Skip to content

Commit 7cea4ba

Browse files
committed
Fix issues
1 parent 801c035 commit 7cea4ba

7 files changed

Lines changed: 37 additions & 12 deletions

File tree

examples/features/src/ray_aabb_compute/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ impl crate::framework::Example for Example {
288288
)),
289289
0,
290290
0xff,
291+
wgpu::IntersectionShaderIndex::QueryData(0),
291292
));
292293

293294
let mut encoder =

wgpu-core/src/binding_model.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,12 @@ impl From<&Arc<ComputePipeline>> for ExclusivePipeline {
737737
}
738738
}
739739

740+
impl From<&Arc<RayTracingPipeline>> for ExclusivePipeline {
741+
fn from(pipeline: &Arc<RayTracingPipeline>) -> Self {
742+
Self::RayTracing(Arc::downgrade(pipeline))
743+
}
744+
}
745+
740746
impl fmt::Display for ExclusivePipeline {
741747
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
742748
match self {

wgpu-core/src/command/ray_tracing_pass.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,10 @@ pub(super) fn encode_ray_tracing_pass(
645645
string_offset: 0,
646646
},
647647

648-
intermediate_trackers: Tracker::new(),
648+
intermediate_trackers: Tracker::new(
649+
device.ordered_buffer_usages,
650+
device.ordered_texture_usages,
651+
),
649652
};
650653

651654
let indices = &device.tracker_indices;

wgpu-core/src/device/global.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1823,7 +1823,7 @@ impl Global {
18231823
Ok(module) => module,
18241824
Err(e) => break 'error e.into(),
18251825
};
1826-
if module.interface.is_none() && layout.is_none() {
1826+
if module.interface.interface().is_none() && layout.is_none() {
18271827
break 'error pipeline::CreateRayTracingPipelineError::Implicit(
18281828
pipeline::ImplicitLayoutError::Passthrough(
18291829
wgt::ShaderStages::RAY_GENERATION,
@@ -1846,7 +1846,7 @@ impl Global {
18461846
Ok(module) => module,
18471847
Err(e) => break 'error e.into(),
18481848
};
1849-
if module.interface.is_none() && layout.is_none() {
1849+
if module.interface.interface().is_none() && layout.is_none() {
18501850
break 'error pipeline::CreateRayTracingPipelineError::Implicit(
18511851
pipeline::ImplicitLayoutError::Passthrough(wgt::ShaderStages::MISS),
18521852
);
@@ -1873,7 +1873,7 @@ impl Global {
18731873
Ok(module) => module,
18741874
Err(e) => break 'error e.into(),
18751875
};
1876-
if module.interface.is_none() && layout.is_none() {
1876+
if module.interface.interface().is_none() && layout.is_none() {
18771877
break 'error pipeline::CreateRayTracingPipelineError::Implicit(
18781878
pipeline::ImplicitLayoutError::Passthrough(
18791879
wgt::ShaderStages::CLOSEST_HIT,
@@ -1896,7 +1896,7 @@ impl Global {
18961896
Ok(module) => module,
18971897
Err(e) => break 'error e.into(),
18981898
};
1899-
if module.interface.is_none() && layout.is_none() {
1899+
if module.interface.interface().is_none() && layout.is_none() {
19001900
break 'error pipeline::CreateRayTracingPipelineError::Implicit(
19011901
pipeline::ImplicitLayoutError::Passthrough(
19021902
wgt::ShaderStages::ANY_HIT,

wgpu-core/src/device/ray_tracing.rs

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,9 @@ impl Device {
333333
None => validation::BindingLayoutSource::new_derived(&self.limits),
334334
};
335335

336+
// The size the immediates will be if there is no pipeline layout
337+
let mut derived_immediate_size = 0;
338+
336339
let final_ray_gen_name;
337340
let ray_generation = {
338341
let stage = validation::ShaderStageForValidation::RayGeneration;
@@ -353,19 +356,22 @@ impl Device {
353356
error: e,
354357
})?;
355358

356-
if let Some(ref interface) = desc.ray_generation.module.interface {
359+
if let Some(interface) = desc.ray_generation.module.interface.interface() {
357360
io = interface
358361
.check_stage(
359362
&mut binding_layout_source,
360363
&mut shader_binding_sizes,
361364
&final_ray_gen_name,
362365
stage,
363366
io,
367+
None,
364368
)
365369
.map_err(|e| pipeline::CreateRayTracingPipelineError::Stage {
366370
stage: stage_bit,
367371
error: e,
368372
})?;
373+
374+
derived_immediate_size = derived_immediate_size.max(interface.immediate_size);
369375
}
370376

371377
hal::ProgrammableStage {
@@ -395,19 +401,22 @@ impl Device {
395401
error: e,
396402
})?;
397403

398-
if let Some(ref interface) = desc.miss.module.interface {
404+
if let Some(interface) = desc.miss.module.interface.interface() {
399405
io = interface
400406
.check_stage(
401407
&mut binding_layout_source,
402408
&mut shader_binding_sizes,
403409
&final_miss_name,
404410
stage,
405411
io,
412+
None,
406413
)
407414
.map_err(|e| pipeline::CreateRayTracingPipelineError::Stage {
408415
stage: stage_bit,
409416
error: e,
410417
})?;
418+
419+
derived_immediate_size = derived_immediate_size.max(interface.immediate_size);
411420
}
412421

413422
hal::ProgrammableStage {
@@ -500,19 +509,22 @@ impl Device {
500509
validation::ShaderStageForValidation::ClosestHit { triangle: true };
501510

502511
let stage_bits = stage.to_wgt_bit();
503-
if let Some(ref interface) = closest_hit.module.interface {
512+
if let Some(interface) = closest_hit.module.interface.interface() {
504513
io = interface
505514
.check_stage(
506515
&mut binding_layout_source,
507516
&mut shader_binding_sizes,
508517
final_closest_name,
509518
stage,
510519
io,
520+
None,
511521
)
512522
.map_err(|e| pipeline::CreateRayTracingPipelineError::Stage {
513523
stage: stage_bits,
514524
error: e,
515525
})?;
526+
527+
derived_immediate_size = derived_immediate_size.max(interface.immediate_size);
516528
}
517529

518530
hal::ProgrammableStage {
@@ -532,21 +544,24 @@ impl Device {
532544
let final_any_name = final_any_name.as_ref().unwrap();
533545

534546
let stage_bits = stage.to_wgt_bit();
535-
if let Some(ref interface) = any_hit.module.interface {
547+
if let Some(interface) = any_hit.module.interface.interface() {
536548
io = interface
537549
.check_stage(
538550
&mut binding_layout_source,
539551
&mut shader_binding_sizes,
540552
final_any_name,
541553
stage,
542554
io,
555+
None,
543556
)
544557
.map_err(|e| {
545558
pipeline::CreateRayTracingPipelineError::Stage {
546559
stage: stage_bits,
547560
error: e,
548561
}
549562
})?;
563+
564+
derived_immediate_size = derived_immediate_size.max(interface.immediate_size);
550565
}
551566

552567
Some(hal::ProgrammableStage {
@@ -587,7 +602,7 @@ impl Device {
587602
let pipeline_layout = match binding_layout_source {
588603
validation::BindingLayoutSource::Provided(layout) => layout,
589604
validation::BindingLayoutSource::Derived(entries) => {
590-
self.create_derived_pipeline_layout(entries)?
605+
self.create_derived_pipeline_layout(entries, derived_immediate_size)?
591606
}
592607
};
593608

wgpu-core/src/pipeline.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1137,6 +1137,6 @@ impl RayTracingPipeline {
11371137
self: &Arc<Self>,
11381138
index: u32,
11391139
) -> Result<Arc<BindGroupLayout>, GetBindGroupLayoutError> {
1140-
self.layout.get_bind_group_layout(index)
1140+
self.layout.get_bind_group_layout(index, self.into())
11411141
}
11421142
}

wgpu-types/src/features.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1472,7 +1472,7 @@ bitflags_array! {
14721472

14731473
/// Allows for constructing ray tracing pipelines.
14741474
#[name("wgpu-ray-tracing-pipelines")]
1475-
const EXPERIMENTAL_RAY_TRACING_PIPELINES = 1 << 63;
1475+
const EXPERIMENTAL_RAY_TRACING_PIPELINES = 1 << 24;
14761476

14771477
// Adding a new feature? All bits in the first u64 are used. Use the second u64 (bits 64+).
14781478
}

0 commit comments

Comments
 (0)