From f9a66eb40d4cba2db73d91efcf7259038e53f27a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Wed, 13 Jun 2018 12:23:58 +0200 Subject: [PATCH] d3d11: Normalize 1D texture view descriptions. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/d3d11/view.c | 53 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 8 deletions(-) diff --git a/dlls/d3d11/view.c b/dlls/d3d11/view.c index 80c4888d782..164a1839e63 100644 --- a/dlls/d3d11/view.c +++ b/dlls/d3d11/view.c @@ -132,6 +132,8 @@ static HRESULT normalize_dsv_desc(D3D11_DEPTH_STENCIL_VIEW_DESC *desc, ID3D11Res { case D3D11_RESOURCE_DIMENSION_TEXTURE1D: { + const struct d3d_texture1d *texture; + if (desc->ViewDimension != D3D11_DSV_DIMENSION_TEXTURE1D && desc->ViewDimension != D3D11_DSV_DIMENSION_TEXTURE1DARRAY) { @@ -139,8 +141,15 @@ static HRESULT normalize_dsv_desc(D3D11_DEPTH_STENCIL_VIEW_DESC *desc, ID3D11Res return E_INVALIDARG; } - FIXME("Unhandled 1D texture resource.\n"); - return S_OK; + if (!(texture = unsafe_impl_from_ID3D11Texture1D((ID3D11Texture1D *)resource))) + { + ERR("Cannot get implementation from ID3D11Texture1D.\n"); + return E_FAIL; + } + + format = texture->desc.Format; + layer_count = texture->desc.ArraySize; + break; } case D3D11_RESOURCE_DIMENSION_TEXTURE2D: @@ -344,6 +353,8 @@ static HRESULT normalize_rtv_desc(D3D11_RENDER_TARGET_VIEW_DESC *desc, ID3D11Res case D3D11_RESOURCE_DIMENSION_TEXTURE1D: { + const struct d3d_texture1d *texture; + if (desc->ViewDimension != D3D11_RTV_DIMENSION_TEXTURE1D && desc->ViewDimension != D3D11_RTV_DIMENSION_TEXTURE1DARRAY) { @@ -351,8 +362,15 @@ static HRESULT normalize_rtv_desc(D3D11_RENDER_TARGET_VIEW_DESC *desc, ID3D11Res return E_INVALIDARG; } - FIXME("Unhandled 1D texture resource.\n"); - return S_OK; + if (!(texture = unsafe_impl_from_ID3D11Texture1D((ID3D11Texture1D *)resource))) + { + ERR("Cannot get implementation from ID3D11Texture1D.\n"); + return E_FAIL; + } + + format = texture->desc.Format; + layer_count = texture->desc.ArraySize; + break; } case D3D11_RESOURCE_DIMENSION_TEXTURE2D: @@ -626,6 +644,8 @@ static HRESULT normalize_srv_desc(D3D11_SHADER_RESOURCE_VIEW_DESC *desc, ID3D11R case D3D11_RESOURCE_DIMENSION_TEXTURE1D: { + const struct d3d_texture1d *texture; + if (desc->ViewDimension != D3D11_SRV_DIMENSION_TEXTURE1D && desc->ViewDimension != D3D11_SRV_DIMENSION_TEXTURE1DARRAY) { @@ -633,8 +653,16 @@ static HRESULT normalize_srv_desc(D3D11_SHADER_RESOURCE_VIEW_DESC *desc, ID3D11R return E_INVALIDARG; } - FIXME("Unhandled 1D texture resource.\n"); - return S_OK; + if (!(texture = unsafe_impl_from_ID3D11Texture1D((ID3D11Texture1D *)resource))) + { + ERR("Cannot get implementation from ID3D11Texture1D.\n"); + return E_FAIL; + } + + format = texture->desc.Format; + miplevel_count = texture->desc.MipLevels; + layer_count = texture->desc.ArraySize; + break; } case D3D11_RESOURCE_DIMENSION_TEXTURE2D: @@ -871,6 +899,8 @@ static HRESULT normalize_uav_desc(D3D11_UNORDERED_ACCESS_VIEW_DESC *desc, ID3D11 case D3D11_RESOURCE_DIMENSION_TEXTURE1D: { + const struct d3d_texture1d *texture; + if (desc->ViewDimension != D3D11_UAV_DIMENSION_TEXTURE1D && desc->ViewDimension != D3D11_UAV_DIMENSION_TEXTURE1DARRAY) { @@ -878,8 +908,15 @@ static HRESULT normalize_uav_desc(D3D11_UNORDERED_ACCESS_VIEW_DESC *desc, ID3D11 return E_INVALIDARG; } - FIXME("Unhandled 1D texture resource.\n"); - return S_OK; + if (!(texture = unsafe_impl_from_ID3D11Texture1D((ID3D11Texture1D *)resource))) + { + ERR("Cannot get implementation from ID3D11Texture1D.\n"); + return E_FAIL; + } + + format = texture->desc.Format; + layer_count = texture->desc.ArraySize; + break; } case D3D11_RESOURCE_DIMENSION_TEXTURE2D: