Change the argument ordering for GrOpsRenderPass::bindTextures
Places the primProc textures immediately after the primProc. This is
the more intuitive place for them and helps show that the pipeline is
there for FPs (not the primProc).
Change-Id: I87cb5715dc5652306713c4d8dced6200a2604b5d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275313
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrOpsRenderPass.cpp b/src/gpu/GrOpsRenderPass.cpp
index 6de07f3..70a392f 100644
--- a/src/gpu/GrOpsRenderPass.cpp
+++ b/src/gpu/GrOpsRenderPass.cpp
@@ -113,8 +113,9 @@
SkDEBUGCODE(fScissorStatus = DynamicStateStatus::kConfigured);
}
-void GrOpsRenderPass::bindTextures(const GrPrimitiveProcessor& primProc, const GrPipeline& pipeline,
- const GrSurfaceProxy* const primProcTextures[]) {
+void GrOpsRenderPass::bindTextures(const GrPrimitiveProcessor& primProc,
+ const GrSurfaceProxy* const primProcTextures[],
+ const GrPipeline& pipeline) {
#ifdef SK_DEBUG
SkASSERT((primProc.numTextureSamplers() > 0) == SkToBool(primProcTextures));
for (int i = 0; i < primProc.numTextureSamplers(); ++i) {
@@ -131,7 +132,7 @@
// Don't assert on fTextureBindingStatus. onBindTextures() just turns into a no-op when there
// aren't any textures, and it's hard to tell from the GrPipeline whether there are any. For
// many clients it is easier to just always call this method.
- if (!this->onBindTextures(primProc, pipeline, primProcTextures)) {
+ if (!this->onBindTextures(primProc, primProcTextures, pipeline)) {
fDrawPipelineStatus = DrawPipelineStatus::kFailedToBind;
return;
}
@@ -147,15 +148,15 @@
if (!programInfo.hasDynamicPrimProcTextures()) {
auto primProcTextures = (programInfo.hasFixedPrimProcTextures()) ?
programInfo.fixedPrimProcTextures() : nullptr;
- this->bindTextures(programInfo.primProc(), programInfo.pipeline(), primProcTextures);
+ this->bindTextures(programInfo.primProc(), primProcTextures, programInfo.pipeline());
}
for (int i = 0; i < meshCount; ++i) {
if (programInfo.hasDynamicScissors()) {
this->setScissorRect(programInfo.dynamicScissor(i));
}
if (programInfo.hasDynamicPrimProcTextures()) {
- this->bindTextures(programInfo.primProc(), programInfo.pipeline(),
- programInfo.dynamicPrimProcTextures(i));
+ this->bindTextures(programInfo.primProc(), programInfo.dynamicPrimProcTextures(i),
+ programInfo.pipeline());
}
meshes[i].draw(this);
}
diff --git a/src/gpu/GrOpsRenderPass.h b/src/gpu/GrOpsRenderPass.h
index 3804a8a..c6d8c1c 100644
--- a/src/gpu/GrOpsRenderPass.h
+++ b/src/gpu/GrOpsRenderPass.h
@@ -60,16 +60,17 @@
// pipeline.
void setScissorRect(const SkIRect&);
- // Texture bindings are dynamic state and therefore not set during bindPipeline(). If the
- // current program uses textures, then the client must call bindTextures() before drawing.
- // The primitive processor textures may also be updated between draws by calling bindTextures()
- // again with a different array for primProcTextures. (On subsequent calls, if the backend is
- // capable of updating the primitive processor textures independently, then it will
- // automatically skip binding textures from GrPipeline.)
+ // Binds textures for the primitive processor and any FP on the GrPipeline. Texture bindings are
+ // dynamic state and therefore not set during bindPipeline(). If the current program uses
+ // textures, then the client must call bindTextures() before drawing. The primitive processor
+ // textures may also be updated between draws by calling bindTextures() again with a different
+ // array for primProcTextures. (On subsequent calls, if the backend is capable of updating the
+ // primitive processor textures independently, then it will automatically skip re-binding
+ // FP textures from GrPipeline.)
//
// If the current program does not use textures, this is a no-op.
- void bindTextures(const GrPrimitiveProcessor&, const GrPipeline&,
- const GrSurfaceProxy* const primProcTextures[]);
+ void bindTextures(const GrPrimitiveProcessor&, const GrSurfaceProxy* const primProcTextures[],
+ const GrPipeline&);
void bindBuffers(const GrBuffer* indexBuffer, const GrBuffer* instanceBuffer,
const GrBuffer* vertexBuffer, GrPrimitiveRestart = GrPrimitiveRestart::kNo);
@@ -136,8 +137,9 @@
// overridden by backend-specific derived class to perform the rendering command.
virtual bool onBindPipeline(const GrProgramInfo&, const SkRect& drawBounds) = 0;
virtual void onSetScissorRect(const SkIRect&) = 0;
- virtual bool onBindTextures(const GrPrimitiveProcessor&, const GrPipeline&,
- const GrSurfaceProxy* const primProcTextures[]) = 0;
+ virtual bool onBindTextures(const GrPrimitiveProcessor&,
+ const GrSurfaceProxy* const primProcTextures[],
+ const GrPipeline&) = 0;
virtual void onBindBuffers(const GrBuffer* indexBuffer, const GrBuffer* instanceBuffer,
const GrBuffer* vertexBuffer, GrPrimitiveRestart) = 0;
virtual void onDraw(int vertexCount, int baseVertex) = 0;
diff --git a/src/gpu/d3d/GrD3DOpsRenderPass.h b/src/gpu/d3d/GrD3DOpsRenderPass.h
index e0ef264..78b0159 100644
--- a/src/gpu/d3d/GrD3DOpsRenderPass.h
+++ b/src/gpu/d3d/GrD3DOpsRenderPass.h
@@ -39,8 +39,8 @@
bool onBindPipeline(const GrProgramInfo&, const SkRect& drawBounds) override { return true; }
void onSetScissorRect(const SkIRect&) override {}
- bool onBindTextures(const GrPrimitiveProcessor&, const GrPipeline&,
- const GrSurfaceProxy* const primProcTextures[]) override {
+ bool onBindTextures(const GrPrimitiveProcessor&, const GrSurfaceProxy* const primProcTextures[],
+ const GrPipeline&) override {
return true;
}
void onBindBuffers(const GrBuffer* indexBuffer, const GrBuffer* instanceBuffer,
diff --git a/src/gpu/dawn/GrDawnOpsRenderPass.cpp b/src/gpu/dawn/GrDawnOpsRenderPass.cpp
index debe15b..f8dbb9a 100644
--- a/src/gpu/dawn/GrDawnOpsRenderPass.cpp
+++ b/src/gpu/dawn/GrDawnOpsRenderPass.cpp
@@ -159,9 +159,9 @@
}
bool GrDawnOpsRenderPass::onBindTextures(const GrPrimitiveProcessor& primProc,
- const GrPipeline& pipeline,
- const GrSurfaceProxy* const textures[]) {
- auto bindGroup = fCurrentProgram->setTextures(fGpu, primProc, pipeline, textures);
+ const GrSurfaceProxy* const primProcTextures[],
+ const GrPipeline& pipeline) {
+ auto bindGroup = fCurrentProgram->setTextures(fGpu, primProc, pipeline, primProcTextures);
fPassEncoder.SetBindGroup(1, bindGroup, 0, nullptr);
return true;
}
diff --git a/src/gpu/dawn/GrDawnOpsRenderPass.h b/src/gpu/dawn/GrDawnOpsRenderPass.h
index ad3a359..e473edd 100644
--- a/src/gpu/dawn/GrDawnOpsRenderPass.h
+++ b/src/gpu/dawn/GrDawnOpsRenderPass.h
@@ -43,8 +43,8 @@
bool onBindPipeline(const GrProgramInfo& programInfo, const SkRect& drawBounds) override;
void onSetScissorRect(const SkIRect&) override;
- bool onBindTextures(const GrPrimitiveProcessor&, const GrPipeline&,
- const GrSurfaceProxy* const primProcTextures[]) override;
+ bool onBindTextures(const GrPrimitiveProcessor&, const GrSurfaceProxy* const primProcTextures[],
+ const GrPipeline&) override;
void onBindBuffers(const GrBuffer* indexBuffer, const GrBuffer* instanceBuffer,
const GrBuffer* vertexBuffer, GrPrimitiveRestart) override;
void onDraw(int vertexCount, int baseVertex) override;
diff --git a/src/gpu/gl/GrGLOpsRenderPass.cpp b/src/gpu/gl/GrGLOpsRenderPass.cpp
index 23f45a1..2315ad8 100644
--- a/src/gpu/gl/GrGLOpsRenderPass.cpp
+++ b/src/gpu/gl/GrGLOpsRenderPass.cpp
@@ -36,13 +36,13 @@
}
bool GrGLOpsRenderPass::onBindTextures(const GrPrimitiveProcessor& primProc,
- const GrPipeline& pipeline,
- const GrSurfaceProxy* const primProcTextures[]) {
+ const GrSurfaceProxy* const primProcTextures[],
+ const GrPipeline& pipeline) {
GrGLProgram* program = fGpu->currentProgram();
if (!program) {
return false;
}
- program->bindTextures(primProc, pipeline, primProcTextures);
+ program->bindTextures(primProc, primProcTextures, pipeline);
return true;
}
diff --git a/src/gpu/gl/GrGLOpsRenderPass.h b/src/gpu/gl/GrGLOpsRenderPass.h
index a7eb31c..182982d 100644
--- a/src/gpu/gl/GrGLOpsRenderPass.h
+++ b/src/gpu/gl/GrGLOpsRenderPass.h
@@ -54,8 +54,8 @@
bool onBindPipeline(const GrProgramInfo& programInfo, const SkRect& drawBounds) override;
void onSetScissorRect(const SkIRect& scissor) override;
- bool onBindTextures(const GrPrimitiveProcessor& primProc, const GrPipeline& pipeline,
- const GrSurfaceProxy* const primProcTextures[]) override;
+ bool onBindTextures(const GrPrimitiveProcessor&, const GrSurfaceProxy* const primProcTextures[],
+ const GrPipeline& pipeline) override;
void onBindBuffers(const GrBuffer* indexBuffer, const GrBuffer* instanceBuffer,
const GrBuffer* vertexBuffer, GrPrimitiveRestart) override;
void onDraw(int vertexCount, int baseVertex) override;
diff --git a/src/gpu/gl/GrGLPathRendering.cpp b/src/gpu/gl/GrGLPathRendering.cpp
index 2d910a8..425a3c8 100644
--- a/src/gpu/gl/GrGLPathRendering.cpp
+++ b/src/gpu/gl/GrGLPathRendering.cpp
@@ -122,8 +122,8 @@
this->gpu()->flushScissorRect(programInfo.fixedScissor(), renderTarget->width(),
renderTarget->height(), programInfo.origin());
}
- this->gpu()->currentProgram()->bindTextures(
- programInfo.primProc(), programInfo.pipeline(), nullptr);
+ this->gpu()->currentProgram()->bindTextures(programInfo.primProc(), nullptr,
+ programInfo.pipeline());
const GrGLPath* glPath = static_cast<const GrGLPath*>(path);
diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp
index fd2c4a3..fd11185 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -100,8 +100,9 @@
fXferProcessor->setData(fProgramDataManager, xp, dstTexture, offset);
}
-void GrGLProgram::bindTextures(const GrPrimitiveProcessor& primProc, const GrPipeline& pipeline,
- const GrSurfaceProxy* const primProcTextures[]) {
+void GrGLProgram::bindTextures(const GrPrimitiveProcessor& primProc,
+ const GrSurfaceProxy* const primProcTextures[],
+ const GrPipeline& pipeline) {
for (int i = 0; i < primProc.numTextureSamplers(); ++i) {
SkASSERT(primProcTextures[i]->asTextureProxy());
auto* overrideTexture = static_cast<GrGLTexture*>(primProcTextures[i]->peekTexture());
diff --git a/src/gpu/gl/GrGLProgram.h b/src/gpu/gl/GrGLProgram.h
index 83ff0c6..f784f2b 100644
--- a/src/gpu/gl/GrGLProgram.h
+++ b/src/gpu/gl/GrGLProgram.h
@@ -122,8 +122,8 @@
/**
* Binds all primitive processor and fragment processor textures.
*/
- void bindTextures(const GrPrimitiveProcessor&, const GrPipeline&,
- const GrSurfaceProxy* const primProcTextures[]);
+ void bindTextures(const GrPrimitiveProcessor&, const GrSurfaceProxy* const primProcTextures[],
+ const GrPipeline&);
int vertexStride() const { return fVertexStride; }
int instanceStride() const { return fInstanceStride; }
diff --git a/src/gpu/mock/GrMockOpsRenderPass.h b/src/gpu/mock/GrMockOpsRenderPass.h
index f5984fa..26f6810 100644
--- a/src/gpu/mock/GrMockOpsRenderPass.h
+++ b/src/gpu/mock/GrMockOpsRenderPass.h
@@ -36,8 +36,8 @@
private:
bool onBindPipeline(const GrProgramInfo&, const SkRect&) override { return true; }
void onSetScissorRect(const SkIRect&) override {}
- bool onBindTextures(const GrPrimitiveProcessor&, const GrPipeline&,
- const GrSurfaceProxy* const primProcTextures[]) override { return true; }
+ bool onBindTextures(const GrPrimitiveProcessor&, const GrSurfaceProxy* const primProcTextures[],
+ const GrPipeline&) override { return true; }
void onBindBuffers(const GrBuffer* indexBuffer, const GrBuffer* instanceBuffer,
const GrBuffer* vertexBuffer, GrPrimitiveRestart) override {}
void onDraw(int, int) override { this->dummyDraw(); }
diff --git a/src/gpu/mtl/GrMtlOpsRenderPass.h b/src/gpu/mtl/GrMtlOpsRenderPass.h
index 8724108..8bd4c28 100644
--- a/src/gpu/mtl/GrMtlOpsRenderPass.h
+++ b/src/gpu/mtl/GrMtlOpsRenderPass.h
@@ -41,8 +41,8 @@
bool onBindPipeline(const GrProgramInfo&, const SkRect& drawBounds) override;
void onSetScissorRect(const SkIRect&) override;
- bool onBindTextures(const GrPrimitiveProcessor&, const GrPipeline&,
- const GrSurfaceProxy* const primProcTextures[]) override;
+ bool onBindTextures(const GrPrimitiveProcessor&, const GrSurfaceProxy* const primProcTextures[],
+ const GrPipeline&) override;
void onBindBuffers(const GrBuffer* indexBuffer, const GrBuffer* instanceBuffer,
const GrBuffer* vertexBuffer, GrPrimitiveRestart) override;
void onDraw(int vertexCount, int baseVertex) override;
diff --git a/src/gpu/mtl/GrMtlOpsRenderPass.mm b/src/gpu/mtl/GrMtlOpsRenderPass.mm
index be0d3b3..0a24cd4 100644
--- a/src/gpu/mtl/GrMtlOpsRenderPass.mm
+++ b/src/gpu/mtl/GrMtlOpsRenderPass.mm
@@ -114,8 +114,8 @@
}
bool GrMtlOpsRenderPass::onBindTextures(const GrPrimitiveProcessor& primProc,
- const GrPipeline& pipeline,
- const GrSurfaceProxy* const primProcTextures[]) {
+ const GrSurfaceProxy* const primProcTextures[],
+ const GrPipeline& pipeline) {
SkASSERT(fActivePipelineState);
SkASSERT(fActiveRenderCmdEncoder);
fActivePipelineState->setTextures(primProc, pipeline, primProcTextures);
diff --git a/src/gpu/vk/GrVkOpsRenderPass.cpp b/src/gpu/vk/GrVkOpsRenderPass.cpp
index 920da28..4be047a 100644
--- a/src/gpu/vk/GrVkOpsRenderPass.cpp
+++ b/src/gpu/vk/GrVkOpsRenderPass.cpp
@@ -544,8 +544,8 @@
}
bool GrVkOpsRenderPass::onBindTextures(const GrPrimitiveProcessor& primProc,
- const GrPipeline& pipeline,
- const GrSurfaceProxy* const primProcTextures[]) {
+ const GrSurfaceProxy* const primProcTextures[],
+ const GrPipeline& pipeline) {
SkASSERT(fCurrentPipelineState);
return fCurrentPipelineState->setAndBindTextures(fGpu, primProc, pipeline, primProcTextures,
this->currentCommandBuffer());
diff --git a/src/gpu/vk/GrVkOpsRenderPass.h b/src/gpu/vk/GrVkOpsRenderPass.h
index 652e9f1..e5d37e2 100644
--- a/src/gpu/vk/GrVkOpsRenderPass.h
+++ b/src/gpu/vk/GrVkOpsRenderPass.h
@@ -65,8 +65,8 @@
bool onBindPipeline(const GrProgramInfo&, const SkRect& drawBounds) override;
void onSetScissorRect(const SkIRect&) override;
- bool onBindTextures(const GrPrimitiveProcessor&, const GrPipeline&,
- const GrSurfaceProxy* const primProcTextures[]) override;
+ bool onBindTextures(const GrPrimitiveProcessor&, const GrSurfaceProxy* const primProcTextures[],
+ const GrPipeline&) override;
void onBindBuffers(const GrBuffer* indexBuffer, const GrBuffer* instanceBuffer,
const GrBuffer* vertexBuffer, GrPrimitiveRestart) override;
void onDraw(int vertexCount, int baseVertex) override {