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

Unified Diff: src/gpu/gl/GrGLShaderBuilder.cpp

Issue 13121002: Make GrGLShaderBuilder::TextureSampler extract only required info from GrTextureAccess. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
« src/gpu/gl/GrGLShaderBuilder.h ('K') | « src/gpu/gl/GrGLShaderBuilder.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLShaderBuilder.cpp
===================================================================
--- src/gpu/gl/GrGLShaderBuilder.cpp (revision 8417)
+++ src/gpu/gl/GrGLShaderBuilder.cpp (working copy)
@@ -40,10 +40,10 @@
inline bool swizzle_requires_alpha_remapping(const GrGLCaps& caps,
const GrTextureAccess& access) {
if (GrPixelConfigIsAlphaOnly(access.getTexture()->config())) {
- if (caps.textureRedSupport() && (GrTextureAccess::kA_SwizzleFlag & access.swizzleMask())) {
+ if (caps.textureRedSupport() && (kA_GrColorComponentFlag & access.swizzleMask())) {
return true;
}
- if (GrTextureAccess::kRGB_SwizzleMask & access.swizzleMask()) {
+ if (kRGB_GrColorComponentFlags & access.swizzleMask()) {
return true;
}
}
@@ -51,14 +51,15 @@
}
void append_swizzle(SkString* outAppend,
- const GrTextureAccess& access,
+ const GrGLShaderBuilder::TextureSampler& texSampler,
const GrGLCaps& caps) {
- const char* swizzle = access.getSwizzle();
+ const char* swizzle = texSampler.swizzle();
char mangledSwizzle[5];
// The swizzling occurs using texture params instead of shader-mangling if ARB_texture_swizzle
// is available.
- if (!caps.textureSwizzleSupport() && GrPixelConfigIsAlphaOnly(access.getTexture()->config())) {
+ if (!caps.textureSwizzleSupport() &&
robertphillips 2013/03/28 13:38:29 Doesn't this change the semantics from "only has a
bsalomon 2013/03/28 13:46:00 Yikes, changed & to ==
+ (kA_GrColorComponentFlag & texSampler.configComponentMask())) {
char alphaChar = caps.textureRedSupport() ? 'r' : 'a';
int i;
for (i = 0; '\0' != swizzle[i]; ++i) {
@@ -151,14 +152,13 @@
const GrGLShaderBuilder::TextureSampler& sampler,
const char* coordName,
GrSLType varyingType) const {
- GrAssert(NULL != sampler.textureAccess());
GrAssert(NULL != coordName);
out->appendf("%s(%s, %s)",
sample_function_name(varyingType, fCtxInfo.glslGeneration()),
this->getUniformCStr(sampler.fSamplerUniform),
coordName);
- append_swizzle(out, *sampler.textureAccess(), *fCtxInfo.caps());
+ append_swizzle(out, sampler, *fCtxInfo.caps());
}
void GrGLShaderBuilder::appendTextureLookup(ShaderType type,
@@ -191,17 +191,6 @@
if (!caps.textureSwizzleSupport() && swizzle_requires_alpha_remapping(caps, access)) {
key = 1;
}
-#if GR_DEBUG
- // Assert that key is set iff the swizzle will be modified.
- SkString origString(access.getSwizzle());
- origString.prepend(".");
- SkString modifiedString;
- append_swizzle(&modifiedString, access, caps);
- if (!modifiedString.size()) {
- modifiedString = ".rgba";
- }
- GrAssert(SkToBool(key) == (modifiedString != origString));
-#endif
return key;
}
« src/gpu/gl/GrGLShaderBuilder.h ('K') | « src/gpu/gl/GrGLShaderBuilder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698