I am currently working on speeding up a legacy 2d drawing library. Especially coherent+persistent buffers are a great tool to reduce the API overhead this library is suffering from (because most operations only touch a few pixels).
I am using the following code to create a streaming buffer to tranfer data to the gpu via an shader storage buffer object:
GLbitfield flags = GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT;
glBufferStorage( GL_SHADER_STORAGE_BUFFER, bufferSize, 0, flags);
maskBufferData = (uint8_t*) glMapBufferRange( GL_SHADER_STORAGE_BUFFER, 0, bufferSize, flags );
It does work with the nvidia driver (legacy 390), however debug messages indicate the driver is not actually doing what I was hoping for:
GL CALLBACK: type = 0x8251, severity = 0x826b, message = Buffer detailed info: Buffer object 1 (bound to GL_SHADER_STORAGE_BUFFER, and GL_SHADER_STORAGE_BUFFER (0), usage hint is GL_DYNAMIC_DRAW) will use SYSTEM HEAP (fast) memory as the source for buffer object operations.
So, if I understand this message correctly, the driver allocated the buffer in GART, GPU accessible system memory, right? So when I issue my draw commands, each access to the SSBOs has to go through the PCIe bus and read system memory.
What I was actually hoping for was a buffer allocated in VRAM, with uncached write-combined access.
Did I use confusing / wrong hints?
Or does the nvidia driver simply not allow placing persistent+coherent buffers in VRAM?
Thanks & best regards, Clemens