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

Unified Diff: cc/output/program_binding.cc

Issue 2628713002: The great shader refactor: Use ProgramKey to initialize shaders (Closed)
Patch Set: 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/program_binding.h ('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.cc
diff --git a/cc/output/program_binding.cc b/cc/output/program_binding.cc
index 836df767ba52dad082c19c0bebd6b2f76533f92d..feccac2a5a4427305ee2c74a646bf426cf0cc4f5 100644
--- a/cc/output/program_binding.cc
+++ b/cc/output/program_binding.cc
@@ -13,6 +13,96 @@ using gpu::gles2::GLES2Interface;
namespace cc {
+ProgramKey::ProgramKey() = default;
+ProgramKey::ProgramKey(const ProgramKey& other) = default;
+ProgramKey::~ProgramKey() = default;
+
+bool ProgramKey::operator==(const ProgramKey& other) const {
+ return type_ == other.type_ && precision_ == other.precision_ &&
+ sampler_ == other.sampler_ && blend_mode_ == other.blend_mode_ &&
+ aa_mode_ == other.aa_mode_ && swizzle_mode_ == other.swizzle_mode_ &&
+ is_opaque_ == other.is_opaque_ &&
+ premultiplied_alpha_ == other.premultiplied_alpha_ &&
+ has_background_color_ == other.has_background_color_ &&
+ mask_mode_ == other.mask_mode_ &&
+ mask_for_background_ == other.mask_for_background_ &&
+ has_color_matrix_ == other.has_color_matrix_;
+}
+
+// static
+ProgramKey ProgramKey::DebugBorder() {
+ ProgramKey result;
+ result.type_ = PROGRAM_TYPE_DEBUG_BORDER;
+ return result;
+}
+
+// static
+ProgramKey ProgramKey::SolidColor(AAMode aa_mode) {
+ ProgramKey result;
+ result.type_ = PROGRAM_TYPE_SOLID_COLOR;
+ result.aa_mode_ = aa_mode;
+ return result;
+}
+
+// static
+ProgramKey ProgramKey::Tile(TexCoordPrecision precision,
+ SamplerType sampler,
+ AAMode aa_mode,
+ SwizzleMode swizzle_mode,
+ bool is_opaque) {
+ ProgramKey result;
+ result.type_ = PROGRAM_TYPE_TILE;
+ result.precision_ = precision;
+ result.sampler_ = sampler;
+ result.aa_mode_ = aa_mode;
+ result.swizzle_mode_ = swizzle_mode;
+ result.is_opaque_ = is_opaque;
+ return result;
+}
+
+// static
+ProgramKey ProgramKey::Texture(TexCoordPrecision precision,
+ SamplerType sampler,
+ PremultipliedAlphaMode premultiplied_alpha,
+ bool has_background_color) {
+ ProgramKey result;
+ result.type_ = PROGRAM_TYPE_TEXTURE;
+ result.precision_ = precision;
+ result.sampler_ = sampler;
+ result.premultiplied_alpha_ = premultiplied_alpha;
+ result.has_background_color_ = has_background_color;
+ return result;
+}
+
+// static
+ProgramKey ProgramKey::RenderPass(TexCoordPrecision precision,
+ SamplerType sampler,
+ BlendMode blend_mode,
+ AAMode aa_mode,
+ MaskMode mask_mode,
+ bool mask_for_background,
+ bool has_color_matrix) {
+ ProgramKey result;
+ result.type_ = PROGRAM_TYPE_RENDER_PASS;
+ result.precision_ = precision;
+ result.sampler_ = sampler;
+ result.blend_mode_ = blend_mode;
+ result.aa_mode_ = aa_mode;
+ result.mask_mode_ = mask_mode;
+ result.mask_for_background_ = mask_for_background;
+ result.has_color_matrix_ = has_color_matrix;
+ return result;
+}
+
+// static
+ProgramKey ProgramKey::VideoStream(TexCoordPrecision precision) {
+ ProgramKey result;
+ result.type_ = PROGRAM_TYPE_VIDEO_STREAM;
+ result.precision_ = precision;
+ result.sampler_ = SAMPLER_TYPE_EXTERNAL_OES;
+ return result;
+}
+
ProgramBindingBase::ProgramBindingBase()
: program_(0),
vertex_shader_id_(0),
« no previous file with comments | « cc/output/program_binding.h ('k') | cc/output/shader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698