GPUDevice: Fix binding deferred cleared textures

i.e. briefly flashing previous state after reset.
This commit is contained in:
Stenzek
2023-12-14 14:47:15 +10:00
parent 371c58dc72
commit 7e1276fbac
5 changed files with 30 additions and 6 deletions

View File

@@ -1408,13 +1408,12 @@ void MetalDevice::InvalidateRenderTarget(GPUTexture* t)
void MetalDevice::CommitClear(MetalTexture* tex)
{
if (tex->GetState() == GPUTexture::State::Dirty)
return;
DebugAssert(tex->IsRenderTargetOrDepthStencil());
if (tex->GetState() == GPUTexture::State::Cleared)
{
tex->SetState(GPUTexture::State::Dirty);
// TODO: We could combine it with the current render pass.
if (InRenderPass())
EndRenderPass();
@@ -1655,7 +1654,10 @@ void MetalDevice::SetTextureSampler(u32 slot, GPUTexture* texture, GPUSampler* s
id<MTLTexture> T = texture ? static_cast<MetalTexture*>(texture)->GetMTLTexture() : nil;
if (texture)
{
CommitClear(static_cast<MetalTexture*>(texture));
static_cast<MetalTexture*>(texture)->SetUseFenceCounter(m_current_fence_counter);
}
if (m_current_textures[slot] != T)
{