OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CC_SHADER_H_ | 5 #ifndef CC_SHADER_H_ |
6 #define CC_SHADER_H_ | 6 #define CC_SHADER_H_ |
7 | 7 |
8 #include "third_party/skia/include/core/SkColorPriv.h" | 8 #include "third_party/skia/include/core/SkColorPriv.h" |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 int alphaLocation() const { return m_alphaLocation; } | 135 int alphaLocation() const { return m_alphaLocation; } |
136 int edgeLocation() const { return -1; } | 136 int edgeLocation() const { return -1; } |
137 int fragmentTexTransformLocation() const { return -1; } | 137 int fragmentTexTransformLocation() const { return -1; } |
138 int samplerLocation() const { return m_samplerLocation; } | 138 int samplerLocation() const { return m_samplerLocation; } |
139 | 139 |
140 private: | 140 private: |
141 int m_samplerLocation; | 141 int m_samplerLocation; |
142 int m_alphaLocation; | 142 int m_alphaLocation; |
143 }; | 143 }; |
144 | 144 |
145 class FragmentTexClampAlphaBinding { | |
146 public: | |
147 FragmentTexClampAlphaBinding(); | |
148 | |
149 void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUni
form, int* baseUniformIndex); | |
150 int alphaLocation() const { return m_alphaLocation; } | |
151 int edgeLocation() const { return -1; } | |
152 int fragmentTexTransformLocation() const { return m_fragmentTexTransformLoca
tion; } | |
153 int samplerLocation() const { return m_samplerLocation; } | |
154 | |
155 private: | |
156 int m_samplerLocation; | |
157 int m_alphaLocation; | |
158 int m_fragmentTexTransformLocation; | |
159 }; | |
160 | |
161 class FragmentTexOpaqueBinding { | 145 class FragmentTexOpaqueBinding { |
162 public: | 146 public: |
163 FragmentTexOpaqueBinding(); | 147 FragmentTexOpaqueBinding(); |
164 | 148 |
165 void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUni
form, int* baseUniformIndex); | 149 void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUni
form, int* baseUniformIndex); |
166 int alphaLocation() const { return -1; } | 150 int alphaLocation() const { return -1; } |
167 int edgeLocation() const { return -1; } | 151 int edgeLocation() const { return -1; } |
168 int fragmentTexTransformLocation() const { return -1; } | 152 int fragmentTexTransformLocation() const { return -1; } |
169 int samplerLocation() const { return m_samplerLocation; } | 153 int samplerLocation() const { return m_samplerLocation; } |
170 | 154 |
171 private: | 155 private: |
172 int m_samplerLocation; | 156 int m_samplerLocation; |
173 }; | 157 }; |
174 | 158 |
175 class FragmentTexClampOpaqueBinding { | |
176 public: | |
177 FragmentTexClampOpaqueBinding(); | |
178 | |
179 void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUni
form, int* baseUniformIndex); | |
180 int alphaLocation() const { return -1; } | |
181 int edgeLocation() const { return -1; } | |
182 int fragmentTexTransformLocation() const { return m_fragmentTexTransformLoca
tion; } | |
183 int samplerLocation() const { return m_samplerLocation; } | |
184 | |
185 private: | |
186 int m_samplerLocation; | |
187 int m_fragmentTexTransformLocation; | |
188 }; | |
189 | |
190 class FragmentShaderRGBATexFlipVaryingAlpha : public FragmentTexOpaqueBinding { | 159 class FragmentShaderRGBATexFlipVaryingAlpha : public FragmentTexOpaqueBinding { |
191 public: | 160 public: |
192 std::string getShaderString() const; | 161 std::string getShaderString() const; |
193 }; | 162 }; |
194 | 163 |
195 class FragmentShaderRGBATexVaryingAlpha : public FragmentTexOpaqueBinding { | 164 class FragmentShaderRGBATexVaryingAlpha : public FragmentTexOpaqueBinding { |
196 public: | 165 public: |
197 std::string getShaderString() const; | 166 std::string getShaderString() const; |
198 }; | 167 }; |
199 | 168 |
200 class FragmentShaderRGBATexAlpha : public FragmentTexAlphaBinding { | 169 class FragmentShaderRGBATexAlpha : public FragmentTexAlphaBinding { |
201 public: | 170 public: |
202 std::string getShaderString() const; | 171 std::string getShaderString() const; |
203 }; | 172 }; |
204 | 173 |
205 class FragmentShaderRGBATexClampAlpha : public FragmentTexClampAlphaBinding { | |
206 public: | |
207 std::string getShaderString() const; | |
208 }; | |
209 | |
210 class FragmentShaderRGBATexRectFlipVaryingAlpha : public FragmentTexAlphaBinding
{ | 174 class FragmentShaderRGBATexRectFlipVaryingAlpha : public FragmentTexAlphaBinding
{ |
211 public: | 175 public: |
212 std::string getShaderString() const; | 176 std::string getShaderString() const; |
213 }; | 177 }; |
214 | 178 |
215 class FragmentShaderRGBATexRectVaryingAlpha : public FragmentTexAlphaBinding { | 179 class FragmentShaderRGBATexRectVaryingAlpha : public FragmentTexAlphaBinding { |
216 public: | 180 public: |
217 std::string getShaderString() const; | 181 std::string getShaderString() const; |
218 }; | 182 }; |
219 | 183 |
220 class FragmentShaderRGBATexClampOpaque : public FragmentTexClampOpaqueBinding { | 184 class FragmentShaderRGBATexOpaque : public FragmentTexOpaqueBinding { |
221 public: | 185 public: |
222 std::string getShaderString() const; | 186 std::string getShaderString() const; |
223 }; | 187 }; |
224 | 188 |
225 class FragmentShaderRGBATex : public FragmentTexOpaqueBinding { | 189 class FragmentShaderRGBATex : public FragmentTexOpaqueBinding { |
226 public: | 190 public: |
227 std::string getShaderString() const; | 191 std::string getShaderString() const; |
228 }; | 192 }; |
229 | 193 |
230 // Swizzles the red and blue component of sampled texel with alpha. | 194 // Swizzles the red and blue component of sampled texel with alpha. |
231 class FragmentShaderRGBATexClampSwizzleAlpha : public FragmentTexClampAlphaBindi
ng { | 195 class FragmentShaderRGBATexSwizzleAlpha : public FragmentTexAlphaBinding { |
232 public: | 196 public: |
233 std::string getShaderString() const; | 197 std::string getShaderString() const; |
234 }; | 198 }; |
235 | 199 |
236 // Swizzles the red and blue component of sampled texel without alpha. | 200 // Swizzles the red and blue component of sampled texel without alpha. |
237 class FragmentShaderRGBATexClampSwizzleOpaque : public FragmentTexClampOpaqueBin
ding { | 201 class FragmentShaderRGBATexSwizzleOpaque : public FragmentTexOpaqueBinding { |
238 public: | 202 public: |
239 std::string getShaderString() const; | 203 std::string getShaderString() const; |
240 }; | 204 }; |
241 | 205 |
242 // Fragment shader for external textures. | 206 // Fragment shader for external textures. |
243 class FragmentShaderOESImageExternal : public FragmentTexAlphaBinding { | 207 class FragmentShaderOESImageExternal : public FragmentTexAlphaBinding { |
244 public: | 208 public: |
245 std::string getShaderString() const; | 209 std::string getShaderString() const; |
246 bool init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUni
form, int* baseUniformIndex); | 210 bool init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUni
form, int* baseUniformIndex); |
247 private: | 211 private: |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 private: | 347 private: |
384 int m_alphaLocation; | 348 int m_alphaLocation; |
385 int m_texTransformLocation; | 349 int m_texTransformLocation; |
386 int m_frequencyLocation; | 350 int m_frequencyLocation; |
387 int m_colorLocation; | 351 int m_colorLocation; |
388 }; | 352 }; |
389 | 353 |
390 } // namespace cc | 354 } // namespace cc |
391 | 355 |
392 #endif // CC_SHADER_H_ | 356 #endif // CC_SHADER_H_ |
OLD | NEW |