Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- programs/vkd3d-compiler/main.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/programs/vkd3d-compiler/main.c b/programs/vkd3d-compiler/main.c index cec2ebb1..9aba2a26 100644 --- a/programs/vkd3d-compiler/main.c +++ b/programs/vkd3d-compiler/main.c @@ -397,8 +397,8 @@ static bool parse_command_line(int argc, char **argv, struct options *options) };
memset(options, 0, sizeof(*options)); - options->source_type = VKD3D_SHADER_SOURCE_DXBC_TPF; - options->target_type = VKD3D_SHADER_TARGET_SPIRV_BINARY; + options->source_type = VKD3D_SHADER_SOURCE_NONE; + options->target_type = VKD3D_SHADER_TARGET_NONE; options->formatting = VKD3D_SHADER_COMPILE_OPTION_FORMATTING_INDENT | VKD3D_SHADER_COMPILE_OPTION_FORMATTING_HEADER;
@@ -483,7 +483,8 @@ static bool parse_command_line(int argc, char **argv, struct options *options) if (options->print_target_types) return true;
- if (!validate_target_type(options->source_type, options->target_type)) + if (options->source_type != VKD3D_SHADER_SOURCE_NONE && options->target_type != VKD3D_SHADER_TARGET_NONE + && !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, @@ -606,6 +607,11 @@ int main(int argc, char **argv) return 1; }
+ if (options.source_type == VKD3D_SHADER_SOURCE_NONE) + options.source_type = options.preprocess_only ? VKD3D_SHADER_SOURCE_HLSL : VKD3D_SHADER_SOURCE_DXBC_TPF; + if (options.target_type == VKD3D_SHADER_TARGET_NONE && !options.preprocess_only) + options.target_type = VKD3D_SHADER_TARGET_SPIRV_BINARY; + if (options.print_version) { const char *version = vkd3d_shader_get_version(NULL, NULL); @@ -639,8 +645,8 @@ int main(int argc, char **argv) if (!(output = open_output(options.output_filename, &close_output))) goto done;
- if (!options.output_filename && get_target_type_info(options.target_type)->is_binary - && isatty(fileno(output))) + if (!options.output_filename && options.target_type != VKD3D_SHADER_TARGET_NONE + && get_target_type_info(options.target_type)->is_binary && isatty(fileno(output))) { fprintf(stderr, "Output is a tty and output format is binary, exiting.\n" "If this is really what you intended, specify the output explicitly.\n");