// Perf impact (test was only done on a gs dump): // Normal (fast): Message:Buffer detailed info: Buffer object 9 (bound to // GL_PIXEL_UNPACK_BUFFER_ARB, usage hint is GL_STREAM_COPY) will use VIDEO // memory as the source for buffer object operations. // // Persistent (slower): Message:Buffer detailed info: Buffer object 8 // (bound to GL_PIXEL_UNPACK_BUFFER_ARB, usage hint is GL_DYNAMIC_DRAW) // will use DMA CACHED memory as the source for buffer object operations void Init() { glGenBuffers(countof(m_pool), m_pool); for (size_t i = 0; i < countof(m_pool); i++) { BindPbo(); glBufferStorage(GL_PIXEL_UNPACK_BUFFER, m_pbo_size, NULL, create_flags); m_map[m_current_pbo] = (char*)glMapBufferRange(GL_PIXEL_UNPACK_BUFFER, 0, m_pbo_size, map_flags); m_fence[m_current_pbo] = 0; NextPbo(); } UnbindPbo(); }
void Init() { glGenBuffers(1, &m_buffer); BindPbo(); glObjectLabel(GL_BUFFER, m_buffer, -1, "PBO"); glBufferStorage(GL_PIXEL_UNPACK_BUFFER, m_pbo_size, NULL, create_flags); m_map = (char*)glMapBufferRange(GL_PIXEL_UNPACK_BUFFER, 0, m_pbo_size, map_flags); m_offset = 0; for (size_t i = 0; i < countof(m_fence); i++) { m_fence[i] = 0; } UnbindPbo(); }
// Perf impact (test was only done on a gs dump): // Normal (fast): Message:Buffer detailed info: Buffer object 9 (bound to // GL_PIXEL_UNPACK_BUFFER_ARB, usage hint is GL_STREAM_COPY) will use VIDEO // memory as the source for buffer object operations. // // Persistent (slower): Message:Buffer detailed info: Buffer object 8 // (bound to GL_PIXEL_UNPACK_BUFFER_ARB, usage hint is GL_DYNAMIC_DRAW) // will use DMA CACHED memory as the source for buffer object operations void Init() { glGenBuffers(countof(m_pool), m_pool); m_texture_storage = GLLoader::found_GL_ARB_buffer_storage; for (size_t i = 0; i < countof(m_pool); i++) { BindPbo(); if (m_texture_storage) { glBufferStorage(GL_PIXEL_UNPACK_BUFFER, m_pbo_size, NULL, create_flags); m_map[m_current_pbo] = (char*)glMapBufferRange(GL_PIXEL_UNPACK_BUFFER, 0, m_pbo_size, map_flags); m_fence[m_current_pbo] = 0; } else { glBufferData(GL_PIXEL_UNPACK_BUFFER, m_pbo_size, NULL, GL_STREAM_COPY); m_map[m_current_pbo] = NULL; } NextPbo(); } UnbindPbo(); }
// Perf impact (test was only done on a gs dump): // Normal (fast): Message:Buffer detailed info: Buffer object 9 (bound to // GL_PIXEL_UNPACK_BUFFER_ARB, usage hint is GL_STREAM_COPY) will use VIDEO // memory as the source for buffer object operations. // // Persistent (slower): Message:Buffer detailed info: Buffer object 8 // (bound to GL_PIXEL_UNPACK_BUFFER_ARB, usage hint is GL_DYNAMIC_DRAW) // will use DMA CACHED memory as the source for buffer object operations void Init() { glGenBuffers(countof(m_pool), m_pool); m_texture_storage = GLLoader::found_GL_ARB_buffer_storage; // Code is really faster on MT driver. So far only nvidia support it if (!GLLoader::nvidia_buggy_driver) m_texture_storage &= (theApp.GetConfig("ogl_texture_storage", 0) == 1); for (size_t i = 0; i < countof(m_pool); i++) { BindPbo(); if (m_texture_storage) { glBufferStorage(GL_PIXEL_UNPACK_BUFFER, m_pbo_size, NULL, create_flags); m_map[m_current_pbo] = (char*)glMapBufferRange(GL_PIXEL_UNPACK_BUFFER, 0, m_pbo_size, map_flags); m_fence[m_current_pbo] = 0; } else { glBufferData(GL_PIXEL_UNPACK_BUFFER, m_pbo_size, NULL, GL_STREAM_COPY); m_map[m_current_pbo] = NULL; } NextPbo(); } UnbindPbo(); }