Zebediah Figura : vkd3d-compiler: Add support for running the HLSL preprocessor.

Alexandre Julliard julliard at winehq.org
Fri Nov 27 16:03:23 CST 2020


Module: vkd3d
Branch: master
Commit: 9a4a5ba63ebd6fd09fe711c6ed02d2f4af12ad1e
URL:    https://source.winehq.org/git/vkd3d.git/?a=commit;h=9a4a5ba63ebd6fd09fe711c6ed02d2f4af12ad1e

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Thu Nov 26 11:54:35 2020 -0600

vkd3d-compiler: Add support for running the HLSL preprocessor.

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 programs/vkd3d-compiler/main.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/programs/vkd3d-compiler/main.c b/programs/vkd3d-compiler/main.c
index 3eee4bd..cec2ebb 100644
--- a/programs/vkd3d-compiler/main.c
+++ b/programs/vkd3d-compiler/main.c
@@ -163,6 +163,7 @@ static void print_usage(const char *program_name)
         "                        Valid values are 'buffer-texture' (default) and\n"
         "                        'storage-buffer'.\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"
         "                        output file is specified, output will be written to\n"
         "                        standard output.\n"
@@ -196,6 +197,7 @@ struct options
     const char *profile;
     enum vkd3d_shader_source_type source_type;
     enum vkd3d_shader_target_type target_type;
+    bool preprocess_only;
     bool print_version;
     bool print_source_types;
     bool print_target_types;
@@ -402,7 +404,7 @@ static bool parse_command_line(int argc, char **argv, struct options *options)
 
     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;
 
         switch (option)
@@ -429,6 +431,10 @@ static bool parse_command_line(int argc, char **argv, struct options *options)
                 options->entry_point = optarg;
                 break;
 
+            case 'E':
+                options->preprocess_only = true;
+                break;
+
             case OPTION_OUTPUT:
             case 'o':
                 options->output_filename = optarg;
@@ -669,7 +675,11 @@ int main(int argc, char **argv)
         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)
         fputs(messages, stderr);
     vkd3d_shader_free_messages(messages);




More information about the wine-cvs mailing list