vkd3d-shader/spirv: Introduce a compiler feature flag for int64 capability.

This commit is contained in:
Conor McCarthy 2023-12-06 00:12:56 +10:00 committed by Alexandre Julliard
parent 108941fce0
commit cdb9eecfd1
Notes: Alexandre Julliard 2023-12-12 23:15: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/489
2 changed files with 40 additions and 3 deletions

View File

@ -196,6 +196,14 @@ enum vkd3d_shader_compile_option_fragment_coordinate_origin
VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPILE_OPTION_FRAGMENT_COORDINATE_ORIGIN),
};
/** Advertises feature availability. \since 1.11 */
enum vkd3d_shader_compile_option_feature_flags
{
VKD3D_SHADER_COMPILE_OPTION_FEATURE_INT64 = 0x00000001,
VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPILE_OPTION_FEATURE_FLAGS),
};
enum vkd3d_shader_compile_option_name
{
/**
@ -253,6 +261,16 @@ enum vkd3d_shader_compile_option_name
* \since 1.10
*/
VKD3D_SHADER_COMPILE_OPTION_FRAGMENT_COORDINATE_ORIGIN = 0x00000009,
/**
* This option specifies the shader features available in the target
* environment. These are not extensions, i.e. they are always supported
* by the driver, but may not be supported by the available hardware.
*
* \a value is a member of enum vkd3d_shader_compile_option_feature_flags.
*
* \since 1.11
*/
VKD3D_SHADER_COMPILE_OPTION_FEATURE = 0x0000000a,
VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPILE_OPTION_NAME),
};

View File

@ -2396,6 +2396,7 @@ struct spirv_compiler
struct vkd3d_shader_spec_constant *spec_constants;
size_t spec_constants_size;
enum vkd3d_shader_compile_option_formatting_flags formatting;
enum vkd3d_shader_compile_option_feature_flags features;
bool write_tess_geom_point_size;
struct vkd3d_string_buffer_cache string_buffers;
@ -2553,6 +2554,10 @@ static struct spirv_compiler *spirv_compiler_create(const struct vkd3d_shader_ve
WARN("Ignoring unrecognised value %#x for option %#x.\n", option->value, option->name);
break;
case VKD3D_SHADER_COMPILE_OPTION_FEATURE:
compiler->features = option->value;
break;
default:
WARN("Ignoring unrecognised option %#x with value %#x.\n", option->name, option->value);
break;
@ -5528,9 +5533,16 @@ static void spirv_compiler_emit_dcl_global_flags(struct spirv_compiler *compiler
if (flags & VKD3DSGF_ENABLE_INT64)
{
FIXME("Unsupported 64-bit integer ops.\n");
if (compiler->features & VKD3D_SHADER_COMPILE_OPTION_FEATURE_INT64)
{
vkd3d_spirv_enable_capability(&compiler->spirv_builder, SpvCapabilityInt64);
}
else
{
WARN("Unsupported 64-bit integer ops.\n");
spirv_compiler_error(compiler, VKD3D_SHADER_ERROR_SPV_UNSUPPORTED_FEATURE,
"Support for 64-bit integers is not implemented.");
"The target environment does not support 64-bit integers.");
}
flags &= ~VKD3DSGF_ENABLE_INT64;
}
@ -7147,6 +7159,13 @@ static void spirv_compiler_emit_int_div(struct spirv_compiler *compiler,
div_op = instruction->handler_idx == VKD3DSIH_IDIV ? SpvOpSDiv : SpvOpUDiv;
mod_op = instruction->handler_idx == VKD3DSIH_IDIV ? SpvOpSRem : SpvOpUMod;
if (dst[0].reg.data_type == VKD3D_DATA_UINT64 || dst[1].reg.data_type == VKD3D_DATA_UINT64)
{
FIXME("Unsupported 64-bit result.\n");
spirv_compiler_error(compiler, VKD3D_SHADER_ERROR_SPV_UNSUPPORTED_FEATURE,
"Bool cast to 64-bit integer is not supported.");
}
if (dst[0].reg.type != VKD3DSPR_NULL)
{
component_count = vkd3d_write_mask_component_count(dst[0].write_mask);