Commit 1a4372ad authored by Karol Herbst's avatar Karol Herbst

arb_bindless_texture: add test for conversion of bound sampler or image to uvec2

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's avatarKarol Herbst <kherbst@redhat.com>
Reviewed-by: Samuel Pitoiset's avatarSamuel Pitoiset <samuel.pitoiset@gmail.com>
parent 88da753a
// [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));
}
// [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));
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment