Index: src/gpu/glsl/GrGLSLProgramBuilder.cpp |
diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.cpp b/src/gpu/glsl/GrGLSLProgramBuilder.cpp |
index 31d1de29b3ba89da5a7b22a0fc2b716e9337b51a..88ef5b92450db92c6b981256e976d06f378f0427 100644 |
--- a/src/gpu/glsl/GrGLSLProgramBuilder.cpp |
+++ b/src/gpu/glsl/GrGLSLProgramBuilder.cpp |
@@ -27,6 +27,7 @@ |
, fDesc(desc) |
, fGeometryProcessor(nullptr) |
, fXferProcessor(nullptr) |
+ , fSamplerUniforms(4) |
, fNumVertexSamplers(0) |
, fNumGeometrySamplers(0) |
, fNumFragmentSamplers(0) { |
@@ -96,8 +97,8 @@ |
SkASSERT(!fGeometryProcessor); |
fGeometryProcessor = proc.createGLSLInstance(*this->glslCaps()); |
- SkSTArray<4, SamplerHandle> texSamplers(proc.numTextures()); |
- SkSTArray<2, SamplerHandle> bufferSamplers(proc.numBuffers()); |
+ SkSTArray<4, GrGLSLSampler> texSamplers(proc.numTextures()); |
+ SkSTArray<2, GrGLSLSampler> bufferSamplers(proc.numBuffers()); |
this->emitSamplers(proc, &texSamplers, &bufferSamplers); |
GrGLSLGeometryProcessor::EmitArgs args(&fVS, |
@@ -108,8 +109,8 @@ |
proc, |
outputColor->c_str(), |
outputCoverage->c_str(), |
- texSamplers.begin(), |
- bufferSamplers.begin(), |
+ texSamplers, |
+ bufferSamplers, |
fCoordTransforms, |
&fOutCoords); |
fGeometryProcessor->emitCode(args); |
@@ -149,8 +150,8 @@ |
GrGLSLFragmentProcessor* fragProc = fp.createGLSLInstance(); |
- SkSTArray<4, SamplerHandle> texSamplers(fp.numTextures()); |
- SkSTArray<2, SamplerHandle> bufferSamplers(fp.numBuffers()); |
+ SkSTArray<4, GrGLSLSampler> texSamplers(fp.numTextures()); |
+ SkSTArray<2, GrGLSLSampler> bufferSamplers(fp.numBuffers()); |
this->emitSamplers(fp, &texSamplers, &bufferSamplers); |
GrGLSLFragmentProcessor::EmitArgs args(&fFS, |
@@ -160,8 +161,8 @@ |
output->c_str(), |
input.isOnes() ? nullptr : input.c_str(), |
fOutCoords[index], |
- texSamplers.begin(), |
- bufferSamplers.begin()); |
+ texSamplers, |
+ bufferSamplers); |
fragProc->emitCode(args); |
// We have to check that effects and the code they emit are consistent, ie if an effect |
@@ -196,8 +197,8 @@ |
openBrace.printf("{ // Xfer Processor: %s\n", xp.name()); |
fFS.codeAppend(openBrace.c_str()); |
- SkSTArray<4, SamplerHandle> texSamplers(xp.numTextures()); |
- SkSTArray<2, SamplerHandle> bufferSamplers(xp.numBuffers()); |
+ SkSTArray<4, GrGLSLSampler> texSamplers(xp.numTextures()); |
+ SkSTArray<2, GrGLSLSampler> bufferSamplers(xp.numBuffers()); |
this->emitSamplers(xp, &texSamplers, &bufferSamplers); |
bool usePLSDstRead = (plsState == GrPixelLocalStorageState::kFinish_GrPixelLocalStorageState); |
@@ -208,8 +209,8 @@ |
ignoresCoverage ? nullptr : coverageIn.c_str(), |
fFS.getPrimaryColorOutputName(), |
fFS.getSecondaryColorOutputName(), |
- texSamplers.begin(), |
- bufferSamplers.begin(), |
+ texSamplers, |
+ bufferSamplers, |
usePLSDstRead); |
fXferProcessor->emitCode(args); |
@@ -220,8 +221,8 @@ |
} |
void GrGLSLProgramBuilder::emitSamplers(const GrProcessor& processor, |
- SkTArray<SamplerHandle>* outTexSamplers, |
- SkTArray<SamplerHandle>* outBufferSamplers) { |
+ GrGLSLSampler::SamplerArray* outTexSamplers, |
+ GrGLSLSampler::SamplerArray* outBufferSamplers) { |
SkString name; |
int numTextures = processor.numTextures(); |
for (int t = 0; t < numTextures; ++t) { |
@@ -264,7 +265,7 @@ |
GrPixelConfig config, |
const char* name, |
GrShaderFlags visibility, |
- SkTArray<SamplerHandle>* outSamplers) { |
+ GrGLSLSampler::SamplerArray* outSamplers) { |
if (visibility & kVertex_GrShaderFlag) { |
++fNumVertexSamplers; |
} |
@@ -276,12 +277,9 @@ |
++fNumFragmentSamplers; |
} |
GrSLPrecision precision = this->glslCaps()->samplerPrecision(config, visibility); |
- SamplerHandle handle = this->uniformHandler()->addSampler(visibility, |
- config, |
- samplerType, |
- precision, |
- name); |
- outSamplers->emplace_back(handle); |
+ UniformHandle u = this->uniformHandler()->addUniform(visibility, samplerType, precision, name); |
+ fSamplerUniforms.push_back(u); |
+ outSamplers->emplace_back(u, config); |
} |
void GrGLSLProgramBuilder::emitFSOutputSwizzle(bool hasSecondaryOutput) { |
@@ -371,10 +369,6 @@ |
this->uniformHandler()->appendUniformDecls(visibility, out); |
} |
-const GrGLSLSampler& GrGLSLProgramBuilder::getSampler(SamplerHandle handle) const { |
- return this->uniformHandler()->getSampler(handle); |
-} |
- |
void GrGLSLProgramBuilder::addRTAdjustmentUniform(GrSLPrecision precision, |
const char* name, |
const char** outName) { |