[PATCH v2 1/3] D3D10: Add d3dcompiler_43 PARENTSRC to d3d10

Matteo Bruni matteo.mystral at gmail.com
Fri Oct 25 03:39:44 CDT 2019


On Thu, Oct 24, 2019 at 9:49 PM Connor McAdams <conmanx360 at gmail.com> wrote:
>
> Adds PARENTSRC of d3dcompiler_43 to eventually use the reflection
> functionality from it. Fixes conflicts of GUID declarations and
> functions with the same names.
>
> Signed-off-by: Connor McAdams <conmanx360 at gmail.com>
> ---
>  dlls/d3d10/Makefile.in           | 19 +++++++++++++++++++
>  dlls/d3d10/d3d10_private.h       |  2 +-
>  dlls/d3d10/effect.c              | 12 ++++++------
>  dlls/d3d10/utils.c               |  4 ++--
>  dlls/d3dcompiler_43/reflection.c |  3 ++-
>  5 files changed, 30 insertions(+), 10 deletions(-)
>
> diff --git a/dlls/d3d10/Makefile.in b/dlls/d3d10/Makefile.in
> index e76f3c5f19..2d79dd53e0 100644
> --- a/dlls/d3d10/Makefile.in
> +++ b/dlls/d3d10/Makefile.in
> @@ -1,14 +1,33 @@
>  MODULE    = d3d10.dll
>  IMPORTLIB = d3d10
>  IMPORTS   = dxguid uuid d3d10core d3dcompiler dxgi
> +EXTRADEFS = -DD3D10REFLECT
> +PARENTSRC = ../d3dcompiler_43
>
>  EXTRADLLFLAGS = -mno-cygwin
>
>  C_SRCS = \
> +       asmparser.c \
> +       blob.c \
> +       bytecodewriter.c \
> +       compiler.c \
> +       preproc.c \
> +       reflection.c \
> +       ../d3dcompiler_43/utils.c \
>         d3d10_main.c \
>         effect.c \
>         shader.c \
>         stateblock.c \
>         utils.c
>
> +LEX_SRCS = \
> +       asmshader.l \
> +       hlsl.l \
> +       ppl.l
> +
> +BISON_SRCS = \
> +       asmshader.y \
> +       hlsl.y \
> +       ppy.y
> +
>  RC_SRCS = version.rc

For the time being you shouldn't need any of those source files from
d3dcompiler_43 except reflection.c. If that in turn needs
d3dcompiler's utils.c, it will need to be handled in some way. It's
not clear at a glance what's the best course of action but some (not
necessarily mutually exclusive) options are:
- rename d3d10's utils.c to something else so that there is no name clash
- replace functions in d3d10's utils.c with the equivalent functions
from d3dcompiler
- move functions currently in d3d10's utils.c into their users or
inline them into d3d10_private.h
- merge some d3d10 source files together

I.e. d3d10 will probably need some work to be able to share code with
d3dcompiler. It should be possible to do that in small incremental
steps over a number of patches though.

> diff --git a/dlls/d3d10/d3d10_private.h b/dlls/d3d10/d3d10_private.h
> index f3fce9c569..bd149f0b41 100644
> --- a/dlls/d3d10/d3d10_private.h
> +++ b/dlls/d3d10/d3d10_private.h
> @@ -298,7 +298,7 @@ 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 d3d10_skip_dword_unknown(const char *location, const char **ptr, unsigned int count) DECLSPEC_HIDDEN;
>  void write_dword_unknown(char **ptr, DWORD d) DECLSPEC_HIDDEN;

This should be mostly the same as the d3dcompiler version so either
drop this change (if you can do without utils.c from d3dcompiler) or
just drop the d3d10 version.

> diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c
> index b163fca9e7..ce634ac95a 100644
> --- a/dlls/d3dcompiler_43/reflection.c
> +++ b/dlls/d3dcompiler_43/reflection.c
> @@ -17,8 +17,9 @@
>   * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
>   *
>   */
> -
> +#ifndef D3D10REFLECT
>  #include "initguid.h"
> +#endif
>  #include "d3dcompiler_private.h"
>  #include "winternl.h"

I think you don't want that. FWIW for these kind of #ifdefs instead of
adding a new define you can use D3D_COMPILER_VERSION.



More information about the wine-devel mailing list