Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Unified Diff: gpu/command_buffer/service/shader_manager.h

Issue 10812002: Bug fixes for getTranslatedShader (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: last fixes Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/service/shader_manager.h
diff --git a/gpu/command_buffer/service/shader_manager.h b/gpu/command_buffer/service/shader_manager.h
index 448dc5a5ebc1ada4dea5ff3111ff17cf42b0d7af..6fc452fd926d7bd71d3a0d931199953cbf812141 100644
--- a/gpu/command_buffer/service/shader_manager.h
+++ b/gpu/command_buffer/service/shader_manager.h
@@ -33,6 +33,13 @@ class GPU_EXPORT ShaderManager {
typedef scoped_refptr<ShaderInfo> Ref;
typedef ShaderTranslator::VariableInfo VariableInfo;
+ enum CompilationStatus {
+ NOT_COMPILED,
+ // We're pending compilation for a cache hit with the program cache.
+ PENDING_DEFERRED_COMPILE,
+ COMPILED
+ };
+
void UpdateSource(const char* source) {
// If the source is flagged as compiled, then store our previous source
// for deferred compile and caching.
@@ -40,7 +47,6 @@ class GPU_EXPORT ShaderManager {
deferred_compilation_source_.reset(source_.release());
}
source_.reset(source ? new std::string(source) : NULL);
- translated_source_.reset(NULL);
}
void UpdateTranslatedSource(const char* translated_source) {
@@ -68,9 +74,8 @@ class GPU_EXPORT ShaderManager {
bool valid, const char* log,
ShaderTranslatorInterface* translator);
- // If the source was actually compiled (compilation wasn't deferred)
- bool source_compiled() const {
- return source_compiled_;
+ CompilationStatus compilation_status() const {
+ return compilation_status_;
}
// The source that was used when the user called CompileShader.
@@ -84,7 +89,9 @@ class GPU_EXPORT ShaderManager {
// Resets our deferred compilation source and stores if the source was
// actually compiled, or if we're expecting a cache hit
void FlagSourceAsCompiled(bool actually_compiled) {
- source_compiled_ = actually_compiled;
+ compilation_status_ = actually_compiled ?
+ COMPILED :
+ PENDING_DEFERRED_COMPILE;
deferred_compilation_source_.reset();
}
@@ -170,9 +177,8 @@ class GPU_EXPORT ShaderManager {
VariableMap attrib_map_;
VariableMap uniform_map_;
- // If the source was actually compiled (otherwise we're deferring
- // compilation because of a possible cache hit)
- bool source_compiled_;
+ // The current compilation status of the shader
+ CompilationStatus compilation_status_;
// Holds on to the source for a deferred compile.
scoped_ptr<std::string> deferred_compilation_source_;
« no previous file with comments | « gpu/command_buffer/service/program_manager_unittest.cc ('k') | gpu/command_buffer/service/shader_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698