vkd3d-shader: Enable DXIL support in the default configuration.

This commit is contained in:
Henri Verbeet
2025-02-05 20:32:27 +01:00
parent 73c0356861
commit 1fd89abcc3
Notes: Henri Verbeet 2025-02-24 16:26:28 +01:00
Approved-by: Conor McCarthy (@cmccarthy)
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1371
9 changed files with 3 additions and 45 deletions

6
README
View File

@@ -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,

View File

@@ -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

View File

@@ -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 || \

View File

@@ -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
}
}

View File

@@ -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)

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -29,21 +29,6 @@
#include <locale.h>
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;