ClearBufferData + shader_buffer_store
I do not understand the behavior of ClearBufferData in my OpenGL 4.3 application. Basically, it seems that clearing a buffer with ClearBufferData then writing into it in shaders causes the buffer to always be empty after the shaders execute.
Specifically, my application does the following:
1. ClearBufferData of myBuffer
2. Make myBuffer resident on the GPU and set it as a uniform in shaders
3. a. Enable shaders
3. b. Draw stuff with shaders (each fragment shader writes into myBuffer)
3. c. Disable shaders
4. Make myBuffer non resident
After #4 myBuffer contains all 0's. However, if I do not clear myBuffer (remove #1) then its contents is written by the shaders as I would expect. I've tried putting a Finish() call between the clear and draw, but it has no effect. What is going on here? I'd appreciate any explanation.