This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

GLSL read+write image2D

I expected to be able to use both imageLoad and imageStore on the same image to read and modify it from within a compute shader.

Trying with a declaration of: layout(r32f, binding=0) uniform highp image2D x;
Produces "Shader error: Image has to be qualified as 'readonly', 'writeonly' or both."

I haven't been able to find yet how to specify "both" as the error implies is possible. Is there a keyword for this I've missed?

I'm using a Mali-T720 with GLES 3.1 v1.r7p0-02

Parents
  • 1) It is an Amazon Fire HD 8" (6th Gen)
    2) Minimal repro and notes below

    #version 310 es
    precision highp image2D;
    layout(rgba32f, binding=0) uniform image2D x;
    layout(local_size_x=8, local_size_y=8) in;
    void main () {
       ivec2 i = ivec2(gl_GlobalInvocationID.xy);
       imageStore(x, i, imageLoad(x, i));
    }

    Shader error:
    0:3: S0001: Image has to be qualified as 'readonly', 'writeonly' or both.

    After my initial post I found I could work around the error by declaring the image2D twice. Once as readonly, then again as writeonly and both using the same binding number. So that is what I'm doing now to work around things on the shaders where this is triggering.  

Reply
  • 1) It is an Amazon Fire HD 8" (6th Gen)
    2) Minimal repro and notes below

    #version 310 es
    precision highp image2D;
    layout(rgba32f, binding=0) uniform image2D x;
    layout(local_size_x=8, local_size_y=8) in;
    void main () {
       ivec2 i = ivec2(gl_GlobalInvocationID.xy);
       imageStore(x, i, imageLoad(x, i));
    }

    Shader error:
    0:3: S0001: Image has to be qualified as 'readonly', 'writeonly' or both.

    After my initial post I found I could work around the error by declaring the image2D twice. Once as readonly, then again as writeonly and both using the same binding number. So that is what I'm doing now to work around things on the shaders where this is triggering.  

Children
No data