mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-17 17:05:31 +00:00
Implement buffer lazy initialization before mapping
This patch implements buffer lazy initialization beffor MapAsync() and buffer creation with BufferDescriptor.mappedAtCreation == true. Note that this patch doesn't initialize buffers in MapReadAsyc() and MapWriteAsync() because they are deprecated and will be removed soon. BUG=dawn:414 TEST=dawn_end2end_tests Change-Id: Ifea99833897081f599c45797e0829c57de1ac926 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24687 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
This commit is contained in:
committed by
Commit Bot service account
parent
2733af5c75
commit
77eb64eb8c
@@ -99,6 +99,8 @@ namespace dawn_native { namespace opengl {
|
||||
}
|
||||
|
||||
MaybeError Buffer::MapAtCreationImpl() {
|
||||
EnsureDataInitialized();
|
||||
|
||||
const OpenGLFunctions& gl = ToBackend(GetDevice())->gl;
|
||||
gl.BindBuffer(GL_ARRAY_BUFFER, mBuffer);
|
||||
mMappedData = gl.MapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
|
||||
@@ -137,6 +139,8 @@ namespace dawn_native { namespace opengl {
|
||||
size = 4;
|
||||
}
|
||||
|
||||
EnsureDataInitialized();
|
||||
|
||||
// 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.
|
||||
gl.BindBuffer(GL_ARRAY_BUFFER, mBuffer);
|
||||
|
||||
Reference in New Issue
Block a user