1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-18 11:52:12 +01:00

[d3d11] Add exception handling to CreateTexture* methods

This commit is contained in:
Philip Rebohle 2018-02-27 08:54:24 +01:00
parent 43b7e84bb5
commit dc67cf730e
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -75,15 +75,20 @@ namespace dxvk {
const D3D11_BUFFER_DESC* pDesc, const D3D11_BUFFER_DESC* pDesc,
const D3D11_SUBRESOURCE_DATA* pInitialData, const D3D11_SUBRESOURCE_DATA* pInitialData,
ID3D11Buffer** ppBuffer) { ID3D11Buffer** ppBuffer) {
if (ppBuffer != nullptr) { if (ppBuffer == nullptr)
return S_FALSE;
try {
const Com<D3D11Buffer> buffer const Com<D3D11Buffer> buffer
= new D3D11Buffer(this, pDesc); = new D3D11Buffer(this, pDesc);
this->InitBuffer(buffer.ptr(), pInitialData); this->InitBuffer(buffer.ptr(), pInitialData);
*ppBuffer = buffer.ref(); *ppBuffer = buffer.ref();
}
return S_OK; return S_OK;
} catch (const DxvkError& e) {
Logger::err(e.message());
return E_FAIL;
}
} }
@ -91,15 +96,20 @@ namespace dxvk {
const D3D11_TEXTURE1D_DESC* pDesc, const D3D11_TEXTURE1D_DESC* pDesc,
const D3D11_SUBRESOURCE_DATA* pInitialData, const D3D11_SUBRESOURCE_DATA* pInitialData,
ID3D11Texture1D** ppTexture1D) { ID3D11Texture1D** ppTexture1D) {
if (ppTexture1D != nullptr) { if (ppTexture1D == nullptr)
return S_FALSE;
try {
const Com<D3D11Texture1D> texture const Com<D3D11Texture1D> texture
= new D3D11Texture1D(this, pDesc); = new D3D11Texture1D(this, pDesc);
this->InitTexture(texture->GetTextureInfo()->image, pInitialData); this->InitTexture(texture->GetTextureInfo()->image, pInitialData);
*ppTexture1D = texture.ref(); *ppTexture1D = texture.ref();
}
return S_OK; return S_OK;
} catch (const DxvkError& e) {
Logger::err(e.message());
return E_FAIL;
}
} }
@ -107,15 +117,20 @@ namespace dxvk {
const D3D11_TEXTURE2D_DESC* pDesc, const D3D11_TEXTURE2D_DESC* pDesc,
const D3D11_SUBRESOURCE_DATA* pInitialData, const D3D11_SUBRESOURCE_DATA* pInitialData,
ID3D11Texture2D** ppTexture2D) { ID3D11Texture2D** ppTexture2D) {
if (ppTexture2D != nullptr) { if (ppTexture2D == nullptr)
return S_FALSE;
try {
const Com<D3D11Texture2D> texture const Com<D3D11Texture2D> texture
= new D3D11Texture2D(this, pDesc); = new D3D11Texture2D(this, pDesc);
this->InitTexture(texture->GetTextureInfo()->image, pInitialData); this->InitTexture(texture->GetTextureInfo()->image, pInitialData);
*ppTexture2D = texture.ref(); *ppTexture2D = texture.ref();
}
return S_OK; return S_OK;
} catch (const DxvkError& e) {
Logger::err(e.message());
return E_FAIL;
}
} }
@ -123,15 +138,20 @@ namespace dxvk {
const D3D11_TEXTURE3D_DESC* pDesc, const D3D11_TEXTURE3D_DESC* pDesc,
const D3D11_SUBRESOURCE_DATA* pInitialData, const D3D11_SUBRESOURCE_DATA* pInitialData,
ID3D11Texture3D** ppTexture3D) { ID3D11Texture3D** ppTexture3D) {
if (ppTexture3D != nullptr) { if (ppTexture3D == nullptr)
return S_FALSE;
try {
const Com<D3D11Texture3D> texture const Com<D3D11Texture3D> texture
= new D3D11Texture3D(this, pDesc); = new D3D11Texture3D(this, pDesc);
this->InitTexture(texture->GetTextureInfo()->image, pInitialData); this->InitTexture(texture->GetTextureInfo()->image, pInitialData);
*ppTexture3D = texture.ref(); *ppTexture3D = texture.ref();
}
return S_OK; return S_OK;
} catch (const DxvkError& e) {
Logger::err(e.message());
return E_FAIL;
}
} }