Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Image atomic addition in a compute shader

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2015
    Posts
    2

    Image atomic addition in a compute shader

    Hello,



    I have the following compute shader:

    Code :
    #version 430
     
    layout(std430, binding=0) buffer wks{
        ivec2 w[];
    };
     
    layout(r32i, binding=1) uniform writeonly iimage2D pathTex;
     
    layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
     
    void main(){
        imageAtomicAdd(pathTex, w[0], 1); // line 12
    }

    That gives me this error:

    Code :
    0(12) : error C1317: qualified actual parameter #1 cannot be converted to less qualified parameter ("im")

    I can't find what I'm doing wrong according to the OpenGL wiki

  2. #2
    Senior Member OpenGL Lord
    Join Date
    May 2009
    Posts
    6,013
    What happens if you replace the texture coordinate with a constant value (like ivec2(0, 0))?

  3. #3
    Junior Member Newbie
    Join Date
    Feb 2015
    Posts
    2
    I got an answer:


    According to the GLSL 4.50 spec, imageAtomicAdd() requires a image variable with the coherent memory qualifier.

    This makes sense because an atomic add needs to read the old value, add a value to it, and write back the result. Therefore, it needs to be able to both read and write the image.

    To make this work, you need to change the declaration to:

    layout(r32i, binding=1) uniform coherent iimage2D pathTex;

    As the name indicates, writeonly will only work for image operations that exclusively write to the image, like imageStore().
    Thanks for your time anyway!

  4. #4
    Newbie Newbie
    Join Date
    Feb 2015
    Posts
    2
    Friends i see your question here. But i do not understand last answer that you say "You Got Answer". But i am not understand how can you calculate it ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •