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

Unified Diff: src/gpu/glsl/GrGLSLProgramBuilder.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/GrGLSLProgramBuilder.h ('k') | src/gpu/glsl/GrGLSLSampler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « src/gpu/glsl/GrGLSLProgramBuilder.h ('k') | src/gpu/glsl/GrGLSLSampler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698