https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f6c4f5e79cf47274f43ab…
commit f6c4f5e79cf47274f43ab685565ae9dd10b6b300
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Sat Jan 4 02:11:30 2020 +0100
Commit: Jérôme Gardou <zefklop(a)users.noreply.github.com>
CommitDate: Wed Feb 26 18:19:18 2020 +0100
[WINESYNC]d3dx9_36: Filter out D3DCompile warning messages that are not present with
D3DCompileShader. (try 4)
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
wine-staging patch by Christian Costa <titan.costa(a)gmail.com>
---
dll/directx/wine/d3dx9_36/shader.c | 35 ++++++++++++++++
...not_present_with_D3DCompileShader._(try_4).diff | 46 ++++++++++++++++++++++
2 files changed, 81 insertions(+)
diff --git a/dll/directx/wine/d3dx9_36/shader.c b/dll/directx/wine/d3dx9_36/shader.c
index 7a23867ba31..fc0f503c697 100644
--- a/dll/directx/wine/d3dx9_36/shader.c
+++ b/dll/directx/wine/d3dx9_36/shader.c
@@ -441,6 +441,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;
}
diff --git
a/sdk/tools/winesync/d3dx9_staging/0021-d3dx9_36__Filter_out_D3DCompile_warning_messages_that_are_not_present_with_D3DCompileShader._(try_4).diff
b/sdk/tools/winesync/d3dx9_staging/0021-d3dx9_36__Filter_out_D3DCompile_warning_messages_that_are_not_present_with_D3DCompileShader._(try_4).diff
new file mode 100644
index 00000000000..aba59a121ad
--- /dev/null
+++
b/sdk/tools/winesync/d3dx9_staging/0021-d3dx9_36__Filter_out_D3DCompile_warning_messages_that_are_not_present_with_D3DCompileShader._(try_4).diff
@@ -0,0 +1,46 @@
+diff --git a/dll/directx/wine/d3dx9_36/shader.c b/dll/directx/wine/d3dx9_36/shader.c
+index 7a23867..fc0f503 100644
+--- a/dll/directx/wine/d3dx9_36/shader.c
++++ b/dll/directx/wine/d3dx9_36/shader.c
+@@ -441,6 +441,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;
+ }
+