Error handling fixes

This commit is contained in:
Henrik Rydgård 2020-10-18 20:26:19 +02:00
parent e80a526015
commit 92e1dce2db
2 changed files with 7 additions and 4 deletions

View File

@ -1305,8 +1305,8 @@ Framebuffer *D3D11DrawContext::CreateFramebuffer(const FramebufferDesc &desc) {
depthViewDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
hr = device_->CreateShaderResourceView(fb->depthStencilTex, &depthViewDesc, &fb->depthSRView);
if (FAILED(hr)) {
delete fb;
return nullptr;
WARN_LOG(G3D, "Failed to create SRV for depth buffer.");
fb->depthSRView = nullptr;
}
}
@ -1606,7 +1606,9 @@ void D3D11DrawContext::BindFramebufferAsTexture(Framebuffer *fbo, int binding, F
context_->PSSetShaderResources(binding, 1, &fb->colorSRView);
break;
case FBChannel::FB_DEPTH_BIT:
context_->PSSetShaderResources(binding, 1, &fb->depthSRView);
if (fb->depthSRView) {
context_->PSSetShaderResources(binding, 1, &fb->depthSRView);
}
break;
default:
break;

View File

@ -121,7 +121,8 @@ TextureCacheD3D11::TextureCacheD3D11(Draw::DrawContext *draw)
lastBoundTexture = INVALID_TEX;
D3D11_BUFFER_DESC desc{ sizeof(DepthPushConstants), D3D11_USAGE_DYNAMIC, D3D11_BIND_CONSTANT_BUFFER, D3D11_CPU_ACCESS_WRITE };
_dbg_assert_(SUCCEEDED(device_->CreateBuffer(&desc, nullptr, &depalConstants_)));
HRESULT hr = device_->CreateBuffer(&desc, nullptr, &depalConstants_);
_dbg_assert_(SUCCEEDED(hr));
HRESULT result = 0;