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