diff --git a/src/libANGLE/renderer/d3d/d3d11/Blit11.cpp b/src/libANGLE/renderer/d3d/d3d11/Blit11.cpp index 98bf6b2931..e3ef785356 100644 --- a/src/libANGLE/renderer/d3d/d3d11/Blit11.cpp +++ b/src/libANGLE/renderer/d3d/d3d11/Blit11.cpp @@ -1753,12 +1753,22 @@ angle::Result Blit11::initResolveDepthOnly(const gl::Context *context, const d3d11::Format &format, const gl::Extents &extents) { - if (mResolvedDepth.valid() && extents == mResolvedDepth.getExtents() && + // The cache is only usable if BOTH the texture and its DSV are valid and + // in sync; otherwise a prior partial failure (texture allocated, DSV + // allocation failed) would let resolveDepth() bind a stale/null DSV while + // returning a never-cleared mResolvedDepth. + if (mResolvedDepth.valid() && mResolvedDepthDSView.valid() && + extents == mResolvedDepth.getExtents() && format.texFormat == mResolvedDepth.getFormat()) { return angle::Result::Continue; } + // Release any previous (possibly desynced) resources before reallocating, + // mirroring initResolveDepthStencil(). + mResolvedDepth.reset(); + mResolvedDepthDSView.reset(); + D3D11_TEXTURE2D_DESC textureDesc; textureDesc.Width = extents.width; textureDesc.Height = extents.height;