ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / cc / output / shader.h
blob93407d4cc892a12bfd375cde7e89514ce6ec8928
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
3 // found in the LICENSE file.
5 #ifndef CC_OUTPUT_SHADER_H_
6 #define CC_OUTPUT_SHADER_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "cc/base/cc_export.h"
13 namespace gfx {
14 class Point;
15 class Size;
18 namespace gpu {
19 namespace gles2 {
20 class GLES2Interface;
24 namespace cc {
26 enum TexCoordPrecision {
27 TEX_COORD_PRECISION_NA = 0,
28 TEX_COORD_PRECISION_MEDIUM = 1,
29 TEX_COORD_PRECISION_HIGH = 2,
30 LAST_TEX_COORD_PRECISION = 2
33 enum SamplerType {
34 SAMPLER_TYPE_NA = 0,
35 SAMPLER_TYPE_2D = 1,
36 SAMPLER_TYPE_2D_RECT = 2,
37 SAMPLER_TYPE_EXTERNAL_OES = 3,
38 LAST_SAMPLER_TYPE = 3
41 enum BlendMode {
42 BLEND_MODE_NONE,
43 BLEND_MODE_NORMAL,
44 BLEND_MODE_SCREEN,
45 BLEND_MODE_OVERLAY,
46 BLEND_MODE_DARKEN,
47 BLEND_MODE_LIGHTEN,
48 BLEND_MODE_COLOR_DODGE,
49 BLEND_MODE_COLOR_BURN,
50 BLEND_MODE_HARD_LIGHT,
51 BLEND_MODE_SOFT_LIGHT,
52 BLEND_MODE_DIFFERENCE,
53 BLEND_MODE_EXCLUSION,
54 BLEND_MODE_MULTIPLY,
55 BLEND_MODE_HUE,
56 BLEND_MODE_SATURATION,
57 BLEND_MODE_COLOR,
58 BLEND_MODE_LUMINOSITY,
59 LAST_BLEND_MODE = BLEND_MODE_LUMINOSITY
62 // Note: The highp_threshold_cache must be provided by the caller to make
63 // the caching multi-thread/context safe in an easy low-overhead manner.
64 // The caller must make sure to clear highp_threshold_cache to 0, so it can be
65 // reinitialized, if a new or different context is used.
66 CC_EXPORT TexCoordPrecision
67 TexCoordPrecisionRequired(gpu::gles2::GLES2Interface* context,
68 int* highp_threshold_cache,
69 int highp_threshold_min,
70 const gfx::Point& max_coordinate);
72 CC_EXPORT TexCoordPrecision TexCoordPrecisionRequired(
73 gpu::gles2::GLES2Interface* context,
74 int *highp_threshold_cache,
75 int highp_threshold_min,
76 const gfx::Size& max_size);
78 class VertexShaderPosTex {
79 public:
80 VertexShaderPosTex();
82 void Init(gpu::gles2::GLES2Interface* context,
83 unsigned program,
84 int* base_uniform_index);
85 std::string GetShaderString() const;
86 static std::string GetShaderHead();
87 static std::string GetShaderBody();
89 int matrix_location() const { return matrix_location_; }
91 private:
92 int matrix_location_;
94 DISALLOW_COPY_AND_ASSIGN(VertexShaderPosTex);
97 class VertexShaderPosTexYUVStretchOffset {
98 public:
99 VertexShaderPosTexYUVStretchOffset();
101 void Init(gpu::gles2::GLES2Interface* context,
102 unsigned program,
103 int* base_uniform_index);
104 std::string GetShaderString() const;
105 static std::string GetShaderHead();
106 static std::string GetShaderBody();
108 int matrix_location() const { return matrix_location_; }
109 int tex_scale_location() const { return tex_scale_location_; }
110 int tex_offset_location() const { return tex_offset_location_; }
112 private:
113 int matrix_location_;
114 int tex_scale_location_;
115 int tex_offset_location_;
117 DISALLOW_COPY_AND_ASSIGN(VertexShaderPosTexYUVStretchOffset);
120 class VertexShaderPos {
121 public:
122 VertexShaderPos();
124 void Init(gpu::gles2::GLES2Interface* context,
125 unsigned program,
126 int* base_uniform_index);
127 std::string GetShaderString() const;
128 static std::string GetShaderHead();
129 static std::string GetShaderBody();
131 int matrix_location() const { return matrix_location_; }
133 private:
134 int matrix_location_;
136 DISALLOW_COPY_AND_ASSIGN(VertexShaderPos);
139 class VertexShaderPosTexIdentity {
140 public:
141 void Init(gpu::gles2::GLES2Interface* context,
142 unsigned program,
143 int* base_uniform_index) {}
144 std::string GetShaderString() const;
145 static std::string GetShaderHead();
146 static std::string GetShaderBody();
149 class VertexShaderPosTexTransform {
150 public:
151 VertexShaderPosTexTransform();
153 void Init(gpu::gles2::GLES2Interface* context,
154 unsigned program,
155 int* base_uniform_index);
156 std::string GetShaderString() const;
157 static std::string GetShaderHead();
158 static std::string GetShaderBody();
160 int matrix_location() const { return matrix_location_; }
161 int tex_transform_location() const { return tex_transform_location_; }
162 int vertex_opacity_location() const { return vertex_opacity_location_; }
164 private:
165 int matrix_location_;
166 int tex_transform_location_;
167 int vertex_opacity_location_;
169 DISALLOW_COPY_AND_ASSIGN(VertexShaderPosTexTransform);
172 class VertexShaderQuad {
173 public:
174 VertexShaderQuad();
176 void Init(gpu::gles2::GLES2Interface* context,
177 unsigned program,
178 int* base_uniform_index);
179 std::string GetShaderString() const;
180 static std::string GetShaderHead();
181 static std::string GetShaderBody();
183 int matrix_location() const { return matrix_location_; }
184 int viewport_location() const { return -1; }
185 int quad_location() const { return quad_location_; }
186 int edge_location() const { return -1; }
188 private:
189 int matrix_location_;
190 int quad_location_;
192 DISALLOW_COPY_AND_ASSIGN(VertexShaderQuad);
195 class VertexShaderQuadAA {
196 public:
197 VertexShaderQuadAA();
199 void Init(gpu::gles2::GLES2Interface* context,
200 unsigned program,
201 int* base_uniform_index);
202 std::string GetShaderString() const;
203 static std::string GetShaderHead();
204 static std::string GetShaderBody();
206 int matrix_location() const { return matrix_location_; }
207 int viewport_location() const { return viewport_location_; }
208 int quad_location() const { return quad_location_; }
209 int edge_location() const { return edge_location_; }
211 private:
212 int matrix_location_;
213 int viewport_location_;
214 int quad_location_;
215 int edge_location_;
217 DISALLOW_COPY_AND_ASSIGN(VertexShaderQuadAA);
221 class VertexShaderQuadTexTransformAA {
222 public:
223 VertexShaderQuadTexTransformAA();
225 void Init(gpu::gles2::GLES2Interface* context,
226 unsigned program,
227 int* base_uniform_index);
228 std::string GetShaderString() const;
229 static std::string GetShaderHead();
230 static std::string GetShaderBody();
232 int matrix_location() const { return matrix_location_; }
233 int viewport_location() const { return viewport_location_; }
234 int quad_location() const { return quad_location_; }
235 int edge_location() const { return edge_location_; }
236 int tex_transform_location() const { return tex_transform_location_; }
238 private:
239 int matrix_location_;
240 int viewport_location_;
241 int quad_location_;
242 int edge_location_;
243 int tex_transform_location_;
245 DISALLOW_COPY_AND_ASSIGN(VertexShaderQuadTexTransformAA);
248 class VertexShaderTile {
249 public:
250 VertexShaderTile();
252 void Init(gpu::gles2::GLES2Interface* context,
253 unsigned program,
254 int* base_uniform_index);
255 std::string GetShaderString() const;
256 static std::string GetShaderHead();
257 static std::string GetShaderBody();
259 int matrix_location() const { return matrix_location_; }
260 int viewport_location() const { return -1; }
261 int quad_location() const { return quad_location_; }
262 int edge_location() const { return -1; }
263 int vertex_tex_transform_location() const {
264 return vertex_tex_transform_location_;
267 private:
268 int matrix_location_;
269 int quad_location_;
270 int vertex_tex_transform_location_;
272 DISALLOW_COPY_AND_ASSIGN(VertexShaderTile);
275 class VertexShaderTileAA {
276 public:
277 VertexShaderTileAA();
279 void Init(gpu::gles2::GLES2Interface* context,
280 unsigned program,
281 int* base_uniform_index);
282 std::string GetShaderString() const;
283 static std::string GetShaderHead();
284 static std::string GetShaderBody();
286 int matrix_location() const { return matrix_location_; }
287 int viewport_location() const { return viewport_location_; }
288 int quad_location() const { return quad_location_; }
289 int edge_location() const { return edge_location_; }
290 int vertex_tex_transform_location() const {
291 return vertex_tex_transform_location_;
294 private:
295 int matrix_location_;
296 int viewport_location_;
297 int quad_location_;
298 int edge_location_;
299 int vertex_tex_transform_location_;
301 DISALLOW_COPY_AND_ASSIGN(VertexShaderTileAA);
304 class VertexShaderVideoTransform {
305 public:
306 VertexShaderVideoTransform();
308 void Init(gpu::gles2::GLES2Interface* context,
309 unsigned program,
310 int* base_uniform_index);
311 std::string GetShaderString() const;
312 static std::string GetShaderHead();
313 static std::string GetShaderBody();
315 int matrix_location() const { return matrix_location_; }
316 int tex_matrix_location() const { return tex_matrix_location_; }
318 private:
319 int matrix_location_;
320 int tex_matrix_location_;
322 DISALLOW_COPY_AND_ASSIGN(VertexShaderVideoTransform);
325 class FragmentTexBlendMode {
326 public:
327 int backdrop_location() const { return backdrop_location_; }
328 int backdrop_rect_location() const { return backdrop_rect_location_; }
330 BlendMode blend_mode() const { return blend_mode_; }
331 void set_blend_mode(BlendMode blend_mode) { blend_mode_ = blend_mode; }
332 bool has_blend_mode() const { return blend_mode_ != BLEND_MODE_NONE; }
334 protected:
335 FragmentTexBlendMode();
337 std::string SetBlendModeFunctions(std::string shader_string) const;
339 int backdrop_location_;
340 int backdrop_rect_location_;
342 private:
343 BlendMode blend_mode_;
345 std::string GetHelperFunctions() const;
346 std::string GetBlendFunction() const;
347 std::string GetBlendFunctionBodyForRGB() const;
350 class FragmentTexAlphaBinding : public FragmentTexBlendMode {
351 public:
352 FragmentTexAlphaBinding();
354 void Init(gpu::gles2::GLES2Interface* context,
355 unsigned program,
356 int* base_uniform_index);
357 int alpha_location() const { return alpha_location_; }
358 int fragment_tex_transform_location() const { return -1; }
359 int sampler_location() const { return sampler_location_; }
361 private:
362 int sampler_location_;
363 int alpha_location_;
365 DISALLOW_COPY_AND_ASSIGN(FragmentTexAlphaBinding);
368 class FragmentTexColorMatrixAlphaBinding : public FragmentTexBlendMode {
369 public:
370 FragmentTexColorMatrixAlphaBinding();
372 void Init(gpu::gles2::GLES2Interface* context,
373 unsigned program,
374 int* base_uniform_index);
375 int alpha_location() const { return alpha_location_; }
376 int color_matrix_location() const { return color_matrix_location_; }
377 int color_offset_location() const { return color_offset_location_; }
378 int fragment_tex_transform_location() const { return -1; }
379 int sampler_location() const { return sampler_location_; }
381 private:
382 int sampler_location_;
383 int alpha_location_;
384 int color_matrix_location_;
385 int color_offset_location_;
388 class FragmentTexOpaqueBinding : public FragmentTexBlendMode {
389 public:
390 FragmentTexOpaqueBinding();
392 void Init(gpu::gles2::GLES2Interface* context,
393 unsigned program,
394 int* base_uniform_index);
395 int alpha_location() const { return -1; }
396 int fragment_tex_transform_location() const { return -1; }
397 int background_color_location() const { return -1; }
398 int sampler_location() const { return sampler_location_; }
400 private:
401 int sampler_location_;
403 DISALLOW_COPY_AND_ASSIGN(FragmentTexOpaqueBinding);
406 class FragmentTexBackgroundBinding : public FragmentTexBlendMode {
407 public:
408 FragmentTexBackgroundBinding();
410 void Init(gpu::gles2::GLES2Interface* context,
411 unsigned program,
412 int* base_uniform_index);
413 int background_color_location() const { return background_color_location_; }
414 int sampler_location() const { return sampler_location_; }
416 private:
417 int background_color_location_;
418 int sampler_location_;
420 DISALLOW_COPY_AND_ASSIGN(FragmentTexBackgroundBinding);
423 class FragmentShaderRGBATexVaryingAlpha : public FragmentTexOpaqueBinding {
424 public:
425 std::string GetShaderString(
426 TexCoordPrecision precision, SamplerType sampler) const;
427 static std::string GetShaderHead();
428 static std::string GetShaderBody();
431 class FragmentShaderRGBATexPremultiplyAlpha : public FragmentTexOpaqueBinding {
432 public:
433 std::string GetShaderString(
434 TexCoordPrecision precision, SamplerType sampler) const;
435 static std::string GetShaderHead();
436 static std::string GetShaderBody();
439 class FragmentShaderTexBackgroundVaryingAlpha
440 : public FragmentTexBackgroundBinding {
441 public:
442 std::string GetShaderString(
443 TexCoordPrecision precision, SamplerType sampler) const;
444 static std::string GetShaderHead();
445 static std::string GetShaderBody();
448 class FragmentShaderTexBackgroundPremultiplyAlpha
449 : public FragmentTexBackgroundBinding {
450 public:
451 std::string GetShaderString(
452 TexCoordPrecision precision, SamplerType sampler) const;
453 static std::string GetShaderHead();
454 static std::string GetShaderBody();
457 class FragmentShaderRGBATexAlpha : public FragmentTexAlphaBinding {
458 public:
459 std::string GetShaderString(
460 TexCoordPrecision precision, SamplerType sampler) const;
461 static std::string GetShaderHead();
462 static std::string GetShaderBody();
465 class FragmentShaderRGBATexColorMatrixAlpha
466 : public FragmentTexColorMatrixAlphaBinding {
467 public:
468 std::string GetShaderString(TexCoordPrecision precision,
469 SamplerType sampler) const;
470 static std::string GetShaderHead();
471 static std::string GetShaderBody();
474 class FragmentShaderRGBATexOpaque : public FragmentTexOpaqueBinding {
475 public:
476 std::string GetShaderString(
477 TexCoordPrecision precision, SamplerType sampler) const;
478 static std::string GetShaderHead();
479 static std::string GetShaderBody();
482 class FragmentShaderRGBATex : public FragmentTexOpaqueBinding {
483 public:
484 std::string GetShaderString(
485 TexCoordPrecision precision, SamplerType sampler) const;
486 static std::string GetShaderHead();
487 static std::string GetShaderBody();
490 // Swizzles the red and blue component of sampled texel with alpha.
491 class FragmentShaderRGBATexSwizzleAlpha : public FragmentTexAlphaBinding {
492 public:
493 std::string GetShaderString(
494 TexCoordPrecision precision, SamplerType sampler) const;
495 static std::string GetShaderHead();
496 static std::string GetShaderBody();
499 // Swizzles the red and blue component of sampled texel without alpha.
500 class FragmentShaderRGBATexSwizzleOpaque : public FragmentTexOpaqueBinding {
501 public:
502 std::string GetShaderString(
503 TexCoordPrecision precision, SamplerType sampler) const;
504 static std::string GetShaderHead();
505 static std::string GetShaderBody();
508 class FragmentShaderRGBATexAlphaAA : public FragmentTexBlendMode {
509 public:
510 FragmentShaderRGBATexAlphaAA();
512 void Init(gpu::gles2::GLES2Interface* context,
513 unsigned program,
514 int* base_uniform_index);
515 std::string GetShaderString(
516 TexCoordPrecision precision, SamplerType sampler) const;
517 static std::string GetShaderHead();
518 static std::string GetShaderBody();
520 int alpha_location() const { return alpha_location_; }
521 int sampler_location() const { return sampler_location_; }
523 private:
524 int sampler_location_;
525 int alpha_location_;
527 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaAA);
530 class FragmentTexClampAlphaAABinding : public FragmentTexBlendMode {
531 public:
532 FragmentTexClampAlphaAABinding();
534 void Init(gpu::gles2::GLES2Interface* context,
535 unsigned program,
536 int* base_uniform_index);
537 int alpha_location() const { return alpha_location_; }
538 int sampler_location() const { return sampler_location_; }
539 int fragment_tex_transform_location() const {
540 return fragment_tex_transform_location_;
543 private:
544 int sampler_location_;
545 int alpha_location_;
546 int fragment_tex_transform_location_;
548 DISALLOW_COPY_AND_ASSIGN(FragmentTexClampAlphaAABinding);
551 class FragmentShaderRGBATexClampAlphaAA
552 : public FragmentTexClampAlphaAABinding {
553 public:
554 std::string GetShaderString(
555 TexCoordPrecision precision, SamplerType sampler) const;
556 static std::string GetShaderHead();
557 static std::string GetShaderBody();
560 // Swizzles the red and blue component of sampled texel.
561 class FragmentShaderRGBATexClampSwizzleAlphaAA
562 : public FragmentTexClampAlphaAABinding {
563 public:
564 std::string GetShaderString(
565 TexCoordPrecision precision, SamplerType sampler) const;
566 static std::string GetShaderHead();
567 static std::string GetShaderBody();
570 class FragmentShaderRGBATexAlphaMask : public FragmentTexBlendMode {
571 public:
572 FragmentShaderRGBATexAlphaMask();
573 std::string GetShaderString(
574 TexCoordPrecision precision, SamplerType sampler) const;
575 static std::string GetShaderHead();
576 static std::string GetShaderBody();
578 void Init(gpu::gles2::GLES2Interface* context,
579 unsigned program,
580 int* base_uniform_index);
581 int alpha_location() const { return alpha_location_; }
582 int sampler_location() const { return sampler_location_; }
583 int mask_sampler_location() const { return mask_sampler_location_; }
584 int mask_tex_coord_scale_location() const {
585 return mask_tex_coord_scale_location_;
587 int mask_tex_coord_offset_location() const {
588 return mask_tex_coord_offset_location_;
591 private:
592 int sampler_location_;
593 int mask_sampler_location_;
594 int alpha_location_;
595 int mask_tex_coord_scale_location_;
596 int mask_tex_coord_offset_location_;
598 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMask);
601 class FragmentShaderRGBATexAlphaMaskAA : public FragmentTexBlendMode {
602 public:
603 FragmentShaderRGBATexAlphaMaskAA();
604 std::string GetShaderString(
605 TexCoordPrecision precision, SamplerType sampler) const;
606 static std::string GetShaderHead();
607 static std::string GetShaderBody();
609 void Init(gpu::gles2::GLES2Interface* context,
610 unsigned program,
611 int* base_uniform_index);
612 int alpha_location() const { return alpha_location_; }
613 int sampler_location() const { return sampler_location_; }
614 int mask_sampler_location() const { return mask_sampler_location_; }
615 int mask_tex_coord_scale_location() const {
616 return mask_tex_coord_scale_location_;
618 int mask_tex_coord_offset_location() const {
619 return mask_tex_coord_offset_location_;
622 private:
623 int sampler_location_;
624 int mask_sampler_location_;
625 int alpha_location_;
626 int mask_tex_coord_scale_location_;
627 int mask_tex_coord_offset_location_;
629 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMaskAA);
632 class FragmentShaderRGBATexAlphaMaskColorMatrixAA
633 : public FragmentTexBlendMode {
634 public:
635 FragmentShaderRGBATexAlphaMaskColorMatrixAA();
636 std::string GetShaderString(
637 TexCoordPrecision precision, SamplerType sampler) const;
638 static std::string GetShaderHead();
639 static std::string GetShaderBody();
641 void Init(gpu::gles2::GLES2Interface* context,
642 unsigned program,
643 int* base_uniform_index);
644 int alpha_location() const { return alpha_location_; }
645 int sampler_location() const { return sampler_location_; }
646 int mask_sampler_location() const { return mask_sampler_location_; }
647 int mask_tex_coord_scale_location() const {
648 return mask_tex_coord_scale_location_;
650 int mask_tex_coord_offset_location() const {
651 return mask_tex_coord_offset_location_;
653 int color_matrix_location() const { return color_matrix_location_; }
654 int color_offset_location() const { return color_offset_location_; }
656 private:
657 int sampler_location_;
658 int mask_sampler_location_;
659 int alpha_location_;
660 int mask_tex_coord_scale_location_;
661 int mask_tex_coord_offset_location_;
662 int color_matrix_location_;
663 int color_offset_location_;
666 class FragmentShaderRGBATexAlphaColorMatrixAA : public FragmentTexBlendMode {
667 public:
668 FragmentShaderRGBATexAlphaColorMatrixAA();
669 std::string GetShaderString(
670 TexCoordPrecision precision, SamplerType sampler) const;
671 static std::string GetShaderHead();
672 static std::string GetShaderBody();
674 void Init(gpu::gles2::GLES2Interface* context,
675 unsigned program,
676 int* base_uniform_index);
677 int alpha_location() const { return alpha_location_; }
678 int sampler_location() const { return sampler_location_; }
679 int color_matrix_location() const { return color_matrix_location_; }
680 int color_offset_location() const { return color_offset_location_; }
682 private:
683 int sampler_location_;
684 int alpha_location_;
685 int color_matrix_location_;
686 int color_offset_location_;
689 class FragmentShaderRGBATexAlphaMaskColorMatrix : public FragmentTexBlendMode {
690 public:
691 FragmentShaderRGBATexAlphaMaskColorMatrix();
692 std::string GetShaderString(
693 TexCoordPrecision precision, SamplerType sampler) const;
694 static std::string GetShaderHead();
695 static std::string GetShaderBody();
697 void Init(gpu::gles2::GLES2Interface* context,
698 unsigned program,
699 int* base_uniform_index);
700 int alpha_location() const { return alpha_location_; }
701 int sampler_location() const { return sampler_location_; }
702 int mask_sampler_location() const { return mask_sampler_location_; }
703 int mask_tex_coord_scale_location() const {
704 return mask_tex_coord_scale_location_;
706 int mask_tex_coord_offset_location() const {
707 return mask_tex_coord_offset_location_;
709 int color_matrix_location() const { return color_matrix_location_; }
710 int color_offset_location() const { return color_offset_location_; }
712 private:
713 int sampler_location_;
714 int mask_sampler_location_;
715 int alpha_location_;
716 int mask_tex_coord_scale_location_;
717 int mask_tex_coord_offset_location_;
718 int color_matrix_location_;
719 int color_offset_location_;
722 class FragmentShaderYUVVideo : public FragmentTexBlendMode {
723 public:
724 FragmentShaderYUVVideo();
725 std::string GetShaderString(
726 TexCoordPrecision precision, SamplerType sampler) const;
727 static std::string GetShaderHead();
728 static std::string GetShaderBody();
730 void Init(gpu::gles2::GLES2Interface* context,
731 unsigned program,
732 int* base_uniform_index);
733 int y_texture_location() const { return y_texture_location_; }
734 int u_texture_location() const { return u_texture_location_; }
735 int v_texture_location() const { return v_texture_location_; }
736 int alpha_location() const { return alpha_location_; }
737 int yuv_matrix_location() const { return yuv_matrix_location_; }
738 int yuv_adj_location() const { return yuv_adj_location_; }
739 int clamp_rect_location() const { return clamp_rect_location_; }
741 private:
742 int y_texture_location_;
743 int u_texture_location_;
744 int v_texture_location_;
745 int alpha_location_;
746 int yuv_matrix_location_;
747 int yuv_adj_location_;
748 int clamp_rect_location_;
750 DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVVideo);
753 class FragmentShaderYUVAVideo : public FragmentTexBlendMode {
754 public:
755 FragmentShaderYUVAVideo();
756 std::string GetShaderString(
757 TexCoordPrecision precision, SamplerType sampler) const;
758 static std::string GetShaderHead();
759 static std::string GetShaderBody();
761 void Init(gpu::gles2::GLES2Interface* context,
762 unsigned program,
763 int* base_uniform_index);
765 int y_texture_location() const { return y_texture_location_; }
766 int u_texture_location() const { return u_texture_location_; }
767 int v_texture_location() const { return v_texture_location_; }
768 int a_texture_location() const { return a_texture_location_; }
769 int alpha_location() const { return alpha_location_; }
770 int yuv_matrix_location() const { return yuv_matrix_location_; }
771 int yuv_adj_location() const { return yuv_adj_location_; }
772 int clamp_rect_location() const { return clamp_rect_location_; }
774 private:
775 int y_texture_location_;
776 int u_texture_location_;
777 int v_texture_location_;
778 int a_texture_location_;
779 int alpha_location_;
780 int yuv_matrix_location_;
781 int yuv_adj_location_;
782 int clamp_rect_location_;
784 DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVAVideo);
787 class FragmentShaderColor : public FragmentTexBlendMode {
788 public:
789 FragmentShaderColor();
790 std::string GetShaderString(
791 TexCoordPrecision precision, SamplerType sampler) const;
792 static std::string GetShaderHead();
793 static std::string GetShaderBody();
795 void Init(gpu::gles2::GLES2Interface* context,
796 unsigned program,
797 int* base_uniform_index);
798 int color_location() const { return color_location_; }
800 private:
801 int color_location_;
803 DISALLOW_COPY_AND_ASSIGN(FragmentShaderColor);
806 class FragmentShaderColorAA : public FragmentTexBlendMode {
807 public:
808 FragmentShaderColorAA();
809 std::string GetShaderString(
810 TexCoordPrecision precision, SamplerType sampler) const;
811 static std::string GetShaderHead();
812 static std::string GetShaderBody();
814 void Init(gpu::gles2::GLES2Interface* context,
815 unsigned program,
816 int* base_uniform_index);
817 int color_location() const { return color_location_; }
819 private:
820 int color_location_;
822 DISALLOW_COPY_AND_ASSIGN(FragmentShaderColorAA);
825 class FragmentShaderCheckerboard : public FragmentTexBlendMode {
826 public:
827 FragmentShaderCheckerboard();
828 std::string GetShaderString(
829 TexCoordPrecision precision, SamplerType sampler) const;
830 static std::string GetShaderHead();
831 static std::string GetShaderBody();
833 void Init(gpu::gles2::GLES2Interface* context,
834 unsigned program,
835 int* base_uniform_index);
836 int alpha_location() const { return alpha_location_; }
837 int tex_transform_location() const { return tex_transform_location_; }
838 int frequency_location() const { return frequency_location_; }
839 int color_location() const { return color_location_; }
841 private:
842 int alpha_location_;
843 int tex_transform_location_;
844 int frequency_location_;
845 int color_location_;
847 DISALLOW_COPY_AND_ASSIGN(FragmentShaderCheckerboard);
850 } // namespace cc
852 #endif // CC_OUTPUT_SHADER_H_