• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 
5 #ifndef CC_OUTPUT_SHADER_H_
6 #define CC_OUTPUT_SHADER_H_
7 
8 #include <string>
9 
10 #include "base/basictypes.h"
11 #include "cc/base/cc_export.h"
12 #include "third_party/skia/include/core/SkColorPriv.h"
13 
14 namespace gfx {
15 class Point;
16 class Size;
17 }
18 
19 namespace gpu {
20 namespace gles2 {
21 class GLES2Interface;
22 }
23 }
24 
25 namespace cc {
26 
27 enum TexCoordPrecision {
28   TexCoordPrecisionNA = 0,
29   TexCoordPrecisionMedium = 1,
30   TexCoordPrecisionHigh = 2,
31   NumTexCoordPrecisions = 3
32 };
33 
34 enum SamplerType {
35   SamplerTypeNA = 0,
36   SamplerType2D = 1,
37   SamplerType2DRect = 2,
38   SamplerTypeExternalOES = 3,
39   NumSamplerTypes = 4
40 };
41 
42 // Note: The highp_threshold_cache must be provided by the caller to make
43 // the caching multi-thread/context safe in an easy low-overhead manner.
44 // The caller must make sure to clear highp_threshold_cache to 0, so it can be
45 // reinitialized, if a new or different context is used.
46 CC_EXPORT TexCoordPrecision
47     TexCoordPrecisionRequired(gpu::gles2::GLES2Interface* context,
48                               int* highp_threshold_cache,
49                               int highp_threshold_min,
50                               const gfx::Point& max_coordinate);
51 
52 CC_EXPORT TexCoordPrecision TexCoordPrecisionRequired(
53     gpu::gles2::GLES2Interface* context,
54     int *highp_threshold_cache,
55     int highp_threshold_min,
56     const gfx::Size& max_size);
57 
58 class VertexShaderPosTex {
59  public:
60   VertexShaderPosTex();
61 
62   void Init(gpu::gles2::GLES2Interface* context,
63             unsigned program,
64             int* base_uniform_index);
65   std::string GetShaderString() const;
66 
matrix_location()67   int matrix_location() const { return matrix_location_; }
68 
69  private:
70   int matrix_location_;
71 
72   DISALLOW_COPY_AND_ASSIGN(VertexShaderPosTex);
73 };
74 
75 class VertexShaderPosTexYUVStretchOffset {
76  public:
77   VertexShaderPosTexYUVStretchOffset();
78 
79   void Init(gpu::gles2::GLES2Interface* context,
80             unsigned program,
81             int* base_uniform_index);
82   std::string GetShaderString() const;
83 
matrix_location()84   int matrix_location() const { return matrix_location_; }
tex_scale_location()85   int tex_scale_location() const { return tex_scale_location_; }
tex_offset_location()86   int tex_offset_location() const { return tex_offset_location_; }
87 
88  private:
89   int matrix_location_;
90   int tex_scale_location_;
91   int tex_offset_location_;
92 
93   DISALLOW_COPY_AND_ASSIGN(VertexShaderPosTexYUVStretchOffset);
94 };
95 
96 class VertexShaderPos {
97  public:
98   VertexShaderPos();
99 
100   void Init(gpu::gles2::GLES2Interface* context,
101             unsigned program,
102             int* base_uniform_index);
103   std::string GetShaderString() const;
104 
matrix_location()105   int matrix_location() const { return matrix_location_; }
106 
107  private:
108   int matrix_location_;
109 
110   DISALLOW_COPY_AND_ASSIGN(VertexShaderPos);
111 };
112 
113 class VertexShaderPosTexIdentity {
114  public:
Init(gpu::gles2::GLES2Interface * context,unsigned program,int * base_uniform_index)115   void Init(gpu::gles2::GLES2Interface* context,
116             unsigned program,
117             int* base_uniform_index) {}
118   std::string GetShaderString() const;
119 };
120 
121 class VertexShaderPosTexTransform {
122  public:
123   VertexShaderPosTexTransform();
124 
125   void Init(gpu::gles2::GLES2Interface* context,
126             unsigned program,
127             int* base_uniform_index);
128   std::string GetShaderString() const;
129 
matrix_location()130   int matrix_location() const { return matrix_location_; }
tex_transform_location()131   int tex_transform_location() const { return tex_transform_location_; }
vertex_opacity_location()132   int vertex_opacity_location() const { return vertex_opacity_location_; }
133 
134  private:
135   int matrix_location_;
136   int tex_transform_location_;
137   int vertex_opacity_location_;
138 
139   DISALLOW_COPY_AND_ASSIGN(VertexShaderPosTexTransform);
140 };
141 
142 class VertexShaderQuad {
143  public:
144   VertexShaderQuad();
145 
146   void Init(gpu::gles2::GLES2Interface* context,
147            unsigned program,
148            int* base_uniform_index);
149   std::string GetShaderString() const;
150 
matrix_location()151   int matrix_location() const { return matrix_location_; }
viewport_location()152   int viewport_location() const { return -1; }
quad_location()153   int quad_location() const { return quad_location_; }
edge_location()154   int edge_location() const { return -1; }
155 
156  private:
157   int matrix_location_;
158   int quad_location_;
159 
160   DISALLOW_COPY_AND_ASSIGN(VertexShaderQuad);
161 };
162 
163 class VertexShaderQuadAA {
164  public:
165   VertexShaderQuadAA();
166 
167   void Init(gpu::gles2::GLES2Interface* context,
168            unsigned program,
169            int* base_uniform_index);
170   std::string GetShaderString() const;
171 
matrix_location()172   int matrix_location() const { return matrix_location_; }
viewport_location()173   int viewport_location() const { return viewport_location_; }
quad_location()174   int quad_location() const { return quad_location_; }
edge_location()175   int edge_location() const { return edge_location_; }
176 
177  private:
178   int matrix_location_;
179   int viewport_location_;
180   int quad_location_;
181   int edge_location_;
182 
183   DISALLOW_COPY_AND_ASSIGN(VertexShaderQuadAA);
184 };
185 
186 
187 class VertexShaderQuadTexTransformAA {
188  public:
189   VertexShaderQuadTexTransformAA();
190 
191   void Init(gpu::gles2::GLES2Interface* context,
192            unsigned program,
193            int* base_uniform_index);
194   std::string GetShaderString() const;
195 
matrix_location()196   int matrix_location() const { return matrix_location_; }
viewport_location()197   int viewport_location() const { return viewport_location_; }
quad_location()198   int quad_location() const { return quad_location_; }
edge_location()199   int edge_location() const { return edge_location_; }
tex_transform_location()200   int tex_transform_location() const { return tex_transform_location_; }
201 
202  private:
203   int matrix_location_;
204   int viewport_location_;
205   int quad_location_;
206   int edge_location_;
207   int tex_transform_location_;
208 
209   DISALLOW_COPY_AND_ASSIGN(VertexShaderQuadTexTransformAA);
210 };
211 
212 class VertexShaderTile {
213  public:
214   VertexShaderTile();
215 
216   void Init(gpu::gles2::GLES2Interface* context,
217             unsigned program,
218             int* base_uniform_index);
219   std::string GetShaderString() const;
220 
matrix_location()221   int matrix_location() const { return matrix_location_; }
viewport_location()222   int viewport_location() const { return -1; }
quad_location()223   int quad_location() const { return quad_location_; }
edge_location()224   int edge_location() const { return -1; }
vertex_tex_transform_location()225   int vertex_tex_transform_location() const {
226     return vertex_tex_transform_location_;
227   }
228 
229  private:
230   int matrix_location_;
231   int quad_location_;
232   int vertex_tex_transform_location_;
233 
234   DISALLOW_COPY_AND_ASSIGN(VertexShaderTile);
235 };
236 
237 class VertexShaderTileAA {
238  public:
239   VertexShaderTileAA();
240 
241   void Init(gpu::gles2::GLES2Interface* context,
242             unsigned program,
243             int* base_uniform_index);
244   std::string GetShaderString() const;
245 
matrix_location()246   int matrix_location() const { return matrix_location_; }
viewport_location()247   int viewport_location() const { return viewport_location_; }
quad_location()248   int quad_location() const { return quad_location_; }
edge_location()249   int edge_location() const { return edge_location_; }
vertex_tex_transform_location()250   int vertex_tex_transform_location() const {
251     return vertex_tex_transform_location_;
252   }
253 
254  private:
255   int matrix_location_;
256   int viewport_location_;
257   int quad_location_;
258   int edge_location_;
259   int vertex_tex_transform_location_;
260 
261   DISALLOW_COPY_AND_ASSIGN(VertexShaderTileAA);
262 };
263 
264 class VertexShaderVideoTransform {
265  public:
266   VertexShaderVideoTransform();
267 
268   void Init(gpu::gles2::GLES2Interface* context,
269             unsigned program,
270             int* base_uniform_index);
271   std::string GetShaderString() const;
272 
matrix_location()273   int matrix_location() const { return matrix_location_; }
tex_matrix_location()274   int tex_matrix_location() const { return tex_matrix_location_; }
275 
276  private:
277   int matrix_location_;
278   int tex_matrix_location_;
279 
280   DISALLOW_COPY_AND_ASSIGN(VertexShaderVideoTransform);
281 };
282 
283 class FragmentTexAlphaBinding {
284  public:
285   FragmentTexAlphaBinding();
286 
287   void Init(gpu::gles2::GLES2Interface* context,
288             unsigned program,
289             int* base_uniform_index);
alpha_location()290   int alpha_location() const { return alpha_location_; }
fragment_tex_transform_location()291   int fragment_tex_transform_location() const { return -1; }
sampler_location()292   int sampler_location() const { return sampler_location_; }
293 
294  private:
295   int sampler_location_;
296   int alpha_location_;
297 
298   DISALLOW_COPY_AND_ASSIGN(FragmentTexAlphaBinding);
299 };
300 
301 class FragmentTexColorMatrixAlphaBinding {
302  public:
303     FragmentTexColorMatrixAlphaBinding();
304 
305     void Init(gpu::gles2::GLES2Interface* context,
306               unsigned program,
307               int* base_uniform_index);
alpha_location()308     int alpha_location() const { return alpha_location_; }
color_matrix_location()309     int color_matrix_location() const { return color_matrix_location_; }
color_offset_location()310     int color_offset_location() const { return color_offset_location_; }
fragment_tex_transform_location()311     int fragment_tex_transform_location() const { return -1; }
sampler_location()312     int sampler_location() const { return sampler_location_; }
313 
314  private:
315     int sampler_location_;
316     int alpha_location_;
317     int color_matrix_location_;
318     int color_offset_location_;
319 };
320 
321 class FragmentTexOpaqueBinding {
322  public:
323   FragmentTexOpaqueBinding();
324 
325   void Init(gpu::gles2::GLES2Interface* context,
326             unsigned program,
327             int* base_uniform_index);
alpha_location()328   int alpha_location() const { return -1; }
fragment_tex_transform_location()329   int fragment_tex_transform_location() const { return -1; }
background_color_location()330   int background_color_location() const { return -1; }
sampler_location()331   int sampler_location() const { return sampler_location_; }
332 
333  private:
334   int sampler_location_;
335 
336   DISALLOW_COPY_AND_ASSIGN(FragmentTexOpaqueBinding);
337 };
338 
339 class FragmentTexBackgroundBinding {
340  public:
341   FragmentTexBackgroundBinding();
342 
343   void Init(gpu::gles2::GLES2Interface* context,
344             unsigned program,
345             int* base_uniform_index);
background_color_location()346   int background_color_location() const { return background_color_location_; }
sampler_location()347   int sampler_location() const { return sampler_location_; }
348 
349  private:
350   int background_color_location_;
351   int sampler_location_;
352 
353   DISALLOW_COPY_AND_ASSIGN(FragmentTexBackgroundBinding);
354 };
355 
356 class FragmentShaderRGBATexVaryingAlpha : public FragmentTexOpaqueBinding {
357  public:
358   std::string GetShaderString(
359       TexCoordPrecision precision, SamplerType sampler) const;
360 };
361 
362 class FragmentShaderRGBATexPremultiplyAlpha : public FragmentTexOpaqueBinding {
363  public:
364   std::string GetShaderString(
365       TexCoordPrecision precision, SamplerType sampler) const;
366 };
367 
368 class FragmentShaderTexBackgroundVaryingAlpha
369     : public FragmentTexBackgroundBinding {
370  public:
371   std::string GetShaderString(
372       TexCoordPrecision precision, SamplerType sampler) const;
373 };
374 
375 class FragmentShaderTexBackgroundPremultiplyAlpha
376     : public FragmentTexBackgroundBinding {
377  public:
378   std::string GetShaderString(
379       TexCoordPrecision precision, SamplerType sampler) const;
380 };
381 
382 class FragmentShaderRGBATexAlpha : public FragmentTexAlphaBinding {
383  public:
384   std::string GetShaderString(
385       TexCoordPrecision precision, SamplerType sampler) const;
386 };
387 
388 class FragmentShaderRGBATexColorMatrixAlpha
389     : public FragmentTexColorMatrixAlphaBinding {
390  public:
391     std::string GetShaderString(
392         TexCoordPrecision precision, SamplerType sampler) const;
393 };
394 
395 class FragmentShaderRGBATexOpaque : public FragmentTexOpaqueBinding {
396  public:
397   std::string GetShaderString(
398       TexCoordPrecision precision, SamplerType sampler) const;
399 };
400 
401 class FragmentShaderRGBATex : public FragmentTexOpaqueBinding {
402  public:
403   std::string GetShaderString(
404       TexCoordPrecision precision, SamplerType sampler) const;
405 };
406 
407 // Swizzles the red and blue component of sampled texel with alpha.
408 class FragmentShaderRGBATexSwizzleAlpha : public FragmentTexAlphaBinding {
409  public:
410   std::string GetShaderString(
411       TexCoordPrecision precision, SamplerType sampler) const;
412 };
413 
414 // Swizzles the red and blue component of sampled texel without alpha.
415 class FragmentShaderRGBATexSwizzleOpaque : public FragmentTexOpaqueBinding {
416  public:
417   std::string GetShaderString(
418       TexCoordPrecision precision, SamplerType sampler) const;
419 };
420 
421 class FragmentShaderRGBATexAlphaAA {
422  public:
423   FragmentShaderRGBATexAlphaAA();
424 
425   void Init(gpu::gles2::GLES2Interface* context,
426             unsigned program,
427             int* base_uniform_index);
428   std::string GetShaderString(
429       TexCoordPrecision precision, SamplerType sampler) const;
430 
alpha_location()431   int alpha_location() const { return alpha_location_; }
sampler_location()432   int sampler_location() const { return sampler_location_; }
433 
434  private:
435   int sampler_location_;
436   int alpha_location_;
437 
438   DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaAA);
439 };
440 
441 class FragmentTexClampAlphaAABinding {
442  public:
443   FragmentTexClampAlphaAABinding();
444 
445   void Init(gpu::gles2::GLES2Interface* context,
446             unsigned program,
447             int* base_uniform_index);
alpha_location()448   int alpha_location() const { return alpha_location_; }
sampler_location()449   int sampler_location() const { return sampler_location_; }
fragment_tex_transform_location()450   int fragment_tex_transform_location() const {
451     return fragment_tex_transform_location_;
452   }
453 
454  private:
455   int sampler_location_;
456   int alpha_location_;
457   int fragment_tex_transform_location_;
458 
459   DISALLOW_COPY_AND_ASSIGN(FragmentTexClampAlphaAABinding);
460 };
461 
462 class FragmentShaderRGBATexClampAlphaAA
463     : public FragmentTexClampAlphaAABinding {
464  public:
465   std::string GetShaderString(
466       TexCoordPrecision precision, SamplerType sampler) const;
467 };
468 
469 // Swizzles the red and blue component of sampled texel.
470 class FragmentShaderRGBATexClampSwizzleAlphaAA
471     : public FragmentTexClampAlphaAABinding {
472  public:
473   std::string GetShaderString(
474       TexCoordPrecision precision, SamplerType sampler) const;
475 };
476 
477 class FragmentShaderRGBATexAlphaMask {
478  public:
479   FragmentShaderRGBATexAlphaMask();
480   std::string GetShaderString(
481       TexCoordPrecision precision, SamplerType sampler) const;
482 
483   void Init(gpu::gles2::GLES2Interface* context,
484             unsigned program,
485             int* base_uniform_index);
alpha_location()486   int alpha_location() const { return alpha_location_; }
sampler_location()487   int sampler_location() const { return sampler_location_; }
mask_sampler_location()488   int mask_sampler_location() const { return mask_sampler_location_; }
mask_tex_coord_scale_location()489   int mask_tex_coord_scale_location() const {
490     return mask_tex_coord_scale_location_;
491   }
mask_tex_coord_offset_location()492   int mask_tex_coord_offset_location() const {
493     return mask_tex_coord_offset_location_;
494   }
495 
496  private:
497   int sampler_location_;
498   int mask_sampler_location_;
499   int alpha_location_;
500   int mask_tex_coord_scale_location_;
501   int mask_tex_coord_offset_location_;
502 
503   DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMask);
504 };
505 
506 class FragmentShaderRGBATexAlphaMaskAA {
507  public:
508   FragmentShaderRGBATexAlphaMaskAA();
509   std::string GetShaderString(
510       TexCoordPrecision precision, SamplerType sampler) const;
511 
512   void Init(gpu::gles2::GLES2Interface* context,
513             unsigned program,
514             int* base_uniform_index);
alpha_location()515   int alpha_location() const { return alpha_location_; }
sampler_location()516   int sampler_location() const { return sampler_location_; }
mask_sampler_location()517   int mask_sampler_location() const { return mask_sampler_location_; }
mask_tex_coord_scale_location()518   int mask_tex_coord_scale_location() const {
519     return mask_tex_coord_scale_location_;
520   }
mask_tex_coord_offset_location()521   int mask_tex_coord_offset_location() const {
522     return mask_tex_coord_offset_location_;
523   }
524 
525  private:
526   int sampler_location_;
527   int mask_sampler_location_;
528   int alpha_location_;
529   int mask_tex_coord_scale_location_;
530   int mask_tex_coord_offset_location_;
531 
532   DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMaskAA);
533 };
534 
535 class FragmentShaderRGBATexAlphaMaskColorMatrixAA {
536  public:
537   FragmentShaderRGBATexAlphaMaskColorMatrixAA();
538   std::string GetShaderString(
539       TexCoordPrecision precision, SamplerType sampler) const;
540 
541   void Init(gpu::gles2::GLES2Interface* context,
542             unsigned program,
543             int* base_uniform_index);
alpha_location()544   int alpha_location() const { return alpha_location_; }
sampler_location()545   int sampler_location() const { return sampler_location_; }
mask_sampler_location()546   int mask_sampler_location() const { return mask_sampler_location_; }
mask_tex_coord_scale_location()547   int mask_tex_coord_scale_location() const {
548     return mask_tex_coord_scale_location_;
549   }
mask_tex_coord_offset_location()550   int mask_tex_coord_offset_location() const {
551     return mask_tex_coord_offset_location_;
552   }
color_matrix_location()553   int color_matrix_location() const { return color_matrix_location_; }
color_offset_location()554   int color_offset_location() const { return color_offset_location_; }
555 
556  private:
557   int sampler_location_;
558   int mask_sampler_location_;
559   int alpha_location_;
560   int mask_tex_coord_scale_location_;
561   int mask_tex_coord_offset_location_;
562   int color_matrix_location_;
563   int color_offset_location_;
564 };
565 
566 class FragmentShaderRGBATexAlphaColorMatrixAA {
567  public:
568   FragmentShaderRGBATexAlphaColorMatrixAA();
569   std::string GetShaderString(
570       TexCoordPrecision precision, SamplerType sampler) const;
571 
572   void Init(gpu::gles2::GLES2Interface* context,
573             unsigned program,
574             int* base_uniform_index);
alpha_location()575   int alpha_location() const { return alpha_location_; }
sampler_location()576   int sampler_location() const { return sampler_location_; }
color_matrix_location()577   int color_matrix_location() const { return color_matrix_location_; }
color_offset_location()578   int color_offset_location() const { return color_offset_location_; }
579 
580  private:
581   int sampler_location_;
582   int alpha_location_;
583   int color_matrix_location_;
584   int color_offset_location_;
585 };
586 
587 class FragmentShaderRGBATexAlphaMaskColorMatrix {
588  public:
589   FragmentShaderRGBATexAlphaMaskColorMatrix();
590   std::string GetShaderString(
591       TexCoordPrecision precision, SamplerType sampler) const;
592 
593   void Init(gpu::gles2::GLES2Interface* context,
594             unsigned program,
595             int* base_uniform_index);
alpha_location()596   int alpha_location() const { return alpha_location_; }
sampler_location()597   int sampler_location() const { return sampler_location_; }
mask_sampler_location()598   int mask_sampler_location() const { return mask_sampler_location_; }
mask_tex_coord_scale_location()599   int mask_tex_coord_scale_location() const {
600     return mask_tex_coord_scale_location_;
601   }
mask_tex_coord_offset_location()602   int mask_tex_coord_offset_location() const {
603     return mask_tex_coord_offset_location_;
604   }
color_matrix_location()605   int color_matrix_location() const { return color_matrix_location_; }
color_offset_location()606   int color_offset_location() const { return color_offset_location_; }
607 
608  private:
609   int sampler_location_;
610   int mask_sampler_location_;
611   int alpha_location_;
612   int mask_tex_coord_scale_location_;
613   int mask_tex_coord_offset_location_;
614   int color_matrix_location_;
615   int color_offset_location_;
616 };
617 
618 class FragmentShaderYUVVideo {
619  public:
620   FragmentShaderYUVVideo();
621   std::string GetShaderString(
622       TexCoordPrecision precision, SamplerType sampler) const;
623 
624   void Init(gpu::gles2::GLES2Interface* context,
625             unsigned program,
626             int* base_uniform_index);
y_texture_location()627   int y_texture_location() const { return y_texture_location_; }
u_texture_location()628   int u_texture_location() const { return u_texture_location_; }
v_texture_location()629   int v_texture_location() const { return v_texture_location_; }
alpha_location()630   int alpha_location() const { return alpha_location_; }
yuv_matrix_location()631   int yuv_matrix_location() const { return yuv_matrix_location_; }
yuv_adj_location()632   int yuv_adj_location() const { return yuv_adj_location_; }
633 
634  private:
635   int y_texture_location_;
636   int u_texture_location_;
637   int v_texture_location_;
638   int alpha_location_;
639   int yuv_matrix_location_;
640   int yuv_adj_location_;
641 
642   DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVVideo);
643 };
644 
645 
646 class FragmentShaderYUVAVideo {
647  public:
648   FragmentShaderYUVAVideo();
649   std::string GetShaderString(
650       TexCoordPrecision precision, SamplerType sampler) const;
651 
652   void Init(gpu::gles2::GLES2Interface* context,
653             unsigned program,
654             int* base_uniform_index);
655 
y_texture_location()656   int y_texture_location() const { return y_texture_location_; }
u_texture_location()657   int u_texture_location() const { return u_texture_location_; }
v_texture_location()658   int v_texture_location() const { return v_texture_location_; }
a_texture_location()659   int a_texture_location() const { return a_texture_location_; }
alpha_location()660   int alpha_location() const { return alpha_location_; }
yuv_matrix_location()661   int yuv_matrix_location() const { return yuv_matrix_location_; }
yuv_adj_location()662   int yuv_adj_location() const { return yuv_adj_location_; }
663 
664  private:
665   int y_texture_location_;
666   int u_texture_location_;
667   int v_texture_location_;
668   int a_texture_location_;
669   int alpha_location_;
670   int yuv_matrix_location_;
671   int yuv_adj_location_;
672 
673   DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVAVideo);
674 };
675 
676 class FragmentShaderColor {
677  public:
678   FragmentShaderColor();
679   std::string GetShaderString(
680       TexCoordPrecision precision, SamplerType sampler) const;
681 
682   void Init(gpu::gles2::GLES2Interface* context,
683             unsigned program,
684             int* base_uniform_index);
color_location()685   int color_location() const { return color_location_; }
686 
687  private:
688   int color_location_;
689 
690   DISALLOW_COPY_AND_ASSIGN(FragmentShaderColor);
691 };
692 
693 class FragmentShaderColorAA {
694  public:
695   FragmentShaderColorAA();
696   std::string GetShaderString(
697       TexCoordPrecision precision, SamplerType sampler) const;
698 
699   void Init(gpu::gles2::GLES2Interface* context,
700             unsigned program,
701             int* base_uniform_index);
color_location()702   int color_location() const { return color_location_; }
703 
704  private:
705   int color_location_;
706 
707   DISALLOW_COPY_AND_ASSIGN(FragmentShaderColorAA);
708 };
709 
710 class FragmentShaderCheckerboard {
711  public:
712   FragmentShaderCheckerboard();
713   std::string GetShaderString(
714       TexCoordPrecision precision, SamplerType sampler) const;
715 
716   void Init(gpu::gles2::GLES2Interface* context,
717             unsigned program,
718             int* base_uniform_index);
alpha_location()719   int alpha_location() const { return alpha_location_; }
tex_transform_location()720   int tex_transform_location() const { return tex_transform_location_; }
frequency_location()721   int frequency_location() const { return frequency_location_; }
color_location()722   int color_location() const { return color_location_; }
723 
724  private:
725   int alpha_location_;
726   int tex_transform_location_;
727   int frequency_location_;
728   int color_location_;
729 
730   DISALLOW_COPY_AND_ASSIGN(FragmentShaderCheckerboard);
731 };
732 
733 }  // namespace cc
734 
735 #endif  // CC_OUTPUT_SHADER_H_
736