OpenGL: Enable nonzero_clear_resources_on_creation_for_testing on buffer
This patch enables nonzero_clear_resources_on_creation_for_testing toggle on buffer on OpenGL backends as a preparation of supporting buffer lazy-initialization in Dawn. BUG=dawn:414 TEST=dawn_end2end_tests Change-Id: Ib49ad17a5d89e14dbdb08d2eb8d6441fadb68f10 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23143 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
This commit is contained in:
parent
2ef2be746d
commit
6b3a974b42
|
@ -28,7 +28,13 @@ namespace dawn_native { namespace opengl {
|
||||||
|
|
||||||
device->gl.GenBuffers(1, &mBuffer);
|
device->gl.GenBuffers(1, &mBuffer);
|
||||||
device->gl.BindBuffer(GL_ARRAY_BUFFER, mBuffer);
|
device->gl.BindBuffer(GL_ARRAY_BUFFER, mBuffer);
|
||||||
device->gl.BufferData(GL_ARRAY_BUFFER, size, nullptr, GL_STATIC_DRAW);
|
|
||||||
|
if (device->IsToggleEnabled(Toggle::NonzeroClearResourcesOnCreationForTesting)) {
|
||||||
|
std::vector<uint8_t> clearValues(size, 1u);
|
||||||
|
device->gl.BufferData(GL_ARRAY_BUFFER, size, clearValues.data(), GL_STATIC_DRAW);
|
||||||
|
} else {
|
||||||
|
device->gl.BufferData(GL_ARRAY_BUFFER, size, nullptr, GL_STATIC_DRAW);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Buffer::~Buffer() {
|
Buffer::~Buffer() {
|
||||||
|
|
|
@ -53,4 +53,5 @@ TEST_P(NonzeroBufferCreationTests, BufferCreationWithMapWriteWithoutCopyDstUsage
|
||||||
DAWN_INSTANTIATE_TEST(NonzeroBufferCreationTests,
|
DAWN_INSTANTIATE_TEST(NonzeroBufferCreationTests,
|
||||||
D3D12Backend({"nonzero_clear_resources_on_creation_for_testing"}),
|
D3D12Backend({"nonzero_clear_resources_on_creation_for_testing"}),
|
||||||
MetalBackend({"nonzero_clear_resources_on_creation_for_testing"}),
|
MetalBackend({"nonzero_clear_resources_on_creation_for_testing"}),
|
||||||
|
OpenGLBackend({"nonzero_clear_resources_on_creation_for_testing"}),
|
||||||
VulkanBackend({"nonzero_clear_resources_on_creation_for_testing"}));
|
VulkanBackend({"nonzero_clear_resources_on_creation_for_testing"}));
|
||||||
|
|
Loading…
Reference in New Issue