Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Side by Side Diff: cc/shader.h

Issue 12086036: cc: Clamp texture coordinates in all tile shaders (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@snowscale
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 int m_texMatrixLocation; 127 int m_texMatrixLocation;
128 }; 128 };
129 129
130 class FragmentTexAlphaBinding { 130 class FragmentTexAlphaBinding {
131 public: 131 public:
132 FragmentTexAlphaBinding(); 132 FragmentTexAlphaBinding();
133 133
134 void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUni form, int* baseUniformIndex); 134 void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUni form, int* baseUniformIndex);
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 fragmentTexClampLocation() 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 fragmentTexClampLocation() const { return m_fragmentTexClampLocation; }
153 int samplerLocation() const { return m_samplerLocation; }
154
155 private:
156 int m_samplerLocation;
157 int m_alphaLocation;
158 int m_fragmentTexClampLocation;
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 fragmentTexClampLocation() 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 FragmentTeClampOpaqueBinding {
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 fragmentTexClampLocation() const { m_fragmentTexClampLocation; }
183 int samplerLocation() const { return m_samplerLocation; }
184
185 private:
186 int m_samplerLocation;
187 int m_fragmentTexClampLocation;
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 FragmentShaderRGBATexAlpha : 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 17 matching lines...) Expand all
229 int m_edgeLocation; 265 int m_edgeLocation;
230 }; 266 };
231 267
232 class FragmentTexClampAlphaAABinding { 268 class FragmentTexClampAlphaAABinding {
233 public: 269 public:
234 FragmentTexClampAlphaAABinding(); 270 FragmentTexClampAlphaAABinding();
235 271
236 void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUni form, int* baseUniformIndex); 272 void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUni form, int* baseUniformIndex);
237 int alphaLocation() const { return m_alphaLocation; } 273 int alphaLocation() const { return m_alphaLocation; }
238 int samplerLocation() const { return m_samplerLocation; } 274 int samplerLocation() const { return m_samplerLocation; }
239 int fragmentTexTransformLocation() const { return m_fragmentTexTransformLoca tion; } 275 int fragmentTexClampLocation() const { return m_fragmentTexClampLocation; }
240 int edgeLocation() const { return m_edgeLocation; } 276 int edgeLocation() const { return m_edgeLocation; }
241 277
242 private: 278 private:
243 int m_samplerLocation; 279 int m_samplerLocation;
244 int m_alphaLocation; 280 int m_alphaLocation;
245 int m_fragmentTexTransformLocation; 281 int m_fragmentTexClampLocation;
246 int m_edgeLocation; 282 int m_edgeLocation;
247 }; 283 };
248 284
249 class FragmentShaderRGBATexClampAlphaAA : public FragmentTexClampAlphaAABinding { 285 class FragmentShaderRGBATexClampAlphaAA : public FragmentTexClampAlphaAABinding {
250 public: 286 public:
251 std::string getShaderString() const; 287 std::string getShaderString() const;
252 }; 288 };
253 289
254 // Swizzles the red and blue component of sampled texel. 290 // Swizzles the red and blue component of sampled texel.
255 class FragmentShaderRGBATexClampSwizzleAlphaAA : public FragmentTexClampAlphaAAB inding { 291 class FragmentShaderRGBATexClampSwizzleAlphaAA : public FragmentTexClampAlphaAAB inding {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698