-
Notifications
You must be signed in to change notification settings - Fork 75
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Compiletest
The following compiletest fails to compile:
// build-pass
use spirv_std::ByteAddressableBuffer;
use spirv_std::spirv;
#[derive(Copy, Clone, Debug)]
pub struct MyScalar(i32);
#[spirv(fragment)]
pub fn store_scalar(
#[spirv(descriptor_set = 0, binding = 0, storage_buffer)] buf: &mut [u32],
#[spirv(flat)] scalar: MyScalar,
) {
unsafe {
let mut buf = ByteAddressableBuffer::from_mut_slice(buf);
buf.store(5, scalar);
}
}
#[derive(Copy, Clone, Debug)]
pub struct MyScalarPair(i32, i32);
#[spirv(fragment)]
pub fn store_scalar_pair(
#[spirv(descriptor_set = 0, binding = 0, storage_buffer)] buf: &mut [u32],
#[spirv(flat)] pair0: i32,
#[spirv(flat)] pair1: i32,
) {
unsafe {
let mut buf = ByteAddressableBuffer::from_mut_slice(buf);
buf.store(5, MyScalarPair(pair0, pair1));
}
}
Error
error: buffer_store_intrinsic should have 4 args, it has 5
--> /home/firestar99/workspace/rust-gpu/crates/spirv-std/src/byte_addressable_buffer.rs:155:13
|
155 | buffer_store_intrinsic(self.data, byte_index, value);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 1 previous error
Error from a different project
Note the reversed arg count!
error: buffer_store_intrinsic should have 5 args, it has 4
--> /home/firestar99/.cargo/git/checkouts/rust-gpu-d06d15e2ba0f0ae2/dfcff49/crates/spirv-std/src/byte_addressable_buffer.rs:166:13
|
166 | buffer_store_intrinsic(self.data, byte_index, value);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Notes
- only stores are affected, loads work fine since they don't have any special handling for scalar pairs
- stores expect 5 args when passing a scalar pair, 4 when passing a scalar
- it seems like the presence of a scalar pair store converts the scalar store to a scalar pair one, and the other way around?
- May indicate a data race, since stores are written to a map
DefId -> PassMode
- May indicate a data race, since stores are written to a map
- my bindless API primarily does loads with very few stores, so I never noticed this previously
System Info
- rust-gpu main dbf3737
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working