vkd3d-shader: Invert the "NO_HEADER" output formatting flag.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2020-09-21 19:48:29 +03:30 committed by Alexandre Julliard
parent 8cc0abfca0
commit 7c64e827ca
3 changed files with 13 additions and 9 deletions

View File

@ -79,7 +79,7 @@ enum vkd3d_shader_compile_option_formatting_flags
VKD3D_SHADER_COMPILE_OPTION_FORMATTING_COLOUR = 0x00000001, VKD3D_SHADER_COMPILE_OPTION_FORMATTING_COLOUR = 0x00000001,
VKD3D_SHADER_COMPILE_OPTION_FORMATTING_INDENT = 0x00000002, VKD3D_SHADER_COMPILE_OPTION_FORMATTING_INDENT = 0x00000002,
VKD3D_SHADER_COMPILE_OPTION_FORMATTING_OFFSETS = 0x00000004, 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_SHADER_COMPILE_OPTION_FORMATTING_FRIENDLY_NAMES = 0x00000010,
VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPILE_OPTION_FORMATTING_FLAGS), VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPILE_OPTION_FORMATTING_FLAGS),

View File

@ -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; enum vkd3d_shader_compile_option_formatting_flags vkd3d;
uint32_t spv; uint32_t spv;
bool invert;
} }
valuemap[] = valuemap[] =
{ {
{VKD3D_SHADER_COMPILE_OPTION_FORMATTING_COLOUR, SPV_BINARY_TO_TEXT_OPTION_COLOR }, {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_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_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 }, {VKD3D_SHADER_COMPILE_OPTION_FORMATTING_FRIENDLY_NAMES, SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES },
}; };
for (i = 0; i < ARRAY_SIZE(valuemap); i++) for (i = 0; i < ARRAY_SIZE(valuemap); ++i)
if (formatting & valuemap[i].vkd3d) {
if (valuemap[i].invert == !(formatting & valuemap[i].vkd3d))
out |= valuemap[i].spv; out |= valuemap[i].spv;
}
return out; 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)); vkd3d_spirv_builder_init(&compiler->spirv_builder, vkd3d_dxbc_compiler_get_entry_point_name(compiler));
compiler->formatting = VKD3D_SHADER_COMPILE_OPTION_FORMATTING_FRIENDLY_NAMES | compiler->formatting = VKD3D_SHADER_COMPILE_OPTION_FORMATTING_FRIENDLY_NAMES
VKD3D_SHADER_COMPILE_OPTION_FORMATTING_INDENT; | VKD3D_SHADER_COMPILE_OPTION_FORMATTING_INDENT
| VKD3D_SHADER_COMPILE_OPTION_FORMATTING_HEADER;
for (i = 0; i < compile_info->option_count; ++i) for (i = 0; i < compile_info->option_count; ++i)
{ {

View File

@ -149,8 +149,8 @@ static void print_usage(const char *program_name)
" standard output.\n" " standard output.\n"
" --formatting=<type> Specify the formatting options for text output.\n" " --formatting=<type> Specify the formatting options for text output.\n"
" Valid values are 'none', 'print', 'colour', 'indent',\n" " Valid values are 'none', 'print', 'colour', 'indent',\n"
" 'offsets', 'no-header', and 'friendly-names'.\n" " 'offsets', 'header', and 'friendly-names'.\n"
" Default is --formatting=friendly-names,indent.\n" " Default is --formatting=friendly-names,indent,header.\n"
" --print-source-types Display the supported source types and exit.\n" " --print-source-types Display the supported source types and exit.\n"
" --print-target-types Display the supported target types for the specified\n" " --print-target-types Display the supported target types for the specified\n"
" source type and exit.\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 }, {"colour", VKD3D_SHADER_COMPILE_OPTION_FORMATTING_COLOUR },
{"indent", VKD3D_SHADER_COMPILE_OPTION_FORMATTING_INDENT }, {"indent", VKD3D_SHADER_COMPILE_OPTION_FORMATTING_INDENT },
{"offsets", VKD3D_SHADER_COMPILE_OPTION_FORMATTING_OFFSETS }, {"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 }, {"friendly-names", VKD3D_SHADER_COMPILE_OPTION_FORMATTING_FRIENDLY_NAMES },
}; };
char *tok; char *tok;