Implement CreateBufferMapped for non-mappable buffers

This uses an intermediate staging buffer to copy data into the buffer.

Bug: dawn:7
Change-Id: I3bda19a8450ef0eddc5b4382ce1b9120f074b917
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7500
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Austin Eng
2019-06-05 18:35:31 +00:00
committed by Commit Bot service account
parent 233ce73c50
commit 9cd21f1bf9
16 changed files with 348 additions and 50 deletions

View File

@@ -35,6 +35,12 @@ namespace dawn_native { namespace opengl {
return mBuffer;
}
bool Buffer::IsMapWritable() const {
// TODO(enga): All buffers in GL can be mapped. Investigate if mapping them will cause the
// driver to migrate it to shared memory.
return true;
}
MaybeError Buffer::MapAtCreationImpl(uint8_t** mappedPointer) {
glBindBuffer(GL_ARRAY_BUFFER, mBuffer);
void* data = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);

View File

@@ -38,6 +38,7 @@ namespace dawn_native { namespace opengl {
void UnmapImpl() override;
void DestroyImpl() override;
bool IsMapWritable() const override;
MaybeError MapAtCreationImpl(uint8_t** mappedPointer) override;
GLuint mBuffer = 0;