mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-14 15:46:28 +00:00
Metal: Implement lazy texture clears
Bug: dawn:145 Change-Id: I73d161002cb09498e41838a10e9ac1db996c955d Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14781 Reviewed-by: Kai Ninomiya <kainino@chromium.org> Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
0ecc48ecb7
commit
0d6619848d
@@ -193,12 +193,15 @@ namespace dawn_native { namespace opengl {
|
||||
|
||||
Device* device = ToBackend(GetDevice());
|
||||
const OpenGLFunctions& gl = device->gl;
|
||||
|
||||
uint8_t clearColor = (clearValue == TextureBase::ClearValue::Zero) ? 0 : 1;
|
||||
float fClearColor = (clearValue == TextureBase::ClearValue::Zero) ? 0.f : 1.f;
|
||||
|
||||
if (GetFormat().isRenderable) {
|
||||
if (GetFormat().HasDepthOrStencil()) {
|
||||
bool doDepthClear = GetFormat().HasDepth();
|
||||
bool doStencilClear = GetFormat().HasStencil();
|
||||
GLfloat depth = clearColor;
|
||||
GLfloat depth = fClearColor;
|
||||
GLint stencil = clearColor;
|
||||
if (doDepthClear) {
|
||||
gl.DepthMask(GL_TRUE);
|
||||
@@ -265,8 +268,7 @@ namespace dawn_native { namespace opengl {
|
||||
// Fill the buffer with clear color
|
||||
uint8_t* clearBuffer = nullptr;
|
||||
DAWN_TRY(srcBuffer->MapAtCreation(&clearBuffer));
|
||||
std::fill(reinterpret_cast<uint32_t*>(clearBuffer),
|
||||
reinterpret_cast<uint32_t*>(clearBuffer + descriptor.size), clearColor);
|
||||
memset(clearBuffer, clearColor, descriptor.size);
|
||||
srcBuffer->Unmap();
|
||||
|
||||
// Bind buffer and texture, and make the buffer to texture copy
|
||||
|
||||
Reference in New Issue
Block a user