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.
28 lines
621 B
28 lines
621 B
struct ScalarBatch {
|
|
size: vec4<u32>,
|
|
data: array<f32>,
|
|
}
|
|
|
|
struct Scalar {
|
|
size: vec4<u32>,
|
|
data: array<f32>,
|
|
}
|
|
|
|
struct MatrixBatch {
|
|
size: vec4<u32>,
|
|
data: array<vec4<f32>>,
|
|
}
|
|
|
|
@group(0) @binding(0)
|
|
var<storage, read> norm: ScalarBatch;
|
|
@group(0) @binding(1)
|
|
var<storage, read> threshold: Scalar;
|
|
@group(0) @binding(2)
|
|
var<storage, read_write> m: MatrixBatch;
|
|
|
|
@compute @workgroup_size(1)
|
|
fn main(@builtin(global_invocation_id) global_id: vec3<u32>) {
|
|
m.size = m.size;
|
|
|
|
m.data[(global_id.z * m.size.y + global_id.y) * m.size.x / 4 + global_id.x] *= min(1f, threshold.data[0] / norm.data[global_id.z]);
|
|
}
|
|
|