Skip to content

Commit e14a70d

Browse files
committed
Allow pointer casts when physical pointers are enabled
1 parent 8ea787a commit e14a70d

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

crates/rustc_codegen_spirv/src/builder_spirv.rs

+14-11
Original file line numberDiff line numberDiff line change
@@ -193,17 +193,20 @@ impl SpirvValue {
193193
original_ptr_ty,
194194
bitcast_result_id,
195195
} => {
196-
cx.zombie_with_span(
197-
bitcast_result_id,
198-
span,
199-
&format!(
200-
"cannot cast between pointer types\
201-
\nfrom `{}`\
202-
\n to `{}`",
203-
cx.debug_type(original_ptr_ty),
204-
cx.debug_type(self.ty)
205-
),
206-
);
196+
// If physical poitners are supported, defer the error until after storage class inferrence.
197+
if !cx.builder.has_capability(Capability::PhysicalStorageBufferAddresses) {
198+
cx.zombie_with_span(
199+
bitcast_result_id,
200+
span,
201+
&format!(
202+
"cannot cast between pointer types\
203+
\nfrom `{}`\
204+
\n to `{}`",
205+
cx.debug_type(original_ptr_ty),
206+
cx.debug_type(self.ty)
207+
),
208+
);
209+
}
207210

208211
bitcast_result_id
209212
}

0 commit comments

Comments
 (0)