vkd3d-shader/d3dbc: Use enum vkd3d_shader_dst_modifier in struct sm1_dst_register.

This commit is contained in:
Henri Verbeet 2024-08-13 22:35:04 +02:00
parent b31c9831fa
commit f3e6c75c89
Notes: Henri Verbeet 2024-09-11 15:35:00 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1059

View File

@ -1877,7 +1877,7 @@ struct sm1_instruction
struct sm1_dst_register struct sm1_dst_register
{ {
enum vkd3d_shader_register_type type; enum vkd3d_shader_register_type type;
D3DSHADER_PARAM_DSTMOD_TYPE mod; enum vkd3d_shader_dst_modifier mod;
unsigned int writemask; unsigned int writemask;
uint32_t reg; uint32_t reg;
} dst; } dst;
@ -1902,7 +1902,7 @@ static bool is_inconsequential_instr(const struct sm1_instruction *instr)
if (instr->opcode != VKD3D_SM1_OP_MOV) if (instr->opcode != VKD3D_SM1_OP_MOV)
return false; return false;
if (dst->mod != D3DSPDM_NONE) if (dst->mod != VKD3DSPDM_NONE)
return false; return false;
if (src->mod != D3DSPSM_NONE) if (src->mod != D3DSPSM_NONE)
return false; return false;
@ -1923,7 +1923,10 @@ static bool is_inconsequential_instr(const struct sm1_instruction *instr)
static void write_sm1_dst_register(struct vkd3d_bytecode_buffer *buffer, const struct sm1_dst_register *reg) static void write_sm1_dst_register(struct vkd3d_bytecode_buffer *buffer, const struct sm1_dst_register *reg)
{ {
VKD3D_ASSERT(reg->writemask); VKD3D_ASSERT(reg->writemask);
put_u32(buffer, (1u << 31) | sm1_encode_register_type(reg->type) | reg->mod | (reg->writemask << 16) | reg->reg); put_u32(buffer, VKD3D_SM1_INSTRUCTION_PARAMETER
| sm1_encode_register_type(reg->type)
| (reg->mod << VKD3D_SM1_DST_MODIFIER_SHIFT)
| (reg->writemask << VKD3D_SM1_WRITEMASK_SHIFT) | reg->reg);
} }
static void write_sm1_src_register(struct vkd3d_bytecode_buffer *buffer, static void write_sm1_src_register(struct vkd3d_bytecode_buffer *buffer,
@ -1962,7 +1965,7 @@ static void sm1_map_src_swizzle(struct sm1_src_register *src, unsigned int map_w
static void d3dbc_write_unary_op(struct d3dbc_compiler *d3dbc, enum vkd3d_sm1_opcode opcode, static void d3dbc_write_unary_op(struct d3dbc_compiler *d3dbc, enum vkd3d_sm1_opcode opcode,
const struct hlsl_reg *dst, const struct hlsl_reg *src, const struct hlsl_reg *dst, const struct hlsl_reg *src,
D3DSHADER_PARAM_SRCMOD_TYPE src_mod, D3DSHADER_PARAM_DSTMOD_TYPE dst_mod) D3DSHADER_PARAM_SRCMOD_TYPE src_mod, enum vkd3d_shader_dst_modifier dst_mod)
{ {
struct sm1_instruction instr = struct sm1_instruction instr =
{ {
@ -2117,7 +2120,7 @@ static void sm1_src_reg_from_vsir(struct d3dbc_compiler *d3dbc, const struct vkd
static void sm1_dst_reg_from_vsir(struct d3dbc_compiler *d3dbc, const struct vkd3d_shader_dst_param *param, static void sm1_dst_reg_from_vsir(struct d3dbc_compiler *d3dbc, const struct vkd3d_shader_dst_param *param,
struct sm1_dst_register *dst, const struct vkd3d_shader_location *loc) struct sm1_dst_register *dst, const struct vkd3d_shader_location *loc)
{ {
dst->mod = (uint32_t)param->modifiers << VKD3D_SM1_DST_MODIFIER_SHIFT; dst->mod = param->modifiers;
dst->reg = param->reg.idx[0].offset; dst->reg = param->reg.idx[0].offset;
dst->type = param->reg.type; dst->type = param->reg.type;
dst->writemask = param->write_mask; dst->writemask = param->write_mask;