Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- d3dcompiler.h is normally supposed to define it, let's update our expectations.
dlls/d3d10/Makefile.in | 1 + dlls/d3dcompiler_43/reflection.c | 2 +- dlls/d3dcompiler_43/utils.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/dlls/d3d10/Makefile.in b/dlls/d3d10/Makefile.in index 50807a295a9..d54f6f70cba 100644 --- a/dlls/d3d10/Makefile.in +++ b/dlls/d3d10/Makefile.in @@ -1,6 +1,7 @@ MODULE = d3d10.dll IMPORTLIB = d3d10 IMPORTS = uuid d3d10core d3dcompiler dxgi +EXTRADEFS = -DD3D_COMPILER_VERSION=0 PARENTSRC = ../d3dcompiler_43
EXTRADLLFLAGS = -mno-cygwin diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index d3d083e8d8c..9a230d8d913 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -1807,7 +1807,7 @@ err_out: }
/* d3d10 reflection methods. */ -#ifndef D3D_COMPILER_VERSION +#if !D3D_COMPILER_VERSION static inline struct d3dcompiler_shader_reflection *impl_from_ID3D10ShaderReflection(ID3D10ShaderReflection *iface) { return CONTAINING_RECORD(iface, struct d3dcompiler_shader_reflection, ID3D10ShaderReflection_iface); diff --git a/dlls/d3dcompiler_43/utils.c b/dlls/d3dcompiler_43/utils.c index 27c0ba8c916..1436ed6bf3e 100644 --- a/dlls/d3dcompiler_43/utils.c +++ b/dlls/d3dcompiler_43/utils.c @@ -758,7 +758,7 @@ void compilation_message(struct compilation_messages *msg, const char *fmt, __ms } }
-#ifdef D3D_COMPILER_VERSION +#if D3D_COMPILER_VERSION BOOL add_declaration(struct hlsl_scope *scope, struct hlsl_ir_var *decl, BOOL local_var) { struct hlsl_ir_var *var;
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- include/d3dcompiler.h | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/include/d3dcompiler.h b/include/d3dcompiler.h index 5151f94510a..bd1b3d1d44d 100644 --- a/include/d3dcompiler.h +++ b/include/d3dcompiler.h @@ -34,6 +34,10 @@ static const WCHAR D3DCOMPILER_DLL_W[] = {'d','3','d','c','o','m','p','i','l','e #define D3DCOMPILER_DLL_A "d3dcompiler_47.dll" #define D3DCOMPILER_DLL WINELIB_NAME_AW(D3DCOMPILER_DLL_)
+#ifndef D3D_COMPILER_VERSION +#define D3D_COMPILER_VERSION 47 +#endif + #define D3DCOMPILE_DEBUG 0x00000001 #define D3DCOMPILE_SKIP_VALIDATION 0x00000002 #define D3DCOMPILE_SKIP_OPTIMIZATION 0x00000004
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- include/d3d11shader.h | 3 +++ include/d3dcommon.idl | 12 ++++++++++++ 2 files changed, 15 insertions(+)
diff --git a/include/d3d11shader.h b/include/d3d11shader.h index 479020abbe5..501d01ee84a 100644 --- a/include/d3d11shader.h +++ b/include/d3d11shader.h @@ -130,6 +130,9 @@ typedef struct _D3D11_SIGNATURE_PARAMETER_DESC BYTE Mask; BYTE ReadWriteMask; UINT Stream; +#if D3D_COMPILER_VERSION >= 46 + D3D_MIN_PRECISION MinPrecision; +#endif } D3D11_SIGNATURE_PARAMETER_DESC;
DEFINE_GUID(IID_ID3D11ShaderReflectionType, 0x6e6ffa6a, 0x9bae, 0x4613, 0xa5, 0x1e, 0x91, 0x65, 0x2d, 0x50, 0x8c, 0x21); diff --git a/include/d3dcommon.idl b/include/d3dcommon.idl index 5e38658f89b..29404efd69d 100644 --- a/include/d3dcommon.idl +++ b/include/d3dcommon.idl @@ -490,6 +490,18 @@ typedef enum D3D_TESSELLATOR_OUTPUT_PRIMITIVE D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CCW, } D3D_TESSELLATOR_OUTPUT_PRIMITIVE;
+typedef enum D3D_MIN_PRECISION +{ + D3D_MIN_PRECISION_DEFAULT = 0, + D3D_MIN_PRECISION_FLOAT_16 = 1, + D3D_MIN_PRECISION_FLOAT_2_8 = 2, + D3D_MIN_PRECISION_RESERVED = 3, + D3D_MIN_PRECISION_SINT_16 = 4, + D3D_MIN_PRECISION_UINT_16 = 5, + D3D_MIN_PRECISION_ANY_16 = 0xf0, + D3D_MIN_PRECISION_ANY_10 = 0xf1, +} D3D_MIN_PRECISION; + typedef enum D3D_CBUFFER_TYPE { D3D_CT_CBUFFER,
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3dcompiler_43/reflection.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index 9a230d8d913..ac24ba0a2d0 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -475,17 +475,17 @@ static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetResourceBindin static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetInputParameterDesc( ID3D11ShaderReflection *iface, UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc) { - struct d3dcompiler_shader_reflection *This = impl_from_ID3D11ShaderReflection(iface); + struct d3dcompiler_shader_reflection *reflection = impl_from_ID3D11ShaderReflection(iface);
TRACE("iface %p, index %u, desc %p\n", iface, index, desc);
- if (!desc || !This->isgn || index >= This->isgn->element_count) + if (!desc || !reflection->isgn || index >= reflection->isgn->element_count) { WARN("Invalid argument specified\n"); return E_INVALIDARG; }
- *desc = This->isgn->elements[index]; + *desc = reflection->isgn->elements[index];
return S_OK; } @@ -493,17 +493,17 @@ static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetInputParameter static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetOutputParameterDesc( ID3D11ShaderReflection *iface, UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc) { - struct d3dcompiler_shader_reflection *This = impl_from_ID3D11ShaderReflection(iface); + struct d3dcompiler_shader_reflection *reflection = impl_from_ID3D11ShaderReflection(iface);
TRACE("iface %p, index %u, desc %p\n", iface, index, desc);
- if (!desc || !This->osgn || index >= This->osgn->element_count) + if (!desc || !reflection->osgn || index >= reflection->osgn->element_count) { WARN("Invalid argument specified\n"); return E_INVALIDARG; }
- *desc = This->osgn->elements[index]; + *desc = reflection->osgn->elements[index];
return S_OK; } @@ -511,17 +511,17 @@ static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetOutputParamete static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetPatchConstantParameterDesc( ID3D11ShaderReflection *iface, UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc) { - struct d3dcompiler_shader_reflection *This = impl_from_ID3D11ShaderReflection(iface); + struct d3dcompiler_shader_reflection *reflection = impl_from_ID3D11ShaderReflection(iface);
TRACE("iface %p, index %u, desc %p\n", iface, index, desc);
- if (!desc || !This->pcsg || index >= This->pcsg->element_count) + if (!desc || !reflection->pcsg || index >= reflection->pcsg->element_count) { WARN("Invalid argument specified\n"); return E_INVALIDARG; }
- *desc = This->pcsg->elements[index]; + *desc = reflection->pcsg->elements[index];
return S_OK; } @@ -1621,6 +1621,10 @@ static HRESULT d3dcompiler_parse_signature(struct d3dcompiler_shader_signature * UINT name_offset; DWORD mask;
+#if D3D_COMPILER_VERSION >= 46 + /* FIXME */ + d[i].MinPrecision = D3D_MIN_PRECISION_DEFAULT; +#endif if (element_size == D3DCOMPILER_SIGNATURE_ELEMENT_SIZE7) { read_dword(&ptr, &d[i].Stream);
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3dcompiler_43/reflection.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index ac24ba0a2d0..f480c72986f 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -2005,13 +2005,21 @@ HRESULT WINAPI D3DReflect(const void *data, SIZE_T data_size, REFIID riid, void if (temp[6] != data_size) { WARN("Wrong size supplied.\n"); +#if D3D_COMPILER_VERSION >= 46 + return D3DERR_INVALIDCALL; +#else return E_FAIL; +#endif }
if (!IsEqualGUID(riid, &IID_ID3D11ShaderReflection)) { WARN("Wrong riid %s, accept only %s!\n", debugstr_guid(riid), debugstr_guid(&IID_ID3D11ShaderReflection)); +#if D3D_COMPILER_VERSION >= 46 + return E_INVALIDARG; +#else return E_NOINTERFACE; +#endif }
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
On Tue, 12 Nov 2019 at 22:33, Matteo Bruni mbruni@codeweavers.com wrote:
@@ -2005,13 +2005,21 @@ HRESULT WINAPI D3DReflect(const void *data, SIZE_T data_size, REFIID riid, void if (temp[6] != data_size) { WARN("Wrong size supplied.\n"); +#if D3D_COMPILER_VERSION >= 46
return D3DERR_INVALIDCALL;
+#else return E_FAIL; +#endif }
It's perhaps worth noting that "if (D3D_COMPILER_VERSION >= 46)" would work just as well, and would avoid some conditional compilation.
Share the code with the existing d3dcompiler_43 tests.
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- configure | 1 + configure.ac | 1 + dlls/d3dcompiler_43/tests/reflection.c | 44 ++++++++++++++++++-------- 3 files changed, 32 insertions(+), 14 deletions(-)
diff --git a/configure b/configure index ad0b149b7d3..e40850201b6 100755 --- a/configure +++ b/configure @@ -20255,6 +20255,7 @@ wine_fn_config_makefile dlls/d3dcompiler_43 enable_d3dcompiler_43 wine_fn_config_makefile dlls/d3dcompiler_43/tests enable_tests wine_fn_config_makefile dlls/d3dcompiler_46 enable_d3dcompiler_46 wine_fn_config_makefile dlls/d3dcompiler_47 enable_d3dcompiler_47 +wine_fn_config_makefile dlls/d3dcompiler_47/tests enable_tests wine_fn_config_makefile dlls/d3dim enable_d3dim wine_fn_config_makefile dlls/d3drm enable_d3drm wine_fn_config_makefile dlls/d3drm/tests enable_tests diff --git a/configure.ac b/configure.ac index 4f651efbd58..c7768db9f9e 100644 --- a/configure.ac +++ b/configure.ac @@ -3131,6 +3131,7 @@ WINE_CONFIG_MAKEFILE(dlls/d3dcompiler_43) WINE_CONFIG_MAKEFILE(dlls/d3dcompiler_43/tests) WINE_CONFIG_MAKEFILE(dlls/d3dcompiler_46) WINE_CONFIG_MAKEFILE(dlls/d3dcompiler_47) +WINE_CONFIG_MAKEFILE(dlls/d3dcompiler_47/tests) WINE_CONFIG_MAKEFILE(dlls/d3dim) WINE_CONFIG_MAKEFILE(dlls/d3drm) WINE_CONFIG_MAKEFILE(dlls/d3drm/tests) diff --git a/dlls/d3dcompiler_43/tests/reflection.c b/dlls/d3dcompiler_43/tests/reflection.c index 1b9d2d418d9..8e48d4d4028 100644 --- a/dlls/d3dcompiler_43/tests/reflection.c +++ b/dlls/d3dcompiler_43/tests/reflection.c @@ -75,11 +75,11 @@ static DWORD test_reflection_blob[] = {
static void test_reflection_references(void) { - HRESULT hr; - ULONG count; ID3D11ShaderReflection *ref11, *ref11_test; - ID3D10ShaderReflection *ref10; ID3D10ShaderReflection1 *ref10_1; + ID3D10ShaderReflection *ref10; + HRESULT hr, expected; + ULONG count;
hr = pD3DReflect(test_reflection_blob, test_reflection_blob[6], &IID_ID3D11ShaderReflection, (void **)&ref11); ok(hr == S_OK, "D3DReflect failed, got %x, expected %x\n", hr, S_OK); @@ -100,11 +100,16 @@ static void test_reflection_references(void) ok(count == 0, "Release failed %u\n", count);
/* check invalid cases */ +#if D3D_COMPILER_VERSION >= 46 + expected = E_INVALIDARG; +#else + expected = E_NOINTERFACE; +#endif hr = pD3DReflect(test_reflection_blob, test_reflection_blob[6], &IID_ID3D10ShaderReflection, (void **)&ref10); - ok(hr == E_NOINTERFACE, "D3DReflect failed, got %x, expected %x\n", hr, E_NOINTERFACE); + ok(hr == expected, "D3DReflect failed, got %x, expected %x\n", hr, expected);
hr = pD3DReflect(test_reflection_blob, test_reflection_blob[6], &IID_ID3D10ShaderReflection1, (void **)&ref10_1); - ok(hr == E_NOINTERFACE, "D3DReflect failed, got %x, expected %x\n", hr, E_NOINTERFACE); + ok(hr == expected, "D3DReflect failed, got %x, expected %x\n", hr, expected);
hr = pD3DReflect(NULL, test_reflection_blob[6], &IID_ID3D10ShaderReflection1, (void **)&ref10_1); ok(hr == D3DERR_INVALIDCALL, "D3DReflect failed, got %x, expected %x\n", hr, D3DERR_INVALIDCALL); @@ -116,20 +121,25 @@ static void test_reflection_references(void) hr = pD3DReflect(test_reflection_blob, 31, &IID_ID3D10ShaderReflection1, (void **)&ref10_1); ok(hr == D3DERR_INVALIDCALL, "D3DReflect failed, got %x, expected %x\n", hr, D3DERR_INVALIDCALL);
+#if D3D_COMPILER_VERSION >= 46 + expected = D3DERR_INVALIDCALL; +#else + expected = E_FAIL; +#endif hr = pD3DReflect(test_reflection_blob, 32, &IID_ID3D10ShaderReflection1, (void **)&ref10_1); - ok(hr == E_FAIL, "D3DReflect failed, got %x, expected %x\n", hr, E_FAIL); + ok(hr == expected, "Got %x, expected %x.\n", hr, expected);
hr = pD3DReflect(test_reflection_blob, test_reflection_blob[6]-1, &IID_ID3D10ShaderReflection1, (void **)&ref10_1); - ok(hr == E_FAIL, "D3DReflect failed, got %x, expected %x\n", hr, E_FAIL); + ok(hr == expected, "Got %x, expected %x.\n", hr, expected);
hr = pD3DReflect(test_reflection_blob, 31, &IID_ID3D11ShaderReflection, (void **)&ref11); - ok(hr == D3DERR_INVALIDCALL, "D3DReflect failed, got %x, expected %x\n", hr, D3DERR_INVALIDCALL); + ok(hr == D3DERR_INVALIDCALL, "Got %x, expected %x.\n", hr, D3DERR_INVALIDCALL);
hr = pD3DReflect(test_reflection_blob, 32, &IID_ID3D11ShaderReflection, (void **)&ref11); - ok(hr == E_FAIL, "D3DReflect failed, got %x, expected %x\n", hr, E_FAIL); + ok(hr == expected, "Got %x, expected %x.\n", hr, expected);
hr = pD3DReflect(test_reflection_blob, test_reflection_blob[6]-1, &IID_ID3D11ShaderReflection, (void **)&ref11); - ok(hr == E_FAIL, "D3DReflect failed, got %x, expected %x\n", hr, E_FAIL); + ok(hr == expected, "Got %x, expected %x.\n", hr, expected); }
/* @@ -1509,11 +1519,17 @@ static void test_reflection_constant_buffer(void) ok(count == 0, "Release failed %u\n", count); }
-static BOOL load_d3dcompiler(void) +static BOOL load_d3dreflect(void) { +#if D3D_COMPILER_VERSION == 47 + static const char filename[] = "d3dcompiler_47.dll"; +#else + static const char filename[] = "d3dcompiler_43.dll"; +#endif HMODULE module;
- if (!(module = LoadLibraryA("d3dcompiler_43.dll"))) return FALSE; + if (!(module = LoadLibraryA(filename))) + return FALSE;
pD3DReflect = (void*)GetProcAddress(module, "D3DReflect"); return TRUE; @@ -1521,9 +1537,9 @@ static BOOL load_d3dcompiler(void)
START_TEST(reflection) { - if (!load_d3dcompiler()) + if (!load_d3dreflect()) { - win_skip("Could not load d3dcompiler_43.dll\n"); + win_skip("Could not load DLL.\n"); return; }
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=59903
Your paranoid android.
=== build (build log) ===
../wine/dlls/d3dcompiler_47/tests/Makefile.in: error: open : No such file or directory config.status: error: could not create Makefile Makefile:1554: recipe for target 'Makefile' failed Task: The Wine native tools build failed
=== debian10 (build log) ===
../wine/dlls/d3dcompiler_47/tests/Makefile.in: error: open : No such file or directory config.status: error: could not create Makefile Task: The win32 build failed
=== debian10 (build log) ===
../wine/dlls/d3dcompiler_47/tests/Makefile.in: error: open : No such file or directory config.status: error: could not create Makefile Task: The wow64 build failed
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3dcompiler_43/tests/reflection.c | 37 +++++++++++++++++++++----- 1 file changed, 31 insertions(+), 6 deletions(-)
diff --git a/dlls/d3dcompiler_43/tests/reflection.c b/dlls/d3dcompiler_43/tests/reflection.c index 8e48d4d4028..fb117fd6a9c 100644 --- a/dlls/d3dcompiler_43/tests/reflection.c +++ b/dlls/d3dcompiler_43/tests/reflection.c @@ -296,16 +296,31 @@ static const D3D11_SIGNATURE_PARAMETER_DESC test_reflection_desc_vs_resultout[] {"SV_InstanceID", 0, 6, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_UINT32, 0x1, 0xe, 0}, };
+struct D3D11_SIGNATURE_PARAMETER_DESC_46 +{ + const char *SemanticName; + UINT SemanticIndex; + UINT Register; + D3D_NAME SystemValueType; + D3D_REGISTER_COMPONENT_TYPE ComponentType; + BYTE Mask; + BYTE ReadWriteMask; + UINT Stream; + D3D_MIN_PRECISION MinPrecision; +}; + static void test_reflection_desc_vs(void) { - HRESULT hr; - ULONG count; - ID3D11ShaderReflection *ref11; - D3D11_SHADER_DESC sdesc11 = {0}; - D3D11_SIGNATURE_PARAMETER_DESC desc = {0}; + struct D3D11_SIGNATURE_PARAMETER_DESC_46 desc_46 = {0}; const D3D11_SIGNATURE_PARAMETER_DESC *pdesc; - UINT ret; + D3D11_SIGNATURE_PARAMETER_DESC desc = {0}; + D3D_MIN_PRECISION expected_min_prec; + D3D11_SHADER_DESC sdesc11 = {0}; + ID3D11ShaderReflection *ref11; unsigned int i; + ULONG count; + HRESULT hr; + UINT ret;
hr = pD3DReflect(test_reflection_desc_vs_blob, test_reflection_desc_vs_blob[6], &IID_ID3D11ShaderReflection, (void **)&ref11); ok(hr == S_OK, "D3DReflect failed %x\n", hr); @@ -368,6 +383,16 @@ static void test_reflection_desc_vs(void) ok(ret == 0, "GetMovcInstructionCount failed, got %u, expected %u\n", ret, 0);
/* GetIn/OutputParameterDesc */ + desc_46.MinPrecision = ~0u; + hr = ref11->lpVtbl->GetInputParameterDesc(ref11, 0, (D3D11_SIGNATURE_PARAMETER_DESC *)&desc_46); +#if D3D_COMPILER_VERSION >= 46 + expected_min_prec = 0; +#else + expected_min_prec = ~0u; +#endif + ok(desc_46.MinPrecision == expected_min_prec, "Got MinPrecision %#x, expected %#x.\n", + desc_46.MinPrecision, expected_min_prec); + for (i = 0; i < ARRAY_SIZE(test_reflection_desc_vs_resultin); ++i) { pdesc = &test_reflection_desc_vs_resultin[i];
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=59904
Your paranoid android.
=== build (build log) ===
../wine/dlls/d3dcompiler_47/tests/Makefile.in: error: open : No such file or directory config.status: error: could not create Makefile Makefile:1548: recipe for target 'Makefile' failed Task: The exe32 Wine crossbuild failed
=== debian10 (build log) ===
../wine/dlls/d3dcompiler_47/tests/Makefile.in: error: open : No such file or directory config.status: error: could not create Makefile Task: The win32 build failed
=== debian10 (build log) ===
../wine/dlls/d3dcompiler_47/tests/Makefile.in: error: open : No such file or directory config.status: error: could not create Makefile Task: The wow64 build failed