summaryrefslogtreecommitdiffstats
path: root/src/shader.comp
diff options
context:
space:
mode:
authorgrm <grm@eyesin.space>2026-03-13 22:05:58 +0200
committergrm <grm@eyesin.space>2026-03-13 22:05:58 +0200
commit21edd2596ff657fc2de61e8848e74cf3c5c9ef01 (patch)
treeb62cac3c8433cca716bb5c699552d9c3ff386af3 /src/shader.comp
parent67eec36945ed1706f23d0fe6d3017a09516dc42b (diff)
downloadcgame-21edd2596ff657fc2de61e8848e74cf3c5c9ef01.tar.gz
cgame-21edd2596ff657fc2de61e8848e74cf3c5c9ef01.tar.bz2
cgame-21edd2596ff657fc2de61e8848e74cf3c5c9ef01.zip
not sure
Diffstat (limited to 'src/shader.comp')
-rw-r--r--src/shader.comp34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/shader.comp b/src/shader.comp
new file mode 100644
index 0000000..0e89702
--- /dev/null
+++ b/src/shader.comp
@@ -0,0 +1,34 @@
+// -*- mode: glsl;-*-
+#version 450
+
+layout (binding = 0) uniform ParameterUBO {
+ float deltaTime;
+} ubo;
+
+struct Particle {
+ vec2 position;
+ vec2 velocity;
+ vec4 color;
+};
+
+layout(std140, binding = 1) readonly buffer ParticleSSBOIn {
+ Particle particlesIn[ ];
+};
+
+layout(std140, binding = 2) buffer ParticleSSBOOut {
+ Particle particlesOut[ ];
+};
+
+layout (local_size_x = 256, local_size_y = 1, local_size_z = 1) in;
+
+void main()
+{
+ uint index = gl_GlobalInvocationID.x;
+
+ Particle particleIn = particlesIn[index];
+
+ particlesOut[index].position = particleIn.position + particleIn.velocity.xy * ubo.deltaTime;
+ particlesOut[index].velocity = particleIn.velocity;
+ particlesOut[index].color = particleIn.color;
+}
+