Resource Management 2: Buffer mapping error handling

Add error handling for buffer mapping ops.

BUG=dawn:27

Change-Id: I9a66baf74c27b137990608c31cb04af8023594b0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9241
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
Bryan Bernhart
2019-07-23 00:04:59 +00:00
committed by Commit Bot service account
parent 23dd12459c
commit 07b5be3bc5
12 changed files with 42 additions and 26 deletions

View File

@@ -58,7 +58,7 @@ namespace dawn_native { namespace opengl {
return {};
}
void Buffer::MapReadAsyncImpl(uint32_t serial) {
MaybeError Buffer::MapReadAsyncImpl(uint32_t serial) {
const OpenGLFunctions& gl = ToBackend(GetDevice())->gl;
// TODO(cwallez@chromium.org): this does GPU->CPU synchronization, we could require a high
@@ -66,9 +66,10 @@ namespace dawn_native { namespace opengl {
gl.BindBuffer(GL_ARRAY_BUFFER, mBuffer);
void* data = gl.MapBuffer(GL_ARRAY_BUFFER, GL_READ_ONLY);
CallMapReadCallback(serial, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, data, GetSize());
return {};
}
void Buffer::MapWriteAsyncImpl(uint32_t serial) {
MaybeError Buffer::MapWriteAsyncImpl(uint32_t serial) {
const OpenGLFunctions& gl = ToBackend(GetDevice())->gl;
// TODO(cwallez@chromium.org): this does GPU->CPU synchronization, we could require a high
@@ -76,6 +77,7 @@ namespace dawn_native { namespace opengl {
gl.BindBuffer(GL_ARRAY_BUFFER, mBuffer);
void* data = gl.MapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
CallMapWriteCallback(serial, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, data, GetSize());
return {};
}
void Buffer::UnmapImpl() {

View File

@@ -33,8 +33,8 @@ namespace dawn_native { namespace opengl {
private:
// Dawn API
MaybeError SetSubDataImpl(uint32_t start, uint32_t count, const void* data) override;
void MapReadAsyncImpl(uint32_t serial) override;
void MapWriteAsyncImpl(uint32_t serial) override;
MaybeError MapReadAsyncImpl(uint32_t serial) override;
MaybeError MapWriteAsyncImpl(uint32_t serial) override;
void UnmapImpl() override;
void DestroyImpl() override;