From 7c64e827ca3ddfe0c9d456810ac0acbd10d0b6b4 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Mon, 21 Sep 2020 19:48:29 +0330 Subject: [PATCH] vkd3d-shader: Invert the "NO_HEADER" output formatting flag. Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- include/vkd3d_shader.h | 2 +- libs/vkd3d-shader/spirv.c | 14 +++++++++----- programs/vkd3d-compiler/main.c | 6 +++--- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/include/vkd3d_shader.h b/include/vkd3d_shader.h index 624376d2..f6dc4773 100644 --- a/include/vkd3d_shader.h +++ b/include/vkd3d_shader.h @@ -79,7 +79,7 @@ enum vkd3d_shader_compile_option_formatting_flags VKD3D_SHADER_COMPILE_OPTION_FORMATTING_COLOUR = 0x00000001, VKD3D_SHADER_COMPILE_OPTION_FORMATTING_INDENT = 0x00000002, VKD3D_SHADER_COMPILE_OPTION_FORMATTING_OFFSETS = 0x00000004, - VKD3D_SHADER_COMPILE_OPTION_FORMATTING_NO_HEADER = 0x00000008, + VKD3D_SHADER_COMPILE_OPTION_FORMATTING_HEADER = 0x00000008, VKD3D_SHADER_COMPILE_OPTION_FORMATTING_FRIENDLY_NAMES = 0x00000010, VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPILE_OPTION_FORMATTING_FLAGS), diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 33356d8e..560e8573 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -59,19 +59,22 @@ static uint32_t get_binary_to_text_options(enum vkd3d_shader_compile_option_form { enum vkd3d_shader_compile_option_formatting_flags vkd3d; uint32_t spv; + bool invert; } valuemap[] = { {VKD3D_SHADER_COMPILE_OPTION_FORMATTING_COLOUR, SPV_BINARY_TO_TEXT_OPTION_COLOR }, {VKD3D_SHADER_COMPILE_OPTION_FORMATTING_INDENT, SPV_BINARY_TO_TEXT_OPTION_INDENT }, {VKD3D_SHADER_COMPILE_OPTION_FORMATTING_OFFSETS, SPV_BINARY_TO_TEXT_OPTION_SHOW_BYTE_OFFSET}, - {VKD3D_SHADER_COMPILE_OPTION_FORMATTING_NO_HEADER, SPV_BINARY_TO_TEXT_OPTION_NO_HEADER }, + {VKD3D_SHADER_COMPILE_OPTION_FORMATTING_HEADER, SPV_BINARY_TO_TEXT_OPTION_NO_HEADER, true}, {VKD3D_SHADER_COMPILE_OPTION_FORMATTING_FRIENDLY_NAMES, SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES }, }; - for (i = 0; i < ARRAY_SIZE(valuemap); i++) - if (formatting & valuemap[i].vkd3d) + for (i = 0; i < ARRAY_SIZE(valuemap); ++i) + { + if (valuemap[i].invert == !(formatting & valuemap[i].vkd3d)) out |= valuemap[i].spv; + } return out; } @@ -2268,8 +2271,9 @@ struct vkd3d_dxbc_compiler *vkd3d_dxbc_compiler_create(const struct vkd3d_shader vkd3d_spirv_builder_init(&compiler->spirv_builder, vkd3d_dxbc_compiler_get_entry_point_name(compiler)); - compiler->formatting = VKD3D_SHADER_COMPILE_OPTION_FORMATTING_FRIENDLY_NAMES | - VKD3D_SHADER_COMPILE_OPTION_FORMATTING_INDENT; + compiler->formatting = VKD3D_SHADER_COMPILE_OPTION_FORMATTING_FRIENDLY_NAMES + | VKD3D_SHADER_COMPILE_OPTION_FORMATTING_INDENT + | VKD3D_SHADER_COMPILE_OPTION_FORMATTING_HEADER; for (i = 0; i < compile_info->option_count; ++i) { diff --git a/programs/vkd3d-compiler/main.c b/programs/vkd3d-compiler/main.c index cc508663..2780d3ec 100644 --- a/programs/vkd3d-compiler/main.c +++ b/programs/vkd3d-compiler/main.c @@ -149,8 +149,8 @@ static void print_usage(const char *program_name) " standard output.\n" " --formatting= Specify the formatting options for text output.\n" " Valid values are 'none', 'print', 'colour', 'indent',\n" - " 'offsets', 'no-header', and 'friendly-names'.\n" - " Default is --formatting=friendly-names,indent.\n" + " 'offsets', 'header', and 'friendly-names'.\n" + " Default is --formatting=friendly-names,indent,header.\n" " --print-source-types Display the supported source types and exit.\n" " --print-target-types Display the supported target types for the specified\n" " source type and exit.\n" @@ -239,7 +239,7 @@ static bool parse_formatting(uint32_t *formatting, char *arg) {"colour", VKD3D_SHADER_COMPILE_OPTION_FORMATTING_COLOUR }, {"indent", VKD3D_SHADER_COMPILE_OPTION_FORMATTING_INDENT }, {"offsets", VKD3D_SHADER_COMPILE_OPTION_FORMATTING_OFFSETS }, - {"no-header", VKD3D_SHADER_COMPILE_OPTION_FORMATTING_NO_HEADER }, + {"header", VKD3D_SHADER_COMPILE_OPTION_FORMATTING_HEADER }, {"friendly-names", VKD3D_SHADER_COMPILE_OPTION_FORMATTING_FRIENDLY_NAMES }, }; char *tok;