@@ -73,63 +73,60 @@ void GrGLProgram::abandon() {
7373
7474// /////////////////////////////////////////////////////////////////////////////
7575
76- void GrGLProgram::updateUniformsAndTextureBindings (const GrRenderTarget* renderTarget,
77- const GrProgramInfo& programInfo) {
78-
76+ void GrGLProgram::updateUniforms (const GrRenderTarget* renderTarget,
77+ const GrProgramInfo& programInfo) {
7978 this ->setRenderTargetState (renderTarget, programInfo.origin (), programInfo.primProc ());
8079
81- // we set the textures, and uniforms for installed processors in a generic way, but subclasses
82- // of GLProgram determine how to set coord transforms
80+ // we set the uniforms for installed processors in a generic way, but subclasses of GLProgram
81+ // determine how to set coord transforms
8382
8483 // We must bind to texture units in the same order in which we set the uniforms in
8584 // GrGLProgramDataManager. That is, we bind textures for processors in this order:
8685 // primProc, fragProcs, XP.
8786 GrFragmentProcessor::PipelineCoordTransformRange range (programInfo.pipeline ());
8887 fPrimitiveProcessor ->setData (fProgramDataManager , programInfo.primProc (), range);
89- if (programInfo.hasFixedPrimProcTextures ()) {
90- this ->updatePrimitiveProcessorTextureBindings (programInfo.primProc (),
91- programInfo.fixedPrimProcTextures ());
92- }
93- int nextTexSamplerIdx = programInfo.primProc ().numTextureSamplers ();
9488
95- this ->setFragmentData (programInfo.pipeline (), &nextTexSamplerIdx);
89+ GrFragmentProcessor::CIter fpIter (programInfo.pipeline ());
90+ GrGLSLFragmentProcessor::Iter glslIter (fFragmentProcessors .get (), fFragmentProcessorCnt );
91+ for (; fpIter && glslIter; ++fpIter, ++glslIter) {
92+ glslIter->setData (fProgramDataManager , *fpIter);
93+ }
94+ SkASSERT (!fpIter && !glslIter);
9695
9796 const GrXferProcessor& xp = programInfo.pipeline ().getXferProcessor ();
9897 SkIPoint offset;
9998 GrTexture* dstTexture = programInfo.pipeline ().peekDstTexture (&offset);
10099
101100 fXferProcessor ->setData (fProgramDataManager , xp, dstTexture, offset);
102- if (dstTexture) {
103- fGpu ->bindTexture (nextTexSamplerIdx++, GrSamplerState::Filter::kNearest ,
104- programInfo.pipeline ().dstProxyView ().swizzle (),
105- static_cast <GrGLTexture*>(dstTexture));
106- }
107- SkASSERT (nextTexSamplerIdx == fNumTextureSamplers );
108101}
109102
110- void GrGLProgram::updatePrimitiveProcessorTextureBindings (const GrPrimitiveProcessor& primProc,
111- const GrSurfaceProxy* const proxies []) {
103+ void GrGLProgram::bindTextures (const GrPrimitiveProcessor& primProc, const GrPipeline& pipeline ,
104+ const GrSurfaceProxy* const primProcTextureOverrides []) {
112105 for (int i = 0 ; i < primProc.numTextureSamplers (); ++i) {
113- SkASSERT (proxies[i]->asTextureProxy ());
114- auto * tex = static_cast <GrGLTexture*>(proxies[i]->peekTexture ());
106+ SkASSERT (primProcTextureOverrides[i]->asTextureProxy ());
107+ auto * overrideTexture = static_cast <GrGLTexture*>(
108+ primProcTextureOverrides[i]->peekTexture ());
115109 fGpu ->bindTexture (i, primProc.textureSampler (i).samplerState (),
116- primProc.textureSampler (i).swizzle (), tex );
110+ primProc.textureSampler (i).swizzle (), overrideTexture );
117111 }
118- }
112+ int nextTexSamplerIdx = primProc. numTextureSamplers ();
119113
120- void GrGLProgram::setFragmentData (const GrPipeline& pipeline, int * nextTexSamplerIdx) {
121114 GrFragmentProcessor::CIter fpIter (pipeline);
122- GrGLSLFragmentProcessor::Iter glslIter (fFragmentProcessors .get (), fFragmentProcessorCnt );
123- for (; fpIter && glslIter; ++fpIter, ++glslIter) {
124- glslIter->setData (fProgramDataManager , *fpIter);
115+ for (; fpIter; ++fpIter) {
125116 for (int i = 0 ; i < fpIter->numTextureSamplers (); ++i) {
126117 const GrFragmentProcessor::TextureSampler& sampler = fpIter->textureSampler (i);
127- fGpu ->bindTexture ((*nextTexSamplerIdx)++, sampler.samplerState (),
128- sampler.view ().swizzle (),
118+ fGpu ->bindTexture (nextTexSamplerIdx++, sampler.samplerState (), sampler.view ().swizzle (),
129119 static_cast <GrGLTexture*>(sampler.peekTexture ()));
130120 }
131121 }
132- SkASSERT (!fpIter && !glslIter);
122+
123+ SkIPoint offset;
124+ GrTexture* dstTexture = pipeline.peekDstTexture (&offset);
125+ if (dstTexture) {
126+ fGpu ->bindTexture (nextTexSamplerIdx++, GrSamplerState::Filter::kNearest ,
127+ pipeline.dstProxyView ().swizzle (), static_cast <GrGLTexture*>(dstTexture));
128+ }
129+ SkASSERT (nextTexSamplerIdx == fNumTextureSamplers );
133130}
134131
135132void GrGLProgram::setRenderTargetState (const GrRenderTarget* rt, GrSurfaceOrigin origin,
0 commit comments