Closed davids91 closed 3 months ago
This should work but I doubt the issue is with the Voxelement
. Your voxels
are in @group(1) @binding(3)
but the error is about ResourceBinding { group: 1, binding: 0 }
.
Sorry, wrong struct..... I have this for OctreeMetaData
:
#[repr(C)]
#[derive(Clone, ShaderType)]
pub struct OctreeMetaData {
pub ambient_light_color: V3cf32,
pub(crate) voxel_brick_dim: u32,
pub ambient_light_position: V3cf32,
pub(crate) octree_size: u32,
}
And :
struct OctreeMetaData {
octree_size: u32,
voxel_brick_dim: u32,
ambient_light_color: vec4f,
ambient_light_position: vec3f,
}
group(1) @binding(0)
var<uniform> octreeMetaData: OctreeMetaData;
Is it because the different ordering in the shader struct ordering?
Yes, the order and types must match across the rust and WGSL structs.
I used to think it doe, because it worked really great. I have some rendering logic, based on bevy, and upon increasing support for bevy 0.14.0 suddenly the program crashes frequently ; And I encounter this error :
With the following struct:
In shader:
I am not sure anymore, because if I add a
_padding
variable toVoxelement
as:_padding: Vec3,
, evaluations pass, but the program crashes...are vectors of structs supported, or should I try to manually arrange its structure, with e.g.
#[repr(C)]
?Thank you for the help in advance!