diff options
| author | hachem <im@hachem.wtf> | 2025-08-13 18:20:54 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2025-08-13 18:20:54 +0200 |
| commit | 2d8f706efe6e0a02b3238c2f22e7cdce620e9807 (patch) | |
| tree | 06734503f8422c1509da09b5dd6a3ce50bad875c /assets/compute.glsl | |
| parent | 3b02022fd79ad0e130b8c49e7707d221bfc97bb5 (diff) | |
feat: compute shaders and compute textures
Diffstat (limited to 'assets/compute.glsl')
| -rw-r--r-- | assets/compute.glsl | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/assets/compute.glsl b/assets/compute.glsl new file mode 100644 index 0000000..9a36a84 --- /dev/null +++ b/assets/compute.glsl @@ -0,0 +1,24 @@ +#type compute +#version 430 core + +layout(local_size_x = 256) in; + +layout(std430, binding = 0) buffer InputBuffer +{ + float data[]; +} inputBuffer; + +layout(std430, binding = 1) buffer OutputBuffer +{ + float data[]; +} outputBuffer; + +uniform float u_Scale; +uniform float u_Offset; + +void main() +{ + uint index = gl_GlobalInvocationID.x; + float inputValue = inputBuffer.data[index]; + outputBuffer.data[index] = inputValue * u_Scale + u_Offset; +} |
