Skip to content

Commit d6ca946

Browse files
Fix panic if indirect buffer has been destroyed (#8689)
1 parent 1ddb5f2 commit d6ca946

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

cts_runner/test.lst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ webgpu:api,validation,encoding,cmds,index_access:*
6565
webgpu:api,validation,encoding,cmds,render,draw:index_buffer_OOB:*
6666
webgpu:api,validation,encoding,cmds,render,draw:unused_buffer_bound:*
6767
webgpu:api,validation,encoding,cmds,render,dynamic_state:*
68+
webgpu:api,validation,encoding,cmds,render,indirect_draw:indirect_buffer,device_mismatch:*
69+
webgpu:api,validation,encoding,cmds,render,indirect_draw:indirect_buffer_usage:*
6870
webgpu:api,validation,encoding,cmds,render,setIndexBuffer:*
6971
webgpu:api,validation,encoding,cmds,render,setVertexBuffer:*
7072
webgpu:api,validation,encoding,encoder_state:*

wgpu-core/src/indirect_validation/draw.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ use super::{
33
CreateIndirectValidationPipelineError,
44
};
55
use crate::{
6+
command::RenderPassErrorInner,
67
device::{queue::TempResource, Device, DeviceError},
78
lock::{rank, Mutex},
89
pipeline::{CreateComputePipelineError, CreateShaderModuleError},
9-
resource::{StagingBuffer, Trackable},
10+
resource::{RawResourceAccess as _, StagingBuffer, Trackable},
1011
snatch::SnatchGuard,
1112
track::TrackerIndex,
1213
FastHashMap,
@@ -199,7 +200,7 @@ impl Draw {
199200
temp_resources: &mut Vec<TempResource>,
200201
encoder: &mut dyn hal::DynCommandEncoder,
201202
batcher: DrawBatcher,
202-
) -> Result<(), DeviceError> {
203+
) -> Result<(), RenderPassErrorInner> {
203204
let mut batches = batcher.batches;
204205

205206
if batches.is_empty() {
@@ -378,6 +379,9 @@ impl Draw {
378379
encoder.set_bind_group(pipeline_layout, 0, Some(metadata_bind_group), &[]);
379380
}
380381

382+
// Make sure the indirect buffer is still valid.
383+
batch.src_buffer.try_raw(snatch_guard)?;
384+
381385
let src_bind_group = batch
382386
.src_buffer
383387
.indirect_validation_bind_groups

0 commit comments

Comments
 (0)