You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
getting In Queue::write_buffer Copy of 0..32 would end up overrunning the bounds of the Destination buffer of size 16 when trying to write to buffer
#10
Open
NewUser69420 opened this issue
Feb 3, 2024
· 1 comment
fn calc_gpu_things(mut compute_worker: ResMut<AppComputeWorker<SimpleComputeWorker>>) {
if !compute_worker.ready() {
return;
};
compute_worker.write_slice("firstArray", &[2.0, 3.0, 5.0, 6.0]);
//compute_worker.write("secondArray", &[2.0, 3.0, 4.0, 5.0]);
let result: [f32; 4] = compute_worker.read("resultArray");
println!("got {:?}", result);
}
#[derive(TypeUuid)]
#[uuid = "2545ae14-a9bc-4f03-9ea4-4eb43d1075a7"]
struct SimpleShader;
impl ComputeShader for SimpleShader {
fn shader() -> ShaderRef {
"compute1.wgsl".into()
}
}
#[derive(Resource)]
struct SimpleComputeWorker;
impl ComputeWorker for SimpleComputeWorker {
fn build(world: &mut World) -> AppComputeWorker<Self> {
let worker = AppComputeWorkerBuilder::new(world)
// Add a staging buffer, it will be available from
// both CPU and GPU land.
.add_staging("firstArray", &[2.0, 3.0, 4.0, 5.0])
.add_staging("secondArray", &[2.0, 3.0, 4.0, 5.0])
.add_staging("resultArray", &[0.0, 0.0, 0.0, 0.0])
// Create a compute pass from your compute shader
// and define used variables
.add_pass::<SimpleShader>([4, 1, 1], &["firstArray", "secondArray", "resultArray"])
.build();
worker
}
}
and the panic i get during run time:
thread 'Compute Task Pool (4)' panicked at C:\Users\bramb\.cargo\registry\src\index.crates.io-6f17d22bba15001f\wgpu-0.17.2\src\backend\direct.rs:3056:5:
wgpu error: Validation Error
Caused by:
In Queue::write_buffer
Copy of 0..32 would end up overrunning the bounds of the Destination buffer of size 16
The text was updated successfully, but these errors were encountered:
this is my shader code:
and the code in bevy:
and the panic i get during run time:
The text was updated successfully, but these errors were encountered: