Bug 106996 - Compiler diagnostic for sampler declared as "out" parameter of function is terrible
Summary: Compiler diagnostic for sampler declared as "out" parameter of function is te...
Status: RESOLVED MOVED
Alias: None
Product: Mesa
Classification: Unclassified
Component: glsl-compiler (show other bugs)
Version: 17.1
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-22 07:51 UTC by xinghua
Modified: 2019-09-18 19:46 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
source code (3.53 KB, text/x-csrc)
2018-06-22 07:53 UTC, xinghua
Details

Description xinghua 2018-06-22 07:51:40 UTC
Steps:
1. Attached file is the source code;
2. build the source code, "gcc -o compileshader compileshader.c -lX11 -lepoxy";
3. run executable file, "./compileshader", mesa explicitly reports "invalid input layout qualifier used", compute shader compiling fails.

Notes:
1. I am nearly sure that this issue is not mesa bug. It is possible that my shader is not correct, but I could not find the root cause, so I file the bug to get some help.

2. Compute shader is as below, defines a user-defined function, with image type parameter, if uses "in" key to qualify the parameter, error happens, but if remove "in" and "out" keys, shader compiling successfully. Quotes OpenGL ES GLSL 3.1 spec section 6.1.1, "A function parameter declared with no such qualifier(in, out, inout) means the same thing as specifying in". Here explicitly specifies "in" key, why reports an error.
#version 310 es
layout(local_size_x=1, local_size_y=1, local_size_z=1) in;
layout(r32ui, binding = 0) uniform readonly highp uimage2D uImage_1;
layout(r32ui, binding = 1) uniform writeonly highp uimage2D uImage_2;
void dataCopy(in readonly highp uimage2D src, out writeonly highp uimage2D dst, ivec2 pos)
{
    uvec4 value = imageLoad(src, pos);
    imageStore(dst, pos, value);
}
void main()
{
    dataCopy(uImage_1, uImage_2, ivec2(gl_LocalInvocationID.xy));
}
Comment 1 xinghua 2018-06-22 07:53:02 UTC
Created attachment 140273 [details]
source code
Comment 2 Ian Romanick 2018-09-19 15:22:58 UTC
The problem is dst is marked as an "out" parameter of the function.  sampler variables cannot be assigned, so it's impossible for it to be an out parameter.  Deleting "out" allows the shader to compile.

Sadly, the compiler error message is useless for debugging that problem.
Comment 3 Ilia Mirkin 2018-09-20 02:29:16 UTC
(In reply to Ian Romanick from comment #2)
> sampler variables cannot be assigned, so it's impossible for it to be an out
> parameter.

FWIW they can be with bindless. But then the expectation would be that the function does something like "dst = src" or something.
Comment 4 GitLab Migration User 2019-09-18 19:46:12 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/818.


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.