summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKarol Herbst <kherbst@redhat.com>2018-04-10 12:27:36 +0200
committerKarol Herbst <kherbst@redhat.com>2018-04-25 13:14:46 +0200
commit88da753a2a56a3281e4dd027cf237e0833a11300 (patch)
tree2e712f9fdc3435318afeb637ef9335cb52ca1300 /tests
parent126b26fcf0047c665436635322cdef75ab94e0a8 (diff)
arb_bindless_texture: add test where we pass a handle through a function
currently fails in mesa with: ir_dereference_variable @ 0x1446830 specifies undeclared variable `wrongHandle' @ 0xffd1b0 v2: add image test convert to compiler test quote the spec v3: use inout Signed-off-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/spec/arb_bindless_texture/compiler/images/func-call-uvec2-image.frag36
-rw-r--r--tests/spec/arb_bindless_texture/compiler/samplers/func-call-uvec2-texture2D.frag35
2 files changed, 71 insertions, 0 deletions
diff --git a/tests/spec/arb_bindless_texture/compiler/images/func-call-uvec2-image.frag b/tests/spec/arb_bindless_texture/compiler/images/func-call-uvec2-image.frag
new file mode 100644
index 000000000..cfa3fbac1
--- /dev/null
+++ b/tests/spec/arb_bindless_texture/compiler/images/func-call-uvec2-image.frag
@@ -0,0 +1,36 @@
+// [config]
+// expect_result: pass
+// glsl_version: 3.30
+// require_extensions: GL_ARB_bindless_texture GL_ARB_shader_image_load_store
+// [end config]
+
+#version 330
+#extension GL_ARB_bindless_texture: require
+#extension GL_ARB_shader_image_load_store: enable
+
+layout (bindless_image) writeonly uniform image2D img;
+uniform uvec2 handleOffset;
+
+out vec4 finalColor;
+
+// The ARB_bindless_texture spec says:
+//
+// "Replace Section 4.1.7 (Samplers), p. 25"
+//
+// "Samplers can be used as l-values, so can be assigned into and used as
+// "out" and "inout" function parameters."
+
+void adjustImageHandle(inout writeonly image2D img)
+{
+ uvec2 handle = uvec2(img);
+ handle.x -= 0x12345678u;
+ handle.y -= 0x9abcdef0u;
+ img = image2D(handle + handleOffset);
+}
+
+void main()
+{
+ writeonly image2D _img = img;
+ adjustImageHandle(_img);
+ imageStore(_img, ivec2(0, 0), vec4(1, 2, 3, 4));
+}
diff --git a/tests/spec/arb_bindless_texture/compiler/samplers/func-call-uvec2-texture2D.frag b/tests/spec/arb_bindless_texture/compiler/samplers/func-call-uvec2-texture2D.frag
new file mode 100644
index 000000000..9faf41000
--- /dev/null
+++ b/tests/spec/arb_bindless_texture/compiler/samplers/func-call-uvec2-texture2D.frag
@@ -0,0 +1,35 @@
+// [config]
+// expect_result: pass
+// glsl_version: 3.30
+// require_extensions: GL_ARB_bindless_texture
+// [end config]
+
+#version 330
+#extension GL_ARB_bindless_texture: require
+
+layout (bindless_sampler) uniform sampler2D tex;
+uniform uvec2 handleOffset;
+
+out vec4 finalColor;
+
+// The ARB_bindless_texture spec says:
+//
+// "Replace Section 4.1.7 (Samplers), p. 25"
+//
+// "Samplers can be used as l-values, so can be assigned into and used as
+// "out" and "inout" function parameters."
+
+void adjustSamplerHandle(inout sampler2D s)
+{
+ uvec2 handle = uvec2(s);
+ handle.x -= 0x12345678u;
+ handle.y -= 0x9abcdef0u;
+ s = sampler2D(handle + handleOffset);
+}
+
+void main()
+{
+ sampler2D s = tex;
+ adjustSamplerHandle(s);
+ finalColor = texture2D(s, vec2(0, 0));
+}