vkd3d-shader: Enable GLSL target support when VKD3D_SHADER_UNSUPPORTED_GLSL is defined.

This commit is contained in:
Henri Verbeet 2024-03-07 20:55:39 +01:00 committed by Alexandre Julliard
parent 4553b2a0dc
commit 1fc55d80cd
Notes: Alexandre Julliard 2024-03-08 23:49:12 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/696
3 changed files with 21 additions and 5 deletions

View File

@ -12,7 +12,7 @@ rm -fr build
mkdir build mkdir build
cd build cd build
export LD_LIBRARY_PATH=/usr/local/lib export LD_LIBRARY_PATH=/usr/local/lib
if ../configure --enable-demos --with-spirv-tools DXCOMPILER_LIBS="-L/usr/local/lib" CFLAGS="-g -O2 -Werror" CPPFLAGS="-DVKD3D_SHADER_UNSUPPORTED_DXIL" && \ 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" && \
make -j$(nproc) ; then make -j$(nproc) ; then
make -j$(nproc) AM_COLOR_TESTS=always check || \ make -j$(nproc) AM_COLOR_TESTS=always check || \
touch ../tests_failed touch ../tests_failed

View File

@ -96,6 +96,8 @@ int vkd3d_glsl_generator_generate(struct vkd3d_glsl_generator *generator,
unsigned int i; unsigned int i;
void *code; void *code;
ERR("Generating a GLSL shader. This is unsupported; you get to keep all the pieces if it breaks.\n");
vkd3d_string_buffer_printf(&generator->buffer, "#version 440\n\n"); vkd3d_string_buffer_printf(&generator->buffer, "#version 440\n\n");
vkd3d_string_buffer_printf(&generator->buffer, "void main()\n{\n"); vkd3d_string_buffer_printf(&generator->buffer, "void main()\n{\n");

View File

@ -1874,7 +1874,7 @@ const enum vkd3d_shader_target_type *vkd3d_shader_get_supported_target_types(
VKD3D_SHADER_TARGET_SPIRV_TEXT, VKD3D_SHADER_TARGET_SPIRV_TEXT,
#endif #endif
VKD3D_SHADER_TARGET_D3D_ASM, VKD3D_SHADER_TARGET_D3D_ASM,
#if 0 #ifdef VKD3D_SHADER_UNSUPPORTED_GLSL
VKD3D_SHADER_TARGET_GLSL, VKD3D_SHADER_TARGET_GLSL,
#endif #endif
}; };
@ -1895,13 +1895,21 @@ const enum vkd3d_shader_target_type *vkd3d_shader_get_supported_target_types(
VKD3D_SHADER_TARGET_D3D_ASM, 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,
# ifdef HAVE_SPIRV_TOOLS
VKD3D_SHADER_TARGET_SPIRV_TEXT,
# endif
VKD3D_SHADER_TARGET_D3D_ASM,
};
#endif
TRACE("source_type %#x, count %p.\n", source_type, count); TRACE("source_type %#x, count %p.\n", source_type, count);
switch (source_type) switch (source_type)
{ {
#ifdef VKD3D_SHADER_UNSUPPORTED_DXIL
case VKD3D_SHADER_SOURCE_DXBC_DXIL:
#endif
case VKD3D_SHADER_SOURCE_DXBC_TPF: case VKD3D_SHADER_SOURCE_DXBC_TPF:
*count = ARRAY_SIZE(dxbc_tpf_types); *count = ARRAY_SIZE(dxbc_tpf_types);
return dxbc_tpf_types; return dxbc_tpf_types;
@ -1914,6 +1922,12 @@ const enum vkd3d_shader_target_type *vkd3d_shader_get_supported_target_types(
*count = ARRAY_SIZE(d3dbc_types); *count = ARRAY_SIZE(d3dbc_types);
return 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
default: default:
*count = 0; *count = 0;
return NULL; return NULL;