diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 34c385fd..eb7d1898 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -433,6 +433,7 @@ patch_enable_all () enable_wined3d_Accounting="$1" enable_wined3d_CSMT_Helper="$1" enable_wined3d_CSMT_Main="$1" + enable_wined3d_Core_Context="$1" enable_wined3d_DXTn="$1" enable_wined3d_GTX_560M="$1" enable_wined3d_Limit_Vram="$1" @@ -1551,6 +1552,9 @@ patch_enable () wined3d-CSMT_Main) enable_wined3d_CSMT_Main="$2" ;; + wined3d-Core_Context) + enable_wined3d_Core_Context="$2" + ;; wined3d-DXTn) enable_wined3d_DXTn="$2" ;; @@ -2125,6 +2129,13 @@ if test "$enable_wined3d_CSMT_Main" -eq 1; then enable_wined3d_CSMT_Helper=1 fi +if test "$enable_wined3d_Core_Context" -eq 1; then + if test "$enable_d3d11_Depth_Bias" -gt 1; then + abort "Patchset d3d11-Depth_Bias disabled, but wined3d-Core_Context depends on that." + fi + enable_d3d11_Depth_Bias=1 +fi + if test "$enable_wined3d_CSMT_Helper" -eq 1; then if test "$enable_d3d11_Deferred_Context" -gt 1; then abort "Patchset d3d11-Deferred_Context disabled, but wined3d-CSMT_Helper depends on that." @@ -9155,6 +9166,21 @@ if test "$enable_wined3d_CSMT_Helper" -eq 1; then ) >> "$patchlist" fi +# Patchset wined3d-Core_Context +# | +# | This patchset has the following (direct or indirect) dependencies: +# | * d3d11-Depth_Bias +# | +# | Modified files: +# | * dlls/dxgi/factory.c, dlls/wined3d/directx.c, include/wine/wined3d.h +# | +if test "$enable_wined3d_Core_Context" -eq 1; then + patch_apply wined3d-Core_Context/0001-wined3d-Use-OpenGL-core-context-for-D3D10-11-when-ne.patch + ( + printf '%s\n' '+ { "Michael Müller", "wined3d: Use OpenGL core context for D3D10/11 when necessary.", 1 },'; + ) >> "$patchlist" +fi + # Patchset wined3d-GTX_560M # | # | Modified files: diff --git a/patches/wined3d-Core_Context/0001-wined3d-Use-OpenGL-core-context-for-D3D10-11-when-ne.patch b/patches/wined3d-Core_Context/0001-wined3d-Use-OpenGL-core-context-for-D3D10-11-when-ne.patch new file mode 100644 index 00000000..620c991e --- /dev/null +++ b/patches/wined3d-Core_Context/0001-wined3d-Use-OpenGL-core-context-for-D3D10-11-when-ne.patch @@ -0,0 +1,101 @@ +From 844796a26ebe527847f1c1a46c1a1cf8ec9c29b1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20M=C3=BCller?= +Date: Sun, 9 Jul 2017 17:04:05 +0200 +Subject: wined3d: Use OpenGL core context for D3D10/11 when necessary. + +--- + dlls/dxgi/factory.c | 2 +- + dlls/wined3d/directx.c | 29 ++++++++++++++++++++++++++--- + include/wine/wined3d.h | 1 + + 3 files changed, 28 insertions(+), 4 deletions(-) + +diff --git a/dlls/dxgi/factory.c b/dlls/dxgi/factory.c +index c218276a220..49c0a10a95d 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(WINED3D_FORWARD_DEPTH_BIAS); ++ factory->wined3d = wined3d_create(WINED3D_FORWARD_DEPTH_BIAS | WINED3D_REQUEST_D3D10); + wined3d_mutex_unlock(); + if (!factory->wined3d) + { +diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c +index 68d7e8cba0f..ea70b4b27cb 100644 +--- a/dlls/wined3d/directx.c ++++ b/dlls/wined3d/directx.c +@@ -6522,6 +6522,18 @@ static void wined3d_adapter_init_fb_cfgs(struct wined3d_adapter *adapter, HDC dc + } + } + ++static BOOL has_extension(const char *list, const char *ext) ++{ ++ size_t len = strlen(ext); ++ while (list) ++ { ++ while (*list == ' ') list++; ++ if (!strncmp(list, ext, len) && (!list[len] || list[len] == ' ')) return TRUE; ++ list = strchr(list, ' '); ++ } ++ return FALSE; ++} ++ + static BOOL wined3d_adapter_init(struct wined3d_adapter *adapter, UINT ordinal, DWORD wined3d_creation_flags) + { + static const DWORD supported_gl_versions[] = +@@ -6531,8 +6543,9 @@ static BOOL wined3d_adapter_init(struct wined3d_adapter *adapter, UINT ordinal, + }; + struct wined3d_gl_info *gl_info = &adapter->gl_info; + struct wined3d_caps_gl_ctx caps_gl_ctx = {0}; +- unsigned int i; ++ DWORD max_gl_version = wined3d_settings.max_gl_version; + DISPLAY_DEVICEW display_device; ++ unsigned int i; + + TRACE("adapter %p, ordinal %u.\n", adapter, ordinal); + +@@ -6577,15 +6590,25 @@ static BOOL wined3d_adapter_init(struct wined3d_adapter *adapter, UINT ordinal, + return FALSE; + } + ++ if (wined3d_creation_flags & WINED3D_REQUEST_D3D10) ++ { ++ const char *gl_extensions = (const char *)gl_info->gl_ops.gl.p_glGetString(GL_EXTENSIONS); ++ if (!has_extension(gl_extensions, "GL_ARB_compatibility")) ++ { ++ ERR_(winediag)("GL_ARB_compatibility not supported, requesting context with GL version 3.2.\n"); ++ max_gl_version = MAKEDWORD_VERSION(3, 2); ++ } ++ } ++ + for (i = 0; i < ARRAY_SIZE(supported_gl_versions); ++i) + { +- if (supported_gl_versions[i] <= wined3d_settings.max_gl_version) ++ if (supported_gl_versions[i] <= max_gl_version) + break; + } + if (i == ARRAY_SIZE(supported_gl_versions)) + { + ERR_(winediag)("Requested invalid GL version %u.%u.\n", +- wined3d_settings.max_gl_version >> 16, wined3d_settings.max_gl_version & 0xffff); ++ max_gl_version >> 16, max_gl_version & 0xffff); + i = ARRAY_SIZE(supported_gl_versions) - 1; + } + +diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h +index 90862d61535..11a5bc4e933 100644 +--- a/include/wine/wined3d.h ++++ b/include/wine/wined3d.h +@@ -1312,6 +1312,7 @@ enum wined3d_shader_byte_code_format + #define WINED3D_NO_PRIMITIVE_RESTART 0x00000800 + #define WINED3D_LEGACY_CUBEMAP_FILTERING 0x00001000 + #define WINED3D_FORWARD_DEPTH_BIAS 0x00002000 ++#define WINED3D_REQUEST_D3D10 0x00004000 + + #define WINED3D_RESZ_CODE 0x7fa05000 + +-- +2.13.1 + diff --git a/patches/wined3d-Core_Context/definition b/patches/wined3d-Core_Context/definition new file mode 100644 index 00000000..24c67796 --- /dev/null +++ b/patches/wined3d-Core_Context/definition @@ -0,0 +1,2 @@ +Fixes: Use OpenGL core context for D3D10/11 when necessary +Depends: d3d11-Depth_Bias