From: Józef Kucia Subject: [PATCH 6/6] wined3d: Allow to create WINED3DFMT_R{16, 32}_TYPELESS depth textures. Message-Id: <1467712015-12306-6-git-send-email-jkucia@codeweavers.com> Date: Tue, 5 Jul 2016 11:46:55 +0200 In-Reply-To: <1467712015-12306-1-git-send-email-jkucia@codeweavers.com> References: <1467712015-12306-1-git-send-email-jkucia@codeweavers.com> Signed-off-by: Józef Kucia --- dlls/d3d10core/tests/device.c | 3 ++- dlls/d3d11/tests/d3d11.c | 3 ++- dlls/wined3d/utils.c | 8 ++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c index 5f4981f..7067ee6 100644 --- a/dlls/d3d10core/tests/device.c +++ b/dlls/d3d10core/tests/device.c @@ -1055,6 +1055,7 @@ static void test_create_texture2d(void) {DXGI_FORMAT_R32_TYPELESS, 9, D3D10_BIND_SHADER_RESOURCE, 0, TRUE, FALSE}, {DXGI_FORMAT_R32_TYPELESS, 9, D3D10_BIND_SHADER_RESOURCE, D3D10_RESOURCE_MISC_TEXTURECUBE, FALSE, TRUE}, + {DXGI_FORMAT_R32_TYPELESS, 1, D3D11_BIND_DEPTH_STENCIL, 0, TRUE, FALSE}, {DXGI_FORMAT_R24G8_TYPELESS, 1, D3D10_BIND_VERTEX_BUFFER, 0, FALSE, TRUE}, {DXGI_FORMAT_R24G8_TYPELESS, 1, D3D10_BIND_INDEX_BUFFER, 0, FALSE, TRUE}, {DXGI_FORMAT_R24G8_TYPELESS, 1, D3D10_BIND_CONSTANT_BUFFER, 0, FALSE, TRUE}, @@ -1065,7 +1066,7 @@ static void test_create_texture2d(void) {DXGI_FORMAT_R8G8_UNORM, 1, D3D10_BIND_RENDER_TARGET, 0, TRUE, FALSE}, {DXGI_FORMAT_R8G8_SNORM, 1, D3D10_BIND_RENDER_TARGET, 0, TRUE, FALSE}, {DXGI_FORMAT_R16_TYPELESS, 1, D3D10_BIND_SHADER_RESOURCE, 0, TRUE, FALSE}, - {DXGI_FORMAT_R16_TYPELESS, 1, D3D10_BIND_DEPTH_STENCIL, 0, TRUE, TRUE}, + {DXGI_FORMAT_R16_TYPELESS, 1, D3D10_BIND_DEPTH_STENCIL, 0, TRUE, FALSE}, {DXGI_FORMAT_R8_TYPELESS, 1, D3D10_BIND_SHADER_RESOURCE, 0, TRUE, FALSE}, {DXGI_FORMAT_R8G8B8A8_UNORM, 1, D3D10_BIND_RENDER_TARGET, 0, TRUE, FALSE}, {DXGI_FORMAT_R8G8B8A8_UNORM, 1, D3D10_BIND_DEPTH_STENCIL, 0, FALSE, FALSE}, diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 174031c..b3b67c4 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -1476,6 +1476,7 @@ static void test_create_texture2d(void) {DXGI_FORMAT_R32_TYPELESS, 9, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE}, {DXGI_FORMAT_R32_TYPELESS, 9, D3D11_BIND_SHADER_RESOURCE, D3D11_RESOURCE_MISC_TEXTURECUBE, TRUE, FALSE}, + {DXGI_FORMAT_R32_TYPELESS, 1, D3D11_BIND_DEPTH_STENCIL, 0, TRUE, FALSE}, {DXGI_FORMAT_R24G8_TYPELESS, 1, D3D11_BIND_VERTEX_BUFFER, 0, FALSE, TRUE}, {DXGI_FORMAT_R24G8_TYPELESS, 1, D3D11_BIND_INDEX_BUFFER, 0, FALSE, TRUE}, {DXGI_FORMAT_R24G8_TYPELESS, 1, D3D11_BIND_CONSTANT_BUFFER, 0, FALSE, TRUE}, @@ -1486,7 +1487,7 @@ static void test_create_texture2d(void) {DXGI_FORMAT_R8G8_UNORM, 1, D3D11_BIND_RENDER_TARGET, 0, TRUE, FALSE}, {DXGI_FORMAT_R8G8_SNORM, 1, D3D11_BIND_RENDER_TARGET, 0, TRUE, FALSE}, {DXGI_FORMAT_R16_TYPELESS, 1, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE}, - {DXGI_FORMAT_R16_TYPELESS, 1, D3D11_BIND_DEPTH_STENCIL, 0, TRUE, TRUE}, + {DXGI_FORMAT_R16_TYPELESS, 1, D3D11_BIND_DEPTH_STENCIL, 0, TRUE, FALSE}, {DXGI_FORMAT_R8_TYPELESS, 1, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE}, {DXGI_FORMAT_R8G8B8A8_UNORM, 1, D3D11_BIND_RENDER_TARGET, 0, TRUE, FALSE}, {DXGI_FORMAT_R8G8B8A8_UNORM, 1, D3D11_BIND_DEPTH_STENCIL, 0, FALSE, FALSE}, diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 01e56eb..394f8ea 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -234,6 +234,7 @@ static const struct wined3d_typed_format_info typed_formats[] = {WINED3DFMT_R32_UINT, WINED3DFMT_R32_TYPELESS, "U"}, {WINED3DFMT_R32_SINT, WINED3DFMT_R32_TYPELESS, "I"}, {WINED3DFMT_R32_FLOAT, WINED3DFMT_R32_TYPELESS, "F"}, + {WINED3DFMT_D32_FLOAT, WINED3DFMT_R32_TYPELESS, "D"}, {WINED3DFMT_R24_UNORM_X8_TYPELESS, WINED3DFMT_R24G8_TYPELESS, "DX"}, {WINED3DFMT_X24_TYPELESS_G8_UINT, WINED3DFMT_R24G8_TYPELESS, "XS"}, {WINED3DFMT_D24_UNORM_S8_UINT, WINED3DFMT_R24G8_TYPELESS, "DS"}, @@ -243,6 +244,7 @@ static const struct wined3d_typed_format_info typed_formats[] = {WINED3DFMT_R16_UINT, WINED3DFMT_R16_TYPELESS, "U"}, {WINED3DFMT_R16_SINT, WINED3DFMT_R16_TYPELESS, "I"}, {WINED3DFMT_R16_FLOAT, WINED3DFMT_R16_TYPELESS, "F"}, + {WINED3DFMT_D16_UNORM, WINED3DFMT_R16_TYPELESS, "D"}, {WINED3DFMT_R8_UNORM, WINED3DFMT_R8_TYPELESS, "u"}, {WINED3DFMT_BC1_UNORM_SRGB, WINED3DFMT_BC1_TYPELESS, ""}, {WINED3DFMT_BC1_UNORM, WINED3DFMT_BC1_TYPELESS, ""}, @@ -1676,6 +1678,12 @@ static BOOL init_format_base_info(struct wined3d_gl_info *gl_info) flags |= WINED3DFMT_FLAG_INTEGER; if (channel_type == WINED3D_CHANNEL_TYPE_FLOAT) flags |= WINED3DFMT_FLAG_FLOAT; + + if (channel_type == WINED3D_CHANNEL_TYPE_DEPTH && !format->depth_size) + { + format->depth_size = format->red_size; + format->red_size = format->red_offset = 0; + } } format_set_flag(format, flags); -- 2.7.3