diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 6fd09830..37083850 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -451,6 +451,7 @@ patch_enable_all () enable_wined3d_DrawIndirect="$1" enable_wined3d_Dual_Source_Blending="$1" enable_wined3d_GTX_560M="$1" + enable_wined3d_GenerateMips="$1" enable_wined3d_Indexed_Vertex_Blending="$1" enable_wined3d_Interpolation_Modifiers="$1" enable_wined3d_Limit_Vram="$1" @@ -1629,6 +1630,9 @@ patch_enable () wined3d-GTX_560M) enable_wined3d_GTX_560M="$2" ;; + wined3d-GenerateMips) + enable_wined3d_GenerateMips="$2" + ;; wined3d-Indexed_Vertex_Blending) enable_wined3d_Indexed_Vertex_Blending="$2" ;; @@ -2221,13 +2225,6 @@ if test "$enable_wined3d_CSMT_Main" -eq 1; then enable_wined3d_CSMT_Helper=1 fi -if test "$enable_wined3d_Interpolation_Modifiers" -eq 1; then - if test "$enable_wined3d_Dual_Source_Blending" -gt 1; then - abort "Patchset wined3d-Dual_Source_Blending disabled, but wined3d-Interpolation_Modifiers depends on that." - fi - enable_wined3d_Dual_Source_Blending=1 -fi - if test "$enable_wined3d_Indexed_Vertex_Blending" -eq 1; then if test "$enable_wined3d_DrawIndirect" -gt 1; then abort "Patchset wined3d-DrawIndirect disabled, but wined3d-Indexed_Vertex_Blending depends on that." @@ -2281,6 +2278,9 @@ if test "$enable_wined3d_CSMT_Helper" -eq 1; then if test "$enable_wined3d_Dual_Source_Blending" -gt 1; then abort "Patchset wined3d-Dual_Source_Blending disabled, but wined3d-CSMT_Helper depends on that." fi + if test "$enable_wined3d_GenerateMips" -gt 1; then + abort "Patchset wined3d-GenerateMips disabled, but wined3d-CSMT_Helper depends on that." + fi if test "$enable_wined3d_QUERY_Stubs" -gt 1; then abort "Patchset wined3d-QUERY_Stubs disabled, but wined3d-CSMT_Helper depends on that." fi @@ -2302,12 +2302,31 @@ if test "$enable_wined3d_CSMT_Helper" -eq 1; then enable_wined3d_Copy_Resource_Typeless=1 enable_wined3d_DXTn=1 enable_wined3d_Dual_Source_Blending=1 + enable_wined3d_GenerateMips=1 enable_wined3d_QUERY_Stubs=1 enable_wined3d_Revert_Buffer_Upload=1 enable_wined3d_Silence_FIXMEs=1 enable_wined3d_UAV_Counters=1 fi +if test "$enable_wined3d_GenerateMips" -eq 1; then + if test "$enable_wined3d_Copy_Resource_Typeless" -gt 1; then + abort "Patchset wined3d-Copy_Resource_Typeless disabled, but wined3d-GenerateMips depends on that." + fi + if test "$enable_wined3d_Interpolation_Modifiers" -gt 1; then + abort "Patchset wined3d-Interpolation_Modifiers disabled, but wined3d-GenerateMips depends on that." + fi + enable_wined3d_Copy_Resource_Typeless=1 + enable_wined3d_Interpolation_Modifiers=1 +fi + +if test "$enable_wined3d_Interpolation_Modifiers" -eq 1; then + if test "$enable_wined3d_Dual_Source_Blending" -gt 1; then + abort "Patchset wined3d-Dual_Source_Blending disabled, but wined3d-Interpolation_Modifiers depends on that." + fi + enable_wined3d_Dual_Source_Blending=1 +fi + if test "$enable_wined3d_Dual_Source_Blending" -eq 1; then if test "$enable_wined3d_Viewports" -gt 1; then abort "Patchset wined3d-Viewports disabled, but wined3d-Dual_Source_Blending depends on that." @@ -9612,6 +9631,47 @@ if test "$enable_wined3d_Dual_Source_Blending" -eq 1; then ) >> "$patchlist" fi +# Patchset wined3d-Interpolation_Modifiers +# | +# | This patchset has the following (direct or indirect) dependencies: +# | * d3d11-Depth_Bias, wined3d-Core_Context, wined3d-Viewports, wined3d-Dual_Source_Blending +# | +# | This patchset fixes the following Wine bugs: +# | * [#43239] Implement support for interpolation modifiers in sm4/sm5 pixel shaders +# | +# | Modified files: +# | * dlls/d3d11/tests/d3d11.c, dlls/wined3d/glsl_shader.c, dlls/wined3d/shader.c, dlls/wined3d/wined3d_private.h +# | +if test "$enable_wined3d_Interpolation_Modifiers" -eq 1; then + patch_apply wined3d-Interpolation_Modifiers/0001-d3d11-tests-Add-test-for-nointerpolation-modifier.patch + patch_apply wined3d-Interpolation_Modifiers/0002-wined3d-Unroll-vertex-geometry-shader-outputs-and-pi.patch + patch_apply wined3d-Interpolation_Modifiers/0003-wined3d-Add-support-for-interpolation-modifiers-in-s.patch + ( + printf '%s\n' '+ { "Michael Müller", "d3d11/tests: Add test for nointerpolation modifier.", 1 },'; + printf '%s\n' '+ { "Józef Kucia", "wined3d: Unroll vertex / geometry shader outputs and pixel shader inputs for >= sm4.", 1 },'; + printf '%s\n' '+ { "Józef Kucia", "wined3d: Add support for interpolation modifiers in sm4/sm5 pixel shader inputs.", 1 },'; + ) >> "$patchlist" +fi + +# Patchset wined3d-GenerateMips +# | +# | This patchset has the following (direct or indirect) dependencies: +# | * d3d11-Depth_Bias, wined3d-1DTextures, wined3d-Copy_Resource_Typeless, wined3d-Core_Context, wined3d-Viewports, wined3d- +# | Dual_Source_Blending, wined3d-Interpolation_Modifiers +# | +# | Modified files: +# | * dlls/d3d11/device.c, dlls/d3d11/tests/d3d11.c, dlls/wined3d/cs.c, dlls/wined3d/device.c, dlls/wined3d/texture.c, +# | dlls/wined3d/wined3d.spec, dlls/wined3d/wined3d_private.h, include/wine/wined3d.h +# | +if test "$enable_wined3d_GenerateMips" -eq 1; then + patch_apply wined3d-GenerateMips/0001-d3d11-tests-Add-basic-test-for-mipmap-level-generati.patch + patch_apply wined3d-GenerateMips/0002-wined3d-Implement-generation-of-mip-maps-for-shader-.patch + ( + printf '%s\n' '+ { "Michael Müller", "d3d11/tests: Add basic test for mipmap level generation.", 1 },'; + printf '%s\n' '+ { "Michael Müller", "wined3d: Implement generation of mip maps for shader resource views.", 1 },'; + ) >> "$patchlist" +fi + # Patchset wined3d-QUERY_Stubs # | # | This patchset fixes the following Wine bugs: @@ -9675,7 +9735,8 @@ fi # | * d3d11-Deferred_Context, d3d9-Tests, makedep-PARENTSPEC, ntdll-Attach_Process_DLLs, ntdll-DllOverrides_WOW64, ntdll- # | Loader_Machine_Type, ntdll-DllRedirects, wined3d-1DTextures, wined3d-Accounting, d3d11-Depth_Bias, wined3d- # | Copy_Resource_Typeless, wined3d-DXTn, wined3d-Core_Context, wined3d-Viewports, wined3d-Dual_Source_Blending, wined3d- -# | QUERY_Stubs, wined3d-Revert_Buffer_Upload, wined3d-Silence_FIXMEs, wined3d-UAV_Counters +# | Interpolation_Modifiers, wined3d-GenerateMips, wined3d-QUERY_Stubs, wined3d-Revert_Buffer_Upload, wined3d- +# | Silence_FIXMEs, wined3d-UAV_Counters # | # | Modified files: # | * configure.ac, dlls/wined3d-csmt/Makefile.in, dlls/wined3d-csmt/version.rc @@ -9791,28 +9852,6 @@ if test "$enable_wined3d_Indexed_Vertex_Blending" -eq 1; then ) >> "$patchlist" fi -# Patchset wined3d-Interpolation_Modifiers -# | -# | This patchset has the following (direct or indirect) dependencies: -# | * d3d11-Depth_Bias, wined3d-Core_Context, wined3d-Viewports, wined3d-Dual_Source_Blending -# | -# | This patchset fixes the following Wine bugs: -# | * [#43239] Implement support for interpolation modifiers in sm4/sm5 pixel shaders -# | -# | Modified files: -# | * dlls/d3d11/tests/d3d11.c, dlls/wined3d/glsl_shader.c, dlls/wined3d/shader.c, dlls/wined3d/wined3d_private.h -# | -if test "$enable_wined3d_Interpolation_Modifiers" -eq 1; then - patch_apply wined3d-Interpolation_Modifiers/0001-d3d11-tests-Add-test-for-nointerpolation-modifier.patch - patch_apply wined3d-Interpolation_Modifiers/0002-wined3d-Unroll-vertex-geometry-shader-outputs-and-pi.patch - patch_apply wined3d-Interpolation_Modifiers/0003-wined3d-Add-support-for-interpolation-modifiers-in-s.patch - ( - printf '%s\n' '+ { "Michael Müller", "d3d11/tests: Add test for nointerpolation modifier.", 1 },'; - printf '%s\n' '+ { "Józef Kucia", "wined3d: Unroll vertex / geometry shader outputs and pixel shader inputs for >= sm4.", 1 },'; - printf '%s\n' '+ { "Józef Kucia", "wined3d: Add support for interpolation modifiers in sm4/sm5 pixel shader inputs.", 1 },'; - ) >> "$patchlist" -fi - # Patchset wined3d-Limit_Vram # | # | Modified files: @@ -9902,7 +9941,8 @@ fi # | * d3d11-Deferred_Context, d3d9-Tests, makedep-PARENTSPEC, ntdll-Attach_Process_DLLs, ntdll-DllOverrides_WOW64, ntdll- # | Loader_Machine_Type, ntdll-DllRedirects, wined3d-1DTextures, wined3d-Accounting, d3d11-Depth_Bias, wined3d- # | Copy_Resource_Typeless, wined3d-DXTn, wined3d-Core_Context, wined3d-Viewports, wined3d-Dual_Source_Blending, wined3d- -# | QUERY_Stubs, wined3d-Revert_Buffer_Upload, wined3d-Silence_FIXMEs, wined3d-UAV_Counters, wined3d-CSMT_Helper +# | Interpolation_Modifiers, wined3d-GenerateMips, wined3d-QUERY_Stubs, wined3d-Revert_Buffer_Upload, wined3d- +# | Silence_FIXMEs, wined3d-UAV_Counters, wined3d-CSMT_Helper # | # | This patchset fixes the following Wine bugs: # | * [#11674] Support for CSMT (command stream) to increase graphic performance diff --git a/patches/wined3d-CSMT_Helper/definition b/patches/wined3d-CSMT_Helper/definition index 6000b4fe..106dee3f 100644 --- a/patches/wined3d-CSMT_Helper/definition +++ b/patches/wined3d-CSMT_Helper/definition @@ -7,6 +7,7 @@ Depends: wined3d-Revert_Buffer_Upload Depends: wined3d-Copy_Resource_Typeless Depends: wined3d-UAV_Counters Depends: wined3d-Dual_Source_Blending +Depends: wined3d-GenerateMips Depends: d3d9-Tests Depends: d3d11-Deferred_Context Depends: makedep-PARENTSPEC diff --git a/patches/wined3d-CSMT_Main/0045-wined3d-Improve-wined3d_cs_emit_update_sub_resource.patch b/patches/wined3d-CSMT_Main/0045-wined3d-Improve-wined3d_cs_emit_update_sub_resource.patch index 110575a8..bdb0b92b 100644 --- a/patches/wined3d-CSMT_Main/0045-wined3d-Improve-wined3d_cs_emit_update_sub_resource.patch +++ b/patches/wined3d-CSMT_Main/0045-wined3d-Improve-wined3d_cs_emit_update_sub_resource.patch @@ -1,4 +1,4 @@ -From c75bb981aac00d8530bf9d38dc7c433370105d9c Mon Sep 17 00:00:00 2001 +From 5fee2758c87e6f98fa85f0fb17d9a576cb138072 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Mon, 20 Feb 2017 00:27:25 +0100 Subject: wined3d: Improve wined3d_cs_emit_update_sub_resource. @@ -10,10 +10,10 @@ Subject: wined3d: Improve wined3d_cs_emit_update_sub_resource. 3 files changed, 75 insertions(+), 4 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index dbe80c8306e..fd0a5c1d99a 100644 +index 70fb19382ea..0625af39e74 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -398,6 +398,7 @@ struct wined3d_cs_update_sub_resource +@@ -399,6 +399,7 @@ struct wined3d_cs_update_sub_resource unsigned int sub_resource_idx; struct wined3d_box box; struct wined3d_sub_resource_data data; @@ -21,7 +21,7 @@ index dbe80c8306e..fd0a5c1d99a 100644 }; struct wined3d_cs_add_dirty_texture_region -@@ -2241,6 +2242,51 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r +@@ -2252,6 +2253,51 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r unsigned int slice_pitch) { struct wined3d_cs_update_sub_resource *op; @@ -73,7 +73,7 @@ index dbe80c8306e..fd0a5c1d99a 100644 op = cs->ops->require_space(cs, sizeof(*op), WINED3D_CS_QUEUE_MAP); op->opcode = WINED3D_CS_OP_UPDATE_SUB_RESOURCE; -@@ -2254,8 +2300,6 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r +@@ -2265,8 +2311,6 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r wined3d_resource_acquire(resource); cs->ops->submit(cs, WINED3D_CS_QUEUE_MAP); @@ -82,8 +82,8 @@ index dbe80c8306e..fd0a5c1d99a 100644 cs->ops->finish(cs, WINED3D_CS_QUEUE_MAP); } -@@ -2557,6 +2601,11 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_COPY_SUB_RESOURCE */ wined3d_cs_exec_copy_sub_resource, +@@ -2645,6 +2689,11 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void + /* WINED3D_CS_OP_GENERATE_MIPS */ wined3d_cs_exec_generate_mips, }; +static BOOL wined3d_cs_st_check_space(struct wined3d_cs *cs, size_t size, enum wined3d_cs_queue_id queue_id) @@ -94,7 +94,7 @@ index dbe80c8306e..fd0a5c1d99a 100644 static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size, enum wined3d_cs_queue_id queue_id) { if (size > (cs->data_size - cs->end)) -@@ -2610,6 +2659,7 @@ static void wined3d_cs_st_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id +@@ -2698,6 +2747,7 @@ static void wined3d_cs_st_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id static const struct wined3d_cs_ops wined3d_cs_st_ops = { @@ -102,7 +102,7 @@ index dbe80c8306e..fd0a5c1d99a 100644 wined3d_cs_st_require_space, wined3d_cs_st_submit, wined3d_cs_st_finish, -@@ -2642,6 +2692,19 @@ static void wined3d_cs_mt_submit(struct wined3d_cs *cs, enum wined3d_cs_queue_id +@@ -2731,6 +2781,19 @@ static void wined3d_cs_mt_submit(struct wined3d_cs *cs, enum wined3d_cs_queue_id wined3d_cs_queue_submit(&cs->queue[queue_id], cs); } @@ -122,7 +122,7 @@ index dbe80c8306e..fd0a5c1d99a 100644 static void *wined3d_cs_queue_require_space(struct wined3d_cs_queue *queue, size_t size, struct wined3d_cs *cs) { size_t queue_size = ARRAY_SIZE(queue->data); -@@ -2703,6 +2766,14 @@ static void *wined3d_cs_queue_require_space(struct wined3d_cs_queue *queue, size +@@ -2792,6 +2855,14 @@ static void *wined3d_cs_queue_require_space(struct wined3d_cs_queue *queue, size return packet->data; } @@ -137,7 +137,7 @@ index dbe80c8306e..fd0a5c1d99a 100644 static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, enum wined3d_cs_queue_id queue_id) { if (cs->thread_id == GetCurrentThreadId()) -@@ -2722,6 +2793,7 @@ static void wined3d_cs_mt_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id +@@ -2811,6 +2882,7 @@ static void wined3d_cs_mt_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id static const struct wined3d_cs_ops wined3d_cs_mt_ops = { @@ -146,10 +146,10 @@ index dbe80c8306e..fd0a5c1d99a 100644 wined3d_cs_mt_submit, wined3d_cs_mt_finish, diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 975ab96b464..09b1fc459fc 100644 +index db38e9d8eeb..a9fd22471c3 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -4325,8 +4325,6 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str +@@ -4316,8 +4316,6 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str return; } @@ -159,10 +159,10 @@ index 975ab96b464..09b1fc459fc 100644 } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 1f2c197e392..073328b71b6 100644 +index 98ed187dcd9..eadb1278ff4 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -3451,6 +3451,7 @@ struct wined3d_cs_queue +@@ -3476,6 +3476,7 @@ struct wined3d_cs_queue struct wined3d_cs_ops { @@ -171,5 +171,5 @@ index 1f2c197e392..073328b71b6 100644 void (*submit)(struct wined3d_cs *cs, enum wined3d_cs_queue_id queue_id); void (*finish)(struct wined3d_cs *cs, enum wined3d_cs_queue_id queue_id); -- -2.13.1 +2.14.1 diff --git a/patches/wined3d-CSMT_Main/9999-IfDefined.patch b/patches/wined3d-CSMT_Main/9999-IfDefined.patch index 845c3b7b..b5b527ce 100644 --- a/patches/wined3d-CSMT_Main/9999-IfDefined.patch +++ b/patches/wined3d-CSMT_Main/9999-IfDefined.patch @@ -37,7 +37,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -398,6 +398,9 @@ struct wined3d_cs_update_sub_resource +@@ -399,6 +399,9 @@ struct wined3d_cs_update_sub_resource unsigned int sub_resource_idx; struct wined3d_box box; struct wined3d_sub_resource_data data; @@ -47,7 +47,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c }; struct wined3d_cs_add_dirty_texture_region -@@ -2245,6 +2248,53 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r +@@ -2252,6 +2255,53 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r unsigned int slice_pitch) { struct wined3d_cs_update_sub_resource *op; @@ -101,7 +101,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op = cs->ops->require_space(cs, sizeof(*op), WINED3D_CS_QUEUE_MAP); op->opcode = WINED3D_CS_OP_UPDATE_SUB_RESOURCE; -@@ -2258,8 +2308,10 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r +@@ -2265,8 +2315,10 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r wined3d_resource_acquire(resource); cs->ops->submit(cs, WINED3D_CS_QUEUE_MAP); @@ -112,8 +112,8 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->finish(cs, WINED3D_CS_QUEUE_MAP); } -@@ -2561,6 +2613,13 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_COPY_SUB_RESOURCE */ wined3d_cs_exec_copy_sub_resource, +@@ -2645,6 +2697,13 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void + /* WINED3D_CS_OP_GENERATE_MIPS */ wined3d_cs_exec_generate_mips, }; +#if defined(STAGING_CSMT) @@ -126,7 +126,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size, enum wined3d_cs_queue_id queue_id) { if (size > (cs->data_size - cs->end)) -@@ -2614,6 +2673,9 @@ static void wined3d_cs_st_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id +@@ -2698,6 +2757,9 @@ static void wined3d_cs_st_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id static const struct wined3d_cs_ops wined3d_cs_st_ops = { @@ -136,7 +136,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c wined3d_cs_st_require_space, wined3d_cs_st_submit, wined3d_cs_st_finish, -@@ -2647,6 +2709,21 @@ static void wined3d_cs_mt_submit(struct wined3d_cs *cs, enum wined3d_cs_queue_id +@@ -2731,6 +2793,21 @@ static void wined3d_cs_mt_submit(struct wined3d_cs *cs, enum wined3d_cs_queue_id wined3d_cs_queue_submit(&cs->queue[queue_id], cs); } @@ -158,7 +158,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c static void *wined3d_cs_queue_require_space(struct wined3d_cs_queue *queue, size_t size, struct wined3d_cs *cs) { size_t queue_size = ARRAY_SIZE(queue->data); -@@ -2708,6 +2785,16 @@ static void *wined3d_cs_queue_require_space(struct wined3d_cs_queue *queue, size +@@ -2792,6 +2869,16 @@ static void *wined3d_cs_queue_require_space(struct wined3d_cs_queue *queue, size return packet->data; } @@ -175,7 +175,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, enum wined3d_cs_queue_id queue_id) { if (cs->thread_id == GetCurrentThreadId()) -@@ -2727,6 +2814,9 @@ static void wined3d_cs_mt_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id +@@ -2811,6 +2898,9 @@ static void wined3d_cs_mt_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id static const struct wined3d_cs_ops wined3d_cs_mt_ops = { @@ -237,7 +237,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_cs_emit_update_sub_resource(device->cs, resource, sub_resource_idx, box, data, row_pitch, depth_pitch); } -@@ -5264,3 +5283,58 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL +@@ -5271,3 +5290,58 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL else return CallWindowProcA(proc, window, message, wparam, lparam); } @@ -428,7 +428,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } if (context) context_release(context); -@@ -1411,11 +1451,16 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT +@@ -1416,11 +1456,16 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT /* Context activation is done by the caller. */ static void wined3d_texture_prepare_buffer_object(struct wined3d_texture *texture, @@ -445,7 +445,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (sub_resource->buffer_object) return; -@@ -1427,6 +1472,16 @@ static void wined3d_texture_prepare_buffer_object(struct wined3d_texture *textur +@@ -1432,6 +1477,16 @@ static void wined3d_texture_prepare_buffer_object(struct wined3d_texture *textur TRACE("Created buffer object %u for texture %p, sub-resource %u.\n", sub_resource->buffer_object, texture, sub_resource_idx); @@ -462,7 +462,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } static void wined3d_texture_force_reload(struct wined3d_texture *texture) -@@ -1552,7 +1607,11 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned +@@ -1557,7 +1612,11 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned return TRUE; case WINED3D_LOCATION_BUFFER: @@ -474,7 +474,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return TRUE; case WINED3D_LOCATION_TEXTURE_RGB: -@@ -1853,7 +1912,11 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in +@@ -1858,7 +1917,11 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in } else if (sub_resource->locations & WINED3D_LOCATION_BUFFER) { @@ -486,7 +486,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c wined3d_texture_bind_and_dirtify(texture, context, location == WINED3D_LOCATION_TEXTURE_SRGB); wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch); texture1d_upload_data(texture, sub_resource_idx, context, NULL, &data, row_pitch, slice_pitch); -@@ -1898,7 +1961,11 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in +@@ -1903,7 +1966,11 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in case WINED3D_LOCATION_BUFFER: if (sub_resource->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB)) { @@ -498,7 +498,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB) wined3d_texture_bind_and_dirtify(texture, context, FALSE); -@@ -2192,8 +2259,13 @@ static void wined3d_texture_unload(struct wined3d_resource *resource) +@@ -2197,8 +2264,13 @@ static void wined3d_texture_unload(struct wined3d_resource *resource) wined3d_texture_invalidate_location(texture, i, ~WINED3D_LOCATION_DISCARDED); } @@ -512,7 +512,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (resource->type == WINED3D_RTYPE_TEXTURE_2D) { -@@ -2969,7 +3041,11 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in +@@ -2974,7 +3046,11 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in } else if (sub_resource->locations & WINED3D_LOCATION_BUFFER) { @@ -524,7 +524,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c wined3d_texture_bind_and_dirtify(texture, context, location == WINED3D_LOCATION_TEXTURE_SRGB); wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch); -@@ -3015,7 +3091,11 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in +@@ -3020,7 +3096,11 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in case WINED3D_LOCATION_BUFFER: if (sub_resource->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB)) { @@ -536,7 +536,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB) wined3d_texture_bind_and_dirtify(texture, context, FALSE); -@@ -3233,8 +3313,19 @@ HRESULT CDECL wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned +@@ -3238,8 +3318,19 @@ HRESULT CDECL wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned if (dst_texture->sub_resources[dst_sub_resource_idx].map_count || src_texture->sub_resources[src_sub_resource_idx].map_count) { @@ -661,7 +661,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h } sub_resources[1]; }; -@@ -3463,6 +3483,9 @@ struct wined3d_cs_queue +@@ -3464,6 +3484,9 @@ struct wined3d_cs_queue struct wined3d_cs_ops { diff --git a/patches/wined3d-GenerateMips/0001-d3d11-tests-Add-basic-test-for-mipmap-level-generati.patch b/patches/wined3d-GenerateMips/0001-d3d11-tests-Add-basic-test-for-mipmap-level-generati.patch new file mode 100644 index 00000000..ab97f43c --- /dev/null +++ b/patches/wined3d-GenerateMips/0001-d3d11-tests-Add-basic-test-for-mipmap-level-generati.patch @@ -0,0 +1,139 @@ +From 36521fb8d471b34993598a6e83b873d2d887e9ed Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20M=C3=BCller?= +Date: Sat, 16 Sep 2017 05:13:04 +0200 +Subject: d3d11/tests: Add basic test for mipmap level generation. + +--- + dlls/d3d11/tests/d3d11.c | 111 +++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 111 insertions(+) + +diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c +index f6bb69e834b..154771f4240 100644 +--- a/dlls/d3d11/tests/d3d11.c ++++ b/dlls/d3d11/tests/d3d11.c +@@ -22646,6 +22646,116 @@ static void test_interpolation(void) + release_test_context(&test_context); + } + ++static void test_mipmap_generation(void) ++{ ++ D3D11_SHADER_RESOURCE_VIEW_DESC srv_desc; ++ struct d3d11_test_context test_context; ++ D3D11_TEXTURE2D_DESC texture_desc; ++ ID3D11ShaderResourceView *srv; ++ ID3D11DeviceContext *context; ++ ID3D11Texture2D *texture; ++ ID3D11Device *device; ++ DWORD color[64*64]; ++ HRESULT hr; ++ int i; ++ ++ if (!init_test_context(&test_context, NULL)) ++ return; ++ ++ device = test_context.device; ++ context = test_context.immediate_context; ++ ++ texture_desc.Width = 64; ++ texture_desc.Height = 64; ++ texture_desc.MipLevels = 3; ++ texture_desc.ArraySize = 2; ++ texture_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; ++ texture_desc.SampleDesc.Count = 1; ++ texture_desc.SampleDesc.Quality = 0; ++ texture_desc.Usage = D3D11_USAGE_DEFAULT; ++ texture_desc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET; ++ texture_desc.CPUAccessFlags = 0; ++ texture_desc.MiscFlags = D3D11_RESOURCE_MISC_GENERATE_MIPS; ++ ++ hr = ID3D11Device_CreateTexture2D(device, &texture_desc, NULL, &texture); ++ ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr); ++ ++ hr = ID3D11Device_CreateShaderResourceView(device, (ID3D11Resource *)texture, NULL, &srv); ++ ok(SUCCEEDED(hr), "Failed to create shader resource view, hr %#x.\n", hr); ++ ++ for (i = 0; i < texture_desc.Width * texture_desc.Height; i++) ++ color[i] = 0xff00ff00; ++ ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource*)texture, 0, NULL, color, 64 * 4, 64 * 64 * 4); ++ ++ for (i = 0; i < texture_desc.Width * texture_desc.Height; i++) ++ color[i] = 0x00ffff00; ++ ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource*)texture, 3, NULL, color, 64 * 4, 64 * 64 * 4); ++ ++ check_texture_sub_resource_color(texture, 0, NULL, 0xff00ff00, 0); ++ check_texture_sub_resource_color(texture, 1, NULL, 0x00000000, 0); ++ check_texture_sub_resource_color(texture, 2, NULL, 0x00000000, 0); ++ check_texture_sub_resource_color(texture, 3, NULL, 0x00ffff00, 0); ++ check_texture_sub_resource_color(texture, 4, NULL, 0x00000000, 0); ++ check_texture_sub_resource_color(texture, 5, NULL, 0x00000000, 0); ++ ++ ID3D11DeviceContext_GenerateMips(context, srv); ++ ++ check_texture_sub_resource_color(texture, 0, NULL, 0xff00ff00, 0); ++ todo_wine check_texture_sub_resource_color(texture, 1, NULL, 0xff00ff00, 0); ++ todo_wine check_texture_sub_resource_color(texture, 2, NULL, 0xff00ff00, 0); ++ check_texture_sub_resource_color(texture, 3, NULL, 0x00ffff00, 0); ++ todo_wine check_texture_sub_resource_color(texture, 4, NULL, 0x00ffff00, 0); ++ todo_wine check_texture_sub_resource_color(texture, 5, NULL, 0x00ffff00, 0); ++ ++ ID3D11ShaderResourceView_Release(srv); ++ ID3D11Texture2D_Release(texture); ++ ++ hr = ID3D11Device_CreateTexture2D(device, &texture_desc, NULL, &texture); ++ ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr); ++ ++ srv_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; ++ srv_desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY; ++ srv_desc.Texture2DArray.MostDetailedMip = 1; ++ srv_desc.Texture2DArray.MipLevels = -1; ++ srv_desc.Texture2DArray.FirstArraySlice = 0; ++ srv_desc.Texture2DArray.ArraySize = 1; ++ ++ hr = ID3D11Device_CreateShaderResourceView(device, (ID3D11Resource *)texture, &srv_desc, &srv); ++ ok(SUCCEEDED(hr), "Failed to create shader resource view, hr %#x.\n", hr); ++ ++ for (i = 0; i < texture_desc.Width * texture_desc.Height; i++) ++ color[i] = 0xff00ff00; ++ ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource*)texture, 0, NULL, color, 64 * 4, 64 * 64 * 4); ++ ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource*)texture, 3, NULL, color, 64 * 4, 64 * 64 * 4); ++ ++ for (i = 0; i < texture_desc.Width * texture_desc.Height; i++) ++ color[i] = 0xffff0000; ++ ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource*)texture, 1, NULL, color, 32 * 4, 32 * 32 * 4); ++ ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource*)texture, 4, NULL, color, 32 * 4, 32 * 32 * 4); ++ ++ check_texture_sub_resource_color(texture, 0, NULL, 0xff00ff00, 0); ++ check_texture_sub_resource_color(texture, 1, NULL, 0xffff0000, 0); ++ check_texture_sub_resource_color(texture, 2, NULL, 0x00000000, 0); ++ check_texture_sub_resource_color(texture, 3, NULL, 0xff00ff00, 0); ++ check_texture_sub_resource_color(texture, 4, NULL, 0xffff0000, 0); ++ check_texture_sub_resource_color(texture, 5, NULL, 0x00000000, 0); ++ ++ ID3D11DeviceContext_GenerateMips(context, srv); ++ ++ check_texture_sub_resource_color(texture, 0, NULL, 0xff00ff00, 0); ++ check_texture_sub_resource_color(texture, 1, NULL, 0xffff0000, 0); ++ if (!is_warp_device(device)) /* broken on WARP device */ ++ todo_wine check_texture_sub_resource_color(texture, 2, NULL, 0xffff0000, 0); ++ check_texture_sub_resource_color(texture, 3, NULL, 0xff00ff00, 0); ++ check_texture_sub_resource_color(texture, 4, NULL, 0xffff0000, 0); ++ check_texture_sub_resource_color(texture, 5, NULL, 0x00000000, 0); ++ ++ ID3D11ShaderResourceView_Release(srv); ++ ID3D11Texture2D_Release(texture); ++ ++ release_test_context(&test_context); ++} ++ + START_TEST(d3d11) + { + test_create_device(); +@@ -22752,4 +22862,5 @@ START_TEST(d3d11) + test_conservative_depth_output(); + test_dual_blending(); + test_interpolation(); ++ test_mipmap_generation(); + } +-- +2.14.1 + diff --git a/patches/wined3d-GenerateMips/0002-wined3d-Implement-generation-of-mip-maps-for-shader-.patch b/patches/wined3d-GenerateMips/0002-wined3d-Implement-generation-of-mip-maps-for-shader-.patch new file mode 100644 index 00000000..04c9c609 --- /dev/null +++ b/patches/wined3d-GenerateMips/0002-wined3d-Implement-generation-of-mip-maps-for-shader-.patch @@ -0,0 +1,280 @@ +From ec757263776955ee6ca680109b47eb3bc6163845 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20M=C3=BCller?= +Date: Sat, 16 Sep 2017 18:05:31 +0200 +Subject: wined3d: Implement generation of mip maps for shader resource views. + +--- + dlls/d3d11/device.c | 14 ++++++- + dlls/d3d11/tests/d3d11.c | 10 ++--- + dlls/wined3d/cs.c | 84 ++++++++++++++++++++++++++++++++++++++++++ + dlls/wined3d/device.c | 7 ++++ + dlls/wined3d/texture.c | 9 ++++- + dlls/wined3d/wined3d.spec | 1 + + dlls/wined3d/wined3d_private.h | 2 + + include/wine/wined3d.h | 1 + + 8 files changed, 119 insertions(+), 9 deletions(-) + +diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c +index f71d4a3e910..bbdc97868db 100644 +--- a/dlls/d3d11/device.c ++++ b/dlls/d3d11/device.c +@@ -2466,9 +2466,19 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_ClearDepthStencilView(ID3D + } + + static void STDMETHODCALLTYPE d3d11_immediate_context_GenerateMips(ID3D11DeviceContext *iface, +- ID3D11ShaderResourceView *view) ++ ID3D11ShaderResourceView *shader_view) + { +- FIXME("iface %p, view %p stub!\n", iface, view); ++ struct d3d_device *device = device_from_immediate_ID3D11DeviceContext(iface); ++ struct d3d_shader_resource_view *view = unsafe_impl_from_ID3D11ShaderResourceView(shader_view); ++ ++ TRACE("iface %p, shader_view %p.\n", iface, shader_view); ++ ++ if (!view) ++ return; ++ ++ wined3d_mutex_lock(); ++ wined3d_device_generate_mips_view(device->wined3d_device, view->wined3d_view); ++ wined3d_mutex_unlock(); + } + + static void STDMETHODCALLTYPE d3d11_immediate_context_SetResourceMinLOD(ID3D11DeviceContext *iface, +diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c +index 154771f4240..8906b9efa7a 100644 +--- a/dlls/d3d11/tests/d3d11.c ++++ b/dlls/d3d11/tests/d3d11.c +@@ -22701,11 +22701,11 @@ static void test_mipmap_generation(void) + ID3D11DeviceContext_GenerateMips(context, srv); + + check_texture_sub_resource_color(texture, 0, NULL, 0xff00ff00, 0); +- todo_wine check_texture_sub_resource_color(texture, 1, NULL, 0xff00ff00, 0); +- todo_wine check_texture_sub_resource_color(texture, 2, NULL, 0xff00ff00, 0); ++ check_texture_sub_resource_color(texture, 1, NULL, 0xff00ff00, 0); ++ check_texture_sub_resource_color(texture, 2, NULL, 0xff00ff00, 0); + check_texture_sub_resource_color(texture, 3, NULL, 0x00ffff00, 0); +- todo_wine check_texture_sub_resource_color(texture, 4, NULL, 0x00ffff00, 0); +- todo_wine check_texture_sub_resource_color(texture, 5, NULL, 0x00ffff00, 0); ++ check_texture_sub_resource_color(texture, 4, NULL, 0x00ffff00, 0); ++ check_texture_sub_resource_color(texture, 5, NULL, 0x00ffff00, 0); + + ID3D11ShaderResourceView_Release(srv); + ID3D11Texture2D_Release(texture); +@@ -22745,7 +22745,7 @@ static void test_mipmap_generation(void) + check_texture_sub_resource_color(texture, 0, NULL, 0xff00ff00, 0); + check_texture_sub_resource_color(texture, 1, NULL, 0xffff0000, 0); + if (!is_warp_device(device)) /* broken on WARP device */ +- todo_wine check_texture_sub_resource_color(texture, 2, NULL, 0xffff0000, 0); ++ check_texture_sub_resource_color(texture, 2, NULL, 0xffff0000, 0); + check_texture_sub_resource_color(texture, 3, NULL, 0xff00ff00, 0); + check_texture_sub_resource_color(texture, 4, NULL, 0xffff0000, 0); + check_texture_sub_resource_color(texture, 5, NULL, 0x00000000, 0); +diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c +index 6b37e9d6f03..70fb19382ea 100644 +--- a/dlls/wined3d/cs.c ++++ b/dlls/wined3d/cs.c +@@ -72,6 +72,7 @@ enum wined3d_cs_op + WINED3D_CS_OP_CLEAR_UNORDERED_ACCESS_VIEW, + WINED3D_CS_OP_COPY_UAV_COUNTER, + WINED3D_CS_OP_COPY_SUB_RESOURCE, ++ WINED3D_CS_OP_GENERATE_MIPS, + WINED3D_CS_OP_STOP, + }; + +@@ -433,6 +434,12 @@ struct wined3d_cs_copy_sub_resource + struct wined3d_box src_box; + }; + ++struct wined3d_cs_generate_mips ++{ ++ enum wined3d_cs_op opcode; ++ struct wined3d_shader_resource_view *view; ++}; ++ + struct wined3d_cs_stop + { + enum wined3d_cs_op opcode; +@@ -2500,6 +2507,82 @@ void wined3d_cs_emit_copy_sub_resource(struct wined3d_cs *cs, struct wined3d_res + cs->ops->submit(cs, WINED3D_CS_QUEUE_DEFAULT); + } + ++static void wined3d_cs_exec_generate_mips(struct wined3d_cs *cs, const void *data) ++{ ++ const struct wined3d_cs_generate_mips *op = data; ++ struct wined3d_shader_resource_view *view = op->view; ++ struct wined3d_resource *resource = view->resource; ++ const struct wined3d_gl_info *gl_info; ++ struct wined3d_texture *texture; ++ struct wined3d_context *context; ++ GLenum target; ++ int i, j; ++ ++ if (resource->type != WINED3D_RTYPE_TEXTURE_1D && ++ resource->type != WINED3D_RTYPE_TEXTURE_2D && ++ resource->type != WINED3D_RTYPE_TEXTURE_3D) ++ { ++ FIXME("Not implemented for %s resources.\n", debug_d3dresourcetype(resource->type)); ++ goto end; ++ } ++ ++ texture = texture_from_resource(resource); ++ context = context_acquire(cs->device, NULL, 0); ++ gl_info = context->gl_info; ++ ++ for (i = view->desc.u.texture.layer_idx; i < view->desc.u.texture.layer_idx + view->desc.u.texture.layer_count; i++) ++ { ++ wined3d_texture_load_location(texture, i * texture->level_count + view->desc.u.texture.level_idx, context, WINED3D_LOCATION_TEXTURE_RGB); ++ } ++ ++ if (view->gl_view.name) ++ { ++ context_bind_texture(context, view->gl_view.target, view->gl_view.name); ++ target = view->gl_view.target; ++ } ++ else ++ { ++ wined3d_texture_bind(texture, context, FALSE); ++ target = texture->target; ++ } ++ ++ if (gl_info->fbo_ops.glGenerateMipmap) ++ { ++ gl_info->fbo_ops.glGenerateMipmap(target); ++ checkGLcall("glGenerateMipmap"); ++ } ++ else ++ FIXME("Your OpenGL driver does not support glGenerateMipmap.\n"); ++ ++ for (i = view->desc.u.texture.layer_idx; i < view->desc.u.texture.layer_idx + view->desc.u.texture.layer_count; i++) ++ { ++ for (j = view->desc.u.texture.level_idx + 1; j < view->desc.u.texture.level_idx + view->desc.u.texture.level_count; j++) ++ { ++ wined3d_texture_validate_location(texture, i * texture->level_count + j, WINED3D_LOCATION_TEXTURE_RGB); ++ wined3d_texture_invalidate_location(texture, i * texture->level_count + j, ~WINED3D_LOCATION_TEXTURE_RGB); ++ } ++ } ++ ++ wined3d_texture_dirtify(context); ++ context_release(context); ++ ++end: ++ wined3d_resource_release(view->resource); ++} ++ ++void wined3d_cs_emit_generate_mips(struct wined3d_cs *cs, struct wined3d_shader_resource_view *view) ++{ ++ struct wined3d_cs_generate_mips *op; ++ ++ op = cs->ops->require_space(cs, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT); ++ op->opcode = WINED3D_CS_OP_GENERATE_MIPS; ++ op->view = view; ++ ++ wined3d_resource_acquire(view->resource); ++ ++ cs->ops->submit(cs, WINED3D_CS_QUEUE_DEFAULT); ++} ++ + static void wined3d_cs_emit_stop(struct wined3d_cs *cs) + { + struct wined3d_cs_stop *op; +@@ -2559,6 +2642,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void + /* WINED3D_CS_OP_CLEAR_UNORDERED_ACCESS_VIEW */ wined3d_cs_exec_clear_unordered_access_view, + /* WINED3D_CS_OP_COPY_UAV_COUNTER */ wined3d_cs_exec_copy_uav_counter, + /* WINED3D_CS_OP_COPY_SUB_RESOURCE */ wined3d_cs_exec_copy_sub_resource, ++ /* WINED3D_CS_OP_GENERATE_MIPS */ wined3d_cs_exec_generate_mips, + }; + + static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size, enum wined3d_cs_queue_id queue_id) +diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c +index 1194513879c..bf17029b89e 100644 +--- a/dlls/wined3d/device.c ++++ b/dlls/wined3d/device.c +@@ -4330,6 +4330,13 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str + wined3d_cs_emit_update_sub_resource(device->cs, resource, sub_resource_idx, box, data, row_pitch, depth_pitch); + } + ++void CDECL wined3d_device_generate_mips_view(struct wined3d_device *device, struct wined3d_shader_resource_view *view) ++{ ++ TRACE("device %p, view %p.\n", device, view); ++ ++ wined3d_cs_emit_generate_mips(device->cs, view); ++} ++ + HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *device, + struct wined3d_rendertarget_view *view, const RECT *rect, DWORD flags, + const struct wined3d_color *color, float depth, DWORD stencil) +diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c +index 14f5c4ecc7a..c91d40d18a9 100644 +--- a/dlls/wined3d/texture.c ++++ b/dlls/wined3d/texture.c +@@ -765,8 +765,7 @@ void wined3d_texture_bind(struct wined3d_texture *texture, + } + + /* Context activation is done by the caller. */ +-void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture, +- struct wined3d_context *context, BOOL srgb) ++void wined3d_texture_dirtify(struct wined3d_context *context) + { + /* We don't need a specific texture unit, but after binding the texture + * the current unit is dirty. Read the unit back instead of switching to +@@ -787,7 +786,13 @@ void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture, + * a shader. */ + context_invalidate_compute_state(context, STATE_COMPUTE_SHADER_RESOURCE_BINDING); + context_invalidate_state(context, STATE_GRAPHICS_SHADER_RESOURCE_BINDING); ++} + ++/* Context activation is done by the caller. */ ++void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture, ++ struct wined3d_context *context, BOOL srgb) ++{ ++ wined3d_texture_dirtify(context); + wined3d_texture_bind(texture, context, srgb); + } + +diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec +index e4d5f2ed9ac..22c76a49281 100644 +--- a/dlls/wined3d/wined3d.spec ++++ b/dlls/wined3d/wined3d.spec +@@ -52,6 +52,7 @@ + @ cdecl wined3d_device_end_scene(ptr) + @ cdecl wined3d_device_end_stateblock(ptr ptr) + @ cdecl wined3d_device_evict_managed_resources(ptr) ++@ cdecl wined3d_device_generate_mips_view(ptr ptr) + @ cdecl wined3d_device_get_available_texture_mem(ptr) + @ cdecl wined3d_device_get_base_vertex_index(ptr) + @ cdecl wined3d_device_get_clip_plane(ptr long ptr) +diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h +index 81628d21e8f..4960b513931 100644 +--- a/dlls/wined3d/wined3d_private.h ++++ b/dlls/wined3d/wined3d_private.h +@@ -3195,6 +3195,7 @@ void wined3d_texture_bind(struct wined3d_texture *texture, + struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; + void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture, + struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; ++void wined3d_texture_dirtify(struct wined3d_context *context) DECLSPEC_HIDDEN; + HRESULT wined3d_texture_check_box_dimensions(const struct wined3d_texture *texture, + unsigned int level, const struct wined3d_box *box) DECLSPEC_HIDDEN; + GLenum wined3d_texture_get_gl_buffer(const struct wined3d_texture *texture) DECLSPEC_HIDDEN; +@@ -3574,6 +3575,7 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r + void wined3d_cs_emit_copy_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *dst_resource, + unsigned int dst_sub_resource_idx, const struct wined3d_box *dst_box, struct wined3d_resource *src_resource, + unsigned int src_sub_resource_idx, const struct wined3d_box *src_box) DECLSPEC_HIDDEN; ++void wined3d_cs_emit_generate_mips(struct wined3d_cs *cs, struct wined3d_shader_resource_view *view) DECLSPEC_HIDDEN; + void wined3d_cs_init_object(struct wined3d_cs *cs, + void (*callback)(void *object), void *object) DECLSPEC_HIDDEN; + HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx, +diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h +index 37aee84308f..961762d2cf0 100644 +--- a/include/wine/wined3d.h ++++ b/include/wine/wined3d.h +@@ -2465,6 +2465,7 @@ void __cdecl wined3d_device_update_sub_resource(struct wined3d_device *device, s + HRESULT __cdecl wined3d_device_update_texture(struct wined3d_device *device, + struct wined3d_texture *src_texture, struct wined3d_texture *dst_texture); + HRESULT __cdecl wined3d_device_validate_device(const struct wined3d_device *device, DWORD *num_passes); ++void CDECL wined3d_device_generate_mips_view(struct wined3d_device *device, struct wined3d_shader_resource_view *view); + + HRESULT __cdecl wined3d_palette_create(struct wined3d_device *device, DWORD flags, + unsigned int entry_count, const PALETTEENTRY *entries, struct wined3d_palette **palette); +-- +2.14.1 + diff --git a/patches/wined3d-GenerateMips/definition b/patches/wined3d-GenerateMips/definition new file mode 100644 index 00000000..bc28ec4b --- /dev/null +++ b/patches/wined3d-GenerateMips/definition @@ -0,0 +1,3 @@ +Fixes: Support for GenerateMips +Depends: wined3d-Interpolation_Modifiers +Depends: wined3d-Copy_Resource_Typeless