Bind deferred vertex buffers during GrGLOpsRenderPass::onDrawIndirect

When GrGLCaps::drawArraysBaseVertexIsBroken() is true, we have to stash
the vertex buffer away and defer binding until the draw call occurs. We
were forgetting to do this last-minute binding during onDrawIndirect.

Change-Id: I19a93cf2bd6d559e762e7ea1bca33a5e0fd4f03d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303584
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
This commit is contained in:
Chris Dalton 2020-07-17 11:04:54 -06:00 committed by Skia Commit-Bot
parent f2d90659ff
commit 89883ca559

View File

@ -224,6 +224,16 @@ static const void* buffer_offset_to_gl_address(const GrBuffer* drawIndirectBuffe
void GrGLOpsRenderPass::onDrawIndirect(const GrBuffer* drawIndirectBuffer, size_t offset,
int drawCount) {
SkASSERT(fGpu->caps()->nativeDrawIndirectSupport());
SkASSERT(fGpu->glCaps().baseVertexBaseInstanceSupport());
SkASSERT(!fActiveVertexBuffer || fGpu->glCaps().drawArraysBaseVertexIsBroken());
if (fGpu->glCaps().drawArraysBaseVertexIsBroken()) {
// We weren't able to bind the vertex buffer during onBindBuffers because of a driver bug
// affecting glDrawArrays.
this->bindVertexBuffer(fActiveVertexBuffer.get(), 0);
}
fGpu->bindBuffer(GrGpuBufferType::kDrawIndirect, drawIndirectBuffer);
if (fGpu->glCaps().multiDrawIndirectSupport() && drawCount > 1) {
@ -244,6 +254,13 @@ void GrGLOpsRenderPass::onDrawIndirect(const GrBuffer* drawIndirectBuffer, size_
void GrGLOpsRenderPass::onDrawIndexedIndirect(const GrBuffer* drawIndirectBuffer, size_t offset,
int drawCount) {
SkASSERT(fGpu->caps()->nativeDrawIndirectSupport());
SkASSERT(!fGpu->caps()->nativeDrawIndexedIndirectIsBroken());
SkASSERT(fGpu->glCaps().baseVertexBaseInstanceSupport());
// The vertex buffer should have already gotten bound (as opposed us stashing it away during
// onBindBuffers and not expecting to bind it until this point).
SkASSERT(!fActiveVertexBuffer);
fGpu->bindBuffer(GrGpuBufferType::kDrawIndirect, drawIndirectBuffer);
if (fGpu->glCaps().multiDrawIndirectSupport() && drawCount > 1) {