vkd3d-shader/d3d-asm: Describe the ASM dialect with a bunch of flags instead of a plain enum.

This commit is contained in:
Giovanni Mascellani 2024-01-17 23:14:33 +01:00 committed by Alexandre Julliard
parent 94d641783b
commit 9d99389663
Notes: Alexandre Julliard 2024-03-07 23:21:49 +01:00
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/553
3 changed files with 10 additions and 10 deletions

View File

@ -377,7 +377,7 @@ struct vkd3d_d3d_asm_compiler
struct vkd3d_string_buffer buffer;
struct vkd3d_shader_version shader_version;
struct vkd3d_d3d_asm_colours colours;
enum vsir_asm_dialect dialect;
enum vsir_asm_flags flags;
const struct vkd3d_shader_instruction *current;
};
@ -1370,7 +1370,7 @@ static void shader_dump_reg_type(struct vkd3d_d3d_asm_compiler *compiler,
struct vkd3d_string_buffer *buffer = &compiler->buffer;
const char *dimension;
if (compiler->dialect != VSIR_ASM_VSIR)
if (!(compiler->flags & VSIR_ASM_FLAG_DUMP_TYPES))
return;
if (reg->dimension < ARRAY_SIZE(dimensions))
@ -2039,13 +2039,13 @@ static void shader_dump_instruction(struct vkd3d_d3d_asm_compiler *compiler,
enum vkd3d_result vkd3d_dxbc_binary_to_text(const struct vsir_program *program,
const struct vkd3d_shader_compile_info *compile_info,
struct vkd3d_shader_code *out, enum vsir_asm_dialect dialect)
struct vkd3d_shader_code *out, enum vsir_asm_flags flags)
{
const struct vkd3d_shader_version *shader_version = &program->shader_version;
enum vkd3d_shader_compile_option_formatting_flags formatting;
struct vkd3d_d3d_asm_compiler compiler =
{
.dialect = dialect,
.flags = flags,
};
enum vkd3d_result result = VKD3D_OK;
struct vkd3d_string_buffer *buffer;
@ -2159,7 +2159,7 @@ void vkd3d_shader_trace(const struct vsir_program *program)
const char *p, *q, *end;
struct vkd3d_shader_code code;
if (vkd3d_dxbc_binary_to_text(program, NULL, &code, VSIR_ASM_VSIR) != VKD3D_OK)
if (vkd3d_dxbc_binary_to_text(program, NULL, &code, VSIR_ASM_FLAG_DUMP_TYPES) != VKD3D_OK)
return;
end = (const char *)code.code + code.size;

View File

@ -1601,7 +1601,7 @@ static int vkd3d_shader_parser_compile(struct vkd3d_shader_parser *parser,
switch (compile_info->target_type)
{
case VKD3D_SHADER_TARGET_D3D_ASM:
ret = vkd3d_dxbc_binary_to_text(&parser->program, compile_info, out, VSIR_ASM_D3D);
ret = vkd3d_dxbc_binary_to_text(&parser->program, compile_info, out, VSIR_ASM_FLAG_NONE);
break;
case VKD3D_SHADER_TARGET_GLSL:

View File

@ -1386,15 +1386,15 @@ struct vkd3d_string_buffer_cache
size_t count, max_count, capacity;
};
enum vsir_asm_dialect
enum vsir_asm_flags
{
VSIR_ASM_VSIR,
VSIR_ASM_D3D,
VSIR_ASM_FLAG_NONE = 0,
VSIR_ASM_FLAG_DUMP_TYPES = 0x1,
};
enum vkd3d_result vkd3d_dxbc_binary_to_text(const struct vsir_program *program,
const struct vkd3d_shader_compile_info *compile_info,
struct vkd3d_shader_code *out, enum vsir_asm_dialect dialect);
struct vkd3d_shader_code *out, enum vsir_asm_flags flags);
void vkd3d_string_buffer_cleanup(struct vkd3d_string_buffer *buffer);
struct vkd3d_string_buffer *vkd3d_string_buffer_get(struct vkd3d_string_buffer_cache *list);
void vkd3d_string_buffer_init(struct vkd3d_string_buffer *buffer);