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