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

Unified Diff: src/gpu/glsl/GrGLSLShaderBuilder.cpp

Issue 1896013003: Revert of Refactor how we store and use samplers in Ganesh (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « src/gpu/glsl/GrGLSLShaderBuilder.h ('k') | src/gpu/glsl/GrGLSLUniformHandler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/glsl/GrGLSLShaderBuilder.cpp
diff --git a/src/gpu/glsl/GrGLSLShaderBuilder.cpp b/src/gpu/glsl/GrGLSLShaderBuilder.cpp
index 1342d1ce9801f50afc615a2a3b6b535091c425f7..1031f84460acf3089afac81ee8ffd5c4f93c5005 100644
--- a/src/gpu/glsl/GrGLSLShaderBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLShaderBuilder.cpp
@@ -63,68 +63,71 @@
}
void GrGLSLShaderBuilder::appendTextureLookup(SkString* out,
- SamplerHandle samplerHandle,
+ const GrGLSLSampler& sampler,
const char* coordName,
GrSLType varyingType) const {
const GrGLSLCaps* glslCaps = fProgramBuilder->glslCaps();
- const GrGLSLSampler& sampler = fProgramBuilder->getSampler(samplerHandle);
- GrSLType samplerType = sampler.type();
+ GrGLSLUniformHandler* uniformHandler = fProgramBuilder->uniformHandler();
+ GrSLType samplerType = uniformHandler->getUniformVariable(sampler.fSamplerUniform).getType();
if (samplerType == kSampler2DRect_GrSLType) {
if (varyingType == kVec2f_GrSLType) {
out->appendf("%s(%s, textureSize(%s) * %s)",
GrGLSLTexture2DFunctionName(varyingType, samplerType,
glslCaps->generation()),
- sampler.getSamplerNameForTexture2D(),
- sampler.getSamplerNameForTexture2D(),
+ uniformHandler->getUniformCStr(sampler.fSamplerUniform),
+ uniformHandler->getUniformCStr(sampler.fSamplerUniform),
coordName);
} else {
out->appendf("%s(%s, vec3(textureSize(%s) * %s.xy, %s.z))",
GrGLSLTexture2DFunctionName(varyingType, samplerType,
glslCaps->generation()),
- sampler.getSamplerNameForTexture2D(),
- sampler.getSamplerNameForTexture2D(),
+ uniformHandler->getUniformCStr(sampler.fSamplerUniform),
+ uniformHandler->getUniformCStr(sampler.fSamplerUniform),
coordName,
coordName);
}
} else {
out->appendf("%s(%s, %s)",
GrGLSLTexture2DFunctionName(varyingType, samplerType, glslCaps->generation()),
- sampler.getSamplerNameForTexture2D(),
+ uniformHandler->getUniformCStr(sampler.fSamplerUniform),
coordName);
}
this->appendTextureSwizzle(out, sampler.config());
}
-void GrGLSLShaderBuilder::appendTextureLookup(SamplerHandle samplerHandle,
+void GrGLSLShaderBuilder::appendTextureLookup(const GrGLSLSampler& sampler,
const char* coordName,
GrSLType varyingType) {
- this->appendTextureLookup(&this->code(), samplerHandle, coordName, varyingType);
+ this->appendTextureLookup(&this->code(), sampler, coordName, varyingType);
}
void GrGLSLShaderBuilder::appendTextureLookupAndModulate(const char* modulation,
- SamplerHandle samplerHandle,
+ const GrGLSLSampler& sampler,
const char* coordName,
GrSLType varyingType) {
SkString lookup;
- this->appendTextureLookup(&lookup, samplerHandle, coordName, varyingType);
+ this->appendTextureLookup(&lookup, sampler, coordName, varyingType);
this->codeAppend((GrGLSLExpr4(modulation) * GrGLSLExpr4(lookup)).c_str());
}
void GrGLSLShaderBuilder::appendTexelFetch(SkString* out,
- SamplerHandle samplerHandle,
+ const GrGLSLSampler& sampler,
const char* coordExpr) const {
- const GrGLSLSampler& sampler = fProgramBuilder->getSampler(samplerHandle);
+ const GrGLSLUniformHandler* uniformHandler = fProgramBuilder->uniformHandler();
SkASSERT(fProgramBuilder->glslCaps()->texelFetchSupport());
- SkASSERT(GrSLTypeIsSamplerType(sampler.type()));
-
- out->appendf("texelFetch(%s, %s)", sampler.getSamplerNameForTexelFetch(), coordExpr);
+ SkASSERT(GrSLTypeIsSamplerType(
+ uniformHandler->getUniformVariable(sampler.fSamplerUniform).getType()));
+
+ out->appendf("texelFetch(%s, %s)",
+ uniformHandler->getUniformCStr(sampler.fSamplerUniform),
+ coordExpr);
this->appendTextureSwizzle(out, sampler.config());
}
-void GrGLSLShaderBuilder::appendTexelFetch(SamplerHandle samplerHandle, const char* coordExpr) {
- this->appendTexelFetch(&this->code(), samplerHandle, coordExpr);
+void GrGLSLShaderBuilder::appendTexelFetch(const GrGLSLSampler& sampler, const char* coordExpr) {
+ this->appendTexelFetch(&this->code(), sampler, coordExpr);
}
void GrGLSLShaderBuilder::appendTextureSwizzle(SkString* out, GrPixelConfig config) const {
« no previous file with comments | « src/gpu/glsl/GrGLSLShaderBuilder.h ('k') | src/gpu/glsl/GrGLSLUniformHandler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698