diff --git a/patches/d3d11-shader-count/0001-d3d11-Test-shader-class-instance-count.patch b/patches/d3d11-shader-count/0001-d3d11-Test-shader-class-instance-count.patch new file mode 100644 index 00000000..22c0671a --- /dev/null +++ b/patches/d3d11-shader-count/0001-d3d11-Test-shader-class-instance-count.patch @@ -0,0 +1,106 @@ +From 27b806367185176be74cd3f2d7a733389e2925b9 Mon Sep 17 00:00:00 2001 +From: Lucian Poston +Date: Thu, 23 Nov 2017 09:50:41 -0800 +Subject: [PATCH 1/2] d3d11: Test shader class instance count + +https://bugs.winehq.org/show_bug.cgi?id=44052 + +Signed-off-by: Lucian Poston +--- + dlls/d3d11/tests/d3d11.c | 32 +++++++++++++++++++++++++------- + 1 file changed, 25 insertions(+), 7 deletions(-) + +diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c +index 63f964a..1345b0e 100644 +--- a/dlls/d3d11/tests/d3d11.c ++++ b/dlls/d3d11/tests/d3d11.c +@@ -9688,7 +9688,7 @@ static void test_clear_state(void) + UINT sample_mask; + UINT stencil_ref; + ULONG refcount; +- UINT count, i; ++ UINT count, i, instance_count; + HRESULT hr; + + device_desc.feature_level = &feature_level; +@@ -9719,8 +9719,11 @@ static void test_clear_state(void) + { + ok(!tmp_sampler[i], "Got unexpected sampler %p in slot %u.\n", tmp_sampler[i], i); + } +- ID3D11DeviceContext_VSGetShader(context, &tmp_vs, NULL, 0); ++ instance_count = 100; ++ ID3D11DeviceContext_VSGetShader(context, &tmp_vs, NULL, &instance_count); + ok(!tmp_vs, "Got unexpected vertex shader %p.\n", tmp_vs); ++ todo_wine ++ ok(instance_count == 0, "Expected 0 instances, got %u.\n", instance_count); + + ID3D11DeviceContext_HSGetConstantBuffers(context, 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, + tmp_buffer); +@@ -9738,8 +9741,11 @@ static void test_clear_state(void) + { + ok(!tmp_sampler[i], "Got unexpected sampler %p in slot %u.\n", tmp_sampler[i], i); + } +- ID3D11DeviceContext_HSGetShader(context, &tmp_hs, NULL, 0); ++ instance_count = 100; ++ ID3D11DeviceContext_HSGetShader(context, &tmp_hs, NULL, &instance_count); + ok(!tmp_hs, "Got unexpected hull shader %p.\n", tmp_hs); ++ todo_wine ++ ok(instance_count == 0, "Expected 0 instances, got %u.\n", instance_count); + + ID3D11DeviceContext_DSGetConstantBuffers(context, 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, + tmp_buffer); +@@ -9757,8 +9763,11 @@ static void test_clear_state(void) + { + ok(!tmp_sampler[i], "Got unexpected sampler %p in slot %u.\n", tmp_sampler[i], i); + } +- ID3D11DeviceContext_DSGetShader(context, &tmp_ds, NULL, 0); ++ instance_count = 100; ++ ID3D11DeviceContext_DSGetShader(context, &tmp_ds, NULL, &instance_count); + ok(!tmp_ds, "Got unexpected domain shader %p.\n", tmp_ds); ++ todo_wine ++ ok(instance_count == 0, "Expected 0 instances, got %u.\n", instance_count); + + ID3D11DeviceContext_GSGetConstantBuffers(context, 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, + tmp_buffer); +@@ -9776,8 +9785,11 @@ static void test_clear_state(void) + { + ok(!tmp_sampler[i], "Got unexpected sampler %p in slot %u.\n", tmp_sampler[i], i); + } +- ID3D11DeviceContext_GSGetShader(context, &tmp_gs, NULL, 0); ++ instance_count = 100; ++ ID3D11DeviceContext_GSGetShader(context, &tmp_gs, NULL, &instance_count); + ok(!tmp_gs, "Got unexpected geometry shader %p.\n", tmp_gs); ++ todo_wine ++ ok(instance_count == 0, "Expected 0 instances, got %u.\n", instance_count); + + ID3D11DeviceContext_PSGetConstantBuffers(context, 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, + tmp_buffer); +@@ -9796,8 +9808,11 @@ static void test_clear_state(void) + { + ok(!tmp_sampler[i], "Got unexpected sampler %p in slot %u.\n", tmp_sampler[i], i); + } +- ID3D11DeviceContext_PSGetShader(context, &tmp_ps, NULL, 0); ++ instance_count = 100; ++ ID3D11DeviceContext_PSGetShader(context, &tmp_ps, NULL, &instance_count); + ok(!tmp_ps, "Got unexpected pixel shader %p.\n", tmp_ps); ++ todo_wine ++ ok(instance_count == 0, "Expected 0 instances, got %u.\n", instance_count); + + ID3D11DeviceContext_CSGetConstantBuffers(context, 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, + tmp_buffer); +@@ -9816,8 +9831,11 @@ static void test_clear_state(void) + { + ok(!tmp_sampler[i], "Got unexpected sampler %p in slot %u.\n", tmp_sampler[i], i); + } +- ID3D11DeviceContext_CSGetShader(context, &tmp_cs, NULL, 0); ++ instance_count = 100; ++ ID3D11DeviceContext_CSGetShader(context, &tmp_cs, NULL, &instance_count); + ok(!tmp_cs, "Got unexpected compute shader %p.\n", tmp_cs); ++ todo_wine ++ ok(instance_count == 0, "Expected 0 instances, got %u.\n", instance_count); + ID3D11DeviceContext_CSGetUnorderedAccessViews(context, 0, D3D11_PS_CS_UAV_REGISTER_COUNT, tmp_uav); + for (i = 0; i < D3D11_PS_CS_UAV_REGISTER_COUNT; ++i) + { +-- +1.9.1 + diff --git a/patches/d3d11-shader-count/0002-d3d11-Return-valid-values-for-shader-class-instances.patch b/patches/d3d11-shader-count/0002-d3d11-Return-valid-values-for-shader-class-instances.patch new file mode 100644 index 00000000..266017dd --- /dev/null +++ b/patches/d3d11-shader-count/0002-d3d11-Return-valid-values-for-shader-class-instances.patch @@ -0,0 +1,129 @@ +From 56048495ec1b1a6d986b9d1ff74a5d541f67ce65 Mon Sep 17 00:00:00 2001 +From: Lucian Poston +Date: Sat, 18 Nov 2017 21:46:35 -0800 +Subject: [PATCH 2/2] d3d11: Return valid values for shader class instances + +Instead of returning garbage data for class instances, return 0 class +instances. + +https://bugs.winehq.org/show_bug.cgi?id=44052 + +Signed-off-by: Lucian Poston +--- + dlls/d3d11/device.c | 12 ++++++++++++ + dlls/d3d11/tests/d3d11.c | 6 ------ + 2 files changed, 12 insertions(+), 6 deletions(-) + +diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c +index 18fa670..f859e0f 100644 +--- a/dlls/d3d11/device.c ++++ b/dlls/d3d11/device.c +@@ -1522,6 +1522,8 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_PSGetShader(ID3D11DeviceCo + + if (class_instances || class_instance_count) + FIXME("Dynamic linking not implemented yet.\n"); ++ if (class_instance_count) ++ *class_instance_count = 0; + + wined3d_mutex_lock(); + if (!(wined3d_shader = wined3d_device_get_pixel_shader(device->wined3d_device))) +@@ -1577,6 +1579,8 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_VSGetShader(ID3D11DeviceCo + + if (class_instances || class_instance_count) + FIXME("Dynamic linking not implemented yet.\n"); ++ if (class_instance_count) ++ *class_instance_count = 0; + + wined3d_mutex_lock(); + if (!(wined3d_shader = wined3d_device_get_vertex_shader(device->wined3d_device))) +@@ -1745,6 +1749,8 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_GSGetShader(ID3D11DeviceCo + + if (class_instances || class_instance_count) + FIXME("Dynamic linking not implemented yet.\n"); ++ if (class_instance_count) ++ *class_instance_count = 0; + + wined3d_mutex_lock(); + if (!(wined3d_shader = wined3d_device_get_geometry_shader(device->wined3d_device))) +@@ -2187,6 +2193,8 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_HSGetShader(ID3D11DeviceCo + + if (class_instances || class_instance_count) + FIXME("Dynamic linking not implemented yet.\n"); ++ if (class_instance_count) ++ *class_instance_count = 0; + + wined3d_mutex_lock(); + if (!(wined3d_shader = wined3d_device_get_hull_shader(device->wined3d_device))) +@@ -2294,6 +2302,8 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_DSGetShader(ID3D11DeviceCo + + if (class_instances || class_instance_count) + FIXME("Dynamic linking not implemented yet.\n"); ++ if (class_instance_count) ++ *class_instance_count = 0; + + wined3d_mutex_lock(); + if (!(wined3d_shader = wined3d_device_get_domain_shader(device->wined3d_device))) +@@ -2426,6 +2436,8 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_CSGetShader(ID3D11DeviceCo + + if (class_instances || class_instance_count) + FIXME("Dynamic linking not implemented yet.\n"); ++ if (class_instance_count) ++ *class_instance_count = 0; + + wined3d_mutex_lock(); + if (!(wined3d_shader = wined3d_device_get_compute_shader(device->wined3d_device))) +diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c +index 1345b0e..72ca70f 100644 +--- a/dlls/d3d11/tests/d3d11.c ++++ b/dlls/d3d11/tests/d3d11.c +@@ -9722,7 +9722,6 @@ static void test_clear_state(void) + instance_count = 100; + ID3D11DeviceContext_VSGetShader(context, &tmp_vs, NULL, &instance_count); + ok(!tmp_vs, "Got unexpected vertex shader %p.\n", tmp_vs); +- todo_wine + ok(instance_count == 0, "Expected 0 instances, got %u.\n", instance_count); + + ID3D11DeviceContext_HSGetConstantBuffers(context, 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, +@@ -9744,7 +9743,6 @@ static void test_clear_state(void) + instance_count = 100; + ID3D11DeviceContext_HSGetShader(context, &tmp_hs, NULL, &instance_count); + ok(!tmp_hs, "Got unexpected hull shader %p.\n", tmp_hs); +- todo_wine + ok(instance_count == 0, "Expected 0 instances, got %u.\n", instance_count); + + ID3D11DeviceContext_DSGetConstantBuffers(context, 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, +@@ -9766,7 +9764,6 @@ static void test_clear_state(void) + instance_count = 100; + ID3D11DeviceContext_DSGetShader(context, &tmp_ds, NULL, &instance_count); + ok(!tmp_ds, "Got unexpected domain shader %p.\n", tmp_ds); +- todo_wine + ok(instance_count == 0, "Expected 0 instances, got %u.\n", instance_count); + + ID3D11DeviceContext_GSGetConstantBuffers(context, 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, +@@ -9788,7 +9785,6 @@ static void test_clear_state(void) + instance_count = 100; + ID3D11DeviceContext_GSGetShader(context, &tmp_gs, NULL, &instance_count); + ok(!tmp_gs, "Got unexpected geometry shader %p.\n", tmp_gs); +- todo_wine + ok(instance_count == 0, "Expected 0 instances, got %u.\n", instance_count); + + ID3D11DeviceContext_PSGetConstantBuffers(context, 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, +@@ -9811,7 +9807,6 @@ static void test_clear_state(void) + instance_count = 100; + ID3D11DeviceContext_PSGetShader(context, &tmp_ps, NULL, &instance_count); + ok(!tmp_ps, "Got unexpected pixel shader %p.\n", tmp_ps); +- todo_wine + ok(instance_count == 0, "Expected 0 instances, got %u.\n", instance_count); + + ID3D11DeviceContext_CSGetConstantBuffers(context, 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, +@@ -9834,7 +9829,6 @@ static void test_clear_state(void) + instance_count = 100; + ID3D11DeviceContext_CSGetShader(context, &tmp_cs, NULL, &instance_count); + ok(!tmp_cs, "Got unexpected compute shader %p.\n", tmp_cs); +- todo_wine + ok(instance_count == 0, "Expected 0 instances, got %u.\n", instance_count); + ID3D11DeviceContext_CSGetUnorderedAccessViews(context, 0, D3D11_PS_CS_UAV_REGISTER_COUNT, tmp_uav); + for (i = 0; i < D3D11_PS_CS_UAV_REGISTER_COUNT; ++i) +-- +1.9.1 + diff --git a/patches/d3d11-shader-count/definition b/patches/d3d11-shader-count/definition new file mode 100644 index 00000000..9e145725 --- /dev/null +++ b/patches/d3d11-shader-count/definition @@ -0,0 +1 @@ +Fixes: [44052] - Return a valid valud for shader count. diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 92bd08cc..f490451f 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -111,6 +111,7 @@ patch_enable_all () enable_d2d1_ID2D1Factory1="$1" enable_d3d11_Deferred_Context="$1" enable_d3d11_Depth_Bias="$1" + enable_d3d11_shader_count="$1" enable_d3d8_ValidateShader="$1" enable_d3d9_DesktopWindow="$1" enable_d3d9_Tests="$1" @@ -521,6 +522,9 @@ patch_enable () d3d11-Depth_Bias) enable_d3d11_Depth_Bias="$2" ;; + d3d11-shader-count) + enable_d3d11_shader_count="$2" + ;; d3d8-ValidateShader) enable_d3d8_ValidateShader="$2" ;; @@ -3227,6 +3231,23 @@ if test "$enable_d3d11_Depth_Bias" -eq 1; then ) >> "$patchlist" fi +# Patchset d3d11-shader-count +# | +# | This patchset fixes the following Wine bugs: +# | * [#44052] - Return a valid valud for shader count. +# | +# | Modified files: +# | * dlls/d3d11/device.c, dlls/d3d11/tests/d3d11.c +# | +if test "$enable_d3d11_shader_count" -eq 1; then + patch_apply d3d11-shader-count/0001-d3d11-Test-shader-class-instance-count.patch + patch_apply d3d11-shader-count/0002-d3d11-Return-valid-values-for-shader-class-instances.patch + ( + printf '%s\n' '+ { "Lucian Poston", "d3d11: Test shader class instance count.", 1 },'; + printf '%s\n' '+ { "Lucian Poston", "d3d11: Return valid values for shader class instances.", 1 },'; + ) >> "$patchlist" +fi + # Patchset d3d8-ValidateShader # | # | This patchset fixes the following Wine bugs: