Move GrGeometryProcessor's textures out of classes and into
GrPipeline::FixedDynamicState.
This will allow specification of different textures for different
GrMeshes using GrPipeline::DynamicStateArrays in a future change.
Change-Id: I4a7897df33a84e4072151149e5d586dca074393f
Reviewed-on: https://skia-review.googlesource.com/145264
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp
index e0eccf2..9e90642 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -72,7 +72,10 @@
///////////////////////////////////////////////////////////////////////////////
-void GrGLProgram::setData(const GrPrimitiveProcessor& primProc, const GrPipeline& pipeline) {
+void GrGLProgram::updateUniformsAndTextureBindings(const GrPrimitiveProcessor& primProc,
+ const GrPipeline& pipeline,
+ const GrTextureProxy* const primProcTextures[]) {
+ SkASSERT(primProcTextures || !primProc.numTextureSamplers());
this->setRenderTargetState(primProc, pipeline.proxy());
// we set the textures, and uniforms for installed processors in a generic way, but subclasses
@@ -85,9 +88,8 @@
fPrimitiveProcessor->setData(fProgramDataManager, primProc,
GrFragmentProcessor::CoordTransformIter(pipeline));
for (int i = 0; i < primProc.numTextureSamplers(); ++i) {
- const GrPrimitiveProcessor::TextureSampler& sampler = primProc.textureSampler(i);
- fGpu->bindTexture(nextTexSamplerIdx++, sampler.samplerState(),
- static_cast<GrGLTexture*>(sampler.peekTexture()));
+ auto* tex = static_cast<GrGLTexture*>(primProcTextures[i]->peekTexture());
+ fGpu->bindTexture(nextTexSamplerIdx++, primProc.textureSampler(i).samplerState(), tex);
}
this->setFragmentData(pipeline, &nextTexSamplerIdx);