Remove extra line from unit_tests.isolate
[chromium-blink-merge.git] / cc / ShaderChromium.h
blob2518382e318f06b51a602ed3fa5dd9cefa56855c
1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef ShaderChromium_h
6 #define ShaderChromium_h
8 #if USE(ACCELERATED_COMPOSITING)
10 #include "SkColorPriv.h"
11 #include <string>
13 namespace WebKit {
14 class WebGraphicsContext3D;
17 namespace cc {
19 class VertexShaderPosTex {
20 public:
21 VertexShaderPosTex();
23 void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
24 std::string getShaderString() const;
26 int matrixLocation() const { return m_matrixLocation; }
28 private:
29 int m_matrixLocation;
32 class VertexShaderPosTexYUVStretch {
33 public:
34 VertexShaderPosTexYUVStretch();
36 void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
37 std::string getShaderString() const;
39 int matrixLocation() const { return m_matrixLocation; }
40 int yWidthScaleFactorLocation() const { return m_yWidthScaleFactorLocation; }
41 int uvWidthScaleFactorLocation() const { return m_uvWidthScaleFactorLocation; }
43 private:
44 int m_matrixLocation;
45 int m_yWidthScaleFactorLocation;
46 int m_uvWidthScaleFactorLocation;
49 class VertexShaderPos {
50 public:
51 VertexShaderPos();
53 void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
54 std::string getShaderString() const;
56 int matrixLocation() const { return m_matrixLocation; }
58 private:
59 int m_matrixLocation;
62 class VertexShaderPosTexIdentity {
63 public:
64 void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex) { }
65 std::string getShaderString() const;
68 class VertexShaderPosTexTransform {
69 public:
70 VertexShaderPosTexTransform();
72 void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
73 std::string getShaderString() const;
75 int matrixLocation() const { return m_matrixLocation; }
76 int texTransformLocation() const { return m_texTransformLocation; }
78 private:
79 int m_matrixLocation;
80 int m_texTransformLocation;
83 class VertexShaderQuad {
84 public:
85 VertexShaderQuad();
87 void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
88 std::string getShaderString() const;
90 int matrixLocation() const { return m_matrixLocation; }
91 int pointLocation() const { return m_pointLocation; }
93 private:
94 int m_matrixLocation;
95 int m_pointLocation;
98 class VertexShaderTile {
99 public:
100 VertexShaderTile();
102 void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
103 std::string getShaderString() const;
105 int matrixLocation() const { return m_matrixLocation; }
106 int pointLocation() const { return m_pointLocation; }
107 int vertexTexTransformLocation() const { return m_vertexTexTransformLocation; }
109 private:
110 int m_matrixLocation;
111 int m_pointLocation;
112 int m_vertexTexTransformLocation;
115 class VertexShaderVideoTransform {
116 public:
117 VertexShaderVideoTransform();
119 bool init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
120 std::string getShaderString() const;
122 int matrixLocation() const { return m_matrixLocation; }
123 int texMatrixLocation() const { return m_texMatrixLocation; }
125 private:
126 int m_matrixLocation;
127 int m_texMatrixLocation;
130 class FragmentTexAlphaBinding {
131 public:
132 FragmentTexAlphaBinding();
134 void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
135 int alphaLocation() const { return m_alphaLocation; }
136 int edgeLocation() const { return -1; }
137 int fragmentTexTransformLocation() const { return -1; }
138 int samplerLocation() const { return m_samplerLocation; }
140 private:
141 int m_samplerLocation;
142 int m_alphaLocation;
145 class FragmentTexOpaqueBinding {
146 public:
147 FragmentTexOpaqueBinding();
149 void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
150 int alphaLocation() const { return -1; }
151 int edgeLocation() const { return -1; }
152 int fragmentTexTransformLocation() const { return -1; }
153 int samplerLocation() const { return m_samplerLocation; }
155 private:
156 int m_samplerLocation;
159 class FragmentShaderRGBATexFlipAlpha : public FragmentTexAlphaBinding {
160 public:
161 std::string getShaderString() const;
164 class FragmentShaderRGBATexAlpha : public FragmentTexAlphaBinding {
165 public:
166 std::string getShaderString() const;
169 class FragmentShaderRGBATexRectFlipAlpha : public FragmentTexAlphaBinding {
170 public:
171 std::string getShaderString() const;
174 class FragmentShaderRGBATexRectAlpha : public FragmentTexAlphaBinding {
175 public:
176 std::string getShaderString() const;
179 class FragmentShaderRGBATexOpaque : public FragmentTexOpaqueBinding {
180 public:
181 std::string getShaderString() const;
184 class FragmentShaderRGBATex : public FragmentTexOpaqueBinding {
185 public:
186 std::string getShaderString() const;
189 // Swizzles the red and blue component of sampled texel with alpha.
190 class FragmentShaderRGBATexSwizzleAlpha : public FragmentTexAlphaBinding {
191 public:
192 std::string getShaderString() const;
195 // Swizzles the red and blue component of sampled texel without alpha.
196 class FragmentShaderRGBATexSwizzleOpaque : public FragmentTexOpaqueBinding {
197 public:
198 std::string getShaderString() const;
201 // Fragment shader for external textures.
202 class FragmentShaderOESImageExternal : public FragmentTexAlphaBinding {
203 public:
204 std::string getShaderString() const;
205 bool init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
206 private:
207 int m_samplerLocation;
210 class FragmentShaderRGBATexAlphaAA {
211 public:
212 FragmentShaderRGBATexAlphaAA();
214 void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
215 std::string getShaderString() const;
217 int alphaLocation() const { return m_alphaLocation; }
218 int samplerLocation() const { return m_samplerLocation; }
219 int edgeLocation() const { return m_edgeLocation; }
221 private:
222 int m_samplerLocation;
223 int m_alphaLocation;
224 int m_edgeLocation;
227 class FragmentTexClampAlphaAABinding {
228 public:
229 FragmentTexClampAlphaAABinding();
231 void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
232 int alphaLocation() const { return m_alphaLocation; }
233 int samplerLocation() const { return m_samplerLocation; }
234 int fragmentTexTransformLocation() const { return m_fragmentTexTransformLocation; }
235 int edgeLocation() const { return m_edgeLocation; }
237 private:
238 int m_samplerLocation;
239 int m_alphaLocation;
240 int m_fragmentTexTransformLocation;
241 int m_edgeLocation;
244 class FragmentShaderRGBATexClampAlphaAA : public FragmentTexClampAlphaAABinding {
245 public:
246 std::string getShaderString() const;
249 // Swizzles the red and blue component of sampled texel.
250 class FragmentShaderRGBATexClampSwizzleAlphaAA : public FragmentTexClampAlphaAABinding {
251 public:
252 std::string getShaderString() const;
255 class FragmentShaderRGBATexAlphaMask {
256 public:
257 FragmentShaderRGBATexAlphaMask();
258 std::string getShaderString() const;
260 void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
261 int alphaLocation() const { return m_alphaLocation; }
262 int samplerLocation() const { return m_samplerLocation; }
263 int maskSamplerLocation() const { return m_maskSamplerLocation; }
264 int maskTexCoordScaleLocation() const { return m_maskTexCoordScaleLocation; }
265 int maskTexCoordOffsetLocation() const { return m_maskTexCoordOffsetLocation; }
267 private:
268 int m_samplerLocation;
269 int m_maskSamplerLocation;
270 int m_alphaLocation;
271 int m_maskTexCoordScaleLocation;
272 int m_maskTexCoordOffsetLocation;
275 class FragmentShaderRGBATexAlphaMaskAA {
276 public:
277 FragmentShaderRGBATexAlphaMaskAA();
278 std::string getShaderString() const;
280 void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
281 int alphaLocation() const { return m_alphaLocation; }
282 int samplerLocation() const { return m_samplerLocation; }
283 int maskSamplerLocation() const { return m_maskSamplerLocation; }
284 int edgeLocation() const { return m_edgeLocation; }
285 int maskTexCoordScaleLocation() const { return m_maskTexCoordScaleLocation; }
286 int maskTexCoordOffsetLocation() const { return m_maskTexCoordOffsetLocation; }
288 private:
289 int m_samplerLocation;
290 int m_maskSamplerLocation;
291 int m_alphaLocation;
292 int m_edgeLocation;
293 int m_maskTexCoordScaleLocation;
294 int m_maskTexCoordOffsetLocation;
297 class FragmentShaderYUVVideo {
298 public:
299 FragmentShaderYUVVideo();
300 std::string getShaderString() const;
302 void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
304 int yTextureLocation() const { return m_yTextureLocation; }
305 int uTextureLocation() const { return m_uTextureLocation; }
306 int vTextureLocation() const { return m_vTextureLocation; }
307 int alphaLocation() const { return m_alphaLocation; }
308 int ccMatrixLocation() const { return m_ccMatrixLocation; }
309 int yuvAdjLocation() const { return m_yuvAdjLocation; }
311 private:
312 int m_yTextureLocation;
313 int m_uTextureLocation;
314 int m_vTextureLocation;
315 int m_alphaLocation;
316 int m_ccMatrixLocation;
317 int m_yuvAdjLocation;
320 class FragmentShaderColor {
321 public:
322 FragmentShaderColor();
323 std::string getShaderString() const;
325 void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
326 int colorLocation() const { return m_colorLocation; }
328 private:
329 int m_colorLocation;
332 class FragmentShaderCheckerboard {
333 public:
334 FragmentShaderCheckerboard();
335 std::string getShaderString() const;
337 void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
338 int alphaLocation() const { return m_alphaLocation; }
339 int texTransformLocation() const { return m_texTransformLocation; }
340 int frequencyLocation() const { return m_frequencyLocation; }
341 int colorLocation() const { return m_colorLocation; }
342 private:
343 int m_alphaLocation;
344 int m_texTransformLocation;
345 int m_frequencyLocation;
346 int m_colorLocation;
349 } // namespace cc
351 #endif // USE(ACCELERATED_COMPOSITING)
353 #endif