From d612df3b5a826394e3e77c6947e401f72a99ddf9 Mon Sep 17 00:00:00 2001 From: Nicolas Silva Date: Tue, 9 Jan 2024 14:13:08 +0100 Subject: [PATCH] Validate max_vertex_buffers in render bundles. --- wgpu-core/src/command/bundle.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/wgpu-core/src/command/bundle.rs b/wgpu-core/src/command/bundle.rs index f9b71affce..c37f3c59b8 100644 --- a/wgpu-core/src/command/bundle.rs +++ b/wgpu-core/src/command/bundle.rs @@ -430,6 +430,16 @@ impl RenderBundleEncoder { size, } => { let scope = PassErrorScope::SetVertexBuffer(buffer_id); + + let max_vertex_buffers = device.limits.max_vertex_buffers; + if slot >= max_vertex_buffers { + return Err(RenderCommandError::VertexBufferIndexOutOfRange { + index: slot, + max: max_vertex_buffers, + }) + .map_pass_err(scope); + } + let buffer = state .trackers .buffers