Patch series four, now includes the d3d10 GetConstantBuffer, ShaderReflectionVariable, and ShaderReflectionType methods. Also removed utils.c altogether, and moved the functions remaining into the files that they're used in.
Connor McAdams (11): d3d10: move parse_dxbc + helpers into effects.c d3d10: Delete utils.c, move remaining functions into respective files. 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. d3dcompiler: Implement d3d10 reflect GetConstantBuffer methods. d3dcompiler: implement d3d10 ShaderReflectionVariable methods. d3dcompiler: implement d3d10 ShaderReflectionType methods.
dlls/d3d10/Makefile.in | 4 +- dlls/d3d10/d3d10_main.c | 41 ++- dlls/d3d10/d3d10_private.h | 20 -- dlls/d3d10/effect.c | 160 ++++++++++ dlls/d3d10/shader.c | 112 ------- dlls/d3d10/stateblock.c | 38 +++ dlls/d3d10/utils.c | 231 -------------- dlls/d3dcompiler_43/reflection.c | 518 ++++++++++++++++++++++++++++++- dlls/d3dcompiler_43/utils.c | 2 + 9 files changed, 734 insertions(+), 392 deletions(-) delete mode 100644 dlls/d3d10/utils.c
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; -}
Signed-off-by: Matteo Bruni mbruni@codeweavers.com
The only remaining functions within utils.c were debugging related, and used only in a single file with each. So, they have been moved into these files and utils.c has been deleted.
Signed-off-by: Connor McAdams conmanx360@gmail.com --- dlls/d3d10/Makefile.in | 1 - dlls/d3d10/d3d10_main.c | 19 ++++++ dlls/d3d10/d3d10_private.h | 6 -- dlls/d3d10/effect.c | 59 +++++++++++++++++ dlls/d3d10/stateblock.c | 38 +++++++++++ dlls/d3d10/utils.c | 130 ------------------------------------- 6 files changed, 116 insertions(+), 137 deletions(-) delete mode 100644 dlls/d3d10/utils.c
diff --git a/dlls/d3d10/Makefile.in b/dlls/d3d10/Makefile.in index e76f3c5f19..e6ab7d94ff 100644 --- a/dlls/d3d10/Makefile.in +++ b/dlls/d3d10/Makefile.in @@ -9,6 +9,5 @@ C_SRCS = \ effect.c \ shader.c \ stateblock.c \ - utils.c
RC_SRCS = version.rc diff --git a/dlls/d3d10/d3d10_main.c b/dlls/d3d10/d3d10_main.c index e3d1c57e44..801614d494 100644 --- a/dlls/d3d10/d3d10_main.c +++ b/dlls/d3d10/d3d10_main.c @@ -24,6 +24,25 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d10);
+#define WINE_D3D10_TO_STR(x) case x: return #x + +const char *debug_d3d10_driver_type(D3D10_DRIVER_TYPE driver_type) +{ + switch(driver_type) + { + WINE_D3D10_TO_STR(D3D10_DRIVER_TYPE_HARDWARE); + WINE_D3D10_TO_STR(D3D10_DRIVER_TYPE_REFERENCE); + WINE_D3D10_TO_STR(D3D10_DRIVER_TYPE_NULL); + WINE_D3D10_TO_STR(D3D10_DRIVER_TYPE_SOFTWARE); + WINE_D3D10_TO_STR(D3D10_DRIVER_TYPE_WARP); + default: + FIXME("Unrecognized D3D10_DRIVER_TYPE %#x\n", driver_type); + return "unrecognized"; + } +} + +#undef WINE_D3D10_TO_STR + static HRESULT d3d10_create_device(IDXGIAdapter *adapter, D3D10_DRIVER_TYPE driver_type, HMODULE swrast, UINT flags, UINT sdk_version, ID3D10Device **device) { diff --git a/dlls/d3d10/d3d10_private.h b/dlls/d3d10/d3d10_private.h index 2fe6183e15..e56996eb75 100644 --- a/dlls/d3d10/d3d10_private.h +++ b/dlls/d3d10/d3d10_private.h @@ -40,12 +40,6 @@ */ #define D3DERR_INVALIDCALL 0x8876086c
-/* TRACE helper functions */ -const char *debug_d3d10_driver_type(D3D10_DRIVER_TYPE driver_type) DECLSPEC_HIDDEN; -const char *debug_d3d10_shader_variable_class(D3D10_SHADER_VARIABLE_CLASS c) DECLSPEC_HIDDEN; -const char *debug_d3d10_shader_variable_type(D3D10_SHADER_VARIABLE_TYPE t) DECLSPEC_HIDDEN; -const char *debug_d3d10_device_state_types(D3D10_DEVICE_STATE_TYPES t) DECLSPEC_HIDDEN; - enum d3d10_effect_object_type { D3D10_EOT_RASTERIZER_STATE = 0x0, diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index ba5b033b0c..59c076c100 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -24,6 +24,65 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d10);
+#define WINE_D3D10_TO_STR(x) case x: return #x + +const char *debug_d3d10_shader_variable_class(D3D10_SHADER_VARIABLE_CLASS c) +{ + switch (c) + { + WINE_D3D10_TO_STR(D3D10_SVC_SCALAR); + WINE_D3D10_TO_STR(D3D10_SVC_VECTOR); + WINE_D3D10_TO_STR(D3D10_SVC_MATRIX_ROWS); + WINE_D3D10_TO_STR(D3D10_SVC_MATRIX_COLUMNS); + WINE_D3D10_TO_STR(D3D10_SVC_OBJECT); + WINE_D3D10_TO_STR(D3D10_SVC_STRUCT); + default: + FIXME("Unrecognized D3D10_SHADER_VARIABLE_CLASS %#x.\n", c); + return "unrecognized"; + } +} + +const char *debug_d3d10_shader_variable_type(D3D10_SHADER_VARIABLE_TYPE t) +{ + switch (t) + { + WINE_D3D10_TO_STR(D3D10_SVT_VOID); + WINE_D3D10_TO_STR(D3D10_SVT_BOOL); + WINE_D3D10_TO_STR(D3D10_SVT_INT); + WINE_D3D10_TO_STR(D3D10_SVT_FLOAT); + WINE_D3D10_TO_STR(D3D10_SVT_STRING); + WINE_D3D10_TO_STR(D3D10_SVT_TEXTURE); + WINE_D3D10_TO_STR(D3D10_SVT_TEXTURE1D); + WINE_D3D10_TO_STR(D3D10_SVT_TEXTURE2D); + WINE_D3D10_TO_STR(D3D10_SVT_TEXTURE3D); + WINE_D3D10_TO_STR(D3D10_SVT_TEXTURECUBE); + WINE_D3D10_TO_STR(D3D10_SVT_SAMPLER); + WINE_D3D10_TO_STR(D3D10_SVT_PIXELSHADER); + WINE_D3D10_TO_STR(D3D10_SVT_VERTEXSHADER); + WINE_D3D10_TO_STR(D3D10_SVT_UINT); + WINE_D3D10_TO_STR(D3D10_SVT_UINT8); + WINE_D3D10_TO_STR(D3D10_SVT_GEOMETRYSHADER); + WINE_D3D10_TO_STR(D3D10_SVT_RASTERIZER); + WINE_D3D10_TO_STR(D3D10_SVT_DEPTHSTENCIL); + WINE_D3D10_TO_STR(D3D10_SVT_BLEND); + WINE_D3D10_TO_STR(D3D10_SVT_BUFFER); + WINE_D3D10_TO_STR(D3D10_SVT_CBUFFER); + WINE_D3D10_TO_STR(D3D10_SVT_TBUFFER); + WINE_D3D10_TO_STR(D3D10_SVT_TEXTURE1DARRAY); + WINE_D3D10_TO_STR(D3D10_SVT_TEXTURE2DARRAY); + WINE_D3D10_TO_STR(D3D10_SVT_RENDERTARGETVIEW); + WINE_D3D10_TO_STR(D3D10_SVT_DEPTHSTENCILVIEW); + WINE_D3D10_TO_STR(D3D10_SVT_TEXTURE2DMS); + WINE_D3D10_TO_STR(D3D10_SVT_TEXTURE2DMSARRAY); + WINE_D3D10_TO_STR(D3D10_SVT_TEXTURECUBEARRAY); + default: + FIXME("Unrecognized D3D10_SHADER_VARIABLE_TYPE %#x.\n", t); + return "unrecognized"; + } +} + +#undef WINE_D3D10_TO_STR + #define D3D10_FX10_TYPE_COLUMN_SHIFT 11 #define D3D10_FX10_TYPE_COLUMN_MASK (0x7 << D3D10_FX10_TYPE_COLUMN_SHIFT)
diff --git a/dlls/d3d10/stateblock.c b/dlls/d3d10/stateblock.c index e20a4e31f3..8a427db007 100644 --- a/dlls/d3d10/stateblock.c +++ b/dlls/d3d10/stateblock.c @@ -21,6 +21,44 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d10);
+#define WINE_D3D10_TO_STR(x) case x: return #x + +const char *debug_d3d10_device_state_types(D3D10_DEVICE_STATE_TYPES t) +{ + switch (t) + { + WINE_D3D10_TO_STR(D3D10_DST_SO_BUFFERS); + WINE_D3D10_TO_STR(D3D10_DST_OM_RENDER_TARGETS); + WINE_D3D10_TO_STR(D3D10_DST_DEPTH_STENCIL_STATE); + WINE_D3D10_TO_STR(D3D10_DST_BLEND_STATE); + WINE_D3D10_TO_STR(D3D10_DST_VS); + WINE_D3D10_TO_STR(D3D10_DST_VS_SAMPLERS); + WINE_D3D10_TO_STR(D3D10_DST_VS_SHADER_RESOURCES); + WINE_D3D10_TO_STR(D3D10_DST_VS_CONSTANT_BUFFERS); + WINE_D3D10_TO_STR(D3D10_DST_GS); + WINE_D3D10_TO_STR(D3D10_DST_GS_SAMPLERS); + WINE_D3D10_TO_STR(D3D10_DST_GS_SHADER_RESOURCES); + WINE_D3D10_TO_STR(D3D10_DST_GS_CONSTANT_BUFFERS); + WINE_D3D10_TO_STR(D3D10_DST_PS); + WINE_D3D10_TO_STR(D3D10_DST_PS_SAMPLERS); + WINE_D3D10_TO_STR(D3D10_DST_PS_SHADER_RESOURCES); + WINE_D3D10_TO_STR(D3D10_DST_PS_CONSTANT_BUFFERS); + WINE_D3D10_TO_STR(D3D10_DST_IA_VERTEX_BUFFERS); + WINE_D3D10_TO_STR(D3D10_DST_IA_INDEX_BUFFER); + WINE_D3D10_TO_STR(D3D10_DST_IA_INPUT_LAYOUT); + WINE_D3D10_TO_STR(D3D10_DST_IA_PRIMITIVE_TOPOLOGY); + WINE_D3D10_TO_STR(D3D10_DST_RS_VIEWPORTS); + WINE_D3D10_TO_STR(D3D10_DST_RS_SCISSOR_RECTS); + WINE_D3D10_TO_STR(D3D10_DST_RS_RASTERIZER_STATE); + WINE_D3D10_TO_STR(D3D10_DST_PREDICATION); + default: + FIXME("Unrecognized D3D10_DEVICE_STATE_TYPES %#x.\n", t); + return "unrecognized"; + } +} + +#undef WINE_D3D10_TO_STR + struct d3d10_stateblock { ID3D10StateBlock ID3D10StateBlock_iface; diff --git a/dlls/d3d10/utils.c b/dlls/d3d10/utils.c deleted file mode 100644 index 9c76e1f375..0000000000 --- a/dlls/d3d10/utils.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright 2008-2009 Henri Verbeet for CodeWeavers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - * - */ - -#include "d3d10_private.h" - -WINE_DEFAULT_DEBUG_CHANNEL(d3d10); - -#define WINE_D3D10_TO_STR(x) case x: return #x - -const char *debug_d3d10_driver_type(D3D10_DRIVER_TYPE driver_type) -{ - switch(driver_type) - { - WINE_D3D10_TO_STR(D3D10_DRIVER_TYPE_HARDWARE); - WINE_D3D10_TO_STR(D3D10_DRIVER_TYPE_REFERENCE); - WINE_D3D10_TO_STR(D3D10_DRIVER_TYPE_NULL); - WINE_D3D10_TO_STR(D3D10_DRIVER_TYPE_SOFTWARE); - WINE_D3D10_TO_STR(D3D10_DRIVER_TYPE_WARP); - default: - FIXME("Unrecognized D3D10_DRIVER_TYPE %#x\n", driver_type); - return "unrecognized"; - } -} - -const char *debug_d3d10_shader_variable_class(D3D10_SHADER_VARIABLE_CLASS c) -{ - switch (c) - { - WINE_D3D10_TO_STR(D3D10_SVC_SCALAR); - WINE_D3D10_TO_STR(D3D10_SVC_VECTOR); - WINE_D3D10_TO_STR(D3D10_SVC_MATRIX_ROWS); - WINE_D3D10_TO_STR(D3D10_SVC_MATRIX_COLUMNS); - WINE_D3D10_TO_STR(D3D10_SVC_OBJECT); - WINE_D3D10_TO_STR(D3D10_SVC_STRUCT); - default: - FIXME("Unrecognized D3D10_SHADER_VARIABLE_CLASS %#x.\n", c); - return "unrecognized"; - } -} - -const char *debug_d3d10_shader_variable_type(D3D10_SHADER_VARIABLE_TYPE t) -{ - switch (t) - { - WINE_D3D10_TO_STR(D3D10_SVT_VOID); - WINE_D3D10_TO_STR(D3D10_SVT_BOOL); - WINE_D3D10_TO_STR(D3D10_SVT_INT); - WINE_D3D10_TO_STR(D3D10_SVT_FLOAT); - WINE_D3D10_TO_STR(D3D10_SVT_STRING); - WINE_D3D10_TO_STR(D3D10_SVT_TEXTURE); - WINE_D3D10_TO_STR(D3D10_SVT_TEXTURE1D); - WINE_D3D10_TO_STR(D3D10_SVT_TEXTURE2D); - WINE_D3D10_TO_STR(D3D10_SVT_TEXTURE3D); - WINE_D3D10_TO_STR(D3D10_SVT_TEXTURECUBE); - WINE_D3D10_TO_STR(D3D10_SVT_SAMPLER); - WINE_D3D10_TO_STR(D3D10_SVT_PIXELSHADER); - WINE_D3D10_TO_STR(D3D10_SVT_VERTEXSHADER); - WINE_D3D10_TO_STR(D3D10_SVT_UINT); - WINE_D3D10_TO_STR(D3D10_SVT_UINT8); - WINE_D3D10_TO_STR(D3D10_SVT_GEOMETRYSHADER); - WINE_D3D10_TO_STR(D3D10_SVT_RASTERIZER); - WINE_D3D10_TO_STR(D3D10_SVT_DEPTHSTENCIL); - WINE_D3D10_TO_STR(D3D10_SVT_BLEND); - WINE_D3D10_TO_STR(D3D10_SVT_BUFFER); - WINE_D3D10_TO_STR(D3D10_SVT_CBUFFER); - WINE_D3D10_TO_STR(D3D10_SVT_TBUFFER); - WINE_D3D10_TO_STR(D3D10_SVT_TEXTURE1DARRAY); - WINE_D3D10_TO_STR(D3D10_SVT_TEXTURE2DARRAY); - WINE_D3D10_TO_STR(D3D10_SVT_RENDERTARGETVIEW); - WINE_D3D10_TO_STR(D3D10_SVT_DEPTHSTENCILVIEW); - WINE_D3D10_TO_STR(D3D10_SVT_TEXTURE2DMS); - WINE_D3D10_TO_STR(D3D10_SVT_TEXTURE2DMSARRAY); - WINE_D3D10_TO_STR(D3D10_SVT_TEXTURECUBEARRAY); - default: - FIXME("Unrecognized D3D10_SHADER_VARIABLE_TYPE %#x.\n", t); - return "unrecognized"; - } -} - -const char *debug_d3d10_device_state_types(D3D10_DEVICE_STATE_TYPES t) -{ - switch (t) - { - WINE_D3D10_TO_STR(D3D10_DST_SO_BUFFERS); - WINE_D3D10_TO_STR(D3D10_DST_OM_RENDER_TARGETS); - WINE_D3D10_TO_STR(D3D10_DST_DEPTH_STENCIL_STATE); - WINE_D3D10_TO_STR(D3D10_DST_BLEND_STATE); - WINE_D3D10_TO_STR(D3D10_DST_VS); - WINE_D3D10_TO_STR(D3D10_DST_VS_SAMPLERS); - WINE_D3D10_TO_STR(D3D10_DST_VS_SHADER_RESOURCES); - WINE_D3D10_TO_STR(D3D10_DST_VS_CONSTANT_BUFFERS); - WINE_D3D10_TO_STR(D3D10_DST_GS); - WINE_D3D10_TO_STR(D3D10_DST_GS_SAMPLERS); - WINE_D3D10_TO_STR(D3D10_DST_GS_SHADER_RESOURCES); - WINE_D3D10_TO_STR(D3D10_DST_GS_CONSTANT_BUFFERS); - WINE_D3D10_TO_STR(D3D10_DST_PS); - WINE_D3D10_TO_STR(D3D10_DST_PS_SAMPLERS); - WINE_D3D10_TO_STR(D3D10_DST_PS_SHADER_RESOURCES); - WINE_D3D10_TO_STR(D3D10_DST_PS_CONSTANT_BUFFERS); - WINE_D3D10_TO_STR(D3D10_DST_IA_VERTEX_BUFFERS); - WINE_D3D10_TO_STR(D3D10_DST_IA_INDEX_BUFFER); - WINE_D3D10_TO_STR(D3D10_DST_IA_INPUT_LAYOUT); - WINE_D3D10_TO_STR(D3D10_DST_IA_PRIMITIVE_TOPOLOGY); - WINE_D3D10_TO_STR(D3D10_DST_RS_VIEWPORTS); - WINE_D3D10_TO_STR(D3D10_DST_RS_SCISSOR_RECTS); - WINE_D3D10_TO_STR(D3D10_DST_RS_RASTERIZER_STATE); - WINE_D3D10_TO_STR(D3D10_DST_PREDICATION); - default: - FIXME("Unrecognized D3D10_DEVICE_STATE_TYPES %#x.\n", t); - return "unrecognized"; - } -} - -#undef WINE_D3D10_TO_STR
On Mon, Oct 28, 2019 at 6:16 PM Connor McAdams conmanx360@gmail.com wrote:
diff --git a/dlls/d3d10/d3d10_main.c b/dlls/d3d10/d3d10_main.c index e3d1c57e44..801614d494 100644 --- a/dlls/d3d10/d3d10_main.c +++ b/dlls/d3d10/d3d10_main.c @@ -24,6 +24,25 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d10);
+#define WINE_D3D10_TO_STR(x) case x: return #x
+const char *debug_d3d10_driver_type(D3D10_DRIVER_TYPE driver_type)
You should make these functions static now that they're only used in the same compilation unit.
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 e6ab7d94ff..e04d46abb9 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 \ effect.c \ shader.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=58553
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
On Mon, Oct 28, 2019 at 6:16 PM Connor McAdams conmanx360@gmail.com wrote:
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(+)
It seems better to split this in two parts, one for each DLLs (with the d3dcompiler patch first, of course).
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 801614d494..e5a4b2b3f4 100644 --- a/dlls/d3d10/d3d10_main.c +++ b/dlls/d3d10/d3d10_main.c @@ -316,25 +316,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 e56996eb75..01330862c4 100644 --- a/dlls/d3d10/d3d10_private.h +++ b/dlls/d3d10/d3d10_private.h @@ -249,14 +249,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=58554
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
On Mon, Oct 28, 2019 at 6:16 PM Connor McAdams conmanx360@gmail.com wrote:
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(-)
I think I'd like it better if you just use the "d3dcompiler:" prefix in the patch subject for this one.
+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;
+}
This is a good opportunity to fix up the formatting (e.g. add missing periods at the end of debug messages).
+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;
+}
Or avoiding "This" as the object variable.
FWIW you should probably put the whole d3d10 stuff inside an #ifndef D3D_COMPILER_VERSION / #endif so that it doesn't get built for d3dcompiler_xx.
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=58555
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=58556
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=58557
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=58558
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
Both GetConstantBuffer methods are filled in, as well as fixing null initializers to include ID3D10 interfaces.
Signed-off-by: Connor McAdams conmanx360@gmail.com --- dlls/d3dcompiler_43/reflection.c | 110 +++++++++++++++++++++++++++++-- 1 file changed, 103 insertions(+), 7 deletions(-)
diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index 90dbc053c6..d6b55eae1b 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -47,6 +47,7 @@ struct d3dcompiler_shader_signature struct d3dcompiler_shader_reflection_type { ID3D11ShaderReflectionType ID3D11ShaderReflectionType_iface; + ID3D10ShaderReflectionType ID3D10ShaderReflectionType_iface;
DWORD id; struct wine_rb_entry entry; @@ -68,6 +69,7 @@ struct d3dcompiler_shader_reflection_type_member struct d3dcompiler_shader_reflection_variable { ID3D11ShaderReflectionVariable ID3D11ShaderReflectionVariable_iface; + ID3D10ShaderReflectionVariable ID3D10ShaderReflectionVariable_iface;
struct d3dcompiler_shader_reflection_constant_buffer *constant_buffer; struct d3dcompiler_shader_reflection_type *type; @@ -82,6 +84,7 @@ struct d3dcompiler_shader_reflection_variable struct d3dcompiler_shader_reflection_constant_buffer { ID3D11ShaderReflectionConstantBuffer ID3D11ShaderReflectionConstantBuffer_iface; + ID3D10ShaderReflectionConstantBuffer ID3D10ShaderReflectionConstantBuffer_iface;
struct d3dcompiler_shader_reflection *reflection;
@@ -150,10 +153,14 @@ static const struct ID3D11ShaderReflectionConstantBufferVtbl d3dcompiler_shader_ static const struct ID3D11ShaderReflectionVariableVtbl d3dcompiler_shader_reflection_variable_vtbl; static const struct ID3D11ShaderReflectionTypeVtbl d3dcompiler_shader_reflection_type_vtbl;
+static const struct ID3D10ShaderReflectionConstantBufferVtbl d3d10_shader_reflection_constant_buffer_vtbl; +static const struct ID3D10ShaderReflectionVariableVtbl d3d10_shader_reflection_variable_vtbl; +static const struct ID3D10ShaderReflectionTypeVtbl d3d10_shader_reflection_type_vtbl; + /* null objects - needed for invalid calls */ -static struct d3dcompiler_shader_reflection_constant_buffer null_constant_buffer = {{&d3dcompiler_shader_reflection_constant_buffer_vtbl}}; -static struct d3dcompiler_shader_reflection_type null_type = {{&d3dcompiler_shader_reflection_type_vtbl}}; -static struct d3dcompiler_shader_reflection_variable null_variable = {{&d3dcompiler_shader_reflection_variable_vtbl}, +static struct d3dcompiler_shader_reflection_constant_buffer null_constant_buffer = {{&d3dcompiler_shader_reflection_constant_buffer_vtbl}, {&d3d10_shader_reflection_constant_buffer_vtbl}}; +static struct d3dcompiler_shader_reflection_type null_type = {{&d3dcompiler_shader_reflection_type_vtbl}, {&d3d10_shader_reflection_type_vtbl}}; +static struct d3dcompiler_shader_reflection_variable null_variable = {{&d3dcompiler_shader_reflection_variable_vtbl}, {&d3d10_shader_reflection_variable_vtbl}, &null_constant_buffer, &null_type};
static BOOL copy_name(const char *ptr, char **name) @@ -404,17 +411,46 @@ static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_GetDesc(ID3D10ShaderRef static struct ID3D10ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3d10_shader_reflection_GetConstantBufferByIndex( ID3D10ShaderReflection *iface, UINT index) { - FIXME("iface %p, index %u stub!\n", iface, index); + struct d3dcompiler_shader_reflection *This = impl_from_ID3D10ShaderReflection(iface); + TRACE("iface %p, index %u\n", iface, index);
- return NULL; + if (index >= This->constant_buffer_count) + { + WARN("Invalid argument specified\n"); + return &null_constant_buffer.ID3D10ShaderReflectionConstantBuffer_iface; + } + + return &This->constant_buffers[index].ID3D10ShaderReflectionConstantBuffer_iface; }
static struct ID3D10ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3d10_shader_reflection_GetConstantBufferByName( ID3D10ShaderReflection *iface, const char *name) { - FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name)); + struct d3dcompiler_shader_reflection *This = impl_from_ID3D10ShaderReflection(iface); + unsigned int i;
- return NULL; + TRACE("iface %p, name %s\n", iface, debugstr_a(name)); + + if (!name) + { + WARN("Invalid argument specified\n"); + return &null_constant_buffer.ID3D10ShaderReflectionConstantBuffer_iface; + } + + for (i = 0; i < This->constant_buffer_count; ++i) + { + struct d3dcompiler_shader_reflection_constant_buffer *d = &This->constant_buffers[i]; + + if (!strcmp(d->name, name)) + { + TRACE("Returning ID3D10ShaderReflectionConstantBuffer %p.\n", d); + return &d->ID3D10ShaderReflectionConstantBuffer_iface; + } + } + + WARN("Invalid name specified\n"); + + return &null_constant_buffer.ID3D10ShaderReflectionConstantBuffer_iface; }
static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_GetResourceBindingDesc( @@ -889,6 +925,65 @@ static const struct ID3D11ShaderReflectionVtbl d3dcompiler_shader_reflection_vtb d3dcompiler_shader_reflection_GetRequiresFlags, };
+/* ID3D10ShaderReflectionConstantBuffer methods */ + +static inline struct d3dcompiler_shader_reflection_constant_buffer *impl_from_ID3D10ShaderReflectionConstantBuffer(ID3D10ShaderReflectionConstantBuffer *iface) +{ + return CONTAINING_RECORD(iface, struct d3dcompiler_shader_reflection_constant_buffer, ID3D10ShaderReflectionConstantBuffer_iface); +} + +static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_constant_buffer_GetDesc( + ID3D10ShaderReflectionConstantBuffer *iface, D3D10_SHADER_BUFFER_DESC *desc) +{ + struct d3dcompiler_shader_reflection_constant_buffer *This = impl_from_ID3D10ShaderReflectionConstantBuffer(iface); + + TRACE("iface %p, desc %p\n", iface, desc); + + if (This == &null_constant_buffer) + { + WARN("Null constant buffer specified\n"); + return E_FAIL; + } + + if (!desc) + { + WARN("Invalid argument specified\n"); + return E_FAIL; + } + + desc->Name = This->name; + desc->Type = This->type; + desc->Variables = This->variable_count; + desc->Size = This->size; + desc->uFlags = This->flags; + + return S_OK; +} + +static ID3D10ShaderReflectionVariable * STDMETHODCALLTYPE d3d10_shader_reflection_constant_buffer_GetVariableByIndex( + ID3D10ShaderReflectionConstantBuffer *iface, UINT index) +{ + FIXME("iface %p, index %d stub!\n", iface, index); + + return &null_variable.ID3D10ShaderReflectionVariable_iface; +} + +static ID3D10ShaderReflectionVariable * STDMETHODCALLTYPE d3d10_shader_reflection_constant_buffer_GetVariableByName( + ID3D10ShaderReflectionConstantBuffer *iface, const char *name) +{ + FIXME("iface %p, name %s stub!\n", iface, name); + + return &null_variable.ID3D10ShaderReflectionVariable_iface; +} + +static const struct ID3D10ShaderReflectionConstantBufferVtbl d3d10_shader_reflection_constant_buffer_vtbl = +{ + /* ID3D10ShaderReflectionConstantBuffer methods */ + d3d10_shader_reflection_constant_buffer_GetDesc, + d3d10_shader_reflection_constant_buffer_GetVariableByIndex, + d3d10_shader_reflection_constant_buffer_GetVariableByName, +}; + /* ID3D11ShaderReflectionConstantBuffer methods */
static inline struct d3dcompiler_shader_reflection_constant_buffer *impl_from_ID3D11ShaderReflectionConstantBuffer(ID3D11ShaderReflectionConstantBuffer *iface) @@ -1692,6 +1787,7 @@ static HRESULT d3dcompiler_parse_rdef(struct d3dcompiler_shader_reflection *r, c struct d3dcompiler_shader_reflection_constant_buffer *cb = &constant_buffers[i];
cb->ID3D11ShaderReflectionConstantBuffer_iface.lpVtbl = &d3dcompiler_shader_reflection_constant_buffer_vtbl; + cb->ID3D10ShaderReflectionConstantBuffer_iface.lpVtbl = &d3d10_shader_reflection_constant_buffer_vtbl; cb->reflection = r;
read_dword(&ptr, &offset);
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=58559
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
On Mon, Oct 28, 2019 at 6:21 PM Connor McAdams conmanx360@gmail.com wrote:
Both GetConstantBuffer methods are filled in, as well as fixing null initializers to include ID3D10 interfaces.
The methods returning ShaderReflectionVariable are (understandably) only stubbed though, so maybe make it a "Partially implement" in the subject line?
Adds the methods for d3d10 ShaderReflectionVariable interface, as well as fills in the constant buffer methods that use the ShaderReflectionVariable interface.
Signed-off-by: Connor McAdams conmanx360@gmail.com --- dlls/d3dcompiler_43/reflection.c | 87 ++++++++++++++++++++++++++++++-- 1 file changed, 84 insertions(+), 3 deletions(-)
diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index d6b55eae1b..334275b189 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -963,15 +963,45 @@ static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_constant_buffer_GetDesc static ID3D10ShaderReflectionVariable * STDMETHODCALLTYPE d3d10_shader_reflection_constant_buffer_GetVariableByIndex( ID3D10ShaderReflectionConstantBuffer *iface, UINT index) { - FIXME("iface %p, index %d stub!\n", iface, index); + struct d3dcompiler_shader_reflection_constant_buffer *This = impl_from_ID3D10ShaderReflectionConstantBuffer(iface);
- return &null_variable.ID3D10ShaderReflectionVariable_iface; + TRACE("iface %p, index %u\n", iface, index); + + if (index >= This->variable_count) + { + WARN("Invalid index specified\n"); + return &null_variable.ID3D10ShaderReflectionVariable_iface; + } + + return &This->variables[index].ID3D10ShaderReflectionVariable_iface; }
static ID3D10ShaderReflectionVariable * STDMETHODCALLTYPE d3d10_shader_reflection_constant_buffer_GetVariableByName( ID3D10ShaderReflectionConstantBuffer *iface, const char *name) { - FIXME("iface %p, name %s stub!\n", iface, name); + struct d3dcompiler_shader_reflection_constant_buffer *This = impl_from_ID3D10ShaderReflectionConstantBuffer(iface); + unsigned int i; + + TRACE("iface %p, name %s\n", iface, debugstr_a(name)); + + if (!name) + { + WARN("Invalid argument specified\n"); + return &null_variable.ID3D10ShaderReflectionVariable_iface; + } + + for (i = 0; i < This->variable_count; ++i) + { + struct d3dcompiler_shader_reflection_variable *v = &This->variables[i]; + + if (!strcmp(v->name, name)) + { + TRACE("Returning ID3D10ShaderReflectionVariable %p.\n", v); + return &v->ID3D10ShaderReflectionVariable_iface; + } + } + + WARN("Invalid name specified\n");
return &null_variable.ID3D10ShaderReflectionVariable_iface; } @@ -1073,6 +1103,56 @@ static const struct ID3D11ShaderReflectionConstantBufferVtbl d3dcompiler_shader_ d3dcompiler_shader_reflection_constant_buffer_GetVariableByName, };
+/* ID3D10ShaderReflectionVariable methods */ + +static inline struct d3dcompiler_shader_reflection_variable *impl_from_ID3D10ShaderReflectionVariable(ID3D10ShaderReflectionVariable *iface) +{ + return CONTAINING_RECORD(iface, struct d3dcompiler_shader_reflection_variable, ID3D10ShaderReflectionVariable_iface); +} + +static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_variable_GetDesc( + ID3D10ShaderReflectionVariable *iface, D3D10_SHADER_VARIABLE_DESC *desc) +{ + struct d3dcompiler_shader_reflection_variable *This = impl_from_ID3D10ShaderReflectionVariable(iface); + + TRACE("iface %p, desc %p\n", iface, desc); + + if (This == &null_variable) + { + WARN("Null variable specified\n"); + return E_FAIL; + } + + if (!desc) + { + WARN("Invalid argument specified\n"); + return E_FAIL; + } + + desc->Name = This->name; + desc->StartOffset = This->start_offset; + desc->Size = This->size; + desc->uFlags = This->flags; + desc->DefaultValue = This->default_value; + + return S_OK; +} + +static ID3D10ShaderReflectionType * STDMETHODCALLTYPE d3d10_shader_reflection_variable_GetType( + ID3D10ShaderReflectionVariable *iface) +{ + FIXME("iface %p stub!\n", iface); + + return &null_type.ID3D10ShaderReflectionType_iface; +} + +static const struct ID3D10ShaderReflectionVariableVtbl d3d10_shader_reflection_variable_vtbl = +{ + /* ID3D10ShaderReflectionVariable methods */ + d3d10_shader_reflection_variable_GetDesc, + d3d10_shader_reflection_variable_GetType, +}; + /* ID3D11ShaderReflectionVariable methods */
static inline struct d3dcompiler_shader_reflection_variable *impl_from_ID3D11ShaderReflectionVariable(ID3D11ShaderReflectionVariable *iface) @@ -1613,6 +1693,7 @@ static HRESULT d3dcompiler_parse_variables(struct d3dcompiler_shader_reflection_ DWORD offset;
v->ID3D11ShaderReflectionVariable_iface.lpVtbl = &d3dcompiler_shader_reflection_variable_vtbl; + v->ID3D10ShaderReflectionVariable_iface.lpVtbl = &d3d10_shader_reflection_variable_vtbl; v->constant_buffer = cb;
read_dword(&ptr, &offset);
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=58560
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
This could be split, one patch implementing GetVariableByIndex() / GetVariableByName() (even separately) with a stub ShaderReflectionVariable and one patch fleshing ShaderReflectionVariable out. Not a huge deal though.
+static const struct ID3D10ShaderReflectionVariableVtbl d3d10_shader_reflection_variable_vtbl = +{
- /* ID3D10ShaderReflectionVariable methods */
- d3d10_shader_reflection_variable_GetDesc,
- d3d10_shader_reflection_variable_GetType,
+};
That comment doesn't seem particularly useful.
Adds the methods for d3d10 ShaderReflectionType interface, as well as fills in the ShaderReflectionVariable methods that use the ShaderReflectionType interface.
Signed-off-by: Connor McAdams conmanx360@gmail.com --- dlls/d3dcompiler_43/reflection.c | 115 ++++++++++++++++++++++++++++++- 1 file changed, 113 insertions(+), 2 deletions(-)
diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index 334275b189..57b92150d4 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -1141,9 +1141,11 @@ static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_variable_GetDesc( static ID3D10ShaderReflectionType * STDMETHODCALLTYPE d3d10_shader_reflection_variable_GetType( ID3D10ShaderReflectionVariable *iface) { - FIXME("iface %p stub!\n", iface); + struct d3dcompiler_shader_reflection_variable *This = impl_from_ID3D10ShaderReflectionVariable(iface);
- return &null_type.ID3D10ShaderReflectionType_iface; + TRACE("iface %p\n", iface); + + return &This->type->ID3D10ShaderReflectionType_iface; }
static const struct ID3D10ShaderReflectionVariableVtbl d3d10_shader_reflection_variable_vtbl = @@ -1225,6 +1227,114 @@ static const struct ID3D11ShaderReflectionVariableVtbl d3dcompiler_shader_reflec d3dcompiler_shader_reflection_variable_GetInterfaceSlot, };
+/* ID3D10ShaderReflectionType methods */ + +static inline struct d3dcompiler_shader_reflection_type *impl_from_ID3D10ShaderReflectionType(ID3D10ShaderReflectionType *iface) +{ + return CONTAINING_RECORD(iface, struct d3dcompiler_shader_reflection_type, ID3D10ShaderReflectionType_iface); +} + +static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_type_GetDesc( + ID3D10ShaderReflectionType *iface, D3D10_SHADER_TYPE_DESC *desc) +{ + struct d3dcompiler_shader_reflection_type *This = impl_from_ID3D10ShaderReflectionType(iface); + + TRACE("iface %p, desc %p\n", iface, desc); + + if (This == &null_type) + { + WARN("Null type specified\n"); + return E_FAIL; + } + + if (!desc) + { + WARN("Invalid argument specified\n"); + return E_FAIL; + } + + memcpy(desc, &This->desc, sizeof(*desc)); + + return S_OK; +} + +static ID3D10ShaderReflectionType * STDMETHODCALLTYPE d3d10_shader_reflection_type_GetMemberTypeByIndex( + ID3D10ShaderReflectionType *iface, UINT index) +{ + struct d3dcompiler_shader_reflection_type *This = impl_from_ID3D10ShaderReflectionType(iface); + + TRACE("iface %p, index %u\n", iface, index); + + if (index >= This->desc.Members) + { + WARN("Invalid index specified\n"); + return &null_type.ID3D10ShaderReflectionType_iface; + } + + return &This->members[index].type->ID3D10ShaderReflectionType_iface; +} + +static ID3D10ShaderReflectionType * STDMETHODCALLTYPE d3d10_shader_reflection_type_GetMemberTypeByName( + ID3D10ShaderReflectionType *iface, const char *name) +{ + struct d3dcompiler_shader_reflection_type *This = impl_from_ID3D10ShaderReflectionType(iface); + unsigned int i; + + TRACE("iface %p, name %s\n", iface, debugstr_a(name)); + + if (!name) + { + WARN("Invalid argument specified\n"); + return &null_type.ID3D10ShaderReflectionType_iface; + } + + for (i = 0; i < This->desc.Members; ++i) + { + struct d3dcompiler_shader_reflection_type_member *member = &This->members[i]; + + if (!strcmp(member->name, name)) + { + TRACE("Returning ID3D10ShaderReflectionType %p.\n", member->type); + return &member->type->ID3D10ShaderReflectionType_iface; + } + } + + WARN("Invalid name specified\n"); + + return &null_type.ID3D10ShaderReflectionType_iface; +} + +static const char * STDMETHODCALLTYPE d3d10_shader_reflection_type_GetMemberTypeName( + ID3D10ShaderReflectionType *iface, UINT index) +{ + struct d3dcompiler_shader_reflection_type *This = impl_from_ID3D10ShaderReflectionType(iface); + + TRACE("iface %p, index %u\n", iface, index); + + if (This == &null_type) + { + WARN("Null type specified\n"); + return "$Invalid"; + } + + if (index >= This->desc.Members) + { + WARN("Invalid index specified\n"); + return NULL; + } + + return This->members[index].name; +} + +static const struct ID3D10ShaderReflectionTypeVtbl d3d10_shader_reflection_type_vtbl = +{ + /* ID3D10ShaderReflectionType methods */ + d3d10_shader_reflection_type_GetDesc, + d3d10_shader_reflection_type_GetMemberTypeByIndex, + d3d10_shader_reflection_type_GetMemberTypeByName, + d3d10_shader_reflection_type_GetMemberTypeName, +}; + /* ID3D11ShaderReflectionType methods */
static inline struct d3dcompiler_shader_reflection_type *impl_from_ID3D11ShaderReflectionType(ID3D11ShaderReflectionType *iface) @@ -1652,6 +1762,7 @@ static struct d3dcompiler_shader_reflection_type *get_reflection_type(struct d3d return NULL;
type->ID3D11ShaderReflectionType_iface.lpVtbl = &d3dcompiler_shader_reflection_type_vtbl; + type->ID3D10ShaderReflectionType_iface.lpVtbl = &d3d10_shader_reflection_type_vtbl; type->id = offset; type->reflection = reflection;
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=58561
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
On Mon, Oct 28, 2019 at 6:17 PM Connor McAdams conmanx360@gmail.com wrote:
Adds the methods for d3d10 ShaderReflectionType interface, as well as fills in the ShaderReflectionVariable methods that use the ShaderReflectionType interface.
Same thing about splitting up the patch. In general every time you find yourself mentioning multiple things in the commit message it means it should probably happen over several patches.