From 9ddb815127badbf6f0c295f63b867375849c5d0a Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Thu, 27 Nov 2025 22:33:32 +0100 Subject: [PATCH] vkd3d-shader/ir: Rename struct vkd3d_shader_src_param to struct vsir_src_operand. --- libs/vkd3d-shader/d3d_asm.c | 34 +- libs/vkd3d-shader/d3dbc.c | 119 ++--- libs/vkd3d-shader/dxil.c | 155 +++--- libs/vkd3d-shader/glsl.c | 16 +- libs/vkd3d-shader/hlsl_codegen.c | 264 +++++----- libs/vkd3d-shader/ir.c | 620 ++++++++++++----------- libs/vkd3d-shader/msl.c | 12 +- libs/vkd3d-shader/spirv.c | 137 +++-- libs/vkd3d-shader/tpf.c | 103 ++-- libs/vkd3d-shader/vkd3d_shader_private.h | 27 +- 10 files changed, 725 insertions(+), 762 deletions(-) diff --git a/libs/vkd3d-shader/d3d_asm.c b/libs/vkd3d-shader/d3d_asm.c index c481be9b1..339225d00 100644 --- a/libs/vkd3d-shader/d3d_asm.c +++ b/libs/vkd3d-shader/d3d_asm.c @@ -563,8 +563,8 @@ static void shader_print_dcl_usage(struct vkd3d_d3d_asm_compiler *compiler, vkd3d_string_buffer_printf(buffer, "%s%s%s", prefix, usage, suffix); } -static void shader_print_src_param(struct vkd3d_d3d_asm_compiler *compiler, - const char *prefix, const struct vkd3d_shader_src_param *param, const char *suffix); +static void shader_print_src_operand(struct vkd3d_d3d_asm_compiler *compiler, + const char *prefix, const struct vsir_src_operand *src, const char *suffix); static void shader_print_float_literal(struct vkd3d_d3d_asm_compiler *compiler, const char *prefix, float f, const char *suffix) @@ -672,10 +672,10 @@ static void shader_print_untyped_literal(struct vkd3d_d3d_asm_compiler *compiler } static void shader_print_subscript(struct vkd3d_d3d_asm_compiler *compiler, - unsigned int offset, const struct vkd3d_shader_src_param *rel_addr) + unsigned int offset, const struct vsir_src_operand *rel_addr) { if (rel_addr) - shader_print_src_param(compiler, "[", rel_addr, " + "); + shader_print_src_operand(compiler, "[", rel_addr, " + "); shader_print_uint_literal(compiler, rel_addr ? "" : "[", offset, "]"); } @@ -1061,12 +1061,12 @@ static void shader_print_dst_operand(struct vkd3d_d3d_asm_compiler *compiler, shader_print_reg_type(compiler, "", &dst->reg, suffix); } -static void shader_print_src_param(struct vkd3d_d3d_asm_compiler *compiler, - const char *prefix, const struct vkd3d_shader_src_param *param, const char *suffix) +static void shader_print_src_operand(struct vkd3d_d3d_asm_compiler *compiler, + const char *prefix, const struct vsir_src_operand *src, const char *suffix) { - enum vkd3d_shader_src_modifier src_modifier = param->modifiers; + enum vkd3d_shader_src_modifier src_modifier = src->modifiers; struct vkd3d_string_buffer *buffer = &compiler->buffer; - uint32_t swizzle = param->swizzle; + uint32_t swizzle = src->swizzle; const char *modifier = ""; bool is_abs = false; @@ -1085,7 +1085,7 @@ static void shader_print_src_param(struct vkd3d_d3d_asm_compiler *compiler, if (src_modifier == VKD3DSPSM_ABS || src_modifier == VKD3DSPSM_ABSNEG) is_abs = true; - shader_print_register(compiler, is_abs ? "|" : "", ¶m->reg, false, ""); + shader_print_register(compiler, is_abs ? "|" : "", &src->reg, false, ""); switch (src_modifier) { @@ -1120,14 +1120,14 @@ static void shader_print_src_param(struct vkd3d_d3d_asm_compiler *compiler, break; } - if (param->reg.type != VKD3DSPR_IMMCONST && param->reg.type != VKD3DSPR_IMMCONST64 - && param->reg.dimension == VSIR_DIMENSION_VEC4) + if (src->reg.type != VKD3DSPR_IMMCONST && src->reg.type != VKD3DSPR_IMMCONST64 + && src->reg.dimension == VSIR_DIMENSION_VEC4) { static const char swizzle_chars[] = "xyzw"; unsigned int swizzle_x, swizzle_y, swizzle_z, swizzle_w; - if (data_type_is_64_bit(param->reg.data_type)) + if (data_type_is_64_bit(src->reg.data_type)) swizzle = vsir_swizzle_32_from_64(swizzle); swizzle_x = vsir_swizzle_get_component(swizzle, 0); @@ -1147,9 +1147,9 @@ static void shader_print_src_param(struct vkd3d_d3d_asm_compiler *compiler, if (is_abs) vkd3d_string_buffer_printf(buffer, "|"); - shader_print_precision(compiler, ¶m->reg); - shader_print_non_uniform(compiler, ¶m->reg); - shader_print_reg_type(compiler, "", ¶m->reg, suffix); + shader_print_precision(compiler, &src->reg); + shader_print_non_uniform(compiler, &src->reg); + shader_print_reg_type(compiler, "", &src->reg, suffix); } static void shader_dump_ins_modifiers(struct vkd3d_d3d_asm_compiler *compiler, @@ -1508,7 +1508,7 @@ static void shader_dump_instruction(struct vkd3d_d3d_asm_compiler *compiler, compiler->current = ins; if (ins->predicate) - shader_print_src_param(compiler, "(", ins->predicate, ") "); + shader_print_src_operand(compiler, "(", ins->predicate, ") "); /* PixWin marks instructions with the coissue flag with a '+' */ if (ins->coissue) @@ -1750,7 +1750,7 @@ static void shader_dump_instruction(struct vkd3d_d3d_asm_compiler *compiler, /* Other source tokens */ for (i = ins->dst_count; i < (ins->dst_count + ins->src_count); ++i) { - shader_print_src_param(compiler, !i ? " " : ", ", &ins->src[i - ins->dst_count], ""); + shader_print_src_operand(compiler, !i ? " " : ", ", &ins->src[i - ins->dst_count], ""); } break; } diff --git a/libs/vkd3d-shader/d3dbc.c b/libs/vkd3d-shader/d3dbc.c index 79e042ca0..3d7c36d93 100644 --- a/libs/vkd3d-shader/d3dbc.c +++ b/libs/vkd3d-shader/d3dbc.c @@ -561,7 +561,7 @@ static enum vkd3d_shader_register_type parse_register_type( } static void d3dbc_parse_register(struct vkd3d_shader_sm1_parser *d3dbc, - struct vkd3d_shader_register *reg, uint32_t param, struct vkd3d_shader_src_param *rel_addr) + struct vkd3d_shader_register *reg, uint32_t param, struct vsir_src_operand *rel_addr) { enum vkd3d_shader_register_type reg_type; unsigned int index_offset, idx_count; @@ -584,16 +584,16 @@ static void d3dbc_parse_register(struct vkd3d_shader_sm1_parser *d3dbc, reg->dimension = VSIR_DIMENSION_VEC4; } -static void shader_sm1_parse_src_param(struct vkd3d_shader_sm1_parser *sm1, uint32_t param, - struct vkd3d_shader_src_param *rel_addr, struct vkd3d_shader_src_param *src) +static void d3dbc_parse_src_operand(struct vkd3d_shader_sm1_parser *d3dbc, + uint32_t param, struct vsir_src_operand *rel_addr, struct vsir_src_operand *src) { - d3dbc_parse_register(sm1, &src->reg, param, rel_addr); + d3dbc_parse_register(d3dbc, &src->reg, param, rel_addr); src->swizzle = swizzle_from_sm1((param & VKD3D_SM1_SWIZZLE_MASK) >> VKD3D_SM1_SWIZZLE_SHIFT); src->modifiers = (param & VKD3D_SM1_SRC_MODIFIER_MASK) >> VKD3D_SM1_SRC_MODIFIER_SHIFT; } -static void d3dbc_parse_dst_operand(struct vkd3d_shader_sm1_parser *d3dbc, uint32_t param, - struct vkd3d_shader_src_param *rel_addr, struct vsir_dst_operand *dst) +static void d3dbc_parse_dst_operand(struct vkd3d_shader_sm1_parser *d3dbc, + uint32_t param, struct vsir_src_operand *rel_addr, struct vsir_dst_operand *dst) { d3dbc_parse_register(d3dbc, &dst->reg, param, rel_addr); dst->modifiers = (param & VKD3D_SM1_DST_MODIFIER_MASK) >> VKD3D_SM1_DST_MODIFIER_SHIFT; @@ -1039,44 +1039,44 @@ static void shader_sm1_skip_opcode(const struct vkd3d_shader_sm1_parser *sm1, co *ptr += (opcode_info->dst_count + opcode_info->src_count); } -static void shader_sm1_read_src_param(struct vkd3d_shader_sm1_parser *sm1, const uint32_t **ptr, - struct vkd3d_shader_src_param *src_param) +static void d3dbc_read_src_operand(struct vkd3d_shader_sm1_parser *d3dbc, + const uint32_t **ptr, struct vsir_src_operand *src) { - struct vkd3d_shader_src_param *src_rel_addr = NULL; - uint32_t token, addr_token; - - shader_sm1_read_param(sm1, ptr, &token, &addr_token); - if (has_relative_address(token)) - { - if (!(src_rel_addr = vsir_program_get_src_params(sm1->program, 1))) - { - vkd3d_shader_parser_error(&sm1->p, VKD3D_SHADER_ERROR_D3DBC_OUT_OF_MEMORY, - "Out of memory."); - sm1->abort = true; - return; - } - shader_sm1_parse_src_param(sm1, addr_token, NULL, src_rel_addr); - } - shader_sm1_parse_src_param(sm1, token, src_rel_addr, src_param); -} - -static void d3dbc_read_dst_operand(struct vkd3d_shader_sm1_parser *d3dbc, - const uint32_t **ptr, struct vsir_dst_operand *dst) -{ - struct vkd3d_shader_src_param *dst_rel_addr = NULL; + struct vsir_src_operand *src_rel_addr = NULL; uint32_t token, addr_token; shader_sm1_read_param(d3dbc, ptr, &token, &addr_token); if (has_relative_address(token)) { - if (!(dst_rel_addr = vsir_program_get_src_params(d3dbc->program, 1))) + if (!(src_rel_addr = vsir_program_get_src_operands(d3dbc->program, 1))) { vkd3d_shader_parser_error(&d3dbc->p, VKD3D_SHADER_ERROR_D3DBC_OUT_OF_MEMORY, "Out of memory."); d3dbc->abort = true; return; } - shader_sm1_parse_src_param(d3dbc, addr_token, NULL, dst_rel_addr); + d3dbc_parse_src_operand(d3dbc, addr_token, NULL, src_rel_addr); + } + d3dbc_parse_src_operand(d3dbc, token, src_rel_addr, src); +} + +static void d3dbc_read_dst_operand(struct vkd3d_shader_sm1_parser *d3dbc, + const uint32_t **ptr, struct vsir_dst_operand *dst) +{ + struct vsir_src_operand *dst_rel_addr = NULL; + uint32_t token, addr_token; + + shader_sm1_read_param(d3dbc, ptr, &token, &addr_token); + if (has_relative_address(token)) + { + if (!(dst_rel_addr = vsir_program_get_src_operands(d3dbc->program, 1))) + { + vkd3d_shader_parser_error(&d3dbc->p, VKD3D_SHADER_ERROR_D3DBC_OUT_OF_MEMORY, + "Out of memory."); + d3dbc->abort = true; + return; + } + d3dbc_parse_src_operand(d3dbc, addr_token, NULL, dst_rel_addr); } d3dbc_parse_dst_operand(d3dbc, token, dst_rel_addr, dst); @@ -1135,7 +1135,7 @@ static void shader_sm1_read_semantic(struct vkd3d_shader_sm1_parser *sm1, } static void shader_sm1_read_immconst(struct vkd3d_shader_sm1_parser *sm1, const uint32_t **ptr, - struct vkd3d_shader_src_param *src_param, enum vsir_dimension dimension, enum vsir_data_type data_type) + struct vsir_src_operand *src, enum vsir_dimension dimension, enum vsir_data_type data_type) { unsigned int count = dimension == VSIR_DIMENSION_VEC4 ? 4 : 1; @@ -1148,21 +1148,10 @@ static void shader_sm1_read_immconst(struct vkd3d_shader_sm1_parser *sm1, const return; } - src_param->reg.type = VKD3DSPR_IMMCONST; - src_param->reg.precision = VKD3D_SHADER_REGISTER_PRECISION_DEFAULT; - src_param->reg.non_uniform = false; - src_param->reg.data_type = data_type; - src_param->reg.idx[0].offset = ~0u; - src_param->reg.idx[0].rel_addr = NULL; - src_param->reg.idx[1].offset = ~0u; - src_param->reg.idx[1].rel_addr = NULL; - src_param->reg.idx[2].offset = ~0u; - src_param->reg.idx[2].rel_addr = NULL; - src_param->reg.idx_count = 0; - src_param->reg.dimension = dimension; - memcpy(src_param->reg.u.immconst_u32, *ptr, count * sizeof(uint32_t)); - src_param->swizzle = VKD3D_SHADER_NO_SWIZZLE; - src_param->modifiers = 0; + vsir_src_operand_init(src, VKD3DSPR_IMMCONST, data_type, 0); + src->reg.dimension = dimension; + memcpy(src->reg.u.immconst_u32, *ptr, count * sizeof(uint32_t)); + src->swizzle = VKD3D_SHADER_NO_SWIZZLE; *ptr += count; } @@ -1283,10 +1272,10 @@ static unsigned int mask_from_swizzle(uint32_t swizzle) static void shader_sm1_read_instruction(struct vkd3d_shader_sm1_parser *sm1, struct vkd3d_shader_instruction *ins) { - struct vkd3d_shader_src_param *src_params, *predicate; const struct vkd3d_sm1_opcode_info *opcode_info; struct vsir_program *program = sm1->program; unsigned int vsir_dst_count, vsir_src_count; + struct vsir_src_operand *src, *predicate; const uint32_t **ptr = &sm1->ptr; struct vsir_dst_operand *dst; uint32_t opcode_token; @@ -1330,12 +1319,12 @@ static void shader_sm1_read_instruction(struct vkd3d_shader_sm1_parser *sm1, str ins->raw = false; ins->structured = false; predicated = !!(opcode_token & VKD3D_SM1_INSTRUCTION_PREDICATED); - ins->predicate = predicate = predicated ? vsir_program_get_src_params(program, 1) : NULL; + ins->predicate = predicate = predicated ? vsir_program_get_src_operands(program, 1) : NULL; ins->dst_count = vsir_dst_count; ins->dst = dst = vsir_program_get_dst_operands(program, ins->dst_count); ins->src_count = vsir_src_count; - ins->src = src_params = vsir_program_get_src_params(program, ins->src_count); - if ((!predicate && predicated) || (!src_params && ins->src_count) || (!dst && ins->dst_count)) + ins->src = src = vsir_program_get_src_operands(program, ins->src_count); + if ((!predicate && predicated) || (!src && ins->src_count) || (!dst && ins->dst_count)) { vkd3d_shader_parser_error(&sm1->p, VKD3D_SHADER_ERROR_D3DBC_OUT_OF_MEMORY, "Out of memory."); goto fail; @@ -1366,19 +1355,19 @@ static void shader_sm1_read_instruction(struct vkd3d_shader_sm1_parser *sm1, str else if (ins->opcode == VSIR_OP_DEF) { d3dbc_read_dst_operand(sm1, &p, dst); - shader_sm1_read_immconst(sm1, &p, &src_params[0], VSIR_DIMENSION_VEC4, VSIR_DATA_F32); + shader_sm1_read_immconst(sm1, &p, &src[0], VSIR_DIMENSION_VEC4, VSIR_DATA_F32); shader_sm1_scan_register(sm1, &dst->reg, dst->write_mask, true); } else if (ins->opcode == VSIR_OP_DEFB) { d3dbc_read_dst_operand(sm1, &p, dst); - shader_sm1_read_immconst(sm1, &p, &src_params[0], VSIR_DIMENSION_SCALAR, VSIR_DATA_U32); + shader_sm1_read_immconst(sm1, &p, &src[0], VSIR_DIMENSION_SCALAR, VSIR_DATA_U32); shader_sm1_scan_register(sm1, &dst->reg, dst->write_mask, true); } else if (ins->opcode == VSIR_OP_DEFI) { d3dbc_read_dst_operand(sm1, &p, dst); - shader_sm1_read_immconst(sm1, &p, &src_params[0], VSIR_DIMENSION_VEC4, VSIR_DATA_I32); + shader_sm1_read_immconst(sm1, &p, &src[0], VSIR_DIMENSION_VEC4, VSIR_DATA_I32); shader_sm1_scan_register(sm1, &dst->reg, dst->write_mask, true); } else if (ins->opcode == VSIR_OP_TEXKILL) @@ -1393,12 +1382,12 @@ static void shader_sm1_read_instruction(struct vkd3d_shader_sm1_parser *sm1, str d3dbc_read_dst_operand(sm1, &p, &tmp_dst); shader_sm1_scan_register(sm1, reg, tmp_dst.write_mask, false); - vsir_src_param_init(&src_params[0], reg->type, reg->data_type, reg->idx_count); - src_params[0].reg = *reg; - src_params[0].swizzle = vsir_swizzle_from_writemask(tmp_dst.write_mask); + vsir_src_operand_init(&src[0], reg->type, reg->data_type, reg->idx_count); + src[0].reg = *reg; + src[0].swizzle = vsir_swizzle_from_writemask(tmp_dst.write_mask); if (ins->predicate) - shader_sm1_read_src_param(sm1, &p, predicate); + d3dbc_read_src_operand(sm1, &p, predicate); } else { @@ -1411,13 +1400,13 @@ static void shader_sm1_read_instruction(struct vkd3d_shader_sm1_parser *sm1, str /* Predication token */ if (ins->predicate) - shader_sm1_read_src_param(sm1, &p, predicate); + d3dbc_read_src_operand(sm1, &p, predicate); /* Other source tokens */ for (i = 0; i < ins->src_count; ++i) { - shader_sm1_read_src_param(sm1, &p, &src_params[i]); - shader_sm1_scan_register(sm1, &src_params[i].reg, mask_from_swizzle(src_params[i].swizzle), false); + d3dbc_read_src_operand(sm1, &p, &src[i]); + shader_sm1_scan_register(sm1, &src[i].reg, mask_from_swizzle(src[i].swizzle), false); } } @@ -1865,7 +1854,7 @@ static uint32_t swizzle_from_vsir(uint32_t swizzle) static bool is_inconsequential_instr(const struct vkd3d_shader_instruction *ins) { - const struct vkd3d_shader_src_param *src = &ins->src[0]; + const struct vsir_src_operand *src = &ins->src[0]; const struct vsir_dst_operand *dst = &ins->dst[0]; unsigned int i; @@ -1901,7 +1890,7 @@ static void write_sm1_dst_register(struct vkd3d_bytecode_buffer *buffer, const s | (offset & VKD3D_SM1_REGISTER_NUMBER_MASK)); } -static void write_sm1_src_register(struct vkd3d_bytecode_buffer *buffer, const struct vkd3d_shader_src_param *reg) +static void write_sm1_src_register(struct vkd3d_bytecode_buffer *buffer, const struct vsir_src_operand *reg) { uint32_t address_mode = VKD3D_SM1_ADDRESS_MODE_ABSOLUTE, offset = 0; @@ -1924,8 +1913,8 @@ static void d3dbc_write_instruction(struct d3dbc_compiler *d3dbc, const struct v { const struct vkd3d_shader_version *version = &d3dbc->program->shader_version; struct vkd3d_bytecode_buffer *buffer = &d3dbc->buffer; - const struct vkd3d_shader_src_param *src; const struct vkd3d_sm1_opcode_info *info; + const struct vsir_src_operand *src; size_t size, token_position; unsigned int i; uint32_t token; diff --git a/libs/vkd3d-shader/dxil.c b/libs/vkd3d-shader/dxil.c index 16e0814a8..aea49f93c 100644 --- a/libs/vkd3d-shader/dxil.c +++ b/libs/vkd3d-shader/dxil.c @@ -931,7 +931,7 @@ struct sm6_parser struct vsir_dst_operand *input_params; struct vsir_dst_operand *patch_constant_params; uint32_t io_regs_declared[VKD3D_BITMAP_SIZE(VKD3DSPR_COUNT)]; - struct vkd3d_shader_src_param *outpointid_param; + struct vsir_src_operand *outpointid_param; struct sm6_function *functions; size_t function_count; @@ -2578,12 +2578,12 @@ static void instruction_init_with_resource(struct vkd3d_shader_instruction *ins, ins->structured = resource->u.handle.d->kind == RESOURCE_KIND_STRUCTUREDBUFFER; } -static struct vkd3d_shader_src_param *instruction_src_params_alloc(struct vkd3d_shader_instruction *ins, +static struct vsir_src_operand *instruction_src_params_alloc(struct vkd3d_shader_instruction *ins, unsigned int count, struct sm6_parser *sm6) { - struct vkd3d_shader_src_param *params; + struct vsir_src_operand *params; - if (!(params = vsir_program_get_src_params(sm6->program, count))) + if (!(params = vsir_program_get_src_operands(sm6->program, count))) { ERR("Failed to allocate src params.\n"); vkd3d_shader_parser_error(&sm6->p, VKD3D_SHADER_ERROR_DXIL_OUT_OF_MEMORY, @@ -2862,13 +2862,13 @@ static void dst_param_init_vector(struct vsir_dst_operand *param, unsigned int c param->shift = 0; } -static inline void src_param_init(struct vkd3d_shader_src_param *param) +static inline void src_param_init(struct vsir_src_operand *param) { param->swizzle = VKD3D_SHADER_SWIZZLE(X, X, X, X); param->modifiers = VKD3DSPSM_NONE; } -static void src_param_init_scalar(struct vkd3d_shader_src_param *param, unsigned int component_idx) +static void src_param_init_scalar(struct vsir_src_operand *param, unsigned int component_idx) { param->swizzle = vkd3d_shader_create_swizzle(component_idx, component_idx, component_idx, component_idx); if (data_type_is_64_bit(param->reg.data_type)) @@ -2876,20 +2876,20 @@ static void src_param_init_scalar(struct vkd3d_shader_src_param *param, unsigned param->modifiers = VKD3DSPSM_NONE; } -static void src_param_init_vector(struct vkd3d_shader_src_param *param, unsigned int component_count) +static void src_param_init_vector(struct vsir_src_operand *param, unsigned int component_count) { param->swizzle = VKD3D_SHADER_NO_SWIZZLE & ((1ull << VKD3D_SHADER_SWIZZLE_SHIFT(component_count)) - 1); param->modifiers = VKD3DSPSM_NONE; } -static void src_param_init_from_value(struct vkd3d_shader_src_param *param, +static void src_param_init_from_value(struct vsir_src_operand *param, const struct sm6_value *src, uint32_t type_flags, struct sm6_parser *dxil) { src_param_init(param); vsir_register_from_dxil_value(¶m->reg, src, type_flags, dxil); } -static void src_param_init_vector_from_reg(struct vkd3d_shader_src_param *param, +static void src_param_init_vector_from_reg(struct vsir_src_operand *param, const struct vkd3d_shader_register *reg) { param->swizzle = (reg->dimension == VSIR_DIMENSION_VEC4) ? VKD3D_SHADER_NO_SWIZZLE : VKD3D_SHADER_SWIZZLE(X, X, X, X); @@ -2897,15 +2897,17 @@ static void src_param_init_vector_from_reg(struct vkd3d_shader_src_param *param, param->reg = *reg; } -static void src_param_make_constant_uint(struct vkd3d_shader_src_param *param, unsigned int value) +static void src_param_make_constant_uint(struct vsir_src_operand *param, unsigned int value) { src_param_init(param); register_make_constant_uint(¶m->reg, value); } -static void register_index_address_init(struct vkd3d_shader_register_index *idx, const struct sm6_value *address, - struct sm6_parser *sm6) +static void register_index_address_init(struct vkd3d_shader_register_index *idx, + const struct sm6_value *address, struct sm6_parser *sm6) { + struct vsir_src_operand *rel_addr; + if (address && sm6_value_is_constant(address)) { idx->offset = sm6_value_get_constant_uint(address, sm6); @@ -2918,8 +2920,7 @@ static void register_index_address_init(struct vkd3d_shader_register_index *idx, } else { - struct vkd3d_shader_src_param *rel_addr = vsir_program_get_src_params(sm6->program, 1); - if (rel_addr) + if ((rel_addr = vsir_program_get_src_operands(sm6->program, 1))) src_param_init_from_value(rel_addr, address, 0, sm6); idx->offset = 0; idx->rel_addr = rel_addr; @@ -2937,7 +2938,7 @@ static void sm6_register_from_handle(struct sm6_parser *sm6, } static void src_param_init_vector_from_handle(struct sm6_parser *sm6, - struct vkd3d_shader_src_param *param, const struct sm6_handle_data *handle) + struct vsir_src_operand *param, const struct sm6_handle_data *handle) { struct vkd3d_shader_register reg; @@ -4283,7 +4284,7 @@ static void dst_param_io_init(struct vsir_dst_operand *param, const struct signa param->reg.dimension = dimension; } -static void src_params_init_from_operands(struct vkd3d_shader_src_param *src_params, +static void src_params_init_from_operands(struct vsir_src_operand *src_params, const struct sm6_value **operands, unsigned int count, struct sm6_parser *sm6) { unsigned int i; @@ -4598,9 +4599,9 @@ static void sm6_parser_emit_atomicrmw(struct sm6_parser *sm6, struct function_em { struct sm6_value *dst = sm6_parser_get_current_value(sm6); const struct dxil_record *record = state->record; - struct vkd3d_shader_src_param *src_params; struct vkd3d_shader_register regs[2], reg; struct vkd3d_shader_instruction *ins; + struct vsir_src_operand *src_params; struct vsir_dst_operand *dst_params; struct vkd3d_shader_register coord; const struct sm6_value *ptr, *src; @@ -4799,8 +4800,8 @@ static void sm6_parser_emit_binop(struct sm6_parser *sm6, struct function_emissi struct sm6_value *dst = sm6_parser_get_current_value(sm6); const struct dxil_record *record = state->record; enum vkd3d_shader_opcode opcode, aux_opcode; - struct vkd3d_shader_src_param *src_params; struct vkd3d_shader_instruction *ins; + struct vsir_src_operand *src_params; struct vsir_dst_operand *dst_params; uint32_t type_flags = 0, aux_id = 0; const struct sm6_value *a, *b; @@ -4945,8 +4946,8 @@ static void sm6_parser_emit_br(struct sm6_parser *dxil, struct function_emission { const struct dxil_record *record = state->record; struct sm6_function *function = state->function; - struct vkd3d_shader_src_param *src_params; struct vkd3d_shader_instruction *ins; + struct vsir_src_operand *src_params; const struct sm6_value *value; unsigned int i = 2; @@ -4974,7 +4975,7 @@ static void sm6_parser_emit_br(struct sm6_parser *dxil, struct function_emission return; } /* Label id is 1-based. */ - vsir_src_param_init_label(&src_params[0], record->operands[0] + 1); + vsir_src_operand_init_label(&src_params[0], record->operands[0] + 1); } else { @@ -5006,8 +5007,8 @@ static void sm6_parser_emit_br(struct sm6_parser *dxil, struct function_emission } src_param_init_from_value(&src_params[0], value, 0, dxil); /* Label id is 1-based. */ - vsir_src_param_init_label(&src_params[1], record->operands[0] + 1); - vsir_src_param_init_label(&src_params[2], record->operands[1] + 1); + vsir_src_operand_init_label(&src_params[1], record->operands[0] + 1); + vsir_src_operand_init_label(&src_params[2], record->operands[1] + 1); } } @@ -5016,7 +5017,7 @@ static bool sm6_parser_emit_reg_composite_construct(struct sm6_parser *sm6, struct function_emission_state *state, struct vkd3d_shader_register *reg) { struct vkd3d_shader_instruction *ins = state->ins; - struct vkd3d_shader_src_param *src_params; + struct vsir_src_operand *src_params; struct vsir_dst_operand *dst_param; bool all_constant = true; unsigned int i; @@ -5209,7 +5210,7 @@ static void sm6_parser_emit_dx_unary(struct sm6_parser *sm6, enum dx_intrinsic_o const struct sm6_value **operands, struct function_emission_state *state) { struct vkd3d_shader_instruction *ins = state->ins; - struct vkd3d_shader_src_param *src_param; + struct vsir_src_operand *src_param; vsir_instruction_init(ins, &sm6->p.location, map_dx_unary_op(op)); if (!(src_param = instruction_src_params_alloc(ins, 1, sm6))) @@ -5253,7 +5254,7 @@ static void sm6_parser_emit_dx_binary(struct sm6_parser *sm6, enum dx_intrinsic_ const struct sm6_value **operands, struct function_emission_state *state) { struct vkd3d_shader_instruction *ins = state->ins; - struct vkd3d_shader_src_param *src_params; + struct vsir_src_operand *src_params; uint32_t type_flags; vsir_instruction_init(ins, &sm6->p.location, map_dx_binary_op(op, operands[0]->type, &type_flags)); @@ -5304,8 +5305,8 @@ static void sm6_parser_emit_dx_atomic_binop(struct sm6_parser *sm6, enum dx_intr enum vkd3d_shader_resource_type resource_type; bool is_cmp_xchg = op == DX_ATOMIC_CMP_XCHG; unsigned int i, coord_idx, coord_count = 1; - struct vkd3d_shader_src_param *src_params; struct vkd3d_shader_instruction *ins; + struct vsir_src_operand *src_params; struct vsir_dst_operand *dst_params; const struct sm6_value *resource; struct vkd3d_shader_register reg; @@ -5388,7 +5389,7 @@ static void sm6_parser_emit_dx_buffer_update_counter(struct sm6_parser *sm6, enu const struct sm6_value **operands, struct function_emission_state *state) { struct vkd3d_shader_instruction *ins = state->ins; - struct vkd3d_shader_src_param *src_params; + struct vsir_src_operand *src_params; const struct sm6_value *resource; unsigned int i; int8_t inc; @@ -5424,8 +5425,8 @@ static void sm6_parser_emit_dx_calculate_lod(struct sm6_parser *sm6, enum dx_int const struct sm6_value **operands, struct function_emission_state *state) { const struct sm6_value *resource, *sampler; - struct vkd3d_shader_src_param *src_params; struct vkd3d_shader_instruction *ins; + struct vsir_src_operand *src_params; struct vkd3d_shader_register coord; unsigned int clamp; @@ -5459,7 +5460,7 @@ static void sm6_parser_emit_dx_cbuffer_load(struct sm6_parser *sm6, enum dx_intr { struct sm6_value *dst = sm6_parser_get_current_value(sm6); struct vkd3d_shader_instruction *ins = state->ins; - struct vkd3d_shader_src_param *src_param; + struct vsir_src_operand *src_param; const struct sm6_value *buffer; const struct sm6_type *type; @@ -5508,7 +5509,7 @@ static void sm6_parser_dcl_register_builtin(struct sm6_parser *dxil, enum vkd3d_ static void sm6_parser_emit_dx_input_register_mov(struct sm6_parser *sm6, struct vkd3d_shader_instruction *ins, enum vkd3d_shader_register_type reg_type, enum vsir_data_type data_type, bool scalar) { - struct vkd3d_shader_src_param *src_param; + struct vsir_src_operand *src_param; vsir_instruction_init(ins, &sm6->p.location, VSIR_OP_MOV); @@ -5587,7 +5588,7 @@ static void sm6_parser_emit_dx_stream(struct sm6_parser *sm6, enum dx_intrinsic_ const struct sm6_value **operands, struct function_emission_state *state) { struct vkd3d_shader_instruction *ins = state->ins; - struct vkd3d_shader_src_param *src_param; + struct vsir_src_operand *src_param; unsigned int i; vsir_instruction_init(ins, &sm6->p.location, (op == DX_CUT_STREAM) ? VSIR_OP_CUT_STREAM : VSIR_OP_EMIT_STREAM); @@ -5618,7 +5619,7 @@ static void sm6_parser_emit_dx_discard(struct sm6_parser *sm6, enum dx_intrinsic const struct sm6_value **operands, struct function_emission_state *state) { struct vkd3d_shader_instruction *ins = state->ins; - struct vkd3d_shader_src_param *src_param; + struct vsir_src_operand *src_param; vsir_instruction_init(ins, &sm6->p.location, VSIR_OP_DISCARD); @@ -5630,7 +5631,7 @@ static void sm6_parser_emit_dx_domain_location(struct sm6_parser *sm6, enum dx_i const struct sm6_value **operands, struct function_emission_state *state) { struct vkd3d_shader_instruction *ins = state->ins; - struct vkd3d_shader_src_param *src_param; + struct vsir_src_operand *src_param; unsigned int component_idx; vsir_instruction_init(ins, &sm6->p.location, VSIR_OP_MOV); @@ -5656,9 +5657,9 @@ static void sm6_parser_emit_dx_domain_location(struct sm6_parser *sm6, enum dx_i static void sm6_parser_emit_dx_dot(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state) { - struct vkd3d_shader_src_param *src_params; struct vkd3d_shader_instruction *ins; struct vkd3d_shader_register regs[2]; + struct vsir_src_operand *src_params; enum vkd3d_shader_opcode opcode; unsigned int component_count; @@ -5699,9 +5700,9 @@ static void sm6_parser_emit_dx_eval_attrib(struct sm6_parser *sm6, enum dx_intri const struct sm6_value **operands, struct function_emission_state *state) { struct vkd3d_shader_instruction *ins = state->ins; - struct vkd3d_shader_src_param *src_params; const struct shader_signature *signature; unsigned int row_index, column_index; + struct vsir_src_operand *src_params; const struct signature_element *e; row_index = sm6_value_get_constant_uint(operands[0], sm6); @@ -5746,7 +5747,7 @@ static void sm6_parser_emit_dx_fabs(struct sm6_parser *sm6, enum dx_intrinsic_op const struct sm6_value **operands, struct function_emission_state *state) { struct vkd3d_shader_instruction *ins = state->ins; - struct vkd3d_shader_src_param *src_param; + struct vsir_src_operand *src_param; vsir_instruction_init(ins, &sm6->p.location, VSIR_OP_ABS); if (!(src_param = instruction_src_params_alloc(ins, 1, sm6))) @@ -5761,8 +5762,8 @@ static void sm6_parser_emit_dx_compute_builtin(struct sm6_parser *sm6, enum dx_i { unsigned int component_count = 3, component_idx = 0; struct vkd3d_shader_instruction *ins = state->ins; - struct vkd3d_shader_src_param *src_param; enum vkd3d_shader_register_type reg_type; + struct vsir_src_operand *src_param; switch (op) { @@ -5816,7 +5817,7 @@ static void sm6_parser_emit_dx_ma(struct sm6_parser *sm6, enum dx_intrinsic_opco const struct sm6_value **operands, struct function_emission_state *state) { struct vkd3d_shader_instruction *ins = state->ins; - struct vkd3d_shader_src_param *src_params; + struct vsir_src_operand *src_params; unsigned int i; vsir_instruction_init(ins, &sm6->p.location, sm6_dx_map_ma_op(op, operands[0]->type)); @@ -5834,9 +5835,9 @@ static void sm6_parser_emit_dx_get_dimensions(struct sm6_parser *sm6, enum dx_in const struct sm6_value **operands, struct function_emission_state *state) { struct vkd3d_shader_instruction *ins = state->ins; - struct vkd3d_shader_src_param *src_params; unsigned int is_texture, component_count; enum dxil_resource_kind resource_kind; + struct vsir_src_operand *src_params; const struct sm6_value *resource; struct vsir_dst_operand *dst; @@ -5921,7 +5922,7 @@ static void sm6_parser_emit_dx_tertiary(struct sm6_parser *sm6, enum dx_intrinsi const struct sm6_value **operands, struct function_emission_state *state) { struct vkd3d_shader_instruction *ins = state->ins; - struct vkd3d_shader_src_param *src_params; + struct vsir_src_operand *src_params; unsigned int i; vsir_instruction_init(ins, &sm6->p.location, sm6_dx_map_tertiary_op(op)); @@ -5943,9 +5944,9 @@ static void sm6_parser_emit_dx_load_input(struct sm6_parser *sm6, enum dx_intrin struct vkd3d_shader_instruction *ins = state->ins; struct vsir_program *program = sm6->program; unsigned int count, row_index, column_index; - struct vkd3d_shader_src_param *src_param; const struct shader_signature *signature; const struct vsir_dst_operand *params; + struct vsir_src_operand *src_param; const struct signature_element *e; row_index = sm6_value_get_constant_uint(operands[0], sm6); @@ -6006,8 +6007,8 @@ static void sm6_parser_emit_dx_load_input(struct sm6_parser *sm6, enum dx_intrin static void sm6_parser_emit_dx_make_double(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state) { - struct vkd3d_shader_src_param *src_params; struct vkd3d_shader_instruction *ins; + struct vsir_src_operand *src_params; struct vkd3d_shader_register reg; if (!sm6_parser_emit_composite_construct(sm6, &operands[0], 2, state, ®)) @@ -6054,7 +6055,7 @@ static void sm6_parser_emit_dx_quad_op(struct sm6_parser *sm6, enum dx_intrinsic const struct sm6_value **operands, struct function_emission_state *state) { struct vkd3d_shader_instruction *ins = state->ins; - struct vkd3d_shader_src_param *src_param; + struct vsir_src_operand *src_param; enum vkd3d_shader_opcode opcode; enum dxil_quad_op_kind quad_op; @@ -6081,7 +6082,7 @@ static void sm6_parser_emit_dx_raw_buffer_load(struct sm6_parser *sm6, enum dx_i { unsigned int operand_count, write_mask, component_count = VKD3D_VEC4_SIZE; struct vkd3d_shader_instruction *ins = state->ins; - struct vkd3d_shader_src_param *src_params; + struct vsir_src_operand *src_params; const struct sm6_value *resource; bool raw; @@ -6123,8 +6124,8 @@ static void sm6_parser_emit_dx_raw_buffer_store(struct sm6_parser *sm6, enum dx_ const struct sm6_value **operands, struct function_emission_state *state) { unsigned int write_mask, component_count, alignment = 0, operand_count; - struct vkd3d_shader_src_param *src_params; struct vkd3d_shader_instruction *ins; + struct vsir_src_operand *src_params; struct vsir_dst_operand *dst_param; struct vkd3d_shader_register data; const struct sm6_value *resource; @@ -6193,7 +6194,7 @@ static void sm6_parser_emit_dx_buffer_load(struct sm6_parser *sm6, enum dx_intri const struct sm6_value **operands, struct function_emission_state *state) { struct vkd3d_shader_instruction *ins = state->ins; - struct vkd3d_shader_src_param *src_params; + struct vsir_src_operand *src_params; const struct sm6_value *resource; resource = operands[0]; @@ -6234,9 +6235,9 @@ static void sm6_parser_emit_dx_buffer_load(struct sm6_parser *sm6, enum dx_intri static void sm6_parser_emit_dx_buffer_store(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state) { - struct vkd3d_shader_src_param *src_params; unsigned int write_mask, component_count; struct vkd3d_shader_instruction *ins; + struct vsir_src_operand *src_params; struct vkd3d_shader_register texel; struct vsir_dst_operand *dst_param; const struct sm6_value *resource; @@ -6302,7 +6303,7 @@ static void sm6_parser_emit_dx_get_sample_count(struct sm6_parser *sm6, enum dx_ const struct sm6_value **operands, struct function_emission_state *state) { struct vkd3d_shader_instruction *ins = state->ins; - struct vkd3d_shader_src_param *src_param; + struct vsir_src_operand *src_param; vsir_instruction_init(ins, &sm6->p.location, VSIR_OP_SAMPLE_INFO); ins->flags = VKD3DSI_SAMPLE_INFO_UINT; @@ -6321,8 +6322,8 @@ static void sm6_parser_emit_dx_get_sample_pos(struct sm6_parser *sm6, enum dx_in const struct sm6_value **operands, struct function_emission_state *state) { struct vkd3d_shader_instruction *ins = state->ins; - struct vkd3d_shader_src_param *src_params; const struct sm6_value *resource = NULL; + struct vsir_src_operand *src_params; if (op == DX_TEX2DMS_GET_SAMPLE_POS) { @@ -6373,8 +6374,8 @@ static void sm6_parser_emit_dx_sample(struct sm6_parser *sm6, enum dx_intrinsic_ unsigned int clamp_idx = 0, component_count = VKD3D_VEC4_SIZE; struct vkd3d_shader_register coord, ddx, ddy; const struct sm6_value *resource, *sampler; - struct vkd3d_shader_src_param *src_params; struct vkd3d_shader_instruction *ins; + struct vsir_src_operand *src_params; resource = operands[0]; sampler = operands[1]; @@ -6456,7 +6457,7 @@ static void sm6_parser_emit_dx_sample_index(struct sm6_parser *sm6, enum dx_intr { const struct shader_signature *signature = &sm6->program->input_signature; struct vkd3d_shader_instruction *ins = state->ins; - struct vkd3d_shader_src_param *src_param; + struct vsir_src_operand *src_param; unsigned int element_idx; vsir_instruction_init(ins, &sm6->p.location, VSIR_OP_MOV); @@ -6483,7 +6484,7 @@ static void sm6_parser_emit_dx_saturate(struct sm6_parser *sm6, enum dx_intrinsi const struct sm6_value **operands, struct function_emission_state *state) { struct vkd3d_shader_instruction *ins = state->ins; - struct vkd3d_shader_src_param *src_param; + struct vsir_src_operand *src_param; vsir_instruction_init(ins, &sm6->p.location, VSIR_OP_SATURATE); if (!(src_param = instruction_src_params_alloc(ins, 1, sm6))) @@ -6497,7 +6498,7 @@ static void sm6_parser_emit_dx_split_double(struct sm6_parser *sm6, enum dx_intr const struct sm6_value **operands, struct function_emission_state *state) { struct vkd3d_shader_instruction *ins = state->ins; - struct vkd3d_shader_src_param *src_param; + struct vsir_src_operand *src_param; vsir_instruction_init(ins, &sm6->p.location, VSIR_OP_MOV); if (!(src_param = instruction_src_params_alloc(ins, 1, sm6))) @@ -6513,9 +6514,9 @@ static void sm6_parser_emit_dx_store_output(struct sm6_parser *sm6, enum dx_intr bool is_patch_constant = op == DX_STORE_PATCH_CONSTANT; struct vkd3d_shader_instruction *ins = state->ins; struct vsir_program *program = sm6->program; - struct vkd3d_shader_src_param *src_param; const struct shader_signature *signature; unsigned int row_index, column_index; + struct vsir_src_operand *src_param; struct vsir_dst_operand *dst_param; const struct signature_element *e; const struct sm6_value *value; @@ -6575,8 +6576,8 @@ static void sm6_parser_emit_dx_texture_gather(struct sm6_parser *sm6, enum dx_in { struct vkd3d_shader_register coord, offset; const struct sm6_value *resource, *sampler; - struct vkd3d_shader_src_param *src_params; struct vkd3d_shader_instruction *ins; + struct vsir_src_operand *src_params; unsigned int swizzle; bool extended_offset; @@ -6641,8 +6642,8 @@ static void sm6_parser_emit_dx_texture_load(struct sm6_parser *sm6, enum dx_intr { const struct sm6_value *resource, *mip_level_or_sample_count; enum vkd3d_shader_resource_type resource_type; - struct vkd3d_shader_src_param *src_params; struct vkd3d_shader_instruction *ins; + struct vsir_src_operand *src_params; struct vkd3d_shader_register coord; bool is_multisample, is_uav; unsigned int i; @@ -6685,9 +6686,9 @@ static void sm6_parser_emit_dx_texture_store(struct sm6_parser *sm6, enum dx_int const struct sm6_value **operands, struct function_emission_state *state) { struct vkd3d_shader_register coord, texel; - struct vkd3d_shader_src_param *src_params; unsigned int write_mask, component_count; struct vkd3d_shader_instruction *ins; + struct vsir_src_operand *src_params; struct vsir_dst_operand *dst_param; const struct sm6_value *resource; @@ -6735,7 +6736,7 @@ static void sm6_parser_emit_dx_wave_active_ballot(struct sm6_parser *sm6, enum d const struct sm6_value **operands, struct function_emission_state *state) { struct vkd3d_shader_instruction *ins = state->ins; - struct vkd3d_shader_src_param *src_param; + struct vsir_src_operand *src_param; vsir_instruction_init(ins, &sm6->p.location, VSIR_OP_WAVE_ACTIVE_BALLOT); if (!(src_param = instruction_src_params_alloc(ins, 1, sm6))) @@ -6768,8 +6769,8 @@ static void sm6_parser_emit_dx_wave_active_bit(struct sm6_parser *sm6, enum dx_i const struct sm6_value **operands, struct function_emission_state *state) { struct vkd3d_shader_instruction *ins = state->ins; - struct vkd3d_shader_src_param *src_param; enum dxil_wave_bit_op_kind wave_op; + struct vsir_src_operand *src_param; enum vkd3d_shader_opcode opcode; wave_op = sm6_value_get_constant_uint(operands[1], sm6); @@ -6814,7 +6815,7 @@ static void sm6_parser_emit_dx_wave_op(struct sm6_parser *sm6, enum dx_intrinsic const struct sm6_value **operands, struct function_emission_state *state) { struct vkd3d_shader_instruction *ins = state->ins; - struct vkd3d_shader_src_param *src_param; + struct vsir_src_operand *src_param; enum vkd3d_shader_opcode opcode; enum dxil_wave_op_kind wave_op; bool is_signed; @@ -7322,7 +7323,7 @@ static enum vkd3d_shader_opcode dxil_map_cast_op(uint64_t code, const struct sm6 static void sm6_parser_emit_cast(struct sm6_parser *dxil, const struct dxil_record *record, struct vkd3d_shader_instruction *ins, struct sm6_value *dst) { - struct vkd3d_shader_src_param *src_param; + struct vsir_src_operand *src_param; const struct sm6_value *value; enum vkd3d_shader_opcode op; const struct sm6_type *type; @@ -7419,8 +7420,8 @@ static const struct sm6_cmp_info *sm6_map_cmp2_op(uint64_t code) static void sm6_parser_emit_cmp2(struct sm6_parser *sm6, const struct dxil_record *record, struct vkd3d_shader_instruction *ins, struct sm6_value *dst) { - struct vkd3d_shader_src_param *src_params; const struct sm6_type *type_a, *type_b; + struct vsir_src_operand *src_params; bool is_int, is_fp, silence_warning; const struct sm6_cmp_info *cmp; const struct sm6_value *a, *b; @@ -7521,8 +7522,8 @@ static void sm6_parser_emit_cmpxchg(struct sm6_parser *sm6, const struct dxil_re struct vkd3d_shader_instruction *ins, struct sm6_value *dst) { uint64_t success_ordering, failure_ordering; - struct vkd3d_shader_src_param *src_params; const struct sm6_value *ptr, *cmp, *new; + struct vsir_src_operand *src_params; struct vsir_dst_operand *dst_params; struct vkd3d_shader_register reg; unsigned int i = 0; @@ -7607,7 +7608,7 @@ static void sm6_parser_emit_cmpxchg(struct sm6_parser *sm6, const struct dxil_re static void sm6_parser_emit_extractval(struct sm6_parser *sm6, const struct dxil_record *record, struct vkd3d_shader_instruction *ins, struct sm6_value *dst) { - struct vkd3d_shader_src_param *src_param; + struct vsir_src_operand *src_param; const struct sm6_type *type; const struct sm6_value *src; unsigned int i = 0; @@ -7767,7 +7768,7 @@ static void sm6_parser_emit_load(struct sm6_parser *sm6, const struct dxil_recor { const struct sm6_type *elem_type = NULL, *pointee_type; unsigned int alignment, operand_count, i = 0; - struct vkd3d_shader_src_param *src_params; + struct vsir_src_operand *src_params; struct vkd3d_shader_register reg; const struct sm6_value *ptr; uint64_t alignment_code; @@ -7852,7 +7853,7 @@ static int phi_incoming_compare(const void *a, const void *b) static void sm6_parser_emit_phi(struct sm6_parser *dxil, const struct dxil_record *record, struct sm6_function *function, struct vkd3d_shader_instruction *ins, struct sm6_value *dst) { - struct vkd3d_shader_src_param *src_params; + struct vsir_src_operand *src_params; unsigned int i, j, incoming_count; struct incoming_value *incoming; const struct sm6_value *src; @@ -7938,7 +7939,7 @@ static void sm6_parser_emit_phi(struct sm6_parser *dxil, const struct dxil_recor { j = i * 2u; src_param_init_from_value(&src_params[j], incoming[i].src, 0, dxil); - vsir_src_param_init_label(&src_params[j + 1], incoming[i].block_idx + 1); + vsir_src_operand_init_label(&src_params[j + 1], incoming[i].block_idx + 1); } instruction_dst_param_init_ssa_scalar(ins, 0, dxil); @@ -7964,7 +7965,7 @@ static void sm6_parser_emit_store(struct sm6_parser *sm6, const struct dxil_reco struct vkd3d_shader_instruction *ins, struct sm6_value *dst) { unsigned int i = 0, alignment, operand_count; - struct vkd3d_shader_src_param *src_params; + struct vsir_src_operand *src_params; struct vsir_dst_operand *dst_param; const struct sm6_value *ptr, *src; struct vkd3d_shader_register reg; @@ -8043,7 +8044,7 @@ static void sm6_parser_emit_store(struct sm6_parser *sm6, const struct dxil_reco static void sm6_parser_emit_switch(struct sm6_parser *dxil, const struct dxil_record *record, struct sm6_function *function, struct vkd3d_shader_instruction *ins) { - struct vkd3d_shader_src_param *src_params; + struct vsir_src_operand *src_params; const struct sm6_type *type; const struct sm6_value *src; uint64_t case_value; @@ -8087,10 +8088,10 @@ static void sm6_parser_emit_switch(struct sm6_parser *dxil, const struct dxil_re src_param_init_from_value(&src_params[0], src, 0, dxil); /* Set the default block label id, 1-based. */ - vsir_src_param_init_label(&src_params[1], record->operands[2] + 1); + vsir_src_operand_init_label(&src_params[1], record->operands[2] + 1); /* Set a zero merge block label id as a placeholder until it is set during * the structurisation pass. */ - vsir_src_param_init_label(&src_params[2], 0); + vsir_src_operand_init_label(&src_params[2], 0); for (i = 3; i < record->operand_count; i += 2) { @@ -8112,7 +8113,7 @@ static void sm6_parser_emit_switch(struct sm6_parser *dxil, const struct dxil_re /* Set the case constant value. 64-bit values are supported. */ if (src_params[0].reg.data_type == VSIR_DATA_U64) { - vsir_src_param_init(&src_params[i], VKD3DSPR_IMMCONST64, VSIR_DATA_U64, 0); + vsir_src_operand_init(&src_params[i], VKD3DSPR_IMMCONST64, VSIR_DATA_U64, 0); src_params[i].reg.u.immconst_u64[0] = case_value; } else @@ -8120,7 +8121,7 @@ static void sm6_parser_emit_switch(struct sm6_parser *dxil, const struct dxil_re if (case_value > UINT_MAX) vkd3d_shader_parser_warning(&dxil->p, VKD3D_SHADER_WARNING_DXIL_TYPE_MISMATCH, "Truncating 64-bit switch case value %"PRIx64" to 32 bits.", case_value); - vsir_src_param_init(&src_params[i], VKD3DSPR_IMMCONST, VSIR_DATA_U32, 0); + vsir_src_operand_init(&src_params[i], VKD3DSPR_IMMCONST, VSIR_DATA_U32, 0); src_params[i].reg.u.immconst_u32[0] = case_value; } @@ -8130,14 +8131,14 @@ static void sm6_parser_emit_switch(struct sm6_parser *dxil, const struct dxil_re return; } /* Set the case block label id, 1-based. */ - vsir_src_param_init_label(&src_params[i + 1], record->operands[i + 1] + 1); + vsir_src_operand_init_label(&src_params[i + 1], record->operands[i + 1] + 1); } } static void sm6_parser_emit_vselect(struct sm6_parser *sm6, const struct dxil_record *record, struct vkd3d_shader_instruction *ins, struct sm6_value *dst) { - struct vkd3d_shader_src_param *src_params; + struct vsir_src_operand *src_params; const struct sm6_value *src[3]; unsigned int i = 0; @@ -8454,8 +8455,8 @@ static void metadata_attachment_record_apply(const struct dxil_record *record, e static void sm6_function_emit_label(struct sm6_function *function, unsigned int label_id, struct sm6_parser *dxil) { - struct vkd3d_shader_src_param *src_param; struct vkd3d_shader_instruction *ins; + struct vsir_src_operand *src_param; ins = &function->instructions.elements[function->instructions.count++]; @@ -8465,7 +8466,7 @@ static void sm6_function_emit_label(struct sm6_function *function, unsigned int vkd3d_shader_instruction_make_nop(ins); return; } - vsir_src_param_init_label(src_param, label_id); + vsir_src_operand_init_label(src_param, label_id); } static enum vkd3d_result sm6_parser_function_init(struct sm6_parser *sm6, diff --git a/libs/vkd3d-shader/glsl.c b/libs/vkd3d-shader/glsl.c index 0eee3e5bd..96c64a0e4 100644 --- a/libs/vkd3d-shader/glsl.c +++ b/libs/vkd3d-shader/glsl.c @@ -67,8 +67,8 @@ struct vkd3d_glsl_generator const struct vkd3d_shader_scan_combined_resource_sampler_info *combined_sampler_info; }; -static void shader_glsl_print_subscript(struct vkd3d_string_buffer *buffer, struct vkd3d_glsl_generator *gen, - const struct vkd3d_shader_src_param *rel_addr, unsigned int offset); +static void shader_glsl_print_subscript(struct vkd3d_string_buffer *buffer, + struct vkd3d_glsl_generator *gen, const struct vsir_src_operand *rel_addr, unsigned int offset); static void VKD3D_PRINTF_FUNC(3, 4) vkd3d_glsl_compiler_error( struct vkd3d_glsl_generator *generator, @@ -389,7 +389,7 @@ static void shader_glsl_print_bitcast(struct vkd3d_string_buffer *dst, struct vk } static void shader_glsl_print_src(struct vkd3d_string_buffer *buffer, struct vkd3d_glsl_generator *gen, - const struct vkd3d_shader_src_param *vsir_src, uint32_t mask, enum vsir_data_type data_type) + const struct vsir_src_operand *vsir_src, uint32_t mask, enum vsir_data_type data_type) { const struct vkd3d_shader_register *reg = &vsir_src->reg; struct vkd3d_string_buffer *register_name; @@ -418,7 +418,7 @@ static void shader_glsl_print_src(struct vkd3d_string_buffer *buffer, struct vkd } static void glsl_src_init(struct glsl_src *glsl_src, struct vkd3d_glsl_generator *gen, - const struct vkd3d_shader_src_param *vsir_src, uint32_t mask) + const struct vsir_src_operand *vsir_src, uint32_t mask) { glsl_src->str = vkd3d_string_buffer_get(&gen->string_buffers); shader_glsl_print_src(glsl_src->str, gen, vsir_src, mask, vsir_src->reg.data_type); @@ -452,8 +452,8 @@ static uint32_t glsl_dst_init(struct glsl_dst *glsl_dst, struct vkd3d_glsl_gener return write_mask; } -static void shader_glsl_print_subscript(struct vkd3d_string_buffer *buffer, struct vkd3d_glsl_generator *gen, - const struct vkd3d_shader_src_param *rel_addr, unsigned int offset) +static void shader_glsl_print_subscript(struct vkd3d_string_buffer *buffer, + struct vkd3d_glsl_generator *gen, const struct vsir_src_operand *rel_addr, unsigned int offset) { struct glsl_src r; @@ -862,7 +862,7 @@ static void shader_glsl_ld(struct vkd3d_glsl_generator *gen, const struct vkd3d_ } static void shader_glsl_print_shadow_coord(struct vkd3d_string_buffer *buffer, struct vkd3d_glsl_generator *gen, - const struct vkd3d_shader_src_param *coord, const struct vkd3d_shader_src_param *ref, unsigned int coord_size) + const struct vsir_src_operand *coord, const struct vsir_src_operand *ref, unsigned int coord_size) { uint32_t coord_mask = vkd3d_write_mask_from_component_count(coord_size); @@ -896,9 +896,9 @@ static void shader_glsl_sample(struct vkd3d_glsl_generator *gen, const struct vk { bool shadow_sampler, array, bias, dynamic_offset, gather, grad, lod, lod_zero, offset, shadow; const struct glsl_resource_type_info *resource_type_info; - const struct vkd3d_shader_src_param *resource, *sampler; unsigned int resource_id, resource_idx, resource_space; unsigned int sampler_id, sampler_idx, sampler_space; + const struct vsir_src_operand *resource, *sampler; const struct vkd3d_shader_descriptor_info1 *d; enum vkd3d_shader_resource_type resource_type; unsigned int component_idx, coord_size; diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index 4141c74f3..a504ed074 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -9202,11 +9202,11 @@ static uint32_t generate_vsir_get_src_swizzle(uint32_t src_writemask, uint32_t d return swizzle; } -static void sm1_generate_vsir_constant_defs(struct hlsl_ctx *ctx, struct vsir_program *program, - struct hlsl_block *block) +static void sm1_generate_vsir_constant_defs(struct hlsl_ctx *ctx, + struct vsir_program *program, struct hlsl_block *block) { - struct vkd3d_shader_src_param *src_param; struct vkd3d_shader_instruction *ins; + struct vsir_src_operand *src; struct vsir_dst_operand *dst; unsigned int i, x; @@ -9227,21 +9227,19 @@ static void sm1_generate_vsir_constant_defs(struct hlsl_ctx *ctx, struct vsir_pr } dst = &ins->dst[0]; - vsir_register_init(&dst->reg, VKD3DSPR_CONST, VSIR_DATA_F32, 1); - ins->dst[0].reg.dimension = VSIR_DIMENSION_VEC4; - ins->dst[0].reg.idx[0].offset = constant_reg->index; - ins->dst[0].write_mask = VKD3DSP_WRITEMASK_ALL; + vsir_dst_operand_init(dst, VKD3DSPR_CONST, VSIR_DATA_F32, 1); + dst->reg.dimension = VSIR_DIMENSION_VEC4; + dst->reg.idx[0].offset = constant_reg->index; + dst->write_mask = VKD3DSP_WRITEMASK_ALL; - src_param = &ins->src[0]; - vsir_register_init(&src_param->reg, VKD3DSPR_IMMCONST, VSIR_DATA_F32, 0); - src_param->reg.type = VKD3DSPR_IMMCONST; - src_param->reg.precision = VKD3D_SHADER_REGISTER_PRECISION_DEFAULT; - src_param->reg.non_uniform = false; - src_param->reg.data_type = VSIR_DATA_F32; - src_param->reg.dimension = VSIR_DIMENSION_VEC4; + src = &ins->src[0]; + vsir_src_operand_init(src, VKD3DSPR_IMMCONST, VSIR_DATA_F32, 0); + src->reg.dimension = VSIR_DIMENSION_VEC4; for (x = 0; x < 4; ++x) - src_param->reg.u.immconst_f32[x] = constant_reg->value.f[x]; - src_param->swizzle = VKD3D_SHADER_NO_SWIZZLE; + { + src->reg.u.immconst_f32[x] = constant_reg->value.f[x]; + } + src->swizzle = VKD3D_SHADER_NO_SWIZZLE; } } @@ -9372,13 +9370,13 @@ static struct vkd3d_shader_instruction *generate_vsir_add_program_instruction(st return ins; } -static void vsir_src_from_hlsl_constant_value(struct vkd3d_shader_src_param *src, +static void vsir_src_from_hlsl_constant_value(struct vsir_src_operand *src, struct hlsl_ctx *ctx, const struct hlsl_constant_value *value, enum vsir_data_type type, unsigned int width, unsigned int map_writemask) { unsigned int i, j; - vsir_src_param_init(src, VKD3DSPR_IMMCONST, type, 0); + vsir_src_operand_init(src, VKD3DSPR_IMMCONST, type, 0); if (width == 1) { src->reg.u.immconst_u32[0] = value->u[0].u; @@ -9396,8 +9394,8 @@ static void vsir_src_from_hlsl_constant_value(struct vkd3d_shader_src_param *src } } -static void vsir_src_from_hlsl_node(struct vkd3d_shader_src_param *src, - struct hlsl_ctx *ctx, const struct hlsl_ir_node *instr, uint32_t map_writemask) +static void vsir_src_from_hlsl_node(struct vsir_src_operand *src, struct hlsl_ctx *ctx, + const struct hlsl_ir_node *instr, uint32_t map_writemask) { struct hlsl_ir_constant *constant; @@ -9417,12 +9415,12 @@ static void vsir_src_from_hlsl_node(struct vkd3d_shader_src_param *src, } } -static struct vkd3d_shader_src_param *sm4_generate_vsir_new_idx_src(struct hlsl_ctx *ctx, +static struct vsir_src_operand *sm4_generate_vsir_new_idx_src(struct hlsl_ctx *ctx, struct vsir_program *program, const struct hlsl_ir_node *rel_offset) { - struct vkd3d_shader_src_param *idx_src; + struct vsir_src_operand *idx_src; - if (!(idx_src = vsir_program_get_src_params(program, 1))) + if (!(idx_src = vsir_program_get_src_operands(program, 1))) { ctx->result = VKD3D_ERROR_OUT_OF_MEMORY; return NULL; @@ -9646,16 +9644,17 @@ static bool sm4_generate_vsir_reg_from_deref(struct hlsl_ctx *ctx, struct vsir_p return true; } -static bool sm4_generate_vsir_init_src_param_from_deref(struct hlsl_ctx *ctx, struct vsir_program *program, - struct vkd3d_shader_src_param *src_param, const struct hlsl_deref *deref, +static bool sm4_generate_vsir_init_src_operand_from_deref(struct hlsl_ctx *ctx, + struct vsir_program *program, struct vsir_src_operand *src, const struct hlsl_deref *deref, unsigned int dst_writemask, const struct vkd3d_shader_location *loc) { uint32_t writemask; - if (!sm4_generate_vsir_reg_from_deref(ctx, program, &src_param->reg, &writemask, deref)) + if (!sm4_generate_vsir_reg_from_deref(ctx, program, &src->reg, &writemask, deref)) return false; - if (src_param->reg.dimension != VSIR_DIMENSION_NONE) - src_param->swizzle = generate_vsir_get_src_swizzle(writemask, dst_writemask); + if (src->reg.dimension != VSIR_DIMENSION_NONE) + src->swizzle = generate_vsir_get_src_swizzle(writemask, dst_writemask); + return true; } @@ -9686,8 +9685,8 @@ static void sm1_generate_vsir_instr_constant(struct hlsl_ctx *ctx, struct vsir_program *program, struct hlsl_ir_constant *constant) { struct hlsl_ir_node *instr = &constant->node; - struct vkd3d_shader_src_param *src_param; struct vkd3d_shader_instruction *ins; + struct vsir_src_operand *src; VKD3D_ASSERT(instr->reg.allocated); VKD3D_ASSERT(constant->reg.allocated); @@ -9695,11 +9694,11 @@ static void sm1_generate_vsir_instr_constant(struct hlsl_ctx *ctx, if (!(ins = generate_vsir_add_program_instruction(ctx, program, &instr->loc, VSIR_OP_MOV, 1, 1))) return; - src_param = &ins->src[0]; - vsir_register_init(&src_param->reg, VKD3DSPR_CONST, VSIR_DATA_F32, 1); - src_param->reg.dimension = VSIR_DIMENSION_VEC4; - src_param->reg.idx[0].offset = constant->reg.id; - src_param->swizzle = generate_vsir_get_src_swizzle(constant->reg.writemask, instr->reg.writemask); + src = &ins->src[0]; + vsir_src_operand_init(src, VKD3DSPR_CONST, VSIR_DATA_F32, 1); + src->reg.dimension = VSIR_DIMENSION_VEC4; + src->reg.idx[0].offset = constant->reg.id; + src->swizzle = generate_vsir_get_src_swizzle(constant->reg.writemask, instr->reg.writemask); vsir_dst_from_hlsl_node(&ins->dst[0], ctx, instr); } @@ -9707,9 +9706,9 @@ static void sm1_generate_vsir_instr_constant(struct hlsl_ctx *ctx, static void sm4_generate_vsir_rasterizer_sample_count(struct hlsl_ctx *ctx, struct vsir_program *program, struct hlsl_ir_expr *expr) { - struct vkd3d_shader_src_param *src_param; struct hlsl_ir_node *instr = &expr->node; struct vkd3d_shader_instruction *ins; + struct vsir_src_operand *src; if (!(ins = generate_vsir_add_program_instruction(ctx, program, &instr->loc, VSIR_OP_SAMPLE_INFO, 1, 1))) return; @@ -9717,10 +9716,10 @@ static void sm4_generate_vsir_rasterizer_sample_count(struct hlsl_ctx *ctx, vsir_dst_from_hlsl_node(&ins->dst[0], ctx, instr); - src_param = &ins->src[0]; - vsir_src_param_init(src_param, VKD3DSPR_RASTERIZER, VSIR_DATA_UNUSED, 0); - src_param->reg.dimension = VSIR_DIMENSION_VEC4; - src_param->swizzle = VKD3D_SHADER_SWIZZLE(X, X, X, X); + src = &ins->src[0]; + vsir_src_operand_init(src, VKD3DSPR_RASTERIZER, VSIR_DATA_UNUSED, 0); + src->reg.dimension = VSIR_DIMENSION_VEC4; + src->swizzle = VKD3D_SHADER_SWIZZLE(X, X, X, X); } /* Translate ops that can be mapped to a single vsir instruction with only one dst register. */ @@ -9729,9 +9728,9 @@ static void generate_vsir_instr_expr_single_instr_op(struct hlsl_ctx *ctx, uint32_t src_mod, uint32_t dst_mod, bool map_src_swizzles) { struct hlsl_ir_node *instr = &expr->node; - struct vkd3d_shader_src_param *src_param; struct vkd3d_shader_instruction *ins; unsigned int i, src_count = 0; + struct vsir_src_operand *src; struct vsir_dst_operand *dst; VKD3D_ASSERT(instr->reg.allocated); @@ -9754,10 +9753,9 @@ static void generate_vsir_instr_expr_single_instr_op(struct hlsl_ctx *ctx, { struct hlsl_ir_node *operand = expr->operands[i].node; - src_param = &ins->src[i]; - vsir_src_from_hlsl_node(src_param, ctx, operand, - map_src_swizzles ? dst->write_mask : VKD3DSP_WRITEMASK_ALL); - src_param->modifiers = src_mod; + src = &ins->src[i]; + vsir_src_from_hlsl_node(src, ctx, operand, map_src_swizzles ? dst->write_mask : VKD3DSP_WRITEMASK_ALL); + src->modifiers = src_mod; } } @@ -9768,8 +9766,8 @@ static void sm1_generate_vsir_instr_expr_per_component_instr_op(struct hlsl_ctx { struct hlsl_ir_node *operand = expr->operands[0].node; struct hlsl_ir_node *instr = &expr->node; - struct vkd3d_shader_src_param *src_param; struct vkd3d_shader_instruction *ins; + struct vsir_src_operand *src; struct vsir_dst_operand *dst; uint32_t src_swizzle; unsigned int i, c; @@ -9786,17 +9784,17 @@ static void sm1_generate_vsir_instr_expr_per_component_instr_op(struct hlsl_ctx return; dst = &ins->dst[0]; - vsir_register_init(&dst->reg, instr->reg.type, VSIR_DATA_F32, 1); + vsir_dst_operand_init(dst, instr->reg.type, VSIR_DATA_F32, 1); dst->reg.idx[0].offset = instr->reg.id; dst->reg.dimension = VSIR_DIMENSION_VEC4; dst->write_mask = 1u << i; - src_param = &ins->src[0]; - vsir_register_init(&src_param->reg, operand->reg.type, VSIR_DATA_F32, 1); - src_param->reg.idx[0].offset = operand->reg.id; - src_param->reg.dimension = VSIR_DIMENSION_VEC4; + src = &ins->src[0]; + vsir_src_operand_init(src, operand->reg.type, VSIR_DATA_F32, 1); + src->reg.idx[0].offset = operand->reg.id; + src->reg.dimension = VSIR_DIMENSION_VEC4; c = vsir_swizzle_get_component(src_swizzle, i); - src_param->swizzle = vsir_swizzle_from_writemask(1u << c); + src->swizzle = vsir_swizzle_from_writemask(1u << c); } } } @@ -9806,8 +9804,8 @@ static void sm1_generate_vsir_instr_expr_sincos(struct hlsl_ctx *ctx, struct vsi { struct hlsl_ir_node *operand = expr->operands[0].node; struct hlsl_ir_node *instr = &expr->node; - struct vkd3d_shader_src_param *src_param; struct vkd3d_shader_instruction *ins; + struct vsir_src_operand *src; unsigned int src_count = 0; VKD3D_ASSERT(instr->reg.allocated); @@ -9821,17 +9819,17 @@ static void sm1_generate_vsir_instr_expr_sincos(struct hlsl_ctx *ctx, struct vsi if (ctx->profile->major_version < 3) { - src_param = &ins->src[1]; - vsir_register_init(&src_param->reg, VKD3DSPR_CONST, VSIR_DATA_F32, 1); - src_param->reg.dimension = VSIR_DIMENSION_VEC4; - src_param->reg.idx[0].offset = ctx->d3dsincosconst1.id; - src_param->swizzle = VKD3D_SHADER_NO_SWIZZLE; + src = &ins->src[1]; + vsir_src_operand_init(src, VKD3DSPR_CONST, VSIR_DATA_F32, 1); + src->reg.dimension = VSIR_DIMENSION_VEC4; + src->reg.idx[0].offset = ctx->d3dsincosconst1.id; + src->swizzle = VKD3D_SHADER_NO_SWIZZLE; - src_param = &ins->src[2]; - vsir_register_init(&src_param->reg, VKD3DSPR_CONST, VSIR_DATA_F32, 1); - src_param->reg.dimension = VSIR_DIMENSION_VEC4; - src_param->reg.idx[0].offset = ctx->d3dsincosconst2.id; - src_param->swizzle = VKD3D_SHADER_NO_SWIZZLE; + src = &ins->src[2]; + vsir_src_operand_init(src, VKD3DSPR_CONST, VSIR_DATA_F32, 1); + src->reg.dimension = VSIR_DIMENSION_VEC4; + src->reg.idx[0].offset = ctx->d3dsincosconst2.id; + src->swizzle = VKD3D_SHADER_NO_SWIZZLE; } } @@ -10186,12 +10184,11 @@ static void sm1_generate_vsir_instr_mova(struct hlsl_ctx *ctx, vsir_src_from_hlsl_node(&ins->src[0], ctx, instr, VKD3DSP_WRITEMASK_ALL); } -static struct vkd3d_shader_src_param *sm1_generate_vsir_new_address_src(struct hlsl_ctx *ctx, - struct vsir_program *program) +static struct vsir_src_operand *sm1_generate_vsir_new_address_src(struct hlsl_ctx *ctx, struct vsir_program *program) { - struct vkd3d_shader_src_param *idx_src; + struct vsir_src_operand *idx_src; - if (!(idx_src = vsir_program_get_src_params(program, 1))) + if (!(idx_src = vsir_program_get_src_operands(program, 1))) { ctx->result = VKD3D_ERROR_OUT_OF_MEMORY; return NULL; @@ -10204,12 +10201,12 @@ static struct vkd3d_shader_src_param *sm1_generate_vsir_new_address_src(struct h return idx_src; } -static void sm1_generate_vsir_init_src_param_from_deref(struct hlsl_ctx *ctx, - struct vsir_program *program, struct vkd3d_shader_src_param *src_param, - struct hlsl_deref *deref, uint32_t dst_writemask, const struct vkd3d_shader_location *loc) +static void sm1_generate_vsir_init_src_operand_from_deref(struct hlsl_ctx *ctx, + struct vsir_program *program, struct vsir_src_operand *src, struct hlsl_deref *deref, + uint32_t dst_writemask, const struct vkd3d_shader_location *loc) { enum vkd3d_shader_register_type type = VKD3DSPR_TEMP; - struct vkd3d_shader_src_param *src_rel_addr = NULL; + struct vsir_src_operand *src_rel_addr = NULL; struct vkd3d_shader_version version; uint32_t register_index; unsigned int writemask; @@ -10277,11 +10274,11 @@ static void sm1_generate_vsir_init_src_param_from_deref(struct hlsl_ctx *ctx, writemask = reg.writemask; } - vsir_register_init(&src_param->reg, type, VSIR_DATA_F32, 1); - src_param->reg.dimension = VSIR_DIMENSION_VEC4; - src_param->reg.idx[0].offset = register_index; - src_param->reg.idx[0].rel_addr = src_rel_addr; - src_param->swizzle = generate_vsir_get_src_swizzle(writemask, dst_writemask); + vsir_src_operand_init(src, type, VSIR_DATA_F32, 1); + src->reg.dimension = VSIR_DIMENSION_VEC4; + src->reg.idx[0].offset = register_index; + src->reg.idx[0].rel_addr = src_rel_addr; + src->swizzle = generate_vsir_get_src_swizzle(writemask, dst_writemask); } static void sm1_generate_vsir_instr_load(struct hlsl_ctx *ctx, struct vsir_program *program, @@ -10300,7 +10297,7 @@ static void sm1_generate_vsir_instr_load(struct hlsl_ctx *ctx, struct vsir_progr vsir_dst_from_hlsl_node(&ins->dst[0], ctx, instr); - sm1_generate_vsir_init_src_param_from_deref(ctx, program, &ins->src[0], + sm1_generate_vsir_init_src_operand_from_deref(ctx, program, &ins->src[0], &load->src, ins->dst[0].write_mask, &ins->location); } @@ -10311,7 +10308,6 @@ static void sm1_generate_vsir_instr_resource_load(struct hlsl_ctx *ctx, struct hlsl_ir_node *ddx = load->ddx.node; struct hlsl_ir_node *ddy = load->ddy.node; struct hlsl_ir_node *instr = &load->node; - struct vkd3d_shader_src_param *src_param; struct vkd3d_shader_instruction *ins; enum vkd3d_shader_opcode opcode; unsigned int src_count = 2; @@ -10355,19 +10351,14 @@ static void sm1_generate_vsir_instr_resource_load(struct hlsl_ctx *ctx, vsir_dst_from_hlsl_node(&ins->dst[0], ctx, instr); - src_param = &ins->src[0]; - vsir_src_from_hlsl_node(src_param, ctx, coords, VKD3DSP_WRITEMASK_ALL); - - sm1_generate_vsir_init_src_param_from_deref(ctx, program, &ins->src[1], &load->resource, - VKD3DSP_WRITEMASK_ALL, &ins->location); + vsir_src_from_hlsl_node(&ins->src[0], ctx, coords, VKD3DSP_WRITEMASK_ALL); + sm1_generate_vsir_init_src_operand_from_deref(ctx, program, &ins->src[1], + &load->resource, VKD3DSP_WRITEMASK_ALL, &ins->location); if (load->load_type == HLSL_RESOURCE_SAMPLE_GRAD) { - src_param = &ins->src[2]; - vsir_src_from_hlsl_node(src_param, ctx, ddx, VKD3DSP_WRITEMASK_ALL); - - src_param = &ins->src[3]; - vsir_src_from_hlsl_node(src_param, ctx, ddy, VKD3DSP_WRITEMASK_ALL); + vsir_src_from_hlsl_node(&ins->src[2], ctx, ddx, VKD3DSP_WRITEMASK_ALL); + vsir_src_from_hlsl_node(&ins->src[3], ctx, ddy, VKD3DSP_WRITEMASK_ALL); } } @@ -10375,8 +10366,8 @@ static void generate_vsir_instr_swizzle(struct hlsl_ctx *ctx, struct vsir_program *program, struct hlsl_ir_swizzle *swizzle_instr) { struct hlsl_ir_node *instr = &swizzle_instr->node, *val = swizzle_instr->val.node; - struct vkd3d_shader_src_param *src_param; struct vkd3d_shader_instruction *ins; + struct vsir_src_operand *src; uint32_t swizzle; VKD3D_ASSERT(instr->reg.allocated); @@ -10390,29 +10381,27 @@ static void generate_vsir_instr_swizzle(struct hlsl_ctx *ctx, swizzle = hlsl_combine_swizzles(swizzle, swizzle_instr->u.vector, instr->data_type->e.numeric.dimx); swizzle = hlsl_map_swizzle(swizzle, ins->dst[0].write_mask); - src_param = &ins->src[0]; + src = &ins->src[0]; VKD3D_ASSERT(val->type != HLSL_IR_CONSTANT); - vsir_register_init(&src_param->reg, val->reg.type, vsir_data_type_from_hlsl_instruction(ctx, val), 1); - src_param->reg.idx[0].offset = val->reg.id; - src_param->reg.dimension = VSIR_DIMENSION_VEC4; - src_param->swizzle = swizzle; + vsir_src_operand_init(src, val->reg.type, vsir_data_type_from_hlsl_instruction(ctx, val), 1); + src->reg.idx[0].offset = val->reg.id; + src->reg.dimension = VSIR_DIMENSION_VEC4; + src->swizzle = swizzle; } -static void sm1_generate_vsir_instr_store(struct hlsl_ctx *ctx, struct vsir_program *program, - struct hlsl_ir_store *store) +static void sm1_generate_vsir_instr_store(struct hlsl_ctx *ctx, + struct vsir_program *program, struct hlsl_ir_store *store) { struct hlsl_ir_node *rhs = store->rhs.node; struct hlsl_ir_node *instr = &store->node; struct vkd3d_shader_instruction *ins; - struct vkd3d_shader_src_param *src_param; if (!(ins = generate_vsir_add_program_instruction(ctx, program, &instr->loc, VSIR_OP_MOV, 1, 1))) return; sm1_generate_vsir_init_dst_operand_from_deref(ctx, &ins->dst[0], &store->lhs, &ins->location, store->writemask); - src_param = &ins->src[0]; - vsir_src_from_hlsl_node(src_param, ctx, rhs, ins->dst[0].write_mask); + vsir_src_from_hlsl_node(&ins->src[0], ctx, rhs, ins->dst[0].write_mask); } static void sm1_generate_vsir_instr_jump(struct hlsl_ctx *ctx, @@ -10442,9 +10431,9 @@ static void sm1_generate_vsir_block(struct hlsl_ctx *ctx, struct hlsl_block *blo static void sm1_generate_vsir_instr_if(struct hlsl_ctx *ctx, struct vsir_program *program, struct hlsl_ir_if *iff) { struct hlsl_ir_node *condition = iff->condition.node; - struct vkd3d_shader_src_param *src_param; struct hlsl_ir_node *instr = &iff->node; struct vkd3d_shader_instruction *ins; + struct vsir_src_operand *src; /* Conditional branches should have already been flattened for SM < 2.1. */ VKD3D_ASSERT(hlsl_version_ge(ctx, 2, 1)); @@ -10455,13 +10444,13 @@ static void sm1_generate_vsir_instr_if(struct hlsl_ctx *ctx, struct vsir_program return; ins->flags = VKD3D_SHADER_REL_OP_NE; - src_param = &ins->src[0]; - vsir_src_from_hlsl_node(src_param, ctx, condition, VKD3DSP_WRITEMASK_ALL); - src_param->modifiers = 0; + src = &ins->src[0]; + vsir_src_from_hlsl_node(src, ctx, condition, VKD3DSP_WRITEMASK_ALL); + src->modifiers = 0; - src_param = &ins->src[1]; - vsir_src_from_hlsl_node(src_param, ctx, condition, VKD3DSP_WRITEMASK_ALL); - src_param->modifiers = VKD3DSPSM_NEG; + src = &ins->src[1]; + vsir_src_from_hlsl_node(src, ctx, condition, VKD3DSP_WRITEMASK_ALL); + src->modifiers = VKD3DSPSM_NEG; sm1_generate_vsir_block(ctx, &iff->then_block, program); @@ -11892,7 +11881,6 @@ static bool sm4_generate_vsir_instr_store(struct hlsl_ctx *ctx, struct vsir_program *program, struct hlsl_ir_store *store) { struct hlsl_ir_node *instr = &store->node; - struct vkd3d_shader_src_param *src_param; struct vkd3d_shader_instruction *ins; struct vsir_dst_operand *dst; @@ -11906,8 +11894,7 @@ static bool sm4_generate_vsir_instr_store(struct hlsl_ctx *ctx, dst, &store->lhs, &instr->loc, store->writemask)) return false; - src_param = &ins->src[0]; - vsir_src_from_hlsl_node(src_param, ctx, store->rhs.node, dst->write_mask); + vsir_src_from_hlsl_node(&ins->src[0], ctx, store->rhs.node, dst->write_mask); return true; } @@ -11945,7 +11932,7 @@ static bool sm4_generate_vsir_instr_load(struct hlsl_ctx *ctx, struct vsir_progr dst = &ins->dst[0]; vsir_dst_from_hlsl_node(dst, ctx, instr); - if (!sm4_generate_vsir_init_src_param_from_deref(ctx, program, + if (!sm4_generate_vsir_init_src_operand_from_deref(ctx, program, &ins->src[0], &load->src, dst->write_mask, &instr->loc)) return false; @@ -11964,7 +11951,7 @@ static bool sm4_generate_vsir_instr_load(struct hlsl_ctx *ctx, struct vsir_progr dst = &ins->dst[0]; vsir_dst_from_hlsl_node(dst, ctx, instr); - if (!sm4_generate_vsir_init_src_param_from_deref(ctx, program, + if (!sm4_generate_vsir_init_src_operand_from_deref(ctx, program, &ins->src[0], &load->src, dst->write_mask, &instr->loc)) return false; } @@ -11998,8 +11985,8 @@ static bool sm4_generate_vsir_instr_resource_store(struct hlsl_ctx *ctx, if (!(ins = generate_vsir_add_program_instruction(ctx, program, &store->node.loc, opcode, 0, 1))) return false; - if (!sm4_generate_vsir_init_src_param_from_deref(ctx, program, &ins->src[0], - &store->resource, VKD3DSP_WRITEMASK_ALL, &instr->loc)) + if (!sm4_generate_vsir_init_src_operand_from_deref(ctx, program, + &ins->src[0], &store->resource, VKD3DSP_WRITEMASK_ALL, &instr->loc)) return false; return true; @@ -12158,7 +12145,7 @@ static bool sm4_generate_vsir_instr_ld(struct hlsl_ctx *ctx, vsir_src_from_hlsl_node(&ins->src[0], ctx, coords, coords_writemask); - if (!sm4_generate_vsir_init_src_param_from_deref(ctx, program, + if (!sm4_generate_vsir_init_src_operand_from_deref(ctx, program, &ins->src[structured ? 2 : 1], resource, ins->dst[0].write_mask, &instr->loc)) return false; @@ -12243,12 +12230,12 @@ static bool sm4_generate_vsir_instr_sample(struct hlsl_ctx *ctx, vsir_src_from_hlsl_node(&ins->src[0], ctx, coords, VKD3DSP_WRITEMASK_ALL); - if (!sm4_generate_vsir_init_src_param_from_deref(ctx, program, &ins->src[1], - resource, ins->dst[0].write_mask, &instr->loc)) + if (!sm4_generate_vsir_init_src_operand_from_deref(ctx, program, + &ins->src[1], resource, ins->dst[0].write_mask, &instr->loc)) return false; - if (!sm4_generate_vsir_init_src_param_from_deref(ctx, program, &ins->src[2], - sampler, VKD3DSP_WRITEMASK_ALL, &instr->loc)) + if (!sm4_generate_vsir_init_src_operand_from_deref(ctx, program, + &ins->src[2], sampler, VKD3DSP_WRITEMASK_ALL, &instr->loc)) return false; if (opcode == VSIR_OP_SAMPLE_LOD || opcode == VSIR_OP_SAMPLE_B) @@ -12309,11 +12296,11 @@ static bool sm4_generate_vsir_instr_gather(struct hlsl_ctx *ctx, struct vsir_pro else sm4_generate_vsir_encode_texel_offset_as_aoffimmi(ins, texel_offset); - if (!sm4_generate_vsir_init_src_param_from_deref(ctx, program, + if (!sm4_generate_vsir_init_src_operand_from_deref(ctx, program, &ins->src[current_arg++], resource, ins->dst[0].write_mask, &instr->loc)) return false; - if (!sm4_generate_vsir_init_src_param_from_deref(ctx, program, + if (!sm4_generate_vsir_init_src_operand_from_deref(ctx, program, &ins->src[current_arg], sampler, VKD3DSP_WRITEMASK_ALL, &instr->loc)) return false; ins->src[current_arg].reg.dimension = VSIR_DIMENSION_VEC4; @@ -12344,7 +12331,7 @@ static bool sm4_generate_vsir_instr_sample_info(struct hlsl_ctx *ctx, vsir_dst_from_hlsl_node(&ins->dst[0], ctx, instr); - if (!sm4_generate_vsir_init_src_param_from_deref(ctx, program, + if (!sm4_generate_vsir_init_src_operand_from_deref(ctx, program, &ins->src[0], resource, ins->dst[0].write_mask, &instr->loc)) return false; @@ -12378,7 +12365,7 @@ static bool sm4_generate_vsir_instr_resinfo(struct hlsl_ctx *ctx, vsir_src_from_hlsl_node(&ins->src[0], ctx, load->lod.node, VKD3DSP_WRITEMASK_ALL); - if (!sm4_generate_vsir_init_src_param_from_deref(ctx, program, + if (!sm4_generate_vsir_init_src_operand_from_deref(ctx, program, &ins->src[1], resource, ins->dst[0].write_mask, &instr->loc)) return false; @@ -13077,8 +13064,8 @@ static void sm4_generate_vsir_add_dcl_constant_buffer(struct hlsl_ctx *ctx, { unsigned int array_first = cbuffer->reg.index; unsigned int array_last = cbuffer->reg.index; /* FIXME: array end. */ - struct vkd3d_shader_src_param *src_param; struct vkd3d_shader_instruction *ins; + struct vsir_src_operand *src; if (!(ins = generate_vsir_add_program_instruction(ctx, program, &cbuffer->loc, VSIR_OP_DCL_CONSTANT_BUFFER, 0, 0))) { @@ -13087,27 +13074,24 @@ static void sm4_generate_vsir_add_dcl_constant_buffer(struct hlsl_ctx *ctx, } ins->declaration.cb.size = align(cbuffer->size, 4) * sizeof(float); - - src_param = &ins->declaration.cb.src; - vsir_src_param_init(src_param, VKD3DSPR_CONSTBUFFER, VSIR_DATA_F32, 0); - src_param->reg.dimension = VSIR_DIMENSION_VEC4; - src_param->swizzle = VKD3D_SHADER_NO_SWIZZLE; - ins->declaration.cb.range.space = cbuffer->reg.space; ins->declaration.cb.range.first = array_first; ins->declaration.cb.range.last = array_last; - src_param->reg.idx[0].offset = cbuffer->reg.id; - src_param->reg.idx[1].offset = array_first; - src_param->reg.idx[2].offset = array_last; - src_param->reg.idx_count = 3; + src = &ins->declaration.cb.src; + vsir_src_operand_init(src, VKD3DSPR_CONSTBUFFER, VSIR_DATA_F32, 3); + src->reg.idx[0].offset = cbuffer->reg.id; + src->reg.idx[1].offset = array_first; + src->reg.idx[2].offset = array_last; + src->reg.dimension = VSIR_DIMENSION_VEC4; + src->swizzle = VKD3D_SHADER_NO_SWIZZLE; } static void sm4_generate_vsir_add_dcl_sampler(struct hlsl_ctx *ctx, struct vsir_program *program, const struct extern_resource *resource) { - struct vkd3d_shader_src_param *src_param; struct vkd3d_shader_instruction *ins; + struct vsir_src_operand *src; unsigned int i; VKD3D_ASSERT(resource->regset == HLSL_REGSET_SAMPLERS); @@ -13130,17 +13114,15 @@ static void sm4_generate_vsir_add_dcl_sampler(struct hlsl_ctx *ctx, if (resource->component_type->sampler_dim == HLSL_SAMPLER_DIM_COMPARISON) ins->flags |= VKD3DSI_SAMPLER_COMPARISON_MODE; - src_param = &ins->declaration.sampler.src; - vsir_src_param_init(src_param, VKD3DSPR_SAMPLER, VSIR_DATA_UNUSED, 0); - ins->declaration.sampler.range.first = array_first; ins->declaration.sampler.range.last = array_last; ins->declaration.sampler.range.space = resource->space; - src_param->reg.idx[0].offset = resource->id + i; - src_param->reg.idx[1].offset = array_first; - src_param->reg.idx[2].offset = array_last; - src_param->reg.idx_count = 3; + src = &ins->declaration.sampler.src; + vsir_src_operand_init(src, VKD3DSPR_SAMPLER, VSIR_DATA_UNUSED, 3); + src->reg.idx[0].offset = resource->id + i; + src->reg.idx[1].offset = array_first; + src->reg.idx[2].offset = array_last; } } @@ -13362,7 +13344,7 @@ static void sm4_generate_vsir_add_dcl_stream(struct hlsl_ctx *ctx, return; } - vsir_src_param_init(&ins->src[0], VKD3DSPR_STREAM, VSIR_DATA_UNUSED, 1); + vsir_src_operand_init(&ins->src[0], VKD3DSPR_STREAM, VSIR_DATA_UNUSED, 1); ins->src[0].reg.dimension = VSIR_DIMENSION_NONE; ins->src[0].reg.idx[0].offset = var->regs[HLSL_REGSET_STREAM_OUTPUTS].index; } diff --git a/libs/vkd3d-shader/ir.c b/libs/vkd3d-shader/ir.c index f1fdfc111..0261ba889 100644 --- a/libs/vkd3d-shader/ir.c +++ b/libs/vkd3d-shader/ir.c @@ -524,8 +524,8 @@ bool vsir_program_add_icb(struct vsir_program *program, struct vkd3d_shader_imme return true; } -static struct vkd3d_shader_src_param *vsir_program_clone_src_params( - struct vsir_program *program, const struct vkd3d_shader_src_param *params, size_t count); +static struct vsir_src_operand *vsir_program_clone_src_operands( + struct vsir_program *program, const struct vsir_src_operand *operands, size_t count); static bool shader_register_clone_relative_addresses(struct vkd3d_shader_register *reg, struct vsir_program *program) { @@ -536,7 +536,7 @@ static bool shader_register_clone_relative_addresses(struct vkd3d_shader_registe if (!reg->idx[i].rel_addr) continue; - if (!(reg->idx[i].rel_addr = vsir_program_clone_src_params(program, reg->idx[i].rel_addr, 1))) + if (!(reg->idx[i].rel_addr = vsir_program_clone_src_operands(program, reg->idx[i].rel_addr, 1))) return false; } @@ -562,23 +562,23 @@ static struct vsir_dst_operand *vsir_program_clone_dst_operands( return ret; } -static struct vkd3d_shader_src_param *vsir_program_clone_src_params( - struct vsir_program *program, const struct vkd3d_shader_src_param *params, size_t count) +static struct vsir_src_operand *vsir_program_clone_src_operands( + struct vsir_program *program, const struct vsir_src_operand *operands, size_t count) { - struct vkd3d_shader_src_param *src_params; + struct vsir_src_operand *ret; size_t i; - if (!(src_params = vsir_program_get_src_params(program, count))) + if (!(ret = vsir_program_get_src_operands(program, count))) return NULL; - memcpy(src_params, params, count * sizeof(*params)); + memcpy(ret, operands, count * sizeof(*operands)); for (i = 0; i < count; ++i) { - if (!shader_register_clone_relative_addresses(&src_params[i].reg, program)) + if (!shader_register_clone_relative_addresses(&ret[i].reg, program)) return NULL; } - return src_params; + return ret; } static void shader_instruction_array_destroy(struct vkd3d_shader_instruction_array *array) @@ -668,7 +668,7 @@ bool vsir_program_init(struct vsir_program *program, const struct vkd3d_shader_c /* Size the parameter initial allocations so they are large enough for most shaders. The * code path for chained allocations will be tested if a few shaders need to use it. */ shader_param_allocator_init(&program->dst_operands, reserve - reserve / 8u, sizeof(struct vsir_dst_operand)); - shader_param_allocator_init(&program->src_params, reserve * 2u, sizeof(struct vkd3d_shader_src_param)); + shader_param_allocator_init(&program->src_operands, reserve * 2u, sizeof(struct vsir_src_operand)); if (!shader_instruction_array_init(&program->instructions, reserve)) { if (program->free_parameters) @@ -696,7 +696,7 @@ void vsir_program_cleanup(struct vsir_program *program) shader_signature_cleanup(&program->output_signature); shader_signature_cleanup(&program->patch_constant_signature); vkd3d_shader_free_scan_descriptor_info1(&program->descriptors); - shader_param_allocator_destroy(&program->src_params); + shader_param_allocator_destroy(&program->src_operands); shader_param_allocator_destroy(&program->dst_operands); for (i = 0; i < program->icb_count; ++i) { @@ -869,70 +869,70 @@ static inline bool shader_register_is_phase_instance_id(const struct vkd3d_shade return reg->type == VKD3DSPR_FORKINSTID || reg->type == VKD3DSPR_JOININSTID; } -void vsir_src_param_init(struct vkd3d_shader_src_param *param, enum vkd3d_shader_register_type reg_type, +void vsir_src_operand_init(struct vsir_src_operand *src, enum vkd3d_shader_register_type reg_type, enum vsir_data_type data_type, unsigned int idx_count) { - vsir_register_init(¶m->reg, reg_type, data_type, idx_count); - param->swizzle = 0; - param->modifiers = VKD3DSPSM_NONE; + vsir_register_init(&src->reg, reg_type, data_type, idx_count); + src->swizzle = 0; + src->modifiers = VKD3DSPSM_NONE; } -static void src_param_init_const_uint(struct vkd3d_shader_src_param *src, uint32_t value) +static void vsir_src_operand_init_const_u32(struct vsir_src_operand *src, uint32_t value) { - vsir_src_param_init(src, VKD3DSPR_IMMCONST, VSIR_DATA_U32, 0); + vsir_src_operand_init(src, VKD3DSPR_IMMCONST, VSIR_DATA_U32, 0); src->reg.u.immconst_u32[0] = value; } -static void vsir_src_param_init_io(struct vkd3d_shader_src_param *src, +static void vsir_src_operand_init_io(struct vsir_src_operand *src, enum vkd3d_shader_register_type reg_type, const struct signature_element *e, unsigned int idx_count) { - vsir_src_param_init(src, reg_type, vsir_data_type_from_component_type(e->component_type), idx_count); + vsir_src_operand_init(src, reg_type, vsir_data_type_from_component_type(e->component_type), idx_count); src->reg.dimension = VSIR_DIMENSION_VEC4; src->swizzle = vsir_swizzle_from_writemask(e->mask); } -void vsir_src_param_init_label(struct vkd3d_shader_src_param *param, unsigned int label_id) +void vsir_src_operand_init_label(struct vsir_src_operand *src, unsigned int label_id) { - vsir_src_param_init(param, VKD3DSPR_LABEL, VSIR_DATA_UNUSED, 1); - param->reg.dimension = VSIR_DIMENSION_NONE; - param->reg.idx[0].offset = label_id; + vsir_src_operand_init(src, VKD3DSPR_LABEL, VSIR_DATA_UNUSED, 1); + src->reg.dimension = VSIR_DIMENSION_NONE; + src->reg.idx[0].offset = label_id; } -static void src_param_init_parameter(struct vkd3d_shader_src_param *src, uint32_t idx, enum vsir_data_type type) +static void vsir_src_operand_init_parameter(struct vsir_src_operand *src, uint32_t idx, enum vsir_data_type type) { - vsir_src_param_init(src, VKD3DSPR_PARAMETER, type, 1); + vsir_src_operand_init(src, VKD3DSPR_PARAMETER, type, 1); src->reg.idx[0].offset = idx; } -static void src_param_init_parameter_vec4(struct vkd3d_shader_src_param *src, uint32_t idx, enum vsir_data_type type) +static void vsir_src_operand_init_parameter_vec4(struct vsir_src_operand *src, uint32_t idx, enum vsir_data_type type) { - vsir_src_param_init(src, VKD3DSPR_PARAMETER, type, 1); + vsir_src_operand_init(src, VKD3DSPR_PARAMETER, type, 1); src->reg.idx[0].offset = idx; src->reg.dimension = VSIR_DIMENSION_VEC4; src->swizzle = VKD3D_SHADER_NO_SWIZZLE; } -static void vsir_src_param_init_resource(struct vkd3d_shader_src_param *src, unsigned int id, unsigned int idx) +static void vsir_src_operand_init_resource(struct vsir_src_operand *src, unsigned int id, unsigned int idx) { - vsir_src_param_init(src, VKD3DSPR_RESOURCE, VSIR_DATA_UNUSED, 2); + vsir_src_operand_init(src, VKD3DSPR_RESOURCE, VSIR_DATA_UNUSED, 2); src->reg.idx[0].offset = id; src->reg.idx[1].offset = idx; src->reg.dimension = VSIR_DIMENSION_VEC4; src->swizzle = VKD3D_SHADER_NO_SWIZZLE; } -static void vsir_src_param_init_sampler(struct vkd3d_shader_src_param *src, unsigned int id, unsigned int idx) +static void vsir_src_operand_init_sampler(struct vsir_src_operand *src, unsigned int id, unsigned int idx) { - vsir_src_param_init(src, VKD3DSPR_SAMPLER, VSIR_DATA_UNUSED, 2); + vsir_src_operand_init(src, VKD3DSPR_SAMPLER, VSIR_DATA_UNUSED, 2); src->reg.idx[0].offset = id; src->reg.idx[1].offset = idx; src->reg.dimension = VSIR_DIMENSION_NONE; } -static void src_param_init_ssa(struct vkd3d_shader_src_param *src, unsigned int idx, +static void vsir_src_operand_init_ssa(struct vsir_src_operand *src, unsigned int idx, enum vsir_data_type data_type, enum vsir_dimension dimension) { - vsir_src_param_init(src, VKD3DSPR_SSA, data_type, 1); + vsir_src_operand_init(src, VKD3DSPR_SSA, data_type, 1); src->reg.idx[0].offset = idx; if (dimension == VSIR_DIMENSION_VEC4) @@ -942,50 +942,50 @@ static void src_param_init_ssa(struct vkd3d_shader_src_param *src, unsigned int } } -static void src_param_init_ssa_scalar(struct vkd3d_shader_src_param *src, +static void vsir_src_operand_init_ssa_scalar(struct vsir_src_operand *src, unsigned int idx, enum vsir_data_type data_type) { - src_param_init_ssa(src, idx, data_type, VSIR_DIMENSION_SCALAR); + vsir_src_operand_init_ssa(src, idx, data_type, VSIR_DIMENSION_SCALAR); } -static void src_param_init_ssa_bool(struct vkd3d_shader_src_param *src, unsigned int idx) +static void vsir_src_operand_init_ssa_bool(struct vsir_src_operand *src, unsigned int idx) { - src_param_init_ssa_scalar(src, idx, VSIR_DATA_BOOL); + vsir_src_operand_init_ssa_scalar(src, idx, VSIR_DATA_BOOL); } -static void src_param_init_ssa_float(struct vkd3d_shader_src_param *src, unsigned int idx) +static void vsir_src_operand_init_ssa_f32(struct vsir_src_operand *src, unsigned int idx) { - src_param_init_ssa_scalar(src, idx, VSIR_DATA_F32); + vsir_src_operand_init_ssa_scalar(src, idx, VSIR_DATA_F32); } -static void src_param_init_ssa_float4(struct vkd3d_shader_src_param *src, unsigned int idx) +static void vsir_src_operand_init_ssa_f32v4(struct vsir_src_operand *src, unsigned int idx) { - src_param_init_ssa(src, idx, VSIR_DATA_F32, VSIR_DIMENSION_VEC4); + vsir_src_operand_init_ssa(src, idx, VSIR_DATA_F32, VSIR_DIMENSION_VEC4); } -static void src_param_init_temp_bool(struct vkd3d_shader_src_param *src, unsigned int idx) +static void vsir_src_operand_init_temp_bool(struct vsir_src_operand *src, unsigned int idx) { - vsir_src_param_init(src, VKD3DSPR_TEMP, VSIR_DATA_BOOL, 1); + vsir_src_operand_init(src, VKD3DSPR_TEMP, VSIR_DATA_BOOL, 1); src->reg.idx[0].offset = idx; } -static void src_param_init_temp_float(struct vkd3d_shader_src_param *src, unsigned int idx) +static void vsir_src_operand_init_temp_f32(struct vsir_src_operand *src, unsigned int idx) { - vsir_src_param_init(src, VKD3DSPR_TEMP, VSIR_DATA_F32, 1); + vsir_src_operand_init(src, VKD3DSPR_TEMP, VSIR_DATA_F32, 1); src->reg.idx[0].offset = idx; } -static void src_param_init_temp_float4(struct vkd3d_shader_src_param *src, unsigned int idx) +static void vsir_src_operand_init_temp_f32v4(struct vsir_src_operand *src, unsigned int idx) { - vsir_src_param_init(src, VKD3DSPR_TEMP, VSIR_DATA_F32, 1); + vsir_src_operand_init(src, VKD3DSPR_TEMP, VSIR_DATA_F32, 1); src->reg.dimension = VSIR_DIMENSION_VEC4; src->swizzle = VKD3D_SHADER_NO_SWIZZLE; src->reg.idx[0].offset = idx; } -static void src_param_init_temp_uint(struct vkd3d_shader_src_param *src, unsigned int idx) +static void vsir_src_operand_init_temp_u32(struct vsir_src_operand *src, unsigned int idx) { - vsir_src_param_init(src, VKD3DSPR_TEMP, VSIR_DATA_U32, 1); + vsir_src_operand_init(src, VKD3DSPR_TEMP, VSIR_DATA_U32, 1); src->reg.idx[0].offset = idx; } @@ -1100,7 +1100,7 @@ bool vsir_instruction_init_with_params(struct vsir_program *program, return false; } - if (!(ins->src = vsir_program_get_src_params(program, ins->src_count))) + if (!(ins->src = vsir_program_get_src_operands(program, ins->src_count))) { ERR("Failed to allocate %u source parameters.\n", src_count); return false; @@ -1114,15 +1114,15 @@ bool vsir_instruction_init_with_params(struct vsir_program *program, static bool vsir_instruction_init_label(struct vkd3d_shader_instruction *ins, const struct vkd3d_shader_location *location, unsigned int label_id, struct vsir_program *program) { - struct vkd3d_shader_src_param *src_param; + struct vsir_src_operand *src; - if (!(src_param = vsir_program_get_src_params(program, 1))) + if (!(src = vsir_program_get_src_operands(program, 1))) return false; - vsir_src_param_init_label(src_param, label_id); + vsir_src_operand_init_label(src, label_id); vsir_instruction_init(ins, location, VSIR_OP_LABEL); - ins->src = src_param; + ins->src = src; ins->src_count = 1; return true; @@ -1147,7 +1147,7 @@ static bool vsir_program_iterator_clone_instruction(struct vsir_program *program if (dst->dst_count && !(dst->dst = vsir_program_clone_dst_operands(program, dst->dst, dst->dst_count))) return false; - return !dst->src_count || (dst->src = vsir_program_clone_src_params(program, dst->src, dst->src_count)); + return !dst->src_count || (dst->src = vsir_program_clone_src_operands(program, dst->src, dst->src_count)); } static bool get_opcode_from_rel_op(enum vkd3d_shader_rel_op rel_op, @@ -1248,11 +1248,11 @@ static enum vkd3d_result vsir_program_normalize_addr(struct vsir_program *progra for (k = 0; k < ins->src_count; ++k) { - struct vkd3d_shader_src_param *src = &ins->src[k]; + struct vsir_src_operand *src = &ins->src[k]; for (r = 0; r < src->reg.idx_count; ++r) { - struct vkd3d_shader_src_param *rel = src->reg.idx[r].rel_addr; + struct vsir_src_operand *rel = src->reg.idx[r].rel_addr; if (rel && rel->reg.type == VKD3DSPR_ADDR) { @@ -1327,7 +1327,7 @@ static enum vkd3d_result vsir_program_lower_lrp(struct vsir_program *program, st { struct vkd3d_shader_instruction *ins = vsir_program_iterator_current(lrp); const struct vkd3d_shader_location location = ins->location; - const struct vkd3d_shader_src_param *src = ins->src; + const struct vsir_src_operand *src = ins->src; const struct vsir_dst_operand *dst = ins->dst; struct vsir_program_iterator it; unsigned int neg_id, mad_id; @@ -1351,7 +1351,7 @@ static enum vkd3d_result vsir_program_lower_lrp(struct vsir_program *program, st goto fail; mad_id = program->ssa_count++; vsir_dst_operand_init_ssa(&ins->dst[0], mad_id, src[2].reg.data_type, src[2].reg.dimension); - src_param_init_ssa(&ins->src[0], neg_id, src[0].reg.data_type, src[0].reg.dimension); + vsir_src_operand_init_ssa(&ins->src[0], neg_id, src[0].reg.data_type, src[0].reg.dimension); ins->src[1] = src[2]; ins->src[2] = src[2]; @@ -1361,7 +1361,7 @@ static enum vkd3d_result vsir_program_lower_lrp(struct vsir_program *program, st ins->dst[0] = dst[0]; ins->src[0] = src[0]; ins->src[1] = src[1]; - src_param_init_ssa(&ins->src[2], mad_id, src[2].reg.data_type, src[2].reg.dimension); + vsir_src_operand_init_ssa(&ins->src[2], mad_id, src[2].reg.data_type, src[2].reg.dimension); return VKD3D_OK; @@ -1375,7 +1375,7 @@ static enum vkd3d_result vsir_program_lower_nrm(struct vsir_program *program, st { struct vkd3d_shader_instruction *ins = vsir_program_iterator_current(nrm); const struct vkd3d_shader_location location = ins->location; - const struct vkd3d_shader_src_param *src = ins->src; + const struct vsir_src_operand *src = ins->src; const struct vsir_dst_operand *dst = ins->dst; unsigned int dot_id, rsq_id, mul_id; struct vsir_program_iterator it; @@ -1401,23 +1401,23 @@ static enum vkd3d_result vsir_program_lower_nrm(struct vsir_program *program, st goto fail; rsq_id = program->ssa_count++; vsir_dst_operand_init_ssa(&ins->dst[0], rsq_id, src[0].reg.data_type, VSIR_DIMENSION_SCALAR); - src_param_init_ssa(&ins->src[0], dot_id, src[0].reg.data_type, VSIR_DIMENSION_SCALAR); + vsir_src_operand_init_ssa(&ins->src[0], dot_id, src[0].reg.data_type, VSIR_DIMENSION_SCALAR); ins = vsir_program_iterator_next(&it); if (!vsir_instruction_init_with_params(program, ins, &location, VSIR_OP_MUL, 1, 2)) goto fail; mul_id = program->ssa_count++; vsir_dst_operand_init_ssa(&ins->dst[0], mul_id, src[0].reg.data_type, dst[0].reg.dimension); - src_param_init_ssa(&ins->src[0], rsq_id, src[0].reg.data_type, VSIR_DIMENSION_SCALAR); + vsir_src_operand_init_ssa(&ins->src[0], rsq_id, src[0].reg.data_type, VSIR_DIMENSION_SCALAR); ins->src[1] = src[0]; ins = vsir_program_iterator_next(&it); if (!vsir_instruction_init_with_params(program, ins, &location, VSIR_OP_MOVC, 1, 3)) goto fail; ins->dst[0] = dst[0]; - src_param_init_ssa(&ins->src[0], dot_id, VSIR_DATA_U32, VSIR_DIMENSION_SCALAR); - src_param_init_ssa(&ins->src[1], mul_id, src[0].reg.data_type, dst[0].reg.dimension); - src_param_init_ssa(&ins->src[2], dot_id, src[0].reg.data_type, VSIR_DIMENSION_SCALAR); + vsir_src_operand_init_ssa(&ins->src[0], dot_id, VSIR_DATA_U32, VSIR_DIMENSION_SCALAR); + vsir_src_operand_init_ssa(&ins->src[1], mul_id, src[0].reg.data_type, dst[0].reg.dimension); + vsir_src_operand_init_ssa(&ins->src[2], dot_id, src[0].reg.data_type, VSIR_DIMENSION_SCALAR); return VKD3D_OK; @@ -1540,7 +1540,8 @@ static enum vkd3d_result vsir_program_lower_precise_mad(struct vsir_program *pro *add_ins->dst = *mul_dst; vsir_dst_operand_init_ssa(mul_dst, program->ssa_count, mul_ins->src[0].reg.data_type, VSIR_DIMENSION_VEC4); - src_param_init_ssa(&add_ins->src[0], program->ssa_count++, mul_ins->src[0].reg.data_type, VSIR_DIMENSION_VEC4); + vsir_src_operand_init_ssa(&add_ins->src[0], program->ssa_count++, + mul_ins->src[0].reg.data_type, VSIR_DIMENSION_VEC4); add_ins->src[1] = mul_ins->src[2]; @@ -1612,8 +1613,8 @@ static enum vkd3d_result vsir_program_lower_udiv(struct vsir_program *program, if (!(vsir_instruction_init_with_params(program, mov, &udiv->location, VSIR_OP_MOVC, 1, 3))) return VKD3D_ERROR_OUT_OF_MEMORY; - src_param_init_ssa(&mov->src[0], src1_id, udiv->src[1].reg.data_type, udiv->src[1].reg.dimension); - src_param_init_ssa(&mov->src[1], src1_id, udiv->src[1].reg.data_type, udiv->src[1].reg.dimension); + vsir_src_operand_init_ssa(&mov->src[0], src1_id, udiv->src[1].reg.data_type, udiv->src[1].reg.dimension); + vsir_src_operand_init_ssa(&mov->src[1], src1_id, udiv->src[1].reg.data_type, udiv->src[1].reg.dimension); vsir_register_init(&mov->src[2].reg, VKD3DSPR_IMMCONST, VSIR_DATA_U32, 0); mov->src[2].reg.dimension = udiv->src[1].reg.dimension; mov->src[2].reg.u.immconst_u32[0] = 1; @@ -1634,8 +1635,8 @@ static enum vkd3d_result vsir_program_lower_udiv(struct vsir_program *program, ins->flags = udiv->flags; - src_param_init_ssa(&ins->src[0], src0_id, udiv->src[0].reg.data_type, udiv->src[0].reg.dimension); - src_param_init_ssa(&ins->src[1], divisor_id, udiv->src[1].reg.data_type, udiv->src[1].reg.dimension); + vsir_src_operand_init_ssa(&ins->src[0], src0_id, udiv->src[0].reg.data_type, udiv->src[0].reg.dimension); + vsir_src_operand_init_ssa(&ins->src[1], divisor_id, udiv->src[1].reg.data_type, udiv->src[1].reg.dimension); vsir_dst_operand_init_ssa(&ins->dst[0], program->ssa_count, udiv->src[1].reg.data_type, udiv->src[1].reg.dimension); @@ -1646,8 +1647,9 @@ static enum vkd3d_result vsir_program_lower_udiv(struct vsir_program *program, if (!(vsir_instruction_init_with_params(program, ins, &udiv->location, VSIR_OP_MOVC, 1, 3))) return VKD3D_ERROR_OUT_OF_MEMORY; - src_param_init_ssa(&ins->src[0], src1_id, udiv->src[1].reg.data_type, udiv->src[1].reg.dimension); - src_param_init_ssa(&ins->src[1], program->ssa_count, udiv->src[1].reg.data_type, udiv->src[1].reg.dimension); + vsir_src_operand_init_ssa(&ins->src[0], src1_id, udiv->src[1].reg.data_type, udiv->src[1].reg.dimension); + vsir_src_operand_init_ssa(&ins->src[1], program->ssa_count, + udiv->src[1].reg.data_type, udiv->src[1].reg.dimension); vsir_register_init(&ins->src[2].reg, VKD3DSPR_IMMCONST, VSIR_DATA_U32, 0); ins->src[2].reg.dimension = udiv->src[1].reg.dimension; ins->src[2].reg.u.immconst_u32[0] = UINT_MAX; @@ -1670,8 +1672,8 @@ static enum vkd3d_result vsir_program_lower_udiv(struct vsir_program *program, ins->flags = udiv->flags; - src_param_init_ssa(&ins->src[0], src0_id, udiv->src[0].reg.data_type, udiv->src[0].reg.dimension); - src_param_init_ssa(&ins->src[1], divisor_id, udiv->src[1].reg.data_type, udiv->src[1].reg.dimension); + vsir_src_operand_init_ssa(&ins->src[0], src0_id, udiv->src[0].reg.data_type, udiv->src[0].reg.dimension); + vsir_src_operand_init_ssa(&ins->src[1], divisor_id, udiv->src[1].reg.data_type, udiv->src[1].reg.dimension); vsir_dst_operand_init_ssa(&ins->dst[0], program->ssa_count, udiv->src[1].reg.data_type, udiv->src[1].reg.dimension); @@ -1679,8 +1681,9 @@ static enum vkd3d_result vsir_program_lower_udiv(struct vsir_program *program, if (!(vsir_instruction_init_with_params(program, ins, &udiv->location, VSIR_OP_MOVC, 1, 3))) return VKD3D_ERROR_OUT_OF_MEMORY; - src_param_init_ssa(&ins->src[0], src1_id, udiv->src[1].reg.data_type, udiv->src[1].reg.dimension); - src_param_init_ssa(&ins->src[1], program->ssa_count, udiv->src[1].reg.data_type, udiv->src[1].reg.dimension); + vsir_src_operand_init_ssa(&ins->src[0], src1_id, udiv->src[1].reg.data_type, udiv->src[1].reg.dimension); + vsir_src_operand_init_ssa(&ins->src[1], program->ssa_count, + udiv->src[1].reg.data_type, udiv->src[1].reg.dimension); vsir_register_init(&ins->src[2].reg, VKD3DSPR_IMMCONST, VSIR_DATA_U32, 0); ins->src[2].reg.dimension = udiv->src[1].reg.dimension; ins->src[2].reg.u.immconst_u32[0] = UINT_MAX; @@ -1734,7 +1737,7 @@ static enum vkd3d_result vsir_program_lower_sm1_sincos(struct vsir_program *prog ins->flags = sincos->flags; - src_param_init_ssa_scalar(&ins->src[0], program->ssa_count, sincos->src[0].reg.data_type); + vsir_src_operand_init_ssa_scalar(&ins->src[0], program->ssa_count, sincos->src[0].reg.data_type); ins->dst[0] = *sincos->dst; ins->dst[0].write_mask = VKD3DSP_WRITEMASK_1; @@ -1749,7 +1752,7 @@ static enum vkd3d_result vsir_program_lower_sm1_sincos(struct vsir_program *prog ins->flags = sincos->flags; - src_param_init_ssa_scalar(&ins->src[0], program->ssa_count, sincos->src[0].reg.data_type); + vsir_src_operand_init_ssa_scalar(&ins->src[0], program->ssa_count, sincos->src[0].reg.data_type); ins->dst[0] = *sincos->dst; ins->dst[0].write_mask = VKD3DSP_WRITEMASK_0; @@ -1805,7 +1808,7 @@ static enum vkd3d_result vsir_program_lower_sm4_sincos(struct vsir_program *prog ins->flags = sincos->flags; - src_param_init_ssa(&ins->src[0], program->ssa_count, + vsir_src_operand_init_ssa(&ins->src[0], program->ssa_count, sincos->src[0].reg.data_type, sincos->src[0].reg.dimension); ins->dst[0] = sincos->dst[0]; } @@ -1819,7 +1822,7 @@ static enum vkd3d_result vsir_program_lower_sm4_sincos(struct vsir_program *prog ins->flags = sincos->flags; - src_param_init_ssa(&ins->src[0], program->ssa_count, + vsir_src_operand_init_ssa(&ins->src[0], program->ssa_count, sincos->src[0].reg.data_type, sincos->src[0].reg.dimension); ins->dst[0] = sincos->dst[1]; } @@ -1852,7 +1855,7 @@ static enum vkd3d_result vsir_program_lower_texld_sm1(struct vsir_program *progr { const struct vkd3d_shader_descriptor_info1 *sampler; unsigned int idx = ins->dst[0].reg.idx[0].offset; - struct vkd3d_shader_src_param *srcs; + struct vsir_src_operand *srcs; /* texld DST, t# -> sample DST, t#, resource#, sampler# */ @@ -1863,13 +1866,13 @@ static enum vkd3d_result vsir_program_lower_texld_sm1(struct vsir_program *progr return VKD3D_ERROR_NOT_IMPLEMENTED; } - if (!(srcs = vsir_program_get_src_params(program, 4))) + if (!(srcs = vsir_program_get_src_operands(program, 4))) return VKD3D_ERROR_OUT_OF_MEMORY; /* Note we run before I/O normalization. */ srcs[0] = ins->src[0]; - vsir_src_param_init_resource(&srcs[1], idx, idx); - vsir_src_param_init_sampler(&srcs[2], idx, idx); + vsir_src_operand_init_resource(&srcs[1], idx, idx); + vsir_src_operand_init_sampler(&srcs[2], idx, idx); sampler = vkd3d_shader_find_descriptor(&program->descriptors, VKD3D_SHADER_DESCRIPTOR_TYPE_SAMPLER, idx); if (sampler->flags & VKD3D_SHADER_DESCRIPTOR_INFO_FLAG_SAMPLER_COMPARISON_MODE) @@ -1952,17 +1955,17 @@ static enum vkd3d_result vsir_program_lower_texld(struct vsir_program *program, { const struct vkd3d_shader_descriptor_info1 *sampler; unsigned int idx = tex->src[1].reg.idx[0].offset; - struct vkd3d_shader_src_param *srcs; + struct vsir_src_operand *srcs; VKD3D_ASSERT(tex->src[1].reg.idx_count == 1); VKD3D_ASSERT(!tex->src[1].reg.idx[0].rel_addr); - if (!(srcs = vsir_program_get_src_params(program, 4))) + if (!(srcs = vsir_program_get_src_operands(program, 4))) return VKD3D_ERROR_OUT_OF_MEMORY; srcs[0] = tex->src[0]; - vsir_src_param_init_resource(&srcs[1], idx, idx); - vsir_src_param_init_sampler(&srcs[2], idx, idx); + vsir_src_operand_init_resource(&srcs[1], idx, idx); + vsir_src_operand_init_sampler(&srcs[2], idx, idx); sampler = vkd3d_shader_find_descriptor(&program->descriptors, VKD3D_SHADER_DESCRIPTOR_TYPE_SAMPLER, idx); if (sampler->flags & VKD3D_SHADER_DESCRIPTOR_INFO_FLAG_SAMPLER_COMPARISON_MODE) @@ -2009,17 +2012,17 @@ static enum vkd3d_result vsir_program_lower_texldd(struct vsir_program *program, struct vkd3d_shader_instruction *texldd) { unsigned int idx = texldd->src[1].reg.idx[0].offset; - struct vkd3d_shader_src_param *srcs; + struct vsir_src_operand *srcs; VKD3D_ASSERT(texldd->src[1].reg.idx_count == 1); VKD3D_ASSERT(!texldd->src[1].reg.idx[0].rel_addr); - if (!(srcs = vsir_program_get_src_params(program, 5))) + if (!(srcs = vsir_program_get_src_operands(program, 5))) return VKD3D_ERROR_OUT_OF_MEMORY; srcs[0] = texldd->src[0]; - vsir_src_param_init_resource(&srcs[1], idx, idx); - vsir_src_param_init_sampler(&srcs[2], idx, idx); + vsir_src_operand_init_resource(&srcs[1], idx, idx); + vsir_src_operand_init_sampler(&srcs[2], idx, idx); srcs[3] = texldd->src[2]; srcs[4] = texldd->src[3]; @@ -2035,17 +2038,17 @@ static enum vkd3d_result vsir_program_lower_texldl(struct vsir_program *program, { unsigned int idx = texldl->src[1].reg.idx[0].offset; enum vkd3d_shader_swizzle_component w; - struct vkd3d_shader_src_param *srcs; + struct vsir_src_operand *srcs; VKD3D_ASSERT(texldl->src[1].reg.idx_count == 1); VKD3D_ASSERT(!texldl->src[1].reg.idx[0].rel_addr); - if (!(srcs = vsir_program_get_src_params(program, 4))) + if (!(srcs = vsir_program_get_src_operands(program, 4))) return VKD3D_ERROR_OUT_OF_MEMORY; srcs[0] = texldl->src[0]; - vsir_src_param_init_resource(&srcs[1], idx, idx); - vsir_src_param_init_sampler(&srcs[2], idx, idx); + vsir_src_operand_init_resource(&srcs[1], idx, idx); + vsir_src_operand_init_sampler(&srcs[2], idx, idx); texldl->opcode = VSIR_OP_SAMPLE_LOD; texldl->src = srcs; @@ -2090,7 +2093,7 @@ static enum vkd3d_result vsir_program_lower_tex(struct vsir_program *program, const struct vkd3d_shader_location location = ins->location; const struct vkd3d_shader_descriptor_info1 *sampler; unsigned int idx = ins->dst[0].reg.idx[0].offset; - struct vkd3d_shader_src_param *srcs; + struct vsir_src_operand *srcs; /* tex t# -> sample t#, t#, resource#, sampler# * Note that the t# destination will subsequently be turned into a temp. */ @@ -2098,7 +2101,7 @@ static enum vkd3d_result vsir_program_lower_tex(struct vsir_program *program, /* We run before I/O normalization. */ VKD3D_ASSERT(program->normalisation_level < VSIR_NORMALISED_SM6); - if (!(srcs = vsir_program_get_src_params(program, 4))) + if (!(srcs = vsir_program_get_src_operands(program, 4))) return VKD3D_ERROR_OUT_OF_MEMORY; if (is_texture_projected(program, message_context, idx)) @@ -2115,7 +2118,7 @@ static enum vkd3d_result vsir_program_lower_tex(struct vsir_program *program, if (!vsir_instruction_init_with_params(program, ins, &location, VSIR_OP_DIV, 1, 2)) return VKD3D_ERROR_OUT_OF_MEMORY; vsir_dst_operand_init_ssa_f32v4(&ins->dst[0], coords); - vsir_src_param_init(&ins->src[0], VKD3DSPR_TEXTURE, VSIR_DATA_F32, 1); + vsir_src_operand_init(&ins->src[0], VKD3DSPR_TEXTURE, VSIR_DATA_F32, 1); ins->src[0].reg.idx[0].offset = idx; ins->src[0].reg.dimension = VSIR_DIMENSION_VEC4; ins->src[0].swizzle = VKD3D_SHADER_NO_SWIZZLE; @@ -2126,18 +2129,18 @@ static enum vkd3d_result vsir_program_lower_tex(struct vsir_program *program, vsir_instruction_init(ins, &location, VSIR_OP_SAMPLE); ins->dst_count = 1; ins->dst = dst; - src_param_init_ssa_float4(&srcs[0], coords); + vsir_src_operand_init_ssa_f32v4(&srcs[0], coords); } else { - vsir_src_param_init(&srcs[0], VKD3DSPR_TEXTURE, VSIR_DATA_F32, 1); + vsir_src_operand_init(&srcs[0], VKD3DSPR_TEXTURE, VSIR_DATA_F32, 1); srcs[0].reg.idx[0].offset = idx; srcs[0].reg.dimension = VSIR_DIMENSION_VEC4; srcs[0].swizzle = VKD3D_SHADER_NO_SWIZZLE; } - vsir_src_param_init_resource(&srcs[1], idx, idx); - vsir_src_param_init_sampler(&srcs[2], idx, idx); + vsir_src_operand_init_resource(&srcs[1], idx, idx); + vsir_src_operand_init_sampler(&srcs[2], idx, idx); sampler = vkd3d_shader_find_descriptor(&program->descriptors, VKD3D_SHADER_DESCRIPTOR_TYPE_SAMPLER, idx); if (sampler->flags & VKD3D_SHADER_DESCRIPTOR_INFO_FLAG_SAMPLER_COMPARISON_MODE) @@ -2165,7 +2168,7 @@ static enum vkd3d_result vsir_program_lower_texcoord(struct vsir_program *progra struct vkd3d_shader_instruction *ins) { unsigned int idx = ins->dst[0].reg.idx[0].offset; - struct vkd3d_shader_src_param *srcs; + struct vsir_src_operand *srcs; /* texcoord t# -> saturate t#, t# * Note that the t# destination will subsequently be turned into a temp. */ @@ -2173,10 +2176,10 @@ static enum vkd3d_result vsir_program_lower_texcoord(struct vsir_program *progra /* We run before I/O normalization. */ VKD3D_ASSERT(program->normalisation_level < VSIR_NORMALISED_SM6); - if (!(srcs = vsir_program_get_src_params(program, 1))) + if (!(srcs = vsir_program_get_src_operands(program, 1))) return VKD3D_ERROR_OUT_OF_MEMORY; - vsir_src_param_init(&srcs[0], VKD3DSPR_TEXTURE, VSIR_DATA_F32, 1); + vsir_src_operand_init(&srcs[0], VKD3DSPR_TEXTURE, VSIR_DATA_F32, 1); srcs[0].reg.idx[0].offset = idx; srcs[0].reg.dimension = VSIR_DIMENSION_VEC4; srcs[0].swizzle = VKD3D_SHADER_NO_SWIZZLE; @@ -2189,8 +2192,8 @@ static enum vkd3d_result vsir_program_lower_texcoord(struct vsir_program *progra } static struct vkd3d_shader_instruction *generate_bump_coords(struct vsir_program *program, - struct vsir_program_iterator *it, uint32_t idx, const struct vkd3d_shader_src_param *coords, - const struct vkd3d_shader_src_param *perturbation, const struct vkd3d_shader_location *loc) + struct vsir_program_iterator *it, uint32_t idx, const struct vsir_src_operand *coords, + const struct vsir_src_operand *perturbation, const struct vkd3d_shader_location *loc) { struct vkd3d_shader_instruction *ins; uint32_t ssa_temp, ssa_coords; @@ -2211,7 +2214,7 @@ static struct vkd3d_shader_instruction *generate_bump_coords(struct vsir_program ins->dst[0].write_mask = VKD3DSP_WRITEMASK_0 | VKD3DSP_WRITEMASK_1; ins->src[0] = *perturbation; ins->src[0].swizzle = vsir_combine_swizzles(perturbation->swizzle, VKD3D_SHADER_SWIZZLE(X, X, X, X)); - src_param_init_parameter_vec4(&ins->src[1], VKD3D_SHADER_PARAMETER_NAME_BUMP_MATRIX_0 + idx, VSIR_DATA_F32); + vsir_src_operand_init_parameter_vec4(&ins->src[1], VKD3D_SHADER_PARAMETER_NAME_BUMP_MATRIX_0 + idx, VSIR_DATA_F32); ins->src[2] = *coords; ins = vsir_program_iterator_next(it); @@ -2221,9 +2224,9 @@ static struct vkd3d_shader_instruction *generate_bump_coords(struct vsir_program ins->dst[0].write_mask = VKD3DSP_WRITEMASK_0 | VKD3DSP_WRITEMASK_1; ins->src[0] = *perturbation; ins->src[0].swizzle = vsir_combine_swizzles(perturbation->swizzle, VKD3D_SHADER_SWIZZLE(Y, Y, Y, Y)); - src_param_init_parameter_vec4(&ins->src[1], VKD3D_SHADER_PARAMETER_NAME_BUMP_MATRIX_0 + idx, VSIR_DATA_F32); + vsir_src_operand_init_parameter_vec4(&ins->src[1], VKD3D_SHADER_PARAMETER_NAME_BUMP_MATRIX_0 + idx, VSIR_DATA_F32); ins->src[1].swizzle = VKD3D_SHADER_SWIZZLE(Z, W, W, W); - src_param_init_ssa_float4(&ins->src[2], ssa_temp); + vsir_src_operand_init_ssa_f32v4(&ins->src[2], ssa_temp); ins->src[2].swizzle = VKD3D_SHADER_SWIZZLE(X, Y, Y, Y); return ins; @@ -2233,7 +2236,7 @@ static enum vkd3d_result vsir_program_lower_bem(struct vsir_program *program, st { struct vkd3d_shader_instruction *ins = vsir_program_iterator_current(it); const struct vkd3d_shader_location location = ins->location; - const struct vkd3d_shader_src_param *src = ins->src; + const struct vsir_src_operand *src = ins->src; const struct vsir_dst_operand *dst = ins->dst; /* bem DST.xy, SRC0, SRC1 @@ -2257,11 +2260,11 @@ static enum vkd3d_result vsir_program_lower_texbem(struct vsir_program *program, struct vkd3d_shader_instruction *ins = vsir_program_iterator_current(it); const struct vkd3d_shader_location location = ins->location; const struct vkd3d_shader_descriptor_info1 *descriptor; - const struct vkd3d_shader_src_param *src = ins->src; bool is_texbeml = (ins->opcode == VSIR_OP_TEXBEML); unsigned int idx = ins->dst[0].reg.idx[0].offset; uint32_t ssa_coords, ssa_luminance, ssa_sample; - struct vkd3d_shader_src_param orig_coords; + const struct vsir_src_operand *src = ins->src; + struct vsir_src_operand orig_coords; bool projected; /* texbem t#, SRC @@ -2305,7 +2308,7 @@ static enum vkd3d_result vsir_program_lower_texbem(struct vsir_program *program, if (!vsir_program_iterator_insert_after(it, 2 + (is_texbeml ? 2 : 0) + (projected ? 1 : 0))) return VKD3D_ERROR_OUT_OF_MEMORY; - vsir_src_param_init(&orig_coords, VKD3DSPR_TEXTURE, VSIR_DATA_F32, 1); + vsir_src_operand_init(&orig_coords, VKD3DSPR_TEXTURE, VSIR_DATA_F32, 1); orig_coords.reg.idx[0].offset = idx; orig_coords.reg.dimension = VSIR_DIMENSION_VEC4; orig_coords.swizzle = VKD3D_SHADER_NO_SWIZZLE; @@ -2322,7 +2325,7 @@ static enum vkd3d_result vsir_program_lower_texbem(struct vsir_program *program, ins->src[1] = ins->src[0]; ins->src[1].swizzle = VKD3D_SHADER_SWIZZLE(W, W, W, W); - src_param_init_ssa_float4(&orig_coords, ssa_proj); + vsir_src_operand_init_ssa_f32v4(&orig_coords, ssa_proj); vsir_program_iterator_next(it); } @@ -2338,10 +2341,10 @@ static enum vkd3d_result vsir_program_lower_texbem(struct vsir_program *program, ins->dst[0].reg.idx[0].offset = idx; ins->dst[0].reg.dimension = VSIR_DIMENSION_VEC4; ins->dst[0].write_mask = VKD3DSP_WRITEMASK_ALL; - src_param_init_ssa_float4(&ins->src[0], ssa_coords); + vsir_src_operand_init_ssa_f32v4(&ins->src[0], ssa_coords); ins->src[0].swizzle = VKD3D_SHADER_SWIZZLE(X, Y, Y, Y); - vsir_src_param_init_resource(&ins->src[1], idx, idx); - vsir_src_param_init_sampler(&ins->src[2], idx, idx); + vsir_src_operand_init_resource(&ins->src[1], idx, idx); + vsir_src_operand_init_sampler(&ins->src[2], idx, idx); if (is_texbeml) { @@ -2360,9 +2363,9 @@ static enum vkd3d_result vsir_program_lower_texbem(struct vsir_program *program, ins->dst[0].write_mask = VKD3DSP_WRITEMASK_0; ins->src[0] = src[0]; ins->src[0].swizzle = vkd3d_shader_create_swizzle(z, z, z, z); - src_param_init_parameter(&ins->src[1], + vsir_src_operand_init_parameter(&ins->src[1], VKD3D_SHADER_PARAMETER_NAME_BUMP_LUMINANCE_SCALE_0 + idx, VSIR_DATA_F32); - src_param_init_parameter(&ins->src[2], + vsir_src_operand_init_parameter(&ins->src[2], VKD3D_SHADER_PARAMETER_NAME_BUMP_LUMINANCE_OFFSET_0 + idx, VSIR_DATA_F32); ins = vsir_program_iterator_next(it); @@ -2372,8 +2375,8 @@ static enum vkd3d_result vsir_program_lower_texbem(struct vsir_program *program, ins->dst[0].reg.idx[0].offset = idx; ins->dst[0].reg.dimension = VSIR_DIMENSION_VEC4; ins->dst[0].write_mask = VKD3DSP_WRITEMASK_ALL; - src_param_init_ssa_float4(&ins->src[0], ssa_sample); - src_param_init_ssa_float4(&ins->src[1], ssa_luminance); + vsir_src_operand_init_ssa_f32v4(&ins->src[0], ssa_sample); + vsir_src_operand_init_ssa_f32v4(&ins->src[1], ssa_luminance); ins->src[1].swizzle = VKD3D_SHADER_SWIZZLE(X, X, X, X); } return VKD3D_OK; @@ -2565,7 +2568,7 @@ static enum vkd3d_result vsir_program_lower_modifiers(struct vsir_program *progr for (i = 0; i < ins->src_count; ++i) { enum vkd3d_shader_opcode new_opcodes[2] = {VSIR_OP_NOP, VSIR_OP_NOP}; - struct vkd3d_shader_src_param *src = &ins->src[i]; + struct vsir_src_operand *src = &ins->src[i]; switch (src->modifiers) { @@ -2609,7 +2612,7 @@ static enum vkd3d_result vsir_program_lower_modifiers(struct vsir_program *progr vsir_dst_operand_init_ssa(&new_ins->dst[0], program->ssa_count, src->reg.data_type, src->reg.dimension); - src_param_init_ssa(src, program->ssa_count, src->reg.data_type, src->reg.dimension); + vsir_src_operand_init_ssa(src, program->ssa_count, src->reg.data_type, src->reg.dimension); if (data_type_is_64_bit(src->reg.data_type)) { @@ -2653,7 +2656,8 @@ static enum vkd3d_result vsir_program_lower_modifiers(struct vsir_program *progr new_ins->dst[0].modifiers &= ~VKD3DSPDM_SATURATE; vsir_dst_operand_init_ssa(dst, program->ssa_count, dst->reg.data_type, dst->reg.dimension); - src_param_init_ssa(&new_ins->src[0], program->ssa_count, dst->reg.data_type, dst->reg.dimension); + vsir_src_operand_init_ssa(&new_ins->src[0], program->ssa_count, + dst->reg.data_type, dst->reg.dimension); if (data_type_is_64_bit(dst->reg.data_type)) { @@ -2769,7 +2773,7 @@ static enum vkd3d_result vsir_program_lower_texture_writes(struct vsir_program * { for (unsigned int i = 0; i < ins->src_count; ++i) { - struct vkd3d_shader_src_param *src = &ins->src[i]; + struct vsir_src_operand *src = &ins->src[i]; if (src->reg.type == VKD3DSPR_TEXTURE && bitmap_is_set(&texture_written_mask, src->reg.idx[0].offset)) { @@ -2848,7 +2852,7 @@ static enum vkd3d_result vsir_program_normalise_ps1_output(struct vsir_program * return VKD3D_ERROR_OUT_OF_MEMORY; } - src_param_init_temp_float4(&ins->src[0], 0); + vsir_src_operand_init_temp_f32v4(&ins->src[0], 0); ins->src[0].swizzle = VKD3D_SHADER_NO_SWIZZLE; vsir_dst_operand_init(&ins->dst[0], VKD3DSPR_COLOROUT, VSIR_DATA_F32, 1); ins->dst[0].reg.idx[0].offset = 0; @@ -2939,7 +2943,7 @@ static enum vkd3d_result vsir_program_ensure_diffuse(struct vsir_program *progra ins->dst[0].reg.idx[0].offset = 0; ins->dst[0].reg.dimension = VSIR_DIMENSION_VEC4; ins->dst[0].write_mask = VKD3DSP_WRITEMASK_ALL & ~program->diffuse_written_mask; - vsir_src_param_init(&ins->src[0], VKD3DSPR_IMMCONST, VSIR_DATA_F32, 0); + vsir_src_operand_init(&ins->src[0], VKD3DSPR_IMMCONST, VSIR_DATA_F32, 0); ins->src[0].reg.dimension = VSIR_DIMENSION_VEC4; ins->src[0].swizzle = VKD3D_SHADER_NO_SWIZZLE; for (i = 0; i < 4; ++i) @@ -3161,7 +3165,7 @@ static enum vkd3d_result vsir_program_remap_output_signature(struct vsir_program vsir_instruction_init_with_params(program, ins, &loc, VSIR_OP_MOV, 1, 1); vsir_dst_operand_init_output(&ins->dst[0], VSIR_DATA_F32, e->register_index, e->mask); - vsir_src_param_init(&ins->src[0], VKD3DSPR_IMMCONST, VSIR_DATA_F32, 0); + vsir_src_operand_init(&ins->src[0], VKD3DSPR_IMMCONST, VSIR_DATA_F32, 0); ins->src[0].reg.dimension = VSIR_DIMENSION_VEC4; ins->src[0].swizzle = VKD3D_SHADER_NO_SWIZZLE; ins = vsir_program_iterator_next(&it); @@ -3402,14 +3406,14 @@ struct control_point_normaliser { struct vsir_program *program; enum vkd3d_shader_opcode phase; - struct vkd3d_shader_src_param *outpointid_param; + struct vsir_src_operand *outpointid_param; }; -struct vkd3d_shader_src_param *vsir_program_create_outpointid_param(struct vsir_program *program) +struct vsir_src_operand *vsir_program_create_outpointid_param(struct vsir_program *program) { - struct vkd3d_shader_src_param *rel_addr; + struct vsir_src_operand *rel_addr; - if (!(rel_addr = vsir_program_get_src_params(program, 1))) + if (!(rel_addr = vsir_program_get_src_operands(program, 1))) return NULL; vsir_register_init(&rel_addr->reg, VKD3DSPR_OUTPOINTID, VSIR_DATA_U32, 0); @@ -3462,7 +3466,7 @@ static enum vkd3d_result control_point_normaliser_emit_hs_input(struct control_p vsir_instruction_init(ins, location, VSIR_OP_MOV); ins->dst = vsir_program_get_dst_operands(normaliser->program, 1); ins->dst_count = 1; - ins->src = vsir_program_get_src_params(normaliser->program, 1); + ins->src = vsir_program_get_src_operands(normaliser->program, 1); ins->src_count = 1; if (!ins->dst || ! ins->src) @@ -3479,7 +3483,7 @@ static enum vkd3d_result control_point_normaliser_emit_hs_input(struct control_p ins->dst[0].reg.idx[0].rel_addr = normaliser->outpointid_param; ins->dst[0].reg.idx[1].offset = e->register_index; - vsir_src_param_init_io(&ins->src[0], VKD3DSPR_INPUT, e, 2); + vsir_src_operand_init_io(&ins->src[0], VKD3DSPR_INPUT, e, 2); ins->src[0].reg.dimension = VSIR_DIMENSION_VEC4; ins->src[0].reg.idx[0].offset = 0; ins->src[0].reg.idx[0].rel_addr = normaliser->outpointid_param; @@ -4080,11 +4084,11 @@ static bool vsir_dst_operand_io_normalise(struct vsir_dst_operand *dst, struct i return true; } -static void shader_src_param_io_normalise(struct vkd3d_shader_src_param *src_param, +static void vsir_src_operand_io_normalise(struct vsir_src_operand *src, struct io_normaliser *normaliser, struct vkd3d_shader_instruction *ins) { unsigned int i, id_idx, reg_idx, write_mask, element_idx, component_idx; - struct vkd3d_shader_register *reg = &src_param->reg; + struct vkd3d_shader_register *reg = &src->reg; const struct shader_signature *signature; const struct signature_element *e; @@ -4142,7 +4146,7 @@ static void shader_src_param_io_normalise(struct vkd3d_shader_src_param *src_par } id_idx = reg->idx_count - 1; - write_mask = VKD3DSP_WRITEMASK_0 << vsir_swizzle_get_component(src_param->swizzle, 0); + write_mask = VKD3DSP_WRITEMASK_0 << vsir_swizzle_get_component(src->swizzle, 0); if (!shader_signature_find_element_for_reg(signature, reg_idx, write_mask, &element_idx)) { vkd3d_shader_error(normaliser->message_context, &ins->location, VKD3D_SHADER_ERROR_VSIR_INVALID_SIGNATURE, @@ -4160,8 +4164,10 @@ static void shader_src_param_io_normalise(struct vkd3d_shader_src_param *src_par if ((component_idx = vsir_write_mask_get_component_idx(e->mask))) { for (i = 0; i < VKD3D_VEC4_SIZE; ++i) - if (vsir_swizzle_get_component(src_param->swizzle, i)) - src_param->swizzle -= component_idx << VKD3D_SHADER_SWIZZLE_SHIFT(i); + { + if (vsir_swizzle_get_component(src->swizzle, i)) + src->swizzle -= component_idx << VKD3D_SHADER_SWIZZLE_SHIFT(i); + } } } @@ -4188,7 +4194,9 @@ static void shader_instruction_normalise_io_params(struct vkd3d_shader_instructi vsir_dst_operand_io_normalise(&ins->dst[i], normaliser); } for (i = 0; i < ins->src_count; ++i) - shader_src_param_io_normalise(&ins->src[i], normaliser, ins); + { + vsir_src_operand_io_normalise(&ins->src[i], normaliser, ins); + } break; } } @@ -4262,8 +4270,7 @@ struct flat_constants_normaliser }; static bool get_flat_constant_register_type(const struct vkd3d_shader_register *reg, - enum vkd3d_shader_d3dbc_constant_register *set, uint32_t *index, - struct vkd3d_shader_src_param **rel_addr) + enum vkd3d_shader_d3dbc_constant_register *set, uint32_t *index, struct vsir_src_operand **rel_addr) { static const struct { @@ -4294,43 +4301,43 @@ static bool get_flat_constant_register_type(const struct vkd3d_shader_register * return false; } -static void shader_register_normalise_flat_constants(struct vkd3d_shader_src_param *param, +static void shader_register_normalise_flat_constants(struct vsir_src_operand *src, const struct flat_constants_normaliser *normaliser) { enum vkd3d_shader_d3dbc_constant_register set; - struct vkd3d_shader_src_param *rel_addr; + struct vsir_src_operand *rel_addr; unsigned int c; uint32_t index; size_t i, j; - if (!get_flat_constant_register_type(¶m->reg, &set, &index, &rel_addr)) + if (!get_flat_constant_register_type(&src->reg, &set, &index, &rel_addr)) return; for (i = 0; i < normaliser->def_count; ++i) { if (normaliser->defs[i].set == set && normaliser->defs[i].index == index) { - param->reg.type = VKD3DSPR_IMMCONST; - param->reg.idx_count = 0; - param->reg.dimension = VSIR_DIMENSION_VEC4; + src->reg.type = VKD3DSPR_IMMCONST; + src->reg.idx_count = 0; + src->reg.dimension = VSIR_DIMENSION_VEC4; for (j = 0; j < 4; ++j) { - c = vsir_swizzle_get_component(param->swizzle, j); - param->reg.u.immconst_u32[j] = normaliser->defs[i].value[c]; + c = vsir_swizzle_get_component(src->swizzle, j); + src->reg.u.immconst_u32[j] = normaliser->defs[i].value[c]; } - param->swizzle = VKD3D_SHADER_NO_SWIZZLE; + src->swizzle = VKD3D_SHADER_NO_SWIZZLE; return; } } - param->reg.type = VKD3DSPR_CONSTBUFFER; - param->reg.idx[0].offset = set; /* register ID */ - param->reg.idx[0].rel_addr = NULL; - param->reg.idx[1].offset = set; /* register index */ - param->reg.idx[1].rel_addr = NULL; - param->reg.idx[2].offset = index; /* buffer index */ - param->reg.idx[2].rel_addr = rel_addr; - param->reg.idx_count = 3; + src->reg.type = VKD3DSPR_CONSTBUFFER; + src->reg.idx[0].offset = set; /* register ID */ + src->reg.idx[0].rel_addr = NULL; + src->reg.idx[1].offset = set; /* register index */ + src->reg.idx[1].rel_addr = NULL; + src->reg.idx[2].offset = index; /* buffer index */ + src->reg.idx[2].rel_addr = rel_addr; + src->reg.idx_count = 3; } static enum vkd3d_result vsir_program_normalise_flat_constants(struct vsir_program *program, @@ -4483,7 +4490,7 @@ static void vsir_program_replace_instructions(struct vsir_program *program, struct cf_flattener_if_info { - struct vkd3d_shader_src_param *false_param; + struct vsir_src_operand *false_param; unsigned int id; uint32_t merge_block_id; unsigned int else_block_id; @@ -4505,7 +4512,7 @@ struct cf_flattener_switch_case struct cf_flattener_switch_info { struct vsir_program_iterator ins_it; - const struct vkd3d_shader_src_param *condition; + const struct vsir_src_operand *condition; unsigned int id; unsigned int merge_block_id; unsigned int default_block_id; @@ -4595,19 +4602,20 @@ static unsigned int cf_flattener_alloc_block_id(struct cf_flattener *flattener) return ++flattener->block_id; } -static struct vkd3d_shader_src_param *instruction_src_params_alloc(struct vkd3d_shader_instruction *ins, +static struct vsir_src_operand *instruction_src_params_alloc(struct vkd3d_shader_instruction *ins, unsigned int count, struct cf_flattener *flattener) { - struct vkd3d_shader_src_param *params; + struct vsir_src_operand *src; - if (!(params = vsir_program_get_src_params(flattener->program, count))) + if (!(src = vsir_program_get_src_operands(flattener->program, count))) { cf_flattener_set_error(flattener, VKD3D_ERROR_OUT_OF_MEMORY); return NULL; } - ins->src = params; + ins->src = src; ins->src_count = count; - return params; + + return src; } static void cf_flattener_emit_label(struct cf_flattener *flattener, unsigned int label_id) @@ -4624,12 +4632,11 @@ static void cf_flattener_emit_label(struct cf_flattener *flattener, unsigned int } /* For conditional branches, this returns the false target branch parameter. */ -static struct vkd3d_shader_src_param *cf_flattener_emit_branch(struct cf_flattener *flattener, - unsigned int merge_block_id, unsigned int continue_block_id, - const struct vkd3d_shader_src_param *condition, unsigned int true_id, unsigned int false_id, - unsigned int flags) +static struct vsir_src_operand *cf_flattener_emit_branch(struct cf_flattener *flattener, + unsigned int merge_block_id, unsigned int continue_block_id, const struct vsir_src_operand *condition, + unsigned int true_id, unsigned int false_id, unsigned int flags) { - struct vkd3d_shader_src_param *src_params, *false_branch_param; + struct vsir_src_operand *src, *false_branch; struct vkd3d_shader_instruction *ins; if (!(ins = cf_flattener_instruction_append(flattener))) @@ -4638,51 +4645,51 @@ static struct vkd3d_shader_src_param *cf_flattener_emit_branch(struct cf_flatten if (condition) { - if (!(src_params = instruction_src_params_alloc(ins, 4 + !!continue_block_id, flattener))) + if (!(src = instruction_src_params_alloc(ins, 4 + !!continue_block_id, flattener))) { vkd3d_shader_instruction_make_nop(ins); return NULL; } - src_params[0] = *condition; + src[0] = *condition; if (flags == VKD3D_SHADER_CONDITIONAL_OP_Z) { - vsir_src_param_init_label(&src_params[1], false_id); - vsir_src_param_init_label(&src_params[2], true_id); - false_branch_param = &src_params[1]; + vsir_src_operand_init_label(&src[1], false_id); + vsir_src_operand_init_label(&src[2], true_id); + false_branch = &src[1]; } else { - vsir_src_param_init_label(&src_params[1], true_id); - vsir_src_param_init_label(&src_params[2], false_id); - false_branch_param = &src_params[2]; + vsir_src_operand_init_label(&src[1], true_id); + vsir_src_operand_init_label(&src[2], false_id); + false_branch = &src[2]; } - vsir_src_param_init_label(&src_params[3], merge_block_id); + vsir_src_operand_init_label(&src[3], merge_block_id); if (continue_block_id) - vsir_src_param_init_label(&src_params[4], continue_block_id); + vsir_src_operand_init_label(&src[4], continue_block_id); } else { - if (!(src_params = instruction_src_params_alloc(ins, merge_block_id ? 3 : 1, flattener))) + if (!(src = instruction_src_params_alloc(ins, merge_block_id ? 3 : 1, flattener))) { vkd3d_shader_instruction_make_nop(ins); return NULL; } - vsir_src_param_init_label(&src_params[0], true_id); + vsir_src_operand_init_label(&src[0], true_id); if (merge_block_id) { /* An unconditional branch may only have merge information for a loop, which * must have both a merge block and continue block. */ - vsir_src_param_init_label(&src_params[1], merge_block_id); - vsir_src_param_init_label(&src_params[2], continue_block_id); + vsir_src_operand_init_label(&src[1], merge_block_id); + vsir_src_operand_init_label(&src[2], continue_block_id); } - false_branch_param = NULL; + false_branch = NULL; } - return false_branch_param; + return false_branch; } static void cf_flattener_emit_conditional_branch_and_merge(struct cf_flattener *flattener, - const struct vkd3d_shader_src_param *condition, unsigned int true_id, unsigned int flags) + const struct vsir_src_operand *condition, unsigned int true_id, unsigned int flags) { unsigned int merge_block_id; @@ -4787,7 +4794,7 @@ static enum vkd3d_result cf_flattener_iterate_instruction_array(struct cf_flatte for (instruction = vsir_program_iterator_head(&it); instruction; instruction = vsir_program_iterator_next(&it)) { unsigned int loop_header_block_id, loop_body_block_id, continue_block_id, merge_block_id, true_block_id; - const struct vkd3d_shader_src_param *src = instruction->src; + struct vsir_src_operand *src = instruction->src; struct cf_flattener_info *cf_info; flattener->location = instruction->location; @@ -4950,7 +4957,6 @@ static enum vkd3d_result cf_flattener_iterate_instruction_array(struct cf_flatte case VSIR_OP_ENDSWITCH: { - struct vkd3d_shader_src_param *src_params; unsigned int j; if (!cf_info->u.switch_.default_block_id) @@ -4965,21 +4971,21 @@ static enum vkd3d_result cf_flattener_iterate_instruction_array(struct cf_flatte * when new instructions are appended to the * vkd3d_shader_instruction_array. */ dst_ins = vsir_program_iterator_current(&cf_info->u.switch_.ins_it); - if (!(src_params = instruction_src_params_alloc(dst_ins, + if (!(src = instruction_src_params_alloc(dst_ins, cf_info->u.switch_.cases_count * 2 + 3, flattener))) { vkd3d_free(cf_info->u.switch_.cases); return VKD3D_ERROR_OUT_OF_MEMORY; } - src_params[0] = *cf_info->u.switch_.condition; - vsir_src_param_init_label(&src_params[1], cf_info->u.switch_.default_block_id); - vsir_src_param_init_label(&src_params[2], cf_info->u.switch_.merge_block_id); + src[0] = *cf_info->u.switch_.condition; + vsir_src_operand_init_label(&src[1], cf_info->u.switch_.default_block_id); + vsir_src_operand_init_label(&src[2], cf_info->u.switch_.merge_block_id); for (j = 0; j < cf_info->u.switch_.cases_count; ++j) { unsigned int index = j * 2 + 3; - vsir_src_param_init(&src_params[index], VKD3DSPR_IMMCONST, VSIR_DATA_U32, 0); - src_params[index].reg.u.immconst_u32[0] = cf_info->u.switch_.cases[j].value; - vsir_src_param_init_label(&src_params[index + 1], cf_info->u.switch_.cases[j].block_id); + vsir_src_operand_init(&src[index], VKD3DSPR_IMMCONST, VSIR_DATA_U32, 0); + src[index].reg.u.immconst_u32[0] = cf_info->u.switch_.cases[j].value; + vsir_src_operand_init_label(&src[index + 1], cf_info->u.switch_.cases[j].block_id); } vkd3d_free(cf_info->u.switch_.cases); @@ -5148,10 +5154,10 @@ static enum vkd3d_result vsir_program_flatten_control_flow_constructs(struct vsi return result; } -static unsigned int label_from_src_param(const struct vkd3d_shader_src_param *param) +static unsigned int label_from_src_operand(const struct vsir_src_operand *src) { - VKD3D_ASSERT(param->reg.type == VKD3DSPR_LABEL); - return param->reg.idx[0].offset; + VKD3D_ASSERT(src->reg.type == VKD3DSPR_LABEL); + return src->reg.idx[0].offset; } /* A record represents replacing a jump from block `switch_label' to @@ -5207,7 +5213,7 @@ static enum vkd3d_result vsir_program_lower_switch_to_selection_ladder(struct vs switch (ins->opcode) { case VSIR_OP_LABEL: - current_label = label_from_src_param(&ins->src[0]); + current_label = label_from_src_operand(&ins->src[0]); if (!(dst_ins = shader_instruction_array_append(&instructions))) goto fail; *dst_ins = *ins; @@ -5224,7 +5230,7 @@ static enum vkd3d_result vsir_program_lower_switch_to_selection_ladder(struct vs } case_count = (ins->src_count - 3) / 2; - default_label = label_from_src_param(&ins->src[1]); + default_label = label_from_src_operand(&ins->src[1]); /* In principle we can have a switch with no cases, and we * just have to jump to the default label. */ @@ -5238,14 +5244,14 @@ static enum vkd3d_result vsir_program_lower_switch_to_selection_ladder(struct vs vkd3d_shader_instruction_make_nop(dst_ins); goto fail; } - vsir_src_param_init_label(&dst_ins->src[0], default_label); + vsir_src_operand_init_label(&dst_ins->src[0], default_label); } if_label = current_label; for (j = 0; j < case_count; ++j) { - unsigned int fallthrough_label, case_label = label_from_src_param(&ins->src[3 + 2 * j + 1]); + unsigned int fallthrough_label, case_label = label_from_src_operand(&ins->src[3 + 2 * j + 1]); if (!(dst_ins = shader_instruction_array_append(&instructions))) goto fail; @@ -5273,9 +5279,9 @@ static enum vkd3d_result vsir_program_lower_switch_to_selection_ladder(struct vs vkd3d_shader_instruction_make_nop(dst_ins); goto fail; } - src_param_init_ssa_bool(&dst_ins->src[0], ssa_count); - vsir_src_param_init_label(&dst_ins->src[1], case_label); - vsir_src_param_init_label(&dst_ins->src[2], fallthrough_label); + vsir_src_operand_init_ssa_bool(&dst_ins->src[0], ssa_count); + vsir_src_operand_init_label(&dst_ins->src[1], case_label); + vsir_src_operand_init_label(&dst_ins->src[2], fallthrough_label); ++ssa_count; @@ -5298,7 +5304,7 @@ static enum vkd3d_result vsir_program_lower_switch_to_selection_ladder(struct vs vkd3d_shader_instruction_make_nop(dst_ins); goto fail; } - vsir_src_param_init_label(&dst_ins->src[0], ++block_count); + vsir_src_operand_init_label(&dst_ins->src[0], ++block_count); if_label = block_count; } @@ -5362,7 +5368,7 @@ struct ssas_to_temps_block_info { struct phi_incoming_to_temp { - struct vkd3d_shader_src_param *src; + struct vsir_src_operand *src; struct vsir_dst_operand *dst; } *incomings; size_t incoming_capacity; @@ -5436,7 +5442,7 @@ static enum vkd3d_result vsir_program_materialise_phi_ssas_to_temps_in_function( struct phi_incoming_to_temp *incoming; unsigned int label; - label = label_from_src_param(&ins->src[j + 1]); + label = label_from_src_operand(&ins->src[j + 1]); VKD3D_ASSERT(label); info = &block_info[label - 1]; @@ -5476,7 +5482,7 @@ static enum vkd3d_result vsir_program_materialise_phi_ssas_to_temps_in_function( switch (ins->opcode) { case VSIR_OP_LABEL: - current_label = label_from_src_param(&ins->src[0]); + current_label = label_from_src_operand(&ins->src[0]); break; case VSIR_OP_BRANCH: @@ -5720,7 +5726,7 @@ struct vsir_cfg_structure } loop; struct vsir_cfg_structure_selection { - struct vkd3d_shader_src_param *condition; + struct vsir_src_operand *condition; struct vsir_cfg_structure_list if_body; struct vsir_cfg_structure_list else_body; bool invert_condition; @@ -5737,7 +5743,7 @@ struct vsir_cfg_structure JUMP_RET, } type; unsigned int target; - struct vkd3d_shader_src_param *condition; + struct vsir_src_operand *condition; bool invert_condition; bool needs_launcher; } jump; @@ -5922,10 +5928,10 @@ static bool vsir_block_dominates(struct vsir_block *b1, struct vsir_block *b2) return bitmap_is_set(b1->dominates, b2->label - 1); } -static enum vkd3d_result vsir_cfg_add_edge(struct vsir_cfg *cfg, struct vsir_block *block, - struct vkd3d_shader_src_param *successor_param) +static enum vkd3d_result vsir_cfg_add_edge(struct vsir_cfg *cfg, + struct vsir_block *block, struct vsir_src_operand *successor_operand) { - unsigned int target = label_from_src_param(successor_param); + unsigned int target = label_from_src_operand(successor_operand); struct vsir_block *successor = &cfg->blocks[target - 1]; enum vkd3d_result ret; @@ -6106,7 +6112,7 @@ static enum vkd3d_result vsir_cfg_init(struct vsir_cfg *cfg, struct vsir_program case VSIR_OP_LABEL: { - unsigned int label = label_from_src_param(&ins->src[0]); + unsigned int label = label_from_src_operand(&ins->src[0]); VKD3D_ASSERT(!current_block); VKD3D_ASSERT(label > 0); @@ -6859,7 +6865,7 @@ static enum vkd3d_result vsir_cfg_build_structured_program(struct vsir_cfg *cfg) if (vsir_register_is_label(&end->src[0].reg)) { - unsigned int target = label_from_src_param(&end->src[0]); + unsigned int target = label_from_src_operand(&end->src[0]); struct vsir_block *successor = &cfg->blocks[target - 1]; vsir_cfg_compute_edge_action(cfg, block, successor, &action_true); @@ -6867,12 +6873,12 @@ static enum vkd3d_result vsir_cfg_build_structured_program(struct vsir_cfg *cfg) } else { - unsigned int target = label_from_src_param(&end->src[1]); + unsigned int target = label_from_src_operand(&end->src[1]); struct vsir_block *successor = &cfg->blocks[target - 1]; vsir_cfg_compute_edge_action(cfg, block, successor, &action_true); - target = label_from_src_param(&end->src[2]); + target = label_from_src_operand(&end->src[2]); successor = &cfg->blocks[target - 1]; vsir_cfg_compute_edge_action(cfg, block, successor, &action_false); @@ -7469,8 +7475,8 @@ static enum vkd3d_result vsir_cfg_structure_list_emit_loop(struct vsir_cfg *cfg, ++target->temp_count; vsir_dst_operand_init_temp_bool(&ins->dst[0], target->temp_count - 1); - src_param_init_temp_uint(&ins->src[0], target->jump_target_temp_idx); - src_param_init_const_uint(&ins->src[1], outer_continue_target); + vsir_src_operand_init_temp_u32(&ins->src[0], target->jump_target_temp_idx); + vsir_src_operand_init_const_u32(&ins->src[1], outer_continue_target); if (!(ins = shader_instruction_array_append(&target->instructions))) return VKD3D_ERROR_OUT_OF_MEMORY; @@ -7480,7 +7486,7 @@ static enum vkd3d_result vsir_cfg_structure_list_emit_loop(struct vsir_cfg *cfg, return VKD3D_ERROR_OUT_OF_MEMORY; } - src_param_init_temp_bool(&ins->src[0], target->temp_count - 1); + vsir_src_operand_init_temp_bool(&ins->src[0], target->temp_count - 1); ins = shader_instruction_array_append(&target->instructions); if (!vsir_instruction_init_with_params(cfg->program, ins, &no_loc, VSIR_OP_IEQ, 1, 2)) @@ -7492,8 +7498,8 @@ static enum vkd3d_result vsir_cfg_structure_list_emit_loop(struct vsir_cfg *cfg, ++target->temp_count; vsir_dst_operand_init_temp_bool(&ins->dst[0], target->temp_count - 1); - src_param_init_temp_uint(&ins->src[0], target->jump_target_temp_idx); - src_param_init_const_uint(&ins->src[1], inner_break_target); + vsir_src_operand_init_temp_u32(&ins->src[0], target->jump_target_temp_idx); + vsir_src_operand_init_const_u32(&ins->src[1], inner_break_target); if (!(ins = shader_instruction_array_append(&target->instructions))) return VKD3D_ERROR_OUT_OF_MEMORY; @@ -7504,7 +7510,7 @@ static enum vkd3d_result vsir_cfg_structure_list_emit_loop(struct vsir_cfg *cfg, } ins->flags |= VKD3D_SHADER_CONDITIONAL_OP_Z; - src_param_init_temp_bool(&ins->src[0], target->temp_count - 1); + vsir_src_operand_init_temp_bool(&ins->src[0], target->temp_count - 1); } return VKD3D_OK; @@ -7603,7 +7609,7 @@ static enum vkd3d_result vsir_cfg_structure_list_emit_jump(struct vsir_cfg *cfg, } vsir_dst_operand_init_temp_u32(&ins->dst[0], target->jump_target_temp_idx); - src_param_init_const_uint(&ins->src[0], jump_target); + vsir_src_operand_init_const_u32(&ins->src[0], jump_target); } if (!(ins = shader_instruction_array_append(&target->instructions))) @@ -8017,7 +8023,7 @@ static enum vkd3d_result insert_alpha_test_before_ret(struct vsir_program *progr vsir_instruction_init_with_params(program, ins, &loc, VSIR_OP_DISCARD, 0, 1); ins->flags = VKD3D_SHADER_CONDITIONAL_OP_Z; - src_param_init_const_uint(&ins->src[0], 0); + vsir_src_operand_init_const_u32(&ins->src[0], 0); vsir_program_iterator_next(it); return VKD3D_OK; @@ -8030,15 +8036,15 @@ static enum vkd3d_result insert_alpha_test_before_ret(struct vsir_program *progr { case VKD3D_SHADER_PARAMETER_DATA_TYPE_FLOAT32: vsir_instruction_init_with_params(program, ins, &loc, opcodes[compare_func].float_opcode, 1, 2); - src_param_init_temp_float(&ins->src[opcodes[compare_func].swap ? 1 : 0], colour_temp); - src_param_init_parameter(&ins->src[opcodes[compare_func].swap ? 0 : 1], + vsir_src_operand_init_temp_f32(&ins->src[opcodes[compare_func].swap ? 1 : 0], colour_temp); + vsir_src_operand_init_parameter(&ins->src[opcodes[compare_func].swap ? 0 : 1], VKD3D_SHADER_PARAMETER_NAME_ALPHA_TEST_REF, VSIR_DATA_F32); break; case VKD3D_SHADER_PARAMETER_DATA_TYPE_UINT32: vsir_instruction_init_with_params(program, ins, &loc, opcodes[compare_func].uint_opcode, 1, 2); - src_param_init_temp_uint(&ins->src[opcodes[compare_func].swap ? 1 : 0], colour_temp); - src_param_init_parameter(&ins->src[opcodes[compare_func].swap ? 0 : 1], + vsir_src_operand_init_temp_u32(&ins->src[opcodes[compare_func].swap ? 1 : 0], colour_temp); + vsir_src_operand_init_parameter(&ins->src[opcodes[compare_func].swap ? 0 : 1], VKD3D_SHADER_PARAMETER_NAME_ALPHA_TEST_REF, VSIR_DATA_U32); break; @@ -8059,7 +8065,7 @@ static enum vkd3d_result insert_alpha_test_before_ret(struct vsir_program *progr ins = vsir_program_iterator_next(it); vsir_instruction_init_with_params(program, ins, &loc, VSIR_OP_DISCARD, 0, 1); ins->flags = VKD3D_SHADER_CONDITIONAL_OP_Z; - src_param_init_ssa_bool(&ins->src[0], program->ssa_count); + vsir_src_operand_init_ssa_bool(&ins->src[0], program->ssa_count); ++program->ssa_count; @@ -8069,7 +8075,7 @@ static enum vkd3d_result insert_alpha_test_before_ret(struct vsir_program *progr ins->dst[0].reg.idx[0].offset = colour_signature_idx; ins->dst[0].reg.dimension = VSIR_DIMENSION_VEC4; ins->dst[0].write_mask = program->output_signature.elements[colour_signature_idx].mask; - src_param_init_temp_float(&ins->src[0], colour_temp); + vsir_src_operand_init_temp_f32(&ins->src[0], colour_temp); ins->src[0].reg.dimension = VSIR_DIMENSION_VEC4; ins->src[0].swizzle = VKD3D_SHADER_NO_SWIZZLE; @@ -8174,8 +8180,8 @@ static enum vkd3d_result insert_clip_planes_before_ret(struct vsir_program *prog continue; vsir_instruction_init_with_params(program, ins, &loc, VSIR_OP_DP4, 1, 2); - src_param_init_temp_float4(&ins->src[0], position_temp); - src_param_init_parameter(&ins->src[1], VKD3D_SHADER_PARAMETER_NAME_CLIP_PLANE_0 + i, VSIR_DATA_F32); + vsir_src_operand_init_temp_f32v4(&ins->src[0], position_temp); + vsir_src_operand_init_parameter(&ins->src[1], VKD3D_SHADER_PARAMETER_NAME_CLIP_PLANE_0 + i, VSIR_DATA_F32); ins->src[1].swizzle = VKD3D_SHADER_NO_SWIZZLE; ins->src[1].reg.dimension = VSIR_DIMENSION_VEC4; @@ -8196,7 +8202,7 @@ static enum vkd3d_result insert_clip_planes_before_ret(struct vsir_program *prog ins->dst[0].reg.idx[0].offset = position_signature_idx; ins->dst[0].reg.dimension = VSIR_DIMENSION_VEC4; ins->dst[0].write_mask = program->output_signature.elements[position_signature_idx].mask; - src_param_init_temp_float(&ins->src[0], position_temp); + vsir_src_operand_init_temp_f32(&ins->src[0], position_temp); ins->src[0].reg.dimension = VSIR_DIMENSION_VEC4; ins->src[0].swizzle = VKD3D_SHADER_NO_SWIZZLE; ins = vsir_program_iterator_next(it); @@ -8449,7 +8455,7 @@ static enum vkd3d_result sysval_array_normaliser_add_output_copy( struct sysval_array_normaliser *normaliser, struct vsir_program_iterator *it) { struct vsir_program *program = normaliser->ctx->program; - struct vkd3d_shader_src_param *outpointid_param = NULL; + struct vsir_src_operand *outpointid_param = NULL; unsigned int output_component_count = 0; struct vkd3d_shader_instruction *mov; struct signature_element *element; @@ -8476,7 +8482,7 @@ static enum vkd3d_result sysval_array_normaliser_add_output_copy( { for (unsigned int k = 0; k < VKD3D_VEC4_SIZE; ++k) { - struct vkd3d_shader_src_param *src; + struct vsir_src_operand *src; struct vsir_dst_operand *dst; if (!(normaliser->regs[q].mask & (1u << k))) @@ -8503,7 +8509,7 @@ static enum vkd3d_result sysval_array_normaliser_add_output_copy( } src = &mov->src[0]; - vsir_src_param_init(src, VKD3DSPR_IDXTEMP, VSIR_DATA_F32, 2); + vsir_src_operand_init(src, VKD3DSPR_IDXTEMP, VSIR_DATA_F32, 2); src->reg.idx[0].offset = normaliser->idxtemp_idx; src->reg.idx[1].offset = q; src->reg.dimension = VSIR_DIMENSION_VEC4; @@ -8576,7 +8582,7 @@ static enum vkd3d_result sysval_array_normaliser_add_input_copy( { for (unsigned int k = 0; k < VKD3D_VEC4_SIZE; ++k) { - struct vkd3d_shader_src_param *src; + struct vsir_src_operand *src; struct vsir_dst_operand *dst; if (!(normaliser->regs[q].mask & (1u << k))) @@ -8595,14 +8601,15 @@ static enum vkd3d_result sysval_array_normaliser_add_input_copy( src = &mov->src[0]; if (control_point_count) { - vsir_src_param_init(src, normaliser->output ? VKD3DSPR_OUTPUT : VKD3DSPR_INPUT, VSIR_DATA_F32, 3); + vsir_src_operand_init(src, normaliser->output ? VKD3DSPR_OUTPUT : VKD3DSPR_INPUT, + VSIR_DATA_F32, 3); src->reg.idx[0].offset = input_component_count++; src->reg.idx[1].offset = p; src->reg.idx[2].offset = normaliser->element_idx; } else { - vsir_src_param_init(src, VKD3DSPR_INPUT, VSIR_DATA_F32, 2); + vsir_src_operand_init(src, VKD3DSPR_INPUT, VSIR_DATA_F32, 2); src->reg.idx[0].offset = input_component_count++; src->reg.idx[1].offset = normaliser->element_idx; } @@ -8814,7 +8821,7 @@ static enum vkd3d_result sysval_array_normaliser_map_register(struct sysval_arra ssa_ins->dst[0].reg.dimension = VSIR_DIMENSION_VEC4; ssa_ins->dst[0].write_mask = VKD3DSP_WRITEMASK_0; ssa_ins->src[0] = *p_idx.rel_addr; - src_param_init_const_uint(&ssa_ins->src[1], normaliser->reg_count); + vsir_src_operand_init_const_u32(&ssa_ins->src[1], normaliser->reg_count); if (i_idx.rel_addr) { @@ -8834,7 +8841,7 @@ static enum vkd3d_result sysval_array_normaliser_map_register(struct sysval_arra vsir_program_iterator_next(it); reg->idx[1].offset = normaliser->reg_count * p_idx.offset + i_idx.offset + q; - if (!(reg->idx[1].rel_addr = vsir_program_get_src_params(program, 1))) + if (!(reg->idx[1].rel_addr = vsir_program_get_src_operands(program, 1))) return VKD3D_ERROR_OUT_OF_MEMORY; vsir_register_init(®->idx[1].rel_addr->reg, VKD3DSPR_SSA, VSIR_DATA_U32, 1); reg->idx[1].rel_addr->reg.idx[0].offset = program->ssa_count - 1; @@ -9077,7 +9084,7 @@ static enum vkd3d_result insert_point_size_before_ret(struct vsir_program *progr vsir_instruction_init_with_params(program, ins, &loc, VSIR_OP_MOV, 1, 1); vsir_dst_operand_init(&ins->dst[0], VKD3DSPR_RASTOUT, VSIR_DATA_F32, 1); ins->dst[0].reg.idx[0].offset = VSIR_RASTOUT_POINT_SIZE; - src_param_init_parameter(&ins->src[0], VKD3D_SHADER_PARAMETER_NAME_POINT_SIZE, VSIR_DATA_F32); + vsir_src_operand_init_parameter(&ins->src[0], VKD3D_SHADER_PARAMETER_NAME_POINT_SIZE, VSIR_DATA_F32); ins = vsir_program_iterator_next(it); return VKD3D_OK; @@ -9207,8 +9214,8 @@ static enum vkd3d_result vsir_program_insert_point_size_clamp(struct vsir_progra if (min_parameter) { vsir_instruction_init_with_params(program, ins, loc, VSIR_OP_MAX, 1, 2); - src_param_init_ssa_float(&ins->src[0], ssa_value); - src_param_init_parameter(&ins->src[1], VKD3D_SHADER_PARAMETER_NAME_POINT_SIZE_MIN, VSIR_DATA_F32); + vsir_src_operand_init_ssa_f32(&ins->src[0], ssa_value); + vsir_src_operand_init_parameter(&ins->src[1], VKD3D_SHADER_PARAMETER_NAME_POINT_SIZE_MIN, VSIR_DATA_F32); if (max_parameter) { vsir_dst_operand_init_ssa_f32(&ins->dst[0], program->ssa_count); @@ -9225,8 +9232,8 @@ static enum vkd3d_result vsir_program_insert_point_size_clamp(struct vsir_progra if (max_parameter) { vsir_instruction_init_with_params(program, ins, loc, VSIR_OP_MIN, 1, 2); - src_param_init_ssa_float(&ins->src[0], ssa_value); - src_param_init_parameter(&ins->src[1], VKD3D_SHADER_PARAMETER_NAME_POINT_SIZE_MAX, VSIR_DATA_F32); + vsir_src_operand_init_ssa_f32(&ins->src[0], ssa_value); + vsir_src_operand_init_parameter(&ins->src[1], VKD3D_SHADER_PARAMETER_NAME_POINT_SIZE_MAX, VSIR_DATA_F32); vsir_dst_operand_init(&ins->dst[0], VKD3DSPR_RASTOUT, VSIR_DATA_F32, 1); ins->dst[0].reg.idx[0].offset = VSIR_RASTOUT_POINT_SIZE; ins = vsir_program_iterator_next(&it); @@ -9248,7 +9255,7 @@ static bool has_texcoord_signature_element(const struct shader_signature *signat /* Returns true if replacement was done. */ static bool replace_texcoord_with_point_coord(struct vsir_program *program, - struct vkd3d_shader_src_param *src, unsigned int coord_temp) + struct vsir_src_operand *src, unsigned int coord_temp) { uint32_t prev_swizzle = src->swizzle; const struct signature_element *e; @@ -9401,7 +9408,7 @@ static enum vkd3d_result vsir_program_insert_point_coord(struct vsir_program *pr vsir_instruction_init_with_params(program, ins, &loc, VSIR_OP_MOV, 1, 1); vsir_dst_operand_init_temp_f32v4(&ins->dst[0], coord_temp); ins->dst[0].write_mask = VKD3DSP_WRITEMASK_0 | VKD3DSP_WRITEMASK_1; - vsir_src_param_init(&ins->src[0], VKD3DSPR_POINT_COORD, VSIR_DATA_F32, 0); + vsir_src_operand_init(&ins->src[0], VKD3DSPR_POINT_COORD, VSIR_DATA_F32, 0); ins->src[0].reg.dimension = VSIR_DIMENSION_VEC4; ins->src[0].swizzle = VKD3D_SHADER_NO_SWIZZLE; ins = vsir_program_iterator_next(&it); @@ -9409,7 +9416,7 @@ static enum vkd3d_result vsir_program_insert_point_coord(struct vsir_program *pr vsir_instruction_init_with_params(program, ins, &loc, VSIR_OP_MOV, 1, 1); vsir_dst_operand_init_temp_f32v4(&ins->dst[0], coord_temp); ins->dst[0].write_mask = VKD3DSP_WRITEMASK_2 | VKD3DSP_WRITEMASK_3; - vsir_src_param_init(&ins->src[0], VKD3DSPR_IMMCONST, VSIR_DATA_F32, 0); + vsir_src_operand_init(&ins->src[0], VKD3DSPR_IMMCONST, VSIR_DATA_F32, 0); ins->src[0].reg.dimension = VSIR_DIMENSION_VEC4; ins->src[0].swizzle = VKD3D_SHADER_NO_SWIZZLE; vsir_program_iterator_next(&it); @@ -9474,7 +9481,7 @@ static enum vkd3d_result insert_fragment_fog_before_ret(struct vsir_program *pro vsir_instruction_init_with_params(program, ins, &loc, VSIR_OP_NEG, 1, 1); vsir_dst_operand_init_ssa_f32(&ins->dst[0], ssa_temp); - vsir_src_param_init(&ins->src[0], VKD3DSPR_INPUT, VSIR_DATA_F32, 1); + vsir_src_operand_init(&ins->src[0], VKD3DSPR_INPUT, VSIR_DATA_F32, 1); ins->src[0].reg.idx[0].offset = fog_signature_idx; ins->src[0].reg.dimension = VSIR_DIMENSION_VEC4; ins->src[0].swizzle = VKD3D_SHADER_SWIZZLE(X, X, X, X); @@ -9482,14 +9489,14 @@ static enum vkd3d_result insert_fragment_fog_before_ret(struct vsir_program *pro vsir_instruction_init_with_params(program, ins, &loc, VSIR_OP_ADD, 1, 2); vsir_dst_operand_init_ssa_f32(&ins->dst[0], ssa_temp2); - src_param_init_parameter(&ins->src[0], VKD3D_SHADER_PARAMETER_NAME_FOG_END, VSIR_DATA_F32); - src_param_init_ssa_float(&ins->src[1], ssa_temp); + vsir_src_operand_init_parameter(&ins->src[0], VKD3D_SHADER_PARAMETER_NAME_FOG_END, VSIR_DATA_F32); + vsir_src_operand_init_ssa_f32(&ins->src[1], ssa_temp); ins = vsir_program_iterator_next(it); vsir_instruction_init_with_params(program, ins, &loc, VSIR_OP_MUL, 1, 2); vsir_dst_operand_init_ssa_f32(&ins->dst[0], ssa_factor); - src_param_init_ssa_float(&ins->src[0], ssa_temp2); - src_param_init_parameter(&ins->src[1], VKD3D_SHADER_PARAMETER_NAME_FOG_SCALE, VSIR_DATA_F32); + vsir_src_operand_init_ssa_f32(&ins->src[0], ssa_temp2); + vsir_src_operand_init_parameter(&ins->src[1], VKD3D_SHADER_PARAMETER_NAME_FOG_SCALE, VSIR_DATA_F32); ins = vsir_program_iterator_next(it); break; @@ -9509,8 +9516,8 @@ static enum vkd3d_result insert_fragment_fog_before_ret(struct vsir_program *pro vsir_instruction_init_with_params(program, ins, &loc, VSIR_OP_MUL, 1, 2); vsir_dst_operand_init_ssa_f32(&ins->dst[0], ssa_temp); - src_param_init_parameter(&ins->src[0], VKD3D_SHADER_PARAMETER_NAME_FOG_SCALE, VSIR_DATA_F32); - vsir_src_param_init(&ins->src[1], VKD3DSPR_INPUT, VSIR_DATA_F32, 1); + vsir_src_operand_init_parameter(&ins->src[0], VKD3D_SHADER_PARAMETER_NAME_FOG_SCALE, VSIR_DATA_F32); + vsir_src_operand_init(&ins->src[1], VKD3DSPR_INPUT, VSIR_DATA_F32, 1); ins->src[1].reg.idx[0].offset = fog_signature_idx; ins->src[1].reg.dimension = VSIR_DIMENSION_VEC4; ins->src[1].swizzle = VKD3D_SHADER_SWIZZLE(X, X, X, X); @@ -9518,12 +9525,12 @@ static enum vkd3d_result insert_fragment_fog_before_ret(struct vsir_program *pro vsir_instruction_init_with_params(program, ins, &loc, VSIR_OP_NEG, 1, 1); vsir_dst_operand_init_ssa_f32(&ins->dst[0], ssa_temp2); - src_param_init_ssa_float(&ins->src[0], ssa_temp); + vsir_src_operand_init_ssa_f32(&ins->src[0], ssa_temp); ins = vsir_program_iterator_next(it); vsir_instruction_init_with_params(program, ins, &loc, VSIR_OP_EXP, 1, 1); vsir_dst_operand_init_ssa_f32(&ins->dst[0], ssa_factor); - src_param_init_ssa_float(&ins->src[0], ssa_temp2); + vsir_src_operand_init_ssa_f32(&ins->src[0], ssa_temp2); ins = vsir_program_iterator_next(it); break; @@ -9544,8 +9551,8 @@ static enum vkd3d_result insert_fragment_fog_before_ret(struct vsir_program *pro vsir_instruction_init_with_params(program, ins, &loc, VSIR_OP_MUL, 1, 2); vsir_dst_operand_init_ssa_f32(&ins->dst[0], ssa_temp); - src_param_init_parameter(&ins->src[0], VKD3D_SHADER_PARAMETER_NAME_FOG_SCALE, VSIR_DATA_F32); - vsir_src_param_init(&ins->src[1], VKD3DSPR_INPUT, VSIR_DATA_F32, 1); + vsir_src_operand_init_parameter(&ins->src[0], VKD3D_SHADER_PARAMETER_NAME_FOG_SCALE, VSIR_DATA_F32); + vsir_src_operand_init(&ins->src[1], VKD3DSPR_INPUT, VSIR_DATA_F32, 1); ins->src[1].reg.idx[0].offset = fog_signature_idx; ins->src[1].reg.dimension = VSIR_DIMENSION_VEC4; ins->src[1].swizzle = VKD3D_SHADER_SWIZZLE(X, X, X, X); @@ -9553,18 +9560,18 @@ static enum vkd3d_result insert_fragment_fog_before_ret(struct vsir_program *pro vsir_instruction_init_with_params(program, ins, &loc, VSIR_OP_MUL, 1, 2); vsir_dst_operand_init_ssa_f32(&ins->dst[0], ssa_temp2); - src_param_init_ssa_float(&ins->src[0], ssa_temp); - src_param_init_ssa_float(&ins->src[1], ssa_temp); + vsir_src_operand_init_ssa_f32(&ins->src[0], ssa_temp); + vsir_src_operand_init_ssa_f32(&ins->src[1], ssa_temp); ins = vsir_program_iterator_next(it); vsir_instruction_init_with_params(program, ins, &loc, VSIR_OP_NEG, 1, 1); vsir_dst_operand_init_ssa_f32(&ins->dst[0], ssa_temp3); - src_param_init_ssa_float(&ins->src[0], ssa_temp2); + vsir_src_operand_init_ssa_f32(&ins->src[0], ssa_temp2); ins = vsir_program_iterator_next(it); vsir_instruction_init_with_params(program, ins, &loc, VSIR_OP_EXP, 1, 1); vsir_dst_operand_init_ssa_f32(&ins->dst[0], ssa_factor); - src_param_init_ssa_float(&ins->src[0], ssa_temp3); + vsir_src_operand_init_ssa_f32(&ins->src[0], ssa_temp3); ins = vsir_program_iterator_next(it); break; @@ -9585,26 +9592,26 @@ static enum vkd3d_result insert_fragment_fog_before_ret(struct vsir_program *pro vsir_instruction_init_with_params(program, ins, &loc, VSIR_OP_NEG, 1, 1); vsir_dst_operand_init_ssa_f32v4(&ins->dst[0], ssa_temp); - src_param_init_parameter_vec4(&ins->src[0], VKD3D_SHADER_PARAMETER_NAME_FOG_COLOUR, VSIR_DATA_F32); + vsir_src_operand_init_parameter_vec4(&ins->src[0], VKD3D_SHADER_PARAMETER_NAME_FOG_COLOUR, VSIR_DATA_F32); ins = vsir_program_iterator_next(it); vsir_instruction_init_with_params(program, ins, &loc, VSIR_OP_ADD, 1, 2); vsir_dst_operand_init_ssa_f32v4(&ins->dst[0], ssa_temp2); - src_param_init_temp_float4(&ins->src[0], colour_temp); - src_param_init_ssa_float4(&ins->src[1], ssa_temp); + vsir_src_operand_init_temp_f32v4(&ins->src[0], colour_temp); + vsir_src_operand_init_ssa_f32v4(&ins->src[1], ssa_temp); ins = vsir_program_iterator_next(it); vsir_instruction_init_with_params(program, ins, &loc, VSIR_OP_SATURATE, 1, 1); vsir_dst_operand_init_ssa_f32(&ins->dst[0], ssa_temp3); - src_param_init_ssa_float(&ins->src[0], ssa_factor); + vsir_src_operand_init_ssa_f32(&ins->src[0], ssa_factor); ins = vsir_program_iterator_next(it); vsir_instruction_init_with_params(program, ins, &loc, VSIR_OP_MAD, 1, 3); vsir_dst_operand_init_output(&ins->dst[0], VSIR_DATA_F32, colour_signature_idx, program->output_signature.elements[colour_signature_idx].mask); - src_param_init_ssa_float4(&ins->src[0], ssa_temp2); - src_param_init_ssa_float(&ins->src[1], ssa_temp3); - src_param_init_parameter_vec4(&ins->src[2], VKD3D_SHADER_PARAMETER_NAME_FOG_COLOUR, VSIR_DATA_F32); + vsir_src_operand_init_ssa_f32v4(&ins->src[0], ssa_temp2); + vsir_src_operand_init_ssa_f32(&ins->src[1], ssa_temp3); + vsir_src_operand_init_parameter_vec4(&ins->src[2], VKD3D_SHADER_PARAMETER_NAME_FOG_COLOUR, VSIR_DATA_F32); ins = vsir_program_iterator_next(it); return VKD3D_OK; @@ -9739,7 +9746,7 @@ static enum vkd3d_result insert_vertex_fog_before_ret(struct vsir_program *progr /* Write the fog output. */ vsir_instruction_init_with_params(program, ins, &loc, VSIR_OP_MOV, 1, 1); vsir_dst_operand_init_output(&ins->dst[0], VSIR_DATA_F32, fog_signature_idx, 0x1); - src_param_init_temp_float4(&ins->src[0], temp); + vsir_src_operand_init_temp_f32v4(&ins->src[0], temp); if (source == VKD3D_SHADER_FOG_SOURCE_Z) ins->src[0].swizzle = VKD3D_SHADER_SWIZZLE(Z, Z, Z, Z); else /* Position or specular W. */ @@ -9750,7 +9757,7 @@ static enum vkd3d_result insert_vertex_fog_before_ret(struct vsir_program *progr vsir_instruction_init_with_params(program, ins, &loc, VSIR_OP_MOV, 1, 1); vsir_dst_operand_init_output(&ins->dst[0], vsir_data_type_from_component_type(e->component_type), source_signature_idx, e->mask); - src_param_init_temp_float4(&ins->src[0], temp); + vsir_src_operand_init_temp_f32v4(&ins->src[0], temp); ins = vsir_program_iterator_next(it); return VKD3D_OK; @@ -10244,8 +10251,7 @@ struct liveness_tracker } *ssa_regs, *temp_regs; }; -static void liveness_track_src(struct liveness_tracker *tracker, - struct vkd3d_shader_src_param *src, unsigned int index) +static void liveness_track_src(struct liveness_tracker *tracker, struct vsir_src_operand *src, unsigned int index) { for (unsigned int k = 0; k < src->reg.idx_count; ++k) { @@ -10463,7 +10469,7 @@ struct temp_allocator bool ps_1_x; }; -static void temp_allocator_set_src(struct temp_allocator *allocator, struct vkd3d_shader_src_param *src) +static void temp_allocator_set_src(struct temp_allocator *allocator, struct vsir_src_operand *src) { struct temp_allocator_reg *reg; @@ -10509,7 +10515,7 @@ static uint32_t vsir_map_swizzle(uint32_t swizzle, unsigned int writemask) return ret; } -static void vsir_remap_immconst(struct vkd3d_shader_src_param *src, unsigned int writemask) +static void vsir_remap_immconst(struct vsir_src_operand *src, unsigned int writemask) { union vsir_immediate_constant prev = src->reg.u; unsigned int src_component = 0; @@ -10521,7 +10527,7 @@ static void vsir_remap_immconst(struct vkd3d_shader_src_param *src, unsigned int } } -static void vsir_remap_immconst64(struct vkd3d_shader_src_param *src, unsigned int writemask) +static void vsir_remap_immconst64(struct vsir_src_operand *src, unsigned int writemask) { if (writemask == (VKD3DSP_WRITEMASK_2 | VKD3DSP_WRITEMASK_3)) src->reg.u.immconst_u64[1] = src->reg.u.immconst_u64[0]; @@ -10600,7 +10606,7 @@ static void temp_allocator_set_dst(struct temp_allocator *allocator, for (unsigned int i = 0; i < ins->src_count; ++i) { - struct vkd3d_shader_src_param *src = &ins->src[i]; + struct vsir_src_operand *src = &ins->src[i]; if (vsir_src_is_masked(ins->opcode, i)) { @@ -11757,8 +11763,7 @@ static void vsir_validate_ssa_register(struct validation_context *ctx, } } -static void vsir_validate_src_param(struct validation_context *ctx, - const struct vkd3d_shader_src_param *src); +static void vsir_validate_src_operand(struct validation_context *ctx, const struct vsir_src_operand *src); static void vsir_validate_register(struct validation_context *ctx, const struct vkd3d_shader_register *reg) @@ -11811,12 +11816,13 @@ static void vsir_validate_register(struct validation_context *ctx, for (i = 0; i < min(reg->idx_count, ARRAY_SIZE(reg->idx)); ++i) { - const struct vkd3d_shader_src_param *param = reg->idx[i].rel_addr; - if (param) - { - vsir_validate_src_param(ctx, param); + const struct vsir_src_operand *src; - switch (param->reg.type) + if ((src = reg->idx[i].rel_addr)) + { + vsir_validate_src_operand(ctx, src); + + switch (src->reg.type) { case VKD3DSPR_TEMP: case VKD3DSPR_SSA: @@ -11828,7 +11834,7 @@ static void vsir_validate_register(struct validation_context *ctx, default: validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_REGISTER_TYPE, "Invalid register type %#x for a relative address parameter.", - param->reg.type); + src->reg.type); break; } } @@ -12127,8 +12133,7 @@ static void vsir_validate_dst_operand(struct validation_context *ctx, const stru } } -static void vsir_validate_io_src_param(struct validation_context *ctx, - const struct vkd3d_shader_src_param *src) +static void vsir_validate_io_src_operand(struct validation_context *ctx, const struct vsir_src_operand *src) { struct vsir_io_register_data io_reg_data; @@ -12147,8 +12152,7 @@ static void vsir_validate_io_src_param(struct validation_context *ctx, #define U32_BIT (1u << VSIR_DATA_U32) #define U16_BIT (1u << VSIR_DATA_U16) -static void vsir_validate_src_param(struct validation_context *ctx, - const struct vkd3d_shader_src_param *src) +static void vsir_validate_src_operand(struct validation_context *ctx, const struct vsir_src_operand *src) { static const struct { @@ -12229,23 +12233,23 @@ static void vsir_validate_src_param(struct validation_context *ctx, break; case VKD3DSPR_INPUT: - vsir_validate_io_src_param(ctx, src); + vsir_validate_io_src_operand(ctx, src); break; case VKD3DSPR_OUTPUT: - vsir_validate_io_src_param(ctx, src); + vsir_validate_io_src_operand(ctx, src); break; case VKD3DSPR_INCONTROLPOINT: - vsir_validate_io_src_param(ctx, src); + vsir_validate_io_src_operand(ctx, src); break; case VKD3DSPR_OUTCONTROLPOINT: - vsir_validate_io_src_param(ctx, src); + vsir_validate_io_src_operand(ctx, src); break; case VKD3DSPR_PATCHCONST: - vsir_validate_io_src_param(ctx, src); + vsir_validate_io_src_operand(ctx, src); break; default: @@ -14100,7 +14104,9 @@ static void vsir_validate_instruction(struct validation_context *ctx, } for (i = 0; i < instruction->src_count; ++i) - vsir_validate_src_param(ctx, &instruction->src[i]); + { + vsir_validate_src_operand(ctx, &instruction->src[i]); + } if (instruction->opcode >= VSIR_OP_INVALID) { @@ -14925,9 +14931,9 @@ static enum vkd3d_result vsir_program_copy_propagation(struct vsir_program *prog { for (unsigned int j = 0; j < ins->src_count; ++j) { - struct vkd3d_shader_src_param *src = &ins->src[j]; - const struct vkd3d_shader_src_param *mov_src; + struct vsir_src_operand *src = &ins->src[j]; const struct vkd3d_shader_instruction *mov; + const struct vsir_src_operand *mov_src; enum vsir_data_type data_type; uint32_t new_swizzle = 0; diff --git a/libs/vkd3d-shader/msl.c b/libs/vkd3d-shader/msl.c index 4ba60b14f..204987175 100644 --- a/libs/vkd3d-shader/msl.c +++ b/libs/vkd3d-shader/msl.c @@ -71,7 +71,7 @@ struct msl_resource_type_info }; static void msl_print_subscript(struct vkd3d_string_buffer *buffer, struct msl_generator *gen, - const struct vkd3d_shader_src_param *rel_addr, unsigned int offset); + const struct vsir_src_operand *rel_addr, unsigned int offset); static void VKD3D_PRINTF_FUNC(3, 4) msl_compiler_error(struct msl_generator *gen, enum vkd3d_shader_error error, const char *fmt, ...) @@ -554,7 +554,7 @@ static void msl_print_bitcast(struct vkd3d_string_buffer *dst, struct msl_genera } static void msl_print_src_with_type(struct vkd3d_string_buffer *buffer, struct msl_generator *gen, - const struct vkd3d_shader_src_param *vsir_src, uint32_t mask, enum vsir_data_type data_type) + const struct vsir_src_operand *vsir_src, uint32_t mask, enum vsir_data_type data_type) { const struct vkd3d_shader_register *reg = &vsir_src->reg; struct vkd3d_string_buffer *register_name; @@ -573,7 +573,7 @@ static void msl_print_src_with_type(struct vkd3d_string_buffer *buffer, struct m } static void msl_src_init(struct msl_src *msl_src, struct msl_generator *gen, - const struct vkd3d_shader_src_param *vsir_src, uint32_t mask) + const struct vsir_src_operand *vsir_src, uint32_t mask) { msl_src->str = vkd3d_string_buffer_get(&gen->string_buffers); msl_print_src_with_type(msl_src->str, gen, vsir_src, mask, vsir_src->reg.data_type); @@ -612,7 +612,7 @@ static uint32_t msl_dst_init(struct msl_dst *msl_dst, struct msl_generator *gen, } static void msl_print_subscript(struct vkd3d_string_buffer *buffer, struct msl_generator *gen, - const struct vkd3d_shader_src_param *rel_addr, unsigned int offset) + const struct vsir_src_operand *rel_addr, unsigned int offset) { struct msl_src r; @@ -803,7 +803,7 @@ static void msl_begin_block(struct msl_generator *gen) } static void msl_print_condition(struct vkd3d_string_buffer *buffer, struct msl_generator *gen, - enum vkd3d_shader_conditional_op op, const struct vkd3d_shader_src_param *arg) + enum vkd3d_shader_conditional_op op, const struct vsir_src_operand *arg) { const char *condition; struct msl_src src; @@ -1028,9 +1028,9 @@ static void msl_sample(struct msl_generator *gen, const struct vkd3d_shader_inst { bool bias, compare, comparison_sampler, dynamic_offset, gather, grad, lod, lod_zero, offset; const struct msl_resource_type_info *resource_type_info; - const struct vkd3d_shader_src_param *resource, *sampler; unsigned int resource_id, resource_idx, resource_space; unsigned int sampler_id, sampler_idx, sampler_space; + const struct vsir_src_operand *resource, *sampler; unsigned int srv_binding = 0, sampler_binding = 0; const struct vkd3d_shader_descriptor_info1 *d; enum vkd3d_shader_resource_type resource_type; diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 036dea0e6..b9debc0b9 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -4106,7 +4106,7 @@ static uint32_t spirv_compiler_emit_construct_vector(struct spirv_compiler *comp } static uint32_t spirv_compiler_emit_load_src(struct spirv_compiler *compiler, - const struct vkd3d_shader_src_param *src, uint32_t write_mask); + const struct vsir_src_operand *src, uint32_t write_mask); static uint32_t spirv_compiler_emit_register_addressing(struct spirv_compiler *compiler, const struct vkd3d_shader_register_index *reg_index) @@ -4816,19 +4816,19 @@ static void spirv_compiler_emit_execution_mode1(struct spirv_compiler *compiler, } static uint32_t spirv_compiler_emit_load_src(struct spirv_compiler *compiler, - const struct vkd3d_shader_src_param *src, uint32_t write_mask) + const struct vsir_src_operand *src, uint32_t write_mask) { return spirv_compiler_emit_load_reg(compiler, &src->reg, src->swizzle, write_mask); } static uint32_t spirv_compiler_emit_load_src_with_type(struct spirv_compiler *compiler, - const struct vkd3d_shader_src_param *src, uint32_t write_mask, enum vsir_data_type data_type) + const struct vsir_src_operand *src, uint32_t write_mask, enum vsir_data_type data_type) { - struct vkd3d_shader_src_param src_param = *src; + struct vsir_src_operand src_operand = *src; - src_param.reg.data_type = data_type; + src_operand.reg.data_type = data_type; - return spirv_compiler_emit_load_src(compiler, &src_param, write_mask); + return spirv_compiler_emit_load_src(compiler, &src_operand, write_mask); } static void spirv_compiler_emit_store_scalar(struct spirv_compiler *compiler, @@ -7331,7 +7331,7 @@ static SpvOp spirv_compiler_map_logical_instruction(const struct vkd3d_shader_in static void spirv_compiler_emit_bool_cast(struct spirv_compiler *compiler, const struct vkd3d_shader_instruction *instruction) { - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; uint32_t val_id; @@ -7370,7 +7370,7 @@ static enum vkd3d_result spirv_compiler_emit_alu_instruction(struct spirv_compil const struct vkd3d_shader_instruction *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; uint32_t src_ids[SPIRV_MAX_SRC_COUNT]; uint32_t type_id, val_id; @@ -7450,7 +7450,7 @@ static enum vkd3d_result spirv_compiler_emit_alu_instruction(struct spirv_compil static void spirv_compiler_emit_saturate(struct spirv_compiler *compiler, const struct vkd3d_shader_instruction *instruction) { - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; uint32_t val_id; @@ -7463,7 +7463,7 @@ static void spirv_compiler_emit_isfinite(struct spirv_compiler *compiler, const struct vkd3d_shader_instruction *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; uint32_t type_id, src_id, isinf_id, isnan_id, val_id; @@ -7535,7 +7535,7 @@ static void spirv_compiler_emit_ext_glsl_instruction(struct spirv_compiler *comp { uint32_t instr_set_id, type_id, val_id, rev_val_id, uint_max_id, condition_id; struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; uint32_t src_id[SPIRV_MAX_SRC_COUNT]; unsigned int i, component_count; @@ -7595,7 +7595,7 @@ static void spirv_compiler_emit_mov(struct spirv_compiler *compiler, uint32_t val_id, dst_val_id, type_id, dst_id, src_id, write_mask32, swizzle32; struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; struct vkd3d_shader_register_info dst_reg_info, src_reg_info; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; unsigned int i, component_count, write_mask; uint32_t components[VKD3D_VEC4_SIZE]; @@ -7669,8 +7669,8 @@ static void spirv_compiler_emit_movc(struct spirv_compiler *compiler, const struct vkd3d_shader_instruction *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; uint32_t condition_id, src1_id, src2_id, type_id, val_id; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; unsigned int component_count; @@ -7700,8 +7700,8 @@ static void spirv_compiler_emit_swapc(struct spirv_compiler *compiler, const struct vkd3d_shader_instruction *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; uint32_t condition_id, src1_id, src2_id, type_id, val_id; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; unsigned int component_count; @@ -7727,7 +7727,7 @@ static void spirv_compiler_emit_dot(struct spirv_compiler *compiler, const struct vkd3d_shader_instruction *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; uint32_t type_id, val_id, src_ids[2]; unsigned int component_count, i; @@ -7764,7 +7764,7 @@ static void spirv_compiler_emit_rcp(struct spirv_compiler *compiler, const struct vkd3d_shader_instruction *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; uint32_t type_id, src_id, val_id, div_id; unsigned int component_count; @@ -7785,7 +7785,7 @@ static void spirv_compiler_emit_imad(struct spirv_compiler *compiler, const struct vkd3d_shader_instruction *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; uint32_t type_id, val_id, src_ids[3]; unsigned int i, component_count; @@ -7807,7 +7807,7 @@ static void spirv_compiler_emit_ftoi(struct spirv_compiler *compiler, { uint32_t src_id, int_min_id, int_max_id, zero_id, float_max_id, condition_id, val_id; struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; uint32_t src_type_id, dst_type_id, condition_type_id; unsigned int component_count; @@ -7862,7 +7862,7 @@ static void spirv_compiler_emit_ftou(struct spirv_compiler *compiler, { uint32_t src_id, zero_id, uint_max_id, float_max_id, condition_id, val_id; struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; uint32_t src_type_id, dst_type_id, condition_type_id; unsigned int component_count; @@ -7910,7 +7910,7 @@ static void spirv_compiler_emit_dtof(struct spirv_compiler *compiler, const struct vkd3d_shader_instruction *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; uint32_t type_id, val_id, src_id; unsigned int component_count; @@ -7934,7 +7934,7 @@ static void spirv_compiler_emit_bitfield_instruction(struct spirv_compiler *comp { uint32_t src_ids[4], constituents[VKD3D_VEC4_SIZE], type_id, mask_id, size_id, max_count_id; struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; unsigned int i, j, k, src_count, size; enum vsir_data_type data_type; @@ -7995,7 +7995,7 @@ static void spirv_compiler_emit_f16tof32(struct spirv_compiler *compiler, { uint32_t instr_set_id, type_id, scalar_type_id, src_id, result_id; struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; uint32_t components[VKD3D_VEC4_SIZE]; uint32_t write_mask; @@ -8027,7 +8027,7 @@ static void spirv_compiler_emit_f32tof16(struct spirv_compiler *compiler, { uint32_t instr_set_id, type_id, scalar_type_id, src_id, zero_id, constituents[2]; struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; uint32_t components[VKD3D_VEC4_SIZE]; uint32_t write_mask; @@ -8061,7 +8061,7 @@ static void spirv_compiler_emit_comparison_instruction(struct spirv_compiler *co const struct vkd3d_shader_instruction *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; uint32_t src0_id, src1_id, type_id, result_id; uint32_t write_mask = dst->write_mask; @@ -8126,7 +8126,7 @@ static void spirv_compiler_emit_orderedness_instruction(struct spirv_compiler *c const struct vkd3d_shader_instruction *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; uint32_t type_id, src0_id, src1_id, val_id; @@ -8146,7 +8146,7 @@ static void spirv_compiler_emit_float_comparison_instruction(struct spirv_compil const struct vkd3d_shader_instruction *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; uint32_t src0_id, src1_id, type_id, result_id; unsigned int component_count; @@ -8176,7 +8176,7 @@ static uint32_t spirv_compiler_emit_conditional_branch(struct spirv_compiler *co const struct vkd3d_shader_instruction *instruction, uint32_t target_block_id) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; uint32_t condition_id, merge_block_id; condition_id = spirv_compiler_emit_load_src(compiler, src, VKD3DSP_WRITEMASK_0); @@ -8291,7 +8291,7 @@ static void spirv_compiler_emit_discard(struct spirv_compiler *compiler, const struct vkd3d_shader_instruction *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; uint32_t condition_id, void_id; /* discard is not a block terminator in VSIR, and emitting it as such in SPIR-V would cause @@ -8322,7 +8322,7 @@ static void spirv_compiler_emit_label(struct spirv_compiler *compiler, const struct vkd3d_shader_instruction *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; unsigned int block_id = src->reg.idx[0].offset; uint32_t label_id; @@ -8360,7 +8360,7 @@ static void spirv_compiler_emit_branch(struct spirv_compiler *compiler, const struct vkd3d_shader_instruction *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; uint32_t condition_id; if (vsir_register_is_label(&src[0].reg)) @@ -8403,7 +8403,7 @@ static void spirv_compiler_emit_switch(struct spirv_compiler *compiler, const struct vkd3d_shader_instruction *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; uint32_t val_id, default_id; unsigned int i, word_count; uint32_t *cases; @@ -8444,7 +8444,7 @@ static void spirv_compiler_emit_deriv_instruction(struct spirv_compiler *compile const struct vkd3d_shader_instruction *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; const struct instruction_info *info; uint32_t type_id, src_id, val_id; @@ -8678,7 +8678,7 @@ static void spirv_compiler_emit_ld(struct spirv_compiler *compiler, const struct vkd3d_shader_instruction *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; uint32_t type_id, coordinate_id, val_id; SpvImageOperandsMask operands_mask = 0; @@ -8724,9 +8724,9 @@ static void spirv_compiler_emit_lod(struct spirv_compiler *compiler, const struct vkd3d_shader_instruction *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; - const struct vkd3d_shader_src_param *resource, *sampler; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; + const struct vsir_src_operand *resource, *sampler; uint32_t type_id, coordinate_id, val_id; struct vkd3d_shader_image image; @@ -8749,10 +8749,10 @@ static void spirv_compiler_emit_sample(struct spirv_compiler *compiler, const struct vkd3d_shader_instruction *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; - const struct vkd3d_shader_src_param *resource, *sampler; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; unsigned int image_operand_count = 0, component_count; + const struct vsir_src_operand *resource, *sampler; uint32_t sampled_type_id, coordinate_id, val_id; SpvImageOperandsMask operands_mask = 0; struct vkd3d_shader_image image; @@ -8819,8 +8819,8 @@ static void spirv_compiler_emit_sample_c(struct spirv_compiler *compiler, const struct vkd3d_shader_instruction *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; uint32_t sampled_type_id, coordinate_id, dref_id, val_id; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; SpvImageOperandsMask operands_mask = 0; unsigned int image_operand_count = 0; @@ -8863,10 +8863,10 @@ static void spirv_compiler_emit_sample_c(struct spirv_compiler *compiler, static void spirv_compiler_emit_gather4(struct spirv_compiler *compiler, const struct vkd3d_shader_instruction *instruction) { - const struct vkd3d_shader_src_param *addr, *offset, *resource, *sampler; uint32_t sampled_type_id, coordinate_id, component_id, dref_id, val_id; + const struct vsir_src_operand *addr, *offset, *resource, *sampler; struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; unsigned int image_flags = VKD3D_IMAGE_FLAG_SAMPLED; unsigned int component_count, component_idx; @@ -8934,11 +8934,11 @@ static void spirv_compiler_emit_gather4(struct spirv_compiler *compiler, static uint32_t spirv_compiler_emit_raw_structured_addressing( struct spirv_compiler *compiler, uint32_t type_id, unsigned int stride, - const struct vkd3d_shader_src_param *src0, uint32_t src0_mask, - const struct vkd3d_shader_src_param *src1, uint32_t src1_mask) + const struct vsir_src_operand *src0, uint32_t src0_mask, + const struct vsir_src_operand *src1, uint32_t src1_mask) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *offset; + const struct vsir_src_operand *offset; uint32_t structure_id = 0, offset_id; uint32_t offset_write_mask; @@ -8966,11 +8966,11 @@ static void spirv_compiler_emit_ld_raw_structured_srv_uav(struct spirv_compiler { uint32_t coordinate_id, type_id, val_id, texel_type_id, ptr_type_id, ptr_id; struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; - const struct vkd3d_shader_src_param *resource; const struct vkd3d_symbol *resource_symbol; uint32_t base_coordinate_id, component_idx; + const struct vsir_src_operand *resource; uint32_t constituents[VKD3D_VEC4_SIZE]; struct vkd3d_shader_image image; bool storage_buffer_uav = false; @@ -9053,12 +9053,12 @@ static void spirv_compiler_emit_ld_tgsm(struct spirv_compiler *compiler, const struct vkd3d_shader_instruction *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; uint32_t coordinate_id, type_id, ptr_type_id, ptr_id; - const struct vkd3d_shader_src_param *resource; struct vkd3d_shader_register_info reg_info; uint32_t base_coordinate_id, component_idx; + const struct vsir_src_operand *resource; uint32_t constituents[VKD3D_VEC4_SIZE]; unsigned int i, j; @@ -9112,11 +9112,11 @@ static void spirv_compiler_emit_store_uav_raw_structured(struct spirv_compiler * { uint32_t coordinate_id, type_id, val_id, data_id, ptr_type_id, ptr_id; struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; const struct vkd3d_symbol *resource_symbol; uint32_t base_coordinate_id, component_idx; - const struct vkd3d_shader_src_param *data; + const struct vsir_src_operand *data; struct vkd3d_shader_image image; unsigned int component_count; uint32_t indices[2]; @@ -9189,11 +9189,11 @@ static void spirv_compiler_emit_store_tgsm(struct spirv_compiler *compiler, { uint32_t coordinate_id, type_id, val_id, ptr_type_id, ptr_id, data_id; struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; uint32_t base_coordinate_id, component_idx; struct vkd3d_shader_register_info reg_info; - struct vkd3d_shader_src_param data; + struct vsir_src_operand data; unsigned int component_count; if (!spirv_compiler_get_register_info(compiler, &dst->reg, ®_info)) @@ -9246,7 +9246,7 @@ static void spirv_compiler_emit_ld_uav_typed(struct spirv_compiler *compiler, { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; uint32_t coordinate_id, type_id, val_id, ptr_type_id, ptr_id; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; const struct vkd3d_symbol *resource_symbol; struct vkd3d_shader_image image; @@ -9288,7 +9288,7 @@ static void spirv_compiler_emit_store_uav_typed(struct spirv_compiler *compiler, { uint32_t coordinate_id, texel_id, type_id, val_id, ptr_type_id, ptr_id; struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; const struct vkd3d_symbol *resource_symbol; struct vkd3d_shader_image image; @@ -9328,8 +9328,8 @@ static void spirv_compiler_emit_uav_counter_instruction(struct spirv_compiler *c const struct vkd3d_shader_instruction *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; unsigned int memory_semantics = SpvMemorySemanticsMaskNone; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; uint32_t ptr_type_id, type_id, counter_id, result_id; uint32_t coordinate_id, sample_id, pointer_id; @@ -9448,7 +9448,7 @@ static void spirv_compiler_emit_atomic_instruction(struct spirv_compiler *compil const struct vkd3d_shader_instruction *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; const struct vkd3d_symbol *resource_symbol = NULL; uint32_t ptr_type_id, type_id, val_id, result_id; @@ -9576,7 +9576,7 @@ static void spirv_compiler_emit_bufinfo(struct spirv_compiler *compiler, const struct vkd3d_shader_instruction *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; const struct vkd3d_symbol *resource_symbol; uint32_t type_id, val_id, stride_id; @@ -9628,7 +9628,7 @@ static void spirv_compiler_emit_resinfo(struct spirv_compiler *compiler, const struct vkd3d_shader_instruction *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; uint32_t type_id, lod_id, val_id, miplevel_count_id; enum vsir_data_type data_type = VSIR_DATA_U32; @@ -9686,7 +9686,7 @@ static void spirv_compiler_emit_resinfo(struct spirv_compiler *compiler, } static uint32_t spirv_compiler_emit_query_sample_count(struct spirv_compiler *compiler, - const struct vkd3d_shader_src_param *src) + const struct vsir_src_operand *src) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; struct vkd3d_shader_image image; @@ -9713,7 +9713,7 @@ static void spirv_compiler_emit_sample_info(struct spirv_compiler *compiler, const struct vkd3d_shader_instruction *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; enum vsir_data_type data_type = VSIR_DATA_U32; uint32_t constituents[VKD3D_VEC4_SIZE]; @@ -9848,15 +9848,14 @@ static void spirv_compiler_emit_eval_attrib(struct spirv_compiler *compiler, const struct vkd3d_shader_instruction *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; - const struct vkd3d_shader_register *input = &src[0].reg; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; uint32_t instr_set_id, type_id, val_id, src_ids[2]; struct vkd3d_shader_register_info register_info; unsigned int src_count = 0; enum GLSLstd450 op; - if (!spirv_compiler_get_register_info(compiler, input, ®ister_info)) + if (!spirv_compiler_get_register_info(compiler, &src[0].reg, ®ister_info)) return; if (register_info.storage_class != SpvStorageClassInput) @@ -10011,8 +10010,8 @@ static void spirv_compiler_emit_quad_read_across(struct spirv_compiler *compiler const struct vkd3d_shader_instruction *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; uint32_t type_id, direction_type_id, direction_id, val_id; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; type_id = spirv_get_type_id(compiler, dst->reg.data_type, vsir_write_mask_component_count(dst->write_mask)); @@ -10029,7 +10028,7 @@ static void spirv_compiler_emit_quad_read_lane_at(struct spirv_compiler *compile const struct vkd3d_shader_instruction *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; uint32_t type_id, val_id, lane_id; @@ -10067,7 +10066,7 @@ static void spirv_compiler_emit_wave_bool_op(struct spirv_compiler *compiler, const struct vkd3d_shader_instruction *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; uint32_t type_id, val_id; SpvOp op; @@ -10084,7 +10083,7 @@ static void spirv_compiler_emit_wave_bool_op(struct spirv_compiler *compiler, } static uint32_t spirv_compiler_emit_group_nonuniform_ballot(struct spirv_compiler *compiler, - const struct vkd3d_shader_src_param *src) + const struct vsir_src_operand *src) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; uint32_t type_id, val_id; @@ -10141,7 +10140,7 @@ static void spirv_compiler_emit_wave_alu_op(struct spirv_compiler *compiler, const struct vkd3d_shader_instruction *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; uint32_t type_id, val_id; SpvOp op; @@ -10193,7 +10192,7 @@ static void spirv_compiler_emit_wave_read_lane_at(struct spirv_compiler *compile const struct vkd3d_shader_instruction *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; uint32_t type_id, lane_id, val_id; @@ -10220,7 +10219,7 @@ static void spirv_compiler_emit_wave_read_lane_first(struct spirv_compiler *comp const struct vkd3d_shader_instruction *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; + const struct vsir_src_operand *src = instruction->src; const struct vsir_dst_operand *dst = instruction->dst; uint32_t type_id, val_id; diff --git a/libs/vkd3d-shader/tpf.c b/libs/vkd3d-shader/tpf.c index 8af5b1d20..97b9ea0fd 100644 --- a/libs/vkd3d-shader/tpf.c +++ b/libs/vkd3d-shader/tpf.c @@ -771,8 +771,8 @@ static bool shader_is_sm_5_1(const struct vkd3d_shader_sm4_parser *sm4) return version->major >= 5 && version->minor >= 1; } -static bool shader_sm4_read_src_param(struct vkd3d_shader_sm4_parser *priv, const uint32_t **ptr, - const uint32_t *end, enum vsir_data_type data_type, struct vkd3d_shader_src_param *src_param); +static bool tpf_read_src_operand(struct vkd3d_shader_sm4_parser *tpf, const uint32_t **ptr, + const uint32_t *end, enum vsir_data_type data_type, struct vsir_src_operand *src); static bool tpf_read_dst_operand(struct vkd3d_shader_sm4_parser *tpf, const uint32_t **ptr, const uint32_t *end, enum vsir_data_type data_type, struct vsir_dst_operand *dst); @@ -795,23 +795,20 @@ static bool shader_sm4_read_register_space(struct vkd3d_shader_sm4_parser *priv, } static void shader_sm4_read_conditional_op(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) + uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *tpf) { - shader_sm4_read_src_param(priv, &tokens, &tokens[token_count], VSIR_DATA_U32, &ins->src[0]); + tpf_read_src_operand(tpf, &tokens, &tokens[token_count], VSIR_DATA_U32, &ins->src[0]); ins->flags = (opcode_token & VKD3D_SM4_CONDITIONAL_NZ) ? VKD3D_SHADER_CONDITIONAL_OP_NZ : VKD3D_SHADER_CONDITIONAL_OP_Z; } static void shader_sm4_read_case_condition(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) + uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *tpf) { - shader_sm4_read_src_param(priv, &tokens, &tokens[token_count], VSIR_DATA_U32, &ins->src[0]); + tpf_read_src_operand(tpf, &tokens, &tokens[token_count], VSIR_DATA_U32, &ins->src[0]); if (ins->src[0].reg.type != VKD3DSPR_IMMCONST) - { - FIXME("Switch case value is not a 32-bit constant.\n"); - vkd3d_shader_parser_error(&priv->p, VKD3D_SHADER_ERROR_TPF_INVALID_CASE_VALUE, + vkd3d_shader_parser_error(&tpf->p, VKD3D_SHADER_ERROR_TPF_INVALID_CASE_VALUE, "Switch case value is not a 32-bit immediate constant register."); - } } static void shader_sm4_read_shader_data(struct vkd3d_shader_instruction *ins, uint32_t opcode, uint32_t opcode_token, @@ -924,19 +921,19 @@ static void shader_sm4_read_dcl_resource(struct vkd3d_shader_instruction *ins, u } static void shader_sm4_read_dcl_constant_buffer(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) + uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *tpf) { const uint32_t *end = &tokens[token_count]; - shader_sm4_read_src_param(priv, &tokens, end, VSIR_DATA_F32, &ins->declaration.cb.src); - shader_sm4_set_descriptor_register_range(priv, &ins->declaration.cb.src.reg, &ins->declaration.cb.range); + tpf_read_src_operand(tpf, &tokens, end, VSIR_DATA_F32, &ins->declaration.cb.src); + shader_sm4_set_descriptor_register_range(tpf, &ins->declaration.cb.src.reg, &ins->declaration.cb.range); if (opcode_token & VKD3D_SM4_INDEX_TYPE_MASK) ins->flags |= VKD3DSI_INDEXED_DYNAMIC; ins->declaration.cb.size = ins->declaration.cb.src.reg.idx[2].offset; ins->declaration.cb.range.space = 0; - if (shader_is_sm_5_1(priv)) + if (shader_is_sm_5_1(tpf)) { if (tokens >= end) { @@ -945,23 +942,23 @@ static void shader_sm4_read_dcl_constant_buffer(struct vkd3d_shader_instruction } ins->declaration.cb.size = *tokens++; - shader_sm4_read_register_space(priv, &tokens, end, &ins->declaration.cb.range.space); + shader_sm4_read_register_space(tpf, &tokens, end, &ins->declaration.cb.range.space); } ins->declaration.cb.size *= VKD3D_VEC4_SIZE * sizeof(float); } static void shader_sm4_read_dcl_sampler(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 *tpf) { const uint32_t *end = &tokens[token_count]; ins->flags = (opcode_token & VKD3D_SM4_SAMPLER_MODE_MASK) >> VKD3D_SM4_SAMPLER_MODE_SHIFT; if (ins->flags & ~VKD3D_SM4_SAMPLER_COMPARISON) FIXME("Unhandled sampler mode %#x.\n", ins->flags); - shader_sm4_read_src_param(priv, &tokens, end, VSIR_DATA_UNUSED, &ins->declaration.sampler.src); - shader_sm4_set_descriptor_register_range(priv, &ins->declaration.sampler.src.reg, &ins->declaration.sampler.range); - shader_sm4_read_register_space(priv, &tokens, end, &ins->declaration.sampler.range.space); + tpf_read_src_operand(tpf, &tokens, end, VSIR_DATA_UNUSED, &ins->declaration.sampler.src); + shader_sm4_set_descriptor_register_range(tpf, &ins->declaration.sampler.src.reg, &ins->declaration.sampler.range); + shader_sm4_read_register_space(tpf, &tokens, end, &ins->declaration.sampler.range.space); } static void shader_sm4_read_dcl_index_range(struct vkd3d_shader_instruction *ins, uint32_t opcode, @@ -1207,10 +1204,10 @@ static void shader_sm4_read_dcl_global_flags(struct vkd3d_shader_instruction *in } static void shader_sm5_read_fcall(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 *tpf) { ins->src[0].reg.u.fp_body_idx = *tokens++; - shader_sm4_read_src_param(priv, &tokens, &tokens[token_count], VSIR_DATA_OPAQUE, &ins->src[0]); + tpf_read_src_operand(tpf, &tokens, &tokens[token_count], VSIR_DATA_OPAQUE, &ins->src[0]); } static void shader_sm5_read_dcl_function_body(struct vkd3d_shader_instruction *ins, uint32_t opcode, @@ -1986,12 +1983,12 @@ static enum vsir_data_type map_data_type(char t) } } -static bool shader_sm4_read_reg_idx(struct vkd3d_shader_sm4_parser *priv, const uint32_t **ptr, +static bool shader_sm4_read_reg_idx(struct vkd3d_shader_sm4_parser *tpf, const uint32_t **ptr, const uint32_t *end, uint32_t addressing, struct vkd3d_shader_register_index *reg_idx) { if (addressing & VKD3D_SM4_ADDRESSING_RELATIVE) { - struct vkd3d_shader_src_param *rel_addr = vsir_program_get_src_params(priv->program, 1); + struct vsir_src_operand *rel_addr = vsir_program_get_src_operands(tpf->program, 1); if (!(reg_idx->rel_addr = rel_addr)) { @@ -2003,7 +2000,7 @@ static bool shader_sm4_read_reg_idx(struct vkd3d_shader_sm4_parser *priv, const reg_idx->offset = *(*ptr)++; else reg_idx->offset = 0; - shader_sm4_read_src_param(priv, ptr, end, VSIR_DATA_I32, rel_addr); + tpf_read_src_operand(tpf, ptr, end, VSIR_DATA_I32, rel_addr); } else { @@ -2329,8 +2326,8 @@ static bool shader_sm4_validate_input_output_register(struct vkd3d_shader_sm4_pa return true; } -static bool shader_sm4_read_src_param(struct vkd3d_shader_sm4_parser *priv, const uint32_t **ptr, - const uint32_t *end, enum vsir_data_type data_type, struct vkd3d_shader_src_param *src_param) +static bool tpf_read_src_operand(struct vkd3d_shader_sm4_parser *tpf, const uint32_t **ptr, + const uint32_t *end, enum vsir_data_type data_type, struct vsir_src_operand *src) { unsigned int dimension, mask; uint32_t token; @@ -2342,7 +2339,7 @@ static bool shader_sm4_read_src_param(struct vkd3d_shader_sm4_parser *priv, cons } token = **ptr; - if (!shader_sm4_read_param(priv, ptr, end, data_type, &src_param->reg, &src_param->modifiers)) + if (!shader_sm4_read_param(tpf, ptr, end, data_type, &src->reg, &src->modifiers)) { ERR("Failed to read parameter.\n"); return false; @@ -2352,7 +2349,7 @@ static bool shader_sm4_read_src_param(struct vkd3d_shader_sm4_parser *priv, cons { case VKD3D_SM4_DIMENSION_NONE: case VKD3D_SM4_DIMENSION_SCALAR: - src_param->swizzle = VKD3D_SHADER_SWIZZLE(X, X, X, X); + src->swizzle = VKD3D_SHADER_SWIZZLE(X, X, X, X); break; case VKD3D_SM4_DIMENSION_VEC4: @@ -2363,37 +2360,30 @@ static bool shader_sm4_read_src_param(struct vkd3d_shader_sm4_parser *priv, cons switch (swizzle_type) { case VKD3D_SM4_SWIZZLE_NONE: - src_param->swizzle = VKD3D_SHADER_NO_SWIZZLE; + src->swizzle = VKD3D_SHADER_NO_SWIZZLE; mask = (token & VKD3D_SM4_WRITEMASK_MASK) >> VKD3D_SM4_WRITEMASK_SHIFT; /* Mask seems only to be used for vec4 constants and is always zero. */ - if (!register_is_constant(&src_param->reg)) - { - FIXME("Source mask %#x is not for a constant.\n", mask); - vkd3d_shader_parser_warning(&priv->p, VKD3D_SHADER_WARNING_TPF_UNHANDLED_REGISTER_MASK, + if (!register_is_constant(&src->reg)) + vkd3d_shader_parser_warning(&tpf->p, VKD3D_SHADER_WARNING_TPF_UNHANDLED_REGISTER_MASK, "Unhandled mask %#x for a non-constant source register.", mask); - } else if (mask) - { - FIXME("Unhandled mask %#x.\n", mask); - vkd3d_shader_parser_warning(&priv->p, VKD3D_SHADER_WARNING_TPF_UNHANDLED_REGISTER_MASK, + vkd3d_shader_parser_warning(&tpf->p, VKD3D_SHADER_WARNING_TPF_UNHANDLED_REGISTER_MASK, "Unhandled source register mask %#x.", mask); - } break; case VKD3D_SM4_SWIZZLE_SCALAR: - src_param->swizzle = (token & VKD3D_SM4_SWIZZLE_MASK) >> VKD3D_SM4_SWIZZLE_SHIFT; - src_param->swizzle = (src_param->swizzle & 0x3) * 0x01010101; + src->swizzle = (token & VKD3D_SM4_SWIZZLE_MASK) >> VKD3D_SM4_SWIZZLE_SHIFT; + src->swizzle = (src->swizzle & 0x3) * 0x01010101; break; case VKD3D_SM4_SWIZZLE_VEC4: - src_param->swizzle = swizzle_from_sm4((token & VKD3D_SM4_SWIZZLE_MASK) >> VKD3D_SM4_SWIZZLE_SHIFT); + src->swizzle = swizzle_from_sm4((token & VKD3D_SM4_SWIZZLE_MASK) >> VKD3D_SM4_SWIZZLE_SHIFT); break; default: - FIXME("Unhandled swizzle type %#x.\n", swizzle_type); - vkd3d_shader_parser_error(&priv->p, VKD3D_SHADER_ERROR_TPF_INVALID_REGISTER_SWIZZLE, + vkd3d_shader_parser_error(&tpf->p, VKD3D_SHADER_ERROR_TPF_INVALID_REGISTER_SWIZZLE, "Source register swizzle type %#x is invalid.", swizzle_type); break; } @@ -2401,17 +2391,16 @@ static bool shader_sm4_read_src_param(struct vkd3d_shader_sm4_parser *priv, cons } default: - FIXME("Unhandled dimension %#x.\n", dimension); - vkd3d_shader_parser_error(&priv->p, VKD3D_SHADER_ERROR_TPF_INVALID_REGISTER_DIMENSION, + vkd3d_shader_parser_error(&tpf->p, VKD3D_SHADER_ERROR_TPF_INVALID_REGISTER_DIMENSION, "Source register dimension %#x is invalid.", dimension); break; } if (data_type_is_64_bit(data_type)) - src_param->swizzle = vsir_swizzle_64_from_32(src_param->swizzle); + src->swizzle = vsir_swizzle_64_from_32(src->swizzle); - if (register_is_input_output(&src_param->reg) && !shader_sm4_validate_input_output_register(priv, - &src_param->reg, mask_from_swizzle(src_param->swizzle))) + if (register_is_input_output(&src->reg) && !shader_sm4_validate_input_output_register(tpf, + &src->reg, mask_from_swizzle(src->swizzle))) return false; return true; @@ -2589,8 +2578,8 @@ static void shader_sm4_read_instruction(struct vkd3d_shader_sm4_parser *sm4, str const struct vkd3d_sm4_opcode_info *opcode_info; uint32_t opcode_token, opcode, previous_token; struct vsir_program *program = sm4->program; - struct vkd3d_shader_src_param *src_params; const uint32_t **ptr = &sm4->ptr; + struct vsir_src_operand *src; struct vsir_dst_operand *dst; unsigned int i, len; const uint32_t *p; @@ -2646,10 +2635,9 @@ static void shader_sm4_read_instruction(struct vkd3d_shader_sm4_parser *sm4, str ins->predicate = NULL; ins->dst_count = opcode_info_get_dst_count(opcode_info); ins->src_count = opcode_info_get_src_count(opcode_info); - ins->src = src_params = vsir_program_get_src_params(program, ins->src_count); - if (!src_params && ins->src_count) + ins->src = src = vsir_program_get_src_operands(program, ins->src_count); + if (!src && ins->src_count) { - ERR("Failed to allocate src parameters.\n"); vkd3d_shader_parser_error(&sm4->p, VKD3D_SHADER_ERROR_TPF_OUT_OF_MEMORY, "Out of memory."); ins->opcode = VSIR_OP_INVALID; return; @@ -2707,8 +2695,7 @@ static void shader_sm4_read_instruction(struct vkd3d_shader_sm4_parser *sm4, str for (i = 0; i < ins->src_count; ++i) { - if (!(shader_sm4_read_src_param(sm4, &p, *ptr, map_data_type(opcode_info->src_info[i]), - &src_params[i]))) + if (!(tpf_read_src_operand(sm4, &p, *ptr, map_data_type(opcode_info->src_info[i]), &src[i]))) { ins->opcode = VSIR_OP_INVALID; return; @@ -3395,7 +3382,7 @@ struct sm4_instruction struct vsir_dst_operand dsts[2]; unsigned int dst_count; - struct vkd3d_shader_src_param srcs[5]; + struct vsir_src_operand srcs[5]; unsigned int src_count; unsigned int byte_stride; @@ -3403,7 +3390,7 @@ struct sm4_instruction uint32_t idx[3]; unsigned int idx_count; - struct vkd3d_shader_src_param idx_srcs[7]; + struct vsir_src_operand idx_srcs[7]; unsigned int idx_src_count; }; @@ -3496,7 +3483,7 @@ static void sm4_write_register_index(const struct tpf_compiler *tpf, const struc if (addressing & VKD3D_SM4_ADDRESSING_RELATIVE) { - const struct vkd3d_shader_src_param *idx_src = idx->rel_addr; + const struct vsir_src_operand *idx_src = idx->rel_addr; uint32_t idx_src_token; VKD3D_ASSERT(idx_src); @@ -3526,7 +3513,7 @@ static void sm4_write_dst_register(const struct tpf_compiler *tpf, const struct sm4_write_register_index(tpf, &dst->reg, j); } -static void sm4_write_src_register(const struct tpf_compiler *tpf, const struct vkd3d_shader_src_param *src) +static void sm4_write_src_register(const struct tpf_compiler *tpf, const struct vsir_src_operand *src) { struct vkd3d_bytecode_buffer *buffer = tpf->buffer; uint32_t token = 0, mod_token = 0; diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h index 29a0b36a5..57aea864b 100644 --- a/libs/vkd3d-shader/vkd3d_shader_private.h +++ b/libs/vkd3d-shader/vkd3d_shader_private.h @@ -1015,7 +1015,7 @@ struct vkd3d_shader_indexable_temp struct vkd3d_shader_register_index { - struct vkd3d_shader_src_param *rel_addr; + struct vsir_src_operand *rel_addr; unsigned int offset; /* address is known to fall within the object (for optimisation) */ bool is_in_bounds; @@ -1086,16 +1086,16 @@ void vsir_dst_operand_init(struct vsir_dst_operand *dst, enum vkd3d_shader_regis enum vsir_data_type data_type, unsigned int idx_count); void vsir_dst_operand_init_null(struct vsir_dst_operand *dst); -struct vkd3d_shader_src_param +struct vsir_src_operand { struct vkd3d_shader_register reg; uint32_t swizzle; enum vkd3d_shader_src_modifier modifiers; }; -void vsir_src_param_init(struct vkd3d_shader_src_param *param, enum vkd3d_shader_register_type reg_type, +void vsir_src_operand_init(struct vsir_src_operand *src, enum vkd3d_shader_register_type reg_type, enum vsir_data_type data_type, unsigned int idx_count); -void vsir_src_param_init_label(struct vkd3d_shader_src_param *param, unsigned int label_id); +void vsir_src_operand_init_label(struct vsir_src_operand *src, unsigned int label_id); struct vkd3d_shader_index_range { @@ -1262,13 +1262,13 @@ struct vkd3d_shader_register_semantic struct vkd3d_shader_sampler { - struct vkd3d_shader_src_param src; + struct vsir_src_operand src; struct vkd3d_shader_register_range range; }; struct vkd3d_shader_constant_buffer { - struct vkd3d_shader_src_param src; + struct vsir_src_operand src; unsigned int size; struct vkd3d_shader_register_range range; }; @@ -1363,13 +1363,13 @@ struct vkd3d_shader_instruction size_t dst_count; size_t src_count; struct vsir_dst_operand *dst; - struct vkd3d_shader_src_param *src; + struct vsir_src_operand *src; struct vkd3d_shader_texel_offset texel_offset; enum vkd3d_shader_resource_type resource_type; unsigned int resource_stride; enum vsir_data_type resource_data_type[VKD3D_VEC4_SIZE]; bool coissue, structured, raw; - const struct vkd3d_shader_src_param *predicate; + const struct vsir_src_operand *predicate; union { enum vsir_global_flags global_flags; @@ -1694,7 +1694,7 @@ struct vsir_program size_t icb_capacity; size_t icb_count; - struct vkd3d_shader_param_allocator src_params; + struct vkd3d_shader_param_allocator src_operands; struct vkd3d_shader_param_allocator dst_operands; enum vsir_denorm_mode f32_denorm_mode; @@ -1726,8 +1726,7 @@ enum vkd3d_result vsir_program_transform_early(struct vsir_program *program, uin const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_message_context *message_context); enum vkd3d_result vsir_program_validate(struct vsir_program *program, uint64_t config_flags, const char *source_name, struct vkd3d_shader_message_context *message_context); -struct vkd3d_shader_src_param *vsir_program_create_outpointid_param( - struct vsir_program *program); +struct vsir_src_operand *vsir_program_create_outpointid_param(struct vsir_program *program); bool vsir_instruction_init_with_params(struct vsir_program *program, struct vkd3d_shader_instruction *ins, const struct vkd3d_shader_location *location, enum vkd3d_shader_opcode opcode, unsigned int dst_count, unsigned int src_count); @@ -1747,12 +1746,12 @@ static inline struct vsir_dst_operand *vsir_program_get_dst_operands( return shader_param_allocator_get(allocator, count); } -static inline struct vkd3d_shader_src_param *vsir_program_get_src_params( +static inline struct vsir_src_operand *vsir_program_get_src_operands( struct vsir_program *program, unsigned int count) { - struct vkd3d_shader_param_allocator *allocator = &program->src_params; + struct vkd3d_shader_param_allocator *allocator = &program->src_operands; - VKD3D_ASSERT(allocator->stride == sizeof(struct vkd3d_shader_src_param)); + VKD3D_ASSERT(allocator->stride == sizeof(struct vsir_src_operand)); return shader_param_allocator_get(allocator, count); }