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_
10 #include "base/basictypes.h"
11 #include "cc/base/cc_export.h"
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
36 SAMPLER_TYPE_2D_RECT
= 2,
37 SAMPLER_TYPE_EXTERNAL_OES
= 3,
48 BLEND_MODE_COLOR_DODGE
,
49 BLEND_MODE_COLOR_BURN
,
50 BLEND_MODE_HARD_LIGHT
,
51 BLEND_MODE_SOFT_LIGHT
,
52 BLEND_MODE_DIFFERENCE
,
56 BLEND_MODE_SATURATION
,
58 BLEND_MODE_LUMINOSITY
,
59 LAST_BLEND_MODE
= BLEND_MODE_LUMINOSITY
65 LAST_MASK_VALUE
= HAS_MASK
68 struct ShaderLocations
{
75 int mask_sampler
= -1;
76 int mask_tex_coord_scale
= -1;
77 int mask_tex_coord_offset
= -1;
80 int color_matrix
= -1;
81 int color_offset
= -1;
82 int tex_transform
= -1;
84 int backdrop_rect
= -1;
85 int original_backdrop
= -1;
88 // Note: The highp_threshold_cache must be provided by the caller to make
89 // the caching multi-thread/context safe in an easy low-overhead manner.
90 // The caller must make sure to clear highp_threshold_cache to 0, so it can be
91 // reinitialized, if a new or different context is used.
92 CC_EXPORT TexCoordPrecision
93 TexCoordPrecisionRequired(gpu::gles2::GLES2Interface
* context
,
94 int* highp_threshold_cache
,
95 int highp_threshold_min
,
96 const gfx::Point
& max_coordinate
);
98 CC_EXPORT TexCoordPrecision
TexCoordPrecisionRequired(
99 gpu::gles2::GLES2Interface
* context
,
100 int *highp_threshold_cache
,
101 int highp_threshold_min
,
102 const gfx::Size
& max_size
);
104 class VertexShaderPosTex
{
106 VertexShaderPosTex();
108 void Init(gpu::gles2::GLES2Interface
* context
,
110 int* base_uniform_index
);
111 std::string
GetShaderString() const;
112 static std::string
GetShaderHead();
113 static std::string
GetShaderBody();
115 int matrix_location() const { return matrix_location_
; }
118 int matrix_location_
;
120 DISALLOW_COPY_AND_ASSIGN(VertexShaderPosTex
);
123 class VertexShaderPosTexYUVStretchOffset
{
125 VertexShaderPosTexYUVStretchOffset();
127 void Init(gpu::gles2::GLES2Interface
* context
,
129 int* base_uniform_index
);
130 std::string
GetShaderString() const;
131 static std::string
GetShaderHead();
132 static std::string
GetShaderBody();
134 int matrix_location() const { return matrix_location_
; }
135 int tex_scale_location() const { return tex_scale_location_
; }
136 int tex_offset_location() const { return tex_offset_location_
; }
139 int matrix_location_
;
140 int tex_scale_location_
;
141 int tex_offset_location_
;
143 DISALLOW_COPY_AND_ASSIGN(VertexShaderPosTexYUVStretchOffset
);
146 class VertexShaderPos
{
150 void Init(gpu::gles2::GLES2Interface
* context
,
152 int* base_uniform_index
);
153 std::string
GetShaderString() const;
154 static std::string
GetShaderHead();
155 static std::string
GetShaderBody();
157 int matrix_location() const { return matrix_location_
; }
160 int matrix_location_
;
162 DISALLOW_COPY_AND_ASSIGN(VertexShaderPos
);
165 class VertexShaderPosTexIdentity
{
167 void Init(gpu::gles2::GLES2Interface
* context
,
169 int* base_uniform_index
) {}
170 std::string
GetShaderString() const;
171 static std::string
GetShaderHead();
172 static std::string
GetShaderBody();
175 class VertexShaderPosTexTransform
{
177 VertexShaderPosTexTransform();
179 void Init(gpu::gles2::GLES2Interface
* context
,
181 int* base_uniform_index
);
182 std::string
GetShaderString() const;
183 static std::string
GetShaderHead();
184 static std::string
GetShaderBody();
185 void FillLocations(ShaderLocations
* locations
) const;
187 int matrix_location() const { return matrix_location_
; }
188 int tex_transform_location() const { return tex_transform_location_
; }
189 int vertex_opacity_location() const { return vertex_opacity_location_
; }
192 int matrix_location_
;
193 int tex_transform_location_
;
194 int vertex_opacity_location_
;
196 DISALLOW_COPY_AND_ASSIGN(VertexShaderPosTexTransform
);
199 class VertexShaderQuad
{
203 void Init(gpu::gles2::GLES2Interface
* context
,
205 int* base_uniform_index
);
206 std::string
GetShaderString() const;
207 static std::string
GetShaderHead();
208 static std::string
GetShaderBody();
210 int matrix_location() const { return matrix_location_
; }
211 int viewport_location() const { return -1; }
212 int quad_location() const { return quad_location_
; }
213 int edge_location() const { return -1; }
216 int matrix_location_
;
219 DISALLOW_COPY_AND_ASSIGN(VertexShaderQuad
);
222 class VertexShaderQuadAA
{
224 VertexShaderQuadAA();
226 void Init(gpu::gles2::GLES2Interface
* context
,
228 int* base_uniform_index
);
229 std::string
GetShaderString() const;
230 static std::string
GetShaderHead();
231 static std::string
GetShaderBody();
233 int matrix_location() const { return matrix_location_
; }
234 int viewport_location() const { return viewport_location_
; }
235 int quad_location() const { return quad_location_
; }
236 int edge_location() const { return edge_location_
; }
239 int matrix_location_
;
240 int viewport_location_
;
244 DISALLOW_COPY_AND_ASSIGN(VertexShaderQuadAA
);
248 class VertexShaderQuadTexTransformAA
{
250 VertexShaderQuadTexTransformAA();
252 void Init(gpu::gles2::GLES2Interface
* context
,
254 int* base_uniform_index
);
255 std::string
GetShaderString() const;
256 static std::string
GetShaderHead();
257 static std::string
GetShaderBody();
258 void FillLocations(ShaderLocations
* locations
) const;
260 int matrix_location() const { return matrix_location_
; }
261 int viewport_location() const { return viewport_location_
; }
262 int quad_location() const { return quad_location_
; }
263 int edge_location() const { return edge_location_
; }
264 int tex_transform_location() const { return tex_transform_location_
; }
267 int matrix_location_
;
268 int viewport_location_
;
271 int tex_transform_location_
;
273 DISALLOW_COPY_AND_ASSIGN(VertexShaderQuadTexTransformAA
);
276 class VertexShaderTile
{
280 void Init(gpu::gles2::GLES2Interface
* context
,
282 int* base_uniform_index
);
283 std::string
GetShaderString() const;
284 static std::string
GetShaderHead();
285 static std::string
GetShaderBody();
287 int matrix_location() const { return matrix_location_
; }
288 int viewport_location() const { return -1; }
289 int quad_location() const { return quad_location_
; }
290 int edge_location() const { return -1; }
291 int vertex_tex_transform_location() const {
292 return vertex_tex_transform_location_
;
296 int matrix_location_
;
298 int vertex_tex_transform_location_
;
300 DISALLOW_COPY_AND_ASSIGN(VertexShaderTile
);
303 class VertexShaderTileAA
{
305 VertexShaderTileAA();
307 void Init(gpu::gles2::GLES2Interface
* context
,
309 int* base_uniform_index
);
310 std::string
GetShaderString() const;
311 static std::string
GetShaderHead();
312 static std::string
GetShaderBody();
314 int matrix_location() const { return matrix_location_
; }
315 int viewport_location() const { return viewport_location_
; }
316 int quad_location() const { return quad_location_
; }
317 int edge_location() const { return edge_location_
; }
318 int vertex_tex_transform_location() const {
319 return vertex_tex_transform_location_
;
323 int matrix_location_
;
324 int viewport_location_
;
327 int vertex_tex_transform_location_
;
329 DISALLOW_COPY_AND_ASSIGN(VertexShaderTileAA
);
332 class VertexShaderVideoTransform
{
334 VertexShaderVideoTransform();
336 void Init(gpu::gles2::GLES2Interface
* context
,
338 int* base_uniform_index
);
339 std::string
GetShaderString() const;
340 static std::string
GetShaderHead();
341 static std::string
GetShaderBody();
343 int matrix_location() const { return matrix_location_
; }
344 int tex_matrix_location() const { return tex_matrix_location_
; }
347 int matrix_location_
;
348 int tex_matrix_location_
;
350 DISALLOW_COPY_AND_ASSIGN(VertexShaderVideoTransform
);
353 class FragmentTexBlendMode
{
355 int backdrop_location() const { return backdrop_location_
; }
356 int original_backdrop_location() const { return original_backdrop_location_
; }
357 int backdrop_rect_location() const { return backdrop_rect_location_
; }
359 BlendMode
blend_mode() const { return blend_mode_
; }
360 void set_blend_mode(BlendMode blend_mode
) { blend_mode_
= blend_mode
; }
361 bool has_blend_mode() const { return blend_mode_
!= BLEND_MODE_NONE
; }
362 void set_mask_for_background(bool mask_for_background
) {
363 mask_for_background_
= mask_for_background
;
365 bool mask_for_background() const { return mask_for_background_
; }
368 FragmentTexBlendMode();
370 std::string
SetBlendModeFunctions(std::string shader_string
) const;
372 int backdrop_location_
;
373 int original_backdrop_location_
;
374 int backdrop_rect_location_
;
377 BlendMode blend_mode_
;
378 bool mask_for_background_
;
380 std::string
GetHelperFunctions() const;
381 std::string
GetBlendFunction() const;
382 std::string
GetBlendFunctionBodyForRGB() const;
385 class FragmentTexAlphaBinding
: public FragmentTexBlendMode
{
387 FragmentTexAlphaBinding();
389 void Init(gpu::gles2::GLES2Interface
* context
,
391 int* base_uniform_index
);
392 int alpha_location() const { return alpha_location_
; }
393 int fragment_tex_transform_location() const { return -1; }
394 int sampler_location() const { return sampler_location_
; }
397 int sampler_location_
;
400 DISALLOW_COPY_AND_ASSIGN(FragmentTexAlphaBinding
);
403 class FragmentTexColorMatrixAlphaBinding
: public FragmentTexBlendMode
{
405 FragmentTexColorMatrixAlphaBinding();
407 void Init(gpu::gles2::GLES2Interface
* context
,
409 int* base_uniform_index
);
410 int alpha_location() const { return alpha_location_
; }
411 int color_matrix_location() const { return color_matrix_location_
; }
412 int color_offset_location() const { return color_offset_location_
; }
413 int fragment_tex_transform_location() const { return -1; }
414 int sampler_location() const { return sampler_location_
; }
417 int sampler_location_
;
419 int color_matrix_location_
;
420 int color_offset_location_
;
423 class FragmentTexOpaqueBinding
: public FragmentTexBlendMode
{
425 FragmentTexOpaqueBinding();
427 void Init(gpu::gles2::GLES2Interface
* context
,
429 int* base_uniform_index
);
430 int alpha_location() const { return -1; }
431 int fragment_tex_transform_location() const { return -1; }
432 int background_color_location() const { return -1; }
433 int sampler_location() const { return sampler_location_
; }
436 int sampler_location_
;
438 DISALLOW_COPY_AND_ASSIGN(FragmentTexOpaqueBinding
);
441 class FragmentTexBackgroundBinding
: public FragmentTexBlendMode
{
443 FragmentTexBackgroundBinding();
445 void Init(gpu::gles2::GLES2Interface
* context
,
447 int* base_uniform_index
);
448 int background_color_location() const { return background_color_location_
; }
449 int sampler_location() const { return sampler_location_
; }
452 int background_color_location_
;
453 int sampler_location_
;
455 DISALLOW_COPY_AND_ASSIGN(FragmentTexBackgroundBinding
);
458 class FragmentShaderRGBATexVaryingAlpha
: public FragmentTexOpaqueBinding
{
460 std::string
GetShaderString(
461 TexCoordPrecision precision
, SamplerType sampler
) const;
462 static std::string
GetShaderHead();
463 static std::string
GetShaderBody();
466 class FragmentShaderRGBATexPremultiplyAlpha
: public FragmentTexOpaqueBinding
{
468 std::string
GetShaderString(
469 TexCoordPrecision precision
, SamplerType sampler
) const;
470 static std::string
GetShaderHead();
471 static std::string
GetShaderBody();
474 class FragmentShaderTexBackgroundVaryingAlpha
475 : public FragmentTexBackgroundBinding
{
477 std::string
GetShaderString(
478 TexCoordPrecision precision
, SamplerType sampler
) const;
479 static std::string
GetShaderHead();
480 static std::string
GetShaderBody();
483 class FragmentShaderTexBackgroundPremultiplyAlpha
484 : public FragmentTexBackgroundBinding
{
486 std::string
GetShaderString(
487 TexCoordPrecision precision
, SamplerType sampler
) const;
488 static std::string
GetShaderHead();
489 static std::string
GetShaderBody();
492 class FragmentShaderRGBATexAlpha
: public FragmentTexAlphaBinding
{
494 std::string
GetShaderString(
495 TexCoordPrecision precision
, SamplerType sampler
) const;
496 static std::string
GetShaderHead();
497 static std::string
GetShaderBody();
498 void FillLocations(ShaderLocations
* locations
) const;
501 class FragmentShaderRGBATexColorMatrixAlpha
502 : public FragmentTexColorMatrixAlphaBinding
{
504 std::string
GetShaderString(TexCoordPrecision precision
,
505 SamplerType sampler
) const;
506 static std::string
GetShaderHead();
507 static std::string
GetShaderBody();
508 void FillLocations(ShaderLocations
* locations
) const;
511 class FragmentShaderRGBATexOpaque
: public FragmentTexOpaqueBinding
{
513 std::string
GetShaderString(
514 TexCoordPrecision precision
, SamplerType sampler
) const;
515 static std::string
GetShaderHead();
516 static std::string
GetShaderBody();
519 class FragmentShaderRGBATex
: public FragmentTexOpaqueBinding
{
521 std::string
GetShaderString(
522 TexCoordPrecision precision
, SamplerType sampler
) const;
523 static std::string
GetShaderHead();
524 static std::string
GetShaderBody();
527 // Swizzles the red and blue component of sampled texel with alpha.
528 class FragmentShaderRGBATexSwizzleAlpha
: public FragmentTexAlphaBinding
{
530 std::string
GetShaderString(
531 TexCoordPrecision precision
, SamplerType sampler
) const;
532 static std::string
GetShaderHead();
533 static std::string
GetShaderBody();
536 // Swizzles the red and blue component of sampled texel without alpha.
537 class FragmentShaderRGBATexSwizzleOpaque
: public FragmentTexOpaqueBinding
{
539 std::string
GetShaderString(
540 TexCoordPrecision precision
, SamplerType sampler
) const;
541 static std::string
GetShaderHead();
542 static std::string
GetShaderBody();
545 class FragmentShaderRGBATexAlphaAA
: public FragmentTexBlendMode
{
547 FragmentShaderRGBATexAlphaAA();
549 void Init(gpu::gles2::GLES2Interface
* context
,
551 int* base_uniform_index
);
552 std::string
GetShaderString(
553 TexCoordPrecision precision
, SamplerType sampler
) const;
554 static std::string
GetShaderHead();
555 static std::string
GetShaderBody();
556 void FillLocations(ShaderLocations
* locations
) const;
558 int alpha_location() const { return alpha_location_
; }
559 int sampler_location() const { return sampler_location_
; }
562 int sampler_location_
;
565 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaAA
);
568 class FragmentTexClampAlphaAABinding
: public FragmentTexBlendMode
{
570 FragmentTexClampAlphaAABinding();
572 void Init(gpu::gles2::GLES2Interface
* context
,
574 int* base_uniform_index
);
575 int alpha_location() const { return alpha_location_
; }
576 int sampler_location() const { return sampler_location_
; }
577 int fragment_tex_transform_location() const {
578 return fragment_tex_transform_location_
;
582 int sampler_location_
;
584 int fragment_tex_transform_location_
;
586 DISALLOW_COPY_AND_ASSIGN(FragmentTexClampAlphaAABinding
);
589 class FragmentShaderRGBATexClampAlphaAA
590 : public FragmentTexClampAlphaAABinding
{
592 std::string
GetShaderString(
593 TexCoordPrecision precision
, SamplerType sampler
) const;
594 static std::string
GetShaderHead();
595 static std::string
GetShaderBody();
598 // Swizzles the red and blue component of sampled texel.
599 class FragmentShaderRGBATexClampSwizzleAlphaAA
600 : public FragmentTexClampAlphaAABinding
{
602 std::string
GetShaderString(
603 TexCoordPrecision precision
, SamplerType sampler
) const;
604 static std::string
GetShaderHead();
605 static std::string
GetShaderBody();
608 class FragmentShaderRGBATexAlphaMask
: public FragmentTexBlendMode
{
610 FragmentShaderRGBATexAlphaMask();
611 std::string
GetShaderString(
612 TexCoordPrecision precision
, SamplerType sampler
) const;
613 static std::string
GetShaderHead();
614 static std::string
GetShaderBody();
615 void FillLocations(ShaderLocations
* locations
) const;
616 void Init(gpu::gles2::GLES2Interface
* context
,
618 int* base_uniform_index
);
619 int alpha_location() const { return alpha_location_
; }
620 int sampler_location() const { return sampler_location_
; }
621 int mask_sampler_location() const { return mask_sampler_location_
; }
622 int mask_tex_coord_scale_location() const {
623 return mask_tex_coord_scale_location_
;
625 int mask_tex_coord_offset_location() const {
626 return mask_tex_coord_offset_location_
;
630 int sampler_location_
;
631 int mask_sampler_location_
;
633 int mask_tex_coord_scale_location_
;
634 int mask_tex_coord_offset_location_
;
636 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMask
);
639 class FragmentShaderRGBATexAlphaMaskAA
: public FragmentTexBlendMode
{
641 FragmentShaderRGBATexAlphaMaskAA();
642 std::string
GetShaderString(
643 TexCoordPrecision precision
, SamplerType sampler
) const;
644 static std::string
GetShaderHead();
645 static std::string
GetShaderBody();
646 void FillLocations(ShaderLocations
* locations
) const;
647 void Init(gpu::gles2::GLES2Interface
* context
,
649 int* base_uniform_index
);
650 int alpha_location() const { return alpha_location_
; }
651 int sampler_location() const { return sampler_location_
; }
652 int mask_sampler_location() const { return mask_sampler_location_
; }
653 int mask_tex_coord_scale_location() const {
654 return mask_tex_coord_scale_location_
;
656 int mask_tex_coord_offset_location() const {
657 return mask_tex_coord_offset_location_
;
661 int sampler_location_
;
662 int mask_sampler_location_
;
664 int mask_tex_coord_scale_location_
;
665 int mask_tex_coord_offset_location_
;
667 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMaskAA
);
670 class FragmentShaderRGBATexAlphaMaskColorMatrixAA
671 : public FragmentTexBlendMode
{
673 FragmentShaderRGBATexAlphaMaskColorMatrixAA();
674 std::string
GetShaderString(
675 TexCoordPrecision precision
, SamplerType sampler
) const;
676 static std::string
GetShaderHead();
677 static std::string
GetShaderBody();
678 void FillLocations(ShaderLocations
* locations
) const;
679 void Init(gpu::gles2::GLES2Interface
* context
,
681 int* base_uniform_index
);
682 int alpha_location() const { return alpha_location_
; }
683 int sampler_location() const { return sampler_location_
; }
684 int mask_sampler_location() const { return mask_sampler_location_
; }
685 int mask_tex_coord_scale_location() const {
686 return mask_tex_coord_scale_location_
;
688 int mask_tex_coord_offset_location() const {
689 return mask_tex_coord_offset_location_
;
691 int color_matrix_location() const { return color_matrix_location_
; }
692 int color_offset_location() const { return color_offset_location_
; }
695 int sampler_location_
;
696 int mask_sampler_location_
;
698 int mask_tex_coord_scale_location_
;
699 int mask_tex_coord_offset_location_
;
700 int color_matrix_location_
;
701 int color_offset_location_
;
704 class FragmentShaderRGBATexAlphaColorMatrixAA
: public FragmentTexBlendMode
{
706 FragmentShaderRGBATexAlphaColorMatrixAA();
707 std::string
GetShaderString(
708 TexCoordPrecision precision
, SamplerType sampler
) const;
709 static std::string
GetShaderHead();
710 static std::string
GetShaderBody();
711 void FillLocations(ShaderLocations
* locations
) const;
712 void Init(gpu::gles2::GLES2Interface
* context
,
714 int* base_uniform_index
);
715 int alpha_location() const { return alpha_location_
; }
716 int sampler_location() const { return sampler_location_
; }
717 int color_matrix_location() const { return color_matrix_location_
; }
718 int color_offset_location() const { return color_offset_location_
; }
721 int sampler_location_
;
723 int color_matrix_location_
;
724 int color_offset_location_
;
727 class FragmentShaderRGBATexAlphaMaskColorMatrix
: public FragmentTexBlendMode
{
729 FragmentShaderRGBATexAlphaMaskColorMatrix();
730 std::string
GetShaderString(
731 TexCoordPrecision precision
, SamplerType sampler
) const;
732 static std::string
GetShaderHead();
733 static std::string
GetShaderBody();
734 void FillLocations(ShaderLocations
* locations
) const;
735 void Init(gpu::gles2::GLES2Interface
* context
,
737 int* base_uniform_index
);
738 int alpha_location() const { return alpha_location_
; }
739 int sampler_location() const { return sampler_location_
; }
740 int mask_sampler_location() const { return mask_sampler_location_
; }
741 int mask_tex_coord_scale_location() const {
742 return mask_tex_coord_scale_location_
;
744 int mask_tex_coord_offset_location() const {
745 return mask_tex_coord_offset_location_
;
747 int color_matrix_location() const { return color_matrix_location_
; }
748 int color_offset_location() const { return color_offset_location_
; }
751 int sampler_location_
;
752 int mask_sampler_location_
;
754 int mask_tex_coord_scale_location_
;
755 int mask_tex_coord_offset_location_
;
756 int color_matrix_location_
;
757 int color_offset_location_
;
760 class FragmentShaderYUVVideo
: public FragmentTexBlendMode
{
762 FragmentShaderYUVVideo();
763 std::string
GetShaderString(
764 TexCoordPrecision precision
, SamplerType sampler
) const;
765 static std::string
GetShaderHead();
766 static std::string
GetShaderBody();
768 void Init(gpu::gles2::GLES2Interface
* context
,
770 int* base_uniform_index
);
771 int y_texture_location() const { return y_texture_location_
; }
772 int u_texture_location() const { return u_texture_location_
; }
773 int v_texture_location() const { return v_texture_location_
; }
774 int alpha_location() const { return alpha_location_
; }
775 int yuv_matrix_location() const { return yuv_matrix_location_
; }
776 int yuv_adj_location() const { return yuv_adj_location_
; }
777 int clamp_rect_location() const { return clamp_rect_location_
; }
780 int y_texture_location_
;
781 int u_texture_location_
;
782 int v_texture_location_
;
784 int yuv_matrix_location_
;
785 int yuv_adj_location_
;
786 int clamp_rect_location_
;
788 DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVVideo
);
791 class FragmentShaderYUVAVideo
: public FragmentTexBlendMode
{
793 FragmentShaderYUVAVideo();
794 std::string
GetShaderString(
795 TexCoordPrecision precision
, SamplerType sampler
) const;
796 static std::string
GetShaderHead();
797 static std::string
GetShaderBody();
799 void Init(gpu::gles2::GLES2Interface
* context
,
801 int* base_uniform_index
);
803 int y_texture_location() const { return y_texture_location_
; }
804 int u_texture_location() const { return u_texture_location_
; }
805 int v_texture_location() const { return v_texture_location_
; }
806 int a_texture_location() const { return a_texture_location_
; }
807 int alpha_location() const { return alpha_location_
; }
808 int yuv_matrix_location() const { return yuv_matrix_location_
; }
809 int yuv_adj_location() const { return yuv_adj_location_
; }
810 int clamp_rect_location() const { return clamp_rect_location_
; }
813 int y_texture_location_
;
814 int u_texture_location_
;
815 int v_texture_location_
;
816 int a_texture_location_
;
818 int yuv_matrix_location_
;
819 int yuv_adj_location_
;
820 int clamp_rect_location_
;
822 DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVAVideo
);
825 class FragmentShaderColor
: public FragmentTexBlendMode
{
827 FragmentShaderColor();
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
,
835 int* base_uniform_index
);
836 int color_location() const { return color_location_
; }
841 DISALLOW_COPY_AND_ASSIGN(FragmentShaderColor
);
844 class FragmentShaderColorAA
: public FragmentTexBlendMode
{
846 FragmentShaderColorAA();
847 std::string
GetShaderString(
848 TexCoordPrecision precision
, SamplerType sampler
) const;
849 static std::string
GetShaderHead();
850 static std::string
GetShaderBody();
852 void Init(gpu::gles2::GLES2Interface
* context
,
854 int* base_uniform_index
);
855 int color_location() const { return color_location_
; }
860 DISALLOW_COPY_AND_ASSIGN(FragmentShaderColorAA
);
863 class FragmentShaderCheckerboard
: public FragmentTexBlendMode
{
865 FragmentShaderCheckerboard();
866 std::string
GetShaderString(
867 TexCoordPrecision precision
, SamplerType sampler
) const;
868 static std::string
GetShaderHead();
869 static std::string
GetShaderBody();
871 void Init(gpu::gles2::GLES2Interface
* context
,
873 int* base_uniform_index
);
874 int alpha_location() const { return alpha_location_
; }
875 int tex_transform_location() const { return tex_transform_location_
; }
876 int frequency_location() const { return frequency_location_
; }
877 int color_location() const { return color_location_
; }
881 int tex_transform_location_
;
882 int frequency_location_
;
885 DISALLOW_COPY_AND_ASSIGN(FragmentShaderCheckerboard
);
890 #endif // CC_OUTPUT_SHADER_H_