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 ya_tex_scale_location() const { return ya_tex_scale_location_
; }
136 int ya_tex_offset_location() const { return ya_tex_offset_location_
; }
137 int uv_tex_scale_location() const { return uv_tex_scale_location_
; }
138 int uv_tex_offset_location() const { return uv_tex_offset_location_
; }
141 int matrix_location_
;
142 int ya_tex_scale_location_
;
143 int ya_tex_offset_location_
;
144 int uv_tex_scale_location_
;
145 int uv_tex_offset_location_
;
147 DISALLOW_COPY_AND_ASSIGN(VertexShaderPosTexYUVStretchOffset
);
150 class VertexShaderPos
{
154 void Init(gpu::gles2::GLES2Interface
* context
,
156 int* base_uniform_index
);
157 std::string
GetShaderString() const;
158 static std::string
GetShaderHead();
159 static std::string
GetShaderBody();
161 int matrix_location() const { return matrix_location_
; }
164 int matrix_location_
;
166 DISALLOW_COPY_AND_ASSIGN(VertexShaderPos
);
169 class VertexShaderPosTexIdentity
{
171 void Init(gpu::gles2::GLES2Interface
* context
,
173 int* base_uniform_index
) {}
174 std::string
GetShaderString() const;
175 static std::string
GetShaderHead();
176 static std::string
GetShaderBody();
179 class VertexShaderPosTexTransform
{
181 VertexShaderPosTexTransform();
183 void Init(gpu::gles2::GLES2Interface
* context
,
185 int* base_uniform_index
);
186 std::string
GetShaderString() const;
187 static std::string
GetShaderHead();
188 static std::string
GetShaderBody();
189 void FillLocations(ShaderLocations
* locations
) const;
191 int matrix_location() const { return matrix_location_
; }
192 int tex_transform_location() const { return tex_transform_location_
; }
193 int vertex_opacity_location() const { return vertex_opacity_location_
; }
196 int matrix_location_
;
197 int tex_transform_location_
;
198 int vertex_opacity_location_
;
200 DISALLOW_COPY_AND_ASSIGN(VertexShaderPosTexTransform
);
203 class VertexShaderQuad
{
207 void Init(gpu::gles2::GLES2Interface
* context
,
209 int* base_uniform_index
);
210 std::string
GetShaderString() const;
211 static std::string
GetShaderHead();
212 static std::string
GetShaderBody();
214 int matrix_location() const { return matrix_location_
; }
215 int viewport_location() const { return -1; }
216 int quad_location() const { return quad_location_
; }
217 int edge_location() const { return -1; }
220 int matrix_location_
;
223 DISALLOW_COPY_AND_ASSIGN(VertexShaderQuad
);
226 class VertexShaderQuadAA
{
228 VertexShaderQuadAA();
230 void Init(gpu::gles2::GLES2Interface
* context
,
232 int* base_uniform_index
);
233 std::string
GetShaderString() const;
234 static std::string
GetShaderHead();
235 static std::string
GetShaderBody();
237 int matrix_location() const { return matrix_location_
; }
238 int viewport_location() const { return viewport_location_
; }
239 int quad_location() const { return quad_location_
; }
240 int edge_location() const { return edge_location_
; }
243 int matrix_location_
;
244 int viewport_location_
;
248 DISALLOW_COPY_AND_ASSIGN(VertexShaderQuadAA
);
252 class VertexShaderQuadTexTransformAA
{
254 VertexShaderQuadTexTransformAA();
256 void Init(gpu::gles2::GLES2Interface
* context
,
258 int* base_uniform_index
);
259 std::string
GetShaderString() const;
260 static std::string
GetShaderHead();
261 static std::string
GetShaderBody();
262 void FillLocations(ShaderLocations
* locations
) const;
264 int matrix_location() const { return matrix_location_
; }
265 int viewport_location() const { return viewport_location_
; }
266 int quad_location() const { return quad_location_
; }
267 int edge_location() const { return edge_location_
; }
268 int tex_transform_location() const { return tex_transform_location_
; }
271 int matrix_location_
;
272 int viewport_location_
;
275 int tex_transform_location_
;
277 DISALLOW_COPY_AND_ASSIGN(VertexShaderQuadTexTransformAA
);
280 class VertexShaderTile
{
284 void Init(gpu::gles2::GLES2Interface
* context
,
286 int* base_uniform_index
);
287 std::string
GetShaderString() const;
288 static std::string
GetShaderHead();
289 static std::string
GetShaderBody();
291 int matrix_location() const { return matrix_location_
; }
292 int viewport_location() const { return -1; }
293 int quad_location() const { return quad_location_
; }
294 int edge_location() const { return -1; }
295 int vertex_tex_transform_location() const {
296 return vertex_tex_transform_location_
;
300 int matrix_location_
;
302 int vertex_tex_transform_location_
;
304 DISALLOW_COPY_AND_ASSIGN(VertexShaderTile
);
307 class VertexShaderTileAA
{
309 VertexShaderTileAA();
311 void Init(gpu::gles2::GLES2Interface
* context
,
313 int* base_uniform_index
);
314 std::string
GetShaderString() const;
315 static std::string
GetShaderHead();
316 static std::string
GetShaderBody();
318 int matrix_location() const { return matrix_location_
; }
319 int viewport_location() const { return viewport_location_
; }
320 int quad_location() const { return quad_location_
; }
321 int edge_location() const { return edge_location_
; }
322 int vertex_tex_transform_location() const {
323 return vertex_tex_transform_location_
;
327 int matrix_location_
;
328 int viewport_location_
;
331 int vertex_tex_transform_location_
;
333 DISALLOW_COPY_AND_ASSIGN(VertexShaderTileAA
);
336 class VertexShaderVideoTransform
{
338 VertexShaderVideoTransform();
340 void Init(gpu::gles2::GLES2Interface
* context
,
342 int* base_uniform_index
);
343 std::string
GetShaderString() const;
344 static std::string
GetShaderHead();
345 static std::string
GetShaderBody();
347 int matrix_location() const { return matrix_location_
; }
348 int tex_matrix_location() const { return tex_matrix_location_
; }
351 int matrix_location_
;
352 int tex_matrix_location_
;
354 DISALLOW_COPY_AND_ASSIGN(VertexShaderVideoTransform
);
357 class FragmentTexBlendMode
{
359 int backdrop_location() const { return backdrop_location_
; }
360 int original_backdrop_location() const { return original_backdrop_location_
; }
361 int backdrop_rect_location() const { return backdrop_rect_location_
; }
363 BlendMode
blend_mode() const { return blend_mode_
; }
364 void set_blend_mode(BlendMode blend_mode
) { blend_mode_
= blend_mode
; }
365 bool has_blend_mode() const { return blend_mode_
!= BLEND_MODE_NONE
; }
366 void set_mask_for_background(bool mask_for_background
) {
367 mask_for_background_
= mask_for_background
;
369 bool mask_for_background() const { return mask_for_background_
; }
372 FragmentTexBlendMode();
374 std::string
SetBlendModeFunctions(std::string shader_string
) const;
376 int backdrop_location_
;
377 int original_backdrop_location_
;
378 int backdrop_rect_location_
;
381 BlendMode blend_mode_
;
382 bool mask_for_background_
;
384 std::string
GetHelperFunctions() const;
385 std::string
GetBlendFunction() const;
386 std::string
GetBlendFunctionBodyForRGB() const;
389 class FragmentTexAlphaBinding
: public FragmentTexBlendMode
{
391 FragmentTexAlphaBinding();
393 void Init(gpu::gles2::GLES2Interface
* context
,
395 int* base_uniform_index
);
396 int alpha_location() const { return alpha_location_
; }
397 int fragment_tex_transform_location() const { return -1; }
398 int sampler_location() const { return sampler_location_
; }
401 int sampler_location_
;
404 DISALLOW_COPY_AND_ASSIGN(FragmentTexAlphaBinding
);
407 class FragmentTexColorMatrixAlphaBinding
: public FragmentTexBlendMode
{
409 FragmentTexColorMatrixAlphaBinding();
411 void Init(gpu::gles2::GLES2Interface
* context
,
413 int* base_uniform_index
);
414 int alpha_location() const { return alpha_location_
; }
415 int color_matrix_location() const { return color_matrix_location_
; }
416 int color_offset_location() const { return color_offset_location_
; }
417 int fragment_tex_transform_location() const { return -1; }
418 int sampler_location() const { return sampler_location_
; }
421 int sampler_location_
;
423 int color_matrix_location_
;
424 int color_offset_location_
;
427 class FragmentTexOpaqueBinding
: public FragmentTexBlendMode
{
429 FragmentTexOpaqueBinding();
431 void Init(gpu::gles2::GLES2Interface
* context
,
433 int* base_uniform_index
);
434 int alpha_location() const { return -1; }
435 int fragment_tex_transform_location() const { return -1; }
436 int background_color_location() const { return -1; }
437 int sampler_location() const { return sampler_location_
; }
440 int sampler_location_
;
442 DISALLOW_COPY_AND_ASSIGN(FragmentTexOpaqueBinding
);
445 class FragmentTexBackgroundBinding
: public FragmentTexBlendMode
{
447 FragmentTexBackgroundBinding();
449 void Init(gpu::gles2::GLES2Interface
* context
,
451 int* base_uniform_index
);
452 int background_color_location() const { return background_color_location_
; }
453 int sampler_location() const { return sampler_location_
; }
456 int background_color_location_
;
457 int sampler_location_
;
459 DISALLOW_COPY_AND_ASSIGN(FragmentTexBackgroundBinding
);
462 class FragmentShaderRGBATexVaryingAlpha
: public FragmentTexOpaqueBinding
{
464 std::string
GetShaderString(
465 TexCoordPrecision precision
, SamplerType sampler
) const;
466 static std::string
GetShaderHead();
467 static std::string
GetShaderBody();
470 class FragmentShaderRGBATexPremultiplyAlpha
: public FragmentTexOpaqueBinding
{
472 std::string
GetShaderString(
473 TexCoordPrecision precision
, SamplerType sampler
) const;
474 static std::string
GetShaderHead();
475 static std::string
GetShaderBody();
478 class FragmentShaderTexBackgroundVaryingAlpha
479 : public FragmentTexBackgroundBinding
{
481 std::string
GetShaderString(
482 TexCoordPrecision precision
, SamplerType sampler
) const;
483 static std::string
GetShaderHead();
484 static std::string
GetShaderBody();
487 class FragmentShaderTexBackgroundPremultiplyAlpha
488 : public FragmentTexBackgroundBinding
{
490 std::string
GetShaderString(
491 TexCoordPrecision precision
, SamplerType sampler
) const;
492 static std::string
GetShaderHead();
493 static std::string
GetShaderBody();
496 class FragmentShaderRGBATexAlpha
: public FragmentTexAlphaBinding
{
498 std::string
GetShaderString(
499 TexCoordPrecision precision
, SamplerType sampler
) const;
500 static std::string
GetShaderHead();
501 static std::string
GetShaderBody();
502 void FillLocations(ShaderLocations
* locations
) const;
505 class FragmentShaderRGBATexColorMatrixAlpha
506 : public FragmentTexColorMatrixAlphaBinding
{
508 std::string
GetShaderString(TexCoordPrecision precision
,
509 SamplerType sampler
) const;
510 static std::string
GetShaderHead();
511 static std::string
GetShaderBody();
512 void FillLocations(ShaderLocations
* locations
) const;
515 class FragmentShaderRGBATexOpaque
: public FragmentTexOpaqueBinding
{
517 std::string
GetShaderString(
518 TexCoordPrecision precision
, SamplerType sampler
) const;
519 static std::string
GetShaderHead();
520 static std::string
GetShaderBody();
523 class FragmentShaderRGBATex
: public FragmentTexOpaqueBinding
{
525 std::string
GetShaderString(
526 TexCoordPrecision precision
, SamplerType sampler
) const;
527 static std::string
GetShaderHead();
528 static std::string
GetShaderBody();
531 // Swizzles the red and blue component of sampled texel with alpha.
532 class FragmentShaderRGBATexSwizzleAlpha
: public FragmentTexAlphaBinding
{
534 std::string
GetShaderString(
535 TexCoordPrecision precision
, SamplerType sampler
) const;
536 static std::string
GetShaderHead();
537 static std::string
GetShaderBody();
540 // Swizzles the red and blue component of sampled texel without alpha.
541 class FragmentShaderRGBATexSwizzleOpaque
: public FragmentTexOpaqueBinding
{
543 std::string
GetShaderString(
544 TexCoordPrecision precision
, SamplerType sampler
) const;
545 static std::string
GetShaderHead();
546 static std::string
GetShaderBody();
549 class FragmentShaderRGBATexAlphaAA
: public FragmentTexBlendMode
{
551 FragmentShaderRGBATexAlphaAA();
553 void Init(gpu::gles2::GLES2Interface
* context
,
555 int* base_uniform_index
);
556 std::string
GetShaderString(
557 TexCoordPrecision precision
, SamplerType sampler
) const;
558 static std::string
GetShaderHead();
559 static std::string
GetShaderBody();
560 void FillLocations(ShaderLocations
* locations
) const;
562 int alpha_location() const { return alpha_location_
; }
563 int sampler_location() const { return sampler_location_
; }
566 int sampler_location_
;
569 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaAA
);
572 class FragmentTexClampAlphaAABinding
: public FragmentTexBlendMode
{
574 FragmentTexClampAlphaAABinding();
576 void Init(gpu::gles2::GLES2Interface
* context
,
578 int* base_uniform_index
);
579 int alpha_location() const { return alpha_location_
; }
580 int sampler_location() const { return sampler_location_
; }
581 int fragment_tex_transform_location() const {
582 return fragment_tex_transform_location_
;
586 int sampler_location_
;
588 int fragment_tex_transform_location_
;
590 DISALLOW_COPY_AND_ASSIGN(FragmentTexClampAlphaAABinding
);
593 class FragmentShaderRGBATexClampAlphaAA
594 : public FragmentTexClampAlphaAABinding
{
596 std::string
GetShaderString(
597 TexCoordPrecision precision
, SamplerType sampler
) const;
598 static std::string
GetShaderHead();
599 static std::string
GetShaderBody();
602 // Swizzles the red and blue component of sampled texel.
603 class FragmentShaderRGBATexClampSwizzleAlphaAA
604 : public FragmentTexClampAlphaAABinding
{
606 std::string
GetShaderString(
607 TexCoordPrecision precision
, SamplerType sampler
) const;
608 static std::string
GetShaderHead();
609 static std::string
GetShaderBody();
612 class FragmentShaderRGBATexAlphaMask
: public FragmentTexBlendMode
{
614 FragmentShaderRGBATexAlphaMask();
615 std::string
GetShaderString(
616 TexCoordPrecision precision
, SamplerType sampler
) const;
617 static std::string
GetShaderHead();
618 static std::string
GetShaderBody();
619 void FillLocations(ShaderLocations
* locations
) const;
620 void Init(gpu::gles2::GLES2Interface
* context
,
622 int* base_uniform_index
);
623 int alpha_location() const { return alpha_location_
; }
624 int sampler_location() const { return sampler_location_
; }
625 int mask_sampler_location() const { return mask_sampler_location_
; }
626 int mask_tex_coord_scale_location() const {
627 return mask_tex_coord_scale_location_
;
629 int mask_tex_coord_offset_location() const {
630 return mask_tex_coord_offset_location_
;
634 int sampler_location_
;
635 int mask_sampler_location_
;
637 int mask_tex_coord_scale_location_
;
638 int mask_tex_coord_offset_location_
;
640 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMask
);
643 class FragmentShaderRGBATexAlphaMaskAA
: public FragmentTexBlendMode
{
645 FragmentShaderRGBATexAlphaMaskAA();
646 std::string
GetShaderString(
647 TexCoordPrecision precision
, SamplerType sampler
) const;
648 static std::string
GetShaderHead();
649 static std::string
GetShaderBody();
650 void FillLocations(ShaderLocations
* locations
) const;
651 void Init(gpu::gles2::GLES2Interface
* context
,
653 int* base_uniform_index
);
654 int alpha_location() const { return alpha_location_
; }
655 int sampler_location() const { return sampler_location_
; }
656 int mask_sampler_location() const { return mask_sampler_location_
; }
657 int mask_tex_coord_scale_location() const {
658 return mask_tex_coord_scale_location_
;
660 int mask_tex_coord_offset_location() const {
661 return mask_tex_coord_offset_location_
;
665 int sampler_location_
;
666 int mask_sampler_location_
;
668 int mask_tex_coord_scale_location_
;
669 int mask_tex_coord_offset_location_
;
671 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMaskAA
);
674 class FragmentShaderRGBATexAlphaMaskColorMatrixAA
675 : public FragmentTexBlendMode
{
677 FragmentShaderRGBATexAlphaMaskColorMatrixAA();
678 std::string
GetShaderString(
679 TexCoordPrecision precision
, SamplerType sampler
) const;
680 static std::string
GetShaderHead();
681 static std::string
GetShaderBody();
682 void FillLocations(ShaderLocations
* locations
) const;
683 void Init(gpu::gles2::GLES2Interface
* context
,
685 int* base_uniform_index
);
686 int alpha_location() const { return alpha_location_
; }
687 int sampler_location() const { return sampler_location_
; }
688 int mask_sampler_location() const { return mask_sampler_location_
; }
689 int mask_tex_coord_scale_location() const {
690 return mask_tex_coord_scale_location_
;
692 int mask_tex_coord_offset_location() const {
693 return mask_tex_coord_offset_location_
;
695 int color_matrix_location() const { return color_matrix_location_
; }
696 int color_offset_location() const { return color_offset_location_
; }
699 int sampler_location_
;
700 int mask_sampler_location_
;
702 int mask_tex_coord_scale_location_
;
703 int mask_tex_coord_offset_location_
;
704 int color_matrix_location_
;
705 int color_offset_location_
;
708 class FragmentShaderRGBATexAlphaColorMatrixAA
: public FragmentTexBlendMode
{
710 FragmentShaderRGBATexAlphaColorMatrixAA();
711 std::string
GetShaderString(
712 TexCoordPrecision precision
, SamplerType sampler
) const;
713 static std::string
GetShaderHead();
714 static std::string
GetShaderBody();
715 void FillLocations(ShaderLocations
* locations
) const;
716 void Init(gpu::gles2::GLES2Interface
* context
,
718 int* base_uniform_index
);
719 int alpha_location() const { return alpha_location_
; }
720 int sampler_location() const { return sampler_location_
; }
721 int color_matrix_location() const { return color_matrix_location_
; }
722 int color_offset_location() const { return color_offset_location_
; }
725 int sampler_location_
;
727 int color_matrix_location_
;
728 int color_offset_location_
;
731 class FragmentShaderRGBATexAlphaMaskColorMatrix
: public FragmentTexBlendMode
{
733 FragmentShaderRGBATexAlphaMaskColorMatrix();
734 std::string
GetShaderString(
735 TexCoordPrecision precision
, SamplerType sampler
) const;
736 static std::string
GetShaderHead();
737 static std::string
GetShaderBody();
738 void FillLocations(ShaderLocations
* locations
) const;
739 void Init(gpu::gles2::GLES2Interface
* context
,
741 int* base_uniform_index
);
742 int alpha_location() const { return alpha_location_
; }
743 int sampler_location() const { return sampler_location_
; }
744 int mask_sampler_location() const { return mask_sampler_location_
; }
745 int mask_tex_coord_scale_location() const {
746 return mask_tex_coord_scale_location_
;
748 int mask_tex_coord_offset_location() const {
749 return mask_tex_coord_offset_location_
;
751 int color_matrix_location() const { return color_matrix_location_
; }
752 int color_offset_location() const { return color_offset_location_
; }
755 int sampler_location_
;
756 int mask_sampler_location_
;
758 int mask_tex_coord_scale_location_
;
759 int mask_tex_coord_offset_location_
;
760 int color_matrix_location_
;
761 int color_offset_location_
;
764 class FragmentShaderYUVVideo
: public FragmentTexBlendMode
{
766 FragmentShaderYUVVideo();
767 std::string
GetShaderString(
768 TexCoordPrecision precision
, SamplerType sampler
) const;
769 static std::string
GetShaderHead();
770 static std::string
GetShaderBody();
772 void Init(gpu::gles2::GLES2Interface
* context
,
774 int* base_uniform_index
);
775 int y_texture_location() const { return y_texture_location_
; }
776 int u_texture_location() const { return u_texture_location_
; }
777 int v_texture_location() const { return v_texture_location_
; }
778 int alpha_location() const { return alpha_location_
; }
779 int yuv_matrix_location() const { return yuv_matrix_location_
; }
780 int yuv_adj_location() const { return yuv_adj_location_
; }
781 int ya_clamp_rect_location() const { return ya_clamp_rect_location_
; }
782 int uv_clamp_rect_location() const { return uv_clamp_rect_location_
; }
785 int y_texture_location_
;
786 int u_texture_location_
;
787 int v_texture_location_
;
789 int yuv_matrix_location_
;
790 int yuv_adj_location_
;
791 int ya_clamp_rect_location_
;
792 int uv_clamp_rect_location_
;
794 DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVVideo
);
797 class FragmentShaderYUVAVideo
: public FragmentTexBlendMode
{
799 FragmentShaderYUVAVideo();
800 std::string
GetShaderString(
801 TexCoordPrecision precision
, SamplerType sampler
) const;
802 static std::string
GetShaderHead();
803 static std::string
GetShaderBody();
805 void Init(gpu::gles2::GLES2Interface
* context
,
807 int* base_uniform_index
);
809 int y_texture_location() const { return y_texture_location_
; }
810 int u_texture_location() const { return u_texture_location_
; }
811 int v_texture_location() const { return v_texture_location_
; }
812 int a_texture_location() const { return a_texture_location_
; }
813 int alpha_location() const { return alpha_location_
; }
814 int yuv_matrix_location() const { return yuv_matrix_location_
; }
815 int yuv_adj_location() const { return yuv_adj_location_
; }
816 int ya_clamp_rect_location() const { return ya_clamp_rect_location_
; }
817 int uv_clamp_rect_location() const { return uv_clamp_rect_location_
; }
820 int y_texture_location_
;
821 int u_texture_location_
;
822 int v_texture_location_
;
823 int a_texture_location_
;
825 int yuv_matrix_location_
;
826 int yuv_adj_location_
;
827 int ya_clamp_rect_location_
;
828 int uv_clamp_rect_location_
;
830 DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVAVideo
);
833 class FragmentShaderColor
: public FragmentTexBlendMode
{
835 FragmentShaderColor();
836 std::string
GetShaderString(
837 TexCoordPrecision precision
, SamplerType sampler
) const;
838 static std::string
GetShaderHead();
839 static std::string
GetShaderBody();
841 void Init(gpu::gles2::GLES2Interface
* context
,
843 int* base_uniform_index
);
844 int color_location() const { return color_location_
; }
849 DISALLOW_COPY_AND_ASSIGN(FragmentShaderColor
);
852 class FragmentShaderColorAA
: public FragmentTexBlendMode
{
854 FragmentShaderColorAA();
855 std::string
GetShaderString(
856 TexCoordPrecision precision
, SamplerType sampler
) const;
857 static std::string
GetShaderHead();
858 static std::string
GetShaderBody();
860 void Init(gpu::gles2::GLES2Interface
* context
,
862 int* base_uniform_index
);
863 int color_location() const { return color_location_
; }
868 DISALLOW_COPY_AND_ASSIGN(FragmentShaderColorAA
);
873 #endif // CC_OUTPUT_SHADER_H_