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

Side by Side Diff: cc/output/program_binding.h

Issue 2697253002: color: Add support for shader generation (Closed)
Patch Set: More bits of precision Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « cc/output/gl_renderer.cc ('k') | cc/output/program_binding.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_OUTPUT_PROGRAM_BINDING_H_ 5 #ifndef CC_OUTPUT_PROGRAM_BINDING_H_
6 #define CC_OUTPUT_PROGRAM_BINDING_H_ 6 #define CC_OUTPUT_PROGRAM_BINDING_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "cc/output/context_provider.h" 12 #include "cc/output/context_provider.h"
13 #include "cc/output/shader.h" 13 #include "cc/output/shader.h"
14 14
15 namespace gfx {
16 class ColorTransform;
17 }
18
15 namespace gpu { 19 namespace gpu {
16 namespace gles2 { 20 namespace gles2 {
17 class GLES2Interface; 21 class GLES2Interface;
18 } 22 }
19 } 23 }
20 24
21 namespace cc { 25 namespace cc {
22 26
23 class ProgramBindingBase { 27 class ProgramBindingBase {
24 public: 28 public:
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 bool has_color_matrix); 96 bool has_color_matrix);
93 static ProgramKey VideoStream(TexCoordPrecision precision); 97 static ProgramKey VideoStream(TexCoordPrecision precision);
94 static ProgramKey YUVVideo(TexCoordPrecision precision, 98 static ProgramKey YUVVideo(TexCoordPrecision precision,
95 SamplerType sampler, 99 SamplerType sampler,
96 YUVAlphaTextureMode yuv_alpha_texture_mode, 100 YUVAlphaTextureMode yuv_alpha_texture_mode,
97 UVTextureMode uv_texture_mode); 101 UVTextureMode uv_texture_mode);
98 102
99 bool operator==(const ProgramKey& other) const; 103 bool operator==(const ProgramKey& other) const;
100 bool operator!=(const ProgramKey& other) const; 104 bool operator!=(const ProgramKey& other) const;
101 105
102 void SetColorConversionMode(ColorConversionMode color_conversion_mode) { 106 void SetColorTransform(const gfx::ColorTransform* transform);
103 color_conversion_mode_ = color_conversion_mode;
104 }
105 107
106 private: 108 private:
107 friend struct ProgramKeyHash; 109 friend struct ProgramKeyHash;
108 friend class Program; 110 friend class Program;
109 111
110 ProgramType type_ = PROGRAM_TYPE_DEBUG_BORDER; 112 ProgramType type_ = PROGRAM_TYPE_DEBUG_BORDER;
111 TexCoordPrecision precision_ = TEX_COORD_PRECISION_NA; 113 TexCoordPrecision precision_ = TEX_COORD_PRECISION_NA;
112 SamplerType sampler_ = SAMPLER_TYPE_NA; 114 SamplerType sampler_ = SAMPLER_TYPE_NA;
113 BlendMode blend_mode_ = BLEND_MODE_NONE; 115 BlendMode blend_mode_ = BLEND_MODE_NONE;
114 AAMode aa_mode_ = NO_AA; 116 AAMode aa_mode_ = NO_AA;
115 SwizzleMode swizzle_mode_ = NO_SWIZZLE; 117 SwizzleMode swizzle_mode_ = NO_SWIZZLE;
116 bool is_opaque_ = false; 118 bool is_opaque_ = false;
117 119
118 PremultipliedAlphaMode premultiplied_alpha_ = PREMULTIPLIED_ALPHA; 120 PremultipliedAlphaMode premultiplied_alpha_ = PREMULTIPLIED_ALPHA;
119 bool has_background_color_ = false; 121 bool has_background_color_ = false;
120 122
121 MaskMode mask_mode_ = NO_MASK; 123 MaskMode mask_mode_ = NO_MASK;
122 bool mask_for_background_ = false; 124 bool mask_for_background_ = false;
123 bool has_color_matrix_ = false; 125 bool has_color_matrix_ = false;
124 126
125 YUVAlphaTextureMode yuv_alpha_texture_mode_ = YUV_NO_ALPHA_TEXTURE; 127 YUVAlphaTextureMode yuv_alpha_texture_mode_ = YUV_NO_ALPHA_TEXTURE;
126 UVTextureMode uv_texture_mode_ = UV_TEXTURE_MODE_NA; 128 UVTextureMode uv_texture_mode_ = UV_TEXTURE_MODE_NA;
127 129
128 ColorConversionMode color_conversion_mode_ = COLOR_CONVERSION_MODE_NONE; 130 ColorConversionMode color_conversion_mode_ = COLOR_CONVERSION_MODE_NONE;
131 const gfx::ColorTransform* color_transform_ = nullptr;
129 }; 132 };
130 133
131 struct ProgramKeyHash { 134 struct ProgramKeyHash {
132 size_t operator()(const ProgramKey& key) const { 135 size_t operator()(const ProgramKey& key) const {
133 return (static_cast<size_t>(key.type_) << 0) ^ 136 return (static_cast<size_t>(key.type_) << 0) ^
134 (static_cast<size_t>(key.precision_) << 3) ^ 137 (static_cast<size_t>(key.precision_) << 3) ^
135 (static_cast<size_t>(key.sampler_) << 6) ^ 138 (static_cast<size_t>(key.sampler_) << 6) ^
136 (static_cast<size_t>(key.blend_mode_) << 9) ^ 139 (static_cast<size_t>(key.blend_mode_) << 9) ^
137 (static_cast<size_t>(key.aa_mode_) << 15) ^ 140 (static_cast<size_t>(key.aa_mode_) << 15) ^
138 (static_cast<size_t>(key.swizzle_mode_) << 16) ^ 141 (static_cast<size_t>(key.swizzle_mode_) << 16) ^
(...skipping 18 matching lines...) Expand all
157 vertex_shader_.aa_mode_ = key.aa_mode_; 160 vertex_shader_.aa_mode_ = key.aa_mode_;
158 fragment_shader_.aa_mode_ = key.aa_mode_; 161 fragment_shader_.aa_mode_ = key.aa_mode_;
159 fragment_shader_.blend_mode_ = key.blend_mode_; 162 fragment_shader_.blend_mode_ = key.blend_mode_;
160 fragment_shader_.tex_coord_precision_ = key.precision_; 163 fragment_shader_.tex_coord_precision_ = key.precision_;
161 fragment_shader_.sampler_type_ = key.sampler_; 164 fragment_shader_.sampler_type_ = key.sampler_;
162 fragment_shader_.swizzle_mode_ = key.swizzle_mode_; 165 fragment_shader_.swizzle_mode_ = key.swizzle_mode_;
163 fragment_shader_.premultiply_alpha_mode_ = key.premultiplied_alpha_; 166 fragment_shader_.premultiply_alpha_mode_ = key.premultiplied_alpha_;
164 fragment_shader_.mask_mode_ = key.mask_mode_; 167 fragment_shader_.mask_mode_ = key.mask_mode_;
165 fragment_shader_.mask_for_background_ = key.mask_for_background_; 168 fragment_shader_.mask_for_background_ = key.mask_for_background_;
166 fragment_shader_.color_conversion_mode_ = key.color_conversion_mode_; 169 fragment_shader_.color_conversion_mode_ = key.color_conversion_mode_;
170 fragment_shader_.color_transform_ = key.color_transform_;
167 171
168 switch (key.type_) { 172 switch (key.type_) {
169 case PROGRAM_TYPE_DEBUG_BORDER: 173 case PROGRAM_TYPE_DEBUG_BORDER:
170 InitializeDebugBorderProgram(); 174 InitializeDebugBorderProgram();
171 break; 175 break;
172 case PROGRAM_TYPE_SOLID_COLOR: 176 case PROGRAM_TYPE_SOLID_COLOR:
173 InitializeSolidColorProgram(key); 177 InitializeSolidColorProgram(key);
174 break; 178 break;
175 case PROGRAM_TYPE_TILE: 179 case PROGRAM_TYPE_TILE:
176 InitializeTileProgram(key); 180 InitializeTileProgram(key);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 int uv_texture_location() const { 268 int uv_texture_location() const {
265 return fragment_shader_.uv_texture_location_; 269 return fragment_shader_.uv_texture_location_;
266 } 270 }
267 int a_texture_location() const { 271 int a_texture_location() const {
268 return fragment_shader_.a_texture_location_; 272 return fragment_shader_.a_texture_location_;
269 } 273 }
270 int lut_texture_location() const { 274 int lut_texture_location() const {
271 return fragment_shader_.lut_texture_location_; 275 return fragment_shader_.lut_texture_location_;
272 } 276 }
273 int lut_size_location() const { return fragment_shader_.lut_size_location_; } 277 int lut_size_location() const { return fragment_shader_.lut_size_location_; }
274 int yuv_and_resource_matrix_location() const { 278 int resource_multiplier_location() const {
275 return fragment_shader_.yuv_and_resource_matrix_location_; 279 return fragment_shader_.resource_multiplier_location_;
280 }
281 int resource_offset_location() const {
282 return fragment_shader_.resource_offset_location_;
276 } 283 }
277 int ya_clamp_rect_location() const { 284 int ya_clamp_rect_location() const {
278 return fragment_shader_.ya_clamp_rect_location_; 285 return fragment_shader_.ya_clamp_rect_location_;
279 } 286 }
280 int uv_clamp_rect_location() const { 287 int uv_clamp_rect_location() const {
281 return fragment_shader_.uv_clamp_rect_location_; 288 return fragment_shader_.uv_clamp_rect_location_;
282 } 289 }
283 290
284 private: 291 private:
285 void InitializeDebugBorderProgram() { 292 void InitializeDebugBorderProgram() {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 427
421 VertexShader vertex_shader_; 428 VertexShader vertex_shader_;
422 FragmentShader fragment_shader_; 429 FragmentShader fragment_shader_;
423 430
424 DISALLOW_COPY_AND_ASSIGN(Program); 431 DISALLOW_COPY_AND_ASSIGN(Program);
425 }; 432 };
426 433
427 } // namespace cc 434 } // namespace cc
428 435
429 #endif // CC_OUTPUT_PROGRAM_BINDING_H_ 436 #endif // CC_OUTPUT_PROGRAM_BINDING_H_
OLDNEW
« no previous file with comments | « cc/output/gl_renderer.cc ('k') | cc/output/program_binding.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698