vkd3d-shader/sm4: Use a flat array to store destination types.

This cuts about 12 kB off of the 64-bit build.
This commit is contained in:
Zebediah Figura 2022-03-12 15:52:41 -06:00 committed by Alexandre Julliard
parent 4173158c8b
commit 520c7457a9
Notes: Alexandre Julliard 2022-11-08 23:05:02 +01:00
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/45

View File

@ -22,6 +22,7 @@
#include "sm4.h" #include "sm4.h"
#define SM4_MAX_SRC_COUNT 6 #define SM4_MAX_SRC_COUNT 6
#define SM4_MAX_DST_COUNT 2
STATIC_ASSERT(SM4_MAX_SRC_COUNT <= SPIRV_MAX_SRC_COUNT); STATIC_ASSERT(SM4_MAX_SRC_COUNT <= SPIRV_MAX_SRC_COUNT);
@ -96,7 +97,7 @@ struct vkd3d_shader_sm4_parser
unsigned int output_map[MAX_REG_OUTPUT]; unsigned int output_map[MAX_REG_OUTPUT];
struct vkd3d_shader_src_param src_param[SM4_MAX_SRC_COUNT]; struct vkd3d_shader_src_param src_param[SM4_MAX_SRC_COUNT];
struct vkd3d_shader_dst_param dst_param[2]; struct vkd3d_shader_dst_param dst_param[SM4_MAX_DST_COUNT];
struct list src_free; struct list src_free;
struct list src; struct list src;
struct vkd3d_shader_immediate_constant_buffer icb; struct vkd3d_shader_immediate_constant_buffer icb;
@ -108,7 +109,7 @@ struct vkd3d_sm4_opcode_info
{ {
enum vkd3d_sm4_opcode opcode; enum vkd3d_sm4_opcode opcode;
enum vkd3d_shader_opcode handler_idx; enum vkd3d_shader_opcode handler_idx;
const char *dst_info; char dst_info[SM4_MAX_DST_COUNT];
char src_info[SM4_MAX_SRC_COUNT]; char src_info[SM4_MAX_SRC_COUNT];
void (*read_opcode_func)(struct vkd3d_shader_instruction *ins, uint32_t opcode, uint32_t opcode_token, void (*read_opcode_func)(struct vkd3d_shader_instruction *ins, uint32_t opcode, uint32_t opcode_token,
const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv); const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv);
@ -1518,7 +1519,7 @@ static void shader_sm4_read_instruction(struct vkd3d_shader_parser *parser, stru
ins->raw = false; ins->raw = false;
ins->structured = false; ins->structured = false;
ins->predicate = NULL; ins->predicate = NULL;
ins->dst_count = strlen(opcode_info->dst_info); ins->dst_count = strnlen(opcode_info->dst_info, SM4_MAX_DST_COUNT);
ins->dst = sm4->dst_param; ins->dst = sm4->dst_param;
ins->src_count = strnlen(opcode_info->src_info, SM4_MAX_SRC_COUNT); ins->src_count = strnlen(opcode_info->src_info, SM4_MAX_SRC_COUNT);
ins->src = sm4->src_param; ins->src = sm4->src_param;