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.
21 lines
557 B
21 lines
557 B
alias number = f32;
|
|
|
|
struct MatrixBatch {
|
|
size: vec4<u32>,
|
|
data: array<vec4<number>>,
|
|
}
|
|
|
|
@group(0) @binding(0)
|
|
var<storage, read> l: MatrixBatch;
|
|
@group(0) @binding(1)
|
|
var<storage, read> r_or_result: MatrixBatch;
|
|
@group(0) @binding(2)
|
|
var<storage, read_write> result: MatrixBatch;
|
|
|
|
@compute @workgroup_size(1)
|
|
fn main(@builtin(global_invocation_id) global_id: vec3<u32>) {
|
|
result.size = l.size;
|
|
|
|
var resi = (global_id.z * result.size.y + global_id.y) * result.size.x / 4 + global_id.x;
|
|
result.data[resi] = l.data[resi] * r_or_result.data[resi];
|
|
}
|
|
|