Results 1 to 2 of 2

Thread: glBufferStorage without GL_MAP_COHERENT_BIT

  1. #1
    Member Newbie
    Join Date
    Sep 2013
    Posts
    31

    glBufferStorage syncronization

    Hello,
    I would like to know how to use glBufferStorage without GL_MAP_COHERENT_BIT flag. If I remember correctly with that flag I don't have to glMemoryBarrier the buffer before reading or writing it. The problem is that I don't know how use glMemoryBarrier with glBufferStorage.
    For example (C code):
    Code :
    GLuint nUniformBuffer;
    glGenBuffers(1, &nUniformBuffer);
    glBindBuffer(GL_UNIFORM_BUFFER, nUniformBuffer);
    glBufferStorage(GL_UNIFORM_BUFFER, <buffer size>, NULL, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_CLIENT_STORAGE_BIT);
    GLvoid *pPointer = glMapBufferRange(GL_UNIFORM_BUFFER, 0, <buffer size>, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT);
    glBindBuffer(GL_UNIFORM_BUFFER, 0);
     
    // Do I have to glMemoryBarrier now?
    DoSomethingWith(pPointer);
     
    glDeleteBuffers(1, &nUniformBuffer);


    How do I syncronize ARB_buffer_storage?

  2. #2
    Member Newbie
    Join Date
    Sep 2013
    Posts
    31

    glSyncFence leak

    I'm currently using this:
    Code :
    GLsync pSyncFence = NULL;
    for each object
    {
    	if (pSyncFence)
    	{
    		GLenum nReturnValue = glClientWaitSync(pSyncFence, GL_SYNC_FLUSH_COMMANDS_BIT, GL_TIMEOUT_IGNORED);
    		if (GL_WAIT_FAILED == nReturnValue || GL_TIMEOUT_EXPIRED == nReturnValue)
    		{
    			// Something went wrong.
    		}
     
    		glDeleteSync(pSyncFence);
    		pSyncFence = NULL;
     
    		DoSomethingWithBufferStorageClientPointer();
    		glMemoryBarrier(GL_CLIENT_MAPPED_BUFFER_BIT); // Don't know if right.
     
    		BindSomeData();
    		Draw();
     
    		pSyncFence = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
    	}
    }

    Syncronization is working right (no strange things happen) but it's leaking memory. Why is this happening?
    I'm using Catalyst 14.4 RC with Ubuntu 14.04 x86_64. I haven't tried it on Windows with Catalyst 14.4 (not RC) yet.



    Edit:
    Fixed. I've changed GL_SYNC_FLUSH_COMMANDS_BIT to GL_NONE (0x00) and no more memory leaks.

Similar Threads

  1. Mac OS X use glBufferStorage
    By robinfaury in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 05-25-2016, 09:15 AM
  2. GlBufferStorage and Fencing / synchronisation
    By imported_qnoper in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 09-27-2014, 03:28 PM

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