summaryrefslogtreecommitdiffstats
path: root/tests/manual/rhi/float16texture_with_compute/load.comp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2020-01-07 15:15:09 +0100
committerLaszlo Agocs <laszlo.agocs@qt.io>2020-01-13 15:52:46 +0100
commitfe97af0c9ad58f0f823f3b1942cd9ad383ba85d3 (patch)
treee80f72557ece554e9241fb1c33a0fd4c287420cf /tests/manual/rhi/float16texture_with_compute/load.comp
parentccb2cb84f535b0bfce19a95d7f3a36803480cae8 (diff)
rhi: Add manual test for RGBA16F and compute
Uses the two compute shaders from Qt Quick 3D. Demonstrates and tests both RGBA16F textures and using them (and doing load/store with mip levels individually) in combination with compute. Task-number: QTBUG-81213 Change-Id: I3f0f250d5997a26c857b7c45517684c63b44e58e Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Diffstat (limited to 'tests/manual/rhi/float16texture_with_compute/load.comp')
-rw-r--r--tests/manual/rhi/float16texture_with_compute/load.comp19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/manual/rhi/float16texture_with_compute/load.comp b/tests/manual/rhi/float16texture_with_compute/load.comp
new file mode 100644
index 0000000000..eb7bc1ece4
--- /dev/null
+++ b/tests/manual/rhi/float16texture_with_compute/load.comp
@@ -0,0 +1,19 @@
+#version 440
+
+layout(local_size_x = 16, local_size_y = 16) in;
+layout(rgba8, binding = 1) readonly uniform image2D inputImage;
+layout(rgba16f, binding = 2) writeonly uniform image2D outputImage;
+
+// There is no equivalent of gl_NumWorkGroups in HLSL. So instead pass the
+// values in in a uniform buffer.
+layout(std140, binding = 0) uniform numWorkGroupsBuf {
+ uvec3 numWorkGroups;
+};
+
+void main()
+{
+ if (gl_GlobalInvocationID.x >= numWorkGroups.x || gl_GlobalInvocationID.y >= numWorkGroups.y)
+ return;
+ vec4 value = imageLoad(inputImage, ivec2(gl_GlobalInvocationID.xy));
+ imageStore(outputImage, ivec2(gl_GlobalInvocationID.xy), value);
+}