OpenGL: implement a synchronous MapReadAsync

Mapping OpenGL buffers persistently and unsynchronized isn't supported
on OSX's OpenGL version where we want to run tests.
This commit is contained in:
Corentin Wallez 2017-07-14 17:38:17 -04:00 committed by Corentin Wallez
parent dab0638177
commit 0f9f747c8a
1 changed files with 8 additions and 3 deletions

View File

@ -37,12 +37,17 @@ namespace opengl {
glBufferSubData(GL_ARRAY_BUFFER, start * sizeof(uint32_t), count * sizeof(uint32_t), data);
}
void Buffer::MapReadAsyncImpl(uint32_t, uint32_t, uint32_t) {
// TODO(cwallez@chromium.org): Implement Map Read for the GL backend
void Buffer::MapReadAsyncImpl(uint32_t serial, uint32_t start, uint32_t count) {
// TODO(cwallez@chromium.org): this does GPU->CPU synchronization, we could require a high
// version of OpenGL that would let us map the buffer unsynchronized.
glBindBuffer(GL_ARRAY_BUFFER, buffer);
void* data = glMapBufferRange(GL_ARRAY_BUFFER, start, count, GL_MAP_READ_BIT);
CallMapReadCallback(serial, NXT_BUFFER_MAP_READ_STATUS_SUCCESS, data);
}
void Buffer::UnmapImpl() {
// TODO(cwallez@chromium.org): Implement Map Read for the GL backend
glBindBuffer(GL_ARRAY_BUFFER, buffer);
glUnmapBuffer(GL_ARRAY_BUFFER);
}
void Buffer::TransitionUsageImpl(nxt::BufferUsageBit, nxt::BufferUsageBit) {