From 1fd89abcc3c9d204fd963957b118c61d7c831973 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Wed, 5 Feb 2025 20:32:27 +0100 Subject: [PATCH] vkd3d-shader: Enable DXIL support in the default configuration. --- README | 6 ------ gitlab/build-linux | 2 +- gitlab/build-mac | 2 +- include/private/vkd3d_shader_utils.h | 4 ---- libs/vkd3d-shader/dxil.c | 2 -- libs/vkd3d-shader/vkd3d_shader_main.c | 6 ------ libs/vkd3d/device.c | 4 ---- tests/shader_runner_d3d12.c | 5 ----- tests/vkd3d_shader_api.c | 17 +---------------- 9 files changed, 3 insertions(+), 45 deletions(-) diff --git a/README b/README index 717afcec..b5a34b34 100644 --- a/README +++ b/README @@ -149,12 +149,6 @@ in future versions of vkd3d. emitted; this can be useful for developers to make error conditions as conspicuous as possible. - * VKD3D_SHADER_UNSUPPORTED_DXIL - enable DXIL (DirectX Intermediate Language) - support in vkd3d-shader, which is disabled by default because it is not - considered ready for release yet. Please note that this feature is not - currently supported, and it might change in a non-compatible way before it is - released. - * VKD3D_SHADER_UNSUPPORTED_GLSL - enable GLSL (GL Shading Language) support in vkd3d-shader, which is disabled by default because it is not considered ready for release yet. Please note that this feature is not currently supported, diff --git a/gitlab/build-linux b/gitlab/build-linux index 8c4e963d..5e3f31fa 100755 --- a/gitlab/build-linux +++ b/gitlab/build-linux @@ -12,7 +12,7 @@ mkdir build cd build export LD_LIBRARY_PATH="/usr/local/lib:${LD_LIBRARY_PATH-}" if ../configure --enable-demos --with-spirv-tools DXCOMPILER_LIBS="-L/usr/local/lib" CFLAGS="-g -O2 -Werror" \ - CPPFLAGS="-DVKD3D_SHADER_UNSUPPORTED_DXIL -DVKD3D_SHADER_UNSUPPORTED_GLSL -DVKD3D_ABORT_ON_ERR" && \ + CPPFLAGS="-DVKD3D_SHADER_UNSUPPORTED_GLSL -DVKD3D_ABORT_ON_ERR" && \ make -j$(nproc) ; then make -j$(nproc) AM_COLOR_TESTS=always check || \ touch ../tests_failed diff --git a/gitlab/build-mac b/gitlab/build-mac index d5f08e5f..7e54f19e 100755 --- a/gitlab/build-mac +++ b/gitlab/build-mac @@ -12,7 +12,7 @@ mkdir build cd build if ../configure CFLAGS="-I/opt/homebrew/opt/vulkan-headers/include -I/opt/homebrew/opt/spirv-headers/include -g -O2 -Wno-implicit-fallthrough -Wno-ignored-attributes -Wno-unknown-attributes -Wno-unused-but-set-variable -Werror" \ OBJCFLAGS="-g -O2 -Wno-unknown-attributes -Wno-ignored-attributes -Werror" \ - CPPFLAGS="-DVKD3D_ABORT_ON_ERR -DVKD3D_SHADER_UNSUPPORTED_DXIL -DVKD3D_SHADER_UNSUPPORTED_MSL" \ + CPPFLAGS="-DVKD3D_ABORT_ON_ERR -DVKD3D_SHADER_UNSUPPORTED_MSL" \ VULKAN_LIBS=-L/opt/homebrew/opt/vulkan-loader/lib --with-spirv-tools && \ make -j$(sysctl -n hw.ncpu) ; then make -j$(sysctl -n hw.ncpu) AM_COLOR_TESTS=always check || \ diff --git a/include/private/vkd3d_shader_utils.h b/include/private/vkd3d_shader_utils.h index c9f8001e..00052a89 100644 --- a/include/private/vkd3d_shader_utils.h +++ b/include/private/vkd3d_shader_utils.h @@ -43,16 +43,12 @@ static inline enum vkd3d_result vkd3d_shader_parse_dxbc_source_type(const struct if (tag == TAG_SHDR || tag == TAG_SHEX) { *type = VKD3D_SHADER_SOURCE_DXBC_TPF; -#ifndef VKD3D_SHADER_UNSUPPORTED_DXIL - break; -#else } else if (tag == TAG_DXIL) { *type = VKD3D_SHADER_SOURCE_DXBC_DXIL; /* Default to DXIL if both are present. */ break; -#endif } } diff --git a/libs/vkd3d-shader/dxil.c b/libs/vkd3d-shader/dxil.c index abcfb437..29e714ee 100644 --- a/libs/vkd3d-shader/dxil.c +++ b/libs/vkd3d-shader/dxil.c @@ -10700,8 +10700,6 @@ int dxil_parse(const struct vkd3d_shader_compile_info *compile_info, uint64_t co uint32_t *byte_code = NULL; int ret; - MESSAGE("Creating a DXIL parser. This is unsupported; you get to keep all the pieces if it breaks.\n"); - dxbc_desc.is_dxil = true; if ((ret = shader_extract_from_dxbc(&compile_info->source, message_context, compile_info->source_name, &dxbc_desc)) < 0) diff --git a/libs/vkd3d-shader/vkd3d_shader_main.c b/libs/vkd3d-shader/vkd3d_shader_main.c index ef6eb293..a2c5d9fb 100644 --- a/libs/vkd3d-shader/vkd3d_shader_main.c +++ b/libs/vkd3d-shader/vkd3d_shader_main.c @@ -1978,9 +1978,7 @@ const enum vkd3d_shader_source_type *vkd3d_shader_get_supported_source_types(uns VKD3D_SHADER_SOURCE_DXBC_TPF, VKD3D_SHADER_SOURCE_HLSL, VKD3D_SHADER_SOURCE_D3D_BYTECODE, -#ifdef VKD3D_SHADER_UNSUPPORTED_DXIL VKD3D_SHADER_SOURCE_DXBC_DXIL, -#endif VKD3D_SHADER_SOURCE_FX, }; @@ -2029,7 +2027,6 @@ const enum vkd3d_shader_target_type *vkd3d_shader_get_supported_target_types( VKD3D_SHADER_TARGET_D3D_ASM, }; -#ifdef VKD3D_SHADER_UNSUPPORTED_DXIL static const enum vkd3d_shader_target_type dxbc_dxil_types[] = { VKD3D_SHADER_TARGET_SPIRV_BINARY, @@ -2038,7 +2035,6 @@ const enum vkd3d_shader_target_type *vkd3d_shader_get_supported_target_types( # endif VKD3D_SHADER_TARGET_D3D_ASM, }; -#endif static const enum vkd3d_shader_target_type fx_types[] = { @@ -2061,11 +2057,9 @@ const enum vkd3d_shader_target_type *vkd3d_shader_get_supported_target_types( *count = ARRAY_SIZE(d3dbc_types); return d3dbc_types; -#ifdef VKD3D_SHADER_UNSUPPORTED_DXIL case VKD3D_SHADER_SOURCE_DXBC_DXIL: *count = ARRAY_SIZE(dxbc_dxil_types); return dxbc_dxil_types; -#endif case VKD3D_SHADER_SOURCE_FX: *count = ARRAY_SIZE(fx_types); diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index 0575b492..67bc4493 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -3610,11 +3610,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CheckFeatureSupport(ID3D12Device9 TRACE("Request shader model %#x.\n", data->HighestShaderModel); -#ifdef VKD3D_SHADER_UNSUPPORTED_DXIL data->HighestShaderModel = min(data->HighestShaderModel, D3D_SHADER_MODEL_6_0); -#else - data->HighestShaderModel = min(data->HighestShaderModel, D3D_SHADER_MODEL_5_1); -#endif TRACE("Shader model %#x.\n", data->HighestShaderModel); return S_OK; diff --git a/tests/shader_runner_d3d12.c b/tests/shader_runner_d3d12.c index e46e1869..d70e297d 100644 --- a/tests/shader_runner_d3d12.c +++ b/tests/shader_runner_d3d12.c @@ -1093,12 +1093,7 @@ static void run_shader_tests_for_model_range(void *dxc_compiler, if (minimum_shader_model >= SHADER_MODEL_6_0 && !device_supports_shader_model_6_0(device)) { -#ifdef VKD3D_CROSSTEST skip("The device does not support shader model 6.0.\n"); -#else - skip("DXIL support is not enabled. If this is unintentional, " - "add -DVKD3D_SHADER_UNSUPPORTED_DXIL to CPPFLAGS.\n"); -#endif destroy_test_context(&runner.test_context); return; } diff --git a/tests/vkd3d_shader_api.c b/tests/vkd3d_shader_api.c index 91feeb5f..1575a256 100644 --- a/tests/vkd3d_shader_api.c +++ b/tests/vkd3d_shader_api.c @@ -29,21 +29,6 @@ #include -static bool check_dxil_support(void) -{ - const enum vkd3d_shader_source_type *source_types; - unsigned int count, i; - - source_types = vkd3d_shader_get_supported_source_types(&count); - for (i = 0; i < count; ++i) - { - if (source_types[i] == VKD3D_SHADER_SOURCE_DXBC_DXIL) - return true; - } - - return false; -} - static void test_invalid_shaders(void) { struct vkd3d_shader_compile_info info; @@ -949,7 +934,7 @@ static void test_scan_signatures(void) vkd3d_test_pop_context(); } - if (!check_dxil_support() || !(compiler = dxcompiler_create())) + if (!(compiler = dxcompiler_create())) { skip("DXIL tests not supported.\n"); return;