[d3d11] Return error if an application creates an RTV for a buffer

Vulkan does not support buffer RTVs, and neither does DXVK, so we
should return an error in that case. Previously, DXVK would crash
upon querying image information.
This commit is contained in:
Philip Rebohle 2018-03-18 21:38:48 +01:00
parent 69dd05b269
commit 0a473b4f86
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
1 changed files with 6 additions and 2 deletions

View File

@ -581,10 +581,15 @@ namespace dxvk {
ID3D11Resource* pResource,
const D3D11_RENDER_TARGET_VIEW_DESC* pDesc,
ID3D11RenderTargetView** ppRTView) {
// Only 2D textures and 2D texture arrays are allowed
// DXVK only supports render target views for image resources
D3D11_RESOURCE_DIMENSION resourceDim = D3D11_RESOURCE_DIMENSION_UNKNOWN;
pResource->GetType(&resourceDim);
if (resourceDim == D3D11_RESOURCE_DIMENSION_BUFFER) {
Logger::err("D3D11: Cannot create render target view for a buffer");
return E_INVALIDARG;
}
// The view description is optional. If not defined, it
// will use the resource's format and all array layers.
D3D11_RENDER_TARGET_VIEW_DESC desc;
@ -698,7 +703,6 @@ namespace dxvk {
ID3D11Resource* pResource,
const D3D11_DEPTH_STENCIL_VIEW_DESC* pDesc,
ID3D11DepthStencilView** ppDepthStencilView) {
// Only 2D textures and 2D texture arrays are allowed
D3D11_RESOURCE_DIMENSION resourceDim = D3D11_RESOURCE_DIMENSION_UNKNOWN;
pResource->GetType(&resourceDim);