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