OLD | NEW |
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" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 fragment_shader_.use_color_lut_ = use_color_lut; | 186 fragment_shader_.use_color_lut_ = use_color_lut; |
187 fragment_shader_.tex_coord_precision_ = precision; | 187 fragment_shader_.tex_coord_precision_ = precision; |
188 fragment_shader_.sampler_type_ = sampler; | 188 fragment_shader_.sampler_type_ = sampler; |
189 | 189 |
190 InitializeInternal(context_provider); | 190 InitializeInternal(context_provider); |
191 } | 191 } |
192 | 192 |
193 const VertexShader& vertex_shader() const { return vertex_shader_; } | 193 const VertexShader& vertex_shader() const { return vertex_shader_; } |
194 const FragmentShader& fragment_shader() const { return fragment_shader_; } | 194 const FragmentShader& fragment_shader() const { return fragment_shader_; } |
195 | 195 |
| 196 // Functions for querying uniform locations. |
| 197 int vertex_tex_transform_location() const { |
| 198 return vertex_shader_.vertex_tex_transform_location_; |
| 199 } |
| 200 int tex_matrix_location() const { |
| 201 return vertex_shader_.tex_matrix_location_; |
| 202 } |
| 203 int ya_tex_scale_location() const { |
| 204 return vertex_shader_.ya_tex_scale_location_; |
| 205 } |
| 206 int ya_tex_offset_location() const { |
| 207 return vertex_shader_.ya_tex_offset_location_; |
| 208 } |
| 209 int uv_tex_scale_location() const { |
| 210 return vertex_shader_.uv_tex_scale_location_; |
| 211 } |
| 212 int uv_tex_offset_location() const { |
| 213 return vertex_shader_.uv_tex_offset_location_; |
| 214 } |
| 215 int matrix_location() const { return vertex_shader_.matrix_location_; } |
| 216 int vertex_opacity_location() const { |
| 217 return vertex_shader_.vertex_opacity_location_; |
| 218 } |
| 219 int viewport_location() const { return vertex_shader_.viewport_location_; } |
| 220 int edge_location() const { return vertex_shader_.edge_location_; } |
| 221 int quad_location() const { return vertex_shader_.quad_location_; } |
| 222 |
| 223 int sampler_location() const { return fragment_shader_.sampler_location_; } |
| 224 int alpha_location() const { return fragment_shader_.alpha_location_; } |
| 225 int color_location() const { return fragment_shader_.color_location_; } |
| 226 int background_color_location() const { |
| 227 return fragment_shader_.background_color_location_; |
| 228 } |
| 229 int fragment_tex_transform_location() const { |
| 230 return fragment_shader_.fragment_tex_transform_location_; |
| 231 } |
| 232 int backdrop_location() const { return fragment_shader_.backdrop_location_; } |
| 233 int backdrop_rect_location() const { |
| 234 return fragment_shader_.backdrop_rect_location_; |
| 235 } |
| 236 int original_backdrop_location() const { |
| 237 return fragment_shader_.original_backdrop_location_; |
| 238 } |
| 239 int mask_sampler_location() const { |
| 240 return fragment_shader_.mask_sampler_location_; |
| 241 } |
| 242 int mask_tex_coord_scale_location() const { |
| 243 return fragment_shader_.mask_tex_coord_scale_location_; |
| 244 } |
| 245 int mask_tex_coord_offset_location() const { |
| 246 return fragment_shader_.mask_tex_coord_offset_location_; |
| 247 } |
| 248 int color_matrix_location() const { |
| 249 return fragment_shader_.color_matrix_location_; |
| 250 } |
| 251 int color_offset_location() const { |
| 252 return fragment_shader_.color_offset_location_; |
| 253 } |
| 254 |
196 private: | 255 private: |
197 void InitializeDebugBorderProgram() { | 256 void InitializeDebugBorderProgram() { |
198 // Initialize vertex program. | 257 // Initialize vertex program. |
199 vertex_shader_.has_matrix_ = true; | 258 vertex_shader_.has_matrix_ = true; |
200 | 259 |
201 // Initialize fragment program. | 260 // Initialize fragment program. |
202 fragment_shader_.input_color_type_ = INPUT_COLOR_SOURCE_UNIFORM; | 261 fragment_shader_.input_color_type_ = INPUT_COLOR_SOURCE_UNIFORM; |
203 fragment_shader_.frag_color_mode_ = FRAG_COLOR_MODE_DEFAULT; | 262 fragment_shader_.frag_color_mode_ = FRAG_COLOR_MODE_DEFAULT; |
204 } | 263 } |
205 | 264 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 FragmentShader fragment_shader_; | 385 FragmentShader fragment_shader_; |
327 | 386 |
328 DISALLOW_COPY_AND_ASSIGN(ProgramBinding); | 387 DISALLOW_COPY_AND_ASSIGN(ProgramBinding); |
329 }; | 388 }; |
330 | 389 |
331 typedef ProgramBinding<VertexShaderBase, FragmentShaderBase> Program; | 390 typedef ProgramBinding<VertexShaderBase, FragmentShaderBase> Program; |
332 | 391 |
333 } // namespace cc | 392 } // namespace cc |
334 | 393 |
335 #endif // CC_OUTPUT_PROGRAM_BINDING_H_ | 394 #endif // CC_OUTPUT_PROGRAM_BINDING_H_ |
OLD | NEW |