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 | f1517709556827fb8b7bab00bdee4a9794d88dd1 (patch) | |
| tree | a1b2325c8bc693bff0ace1fd98ea7dac91f76286 /assets/Compute.glsl | |
| parent | 1ad6bc34323f5b30d463ebe47a58d47ff9d4f328 (diff) | |
[add]: 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; +} |
