mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-compiler: Introduce an option to specify the origin of fragment coordinates.
This commit is contained in:
parent
e7eec3e023
commit
557b32a504
Notes:
Alexandre Julliard
2023-11-10 00:08:58 +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/457
@ -40,6 +40,7 @@ enum
|
|||||||
OPTION_HELP = CHAR_MAX + 1,
|
OPTION_HELP = CHAR_MAX + 1,
|
||||||
OPTION_BUFFER_UAV,
|
OPTION_BUFFER_UAV,
|
||||||
OPTION_ENTRY,
|
OPTION_ENTRY,
|
||||||
|
OPTION_FRAGMENT_COORDINATE_ORIGIN,
|
||||||
OPTION_MATRIX_STORAGE_ORDER,
|
OPTION_MATRIX_STORAGE_ORDER,
|
||||||
OPTION_OUTPUT,
|
OPTION_OUTPUT,
|
||||||
OPTION_PRINT_SOURCE_TYPES,
|
OPTION_PRINT_SOURCE_TYPES,
|
||||||
@ -189,6 +190,11 @@ static void print_usage(const char *program_name)
|
|||||||
" optionally prefixed by '+' or '-'. Valid flags are\n"
|
" optionally prefixed by '+' or '-'. Valid flags are\n"
|
||||||
" 'colour', 'indent', 'offsets', 'header', and 'raw-ids'.\n"
|
" 'colour', 'indent', 'offsets', 'header', and 'raw-ids'.\n"
|
||||||
" The 'indent' and 'header' flags are enabled by default.\n"
|
" The 'indent' and 'header' flags are enabled by default.\n"
|
||||||
|
" --fragment-coordinate-origin=<origin>\n"
|
||||||
|
" Specify the origin of fragment coordinates for SPIR-V\n"
|
||||||
|
" targets. Valid values are 'upper-left' (default) and\n"
|
||||||
|
" 'lower-left'. The only value supported by Vulkan\n"
|
||||||
|
" environments is 'upper-left'.\n"
|
||||||
" --matrix-storage-order=<order>\n"
|
" --matrix-storage-order=<order>\n"
|
||||||
" Specify the default matrix storage order. Valid values\n"
|
" Specify the default matrix storage order. Valid values\n"
|
||||||
" are 'column' (default) and 'row'.\n"
|
" are 'column' (default) and 'row'.\n"
|
||||||
@ -337,6 +343,24 @@ static bool parse_formatting(uint32_t *formatting, bool *colour, char *arg)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool parse_fragment_coordinate_origin(enum vkd3d_shader_compile_option_fragment_coordinate_origin *origin,
|
||||||
|
const char *arg)
|
||||||
|
{
|
||||||
|
if (!strcmp(arg, "upper-left"))
|
||||||
|
{
|
||||||
|
*origin = VKD3D_SHADER_COMPILE_OPTION_FRAGMENT_COORDINATE_ORIGIN_UPPER_LEFT;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!strcmp(arg, "lower-left"))
|
||||||
|
{
|
||||||
|
*origin = VKD3D_SHADER_COMPILE_OPTION_FRAGMENT_COORDINATE_ORIGIN_LOWER_LEFT;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static bool parse_matrix_storage_order(enum vkd3d_shader_compile_option_pack_matrix_order *order, const char *arg)
|
static bool parse_matrix_storage_order(enum vkd3d_shader_compile_option_pack_matrix_order *order, const char *arg)
|
||||||
{
|
{
|
||||||
if (!strcmp(arg, "column"))
|
if (!strcmp(arg, "column"))
|
||||||
@ -441,6 +465,7 @@ static bool validate_target_type(
|
|||||||
static bool parse_command_line(int argc, char **argv, struct options *options)
|
static bool parse_command_line(int argc, char **argv, struct options *options)
|
||||||
{
|
{
|
||||||
enum vkd3d_shader_compile_option_pack_matrix_order pack_matrix_order;
|
enum vkd3d_shader_compile_option_pack_matrix_order pack_matrix_order;
|
||||||
|
enum vkd3d_shader_compile_option_fragment_coordinate_origin origin;
|
||||||
enum vkd3d_shader_compile_option_buffer_uav buffer_uav;
|
enum vkd3d_shader_compile_option_buffer_uav buffer_uav;
|
||||||
unsigned int compat_options = 0;
|
unsigned int compat_options = 0;
|
||||||
int option;
|
int option;
|
||||||
@ -450,6 +475,7 @@ static bool parse_command_line(int argc, char **argv, struct options *options)
|
|||||||
{"help", no_argument, NULL, OPTION_HELP},
|
{"help", no_argument, NULL, OPTION_HELP},
|
||||||
{"buffer-uav", required_argument, NULL, OPTION_BUFFER_UAV},
|
{"buffer-uav", required_argument, NULL, OPTION_BUFFER_UAV},
|
||||||
{"entry", required_argument, NULL, OPTION_ENTRY},
|
{"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},
|
{"matrix-storage-order", required_argument, NULL, OPTION_MATRIX_STORAGE_ORDER},
|
||||||
{"output", required_argument, NULL, OPTION_OUTPUT},
|
{"output", required_argument, NULL, OPTION_OUTPUT},
|
||||||
{"formatting", required_argument, NULL, OPTION_TEXT_FORMATTING},
|
{"formatting", required_argument, NULL, OPTION_TEXT_FORMATTING},
|
||||||
@ -501,6 +527,15 @@ static bool parse_command_line(int argc, char **argv, struct options *options)
|
|||||||
options->preprocess_only = true;
|
options->preprocess_only = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case OPTION_FRAGMENT_COORDINATE_ORIGIN:
|
||||||
|
if (!parse_fragment_coordinate_origin(&origin, optarg))
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Invalid fragment coordinate origin '%s' specified.\n", optarg);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
add_compile_option(options, VKD3D_SHADER_COMPILE_OPTION_FRAGMENT_COORDINATE_ORIGIN, origin);
|
||||||
|
break;
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
case OPTION_HELP:
|
case OPTION_HELP:
|
||||||
options->print_help = true;
|
options->print_help = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user