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