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

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

Issue 2365943003: Stop aggregating texture/buffer access objects in GrFragmentProcessor parents. (Closed)
Patch Set: Readd base class, rebase Created 4 years, 3 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/GrGLSLFragmentProcessor.cpp ('k') | src/gpu/vk/GrVkGpuCommandBuffer.cpp » ('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 29470c4e2b9dc116a9e2412a53e1874fa9fce160..abfeafda0c79c3ff5221243b49d36ab9e4aa8a2d 100644
--- a/src/gpu/glsl/GrGLSLProgramBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLProgramBuilder.cpp
@@ -158,12 +158,17 @@ void GrGLSLProgramBuilder::emitAndInstallFragProc(const GrFragmentProcessor& fp,
GrGLSLFragmentProcessor* fragProc = fp.createGLSLInstance();
- SkSTArray<4, SamplerHandle> texSamplers(fp.numTextures());
- SkSTArray<2, SamplerHandle> bufferSamplers(fp.numBuffers());
- this->emitSamplers(fp, &texSamplers, &bufferSamplers);
+ SkSTArray<4, SamplerHandle> textureSamplerArray(fp.numTextures());
+ SkSTArray<2, SamplerHandle> bufferSamplerArray(fp.numBuffers());
+ GrFragmentProcessor::Iter iter(&fp);
+ while (const GrFragmentProcessor* subFP = iter.next()) {
+ this->emitSamplers(*subFP, &textureSamplerArray, &bufferSamplerArray);
+ }
const GrShaderVar* coordVars = fTransformedCoordVars.begin() + transformedCoordVarsIdx;
GrGLSLFragmentProcessor::TransformedCoordVars coords(&fp, coordVars);
+ GrGLSLFragmentProcessor::TextureSamplers textureSamplers(&fp, textureSamplerArray.begin());
+ GrGLSLFragmentProcessor::BufferSamplers bufferSamplers(&fp, bufferSamplerArray.begin());
GrGLSLFragmentProcessor::EmitArgs args(&fFS,
this->uniformHandler(),
this->glslCaps(),
@@ -171,8 +176,8 @@ void GrGLSLProgramBuilder::emitAndInstallFragProc(const GrFragmentProcessor& fp,
output->c_str(),
input.isOnes() ? nullptr : input.c_str(),
coords,
- texSamplers.begin(),
- bufferSamplers.begin(),
+ textureSamplers,
+ bufferSamplers,
this->primitiveProcessor().implementsDistanceVector());
fragProc->emitCode(args);
@@ -248,7 +253,7 @@ void GrGLSLProgramBuilder::emitSamplers(const GrProcessor& processor,
1 << GrGLSLShaderBuilder::kExternalTexture_GLSLPrivateFeature,
externalFeatureString);
}
- name.printf("TextureSampler%d", t);
+ name.printf("TextureSampler_%d", outTexSamplers->count());
this->emitSampler(samplerType, access.getTexture()->config(),
name.c_str(), access.getVisibility(), outTexSamplers);
}
@@ -259,7 +264,7 @@ void GrGLSLProgramBuilder::emitSamplers(const GrProcessor& processor,
for (int b = 0; b < numBuffers; ++b) {
const GrBufferAccess& access = processor.bufferAccess(b);
- name.printf("BufferSampler%d", b);
+ name.printf("BufferSampler_%d", outBufferSamplers->count());
this->emitSampler(kTextureBufferSampler_GrSLType, access.texelConfig(), name.c_str(),
access.visibility(), outBufferSamplers);
texelBufferVisibility |= access.visibility();
« no previous file with comments | « src/gpu/glsl/GrGLSLFragmentProcessor.cpp ('k') | src/gpu/vk/GrVkGpuCommandBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698