aboutsummaryrefslogtreecommitdiff
path: root/Assets/Compute.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/Compute.glsl')
-rw-r--r--Assets/Compute.glsl24
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;
+}