[PATCH] d3dx9/shader: Set backwards compatibility compile flag at preprocessing.

Matteo Bruni matteo.mystral at gmail.com
Fri Aug 27 04:57:04 CDT 2021


On Fri, Aug 27, 2021 at 7:25 AM Nikolay Sivov <nsivov at codeweavers.com> wrote:
>
> Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
> ---
>  dlls/d3dx9_36/shader.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/dlls/d3dx9_36/shader.c b/dlls/d3dx9_36/shader.c
> index 7033972af36..6dc145a4faa 100644
> --- a/dlls/d3dx9_36/shader.c
> +++ b/dlls/d3dx9_36/shader.c
> @@ -424,8 +424,9 @@ HRESULT WINAPI D3DXCompileShader(const char *data, UINT length, const D3DXMACRO
>              debugstr_a(data), length, defines, include, debugstr_a(function), debugstr_a(profile),
>              flags, shader, error_msgs, constant_table);
>
> -    if (D3DX_SDK_VERSION <= 36)
> -        flags |= D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY;
> +#if D3DX_SDK_VERSION <= 36
> +    flags |= D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY;
> +#endif
>
>      hr = D3DCompile(data, length, NULL, (D3D_SHADER_MACRO *)defines, (ID3DInclude *)include,
>                      function, profile, flags, 0, (ID3DBlob **)shader, (ID3DBlob **)error_msgs);
> @@ -507,8 +508,9 @@ HRESULT WINAPI D3DXCompileShaderFromFileW(const WCHAR *filename, const D3DXMACRO
>          return D3DXERR_INVALIDDATA;
>      }
>
> -    if (D3DX_SDK_VERSION <= 36)
> -        flags |= D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY;
> +#if D3DX_SDK_VERSION <= 36
> +    flags |= D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY;
> +#endif
>
>      hr = D3DCompile(buffer, len, filename_a, (const D3D_SHADER_MACRO *)defines,
>                      (ID3DInclude *)include, entrypoint, profile, flags, 0,

Some mailing list archeology suggests that Paul originally sent his
patch exactly like this
(https://www.winehq.org/pipermail/wine-devel/2020-January/157593.html)
and then I resent it changed to the current version
(https://www.winehq.org/pipermail/wine-devel/2020-January/157641.html).
I guess that the reason for my change was to reduce the amount of
#ifdefs and, possibly, to make the code "ready" to be shared via a
common library instead of multiple recompilations (PARENTSRC).

I'm not attached to the current solution but the change requires some
motivation IMO. I don't expect the generated code to differ at all
either way.



More information about the wine-devel mailing list