Handle null vertex buffers in Metal
When using instanced rendering, we sometimes bind a null vertex buffer. Make sure not to crash during the deferred bind. Change-Id: Ia0351222a220c2ac947de52e9d6eb76146dd64b1 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408357 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
parent
1a183bc90d
commit
3193a04b09
@ -416,6 +416,10 @@ void GrMtlOpsRenderPass::setVertexBuffer(id<MTLRenderCommandEncoder> encoder,
|
||||
const GrBuffer* buffer,
|
||||
size_t vertexOffset,
|
||||
size_t inputBufferIndex) {
|
||||
if (!buffer) {
|
||||
return;
|
||||
}
|
||||
|
||||
constexpr static int kFirstBufferBindingIdx = GrMtlUniformHandler::kLastUniformBinding + 1;
|
||||
int index = inputBufferIndex + kFirstBufferBindingIdx;
|
||||
SkASSERT(index < 4);
|
||||
|
Loading…
Reference in New Issue
Block a user