Results 1 to 2 of 2

Thread: Compute shader and barrier

  1. #1
    Member Contributor
    Join Date
    Mar 2014
    Posts
    59

    Compute shader and barrier

    Hi all!

    I'm working on a compute shader that generate a tree (a new kind of bsp tree), first i build the nodes of my tree, then i need to connect nodes togethers. I use an uvec4 that contains indexs of next nodes.
    At the begining, all index are equal to 0. i use atomicCompSwap fill the node link :
    if node.link.x =0, i can connect another node so i do like this :

    current = rootNodeIndex;
    while(true)
    {
    //some test to know wich link to use
    ....
    result = atomicCompSwap(mynode[current].link.x,0, insertion_point);
    if(result==0) break;
    else current = result
    ....
    }




    then if result = 0 link was created, in the other case node is linked and i need to go to the next one.

    I try to add before and after...
    barrier();memoryBarrierBuffer();

    And in C++ code i use :
    glMemoryBarrier(GL_SHADER_STORAGE_BARRIER_BIT);
    before glDispatchCompute;

    my node strucutre is in SSBO in read/write access.

    It doesnt work...the result is not correct... seems to be problem with atomic operations...

    Any ideas?

  2. #2
    Member Contributor
    Join Date
    Mar 2014
    Posts
    59
    Solution :
    The buffer in withch i read write have to use qualifier restrict.
    Just use atomic operation without barrier need...

Similar Threads

  1. Gl memory barrier and dispatch compute crahses
    By Onnion19 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 09-10-2018, 10:03 AM
  2. Replies: 3
    Last Post: 05-03-2018, 03:52 PM
  3. Compute Shader - correct memory barrier usage
    By ewanRi in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 08-17-2016, 03:45 AM
  4. VBO and compute shader
    By __bob__ in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 04-09-2015, 09:00 AM
  5. Compute shader : barrier issue?
    By imported_qnoper in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 11-22-2014, 10:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean