Revert "Add ability to specify different GP textures for each mesh in a draw."
This reverts commit d1b8a166db27ffb8e550c4e853afbd67025948bf.
Reason for revert: breaks android apps, by drawing overlapping content out of painters order.
Original change's description:
> Add ability to specify different GP textures for each mesh in a draw.
>
> Uses GrPipeline::DynamicStateArrays to allow per-mesh GP textures when
> drawing an array of GrMeshes.
>
> Uses this along with op-chaining to make drawing multiple TextureOps
> with different textures faster.
>
> Change-Id: Iec4da1b72a13d0e0c94c8a8568fe4221c539dfcf
> Reviewed-on: https://skia-review.googlesource.com/145960
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
TBR=bsalomon@google.com,robertphillips@google.com,brianosman@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: I5c686b85adb378ba7faf34576efce74aebd348f7
Reviewed-on: https://skia-review.googlesource.com/147260
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp
index 102dc4a..9e90642 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -75,6 +75,7 @@
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
@@ -83,12 +84,13 @@
// 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.
+ int nextTexSamplerIdx = 0;
fPrimitiveProcessor->setData(fProgramDataManager, primProc,
GrFragmentProcessor::CoordTransformIter(pipeline));
- if (primProcTextures) {
- this->updatePrimitiveProcessorTextureBindings(primProc, primProcTextures);
+ for (int i = 0; i < primProc.numTextureSamplers(); ++i) {
+ auto* tex = static_cast<GrGLTexture*>(primProcTextures[i]->peekTexture());
+ fGpu->bindTexture(nextTexSamplerIdx++, primProc.textureSampler(i).samplerState(), tex);
}
- int nextTexSamplerIdx = primProc.numTextureSamplers();
this->setFragmentData(pipeline, &nextTexSamplerIdx);
@@ -104,14 +106,6 @@
SkASSERT(nextTexSamplerIdx == fNumTextureSamplers);
}
-void GrGLProgram::updatePrimitiveProcessorTextureBindings(const GrPrimitiveProcessor& primProc,
- const GrTextureProxy* const proxies[]) {
- for (int i = 0; i < primProc.numTextureSamplers(); ++i) {
- auto* tex = static_cast<GrGLTexture*>(proxies[i]->peekTexture());
- fGpu->bindTexture(i, primProc.textureSampler(i).samplerState(), tex);
- }
-}
-
void GrGLProgram::setFragmentData(const GrPipeline& pipeline, int* nextTexSamplerIdx) {
GrFragmentProcessor::Iter iter(pipeline);
GrGLSLFragmentProcessor::Iter glslIter(fFragmentProcessors.get(), fFragmentProcessorCnt);