From: Józef Kucia jkucia@codeweavers.com
Allows building with Vulkan SDK.
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- configure.ac | 12 +++++++++--- libs/vkd3d-shader/spirv.c | 19 +++++++++++++------ 2 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/configure.ac b/configure.ac index 820783a3b4fa..2b8249eebd10 100644 --- a/configure.ac +++ b/configure.ac @@ -48,11 +48,17 @@ VKD3D_CHECK_MINGW32_PROG([CROSSCC32], [CROSSTARGET32], [no]) VKD3D_CHECK_MINGW64_PROG([CROSSCC64], [CROSSTARGET64], [no])
dnl Check for headers -AC_CHECK_HEADERS([pthread.h vulkan/vulkan.h spirv/unified1/spirv.h spirv/unified1/GLSL.std.450.h]) +AC_CHECK_HEADERS([pthread.h vulkan/vulkan.h \ + vulkan/spirv.h vulkan/GLSL.std.450.h \ + spirv/unified1/spirv.h spirv/unified1/GLSL.std.450.h]) AS_IF([test "x$ac_cv_header_pthread_h" != "xyes"], [AC_MSG_ERROR([pthread.h not found.])]) AS_IF([test "x$ac_cv_header_vulkan_vulkan_h" != "xyes"], [AC_MSG_ERROR([vulkan.h not found.])]) -AS_IF([test "x$ac_cv_header_spirv_unified1_spirv_h" != "xyes"], [AC_MSG_ERROR([spirv.h not found.])]) -AS_IF([test "x$ac_cv_header_spirv_unified1_GLSL_std_450_h" != "xyes"], [AC_MSG_ERROR([GLSL.std.450.h not found.])]) +AS_IF([test "x$ac_cv_header_spirv_unified1_spirv_h" != "xyes" \ + -a "x$ac_cv_header_vulkan_spirv_h" != "xyes"], + [AC_MSG_ERROR([spirv.h not found.])]) +AS_IF([test "x$ac_cv_header_spirv_unified1_GLSL_std_450_h" != "xyes" \ + -a "x$ac_cv_header_vulkan_GLSL_std_450_h" != "xyes"], + [AC_MSG_ERROR([GLSL.std.450.h not found.])])
dnl Check for libraries m4_ifdef([PKG_PROG_PKG_CONFIG], [PKG_PROG_PKG_CONFIG], [m4_fatal([pkg-config autoconf macros not found.])]) diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 8a1fdf40dae6..f646d540297f 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -21,13 +21,20 @@
#include <stdarg.h> #include <stdio.h> -#include "spirv/unified1/spirv.h" -#include "spirv/unified1/GLSL.std.450.h" -#ifdef HAVE_SPIRV_TOOLS -# include "spirv-tools/libspirv.h" -#endif /* HAVE_SPIRV_TOOLS */ + +#ifdef HAVE_SPIRV_UNIFIED1_SPIRV_H +# include "spirv/unified1/spirv.h" +#else +# include "vulkan/spirv.h" +#endif /* HAVE_SPIRV_UNIFIED1_SPIRV_H */ +#ifdef HAVE_SPIRV_UNIFIED1_GLSL_STD_450_H +# include "spirv/unified1/GLSL.std.450.h" +#else +# include "vulkan/GLSL.std.450.h" +#endif /* HAVE_SPIRV_UNIFIED1_GLSL_STD_450_H */
#ifdef HAVE_SPIRV_TOOLS +# include "spirv-tools/libspirv.h"
static void vkd3d_spirv_dump(const struct vkd3d_shader_code *spirv) { @@ -85,7 +92,7 @@ static void vkd3d_spirv_validate(const struct vkd3d_shader_code *spirv) static void vkd3d_spirv_dump(const struct vkd3d_shader_code *spirv) {} static void vkd3d_spirv_validate(const struct vkd3d_shader_code *spirv) {}
-#endif /* HAVE_SPIRV_TOOLS */ +#endif /* HAVE_SPIRV_TOOLS */
#define VKD3D_SPIRV_VERSION 0x00010000 #define VKD3D_SPIRV_GENERATOR_ID 18