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

Unified Diff: cc/output/program_binding.h

Issue 2613903002: The great shader refactor: Move all programs to a common cache (Closed)
Patch Set: Incorporate review feedback Created 3 years, 11 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
« no previous file with comments | « cc/output/gl_renderer_unittest.cc ('k') | cc/output/shader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/program_binding.h
diff --git a/cc/output/program_binding.h b/cc/output/program_binding.h
index 357642db26f1b3cda17ca72953d76e3a7a703224..6887c5ef94a0cb876035c31c86e018508cd2350a 100644
--- a/cc/output/program_binding.h
+++ b/cc/output/program_binding.h
@@ -114,6 +114,23 @@ class CC_EXPORT ProgramKey {
bool has_color_matrix_ = false;
};
+struct ProgramKeyHash {
+ size_t operator()(const ProgramKey& key) const {
+ return (static_cast<size_t>(key.type_) << 0) ^
+ (static_cast<size_t>(key.precision_) << 3) ^
+ (static_cast<size_t>(key.sampler_) << 6) ^
+ (static_cast<size_t>(key.blend_mode_) << 9) ^
+ (static_cast<size_t>(key.aa_mode_) << 15) ^
+ (static_cast<size_t>(key.swizzle_mode_) << 16) ^
+ (static_cast<size_t>(key.is_opaque_) << 17) ^
+ (static_cast<size_t>(key.premultiplied_alpha_) << 19) ^
+ (static_cast<size_t>(key.has_background_color_) << 20) ^
+ (static_cast<size_t>(key.mask_mode_) << 21) ^
+ (static_cast<size_t>(key.mask_for_background_) << 22) ^
+ (static_cast<size_t>(key.has_color_matrix_) << 23);
+ }
+};
+
template <class VertexShader, class FragmentShader>
class ProgramBinding : public ProgramBindingBase {
public:
@@ -151,8 +168,6 @@ class ProgramBinding : public ProgramBindingBase {
InitializeVideoStreamProgram(key);
break;
}
- fragment_shader_.CheckSubclassProperties();
- vertex_shader_.CheckSubclassProperties();
InitializeInternal(context_provider);
}
@@ -172,8 +187,6 @@ class ProgramBinding : public ProgramBindingBase {
fragment_shader_.tex_coord_precision_ = precision;
fragment_shader_.sampler_type_ = sampler;
- fragment_shader_.CheckSubclassProperties();
- vertex_shader_.CheckSubclassProperties();
InitializeInternal(context_provider);
}
@@ -315,6 +328,8 @@ class ProgramBinding : public ProgramBindingBase {
DISALLOW_COPY_AND_ASSIGN(ProgramBinding);
};
+typedef ProgramBinding<VertexShaderBase, FragmentShaderBase> Program;
+
} // namespace cc
#endif // CC_OUTPUT_PROGRAM_BINDING_H_
« no previous file with comments | « cc/output/gl_renderer_unittest.cc ('k') | cc/output/shader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698