This series of patches moves the DX10 Shader Reflection handling into the d3dcompiler_43 implementation. These patches should be more in line with what was suggested with the last series of patches. The only missing methods are those for GetConstantBufferByIndex/Name, which are currently in the works. For the time being, I just want to make sure that I'm on the right track.
Connor McAdams (8): d3d10: move parse_dxbc + helpers into effects.c d3d10: rename utils.c to debug.c d3d10+d3dcompiler: add PARENTSRC and fix definition conflicts d3d10+d3dcompiler: Move d3d10 reflection into d3dcompiler. d3dcompiler: Add shader init to D3D10ReflectShader d3dcompiler: implement d3d10 reflection GetDesc method. d3dcompiler: Implement Input/OutputParameterDesc method d3dcompiler: GetResourceBindingDesc for d3d10 reflect shader.
dlls/d3d10/Makefile.in | 5 +- dlls/d3d10/d3d10_main.c | 22 --- dlls/d3d10/d3d10_private.h | 14 -- dlls/d3d10/{utils.c => debug.c} | 101 -------------- dlls/d3d10/effect.c | 101 ++++++++++++++ dlls/d3d10/shader.c | 112 ---------------- dlls/d3dcompiler_43/reflection.c | 224 ++++++++++++++++++++++++++++++- dlls/d3dcompiler_43/utils.c | 2 + 8 files changed, 328 insertions(+), 253 deletions(-) rename dlls/d3d10/{utils.c => debug.c} (66%)
parse_dxbc is only used in effects.c, so having it in utils.c isn't necessary.
Signed-off-by: Connor McAdams conmanx360@gmail.com --- dlls/d3d10/d3d10_private.h | 6 --- dlls/d3d10/effect.c | 101 +++++++++++++++++++++++++++++++++++++ dlls/d3d10/utils.c | 101 ------------------------------------- 3 files changed, 101 insertions(+), 107 deletions(-)
diff --git a/dlls/d3d10/d3d10_private.h b/dlls/d3d10/d3d10_private.h index f3fce9c569..2fe6183e15 100644 --- a/dlls/d3d10/d3d10_private.h +++ b/dlls/d3d10/d3d10_private.h @@ -278,9 +278,6 @@ HRESULT WINAPI D3D10CoreCreateDevice(IDXGIFactory *factory, IDXGIAdapter *adapte #define TAG_OSGN MAKE_TAG('O', 'S', 'G', 'N') #define TAG_SHDR MAKE_TAG('S', 'H', 'D', 'R')
-HRESULT parse_dxbc(const char *data, SIZE_T data_size, - HRESULT (*chunk_handler)(const char *data, DWORD data_size, DWORD tag, void *ctx), void *ctx) DECLSPEC_HIDDEN; - static inline void read_dword(const char **ptr, DWORD *d) { memcpy(d, *ptr, sizeof(*d)); @@ -298,7 +295,4 @@ static inline BOOL require_space(size_t offset, size_t count, size_t size, size_ return !count || (data_size - offset) / count >= size; }
-void skip_dword_unknown(const char *location, const char **ptr, unsigned int count) DECLSPEC_HIDDEN; -void write_dword_unknown(char **ptr, DWORD d) DECLSPEC_HIDDEN; - #endif /* __WINE_D3D10_PRIVATE_H */ diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index 439833485d..ba5b033b0c 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -241,6 +241,107 @@ static const struct d3d10_effect_state_storage_info d3d10_effect_state_storage_i {D3D10_SVT_SAMPLER, sizeof(default_sampler_desc), &default_sampler_desc }, };
+static void skip_dword_unknown(const char *location, const char **ptr, unsigned int count) +{ + unsigned int i; + DWORD d; + + FIXME("Skipping %u unknown DWORDs (%s):\n", count, location); + for (i = 0; i < count; ++i) + { + read_dword(ptr, &d); + FIXME("\t0x%08x\n", d); + } +} + +static void write_dword_unknown(char **ptr, DWORD d) +{ + FIXME("Writing unknown DWORD 0x%08x\n", d); + write_dword(ptr, d); +} + +static HRESULT parse_dxbc(const char *data, SIZE_T data_size, + HRESULT (*chunk_handler)(const char *data, DWORD data_size, DWORD tag, void *ctx), void *ctx) +{ + const char *ptr = data; + HRESULT hr = S_OK; + DWORD chunk_count; + DWORD total_size; + unsigned int i; + DWORD version; + DWORD tag; + + if (!data) + { + WARN("No data supplied.\n"); + return E_FAIL; + } + + read_dword(&ptr, &tag); + TRACE("tag: %s.\n", debugstr_an((const char *)&tag, 4)); + + if (tag != TAG_DXBC) + { + WARN("Wrong tag.\n"); + return E_FAIL; + } + + /* checksum? */ + skip_dword_unknown("DXBC header", &ptr, 4); + + read_dword(&ptr, &version); + TRACE("version: %#x.\n", version); + if (version != 0x00000001) + { + WARN("Got unexpected DXBC version %#x.\n", version); + return E_FAIL; + } + + read_dword(&ptr, &total_size); + TRACE("total size: %#x\n", total_size); + + if (data_size != total_size) + { + WARN("Wrong size supplied.\n"); + return E_FAIL; + } + + read_dword(&ptr, &chunk_count); + TRACE("chunk count: %#x\n", chunk_count); + + for (i = 0; i < chunk_count; ++i) + { + DWORD chunk_tag, chunk_size; + const char *chunk_ptr; + DWORD chunk_offset; + + read_dword(&ptr, &chunk_offset); + TRACE("chunk %u at offset %#x\n", i, chunk_offset); + + if (chunk_offset >= data_size || !require_space(chunk_offset, 2, sizeof(DWORD), data_size)) + { + WARN("Invalid chunk offset %#x (data size %#lx).\n", chunk_offset, data_size); + return E_FAIL; + } + + chunk_ptr = data + chunk_offset; + + read_dword(&chunk_ptr, &chunk_tag); + read_dword(&chunk_ptr, &chunk_size); + + if (!require_space(chunk_ptr - data, 1, chunk_size, data_size)) + { + WARN("Invalid chunk size %#x (data size %#lx, chunk offset %#x).\n", chunk_size, data_size, chunk_offset); + return E_FAIL; + } + + hr = chunk_handler(chunk_ptr, chunk_size, chunk_tag, ctx); + if (FAILED(hr)) break; + } + + return hr; +} + static BOOL fx10_get_string(const char *data, size_t data_size, DWORD offset, const char **s, size_t *l) { size_t len, max_len; diff --git a/dlls/d3d10/utils.c b/dlls/d3d10/utils.c index 3b51868488..9c76e1f375 100644 --- a/dlls/d3d10/utils.c +++ b/dlls/d3d10/utils.c @@ -128,104 +128,3 @@ const char *debug_d3d10_device_state_types(D3D10_DEVICE_STATE_TYPES t) }
#undef WINE_D3D10_TO_STR - -void skip_dword_unknown(const char *location, const char **ptr, unsigned int count) -{ - unsigned int i; - DWORD d; - - FIXME("Skipping %u unknown DWORDs (%s):\n", count, location); - for (i = 0; i < count; ++i) - { - read_dword(ptr, &d); - FIXME("\t0x%08x\n", d); - } -} - -void write_dword_unknown(char **ptr, DWORD d) -{ - FIXME("Writing unknown DWORD 0x%08x\n", d); - write_dword(ptr, d); -} - -HRESULT parse_dxbc(const char *data, SIZE_T data_size, - HRESULT (*chunk_handler)(const char *data, DWORD data_size, DWORD tag, void *ctx), void *ctx) -{ - const char *ptr = data; - HRESULT hr = S_OK; - DWORD chunk_count; - DWORD total_size; - unsigned int i; - DWORD version; - DWORD tag; - - if (!data) - { - WARN("No data supplied.\n"); - return E_FAIL; - } - - read_dword(&ptr, &tag); - TRACE("tag: %s.\n", debugstr_an((const char *)&tag, 4)); - - if (tag != TAG_DXBC) - { - WARN("Wrong tag.\n"); - return E_FAIL; - } - - /* checksum? */ - skip_dword_unknown("DXBC header", &ptr, 4); - - read_dword(&ptr, &version); - TRACE("version: %#x.\n", version); - if (version != 0x00000001) - { - WARN("Got unexpected DXBC version %#x.\n", version); - return E_FAIL; - } - - read_dword(&ptr, &total_size); - TRACE("total size: %#x\n", total_size); - - if (data_size != total_size) - { - WARN("Wrong size supplied.\n"); - return E_FAIL; - } - - read_dword(&ptr, &chunk_count); - TRACE("chunk count: %#x\n", chunk_count); - - for (i = 0; i < chunk_count; ++i) - { - DWORD chunk_tag, chunk_size; - const char *chunk_ptr; - DWORD chunk_offset; - - read_dword(&ptr, &chunk_offset); - TRACE("chunk %u at offset %#x\n", i, chunk_offset); - - if (chunk_offset >= data_size || !require_space(chunk_offset, 2, sizeof(DWORD), data_size)) - { - WARN("Invalid chunk offset %#x (data size %#lx).\n", chunk_offset, data_size); - return E_FAIL; - } - - chunk_ptr = data + chunk_offset; - - read_dword(&chunk_ptr, &chunk_tag); - read_dword(&chunk_ptr, &chunk_size); - - if (!require_space(chunk_ptr - data, 1, chunk_size, data_size)) - { - WARN("Invalid chunk size %#x (data size %#lx, chunk offset %#x).\n", chunk_size, data_size, chunk_offset); - return E_FAIL; - } - - hr = chunk_handler(chunk_ptr, chunk_size, chunk_tag, ctx); - if (FAILED(hr)) break; - } - - return hr; -}
The only remaining functions within utils.c were debugging related, so renaming it to debug.c is more appropriate.
Signed-off-by: Connor McAdams conmanx360@gmail.com --- dlls/d3d10/Makefile.in | 2 +- dlls/d3d10/{utils.c => debug.c} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename dlls/d3d10/{utils.c => debug.c} (100%)
diff --git a/dlls/d3d10/Makefile.in b/dlls/d3d10/Makefile.in index e76f3c5f19..9711fc9838 100644 --- a/dlls/d3d10/Makefile.in +++ b/dlls/d3d10/Makefile.in @@ -6,9 +6,9 @@ EXTRADLLFLAGS = -mno-cygwin
C_SRCS = \ d3d10_main.c \ + debug.c \ effect.c \ shader.c \ stateblock.c \ - utils.c
RC_SRCS = version.rc diff --git a/dlls/d3d10/utils.c b/dlls/d3d10/debug.c similarity index 100% rename from dlls/d3d10/utils.c rename to dlls/d3d10/debug.c
On Sat, 26 Oct 2019 at 05:58, Connor McAdams conmanx360@gmail.com wrote:
The only remaining functions within utils.c were debugging related, so renaming it to debug.c is more appropriate.
You may as well just move them into the files that use them.
This adds d3dcompiler_43 to the PARENTSRC of d3d10 and includes only the needed files (reflection.c and utils.c) from d3dcompiler_43.
Signed-off-by: Connor McAdams conmanx360@gmail.com --- dlls/d3d10/Makefile.in | 3 +++ dlls/d3dcompiler_43/reflection.c | 3 +++ dlls/d3dcompiler_43/utils.c | 2 ++ 3 files changed, 8 insertions(+)
diff --git a/dlls/d3d10/Makefile.in b/dlls/d3d10/Makefile.in index 9711fc9838..c5b44bd7c7 100644 --- a/dlls/d3d10/Makefile.in +++ b/dlls/d3d10/Makefile.in @@ -1,10 +1,13 @@ MODULE = d3d10.dll IMPORTLIB = d3d10 IMPORTS = dxguid uuid d3d10core d3dcompiler dxgi +PARENTSRC = ../d3dcompiler_43
EXTRADLLFLAGS = -mno-cygwin
C_SRCS = \ + reflection.c \ + utils.c \ d3d10_main.c \ debug.c \ effect.c \ diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index b163fca9e7..8f71bd9ce8 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -18,7 +18,10 @@ * */
+#ifdef D3D_COMPILER_VERSION #include "initguid.h" +#endif + #include "d3dcompiler_private.h" #include "winternl.h"
diff --git a/dlls/d3dcompiler_43/utils.c b/dlls/d3dcompiler_43/utils.c index 079bd1c6bc..27c0ba8c91 100644 --- a/dlls/d3dcompiler_43/utils.c +++ b/dlls/d3dcompiler_43/utils.c @@ -758,6 +758,7 @@ void compilation_message(struct compilation_messages *msg, const char *fmt, __ms } }
+#ifdef D3D_COMPILER_VERSION BOOL add_declaration(struct hlsl_scope *scope, struct hlsl_ir_var *decl, BOOL local_var) { struct hlsl_ir_var *var; @@ -2327,3 +2328,4 @@ void add_function_decl(struct wine_rb_tree *funcs, char *name, struct hlsl_ir_fu func->intrinsic = intrinsic; wine_rb_put(funcs, func->name, &func->entry); } +#endif
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=58449
Your paranoid android.
=== debian10 (build log) ===
collect2: error: ld returned 1 exit status Task: The win32 build failed
=== debian10 (build log) ===
collect2: error: ld returned 1 exit status Task: The wow64 build failed
Move the methods for d3d10 reflection into d3dcompiler, as well as the D3D10Reflect function.
Signed-off-by: Connor McAdams conmanx360@gmail.com --- dlls/d3d10/d3d10_main.c | 22 ----- dlls/d3d10/d3d10_private.h | 8 -- dlls/d3d10/shader.c | 112 ------------------------- dlls/d3dcompiler_43/reflection.c | 139 +++++++++++++++++++++++++++++++ 4 files changed, 139 insertions(+), 142 deletions(-)
diff --git a/dlls/d3d10/d3d10_main.c b/dlls/d3d10/d3d10_main.c index e3d1c57e44..9a90e6ee5f 100644 --- a/dlls/d3d10/d3d10_main.c +++ b/dlls/d3d10/d3d10_main.c @@ -297,25 +297,3 @@ const char * WINAPI D3D10GetPixelShaderProfile(ID3D10Device *device)
return "ps_4_0"; } - -HRESULT WINAPI D3D10ReflectShader(const void *data, SIZE_T data_size, ID3D10ShaderReflection **reflector) -{ - struct d3d10_shader_reflection *object; - - FIXME("data %p, data_size %lu, reflector %p stub!\n", data, data_size, reflector); - - if (!(object = heap_alloc_zero(sizeof(*object)))) - { - ERR("Failed to allocate D3D10 shader reflection object memory\n"); - return E_OUTOFMEMORY; - } - - object->ID3D10ShaderReflection_iface.lpVtbl = &d3d10_shader_reflection_vtbl; - object->refcount = 1; - - *reflector = &object->ID3D10ShaderReflection_iface; - - TRACE("Created ID3D10ShaderReflection %p\n", object); - - return S_OK; -} diff --git a/dlls/d3d10/d3d10_private.h b/dlls/d3d10/d3d10_private.h index 2fe6183e15..9c7b2cbab7 100644 --- a/dlls/d3d10/d3d10_private.h +++ b/dlls/d3d10/d3d10_private.h @@ -255,14 +255,6 @@ struct d3d10_effect struct d3d10_effect_technique *techniques; };
-/* ID3D10ShaderReflection */ -extern const struct ID3D10ShaderReflectionVtbl d3d10_shader_reflection_vtbl DECLSPEC_HIDDEN; -struct d3d10_shader_reflection -{ - ID3D10ShaderReflection ID3D10ShaderReflection_iface; - LONG refcount; -}; - HRESULT d3d10_effect_parse(struct d3d10_effect *This, const void *data, SIZE_T data_size) DECLSPEC_HIDDEN;
/* D3D10Core */ diff --git a/dlls/d3d10/shader.c b/dlls/d3d10/shader.c index 52e3cc06bf..d198689af6 100644 --- a/dlls/d3d10/shader.c +++ b/dlls/d3d10/shader.c @@ -22,118 +22,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d10);
-/* IUnknown methods */ - -static inline struct d3d10_shader_reflection *impl_from_ID3D10ShaderReflection(ID3D10ShaderReflection *iface) -{ - return CONTAINING_RECORD(iface, struct d3d10_shader_reflection, ID3D10ShaderReflection_iface); -} - -static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_QueryInterface(ID3D10ShaderReflection *iface, REFIID riid, void **object) -{ - TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object); - - if (IsEqualGUID(riid, &IID_ID3D10ShaderReflection) - || IsEqualGUID(riid, &IID_IUnknown)) - { - IUnknown_AddRef(iface); - *object = iface; - return S_OK; - } - - WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid)); - - *object = NULL; - return E_NOINTERFACE; -} - -static ULONG STDMETHODCALLTYPE d3d10_shader_reflection_AddRef(ID3D10ShaderReflection *iface) -{ - struct d3d10_shader_reflection *This = impl_from_ID3D10ShaderReflection(iface); - ULONG refcount = InterlockedIncrement(&This->refcount); - - TRACE("%p increasing refcount to %u\n", This, refcount); - - return refcount; -} - -static ULONG STDMETHODCALLTYPE d3d10_shader_reflection_Release(ID3D10ShaderReflection *iface) -{ - struct d3d10_shader_reflection *This = impl_from_ID3D10ShaderReflection(iface); - ULONG refcount = InterlockedDecrement(&This->refcount); - - TRACE("%p decreasing refcount to %u\n", This, refcount); - - if (!refcount) - heap_free(This); - - return refcount; -} - -/* ID3D10ShaderReflection methods */ - -static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_GetDesc(ID3D10ShaderReflection *iface, D3D10_SHADER_DESC *desc) -{ - FIXME("iface %p, desc %p stub!\n", iface, desc); - - return E_NOTIMPL; -} - -static struct ID3D10ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3d10_shader_reflection_GetConstantBufferByIndex( - ID3D10ShaderReflection *iface, UINT index) -{ - FIXME("iface %p, index %u stub!\n", iface, index); - - return NULL; -} - -static struct ID3D10ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3d10_shader_reflection_GetConstantBufferByName( - ID3D10ShaderReflection *iface, const char *name) -{ - FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name)); - - return NULL; -} - -static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_GetResourceBindingDesc( - ID3D10ShaderReflection *iface, UINT index, D3D10_SHADER_INPUT_BIND_DESC *desc) -{ - FIXME("iface %p, index %u, desc %p stub!\n", iface, index, desc); - - return E_NOTIMPL; -} - -static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_GetInputParameterDesc( - ID3D10ShaderReflection *iface, UINT index, D3D10_SIGNATURE_PARAMETER_DESC *desc) -{ - FIXME("iface %p, index %u, desc %p stub!\n", iface, index, desc); - - return E_NOTIMPL; -} - -static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_GetOutputParameterDesc( - ID3D10ShaderReflection *iface, UINT index, D3D10_SIGNATURE_PARAMETER_DESC *desc) -{ - FIXME("iface %p, index %u, desc %p stub!\n", iface, index, desc); - - return E_NOTIMPL; -} - -const struct ID3D10ShaderReflectionVtbl d3d10_shader_reflection_vtbl = -{ - /* IUnknown methods */ - d3d10_shader_reflection_QueryInterface, - d3d10_shader_reflection_AddRef, - d3d10_shader_reflection_Release, - /* ID3D10ShaderReflection methods */ - d3d10_shader_reflection_GetDesc, - d3d10_shader_reflection_GetConstantBufferByIndex, - d3d10_shader_reflection_GetConstantBufferByName, - d3d10_shader_reflection_GetResourceBindingDesc, - d3d10_shader_reflection_GetInputParameterDesc, - d3d10_shader_reflection_GetOutputParameterDesc, -}; - HRESULT WINAPI D3D10CompileShader(const char *data, SIZE_T data_size, const char *filename, const D3D10_SHADER_MACRO *defines, ID3D10Include *include, const char *entrypoint, const char *profile, UINT flags, ID3D10Blob **shader, ID3D10Blob **error_messages) diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index 8f71bd9ce8..192dcfcb72 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -24,6 +24,7 @@
#include "d3dcompiler_private.h" #include "winternl.h" +#include "d3d10.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3dcompiler);
@@ -97,6 +98,7 @@ struct d3dcompiler_shader_reflection_constant_buffer struct d3dcompiler_shader_reflection { ID3D11ShaderReflection ID3D11ShaderReflection_iface; + ID3D10ShaderReflection ID3D10ShaderReflection_iface; LONG refcount;
DWORD target; @@ -302,6 +304,121 @@ static void reflection_cleanup(struct d3dcompiler_shader_reflection *ref) HeapFree(GetProcessHeap(), 0, ref->creator); }
+/* + * D3D10 Reflect methods. + */ + +/* IUnknown methods */ +static inline struct d3dcompiler_shader_reflection *impl_from_ID3D10ShaderReflection(ID3D10ShaderReflection *iface) +{ + return CONTAINING_RECORD(iface, struct d3dcompiler_shader_reflection, ID3D10ShaderReflection_iface); +} + +static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_QueryInterface(ID3D10ShaderReflection *iface, REFIID riid, void **object) +{ + TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object); + + if (IsEqualGUID(riid, &IID_ID3D10ShaderReflection) + || IsEqualGUID(riid, &IID_IUnknown)) + { + IUnknown_AddRef(iface); + *object = iface; + return S_OK; + } + + WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid)); + + *object = NULL; + return E_NOINTERFACE; +} + +static ULONG STDMETHODCALLTYPE d3d10_shader_reflection_AddRef(ID3D10ShaderReflection *iface) +{ + struct d3dcompiler_shader_reflection *This = impl_from_ID3D10ShaderReflection(iface); + ULONG refcount = InterlockedIncrement(&This->refcount); + + TRACE("%p increasing refcount to %u\n", This, refcount); + + return refcount; +} + +static ULONG STDMETHODCALLTYPE d3d10_shader_reflection_Release(ID3D10ShaderReflection *iface) +{ + struct d3dcompiler_shader_reflection *This = impl_from_ID3D10ShaderReflection(iface); + ULONG refcount = InterlockedDecrement(&This->refcount); + + TRACE("%p decreasing refcount to %u\n", This, refcount); + + if (!refcount) + heap_free(This); + + return refcount; +} + +/* ID3D10ShaderReflection methods */ + +static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_GetDesc(ID3D10ShaderReflection *iface, D3D10_SHADER_DESC *desc) +{ + FIXME("iface %p, desc %p stub!\n", iface, desc); + + return E_NOTIMPL; +} + +static struct ID3D10ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3d10_shader_reflection_GetConstantBufferByIndex( + ID3D10ShaderReflection *iface, UINT index) +{ + FIXME("iface %p, index %u stub!\n", iface, index); + + return NULL; +} + +static struct ID3D10ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3d10_shader_reflection_GetConstantBufferByName( + ID3D10ShaderReflection *iface, const char *name) +{ + FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name)); + + return NULL; +} + +static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_GetResourceBindingDesc( + ID3D10ShaderReflection *iface, UINT index, D3D10_SHADER_INPUT_BIND_DESC *desc) +{ + FIXME("iface %p, index %u, desc %p stub!\n", iface, index, desc); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_GetInputParameterDesc( + ID3D10ShaderReflection *iface, UINT index, D3D10_SIGNATURE_PARAMETER_DESC *desc) +{ + FIXME("iface %p, index %u, desc %p stub!\n", iface, index, desc); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_GetOutputParameterDesc( + ID3D10ShaderReflection *iface, UINT index, D3D10_SIGNATURE_PARAMETER_DESC *desc) +{ + FIXME("iface %p, index %u, desc %p stub!\n", iface, index, desc); + + return E_NOTIMPL; +} + +const struct ID3D10ShaderReflectionVtbl d3d10_shader_reflection_vtbl = +{ + /* IUnknown methods */ + d3d10_shader_reflection_QueryInterface, + d3d10_shader_reflection_AddRef, + d3d10_shader_reflection_Release, + /* ID3D10ShaderReflection methods */ + d3d10_shader_reflection_GetDesc, + d3d10_shader_reflection_GetConstantBufferByIndex, + d3d10_shader_reflection_GetConstantBufferByName, + d3d10_shader_reflection_GetResourceBindingDesc, + d3d10_shader_reflection_GetInputParameterDesc, + d3d10_shader_reflection_GetOutputParameterDesc, +}; + /* IUnknown methods */
static inline struct d3dcompiler_shader_reflection *impl_from_ID3D11ShaderReflection(ID3D11ShaderReflection *iface) @@ -1810,6 +1927,28 @@ err_out: return hr; }
+HRESULT WINAPI D3D10ReflectShader(const void *data, SIZE_T data_size, ID3D10ShaderReflection **reflector) +{ + struct d3dcompiler_shader_reflection *object; + + FIXME("data %p, data_size %lu, reflector %p stub!\n", data, data_size, reflector); + + if (!(object = heap_alloc_zero(sizeof(*object)))) + { + ERR("Failed to allocate D3D10 shader reflection object memory\n"); + return E_OUTOFMEMORY; + } + + object->ID3D10ShaderReflection_iface.lpVtbl = &d3d10_shader_reflection_vtbl; + object->refcount = 1; + + *reflector = &object->ID3D10ShaderReflection_iface; + + TRACE("Created ID3D10ShaderReflection %p\n", object); + + return S_OK; +} + HRESULT WINAPI D3DReflect(const void *data, SIZE_T data_size, REFIID riid, void **reflector) { struct d3dcompiler_shader_reflection *object;
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=58450
Your paranoid android.
=== debian10 (build log) ===
collect2: error: ld returned 1 exit status Task: The win32 build failed
=== debian10 (build log) ===
collect2: error: ld returned 1 exit status Task: The wow64 build failed
Modify D3D10ReflectShader to now use the shader init function within d3dcompiler, and also take vtbl assignment outside of d3dcompiler_shader_reflection_init so that it can be used by both D3DReflect and D3D10ReflectShader.
Signed-off-by: Connor McAdams conmanx360@gmail.com --- dlls/d3dcompiler_43/reflection.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index 192dcfcb72..43a2ca7f64 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -1812,8 +1812,6 @@ static HRESULT d3dcompiler_shader_reflection_init(struct d3dcompiler_shader_refl HRESULT hr; unsigned int i;
- reflection->ID3D11ShaderReflection_iface.lpVtbl = &d3dcompiler_shader_reflection_vtbl; - reflection->refcount = 1;
wine_rb_init(&reflection->types, d3dcompiler_shader_reflection_type_compare);
@@ -1930,8 +1928,9 @@ err_out: HRESULT WINAPI D3D10ReflectShader(const void *data, SIZE_T data_size, ID3D10ShaderReflection **reflector) { struct d3dcompiler_shader_reflection *object; + HRESULT hr;
- FIXME("data %p, data_size %lu, reflector %p stub!\n", data, data_size, reflector); + TRACE("data %p, data_size %lu, reflector %p\n", data, data_size, reflector);
if (!(object = heap_alloc_zero(sizeof(*object)))) { @@ -1942,6 +1941,14 @@ HRESULT WINAPI D3D10ReflectShader(const void *data, SIZE_T data_size, ID3D10Shad object->ID3D10ShaderReflection_iface.lpVtbl = &d3d10_shader_reflection_vtbl; object->refcount = 1;
+ hr = d3dcompiler_shader_reflection_init(object, data, data_size); + if (FAILED(hr)) + { + WARN("Failed to initialize shader reflection\n"); + HeapFree(GetProcessHeap(), 0, object); + return hr; + } + *reflector = &object->ID3D10ShaderReflection_iface;
TRACE("Created ID3D10ShaderReflection %p\n", object); @@ -1979,6 +1986,9 @@ HRESULT WINAPI D3DReflect(const void *data, SIZE_T data_size, REFIID riid, void if (!object) return E_OUTOFMEMORY;
+ object->ID3D11ShaderReflection_iface.lpVtbl = &d3dcompiler_shader_reflection_vtbl; + object->refcount = 1; + hr = d3dcompiler_shader_reflection_init(object, data, data_size); if (FAILED(hr)) {
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=58451
Your paranoid android.
=== debian10 (build log) ===
collect2: error: ld returned 1 exit status Task: The win32 build failed
=== debian10 (build log) ===
collect2: error: ld returned 1 exit status Task: The wow64 build failed
Implements the GetDesc method for D3D10 reflection interface.
Signed-off-by: Connor McAdams conmanx360@gmail.com --- dlls/d3dcompiler_43/reflection.c | 42 +++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-)
diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index 43a2ca7f64..670d08bd2e 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -359,9 +359,46 @@ static ULONG STDMETHODCALLTYPE d3d10_shader_reflection_Release(ID3D10ShaderRefle
static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_GetDesc(ID3D10ShaderReflection *iface, D3D10_SHADER_DESC *desc) { - FIXME("iface %p, desc %p stub!\n", iface, desc); + struct d3dcompiler_shader_reflection *This = impl_from_ID3D10ShaderReflection(iface);
- return E_NOTIMPL; + FIXME("iface %p, desc %p partial stub!\n", iface, desc); + + if (!desc) + { + WARN("Invalid argument specified\n"); + return E_FAIL; + } + + desc->Version = This->version; + desc->Creator = This->creator; + desc->Flags = This->flags; + desc->ConstantBuffers = This->constant_buffer_count; + desc->BoundResources = This->bound_resource_count; + desc->InputParameters = This->isgn ? This->isgn->element_count : 0; + desc->OutputParameters = This->osgn ? This->osgn->element_count : 0; + desc->InstructionCount = This->instruction_count; + desc->TempRegisterCount = This->temp_register_count; + desc->TempArrayCount = This->temp_array_count; + desc->DefCount = 0; + desc->DclCount = This->dcl_count; + desc->TextureNormalInstructions = This->texture_normal_instructions; + desc->TextureLoadInstructions = This->texture_load_instructions; + desc->TextureCompInstructions = This->texture_comp_instructions; + desc->TextureBiasInstructions = This->texture_bias_instructions; + desc->TextureGradientInstructions = This->texture_gradient_instructions; + desc->FloatInstructionCount = This->float_instruction_count; + desc->IntInstructionCount = This->int_instruction_count; + desc->UintInstructionCount = This->uint_instruction_count; + desc->StaticFlowControlCount = This->static_flow_control_count; + desc->DynamicFlowControlCount = This->dynamic_flow_control_count; + desc->MacroInstructionCount = 0; + desc->ArrayInstructionCount = This->array_instruction_count; + desc->CutInstructionCount = This->cut_instruction_count; + desc->EmitInstructionCount = This->emit_instruction_count; + desc->GSOutputTopology = This->gs_output_topology; + desc->GSMaxOutputVertexCount = This->gs_max_output_vertex_count; + + return S_OK; }
static struct ID3D10ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3d10_shader_reflection_GetConstantBufferByIndex( @@ -1812,7 +1849,6 @@ static HRESULT d3dcompiler_shader_reflection_init(struct d3dcompiler_shader_refl HRESULT hr; unsigned int i;
- wine_rb_init(&reflection->types, d3dcompiler_shader_reflection_type_compare);
hr = dxbc_parse(data, data_size, &src_dxbc);
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=58452
Your paranoid android.
=== debian10 (build log) ===
collect2: error: ld returned 1 exit status Task: The win32 build failed
=== debian10 (build log) ===
collect2: error: ld returned 1 exit status Task: The wow64 build failed
Implements GetInputParameterDesc/GetOutputParameterDesc methods for D3D10 shader reflection interface.
Signed-off-by: Connor McAdams conmanx360@gmail.com --- dlls/d3dcompiler_43/reflection.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-)
diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index 670d08bd2e..6153b69c3c 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -428,17 +428,37 @@ static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_GetResourceBindingDesc( static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_GetInputParameterDesc( ID3D10ShaderReflection *iface, UINT index, D3D10_SIGNATURE_PARAMETER_DESC *desc) { - FIXME("iface %p, index %u, desc %p stub!\n", iface, index, desc); + struct d3dcompiler_shader_reflection *This = impl_from_ID3D10ShaderReflection(iface);
- return E_NOTIMPL; + TRACE("iface %p, index %u, desc %p\n", iface, index, desc); + + if (!desc || !This->isgn || index >= This->isgn->element_count) + { + WARN("Invalid argument specified\n"); + return E_INVALIDARG; + } + + memcpy(desc, &This->isgn->elements[index], sizeof(*desc)); + + return S_OK; }
static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_GetOutputParameterDesc( ID3D10ShaderReflection *iface, UINT index, D3D10_SIGNATURE_PARAMETER_DESC *desc) { - FIXME("iface %p, index %u, desc %p stub!\n", iface, index, desc); + struct d3dcompiler_shader_reflection *This = impl_from_ID3D10ShaderReflection(iface);
- return E_NOTIMPL; + TRACE("iface %p, index %u, desc %p\n", iface, index, desc); + + if (!desc || !This->osgn || index >= This->osgn->element_count) + { + WARN("Invalid argument specified\n"); + return E_INVALIDARG; + } + + memcpy(desc, &This->osgn->elements[index], sizeof(*desc)); + + return S_OK; }
const struct ID3D10ShaderReflectionVtbl d3d10_shader_reflection_vtbl =
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=58453
Your paranoid android.
=== debian10 (build log) ===
collect2: error: ld returned 1 exit status Task: The win32 build failed
=== debian10 (build log) ===
collect2: error: ld returned 1 exit status Task: The wow64 build failed
Implement the GetResourceBindingDesc method for d3d10 reflection shader interface.
Signed-off-by: Connor McAdams conmanx360@gmail.com --- dlls/d3dcompiler_43/reflection.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index 6153b69c3c..90dbc053c6 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -420,9 +420,19 @@ static struct ID3D10ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3d10_sha static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_GetResourceBindingDesc( ID3D10ShaderReflection *iface, UINT index, D3D10_SHADER_INPUT_BIND_DESC *desc) { - FIXME("iface %p, index %u, desc %p stub!\n", iface, index, desc); + struct d3dcompiler_shader_reflection *This = impl_from_ID3D10ShaderReflection(iface);
- return E_NOTIMPL; + TRACE("iface %p, index %u, desc %p\n", iface, index, desc); + + if (!desc || index >= This->bound_resource_count) + { + WARN("Invalid argument specified\n"); + return E_INVALIDARG; + } + + memcpy(desc, &This->bound_resources[index], sizeof(*desc)); + + return S_OK; }
static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_GetInputParameterDesc(
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=58454
Your paranoid android.
=== debian10 (build log) ===
collect2: error: ld returned 1 exit status Task: The win32 build failed
=== debian10 (build log) ===
collect2: error: ld returned 1 exit status Task: The wow64 build failed