Skip to content

Commit d4574d5

Browse files
committed
Apply suggestions
1 parent ee8883c commit d4574d5

File tree

5 files changed

+13
-12
lines changed

5 files changed

+13
-12
lines changed

naga/src/back/glsl/mod.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,11 @@ impl crate::AddressSpace {
140140
| crate::AddressSpace::Storage { .. }
141141
| crate::AddressSpace::Handle
142142
| crate::AddressSpace::PushConstant
143-
| crate::AddressSpace::TaskPayload
144-
// just a default impl, not really supported
145-
| crate::AddressSpace::RayPayload
146-
| crate::AddressSpace::IncomingRayPayload => false,
143+
| crate::AddressSpace::TaskPayload => false,
144+
145+
crate::AddressSpace::RayPayload | crate::AddressSpace::IncomingRayPayload => {
146+
unreachable!()
147+
}
147148
}
148149
}
149150
}

naga/src/back/msl/writer.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -596,10 +596,9 @@ impl crate::AddressSpace {
596596
| Self::WorkGroup
597597
| Self::PushConstant
598598
| Self::Handle
599-
| Self::TaskPayload
600-
| Self::RayPayload
601-
| Self::IncomingRayPayload => true,
599+
| Self::TaskPayload => true,
602600
Self::Function => false,
601+
Self::RayPayload | Self::IncomingRayPayload => unreachable!(),
603602
}
604603
}
605604

naga/src/ir/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ pub enum ShaderStage {
344344

345345
/// A any hit shader, in a ray tracing pipeline.
346346
AnyHit,
347+
347348
/// A closest hit shader, in a ray tracing pipeline.
348349
ClosestHit,
349350
}

naga/src/valid/interface.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,9 @@ pub enum EntryPointError {
165165
#[error("Task payload must be at least 4 bytes, but is {0} bytes")]
166166
TaskPayloadTooSmall(u32),
167167
#[error("Only the `ray_generation`, `closest_hit`, and `any_hit` shader stages can access a global variable in the `ray_payload` address space")]
168-
RayPayloadInInvalidStage,
168+
RayPayloadInInvalidStage(crate::ShaderStage),
169169
#[error("Only the `closest_hit`, `any_hit`, and `miss` shader stages can access a global variable in the `incoming_ray_payload` address space")]
170-
IncomingRayPayloadInInvalidStage,
170+
IncomingRayPayloadInInvalidStage(crate::ShaderStage),
171171
}
172172

173173
fn storage_usage(access: crate::StorageAccess) -> GlobalUse {
@@ -1340,7 +1340,7 @@ impl super::Validator {
13401340
| crate::ShaderStage::ClosestHit
13411341
| crate::ShaderStage::Miss
13421342
) {
1343-
return Err(EntryPointError::RayPayloadInInvalidStage
1343+
return Err(EntryPointError::RayPayloadInInvalidStage(ep.stage)
13441344
.with_span_handle(var_handle, &module.global_variables));
13451345
}
13461346
GlobalUse::READ | GlobalUse::QUERY | GlobalUse::WRITE
@@ -1352,7 +1352,7 @@ impl super::Validator {
13521352
| crate::ShaderStage::ClosestHit
13531353
| crate::ShaderStage::Miss
13541354
) {
1355-
return Err(EntryPointError::IncomingRayPayloadInInvalidStage
1355+
return Err(EntryPointError::IncomingRayPayloadInInvalidStage(ep.stage)
13561356
.with_span_handle(var_handle, &module.global_variables));
13571357
}
13581358
GlobalUse::READ | GlobalUse::QUERY | GlobalUse::WRITE

naga/tests/naga/wgsl_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4562,7 +4562,7 @@ fn check_ray_tracing_pipeline_payload_disallowed() {
45624562
{stage} fn main() {output} {{_ = payload; {stmt}}}"
45634563
),
45644564
Err(naga::valid::ValidationError::EntryPoint {
4565-
source: naga::valid::EntryPointError::RayPayloadInInvalidStage,
4565+
source: naga::valid::EntryPointError::RayPayloadInInvalidStage(_),
45664566
..
45674567
},),
45684568
Capabilities::RAY_TRACING_PIPELINE

0 commit comments

Comments
 (0)