Bug 93266

Summary: gl_arb_shading_language_420pack does not allow binding of image variables
Product: Mesa Reporter: bugReporter92
Component: glsl-compilerAssignee: Matt Turner <mattst88>
Status: RESOLVED FIXED QA Contact: Intel 3D Bugs Mailing List <intel-3d-bugs>
Severity: normal    
Priority: medium    
Version: git   
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: patch

Description bugReporter92 2015-12-05 21:24:38 UTC
If I am creating a shader like so:

#version 330
#extension GL_ARB_shader_image_load_store : require
#extension GL_ARB_shading_language_420pack : require

layout(binding = 0, r16ui) uniform readonly uimage2D uZlutImage;
...

This currently gives the error:
"the "binding" qualifier only applies to uniform blocks, opaque variables, or arrays thereof"
If I set the first line of the shader to "#version 420" it compiles and works as expected (because both of those extensions are supported in Mesa, so although I'm using 420 behaviour which isn't yet fully supported in Mesa it should still be possible. I need to set the environment variable MESA_GLSL_VERSION_OVERRIDE=420 of course)

In the extension specification for GL_ARB_shading_language_420pack (https://www.opengl.org/registry/specs/ARB/shading_language_420pack.txt) it reads
"Add layout qualifier identifier "binding" to bind units to sampler and image variable declarations." I could be wrong, but I think I should be able to bind image variables without using the environment variables.

I think the fix here could be as simple as forcing "#extension GL_ARB_shading_language_420pack" to imply "#version 420". It might be more complex than that though.

If I'm wrong here, and my interpretation of how to use this extension is false, do you mind directing me in how to bind image variables using only extensions, and if that's even possible?

Thank-you very much
Matt
i965 (Ivybridge I think)
Debian Sarge
Comment 1 Matt Turner 2015-12-07 23:36:13 UTC
Created attachment 120401 [details] [review]
patch

Please try the attached patch (also sent to the mailing list for review)
Comment 2 Matt Turner 2015-12-09 21:16:16 UTC
I pushed this as

commit c200e606f7348a6d75e4cf72fb538f5d78d67649
Author: Matt Turner <mattst88@gmail.com>
Date:   Mon Dec 7 11:14:56 2015 -0800

    glsl: Allow binding of image variables with 420pack.

It is tagged for the 11.0 and 11.1 branches so it will be available soon in the 11.0.8 and 11.1.0 releases.

Please confirm whether it fixes the issue you see, and reopen the bug if it does not.

Thanks for the report!
Comment 3 bugReporter92 2015-12-12 13:42:53 UTC
Fixed for me.

Thank-you for the quick response.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.