Skip to content

Commit

Permalink
fix incompatibility with new wgpu trunk changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Vecvec committed Dec 17, 2023
1 parent 07f6e1a commit 817e545
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions wgpu-core/src/command/ray_tracing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,19 +296,20 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
}

let mut triangle_entries = Vec::<hal::AccelerationStructureTriangles<A>>::new();
let snatch_guard = device.snatchable_lock.read();
for buf in &mut buf_storage {
let mesh = &buf.4;
let vertex_buffer = {
let vertex_buffer = buf.0.as_ref();
let vertex_raw = vertex_buffer.raw.as_ref().ok_or(
let vertex_raw = vertex_buffer.raw.get(&snatch_guard).ok_or(
BuildAccelerationStructureError::InvalidBuffer(mesh.vertex_buffer),
)?;
if !vertex_buffer.usage.contains(BufferUsages::BLAS_INPUT) {
return Err(BuildAccelerationStructureError::MissingBlasInputUsageFlag(
mesh.vertex_buffer,
));
}
if let Some(barrier) = buf.1.take().map(|pending| pending.into_hal(vertex_buffer)) {
if let Some(barrier) = buf.1.take().map(|pending| pending.into_hal(vertex_buffer, &snatch_guard)) {
input_barriers.push(barrier);
}
if vertex_buffer.size
Expand Down Expand Up @@ -336,7 +337,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
let index_id = mesh.index_buffer.as_ref().unwrap();
let index_raw = index_buffer
.raw
.as_ref()
.get(&snatch_guard)
.ok_or(BuildAccelerationStructureError::InvalidBuffer(*index_id))?;
if !index_buffer.usage.contains(BufferUsages::BLAS_INPUT) {
return Err(BuildAccelerationStructureError::MissingBlasInputUsageFlag(
Expand All @@ -345,7 +346,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
}
if let Some(barrier) = index_pending
.take()
.map(|pending| pending.into_hal(index_buffer))
.map(|pending| pending.into_hal(index_buffer, &snatch_guard))
{
input_barriers.push(barrier);
}
Expand Down Expand Up @@ -405,7 +406,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
*transform_id,
));
}
let transform_raw = transform_buffer.raw.as_ref().ok_or(
let transform_raw = transform_buffer.raw.get(&snatch_guard).ok_or(
BuildAccelerationStructureError::InvalidBuffer(*transform_id),
)?;
if !transform_buffer.usage.contains(BufferUsages::BLAS_INPUT) {
Expand All @@ -415,7 +416,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
}
if let Some(barrier) = transform_pending
.take()
.map(|pending| pending.into_hal(transform_buffer))
.map(|pending| pending.into_hal(transform_buffer, &snatch_guard))
{
input_barriers.push(barrier);
}
Expand Down Expand Up @@ -519,7 +520,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
let entry = &tlas_buf.2;
let instance_buffer = {
let (instance_buffer, instance_pending) = (&mut tlas_buf.0, &mut tlas_buf.1);
let instance_raw = instance_buffer.raw.as_ref().ok_or(
let instance_raw = instance_buffer.raw.get(&snatch_guard).ok_or(
BuildAccelerationStructureError::InvalidBuffer(entry.instance_buffer_id),
)?;
if !instance_buffer.usage.contains(BufferUsages::TLAS_INPUT) {
Expand All @@ -529,7 +530,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
}
if let Some(barrier) = instance_pending
.take()
.map(|pending| pending.into_hal(instance_buffer))
.map(|pending| pending.into_hal(instance_buffer, &snatch_guard))
{
input_barriers.push(barrier);
}
Expand Down Expand Up @@ -999,19 +1000,20 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
}

let mut triangle_entries = Vec::<hal::AccelerationStructureTriangles<A>>::new();
let snatch_guard = device.snatchable_lock.read();
for buf in &mut buf_storage {
let mesh = &buf.4;
let vertex_buffer = {
let vertex_buffer = buf.0.as_ref();
let vertex_raw = vertex_buffer.raw.as_ref().ok_or(
let vertex_raw = vertex_buffer.raw.get(&snatch_guard).ok_or(
BuildAccelerationStructureError::InvalidBuffer(mesh.vertex_buffer),
)?;
if !vertex_buffer.usage.contains(BufferUsages::BLAS_INPUT) {
return Err(BuildAccelerationStructureError::MissingBlasInputUsageFlag(
mesh.vertex_buffer,
));
}
if let Some(barrier) = buf.1.take().map(|pending| pending.into_hal(vertex_buffer)) {
if let Some(barrier) = buf.1.take().map(|pending| pending.into_hal(vertex_buffer, &snatch_guard)) {
input_barriers.push(barrier);
}
if vertex_buffer.size
Expand Down Expand Up @@ -1039,7 +1041,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
let index_id = mesh.index_buffer.as_ref().unwrap();
let index_raw = index_buffer
.raw
.as_ref()
.get(&snatch_guard)
.ok_or(BuildAccelerationStructureError::InvalidBuffer(*index_id))?;
if !index_buffer.usage.contains(BufferUsages::BLAS_INPUT) {
return Err(BuildAccelerationStructureError::MissingBlasInputUsageFlag(
Expand All @@ -1048,7 +1050,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
}
if let Some(barrier) = index_pending
.take()
.map(|pending| pending.into_hal(index_buffer))
.map(|pending| pending.into_hal(index_buffer, &snatch_guard))
{
input_barriers.push(barrier);
}
Expand Down Expand Up @@ -1108,7 +1110,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
*transform_id,
));
}
let transform_raw = transform_buffer.raw.as_ref().ok_or(
let transform_raw = transform_buffer.raw.get(&snatch_guard).ok_or(
BuildAccelerationStructureError::InvalidBuffer(*transform_id),
)?;
if !transform_buffer.usage.contains(BufferUsages::BLAS_INPUT) {
Expand All @@ -1118,7 +1120,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
}
if let Some(barrier) = transform_pending
.take()
.map(|pending| pending.into_hal(transform_buffer))
.map(|pending| pending.into_hal(transform_buffer, &snatch_guard))
{
input_barriers.push(barrier);
}
Expand Down

0 comments on commit 817e545

Please sign in to comment.