You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
540 B
20 lines
540 B
alias number = f32;
|
|
|
|
struct MatrixBatch {
|
|
size: vec4<u32>,
|
|
data: array<number>,
|
|
}
|
|
|
|
@group(0) @binding(0)
|
|
var<storage, read> in: MatrixBatch;
|
|
@group(0) @binding(1)
|
|
var<storage, read_write> out: MatrixBatch;
|
|
|
|
@compute @workgroup_size(1)
|
|
fn main(@builtin(global_invocation_id) global_id: vec3<u32>) {
|
|
out.size.x = in.size.y;
|
|
out.size.y = in.size.x;
|
|
out.size.z = in.size.z;
|
|
var l = global_id.z * out.size.y * out.size.x;
|
|
out.data[l + global_id.y * out.size.x + global_id.x] = in.data[l + global_id.x * in.size.x + global_id.y];
|
|
}
|
|
|