diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2019-06-09 18:51:20 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2019-06-11 14:01:28 +0000 |
commit | 5c70bac7becb8e5fd81b7f388eeba87576a6dc69 (patch) | |
tree | 7aaf9318efd493abd4e12b05f11449b094619806 /tests | |
parent | 9fa867d0907c675a2e32957d7866f3e77c8f8de5 (diff) |
Add support for storage images and blocks
Not used in graphics but are essential for compute.
Change-Id: I4d3a0dfd926ee02b824494ee438f3a69fc96c0d4
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/playground/comp_buffer.comp | 26 | ||||
-rw-r--r-- | tests/playground/comp_image.comp | 12 |
2 files changed, 38 insertions, 0 deletions
diff --git a/tests/playground/comp_buffer.comp b/tests/playground/comp_buffer.comp new file mode 100644 index 0000000..4a7e0ce --- /dev/null +++ b/tests/playground/comp_buffer.comp @@ -0,0 +1,26 @@ +#version 440 + +layout (local_size_x = 256) in; + +struct Stuff { + vec2 a; + vec2 b; +}; + +layout(std140, binding = 0) buffer StuffSsbo +{ + vec4 whatever; + Stuff stuff[]; +} buf; + +void main() +{ + uint index = gl_GlobalInvocationID.x; + vec2 a = buf.stuff[index].a; + vec2 b = buf.stuff[index].b; + + a.x += 1.0; + buf.stuff[index].a = a; + b.y += 1.0; + buf.stuff[index].b = b; +} diff --git a/tests/playground/comp_image.comp b/tests/playground/comp_image.comp new file mode 100644 index 0000000..a4aa01e --- /dev/null +++ b/tests/playground/comp_image.comp @@ -0,0 +1,12 @@ +#version 440 + +layout (local_size_x = 16, local_size_y = 16) in; + +layout (binding = 0, rgba8) uniform readonly image2D inputImage; +layout (binding = 1, rgba8) uniform writeonly image2D resultImage; + +void main() +{ + vec4 c = imageLoad(inputImage, ivec2(gl_GlobalInvocationID.x, gl_GlobalInvocationID.y)); + imageStore(resultImage, ivec2(gl_GlobalInvocationID.xy), c); +} |