mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-14 15:46:28 +00:00
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:
committed by
Commit Bot service account
parent
233ce73c50
commit
9cd21f1bf9
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user