mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -07:00
vkd3d-compiler: Add support for running the HLSL preprocessor.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
584f84737b
commit
9a4a5ba63e
@ -163,6 +163,7 @@ static void print_usage(const char *program_name)
|
|||||||
" Valid values are 'buffer-texture' (default) and\n"
|
" Valid values are 'buffer-texture' (default) and\n"
|
||||||
" 'storage-buffer'.\n"
|
" 'storage-buffer'.\n"
|
||||||
" -e, --entry=<name> Use <name> as the entry point (default is \"main\").\n"
|
" -e, --entry=<name> Use <name> as the entry point (default is \"main\").\n"
|
||||||
|
" -E Preprocess the source code instead of compiling it.\n"
|
||||||
" -o, --output=<file> Write the output to <file>. If <file> is '-' or no\n"
|
" -o, --output=<file> Write the output to <file>. If <file> is '-' or no\n"
|
||||||
" output file is specified, output will be written to\n"
|
" output file is specified, output will be written to\n"
|
||||||
" standard output.\n"
|
" standard output.\n"
|
||||||
@ -196,6 +197,7 @@ struct options
|
|||||||
const char *profile;
|
const char *profile;
|
||||||
enum vkd3d_shader_source_type source_type;
|
enum vkd3d_shader_source_type source_type;
|
||||||
enum vkd3d_shader_target_type target_type;
|
enum vkd3d_shader_target_type target_type;
|
||||||
|
bool preprocess_only;
|
||||||
bool print_version;
|
bool print_version;
|
||||||
bool print_source_types;
|
bool print_source_types;
|
||||||
bool print_target_types;
|
bool print_target_types;
|
||||||
@ -402,7 +404,7 @@ static bool parse_command_line(int argc, char **argv, struct options *options)
|
|||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if ((option = getopt_long(argc, argv, "b:e:ho:p:Vx:", long_options, NULL)) == -1)
|
if ((option = getopt_long(argc, argv, "b:e:Eho:p:Vx:", long_options, NULL)) == -1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
switch (option)
|
switch (option)
|
||||||
@ -429,6 +431,10 @@ static bool parse_command_line(int argc, char **argv, struct options *options)
|
|||||||
options->entry_point = optarg;
|
options->entry_point = optarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'E':
|
||||||
|
options->preprocess_only = true;
|
||||||
|
break;
|
||||||
|
|
||||||
case OPTION_OUTPUT:
|
case OPTION_OUTPUT:
|
||||||
case 'o':
|
case 'o':
|
||||||
options->output_filename = optarg;
|
options->output_filename = optarg;
|
||||||
@ -669,7 +675,11 @@ int main(int argc, char **argv)
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = vkd3d_shader_compile(&info, &output_code, &messages);
|
if (options.preprocess_only)
|
||||||
|
ret = vkd3d_shader_preprocess(&info, &output_code, &messages);
|
||||||
|
else
|
||||||
|
ret = vkd3d_shader_compile(&info, &output_code, &messages);
|
||||||
|
|
||||||
if (messages)
|
if (messages)
|
||||||
fputs(messages, stderr);
|
fputs(messages, stderr);
|
||||||
vkd3d_shader_free_messages(messages);
|
vkd3d_shader_free_messages(messages);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user