Patches 1,2,3,5 are:

Reviewed-by: Samuel Pitoiset <samuel.pitoi...@gmail.com>

Sorry for the delay.

On 04/12/2018 12:58 PM, Karol Herbst wrote:
conversion of bounded sampler2D to uvec2 is legal with
ARB_bindless_texture. Currently Mesa fails with an assert:

../src/compiler/glsl/opt_function_inlining.cpp:248:
void ir_call::generate_inline(ir_instruction*): Assertion `deref' failed.

v2: add image test
     convert to compiler test
     quote the spec

Signed-off-by: Karol Herbst <kher...@redhat.com>
---
  .../compiler/images/arith-bound-image.frag         | 33 ++++++++++++++++++++++
  .../samplers/arith-bound-sampler-texture2D.frag    | 32 +++++++++++++++++++++
  2 files changed, 65 insertions(+)
  create mode 100644 
tests/spec/arb_bindless_texture/compiler/images/arith-bound-image.frag
  create mode 100644 
tests/spec/arb_bindless_texture/compiler/samplers/arith-bound-sampler-texture2D.frag

diff --git 
a/tests/spec/arb_bindless_texture/compiler/images/arith-bound-image.frag 
b/tests/spec/arb_bindless_texture/compiler/images/arith-bound-image.frag
new file mode 100644
index 000000000..1876081c9
--- /dev/null
+++ b/tests/spec/arb_bindless_texture/compiler/images/arith-bound-image.frag
@@ -0,0 +1,33 @@
+// [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
+
+writeonly uniform image2D img;
+uniform uvec2 handleOffset;
+
+out vec4 finalColor;
+
+// The ARB_bindless_texture spec says:
+//
+//  "Modify Section 5.4.1, Conversion and Scalar Constructors, p. 60"
+//
+//  "(add the following constructors:)"
+//
+//  "uvec2(any image type)       // Converts an image type to a
+//                               //   pair of 32-bit unsigned integers
+//   any image type(uvec2)       // Converts a pair of 32-bit unsigned 
integers to
+//                               //   an image type"
+
+void main()
+{
+       uvec2 handle = uvec2(img);
+       handle.x -= 0x12345678u;
+       handle.y -= 0x9abcdef0u;
+       imageStore(image2D(handle + handleOffset), ivec2(0, 0), vec4(1, 2, 3, 
4));
+}
diff --git 
a/tests/spec/arb_bindless_texture/compiler/samplers/arith-bound-sampler-texture2D.frag
 
b/tests/spec/arb_bindless_texture/compiler/samplers/arith-bound-sampler-texture2D.frag
new file mode 100644
index 000000000..cf6a625bf
--- /dev/null
+++ 
b/tests/spec/arb_bindless_texture/compiler/samplers/arith-bound-sampler-texture2D.frag
@@ -0,0 +1,32 @@
+// [config]
+// expect_result: pass
+// glsl_version: 3.30
+// require_extensions: GL_ARB_bindless_texture
+// [end config]
+
+#version 330
+#extension GL_ARB_bindless_texture: require
+
+uniform sampler2D tex;
+uniform uvec2 handleOffset;
+
+out vec4 finalColor;
+
+// The ARB_bindless_texture spec says:
+//
+//  "Modify Section 5.4.1, Conversion and Scalar Constructors, p. 60"
+//
+//  "(add the following constructors:)"
+//
+//  "uvec2(any sampler type)     // Converts a sampler type to a
+//                               //   pair of 32-bit unsigned integers
+//   any sampler type(uvec2)     // Converts a pair of 32-bit unsigned 
integers to
+//                               //   a sampler type"
+
+void main()
+{
+       uvec2 handle = uvec2(tex);
+       handle.x -= 0x12345678u;
+       handle.y -= 0x9abcdef0u;
+       finalColor = texture2D(sampler2D(handle + handleOffset), vec2(0, 0));
+}

_______________________________________________
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to