Add GrProgramInfo to centralize management of program information
This is the first step in moving the marshaling of program information earlier in renderTask processing (i.e., to onPrePrepare).
Change-Id: I91e3baed9a128e845bd32f9dbbacd9b21d852a3d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244118
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp
index e96ffa3..74cf539 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -10,6 +10,7 @@
#include "src/gpu/GrPathProcessor.h"
#include "src/gpu/GrPipeline.h"
#include "src/gpu/GrProcessor.h"
+#include "src/gpu/GrProgramInfo.h"
#include "src/gpu/GrTexturePriv.h"
#include "src/gpu/GrXferProcessor.h"
#include "src/gpu/gl/GrGLBuffer.h"
@@ -73,11 +74,9 @@
///////////////////////////////////////////////////////////////////////////////
void GrGLProgram::updateUniformsAndTextureBindings(const GrRenderTarget* renderTarget,
- GrSurfaceOrigin origin,
- const GrPrimitiveProcessor& primProc,
- const GrPipeline& pipeline,
- const GrTextureProxy* const primProcTextures[]) {
- this->setRenderTargetState(renderTarget, origin, primProc);
+ const GrProgramInfo& programInfo) {
+
+ this->setRenderTargetState(renderTarget, programInfo.origin(), programInfo.primProc());
// we set the textures, and uniforms for installed processors in a generic way, but subclasses
// of GLProgram determine how to set coord transforms
@@ -85,23 +84,24 @@
// We must bind to texture units in the same order in which we set the uniforms in
// GrGLProgramDataManager. That is, we bind textures for processors in this order:
// primProc, fragProcs, XP.
- fPrimitiveProcessor->setData(fProgramDataManager, primProc,
- GrFragmentProcessor::CoordTransformIter(pipeline));
- if (primProcTextures) {
- this->updatePrimitiveProcessorTextureBindings(primProc, primProcTextures);
+ fPrimitiveProcessor->setData(fProgramDataManager, programInfo.primProc(),
+ GrFragmentProcessor::CoordTransformIter(programInfo.pipeline()));
+ if (programInfo.hasFixedPrimProcTextures()) {
+ this->updatePrimitiveProcessorTextureBindings(programInfo.primProc(),
+ programInfo.fixedPrimProcTextures());
}
- int nextTexSamplerIdx = primProc.numTextureSamplers();
+ int nextTexSamplerIdx = programInfo.primProc().numTextureSamplers();
- this->setFragmentData(pipeline, &nextTexSamplerIdx);
+ this->setFragmentData(programInfo.pipeline(), &nextTexSamplerIdx);
- const GrXferProcessor& xp = pipeline.getXferProcessor();
+ const GrXferProcessor& xp = programInfo.pipeline().getXferProcessor();
SkIPoint offset;
- GrTexture* dstTexture = pipeline.peekDstTexture(&offset);
+ GrTexture* dstTexture = programInfo.pipeline().peekDstTexture(&offset);
fXferProcessor->setData(fProgramDataManager, xp, dstTexture, offset);
if (dstTexture) {
fGpu->bindTexture(nextTexSamplerIdx++, GrSamplerState::ClampNearest(),
- pipeline.dstTextureProxy()->textureSwizzle(),
+ programInfo.pipeline().dstTextureProxy()->textureSwizzle(),
static_cast<GrGLTexture*>(dstTexture));
}
SkASSERT(nextTexSamplerIdx == fNumTextureSamplers);