From: Conor McCarthy cmccarthy@codeweavers.com
--- programs/vkd3d-compiler/main.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/programs/vkd3d-compiler/main.c b/programs/vkd3d-compiler/main.c index fdb1cadea..6fa704f7c 100644 --- a/programs/vkd3d-compiler/main.c +++ b/programs/vkd3d-compiler/main.c @@ -605,6 +605,9 @@ static bool parse_command_line(int argc, char **argv, struct options *options) if (compat_options) add_compile_option(options, VKD3D_SHADER_COMPILE_OPTION_BACKWARD_COMPATIBILITY, compat_options);
+ if (options->target_type == VKD3D_SHADER_TARGET_SPIRV_BINARY || options->target_type == VKD3D_SHADER_TARGET_SPIRV_TEXT) + add_compile_option(options, VKD3D_SHADER_COMPILE_OPTION_FEATURE, VKD3D_SHADER_COMPILE_OPTION_FEATURE_FLOAT64); + if (optind < argc) options->filename = argv[argc - 1];
From: Conor McCarthy cmccarthy@codeweavers.com
--- programs/vkd3d-compiler/main.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/programs/vkd3d-compiler/main.c b/programs/vkd3d-compiler/main.c index 6fa704f7c..2e68cea93 100644 --- a/programs/vkd3d-compiler/main.c +++ b/programs/vkd3d-compiler/main.c @@ -39,6 +39,7 @@ enum { OPTION_HELP = CHAR_MAX + 1, OPTION_BUFFER_UAV, + OPTION_DISABLE_INT64, OPTION_ENTRY, OPTION_FRAGMENT_COORDINATE_ORIGIN, OPTION_MATRIX_STORAGE_ORDER, @@ -471,12 +472,14 @@ static bool parse_command_line(int argc, char **argv, struct options *options) enum vkd3d_shader_compile_option_fragment_coordinate_origin origin; enum vkd3d_shader_compile_option_buffer_uav buffer_uav; unsigned int compat_options = 0; + bool enable_int64 = true; int option;
static struct option long_options[] = { {"help", no_argument, NULL, OPTION_HELP}, {"buffer-uav", required_argument, NULL, OPTION_BUFFER_UAV}, + {"disable-int64", no_argument, NULL, OPTION_DISABLE_INT64}, {"entry", required_argument, NULL, OPTION_ENTRY}, {"fragment-coordinate-origin", required_argument, NULL, OPTION_FRAGMENT_COORDINATE_ORIGIN}, {"matrix-storage-order", required_argument, NULL, OPTION_MATRIX_STORAGE_ORDER}, @@ -521,6 +524,10 @@ static bool parse_command_line(int argc, char **argv, struct options *options) add_compile_option(options, VKD3D_SHADER_COMPILE_OPTION_BUFFER_UAV, buffer_uav); break;
+ case OPTION_DISABLE_INT64: + enable_int64 = false; + break; + case OPTION_ENTRY: case 'e': options->entry_point = optarg; @@ -606,7 +613,10 @@ static bool parse_command_line(int argc, char **argv, struct options *options) add_compile_option(options, VKD3D_SHADER_COMPILE_OPTION_BACKWARD_COMPATIBILITY, compat_options);
if (options->target_type == VKD3D_SHADER_TARGET_SPIRV_BINARY || options->target_type == VKD3D_SHADER_TARGET_SPIRV_TEXT) - add_compile_option(options, VKD3D_SHADER_COMPILE_OPTION_FEATURE, VKD3D_SHADER_COMPILE_OPTION_FEATURE_FLOAT64); + { + add_compile_option(options, VKD3D_SHADER_COMPILE_OPTION_FEATURE, VKD3D_SHADER_COMPILE_OPTION_FEATURE_FLOAT64 + | (enable_int64 ? VKD3D_SHADER_COMPILE_OPTION_FEATURE_INT64 : 0)); + }
if (optind < argc) options->filename = argv[argc - 1];
From: Conor McCarthy cmccarthy@codeweavers.com
--- include/vkd3d_shader.h | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/include/vkd3d_shader.h b/include/vkd3d_shader.h index 2f4478a79..a4eb3252d 100644 --- a/include/vkd3d_shader.h +++ b/include/vkd3d_shader.h @@ -199,7 +199,14 @@ enum vkd3d_shader_compile_option_fragment_coordinate_origin /** Advertises feature availability. \since 1.11 */ enum vkd3d_shader_compile_option_feature_flags { + /** Enable 64-bit integer support for SPIR-V targets. This flag must be set + * for sources which use 64-bit integers, and should only be set if the + * target environment supports the shaderInt64 feature. */ VKD3D_SHADER_COMPILE_OPTION_FEATURE_INT64 = 0x00000001, + /** Enable 64-bit floating point support for SPIR-V targets. This flag must + * be set for sources which use 64-bit floating point values with API + * version 1.11 or greater, and should only be set if the target + * environment supports the shaderFloat64 feature. */ VKD3D_SHADER_COMPILE_OPTION_FEATURE_FLOAT64 = 0x00000002,
VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPILE_OPTION_FEATURE_FLAGS),
Giovanni Mascellani (@giomasce) commented about programs/vkd3d-compiler/main.c:
enum vkd3d_shader_compile_option_fragment_coordinate_origin origin; enum vkd3d_shader_compile_option_buffer_uav buffer_uav; unsigned int compat_options = 0;
bool enable_int64 = true; int option;
static struct option long_options[] = { {"help", no_argument, NULL, OPTION_HELP}, {"buffer-uav", required_argument, NULL, OPTION_BUFFER_UAV},
{"disable-int64", no_argument, NULL, OPTION_DISABLE_INT64},
Do we even want to make this configurable at the level of vkd3d-compiler? It's the kind of feature that either the shader needs or does not. It makes sense to have configurability in the library so vkd3d can error out appropriately is a feature is not used, but if the compilation is done "by hand" I don't really see the point of enforcing the unavailability of int64.
This merge request was approved by Giovanni Mascellani.
Do we even want to make this configurable at the level of vkd3d-compiler?
Ultimately I think we do, but this probably isn't the way. What we want is probably some way to specify a target GPU or feature set, somewhat along the lines of gcc's "-march" option. These would then imply a particular set of supported extensions and features. Similarly, we could imagine vkd3d-compiler querying the features of the host GPU, along the lines of "-march=native".
Building from there, we could probably add options to enable/disable individual extensions and features as well.
This merge request was closed by Conor McCarthy.