[PATCH 0/1] MR5415: d3d10: Use older compiler for D3D10CompileEffectFromMemory().
Compilation output from D3D10CompileEffectFromMemory() always contains $Globals buffer, even if it's empty. That matches behaviour of 33-39 compilers. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> -- https://gitlab.winehq.org/wine/wine/-/merge_requests/5415
From: Nikolay Sivov <nsivov(a)codeweavers.com> Compilation output from D3D10CompileEffectFromMemory() always contains $Globals buffer, even if it's empty. That matches behaviour of 33-39 compilers. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- dlls/d3d10/Makefile.in | 2 +- dlls/d3d10/d3d10_main.c | 6 +++++- dlls/d3dcompiler_39/Makefile.in | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/dlls/d3d10/Makefile.in b/dlls/d3d10/Makefile.in index b942e27f991..ff260f6f5aa 100644 --- a/dlls/d3d10/Makefile.in +++ b/dlls/d3d10/Makefile.in @@ -1,6 +1,6 @@ MODULE = d3d10.dll IMPORTLIB = d3d10 -IMPORTS = uuid d3d10core d3dcompiler dxgi wined3d +IMPORTS = uuid d3d10core d3dcompiler_39 d3dcompiler dxgi wined3d EXTRADEFS = -DD3D_COMPILER_VERSION=0 PARENTSRC = ../d3dcompiler_43 EXTRAINCL = $(VKD3D_PE_CFLAGS) diff --git a/dlls/d3d10/d3d10_main.c b/dlls/d3d10/d3d10_main.c index 82c2ecc2ec9..8fd8fa4034c 100644 --- a/dlls/d3d10/d3d10_main.c +++ b/dlls/d3d10/d3d10_main.c @@ -24,6 +24,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d10); +extern HRESULT WINAPI D3DCompileFromMemory(const void *data, SIZE_T data_size, const char *filename, + const D3D_SHADER_MACRO *defines, ID3DInclude *include, const char *entrypoint, + const char *target, UINT sflags, UINT eflags, ID3DBlob **shader, ID3DBlob **error_messages); + #define WINE_D3D10_TO_STR(x) case x: return #x static const char *debug_d3d10_driver_type(D3D10_DRIVER_TYPE driver_type) @@ -239,7 +243,7 @@ HRESULT WINAPI D3D10CompileEffectFromMemory(void *data, SIZE_T data_size, const data, data_size, wine_dbgstr_a(filename), defines, include, hlsl_flags, fx_flags, effect, errors); - return D3DCompile(data, data_size, filename, defines, include, + return D3DCompileFromMemory(data, data_size, filename, defines, include, NULL, "fx_4_0", hlsl_flags, fx_flags, effect, errors); } diff --git a/dlls/d3dcompiler_39/Makefile.in b/dlls/d3dcompiler_39/Makefile.in index 2f9231871f1..4735aa18411 100644 --- a/dlls/d3dcompiler_39/Makefile.in +++ b/dlls/d3dcompiler_39/Makefile.in @@ -1,4 +1,5 @@ MODULE = d3dcompiler_39.dll +IMPORTLIB = d3dcompiler_39 IMPORTS = wined3d EXTRADEFS = -DD3D_COMPILER_VERSION=39 PARENTSRC = ../d3dcompiler_43 -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/5415
I guess it's proof that we're making serious progress with the compiler if we're starting to notice _xx version discrepancies, so good job everybody :smile: Can we add a test for this? I'd probably put it in d3dcompiler_43/tests/hlsl_d3d11.c:test_reflection(), simply checking that `GetConstantBufferByName("$Global")` returns non NULL iff D3D_COMPILER_VERSION >= 40 (which works for d3d10 since that has D3D_COMPILER_VERSION defined as 0). Second point: it's a bit annoying that this makes d3d10 import 2 versions of d3dcompiler at the same time. We can avoid that though, see the attachment. Feel free to make use of it as you prefer. [d3d10_compile.txt](/uploads/a8438df1832c3c733c56327c88023c35/d3d10_compile.txt) -- https://gitlab.winehq.org/wine/wine/-/merge_requests/5415#note_66385
participants (3)
-
Matteo Bruni (@Mystral) -
Nikolay Sivov -
Nikolay Sivov (@nsivov)