diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 5d204342..d339efa2 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -406,6 +406,7 @@ patch_enable_all () enable_wined3d_GTX_560M="$1" enable_wined3d_Limit_Vram="$1" enable_wined3d_QUERY_Stubs="$1" + enable_wined3d_Render_Target="$1" enable_wined3d_Revert_Pixel_Center_Offset="$1" enable_wined3d_Silence_FIXMEs="$1" enable_wined3d_WINED3DFMT_R32G32_UINT="$1" @@ -1438,6 +1439,9 @@ patch_enable () wined3d-QUERY_Stubs) enable_wined3d_QUERY_Stubs="$2" ;; + wined3d-Render_Target) + enable_wined3d_Render_Target="$2" + ;; wined3d-Revert_Pixel_Center_Offset) enable_wined3d_Revert_Pixel_Center_Offset="$2" ;; @@ -2193,6 +2197,9 @@ if test "$enable_wined3d_CSMT_Helper" -eq 1; then if test "$enable_wined3d_QUERY_Stubs" -gt 1; then abort "Patchset wined3d-QUERY_Stubs disabled, but wined3d-CSMT_Helper depends on that." fi + if test "$enable_wined3d_Render_Target" -gt 1; then + abort "Patchset wined3d-Render_Target disabled, but wined3d-CSMT_Helper depends on that." + fi if test "$enable_wined3d_Revert_Pixel_Center_Offset" -gt 1; then abort "Patchset wined3d-Revert_Pixel_Center_Offset disabled, but wined3d-CSMT_Helper depends on that." fi @@ -2206,6 +2213,7 @@ if test "$enable_wined3d_CSMT_Helper" -eq 1; then enable_wined3d_Accounting=1 enable_wined3d_DXTn=1 enable_wined3d_QUERY_Stubs=1 + enable_wined3d_Render_Target=1 enable_wined3d_Revert_Pixel_Center_Offset=1 enable_wined3d_Silence_FIXMEs=1 fi @@ -8424,6 +8432,20 @@ if test "$enable_wined3d_QUERY_Stubs" -eq 1; then ) >> "$patchlist" fi +# Patchset wined3d-Render_Target +# | +# | Modified files: +# | * dlls/wined3d/context.c, dlls/wined3d/state.c +# | +if test "$enable_wined3d_Render_Target" -eq 1; then + patch_apply wined3d-Render_Target/0001-wined3d-Handle-no-render-target-view-case-when-setti.patch + patch_apply wined3d-Render_Target/0002-wined3d-Set-draw-buffer-mask-to-zero-GL_NONE-when-no.patch + ( + printf '%s\n' '+ { "Michael Müller", "wined3d: Handle no render target view case when setting scissors.", 1 },'; + printf '%s\n' '+ { "Michael Müller", "wined3d: Set draw buffer mask to zero (GL_NONE) when no render target view is attached.", 1 },'; + ) >> "$patchlist" +fi + # Patchset wined3d-Revert_Pixel_Center_Offset # | # | Modified files: @@ -8470,7 +8492,7 @@ fi # | This patchset has the following (direct or indirect) dependencies: # | * d3d11-Deferred_Context, makedep-PARENTSPEC, ntdll-Attach_Process_DLLs, ntdll-DllOverrides_WOW64, ntdll- # | Loader_Machine_Type, ntdll-DllRedirects, wined3d-1DTextures, wined3d-Accounting, wined3d-DXTn, wined3d-QUERY_Stubs, -# | wined3d-Revert_Pixel_Center_Offset, wined3d-Silence_FIXMEs +# | wined3d-Render_Target, wined3d-Revert_Pixel_Center_Offset, wined3d-Silence_FIXMEs # | # | Modified files: # | * configure.ac, dlls/wined3d-csmt/Makefile.in, dlls/wined3d-csmt/version.rc @@ -8537,7 +8559,7 @@ fi # | This patchset has the following (direct or indirect) dependencies: # | * d3d11-Deferred_Context, makedep-PARENTSPEC, ntdll-Attach_Process_DLLs, ntdll-DllOverrides_WOW64, ntdll- # | Loader_Machine_Type, ntdll-DllRedirects, wined3d-1DTextures, wined3d-Accounting, wined3d-DXTn, wined3d-QUERY_Stubs, -# | wined3d-Revert_Pixel_Center_Offset, wined3d-Silence_FIXMEs, wined3d-CSMT_Helper +# | wined3d-Render_Target, wined3d-Revert_Pixel_Center_Offset, wined3d-Silence_FIXMEs, 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 8a157918..c4dcfbb2 100644 --- a/patches/wined3d-CSMT_Helper/definition +++ b/patches/wined3d-CSMT_Helper/definition @@ -4,6 +4,7 @@ Depends: wined3d-QUERY_Stubs Depends: wined3d-1DTextures Depends: wined3d-Silence_FIXMEs Depends: wined3d-Revert_Pixel_Center_Offset +Depends: wined3d-Render_Target Depends: d3d11-Deferred_Context Depends: makedep-PARENTSPEC Depends: ntdll-DllRedirects diff --git a/patches/wined3d-CSMT_Main/0004-Revert-wined3d-Introduce-wined3d_rendertarget_view_g.patch b/patches/wined3d-CSMT_Main/0004-Revert-wined3d-Introduce-wined3d_rendertarget_view_g.patch index dd6021c5..dfdccd3c 100644 --- a/patches/wined3d-CSMT_Main/0004-Revert-wined3d-Introduce-wined3d_rendertarget_view_g.patch +++ b/patches/wined3d-CSMT_Main/0004-Revert-wined3d-Introduce-wined3d_rendertarget_view_g.patch @@ -1,4 +1,4 @@ -From 9e7a6ec77afd6a2a0304b2a09697792f80c2a595 Mon Sep 17 00:00:00 2001 +From 848085bd98f238e46bc23113ed9329cb14b6c1cf Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Tue, 15 Nov 2016 22:07:56 +0100 Subject: Revert "wined3d: Introduce @@ -14,7 +14,7 @@ This reverts commit 5cdb8f2486cf00a61c1aac20daef8c7cac0d8312. 4 files changed, 10 insertions(+), 23 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index ae8ca97..c526266 100644 +index 3cc78234b0d..7dbdc0aa1e2 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -291,8 +291,7 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c @@ -37,10 +37,10 @@ index ae8ca97..c526266 100644 else { diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c -index 3a899b3..6e89fbc 100644 +index 5952c6cc610..402bad31da0 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c -@@ -4633,7 +4633,7 @@ static void viewport_miscpart(struct wined3d_context *context, const struct wine +@@ -4636,7 +4636,7 @@ static void viewport_miscpart(struct wined3d_context *context, const struct wine if (vp.height > target->height) vp.height = target->height; @@ -49,7 +49,7 @@ index 3a899b3..6e89fbc 100644 } else if (depth_stencil) { -@@ -4675,7 +4675,7 @@ static void viewport_miscpart_cc(struct wined3d_context *context, +@@ -4678,7 +4678,7 @@ static void viewport_miscpart_cc(struct wined3d_context *context, if (vp.height > target->height) vp.height = target->height; @@ -58,17 +58,17 @@ index 3a899b3..6e89fbc 100644 } else if (depth_stencil) { -@@ -4860,7 +4860,7 @@ static void scissorrect(struct wined3d_context *context, const struct wined3d_st - UINT height; - UINT width; +@@ -4865,7 +4865,7 @@ static void scissorrect(struct wined3d_context *context, const struct wined3d_st -- wined3d_rendertarget_view_get_drawable_size(target, context, &width, &height); -+ surface_get_drawable_size(wined3d_rendertarget_view_get_surface(target), context, &width, &height); - gl_info->gl_ops.gl.p_glScissor(r->left, height - r->bottom, r->right - r->left, r->bottom - r->top); - } - checkGLcall("glScissor"); + if (target) + { +- wined3d_rendertarget_view_get_drawable_size(target, context, &width, &height); ++ surface_get_drawable_size(wined3d_rendertarget_view_get_surface(target), context, &width, &height); + gl_info->gl_ops.gl.p_glScissor(r->left, height - r->bottom, r->right - r->left, r->bottom - r->top); + } + else diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c -index 10eecc8..cfd2ce1 100644 +index 609f8f7365e..a0a46208343 100644 --- a/dlls/wined3d/view.c +++ b/dlls/wined3d/view.c @@ -195,21 +195,10 @@ struct wined3d_resource * CDECL wined3d_rendertarget_view_get_resource(const str @@ -97,10 +97,10 @@ index 10eecc8..cfd2ce1 100644 /* The drawable size of an onscreen drawable is the surface size. * (Actually: The window size, but the surface is created in window diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index f14ad98..52bf790 100644 +index e7321b889ac..28efc25b908 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2973,6 +2973,8 @@ HRESULT surface_color_fill(struct wined3d_surface *s, +@@ -2987,6 +2987,8 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const struct wined3d_color *color) DECLSPEC_HIDDEN; HRESULT wined3d_surface_create_dc(struct wined3d_surface *surface) DECLSPEC_HIDDEN; void wined3d_surface_destroy_dc(struct wined3d_surface *surface) DECLSPEC_HIDDEN; @@ -109,7 +109,7 @@ index f14ad98..52bf790 100644 void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb, struct wined3d_context *context) DECLSPEC_HIDDEN; HRESULT surface_load_location(struct wined3d_surface *surface, -@@ -3291,9 +3293,6 @@ static inline struct wined3d_surface *wined3d_rendertarget_view_get_surface( +@@ -3302,9 +3304,6 @@ static inline struct wined3d_surface *wined3d_rendertarget_view_get_surface( return texture->sub_resources[view->sub_resource_idx].u.surface; } @@ -120,5 +120,5 @@ index f14ad98..52bf790 100644 { GLenum target; -- -2.9.0 +2.11.0 diff --git a/patches/wined3d-CSMT_Main/9999-IfDefined.patch b/patches/wined3d-CSMT_Main/9999-IfDefined.patch index 1b094100..959daa2d 100644 --- a/patches/wined3d-CSMT_Main/9999-IfDefined.patch +++ b/patches/wined3d-CSMT_Main/9999-IfDefined.patch @@ -6299,7 +6299,7 @@ diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c } else if (depth_stencil) { -@@ -4859,11 +4909,19 @@ static void scissorrect(struct wined3d_context *context, const struct wined3d_st +@@ -4859,13 +4909,21 @@ static void scissorrect(struct wined3d_context *context, const struct wined3d_st } else { @@ -6311,15 +6311,17 @@ diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c UINT height; UINT width; + if (target) + { +#if !defined(STAGING_CSMT) - wined3d_rendertarget_view_get_drawable_size(target, context, &width, &height); + wined3d_rendertarget_view_get_drawable_size(target, context, &width, &height); +#else /* STAGING_CSMT */ -+ surface_get_drawable_size(wined3d_rendertarget_view_get_surface(target), context, &width, &height); ++ surface_get_drawable_size(wined3d_rendertarget_view_get_surface(target), context, &width, &height); +#endif /* STAGING_CSMT */ - gl_info->gl_ops.gl.p_glScissor(r->left, height - r->bottom, r->right - r->left, r->bottom - r->top); - } - checkGLcall("glScissor"); -@@ -4935,7 +4993,11 @@ void state_srgbwrite(struct wined3d_context *context, const struct wined3d_state + gl_info->gl_ops.gl.p_glScissor(r->left, height - r->bottom, r->right - r->left, r->bottom - r->top); + } + else +@@ -4943,7 +5001,11 @@ void state_srgbwrite(struct wined3d_context *context, const struct wined3d_state TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id); diff --git a/patches/wined3d-Render_Target/0001-wined3d-Handle-no-render-target-view-case-when-setti.patch b/patches/wined3d-Render_Target/0001-wined3d-Handle-no-render-target-view-case-when-setti.patch new file mode 100644 index 00000000..a31058c7 --- /dev/null +++ b/patches/wined3d-Render_Target/0001-wined3d-Handle-no-render-target-view-case-when-setti.patch @@ -0,0 +1,35 @@ +From cdec706cd4fcff6adee4a40ddcf0c2072982b56e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20M=C3=BCller?= +Date: Sat, 21 Jan 2017 22:13:09 +0100 +Subject: wined3d: Handle no render target view case when setting scissors. + +--- + dlls/wined3d/state.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c +index 3c0bb5eb132..b7050be1b3b 100644 +--- a/dlls/wined3d/state.c ++++ b/dlls/wined3d/state.c +@@ -4853,8 +4853,16 @@ static void scissorrect(struct wined3d_context *context, const struct wined3d_st + UINT height; + UINT width; + +- wined3d_rendertarget_view_get_drawable_size(target, context, &width, &height); +- gl_info->gl_ops.gl.p_glScissor(r->left, height - r->bottom, r->right - r->left, r->bottom - r->top); ++ if (target) ++ { ++ wined3d_rendertarget_view_get_drawable_size(target, context, &width, &height); ++ gl_info->gl_ops.gl.p_glScissor(r->left, height - r->bottom, r->right - r->left, r->bottom - r->top); ++ } ++ else ++ { ++ /* There is nothing to render to anyway */ ++ gl_info->gl_ops.gl.p_glScissor(0, 0, 0, 0); ++ } + } + checkGLcall("glScissor"); + } +-- +2.11.0 + diff --git a/patches/wined3d-Render_Target/0002-wined3d-Set-draw-buffer-mask-to-zero-GL_NONE-when-no.patch b/patches/wined3d-Render_Target/0002-wined3d-Set-draw-buffer-mask-to-zero-GL_NONE-when-no.patch new file mode 100644 index 00000000..120fa81c --- /dev/null +++ b/patches/wined3d-Render_Target/0002-wined3d-Set-draw-buffer-mask-to-zero-GL_NONE-when-no.patch @@ -0,0 +1,26 @@ +From f0c26f58cc4c774adde80d9b8c02ca7b94adcaa9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20M=C3=BCller?= +Date: Sat, 21 Jan 2017 22:17:32 +0100 +Subject: wined3d: Set draw buffer mask to zero (GL_NONE) when no render target + view is attached. + +--- + dlls/wined3d/context.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c +index 6112b40e60f..d168c959e30 100644 +--- a/dlls/wined3d/context.c ++++ b/dlls/wined3d/context.c +@@ -2724,7 +2724,7 @@ static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const + if (wined3d_settings.offscreen_rendering_mode != ORM_FBO) + return context_generate_rt_mask_no_fbo(context, wined3d_rendertarget_view_get_surface(rts[0])->container); + else if (!context->render_offscreen) +- return context_generate_rt_mask_from_resource(rts[0]->resource); ++ return rts[0] ? context_generate_rt_mask_from_resource(rts[0]->resource) : 0; + + rt_mask = ps ? ps->reg_maps.rt_mask : 1; + rt_mask &= context->d3d_info->valid_rt_mask; +-- +2.11.0 + diff --git a/patches/wined3d-Render_Target/definition b/patches/wined3d-Render_Target/definition new file mode 100644 index 00000000..842d0ac2 --- /dev/null +++ b/patches/wined3d-Render_Target/definition @@ -0,0 +1 @@ +Fixes: Fix crash when trying to rendering without render target