From cc459b2b4f6e1e02dbd3896d06677c978d522a1c Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Mon, 20 Oct 2014 22:14:11 +0200 Subject: [PATCH] Added patch to filter out specific warning messages for D3DCompileShader. --- README.md | 5 ++ debian/changelog | 1 + patches/Makefile | 19 ++++ ...out-D3DCompile-warning-messages-that.patch | 87 +++++++++++++++++++ patches/d3dx9_36-Filter_Warnings/definition | 4 + 5 files changed, 116 insertions(+) create mode 100644 patches/d3dx9_36-Filter_Warnings/0001-d3dx9_36-Filter-out-D3DCompile-warning-messages-that.patch create mode 100644 patches/d3dx9_36-Filter_Warnings/definition diff --git a/README.md b/README.md index 25f57081..de0fcb5a 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,11 @@ Wine. All those differences are also documented on the Included bugfixes and improvements ================================== +**Bugfixes and features included in the next upcoming release [1]:** + +* D3DCompileShader should filter specific warning messages ([Wine Bug #33770](http://bugs.winehq.org/show_bug.cgi?id=33770)) + + **Bugs fixed in Wine-Compholio 1.7.29 [80]:** * ATL IOCS data should not be stored in GWLP_USERDATA ([Wine Bug #21767](http://bugs.winehq.org/show_bug.cgi?id=21767)) diff --git a/debian/changelog b/debian/changelog index 340be425..299b464d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,5 @@ wine-compholio (1.7.30) UNRELEASED; urgency=low + * Added patch to filter specific warning messages for D3DCompileShader. * Removed patch to avoid Clang compiler warning because of unused Vtable (accepted upstream). -- Sebastian Lackner Mon, 20 Oct 2014 19:53:47 +0200 diff --git a/patches/Makefile b/patches/Makefile index 7855b5ef..c9ecbd16 100644 --- a/patches/Makefile +++ b/patches/Makefile @@ -26,6 +26,7 @@ PATCHLIST := \ comctl32-LoadIconMetric.ok \ configure-Absolute_RPATH.ok \ configure-Detect_Gnutls.ok \ + d3dx9_36-Filter_Warnings.ok \ d3dx9_36-GetShaderSemantics.ok \ d3dx9_36-UpdateSkinnedMesh.ok \ dbghelp-KdHelp.ok \ @@ -301,6 +302,24 @@ configure-Detect_Gnutls.ok: echo '+ { "configure-Detect_Gnutls", "Sebastian Lackner", "Fix detection of gnutls on Ubuntu 14.10. [rev 3]" },'; \ ) > configure-Detect_Gnutls.ok +# Patchset d3dx9_36-Filter_Warnings +# | +# | Included patches: +# | * D3DCompileShader should filter specific warning messages. [by Christian Costa] +# | +# | This patchset fixes the following Wine bugs: +# | * [#33770] D3DCompileShader should filter specific warning messages +# | +# | Modified files: +# | * dlls/d3dx9_36/shader.c +# | +.INTERMEDIATE: d3dx9_36-Filter_Warnings.ok +d3dx9_36-Filter_Warnings.ok: + $(call APPLY_FILE,d3dx9_36-Filter_Warnings/0001-d3dx9_36-Filter-out-D3DCompile-warning-messages-that.patch) + @( \ + echo '+ { "d3dx9_36-Filter_Warnings", "Christian Costa", "D3DCompileShader should filter specific warning messages." },'; \ + ) > d3dx9_36-Filter_Warnings.ok + # Patchset d3dx9_36-GetShaderSemantics # | # | Included patches: diff --git a/patches/d3dx9_36-Filter_Warnings/0001-d3dx9_36-Filter-out-D3DCompile-warning-messages-that.patch b/patches/d3dx9_36-Filter_Warnings/0001-d3dx9_36-Filter-out-D3DCompile-warning-messages-that.patch new file mode 100644 index 00000000..89e878fc --- /dev/null +++ b/patches/d3dx9_36-Filter_Warnings/0001-d3dx9_36-Filter-out-D3DCompile-warning-messages-that.patch @@ -0,0 +1,87 @@ +From d258e0c4428f3d5b7c0b6f4b31058d8710244dd7 Mon Sep 17 00:00:00 2001 +From: Christian Costa +Date: Wed, 14 Aug 2013 09:31:31 +0200 +Subject: d3dx9_36: Filter out D3DCompile warning messages that are not present + with D3DCompileShader. + +This patch fixes vertex processing issue of bug 33770. + +The problem comes from the fact that even if the call succeeds, +the game interprets a non null error_messages pointer as an error. + +By calling D3DCompile we use a newer version of the compiler which is more +strict and generates the following warning. + - warning X3206: 'dot': implicit truncation of vector type + - warning X3206: implicit truncation of vector type + - warning X3206: 'mul': implicit truncation of vector type +D3DCompileShader does not generate such warnings. + +These is confirmed in the DX SDK release note: +New Warning X3206: Implicit Truncation of Vector Type +Beginning in the August 2009 release of the DirectX SDK, the compiler will warn +when an implicit truncation of a vector type occurs. + +The warnings cannot be disable so this patch filters out these strings in D3DCompileShader +and reset the error messages pointer if the resulting buffer is empty. + +Try 2: + - only filter out lines containing "X3206:" in case d3dcompiler_43 has localization + +Try 3: + - use move in place instead of copying the buffer + +Try 4: + - filter simplification by Sebastian and remove 'mul' testing left-out in search string +--- + dlls/d3dx9_36/shader.c | 35 +++++++++++++++++++++++++++++++++++ + 1 file changed, 35 insertions(+) + +diff --git a/dlls/d3dx9_36/shader.c b/dlls/d3dx9_36/shader.c +index 5ea3d13..646d3dc 100644 +--- a/dlls/d3dx9_36/shader.c ++++ b/dlls/d3dx9_36/shader.c +@@ -450,6 +450,41 @@ HRESULT WINAPI D3DXCompileShader(const char *data, UINT length, const D3DXMACRO + } + } + ++ /* Filter out D3DCompile warning messages that are not present with D3DCompileShader */ ++ if (SUCCEEDED(hr) && error_msgs && *error_msgs) ++ { ++ char *messages = ID3DXBuffer_GetBufferPointer(*error_msgs); ++ DWORD size = ID3DXBuffer_GetBufferSize(*error_msgs); ++ ++ /* Ensure messages are null terminated for safe processing */ ++ if (size) messages[size - 1] = 0; ++ ++ while (size > 1) ++ { ++ char *prev, *next; ++ ++ /* Warning has the form "warning X3206: ... implicit truncation of vector type" ++ but we only search for "X3206:" in case d3dcompiler_43 has localization */ ++ prev = next = strstr(messages, "X3206:"); ++ if (!prev) break; ++ ++ /* get pointer to beginning and end of current line */ ++ while (prev > messages && *(prev - 1) != '\n') prev--; ++ while (next < messages + size - 1 && *next != '\n') next++; ++ if (next < messages + size - 1 && *next == '\n') next++; ++ ++ memmove(prev, next, messages + size - next); ++ size -= (next - prev); ++ } ++ ++ /* Only return a buffer if the resulting string is not empty as some apps depend on that */ ++ if (size <= 1) ++ { ++ ID3DXBuffer_Release(*error_msgs); ++ *error_msgs = NULL; ++ } ++ } ++ + return hr; + } + +-- +2.1.2 + diff --git a/patches/d3dx9_36-Filter_Warnings/definition b/patches/d3dx9_36-Filter_Warnings/definition new file mode 100644 index 00000000..1344aa74 --- /dev/null +++ b/patches/d3dx9_36-Filter_Warnings/definition @@ -0,0 +1,4 @@ +Author: Christian Costa +Subject: D3DCompileShader should filter specific warning messages. +Revision: 1 +Fixes: [33770] D3DCompileShader should filter specific warning messages