VideoBackends/D3D11: Include HRESULT in error messages

This commit is contained in:
Pokechu22
2021-12-12 12:50:13 -08:00
parent 140c8217f6
commit 23cdb5c576
9 changed files with 73 additions and 38 deletions

View File

@ -51,8 +51,8 @@ std::unique_ptr<DXTexture> DXTexture::Create(const TextureConfig& config, std::s
HRESULT hr = D3D::device->CreateTexture2D(&desc, nullptr, d3d_texture.GetAddressOf());
if (FAILED(hr))
{
PanicAlertFmt("Failed to create {}x{}x{} D3D backing texture", config.width, config.height,
config.layers);
PanicAlertFmt("Failed to create {}x{}x{} D3D backing texture: {}", config.width, config.height,
config.layers, DX11HRWrap(hr));
return nullptr;
}
@ -98,8 +98,8 @@ bool DXTexture::CreateSRV()
HRESULT hr = D3D::device->CreateShaderResourceView(m_texture.Get(), &desc, m_srv.GetAddressOf());
if (FAILED(hr))
{
PanicAlertFmt("Failed to create {}x{}x{} D3D SRV", m_config.width, m_config.height,
m_config.layers);
PanicAlertFmt("Failed to create {}x{}x{} D3D SRV: {}", m_config.width, m_config.height,
m_config.layers, DX11HRWrap(hr));
return false;
}
@ -115,8 +115,8 @@ bool DXTexture::CreateUAV()
HRESULT hr = D3D::device->CreateUnorderedAccessView(m_texture.Get(), &desc, m_uav.GetAddressOf());
if (FAILED(hr))
{
PanicAlertFmt("Failed to create {}x{}x{} D3D UAV", m_config.width, m_config.height,
m_config.layers);
PanicAlertFmt("Failed to create {}x{}x{} D3D UAV: {}", m_config.width, m_config.height,
m_config.layers, DX11HRWrap(hr));
return false;
}
@ -207,7 +207,7 @@ std::unique_ptr<DXStagingTexture> DXStagingTexture::Create(StagingTextureType ty
ComPtr<ID3D11Texture2D> texture;
HRESULT hr = D3D::device->CreateTexture2D(&desc, nullptr, texture.GetAddressOf());
ASSERT_MSG(VIDEO, SUCCEEDED(hr), "Failed to create staging texture");
ASSERT_MSG(VIDEO, SUCCEEDED(hr), "Failed to create staging texture: {}", DX11HRWrap(hr));
if (FAILED(hr))
return nullptr;
@ -298,7 +298,7 @@ bool DXStagingTexture::Map()
D3D11_MAPPED_SUBRESOURCE sr;
HRESULT hr = D3D::context->Map(m_tex.Get(), 0, map_type, 0, &sr);
ASSERT_MSG(VIDEO, SUCCEEDED(hr), "Failed to map readback texture");
ASSERT_MSG(VIDEO, SUCCEEDED(hr), "Failed to map readback texture: {}", DX11HRWrap(hr));
if (FAILED(hr))
return false;
@ -363,7 +363,8 @@ std::unique_ptr<DXFramebuffer> DXFramebuffer::Create(DXTexture* color_attachment
color_attachment->GetLayers());
HRESULT hr = D3D::device->CreateRenderTargetView(color_attachment->GetD3DTexture(), &desc,
rtv.GetAddressOf());
ASSERT_MSG(VIDEO, SUCCEEDED(hr), "Failed to create render target view for framebuffer");
ASSERT_MSG(VIDEO, SUCCEEDED(hr), "Failed to create render target view for framebuffer: {}",
DX11HRWrap(hr));
if (FAILED(hr))
return nullptr;
@ -376,7 +377,7 @@ std::unique_ptr<DXFramebuffer> DXFramebuffer::Create(DXTexture* color_attachment
hr = D3D::device->CreateRenderTargetView(color_attachment->GetD3DTexture(), &desc,
integer_rtv.GetAddressOf());
ASSERT_MSG(VIDEO, SUCCEEDED(hr),
"Failed to create integer render target view for framebuffer");
"Failed to create integer render target view for framebuffer: {}", DX11HRWrap(hr));
}
}
@ -390,7 +391,8 @@ std::unique_ptr<DXFramebuffer> DXFramebuffer::Create(DXTexture* color_attachment
depth_attachment->GetLayers(), 0);
HRESULT hr = D3D::device->CreateDepthStencilView(depth_attachment->GetD3DTexture(), &desc,
dsv.GetAddressOf());
ASSERT_MSG(VIDEO, SUCCEEDED(hr), "Failed to create depth stencil view for framebuffer");
ASSERT_MSG(VIDEO, SUCCEEDED(hr), "Failed to create depth stencil view for framebuffer: {}",
DX11HRWrap(hr));
if (FAILED(hr))
return nullptr;
}