Don't rely on primProc textures when adding samplers

Change-Id: Idee88e061004c308665ad5e7c56528398c8e7201
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274842
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.cpp b/src/gpu/glsl/GrGLSLProgramBuilder.cpp
index 8cc1f06..a427be5 100644
--- a/src/gpu/glsl/GrGLSLProgramBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLProgramBuilder.cpp
@@ -61,20 +61,9 @@
     return this->checkSamplerCounts();
 }
 
-void GrGLSLProgramBuilder::emitAndInstallPrimProc(SkString* outputColor,
-                                                  SkString* outputCoverage) {
+void GrGLSLProgramBuilder::emitAndInstallPrimProc(SkString* outputColor, SkString* outputCoverage) {
     const GrPrimitiveProcessor& proc = this->primitiveProcessor();
 
-    // Because all the texture properties must be consistent between all the dynamic and fixed
-    // primProc proxies, we just deal w/ the first set of dynamic proxies or the set of fixed
-    // proxies here.
-    const GrSurfaceProxy* const* primProcProxies = nullptr;
-    if (fProgramInfo.hasDynamicPrimProcTextures()) {
-        primProcProxies = fProgramInfo.dynamicPrimProcTextures(0);
-    } else if (fProgramInfo.hasFixedPrimProcTextures()) {
-        primProcProxies = fProgramInfo.fixedPrimProcTextures();
-    }
-
     // Program builders have a bit of state we need to clear with each effect
     AutoStageAdvance adv(this);
     this->nameExpression(outputColor, "outputColor");
@@ -108,8 +97,7 @@
         SkString name;
         name.printf("TextureSampler_%d", i);
         const auto& sampler = proc.textureSampler(i);
-        SkASSERT(sampler.textureType() == primProcProxies[i]->backendFormat().textureType());
-        texSamplers[i] = this->emitSampler(primProcProxies[i],
+        texSamplers[i] = this->emitSampler(proc.textureSampler(i).backendFormat(),
                                            sampler.samplerState(),
                                            sampler.swizzle(),
                                            name.c_str());
@@ -190,7 +178,7 @@
             SkString name;
             name.printf("TextureSampler_%d", samplerIdx++);
             const auto& sampler = subFP.textureSampler(i);
-            texSamplers.emplace_back(this->emitSampler(sampler.view().proxy(),
+            texSamplers.emplace_back(this->emitSampler(sampler.view().proxy()->backendFormat(),
                                                        sampler.samplerState(),
                                                        sampler.view().swizzle(),
                                                        name.c_str()));
@@ -249,8 +237,8 @@
     if (GrTextureProxy* dstTextureProxy = dstView.asTextureProxy()) {
         // GrProcessor::TextureSampler sampler(dstTexture);
         const GrSwizzle& swizzle = dstView.swizzle();
-        dstTextureSamplerHandle = this->emitSampler(dstTextureProxy, GrSamplerState(),
-                                                    swizzle, "DstTextureSampler");
+        dstTextureSamplerHandle = this->emitSampler(dstTextureProxy->backendFormat(),
+                                                    GrSamplerState(), swizzle, "DstTextureSampler");
         dstTextureOrigin = dstView.origin();
         SkASSERT(dstTextureProxy->textureType() != GrTextureType::kExternal);
     }
@@ -276,12 +264,12 @@
     fFS.codeAppend("}");
 }
 
-GrGLSLProgramBuilder::SamplerHandle GrGLSLProgramBuilder::emitSampler(const GrSurfaceProxy* texture,
-                                                                      GrSamplerState state,
-                                                                      const GrSwizzle& swizzle,
-                                                                      const char* name) {
+GrGLSLProgramBuilder::SamplerHandle GrGLSLProgramBuilder::emitSampler(
+        const GrBackendFormat& backendFormat, GrSamplerState state, const GrSwizzle& swizzle,
+        const char* name) {
     ++fNumFragmentSamplers;
-    return this->uniformHandler()->addSampler(texture, state, swizzle, name, this->shaderCaps());
+    return this->uniformHandler()->addSampler(backendFormat, state, swizzle, name,
+                                              this->shaderCaps());
 }
 
 bool GrGLSLProgramBuilder::checkSamplerCounts() {