Harbor

branch main
showing the latest snapshot on main
workflow_compute_builtins.glsl 592 B · Plain text
shader/tests/golden/workflow_compute_builtins.glsl 0644 Raw
#version 450

shared float scratch[64];

layout(set = 0, binding = 0) buffer params_Block {
	uint count;
	float scale;
} params;
layout(set = 0, binding = 1) buffer data_Block {
	float values[64];
} data;

layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in;

void main() {
	uint idx = gl_LocalInvocationIndex;
	uint gid = gl_GlobalInvocationID.x;
	uint lid = gl_LocalInvocationID.x;
	uint group_x = gl_WorkGroupID.x;
	if ((gid < params.count)) {
		scratch[idx] = (data.values[idx] * params.scale);
		barrier();
		data.values[idx] = (scratch[idx] + float((lid + group_x)));
	}
}