Isabella Bosia : vkd3d-compiler: Add spirv-text output type.

Alexandre Julliard julliard at winehq.org
Mon Sep 7 16:07:11 CDT 2020


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

Author: Isabella Bosia <ibosia at codeweavers.com>
Date:   Mon Sep  7 12:35:46 2020 +0100

vkd3d-compiler: Add spirv-text output type.

Also allow outputting non-binary formats to tty.

Signed-off-by: Isabella Bosia <ibosia 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 | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/programs/vkd3d-compiler/main.c b/programs/vkd3d-compiler/main.c
index cb23b81..c05ec6a 100644
--- a/programs/vkd3d-compiler/main.c
+++ b/programs/vkd3d-compiler/main.c
@@ -51,8 +51,8 @@ static const struct source_type_info
 source_type_info[] =
 {
     {VKD3D_SHADER_SOURCE_DXBC_TPF,
-        "dxbc-tpf", "A 'Tokenized Program Format' shader embedded in a DXBC container.\n"
-        "            This is the format used for Direct3D shader model 4 and 5 shaders."},
+        "dxbc-tpf",     "A 'Tokenized Program Format' shader embedded in a DXBC container.\n"
+        "                This is the format used for Direct3D shader model 4 and 5 shaders.\n"},
 };
 
 static const struct target_type_info
@@ -60,12 +60,17 @@ static const struct target_type_info
     enum vkd3d_shader_target_type type;
     const char *name;
     const char *description;
+    bool is_binary;
 }
 target_type_info[] =
 {
     {VKD3D_SHADER_TARGET_SPIRV_BINARY,
         "spirv-binary", "A SPIR-V shader in binary form.\n"
-        "                This is the format used for Vulkan shaders.\n"},
+        "                This is the format used for Vulkan shaders.\n",
+        true},
+    {VKD3D_SHADER_TARGET_SPIRV_TEXT,
+        "spirv-text", "A SPIR-V shader in text form.\n",
+        false},
 };
 
 static bool read_shader(struct vkd3d_shader_code *shader, FILE *f)
@@ -134,8 +139,7 @@ static void print_usage(const char *program_name)
         "[options...] [file]\n"
         "Options:\n"
         "  -h, --help            Display this information and exit.\n"
-        "  -b <type>             Specify the target type. Currently the only valid value\n"
-        "                        is 'spirv-binary'.\n"
+        "  -b <type>             Specify the target type.\n"
         "  --buffer-uav=<type>   Specify the buffer type to use for buffer UAV bindings.\n"
         "                        Valid values are 'buffer-texture' (default) and\n"
         "                        'storage-buffer'.\n"
@@ -393,7 +397,7 @@ static void print_source_types(void)
     {
         const struct source_type_info *type = get_source_type_info(source_types[i]);
         if (type)
-            fprintf(stdout, "  %s  %s", type->name, type->description);
+            fprintf(stdout, "  %-12s  %s", type->name, type->description);
     }
 
 }
@@ -410,7 +414,7 @@ static void print_target_types(enum vkd3d_shader_source_type source_type)
     {
         const struct target_type_info *type = get_target_type_info(target_types[i]);
         if (type)
-            fprintf(stdout, "  %s  %s", type->name, type->description);
+            fprintf(stdout, "  %-12s  %s", type->name, type->description);
     }
 }
 
@@ -502,7 +506,8 @@ int main(int argc, char **argv)
     if (!(output = open_output(options.output_filename, &close_output)))
         goto done;
 
-    if (!options.output_filename && isatty(fileno(output)))
+    if (!options.output_filename && 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");




More information about the wine-cvs mailing list