diff --git a/patches/d3d11-Depth_Bias/0001-d3d11-tests-Don-t-use-draw_quad-in-test_cb_relative_.patch b/patches/d3d11-Depth_Bias/0001-d3d11-tests-Don-t-use-draw_quad-in-test_cb_relative_.patch new file mode 100644 index 00000000..55ca6064 --- /dev/null +++ b/patches/d3d11-Depth_Bias/0001-d3d11-tests-Don-t-use-draw_quad-in-test_cb_relative_.patch @@ -0,0 +1,51 @@ +From 1706e3e86b8a58ff9060ab9d16bfef351971f3e2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20M=C3=BCller?= +Date: Fri, 7 Jul 2017 04:06:01 +0200 +Subject: d3d11/tests: Don't use draw_quad in test_cb_relative_addressing. + +--- + dlls/d3d11/tests/d3d11.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c +index 241320d0a74..83ae6413f99 100644 +--- a/dlls/d3d11/tests/d3d11.c ++++ b/dlls/d3d11/tests/d3d11.c +@@ -12101,6 +12101,7 @@ static void test_cb_relative_addressing(void) + ID3D11Buffer *colors_cb, *index_cb; + unsigned int i, index[4] = {0}; + ID3D11DeviceContext *context; ++ unsigned int stride, offset; + ID3D11PixelShader *ps; + ID3D11Device *device; + HRESULT hr; +@@ -12241,10 +12242,17 @@ float4 main(const ps_in v) : SV_TARGET + hr = ID3D11Device_CreatePixelShader(device, ps_code, sizeof(ps_code), NULL, &ps); + ok(SUCCEEDED(hr), "Failed to create pixel shader, hr %#x.\n", hr); + ++ ID3D11DeviceContext_VSSetShader(context, test_context.vs, NULL, 0); + ID3D11DeviceContext_VSSetConstantBuffers(context, 0, 1, &index_cb); + ID3D11DeviceContext_VSSetConstantBuffers(context, 1, 1, &colors_cb); + ID3D11DeviceContext_PSSetShader(context, ps, NULL, 0); + ++ stride = sizeof(*quad); ++ offset = 0; ++ ID3D11DeviceContext_IASetInputLayout(context, test_context.input_layout); ++ ID3D11DeviceContext_IASetPrimitiveTopology(context, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); ++ ID3D11DeviceContext_IASetVertexBuffers(context, 0, 1, &test_context.vb, &stride, &offset); ++ + for (i = 0; i < ARRAY_SIZE(test_data); ++i) + { + ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, white_color); +@@ -12252,7 +12260,7 @@ float4 main(const ps_in v) : SV_TARGET + index[0] = test_data[i].index; + ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)index_cb, 0, NULL, &index, 0, 0); + +- draw_quad(&test_context); ++ ID3D11DeviceContext_Draw(context, 4, 0); + check_texture_color(test_context.backbuffer, test_data[i].expected, 1); + } + +-- +2.13.1 + diff --git a/patches/d3d11-Depth_Bias/0002-d3d11-tests-Add-some-basic-depth-tests.patch b/patches/d3d11-Depth_Bias/0002-d3d11-tests-Add-some-basic-depth-tests.patch new file mode 100644 index 00000000..64ebddc3 --- /dev/null +++ b/patches/d3d11-Depth_Bias/0002-d3d11-tests-Add-some-basic-depth-tests.patch @@ -0,0 +1,352 @@ +From f6b0a2ea8cfe9fe2bb272689dffb0f9e27b38f0b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20M=C3=BCller?= +Date: Fri, 7 Jul 2017 05:44:09 +0200 +Subject: d3d11/tests: Add some basic depth tests. + +--- + dlls/d3d11/tests/d3d11.c | 253 +++++++++++++++++++++++++++++++++++++++++++---- + 1 file changed, 232 insertions(+), 21 deletions(-) + +diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c +index 83ae6413f99..7c9c8395315 100644 +--- a/dlls/d3d11/tests/d3d11.c ++++ b/dlls/d3d11/tests/d3d11.c +@@ -1194,6 +1194,7 @@ struct d3d11_test_context + ID3D11InputLayout *input_layout; + ID3D11VertexShader *vs; + ID3D11Buffer *vb; ++ float last_depth; + + ID3D11PixelShader *ps; + ID3D11Buffer *ps_cb; +@@ -1270,12 +1271,13 @@ static void release_test_context_(unsigned int line, struct d3d11_test_context * + ok_(__FILE__, line)(!ref, "Device has %u references left.\n", ref); + } + +-#define draw_quad(c) draw_quad_(__LINE__, c) +-static void draw_quad_(unsigned int line, struct d3d11_test_context *context) ++#define draw_quad(c) draw_quad_(__LINE__, c, 0.0f) ++#define draw_quad_depth(c,d) draw_quad_(__LINE__, c, d) ++static void draw_quad_(unsigned int line, struct d3d11_test_context *context, float depth) + { + static const D3D11_INPUT_ELEMENT_DESC default_layout_desc[] = + { +- {"POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0}, ++ {"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0}, + }; + static const DWORD default_vs_code[] = + { +@@ -1301,12 +1303,12 @@ static void draw_quad_(unsigned int line, struct d3d11_test_context *context) + 0x49534f50, 0x4e4f4954, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, + 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49, + }; +- static const struct vec2 quad[] = ++ struct vec3 quad[] = + { +- {-1.0f, -1.0f}, +- {-1.0f, 1.0f}, +- { 1.0f, -1.0f}, +- { 1.0f, 1.0f}, ++ {-1.0f, -1.0f, depth}, ++ {-1.0f, 1.0f, depth}, ++ { 1.0f, -1.0f, depth}, ++ { 1.0f, 1.0f, depth}, + }; + + ID3D11Device *device = context->device; +@@ -1324,6 +1326,11 @@ static void draw_quad_(unsigned int line, struct d3d11_test_context *context) + hr = ID3D11Device_CreateVertexShader(device, default_vs_code, sizeof(default_vs_code), NULL, &context->vs); + ok_(__FILE__, line)(SUCCEEDED(hr), "Failed to create vertex shader, hr %#x.\n", hr); + } ++ else if (context->last_depth != depth) ++ { ++ ID3D11DeviceContext_UpdateSubresource(context->immediate_context, ++ (ID3D11Resource *)context->vb, 0, NULL, quad, 0, 0); ++ } + + ID3D11DeviceContext_IASetInputLayout(context->immediate_context, context->input_layout); + ID3D11DeviceContext_IASetPrimitiveTopology(context->immediate_context, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); +@@ -1331,6 +1338,7 @@ static void draw_quad_(unsigned int line, struct d3d11_test_context *context) + offset = 0; + ID3D11DeviceContext_IASetVertexBuffers(context->immediate_context, 0, 1, &context->vb, &stride, &offset); + ID3D11DeviceContext_VSSetShader(context->immediate_context, context->vs, NULL, 0); ++ context->last_depth = depth; + + ID3D11DeviceContext_Draw(context->immediate_context, 4, 0); + } +@@ -1341,8 +1349,9 @@ static void set_quad_color(struct d3d11_test_context *context, const struct vec4 + (ID3D11Resource *)context->ps_cb, 0, NULL, color, 0, 0); + } + +-#define draw_color_quad(c, color) draw_color_quad_(__LINE__, c, color) +-static void draw_color_quad_(unsigned int line, struct d3d11_test_context *context, const struct vec4 *color) ++#define draw_color_quad(c, color) draw_color_quad_(__LINE__, c, color, 0.0f) ++#define draw_color_quad_depth(c, color, depth) draw_color_quad_(__LINE__, c, color, depth) ++static void draw_color_quad_(unsigned int line, struct d3d11_test_context *context, const struct vec4 *color, float depth) + { + static const DWORD ps_color_code[] = + { +@@ -1384,7 +1393,7 @@ static void draw_color_quad_(unsigned int line, struct d3d11_test_context *conte + + set_quad_color(context, color); + +- draw_quad_(line, context); ++ draw_quad_(line, context, depth); + } + + static void test_create_device(void) +@@ -14506,12 +14515,12 @@ static void test_face_culling(void) + 0x00000000, 0x3f800000, 0x00000000, 0x3f800000, 0x00004002, 0x00000000, 0x00000000, 0x3f800000, + 0x3f800000, 0x0100003e, + }; +- static const struct vec2 ccw_quad[] = ++ static const struct vec3 ccw_quad[] = + { +- {-1.0f, 1.0f}, +- {-1.0f, -1.0f}, +- { 1.0f, 1.0f}, +- { 1.0f, -1.0f}, ++ {-1.0f, 1.0f, 0.0f}, ++ {-1.0f, -1.0f, 0.0f}, ++ { 1.0f, 1.0f, 0.0f}, ++ { 1.0f, -1.0f, 0.0f}, + }; + static const struct + { +@@ -15415,12 +15424,12 @@ static void test_stencil_separate(void) + + static const float red[] = {1.0f, 0.0f, 0.0f, 1.0f}; + static const struct vec4 green = {0.0f, 1.0f, 0.0f, 1.0f}; +- static const struct vec2 ccw_quad[] = ++ static const struct vec3 ccw_quad[] = + { +- {-1.0f, -1.0f}, +- { 1.0f, -1.0f}, +- {-1.0f, 1.0f}, +- { 1.0f, 1.0f}, ++ {-1.0f, -1.0f, 0.0f}, ++ { 1.0f, -1.0f, 0.0f}, ++ {-1.0f, 1.0f, 0.0f}, ++ { 1.0f, 1.0f, 0.0f}, + }; + + if (!init_test_context(&test_context, NULL)) +@@ -15507,6 +15516,207 @@ static void test_stencil_separate(void) + release_test_context(&test_context); + } + ++static void test_depth_separate(void) ++{ ++ struct d3d11_test_context test_context; ++ D3D11_TEXTURE2D_DESC texture_desc; ++ D3D11_DEPTH_STENCIL_DESC ds_desc; ++ ID3D11DepthStencilState *ds_state; ++ ID3D11DepthStencilView *ds_view; ++ D3D11_RASTERIZER_DESC rs_desc; ++ ID3D11DeviceContext *context; ++ struct resource_readback rb; ++ ID3D11RasterizerState *rs; ++ ID3D11Texture2D *texture; ++ ID3D11Device *device; ++ D3D11_VIEWPORT vp; ++ DWORD color; ++ HRESULT hr; ++ ++ static const float red[] = {1.0f, 0.0f, 0.0f, 1.0f}; ++ static const struct vec4 green = {0.0f, 1.0f, 0.0f, 1.0f}; ++ static const struct vec4 blue = {0.0f, 0.0f, 1.0f, 1.0f}; ++ static const struct vec4 white = {1.0f, 1.0f, 1.0f, 1.0f}; ++ static const DWORD green_d = 0xff00ff00; ++ static const DWORD blue_d = 0xffff0000; ++ static const DWORD red_d = 0xff0000ff; ++ static const DWORD white_d = 0xffffffff; ++ ++ if (!init_test_context(&test_context, NULL)) ++ return; ++ ++ device = test_context.device; ++ context = test_context.immediate_context; ++ ++ texture_desc.Width = 640; ++ texture_desc.Height = 480; ++ texture_desc.MipLevels = 1; ++ texture_desc.ArraySize = 1; ++ texture_desc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; ++ texture_desc.SampleDesc.Count = 1; ++ texture_desc.SampleDesc.Quality = 0; ++ texture_desc.Usage = D3D11_USAGE_DEFAULT; ++ texture_desc.BindFlags = D3D11_BIND_DEPTH_STENCIL; ++ texture_desc.CPUAccessFlags = 0; ++ texture_desc.MiscFlags = 0; ++ hr = ID3D11Device_CreateTexture2D(device, &texture_desc, NULL, &texture); ++ ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr); ++ hr = ID3D11Device_CreateDepthStencilView(device, (ID3D11Resource *)texture, NULL, &ds_view); ++ ok(SUCCEEDED(hr), "Failed to create depth stencil view, hr %#x.\n", hr); ++ ++ ds_desc.DepthEnable = TRUE; ++ ds_desc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL; ++ ds_desc.DepthFunc = D3D11_COMPARISON_LESS; ++ ds_desc.StencilEnable = FALSE; ++ ds_desc.StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK; ++ ds_desc.StencilWriteMask = D3D11_DEFAULT_STENCIL_WRITE_MASK; ++ ds_desc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_ZERO; ++ ds_desc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_ZERO; ++ ds_desc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_ZERO; ++ ds_desc.FrontFace.StencilFunc = D3D11_COMPARISON_NEVER; ++ ds_desc.BackFace.StencilFailOp = D3D11_STENCIL_OP_ZERO; ++ ds_desc.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_ZERO; ++ ds_desc.BackFace.StencilPassOp = D3D11_STENCIL_OP_ZERO; ++ ds_desc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS; ++ hr = ID3D11Device_CreateDepthStencilState(device, &ds_desc, &ds_state); ++ ok(SUCCEEDED(hr), "Failed to create depth stencil state, hr %#x.\n", hr); ++ ++ rs_desc.FillMode = D3D11_FILL_SOLID; ++ rs_desc.CullMode = D3D11_CULL_NONE; ++ rs_desc.FrontCounterClockwise = FALSE; ++ rs_desc.DepthBias = 0; ++ rs_desc.DepthBiasClamp = 0.0f; ++ rs_desc.SlopeScaledDepthBias = 0.0f; ++ rs_desc.DepthClipEnable = TRUE; ++ rs_desc.ScissorEnable = FALSE; ++ rs_desc.MultisampleEnable = FALSE; ++ rs_desc.AntialiasedLineEnable = FALSE; ++ ID3D11Device_CreateRasterizerState(device, &rs_desc, &rs); ++ ok(SUCCEEDED(hr), "Failed to create rasterizer state, hr %#x.\n", hr); ++ ++ ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, red); ++ ID3D11DeviceContext_ClearDepthStencilView(context, ds_view, D3D11_CLEAR_DEPTH, 1.1f, 0); ++ ID3D11DeviceContext_OMSetRenderTargets(context, 1, &test_context.backbuffer_rtv, ds_view); ++ ID3D11DeviceContext_OMSetDepthStencilState(context, ds_state, 0); ++ ID3D11DeviceContext_RSSetState(context, rs); ++ ++ vp.TopLeftX = 0.0f; ++ vp.TopLeftY = 0.0f; ++ vp.Width = texture_desc.Width; ++ vp.Height = texture_desc.Height; ++ vp.MinDepth = 0.0f; ++ vp.MaxDepth = 0.7f; ++ ID3D11DeviceContext_RSSetViewports(context, 1, &vp); ++ ++ /* simple depth tests */ ++ ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, red); ++ ID3D11DeviceContext_ClearDepthStencilView(context, ds_view, D3D11_CLEAR_DEPTH, 1.0f, 0); ++ draw_color_quad_depth(&test_context, &green, 0.0f); ++ get_texture_readback(test_context.backbuffer, 0, &rb); ++ color = get_readback_color(&rb, 320, 240); ++ ok(compare_color(color, green_d, 1), "Got unexpected color 0x%08x.\n", color); ++ release_resource_readback(&rb); ++ ++ ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, red); ++ ID3D11DeviceContext_ClearDepthStencilView(context, ds_view, D3D11_CLEAR_DEPTH, 1.0f, 0); ++ draw_color_quad_depth(&test_context, &green, 0.7f); ++ get_texture_readback(test_context.backbuffer, 0, &rb); ++ color = get_readback_color(&rb, 320, 240); ++ ok(compare_color(color, green_d, 1), "Got unexpected color 0x%08x.\n", color); ++ release_resource_readback(&rb); ++ ++ ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, red); ++ ID3D11DeviceContext_ClearDepthStencilView(context, ds_view, D3D11_CLEAR_DEPTH, 1.0f, 0); ++ draw_color_quad_depth(&test_context, &green, 0.0f); ++ draw_color_quad_depth(&test_context, &blue, 0.0f); ++ get_texture_readback(test_context.backbuffer, 0, &rb); ++ color = get_readback_color(&rb, 320, 240); ++ ok(compare_color(color, green_d, 1), "Got unexpected color 0x%08x.\n", color); ++ release_resource_readback(&rb); ++ ++ /* clipped */ ++ ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, red); ++ ID3D11DeviceContext_ClearDepthStencilView(context, ds_view, D3D11_CLEAR_DEPTH, 1.0f, 0); ++ draw_color_quad_depth(&test_context, &green, 1.1f); ++ get_texture_readback(test_context.backbuffer, 0, &rb); ++ color = get_readback_color(&rb, 320, 240); ++ ok(compare_color(color, red_d, 1), "Got unexpected color 0x%08x.\n", color); ++ release_resource_readback(&rb); ++ ++ ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, red); ++ ID3D11DeviceContext_ClearDepthStencilView(context, ds_view, D3D11_CLEAR_DEPTH, 1.0f, 0); ++ draw_color_quad_depth(&test_context, &green, -0.1f); ++ get_texture_readback(test_context.backbuffer, 0, &rb); ++ color = get_readback_color(&rb, 320, 240); ++ ok(compare_color(color, red_d, 1), "Got unexpected color 0x%08x.\n", color); ++ release_resource_readback(&rb); ++ ++ /* clipping disabled */ ++ ID3D11RasterizerState_Release(rs); ++ rs_desc.DepthClipEnable = FALSE; ++ ID3D11Device_CreateRasterizerState(device, &rs_desc, &rs); ++ ok(SUCCEEDED(hr), "Failed to create rasterizer state, hr %#x.\n", hr); ++ ID3D11DeviceContext_RSSetState(context, rs); ++ ++ ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, red); ++ ID3D11DeviceContext_ClearDepthStencilView(context, ds_view, D3D11_CLEAR_DEPTH, 1.0f, 0); ++ draw_color_quad_depth(&test_context, &green, 1.1f); ++ get_texture_readback(test_context.backbuffer, 0, &rb); ++ color = get_readback_color(&rb, 320, 240); ++ todo_wine ok(compare_color(color, green_d, 1), "Got unexpected color 0x%08x.\n", color); ++ release_resource_readback(&rb); ++ ++ ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, red); ++ ID3D11DeviceContext_ClearDepthStencilView(context, ds_view, D3D11_CLEAR_DEPTH, 1.0f, 0); ++ draw_color_quad_depth(&test_context, &green, -0.1f); ++ get_texture_readback(test_context.backbuffer, 0, &rb); ++ color = get_readback_color(&rb, 320, 240); ++ todo_wine ok(compare_color(color, green_d, 1), "Got unexpected color 0x%08x.\n", color); ++ release_resource_readback(&rb); ++ ++ /* depth bias */ ++ ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, red); ++ ID3D11DeviceContext_ClearDepthStencilView(context, ds_view, D3D11_CLEAR_DEPTH, 1.0f, 0); ++ draw_color_quad_depth(&test_context, &green, 0.5f); ++ ID3D11RasterizerState_Release(rs); ++ rs_desc.DepthClipEnable = TRUE; ++ rs_desc.DepthBias = -100000; ++ ID3D11Device_CreateRasterizerState(device, &rs_desc, &rs); ++ ok(SUCCEEDED(hr), "Failed to create rasterizer state, hr %#x.\n", hr); ++ ID3D11DeviceContext_RSSetState(context, rs); ++ draw_color_quad_depth(&test_context, &blue, 0.5f); ++ get_texture_readback(test_context.backbuffer, 0, &rb); ++ color = get_readback_color(&rb, 320, 240); ++ todo_wine ok(compare_color(color, blue_d, 1), "Got unexpected color 0x%08x.\n", color); ++ release_resource_readback(&rb); ++ ID3D11RasterizerState_Release(rs); ++ rs_desc.DepthBias = -100005; ++ ID3D11Device_CreateRasterizerState(device, &rs_desc, &rs); ++ ok(SUCCEEDED(hr), "Failed to create rasterizer state, hr %#x.\n", hr); ++ ID3D11DeviceContext_RSSetState(context, rs); ++ draw_color_quad_depth(&test_context, &white, 0.5f); ++ get_texture_readback(test_context.backbuffer, 0, &rb); ++ color = get_readback_color(&rb, 320, 240); ++ todo_wine ok(compare_color(color, white_d, 1), "Got unexpected color 0x%08x.\n", color); ++ release_resource_readback(&rb); ++ ID3D11RasterizerState_Release(rs); ++ rs_desc.DepthBias = -99995; ++ ID3D11Device_CreateRasterizerState(device, &rs_desc, &rs); ++ ok(SUCCEEDED(hr), "Failed to create rasterizer state, hr %#x.\n", hr); ++ ID3D11DeviceContext_RSSetState(context, rs); ++ draw_color_quad_depth(&test_context, &green, 0.5f); ++ get_texture_readback(test_context.backbuffer, 0, &rb); ++ color = get_readback_color(&rb, 320, 240); ++ todo_wine ok(compare_color(color, white_d, 1), "Got unexpected color 0x%08x.\n", color); ++ release_resource_readback(&rb); ++ ++ ID3D11DepthStencilState_Release(ds_state); ++ ID3D11DepthStencilView_Release(ds_view); ++ ID3D11RasterizerState_Release(rs); ++ ID3D11Texture2D_Release(texture); ++ release_test_context(&test_context); ++} ++ + static void test_uav_load(void) + { + struct shader +@@ -21083,6 +21293,7 @@ START_TEST(d3d11) + test_shader_input_registers_limits(); + test_unbind_shader_resource_view(); + test_stencil_separate(); ++ test_depth_separate(); + test_uav_load(); + test_cs_uav_store(); + test_ps_cs_uav_binding(); +-- +2.13.1 + diff --git a/patches/d3d11-Depth_Bias/0003-d3d11-Implement-depth-bias-and-slope.patch b/patches/d3d11-Depth_Bias/0003-d3d11-Implement-depth-bias-and-slope.patch new file mode 100644 index 00000000..01964a34 --- /dev/null +++ b/patches/d3d11-Depth_Bias/0003-d3d11-Implement-depth-bias-and-slope.patch @@ -0,0 +1,137 @@ +From 673399c500a4616d18443df206dbdb1d354f912b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20M=C3=BCller?= +Date: Mon, 3 Jul 2017 00:21:12 +0200 +Subject: d3d11: Implement depth bias and slope. + +--- + dlls/d3d11/device.c | 13 ++++++++++--- + dlls/d3d11/tests/d3d11.c | 6 +++--- + dlls/dxgi/factory.c | 2 +- + dlls/wined3d/state.c | 6 ++++++ + include/wine/wined3d.h | 1 + + 5 files changed, 21 insertions(+), 7 deletions(-) + +diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c +index 08a98626f28..4c46c9f235b 100644 +--- a/dlls/d3d11/device.c ++++ b/dlls/d3d11/device.c +@@ -1823,6 +1823,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_RSSetState(ID3D11DeviceCon + struct d3d_device *device = device_from_immediate_ID3D11DeviceContext(iface); + struct d3d_rasterizer_state *rasterizer_state_impl; + const D3D11_RASTERIZER_DESC *desc; ++ union {DWORD d; float f;} slope; + + TRACE("iface %p, rasterizer_state %p.\n", iface, rasterizer_state); + +@@ -1835,6 +1836,8 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_RSSetState(ID3D11DeviceCon + wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SCISSORTESTENABLE, FALSE); + wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_MULTISAMPLEANTIALIAS, FALSE); + wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_ANTIALIASEDLINEENABLE, FALSE); ++ wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DEPTHBIAS, 0); ++ wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SLOPESCALEDEPTHBIAS, 0); + wined3d_mutex_unlock(); + return; + } +@@ -1844,12 +1847,16 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_RSSetState(ID3D11DeviceCon + desc = &rasterizer_state_impl->desc; + wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_FILLMODE, desc->FillMode); + wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_CULLMODE, desc->CullMode); ++ + /* OpenGL style depth bias. */ +- if (desc->DepthBias || desc->SlopeScaledDepthBias) +- FIXME("Ignoring depth bias.\n"); +- /* GL_DEPTH_CLAMP */ ++ slope.f = desc->SlopeScaledDepthBias; ++ wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DEPTHBIAS, desc->DepthBias); ++ wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SLOPESCALEDEPTHBIAS, slope.d); ++ if (desc->DepthBiasClamp) ++ FIXME("Ignoring DepthBiasClamp %f.\n", desc->DepthBiasClamp); + if (!desc->DepthClipEnable) + FIXME("Ignoring DepthClipEnable %#x.\n", desc->DepthClipEnable); ++ + wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SCISSORTESTENABLE, desc->ScissorEnable); + wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_MULTISAMPLEANTIALIAS, desc->MultisampleEnable); + wined3d_device_set_render_state(device->wined3d_device, +diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c +index 7c9c8395315..b7b35ef8b85 100644 +--- a/dlls/d3d11/tests/d3d11.c ++++ b/dlls/d3d11/tests/d3d11.c +@@ -15687,7 +15687,7 @@ static void test_depth_separate(void) + draw_color_quad_depth(&test_context, &blue, 0.5f); + get_texture_readback(test_context.backbuffer, 0, &rb); + color = get_readback_color(&rb, 320, 240); +- todo_wine ok(compare_color(color, blue_d, 1), "Got unexpected color 0x%08x.\n", color); ++ ok(compare_color(color, blue_d, 1), "Got unexpected color 0x%08x.\n", color); + release_resource_readback(&rb); + ID3D11RasterizerState_Release(rs); + rs_desc.DepthBias = -100005; +@@ -15697,7 +15697,7 @@ static void test_depth_separate(void) + draw_color_quad_depth(&test_context, &white, 0.5f); + get_texture_readback(test_context.backbuffer, 0, &rb); + color = get_readback_color(&rb, 320, 240); +- todo_wine ok(compare_color(color, white_d, 1), "Got unexpected color 0x%08x.\n", color); ++ ok(compare_color(color, white_d, 1), "Got unexpected color 0x%08x.\n", color); + release_resource_readback(&rb); + ID3D11RasterizerState_Release(rs); + rs_desc.DepthBias = -99995; +@@ -15707,7 +15707,7 @@ static void test_depth_separate(void) + draw_color_quad_depth(&test_context, &green, 0.5f); + get_texture_readback(test_context.backbuffer, 0, &rb); + color = get_readback_color(&rb, 320, 240); +- todo_wine ok(compare_color(color, white_d, 1), "Got unexpected color 0x%08x.\n", color); ++ ok(compare_color(color, white_d, 1), "Got unexpected color 0x%08x.\n", color); + release_resource_readback(&rb); + + ID3D11DepthStencilState_Release(ds_state); +diff --git a/dlls/dxgi/factory.c b/dlls/dxgi/factory.c +index 662b0cf3745..c218276a220 100644 +--- a/dlls/dxgi/factory.c ++++ b/dlls/dxgi/factory.c +@@ -318,7 +318,7 @@ static HRESULT dxgi_factory_init(struct dxgi_factory *factory, BOOL extended) + wined3d_private_store_init(&factory->private_store); + + wined3d_mutex_lock(); +- factory->wined3d = wined3d_create(0); ++ factory->wined3d = wined3d_create(WINED3D_FORWARD_DEPTH_BIAS); + wined3d_mutex_unlock(); + if (!factory->wined3d) + { +diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c +index 950c4d511c3..5b43927fea5 100644 +--- a/dlls/wined3d/state.c ++++ b/dlls/wined3d/state.c +@@ -1726,6 +1726,7 @@ static void state_depthbias(struct wined3d_context *context, const struct wined3 + union + { + DWORD d; ++ INT i; + float f; + } scale_bias, const_bias; + +@@ -1741,6 +1742,11 @@ static void state_depthbias(struct wined3d_context *context, const struct wined3 + gl_info->gl_ops.gl.p_glPolygonOffset(bias, bias); + checkGLcall("glPolygonOffset"); + } ++ else if (context->d3d_info->wined3d_creation_flags & WINED3D_FORWARD_DEPTH_BIAS) ++ { ++ gl_info->gl_ops.gl.p_glPolygonOffset(scale_bias.f, const_bias.i); ++ checkGLcall("glPolygonOffset(...)"); ++ } + else + { + if (depth) +diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h +index 653c6a5a904..7491c49587a 100644 +--- a/include/wine/wined3d.h ++++ b/include/wine/wined3d.h +@@ -1310,6 +1310,7 @@ enum wined3d_shader_byte_code_format + #define WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR 0x00000400 + #define WINED3D_NO_PRIMITIVE_RESTART 0x00000800 + #define WINED3D_LEGACY_CUBEMAP_FILTERING 0x00001000 ++#define WINED3D_FORWARD_DEPTH_BIAS 0x00002000 + + #define WINED3D_RESZ_CODE 0x7fa05000 + +-- +2.13.1 + diff --git a/patches/d3d11-Depth_Bias/0004-d3d11-Add-support-for-SlopeScaledDepthBias-in-RSSetS.patch b/patches/d3d11-Depth_Bias/0004-d3d11-Add-support-for-SlopeScaledDepthBias-in-RSSetS.patch new file mode 100644 index 00000000..31b19842 --- /dev/null +++ b/patches/d3d11-Depth_Bias/0004-d3d11-Add-support-for-SlopeScaledDepthBias-in-RSSetS.patch @@ -0,0 +1,178 @@ +From b3431c46e215b3ef61955b5a8ed2456c4aaf78cf Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20M=C3=BCller?= +Date: Fri, 7 Jul 2017 06:10:01 +0200 +Subject: d3d11: Add support for SlopeScaledDepthBias in RSSetState. + +--- + dlls/d3d11/device.c | 4 ++-- + dlls/d3d11/tests/d3d11.c | 4 ++-- + dlls/wined3d/directx.c | 1 + + dlls/wined3d/state.c | 24 ++++++++++++++++++++++++ + dlls/wined3d/stateblock.c | 2 ++ + dlls/wined3d/utils.c | 1 + + dlls/wined3d/wined3d_gl.h | 1 + + include/wine/wined3d.h | 3 ++- + 8 files changed, 35 insertions(+), 5 deletions(-) + +diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c +index 4c46c9f235b..3860a768d0f 100644 +--- a/dlls/d3d11/device.c ++++ b/dlls/d3d11/device.c +@@ -1838,6 +1838,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_RSSetState(ID3D11DeviceCon + wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_ANTIALIASEDLINEENABLE, FALSE); + wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DEPTHBIAS, 0); + wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SLOPESCALEDEPTHBIAS, 0); ++ wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DEPTHCLIP, TRUE); + wined3d_mutex_unlock(); + return; + } +@@ -1852,10 +1853,9 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_RSSetState(ID3D11DeviceCon + slope.f = desc->SlopeScaledDepthBias; + wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DEPTHBIAS, desc->DepthBias); + wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SLOPESCALEDEPTHBIAS, slope.d); ++ wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DEPTHCLIP, (desc->DepthClipEnable != FALSE)); + if (desc->DepthBiasClamp) + FIXME("Ignoring DepthBiasClamp %f.\n", desc->DepthBiasClamp); +- if (!desc->DepthClipEnable) +- FIXME("Ignoring DepthClipEnable %#x.\n", desc->DepthClipEnable); + + wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SCISSORTESTENABLE, desc->ScissorEnable); + wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_MULTISAMPLEANTIALIAS, desc->MultisampleEnable); +diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c +index b7b35ef8b85..f15d4873ab1 100644 +--- a/dlls/d3d11/tests/d3d11.c ++++ b/dlls/d3d11/tests/d3d11.c +@@ -15663,7 +15663,7 @@ static void test_depth_separate(void) + draw_color_quad_depth(&test_context, &green, 1.1f); + get_texture_readback(test_context.backbuffer, 0, &rb); + color = get_readback_color(&rb, 320, 240); +- todo_wine ok(compare_color(color, green_d, 1), "Got unexpected color 0x%08x.\n", color); ++ ok(compare_color(color, green_d, 1), "Got unexpected color 0x%08x.\n", color); + release_resource_readback(&rb); + + ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, red); +@@ -15671,7 +15671,7 @@ static void test_depth_separate(void) + draw_color_quad_depth(&test_context, &green, -0.1f); + get_texture_readback(test_context.backbuffer, 0, &rb); + color = get_readback_color(&rb, 320, 240); +- todo_wine ok(compare_color(color, green_d, 1), "Got unexpected color 0x%08x.\n", color); ++ ok(compare_color(color, green_d, 1), "Got unexpected color 0x%08x.\n", color); + release_resource_readback(&rb); + + /* depth bias */ +diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c +index 01131ed8230..68d7e8cba0f 100644 +--- a/dlls/wined3d/directx.c ++++ b/dlls/wined3d/directx.c +@@ -118,6 +118,7 @@ static const struct wined3d_extension_map gl_extension_map[] = + {"GL_ARB_copy_buffer", ARB_COPY_BUFFER }, + {"GL_ARB_debug_output", ARB_DEBUG_OUTPUT }, + {"GL_ARB_depth_buffer_float", ARB_DEPTH_BUFFER_FLOAT }, ++ {"GL_ARB_depth_clamp", ARB_DEPTH_CLAMP }, + {"GL_ARB_depth_texture", ARB_DEPTH_TEXTURE }, + {"GL_ARB_derivative_control", ARB_DERIVATIVE_CONTROL }, + {"GL_ARB_draw_buffers", ARB_DRAW_BUFFERS }, +diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c +index 5b43927fea5..8b1729de2a3 100644 +--- a/dlls/wined3d/state.c ++++ b/dlls/wined3d/state.c +@@ -1777,6 +1777,28 @@ static void state_depthbias(struct wined3d_context *context, const struct wined3 + } + } + ++static void state_depthclip(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) ++{ ++ const struct wined3d_gl_info *gl_info = context->gl_info; ++ ++ if (state->render_states[WINED3D_RS_DEPTHCLIP]) ++ { ++ gl_info->gl_ops.gl.p_glDisable(GL_DEPTH_CLAMP); ++ checkGLcall("glDisable(GL_DEPTH_CLAMP)"); ++ } ++ else ++ { ++ gl_info->gl_ops.gl.p_glEnable(GL_DEPTH_CLAMP); ++ checkGLcall("glEnable(GL_DEPTH_CLAMP)"); ++ } ++} ++ ++static void state_depthclip_w(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) ++{ ++ if (!state->render_states[WINED3D_RS_DEPTHCLIP]) ++ FIXME("Depth clamping not supported by GL.\n"); ++} ++ + static void state_zvisible(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) + { + if (state->render_states[WINED3D_RS_ZVISIBLE]) +@@ -5220,6 +5242,8 @@ const struct StateEntryTemplate misc_state_template[] = + { STATE_RENDER(WINED3D_RS_BLENDFACTOR), { STATE_RENDER(WINED3D_RS_BLENDFACTOR), state_blendfactor_w }, WINED3D_GL_EXT_NONE }, + { STATE_RENDER(WINED3D_RS_DEPTHBIAS), { STATE_RENDER(WINED3D_RS_DEPTHBIAS), state_depthbias }, WINED3D_GL_EXT_NONE }, + { STATE_RENDER(WINED3D_RS_ZVISIBLE), { STATE_RENDER(WINED3D_RS_ZVISIBLE), state_zvisible }, WINED3D_GL_EXT_NONE }, ++ { STATE_RENDER(WINED3D_RS_DEPTHCLIP), { STATE_RENDER(WINED3D_RS_DEPTHCLIP), state_depthclip }, ARB_DEPTH_CLAMP }, ++ { STATE_RENDER(WINED3D_RS_DEPTHCLIP), { STATE_RENDER(WINED3D_RS_DEPTHCLIP), state_depthclip_w }, WINED3D_GL_EXT_NONE }, + /* Samplers */ + { STATE_SAMPLER(0), { STATE_SAMPLER(0), sampler }, WINED3D_GL_EXT_NONE }, + { STATE_SAMPLER(1), { STATE_SAMPLER(1), sampler }, WINED3D_GL_EXT_NONE }, +diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c +index 40ce7b37a70..e55e2b8abc3 100644 +--- a/dlls/wined3d/stateblock.c ++++ b/dlls/wined3d/stateblock.c +@@ -90,6 +90,7 @@ static const DWORD pixel_states_render[] = + WINED3D_RS_ZENABLE, + WINED3D_RS_ZFUNC, + WINED3D_RS_ZWRITEENABLE, ++ WINED3D_RS_DEPTHCLIP, + }; + + static const DWORD pixel_states_texture[] = +@@ -1243,6 +1244,7 @@ static void state_init_default(struct wined3d_state *state, const struct wined3d + state->render_states[WINED3D_RS_BLENDFACTOR] = 0xffffffff; + state->render_states[WINED3D_RS_SRGBWRITEENABLE] = 0; + state->render_states[WINED3D_RS_DEPTHBIAS] = 0; ++ state->render_states[WINED3D_RS_DEPTHCLIP] = TRUE; + state->render_states[WINED3D_RS_WRAP8] = 0; + state->render_states[WINED3D_RS_WRAP9] = 0; + state->render_states[WINED3D_RS_WRAP10] = 0; +diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c +index 77bfd81f73c..7462103aeee 100644 +--- a/dlls/wined3d/utils.c ++++ b/dlls/wined3d/utils.c +@@ -4291,6 +4291,7 @@ const char *debug_d3drenderstate(enum wined3d_render_state state) + D3DSTATE_TO_STR(WINED3D_RS_SRCBLENDALPHA); + D3DSTATE_TO_STR(WINED3D_RS_DESTBLENDALPHA); + D3DSTATE_TO_STR(WINED3D_RS_BLENDOPALPHA); ++ D3DSTATE_TO_STR(WINED3D_RS_DEPTHCLIP); + #undef D3DSTATE_TO_STR + default: + FIXME("Unrecognized %u render state!\n", state); +diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h +index 17d17a1be65..718213cca51 100644 +--- a/dlls/wined3d/wined3d_gl.h ++++ b/dlls/wined3d/wined3d_gl.h +@@ -52,6 +52,7 @@ enum wined3d_gl_extension + ARB_COPY_BUFFER, + ARB_DEBUG_OUTPUT, + ARB_DEPTH_BUFFER_FLOAT, ++ ARB_DEPTH_CLAMP, + ARB_DEPTH_TEXTURE, + ARB_DERIVATIVE_CONTROL, + ARB_DRAW_BUFFERS, +diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h +index 7491c49587a..90862d61535 100644 +--- a/include/wine/wined3d.h ++++ b/include/wine/wined3d.h +@@ -383,8 +383,9 @@ enum wined3d_render_state + WINED3D_RS_SRCBLENDALPHA = 207, + WINED3D_RS_DESTBLENDALPHA = 208, + WINED3D_RS_BLENDOPALPHA = 209, ++ WINED3D_RS_DEPTHCLIP = 210, + }; +-#define WINEHIGHEST_RENDER_STATE WINED3D_RS_BLENDOPALPHA ++#define WINEHIGHEST_RENDER_STATE WINED3D_RS_DEPTHCLIP + + enum wined3d_blend + { +-- +2.13.1 + diff --git a/patches/d3d11-Depth_Bias/definition b/patches/d3d11-Depth_Bias/definition new file mode 100644 index 00000000..f493a23c --- /dev/null +++ b/patches/d3d11-Depth_Bias/definition @@ -0,0 +1 @@ +Fixes: Implement support for more d3d11 depth options in RSSetState. diff --git a/patches/d3d11-Silence_FIXMEs/0002-d3d11-Silence-depth-bias-warning-in-ID3D11DeviceCont.patch b/patches/d3d11-Silence_FIXMEs/0002-d3d11-Silence-depth-bias-warning-in-ID3D11DeviceCont.patch deleted file mode 100644 index e094370b..00000000 --- a/patches/d3d11-Silence_FIXMEs/0002-d3d11-Silence-depth-bias-warning-in-ID3D11DeviceCont.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 67bf62879edea7ee4d6c6f7218c8fa6b92c66163 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Michael=20M=C3=BCller?= -Date: Sun, 28 May 2017 05:45:31 +0200 -Subject: d3d11: Silence depth bias warning in ID3D11DeviceContext_RSSetState. - ---- - dlls/d3d11/device.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c -index c78a4a755d8..14a0b98a32d 100644 ---- a/dlls/d3d11/device.c -+++ b/dlls/d3d11/device.c -@@ -1724,7 +1724,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_RSSetState(ID3D11DeviceCon - wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_CULLMODE, desc->CullMode); - /* OpenGL style depth bias. */ - if (desc->DepthBias || desc->SlopeScaledDepthBias) -- FIXME("Ignoring depth bias.\n"); -+ WARN("Ignoring depth bias.\n"); - /* GL_DEPTH_CLAMP */ - if (!desc->DepthClipEnable) - FIXME("Ignoring DepthClipEnable %#x.\n", desc->DepthClipEnable); --- -2.12.2 - diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 6ef187ac..48a2b148 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -113,6 +113,7 @@ patch_enable_all () enable_crypt32_SHA_OIDs="$1" enable_d3d10_1_Forwards="$1" enable_d3d11_Deferred_Context="$1" + enable_d3d11_Depth_Bias="$1" enable_d3d11_ID3D11Texture1D="$1" enable_d3d11_ResolveSubresource="$1" enable_d3d11_Silence_FIXMEs="$1" @@ -589,6 +590,9 @@ patch_enable () d3d11-Deferred_Context) enable_d3d11_Deferred_Context="$2" ;; + d3d11-Depth_Bias) + enable_d3d11_Depth_Bias="$2" + ;; d3d11-ID3D11Texture1D) enable_d3d11_ID3D11Texture1D="$2" ;; @@ -3450,6 +3454,25 @@ if test "$enable_d3d11_Deferred_Context" -eq 1; then ) >> "$patchlist" fi +# Patchset d3d11-Depth_Bias +# | +# | Modified files: +# | * dlls/d3d11/device.c, dlls/d3d11/tests/d3d11.c, dlls/dxgi/factory.c, dlls/wined3d/directx.c, dlls/wined3d/state.c, +# | dlls/wined3d/stateblock.c, dlls/wined3d/utils.c, dlls/wined3d/wined3d_gl.h, include/wine/wined3d.h +# | +if test "$enable_d3d11_Depth_Bias" -eq 1; then + patch_apply d3d11-Depth_Bias/0001-d3d11-tests-Don-t-use-draw_quad-in-test_cb_relative_.patch + patch_apply d3d11-Depth_Bias/0002-d3d11-tests-Add-some-basic-depth-tests.patch + patch_apply d3d11-Depth_Bias/0003-d3d11-Implement-depth-bias-and-slope.patch + patch_apply d3d11-Depth_Bias/0004-d3d11-Add-support-for-SlopeScaledDepthBias-in-RSSetS.patch + ( + printf '%s\n' '+ { "Michael Müller", "d3d11/tests: Don'\''t use draw_quad in test_cb_relative_addressing.", 1 },'; + printf '%s\n' '+ { "Michael Müller", "d3d11/tests: Add some basic depth tests.", 1 },'; + printf '%s\n' '+ { "Michael Müller", "d3d11: Implement depth bias and slope.", 1 },'; + printf '%s\n' '+ { "Michael Müller", "d3d11: Add support for SlopeScaledDepthBias in RSSetState.", 1 },'; + ) >> "$patchlist" +fi + # Patchset wined3d-1DTextures # | # | Modified files: @@ -3475,6 +3498,7 @@ if test "$enable_wined3d_1DTextures" -eq 1; then patch_apply wined3d-1DTextures/0014-wined3d-Handle-1d-textures-in-texture_activate_dimen.patch patch_apply wined3d-1DTextures/0015-wined3d-Allow-creation-of-1d-shader-views.patch patch_apply wined3d-1DTextures/0016-d3d11-Improve-ID3D11Device_CheckFormatSupport.patch + patch_apply wined3d-1DTextures/0017-d3d11-Allow-DXGI_FORMAT_UNKNOWN-in-CheckFormatSuppor.patch ( printf '%s\n' '+ { "Michael Müller", "wined3d: Create dummy 1d textures.", 1 },'; printf '%s\n' '+ { "Michael Müller", "wined3d: Add 1d texture resource type.", 1 },'; @@ -3492,6 +3516,7 @@ if test "$enable_wined3d_1DTextures" -eq 1; then printf '%s\n' '+ { "Michael Müller", "wined3d: Handle 1d textures in texture_activate_dimensions.", 1 },'; printf '%s\n' '+ { "Michael Müller", "wined3d: Allow creation of 1d shader views.", 1 },'; printf '%s\n' '+ { "Michael Müller", "d3d11: Improve ID3D11Device_CheckFormatSupport.", 1 },'; + printf '%s\n' '+ { "Michael Müller", "d3d11: Allow DXGI_FORMAT_UNKNOWN in CheckFormatSupport and improve tests.", 1 },'; ) >> "$patchlist" fi @@ -3575,10 +3600,8 @@ fi # | if test "$enable_d3d11_Silence_FIXMEs" -eq 1; then patch_apply d3d11-Silence_FIXMEs/0001-d3d11-Silence-ID3D11Device_GetDeviceRemovedReason.patch - patch_apply d3d11-Silence_FIXMEs/0002-d3d11-Silence-depth-bias-warning-in-ID3D11DeviceCont.patch ( printf '%s\n' '+ { "Michael Müller", "d3d11: Silence ID3D11Device_GetDeviceRemovedReason.", 1 },'; - printf '%s\n' '+ { "Michael Müller", "d3d11: Silence depth bias warning in ID3D11DeviceContext_RSSetState.", 1 },'; ) >> "$patchlist" fi diff --git a/patches/wined3d-1DTextures/0017-d3d11-Allow-DXGI_FORMAT_UNKNOWN-in-CheckFormatSuppor.patch b/patches/wined3d-1DTextures/0017-d3d11-Allow-DXGI_FORMAT_UNKNOWN-in-CheckFormatSuppor.patch new file mode 100644 index 00000000..7722ed3c --- /dev/null +++ b/patches/wined3d-1DTextures/0017-d3d11-Allow-DXGI_FORMAT_UNKNOWN-in-CheckFormatSuppor.patch @@ -0,0 +1,54 @@ +From 9d41dd847845cf31ca0f194c1418b03eb164cf37 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20M=C3=BCller?= +Date: Fri, 7 Jul 2017 04:03:19 +0200 +Subject: d3d11: Allow DXGI_FORMAT_UNKNOWN in CheckFormatSupport and improve + tests. + +--- + dlls/d3d11/device.c | 2 +- + dlls/d3d11/tests/d3d11.c | 6 ++---- + 2 files changed, 3 insertions(+), 5 deletions(-) + +diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c +index 8642bf50fb1..3b7d55828a5 100644 +--- a/dlls/d3d11/device.c ++++ b/dlls/d3d11/device.c +@@ -5567,7 +5567,7 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CheckFormatSupport(ID3D11Device *i + FIXME("iface %p, format %u, format_support %p partial-stub!\n", iface, format, format_support); + + wined3d_format = wined3dformat_from_dxgi_format(format); +- if ((format && !wined3d_format) || wined3d_format == WINED3DFMT_UNKNOWN) ++ if (format && !wined3d_format) + { + WARN("Invalid format %#x.\n", format); + *format_support = 0; +diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c +index c8c9037fced..241320d0a74 100644 +--- a/dlls/d3d11/tests/d3d11.c ++++ b/dlls/d3d11/tests/d3d11.c +@@ -14744,7 +14744,7 @@ static void check_format_support(const unsigned int *format_support, D3D_FEATURE + + static void test_required_format_support(const D3D_FEATURE_LEVEL feature_level) + { +- static const UINT expected = D3D11_FORMAT_SUPPORT_IA_VERTEX_BUFFER | ++ UINT expected = D3D11_FORMAT_SUPPORT_IA_VERTEX_BUFFER | + D3D11_FORMAT_SUPPORT_TEXTURE1D | D3D11_FORMAT_SUPPORT_TEXTURE2D | + D3D11_FORMAT_SUPPORT_TEXTURE3D | D3D11_FORMAT_SUPPORT_TEXTURECUBE | + D3D11_FORMAT_SUPPORT_MIP | D3D11_FORMAT_SUPPORT_MIP_AUTOGEN | +@@ -14787,12 +14787,10 @@ static void test_required_format_support(const D3D_FEATURE_LEVEL feature_level) + ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %#x.\n", hr); + } + +- hr = ID3D11Device_CheckFormatSupport(device, DXGI_FORMAT_UNKNOWN, &support); +- ok(hr == E_FAIL, "Expected E_FAIL, got %#x.\n", hr); +- + hr = ID3D11Device_CheckFormatSupport(device, 0xdeadbeef, &support); + ok(hr == E_FAIL, "Expected E_FAIL, got %#x.\n", hr); + ++ if (feature_level < D3D_FEATURE_LEVEL_10_0) expected &= ~D3D11_FORMAT_SUPPORT_TEXTURE1D; + hr = ID3D11Device_CheckFormatSupport(device, DXGI_FORMAT_R8G8B8A8_UNORM, &support); + ok(hr == S_OK, "Expected S_OK, got %#x.\n", hr); + ok((support & expected) == expected, "Expected the following features to be supported: %#x.\n", +-- +2.13.1 +