Module: vkd3d Branch: master Commit: 47ea863535448fe23340a34f2563783a7cf405a7 URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=47ea863535448fe23340a34f...
Author: Zebediah Figura zfigura@codeweavers.com Date: Sat Dec 25 22:43:13 2021 -0600
vkd3d-compiler: Move some argument validation out of parse_command_line().
Signed-off-by: Zebediah Figura zfigura@codeweavers.com Signed-off-by: Henri Verbeet hverbeet@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
programs/vkd3d-compiler/main.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-)
diff --git a/programs/vkd3d-compiler/main.c b/programs/vkd3d-compiler/main.c index 4e56e8f..5607c29 100644 --- a/programs/vkd3d-compiler/main.c +++ b/programs/vkd3d-compiler/main.c @@ -502,23 +502,6 @@ static bool parse_command_line(int argc, char **argv, struct options *options) if (options->target_type == VKD3D_SHADER_TARGET_NONE && !options->preprocess_only) options->target_type = VKD3D_SHADER_TARGET_SPIRV_BINARY;
- if (options->print_target_types) - return true; - - if (!options->preprocess_only && !validate_target_type(options->source_type, options->target_type)) - { - fprintf(stderr, "Target type '%s' is invalid for source type '%s'.\n", - get_target_type_info(options->target_type)->name, - get_source_type_info(options->source_type)->name); - return false; - } - - if (!options->preprocess_only && options->source_type == VKD3D_SHADER_SOURCE_HLSL && !options->profile) - { - fprintf(stderr, "You need to specify a profile when compiling from HLSL source.\n"); - return false; - } - if (optind < argc) options->filename = argv[argc - 1];
@@ -657,6 +640,20 @@ int main(int argc, char **argv) return 0; }
+ if (!options.preprocess_only && !validate_target_type(options.source_type, options.target_type)) + { + fprintf(stderr, "Target type '%s' is invalid for source type '%s'.\n", + get_target_type_info(options.target_type)->name, + get_source_type_info(options.source_type)->name); + return 0; + } + + if (!options.preprocess_only && options.source_type == VKD3D_SHADER_SOURCE_HLSL && !options.profile) + { + fprintf(stderr, "You need to specify a profile when compiling from HLSL source.\n"); + return 0; + } + if (!(input = open_input(options.filename, &close_input))) goto done;