vkd3d-shader/tpf: Replace sm4_src_register with vkd3d_shader_src_param.

This commit is contained in:
Francisco Casas 2023-07-18 19:54:17 -04:00 committed by Alexandre Julliard
parent 13f62e60e1
commit c92772657f
Notes: Alexandre Julliard 2023-10-03 21:41:02 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/382

View File

@ -3635,13 +3635,7 @@ struct sm4_instruction
struct vkd3d_shader_dst_param dsts[2];
unsigned int dst_count;
struct sm4_src_register
{
struct vkd3d_shader_register reg;
enum vkd3d_sm4_swizzle_type swizzle_type;
DWORD swizzle;
enum vkd3d_shader_src_modifier modifiers;
} srcs[5];
struct vkd3d_shader_src_param srcs[5];
unsigned int src_count;
unsigned int byte_stride;
@ -3777,7 +3771,7 @@ static void sm4_register_from_deref(struct hlsl_ctx *ctx, struct vkd3d_shader_re
}
}
static void sm4_src_from_deref(const struct tpf_writer *tpf, struct sm4_src_register *src,
static void sm4_src_from_deref(const struct tpf_writer *tpf, struct vkd3d_shader_src_param *src,
const struct hlsl_deref *deref, unsigned int map_writemask)
{
unsigned int writemask, hlsl_swizzle;
@ -3806,7 +3800,7 @@ static void sm4_dst_from_node(struct vkd3d_shader_dst_param *dst, const struct h
sm4_register_from_node(&dst->reg, &dst->write_mask, instr);
}
static void sm4_src_from_constant_value(struct sm4_src_register *src,
static void sm4_src_from_constant_value(struct vkd3d_shader_src_param *src,
const struct hlsl_constant_value *value, unsigned int width, unsigned int map_writemask)
{
src->swizzle = VKD3D_SHADER_NO_SWIZZLE;
@ -3831,7 +3825,7 @@ static void sm4_src_from_constant_value(struct sm4_src_register *src,
}
}
static void sm4_src_from_node(const struct tpf_writer *tpf, struct sm4_src_register *src,
static void sm4_src_from_node(const struct tpf_writer *tpf, struct vkd3d_shader_src_param *src,
const struct hlsl_ir_node *instr, unsigned int map_writemask)
{
unsigned int writemask, hlsl_swizzle;
@ -3887,7 +3881,7 @@ static void sm4_write_dst_register(const struct tpf_writer *tpf, const struct vk
}
}
static void sm4_write_src_register(const struct tpf_writer *tpf, const struct sm4_src_register *src)
static void sm4_write_src_register(const struct tpf_writer *tpf, const struct vkd3d_shader_src_param *src)
{
const struct vkd3d_sm4_register_type_info *register_type_info;
struct vkd3d_bytecode_buffer *buffer = tpf->buffer;
@ -3973,7 +3967,7 @@ static void sm4_write_src_register(const struct tpf_writer *tpf, const struct sm
}
}
static uint32_t vkd3d_shader_dst_param_order(const struct vkd3d_shader_dst_param *dst)
static uint32_t sm4_token_count_from_dst_register(const struct vkd3d_shader_dst_param *dst)
{
uint32_t order = 1;
if (dst->reg.type == VKD3DSPR_IMMCONST)
@ -3982,7 +3976,7 @@ static uint32_t vkd3d_shader_dst_param_order(const struct vkd3d_shader_dst_param
return order;
}
static uint32_t sm4_src_register_order(const struct sm4_src_register *src)
static uint32_t sm4_token_count_from_src_register(const struct vkd3d_shader_src_param *src)
{
uint32_t order = 1;
if (src->reg.type == VKD3DSPR_IMMCONST)
@ -4001,9 +3995,9 @@ static void write_sm4_instruction(const struct tpf_writer *tpf, const struct sm4
size += instr->modifier_count;
for (i = 0; i < instr->dst_count; ++i)
size += vkd3d_shader_dst_param_order(&instr->dsts[i]);
size += sm4_token_count_from_dst_register(&instr->dsts[i]);
for (i = 0; i < instr->src_count; ++i)
size += sm4_src_register_order(&instr->srcs[i]);
size += sm4_token_count_from_src_register(&instr->srcs[i]);
size += instr->idx_count;
if (instr->byte_stride)
++size;
@ -5350,7 +5344,7 @@ static void write_sm4_gather(const struct tpf_writer *tpf, const struct hlsl_ir_
const struct hlsl_deref *resource, const struct hlsl_deref *sampler,
const struct hlsl_ir_node *coords, DWORD swizzle, const struct hlsl_ir_node *texel_offset)
{
struct sm4_src_register *src;
struct vkd3d_shader_src_param *src;
struct sm4_instruction instr;
memset(&instr, 0, sizeof(instr));