[Piglit] [PATCH v2 4/5] arb_bindless_texture: add test where we pass a handle through a function
Karol Herbst
kherbst at redhat.com
Thu Apr 12 10:58:18 UTC 2018
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
Signed-off-by: Karol Herbst <kherbst at redhat.com>
---
.../compiler/images/func-call-uvec2-image.frag | 34 ++++++++++++++++++++++
.../samplers/func-call-uvec2-texture2D.frag | 33 +++++++++++++++++++++
2 files changed, 67 insertions(+)
create mode 100644 tests/spec/arb_bindless_texture/compiler/images/func-call-uvec2-image.frag
create mode 100644 tests/spec/arb_bindless_texture/compiler/samplers/func-call-uvec2-texture2D.frag
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..a603440f2
--- /dev/null
+++ b/tests/spec/arb_bindless_texture/compiler/images/func-call-uvec2-image.frag
@@ -0,0 +1,34 @@
+// [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."
+
+image2D adjustImageHandle(in writeonly image2D wrongHandle)
+{
+ uvec2 handle = uvec2(wrongHandle);
+ handle.x -= 0x12345678u;
+ handle.y -= 0x9abcdef0u;
+ return image2D(handle + handleOffset);
+}
+
+void main()
+{
+ imageStore(adjustImageHandle(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..4491dd515
--- /dev/null
+++ b/tests/spec/arb_bindless_texture/compiler/samplers/func-call-uvec2-texture2D.frag
@@ -0,0 +1,33 @@
+// [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."
+
+sampler2D adjustSamplerHandle(in sampler2D wrongHandle)
+{
+ uvec2 handle = uvec2(wrongHandle);
+ handle.x -= 0x12345678u;
+ handle.y -= 0x9abcdef0u;
+ return sampler2D(handle + handleOffset);
+}
+
+void main()
+{
+ finalColor = texture2D(adjustSamplerHandle(tex), vec2(0, 0));
+}
--
2.14.3
More information about the Piglit
mailing list