mirror of
https://github.com/EmbarkStudios/rust-gpu.git
synced 2024-11-22 06:45:13 +00:00
spirv-std: add #[repr(C)]
(and extra comments) to opaque handle types.
This commit is contained in:
parent
396adcaf59
commit
beecb48e39
@ -94,6 +94,8 @@ pub type Cubemap = crate::Image!(cube, type=f32, sampled, __crate_root=crate);
|
||||
/// See SPIR-V OpTypeImage specification for the meaning of integer parameters.
|
||||
#[spirv(generic_image_type)]
|
||||
#[derive(Copy, Clone)]
|
||||
// HACK(eddyb) avoids "transparent newtype of `_anti_zst_padding`" misinterpretation.
|
||||
#[repr(C)]
|
||||
pub struct Image<
|
||||
SampledType: SampleType<FORMAT>,
|
||||
const DIM: u32, // Dimensionality,
|
||||
@ -103,7 +105,9 @@ pub struct Image<
|
||||
const SAMPLED: u32, // Sampled,
|
||||
const FORMAT: u32, // ImageFormat,
|
||||
> {
|
||||
_x: u32,
|
||||
// HACK(eddyb) avoids the layout becoming ZST (and being elided in one way
|
||||
// or another, before `#[spirv(generic_image_type)]` can special-case it).
|
||||
_anti_zst_padding: core::mem::MaybeUninit<u32>,
|
||||
_marker: core::marker::PhantomData<SampledType>,
|
||||
}
|
||||
|
||||
|
@ -7,8 +7,12 @@ use core::arch::asm;
|
||||
/// acceleration structure handle as defined in the client API specification.
|
||||
#[spirv(acceleration_structure)]
|
||||
#[derive(Copy, Clone)]
|
||||
// HACK(eddyb) avoids "transparent newtype of `_anti_zst_padding`" misinterpretation.
|
||||
#[repr(C)]
|
||||
pub struct AccelerationStructure {
|
||||
pub(crate) _private: u32,
|
||||
// HACK(eddyb) avoids the layout becoming ZST (and being elided in one way
|
||||
// or another, before `#[spirv(acceleration_structure)]` can special-case it).
|
||||
_anti_zst_padding: core::mem::MaybeUninit<u32>,
|
||||
}
|
||||
|
||||
impl AccelerationStructure {
|
||||
@ -186,8 +190,12 @@ pub enum CommittedIntersection {
|
||||
|
||||
/// A ray query type which is an opaque object representing a ray traversal.
|
||||
#[spirv(ray_query)]
|
||||
// HACK(eddyb) avoids "transparent newtype of `_anti_zst_padding`" misinterpretation.
|
||||
#[repr(C)]
|
||||
pub struct RayQuery {
|
||||
_private: u32,
|
||||
// HACK(eddyb) avoids the layout becoming ZST (and being elided in one way
|
||||
// or another, before `#[spirv(ray_query)]` can special-case it).
|
||||
_anti_zst_padding: core::mem::MaybeUninit<u32>,
|
||||
}
|
||||
|
||||
/// Constructs an uninitialized ray query variable. Using the syntax
|
||||
|
@ -7,9 +7,12 @@ use core::marker::PhantomData;
|
||||
/// Hence, this type represents something very similar to a slice, but with no way of knowing its
|
||||
/// length.
|
||||
#[spirv(runtime_array)]
|
||||
// HACK(eddyb) avoids "transparent newtype of `_anti_zst_padding`" misinterpretation.
|
||||
#[repr(C)]
|
||||
pub struct RuntimeArray<T> {
|
||||
// spooky! this field does not exist, so if it's referenced in rust code, things will explode
|
||||
_do_not_touch: u32,
|
||||
// HACK(eddyb) avoids the layout becoming ZST (and being elided in one way
|
||||
// or another, before `#[spirv(runtime_array)]` can special-case it).
|
||||
_anti_zst_padding: core::mem::MaybeUninit<u32>,
|
||||
_phantom: PhantomData<T>,
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,10 @@
|
||||
/// sample an image.
|
||||
#[spirv(sampler)]
|
||||
#[derive(Copy, Clone)]
|
||||
// HACK(eddyb) avoids "transparent newtype of `_anti_zst_padding`" misinterpretation.
|
||||
#[repr(C)]
|
||||
pub struct Sampler {
|
||||
_x: u32,
|
||||
// HACK(eddyb) avoids the layout becoming ZST (and being elided in one way
|
||||
// or another, before `#[spirv(sampler)]` can special-case it).
|
||||
_anti_zst_padding: core::mem::MaybeUninit<u32>,
|
||||
}
|
||||
|
@ -9,9 +9,9 @@ error[E0277]: the trait bound `Image<f32, 0, 2, 0, 0, 1, 0>: HasGather` is not s
|
||||
Image<SampledType, 3, DEPTH, ARRAYED, 0, SAMPLED, FORMAT>
|
||||
Image<SampledType, 4, DEPTH, ARRAYED, 0, SAMPLED, FORMAT>
|
||||
note: required by a bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, spirv_std::::image::{impl#1}::{constant#0}, SAMPLED, FORMAT>::gather`
|
||||
--> $SPIRV_STD_SRC/image.rs:163:15
|
||||
--> $SPIRV_STD_SRC/image.rs:167:15
|
||||
|
|
||||
163 | Self: HasGather,
|
||||
167 | Self: HasGather,
|
||||
| ^^^^^^^^^ required by this bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, spirv_std::::image::{impl#1}::{constant#0}, SAMPLED, FORMAT>::gather`
|
||||
|
||||
error[E0277]: the trait bound `Image<f32, 2, 2, 0, 0, 1, 0>: HasGather` is not satisfied
|
||||
@ -25,9 +25,9 @@ error[E0277]: the trait bound `Image<f32, 2, 2, 0, 0, 1, 0>: HasGather` is not s
|
||||
Image<SampledType, 3, DEPTH, ARRAYED, 0, SAMPLED, FORMAT>
|
||||
Image<SampledType, 4, DEPTH, ARRAYED, 0, SAMPLED, FORMAT>
|
||||
note: required by a bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, spirv_std::::image::{impl#1}::{constant#0}, SAMPLED, FORMAT>::gather`
|
||||
--> $SPIRV_STD_SRC/image.rs:163:15
|
||||
--> $SPIRV_STD_SRC/image.rs:167:15
|
||||
|
|
||||
163 | Self: HasGather,
|
||||
167 | Self: HasGather,
|
||||
| ^^^^^^^^^ required by this bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, spirv_std::::image::{impl#1}::{constant#0}, SAMPLED, FORMAT>::gather`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
@ -10,9 +10,9 @@ error[E0277]: the trait bound `Image<f32, 4, 2, 0, 0, 1, 0>: HasQueryLevels` is
|
||||
Image<SampledType, 2, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT>
|
||||
Image<SampledType, 3, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT>
|
||||
note: required by a bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT>::query_levels`
|
||||
--> $SPIRV_STD_SRC/image.rs:813:15
|
||||
--> $SPIRV_STD_SRC/image.rs:817:15
|
||||
|
|
||||
813 | Self: HasQueryLevels,
|
||||
817 | Self: HasQueryLevels,
|
||||
| ^^^^^^^^^^^^^^ required by this bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT>::query_levels`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -10,9 +10,9 @@ error[E0277]: the trait bound `Image<f32, 4, 2, 0, 0, 1, 0>: HasQueryLevels` is
|
||||
Image<SampledType, 2, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT>
|
||||
Image<SampledType, 3, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT>
|
||||
note: required by a bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT>::query_lod`
|
||||
--> $SPIRV_STD_SRC/image.rs:839:15
|
||||
--> $SPIRV_STD_SRC/image.rs:843:15
|
||||
|
|
||||
839 | Self: HasQueryLevels,
|
||||
843 | Self: HasQueryLevels,
|
||||
| ^^^^^^^^^^^^^^ required by this bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT>::query_lod`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -15,9 +15,9 @@ error[E0277]: the trait bound `Image<f32, 1, 2, 0, 0, 1, 0>: HasQuerySize` is no
|
||||
Image<SampledType, 2, DEPTH, ARRAYED, 0, 2, FORMAT>
|
||||
and 6 others
|
||||
note: required by a bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT>::query_size`
|
||||
--> $SPIRV_STD_SRC/image.rs:870:15
|
||||
--> $SPIRV_STD_SRC/image.rs:874:15
|
||||
|
|
||||
870 | Self: HasQuerySize,
|
||||
874 | Self: HasQuerySize,
|
||||
| ^^^^^^^^^^^^ required by this bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT>::query_size`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -10,9 +10,9 @@ error[E0277]: the trait bound `Image<f32, 4, 2, 0, 0, 1, 0>: HasQuerySizeLod` is
|
||||
Image<SampledType, 2, DEPTH, ARRAYED, 0, SAMPLED, FORMAT>
|
||||
Image<SampledType, 3, DEPTH, ARRAYED, 0, SAMPLED, FORMAT>
|
||||
note: required by a bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, spirv_std::::image::{impl#7}::{constant#0}, SAMPLED, FORMAT>::query_size_lod`
|
||||
--> $SPIRV_STD_SRC/image.rs:903:15
|
||||
--> $SPIRV_STD_SRC/image.rs:907:15
|
||||
|
|
||||
903 | Self: HasQuerySizeLod,
|
||||
907 | Self: HasQuerySizeLod,
|
||||
| ^^^^^^^^^^^^^^^ required by this bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, spirv_std::::image::{impl#7}::{constant#0}, SAMPLED, FORMAT>::query_size_lod`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
Loading…
Reference in New Issue
Block a user