vkd3d-shader/spirv: Check for FEATURE_FLOAT64 when double precision use is flagged.

This commit is contained in:
Conor McCarthy 2024-01-23 13:00:22 +10:00 committed by Alexandre Julliard
parent 6446b6ea21
commit 54f6e6dd67
Notes: Alexandre Julliard 2024-01-24 22:54:46 +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/588

View File

@ -2369,6 +2369,7 @@ struct spirv_compiler
size_t spec_constants_size;
enum vkd3d_shader_compile_option_formatting_flags formatting;
enum vkd3d_shader_compile_option_feature_flags features;
enum vkd3d_shader_api_version api_version;
bool write_tess_geom_point_size;
struct vkd3d_string_buffer_cache string_buffers;
@ -2513,6 +2514,7 @@ static struct spirv_compiler *spirv_compiler_create(const struct vkd3d_shader_ve
break;
case VKD3D_SHADER_COMPILE_OPTION_API_VERSION:
compiler->api_version = option->value;
break;
case VKD3D_SHADER_COMPILE_OPTION_TYPED_UAV:
@ -2547,6 +2549,10 @@ static struct spirv_compiler *spirv_compiler_create(const struct vkd3d_shader_ve
}
}
/* Explicit enabling of float64 was not required for API versions <= 1.10. */
if (compiler->api_version <= VKD3D_SHADER_API_VERSION_1_10)
compiler->features |= VKD3D_SHADER_COMPILE_OPTION_FEATURE_FLOAT64;
rb_init(&compiler->symbol_table, vkd3d_symbol_compare);
compiler->shader_type = shader_version->type;
@ -5601,7 +5607,16 @@ static void spirv_compiler_emit_dcl_global_flags(struct spirv_compiler *compiler
if (flags & (VKD3DSGF_ENABLE_DOUBLE_PRECISION_FLOAT_OPS | VKD3DSGF_ENABLE_11_1_DOUBLE_EXTENSIONS))
{
vkd3d_spirv_enable_capability(&compiler->spirv_builder, SpvCapabilityFloat64);
if (compiler->features & VKD3D_SHADER_COMPILE_OPTION_FEATURE_FLOAT64)
{
vkd3d_spirv_enable_capability(&compiler->spirv_builder, SpvCapabilityFloat64);
}
else
{
WARN("Unsupported 64-bit float ops.\n");
spirv_compiler_error(compiler, VKD3D_SHADER_ERROR_SPV_UNSUPPORTED_FEATURE,
"The target environment does not support 64-bit floating point.");
}
flags &= ~(VKD3DSGF_ENABLE_DOUBLE_PRECISION_FLOAT_OPS | VKD3DSGF_ENABLE_11_1_DOUBLE_EXTENSIONS);
}