There are a few motivations for this:
* Identifiers beginning with vkd3d_shader_ look like external API. Changing the prefix makes it clear that this is an internal API.
* vkd3d_shader is a very long prefix, which is annoying to type [not least because "vkd3d" itself is an unwieldy name.] This is also a motivation for shortening "instruction" to "instr".
* The "vkd3d_instruction" is increasingly growing from a simple parsed representation of sm4 bytecode, to a proper IR in its own right—e.g. we are using it for sm1 and sm6, are performing passes over it, and we have plans to extend its scope further, e.g. to HLSL compilation. Give it a name that reflects and clearly communicates what it is.
-- v2: vkd3d-shader/ir: Rename vkd3d_shader_instruction to ir_instr.
From: Zebediah Figura zfigura@codeweavers.com
There are a few motivations for this:
* Identifiers beginning with vkd3d_shader_ look like external API. Changing the prefix makes it clear that this is an internal API.
* vkd3d_shader is a very long prefix, which is annoying to type [not least because "vkd3d" itself is an unwieldy name.] This is also a motivation for shortening "instruction" to "instr".
* The "vkd3d_instruction" is increasingly growing from a simple parsed representation of sm4 bytecode, to a proper IR in its own right—e.g. we are using it for sm1 and sm6, are performing passes over it, and we have plans to extend its scope further, e.g. to HLSL compilation. Give it a name that reflects and clearly communicates what it is. --- libs/vkd3d-shader/d3d_asm.c | 8 +- libs/vkd3d-shader/d3dbc.c | 6 +- libs/vkd3d-shader/glsl.c | 5 +- libs/vkd3d-shader/ir.c | 56 ++++---- libs/vkd3d-shader/spirv.c | 155 +++++++++++------------ libs/vkd3d-shader/tpf.c | 72 +++++------ libs/vkd3d-shader/vkd3d_shader_main.c | 24 ++-- libs/vkd3d-shader/vkd3d_shader_private.h | 6 +- 8 files changed, 164 insertions(+), 168 deletions(-)
diff --git a/libs/vkd3d-shader/d3d_asm.c b/libs/vkd3d-shader/d3d_asm.c index d72402eb2..98d16f01d 100644 --- a/libs/vkd3d-shader/d3d_asm.c +++ b/libs/vkd3d-shader/d3d_asm.c @@ -1499,7 +1499,7 @@ const char *shader_get_type_prefix(enum vkd3d_shader_type type) }
static void shader_dump_instruction_flags(struct vkd3d_d3d_asm_compiler *compiler, - const struct vkd3d_shader_instruction *ins) + const struct ir_instr *ins) { struct vkd3d_string_buffer *buffer = &compiler->buffer;
@@ -1579,7 +1579,7 @@ static void shader_print_opcode(struct vkd3d_d3d_asm_compiler *compiler, enum vk }
static void shader_dump_instruction(struct vkd3d_d3d_asm_compiler *compiler, - const struct vkd3d_shader_instruction *ins) + const struct ir_instr *ins) { struct vkd3d_string_buffer *buffer = &compiler->buffer; unsigned int i; @@ -1827,7 +1827,7 @@ static void shader_dump_instruction(struct vkd3d_d3d_asm_compiler *compiler, shader_addline(buffer, ")"); }
- if (vkd3d_shader_instruction_has_texel_offset(ins)) + if (ir_instr_has_texel_offset(ins)) { shader_print_int_literal(compiler, "(", ins->texel_offset.u, ""); shader_print_int_literal(compiler, ",", ins->texel_offset.v, ""); @@ -1930,7 +1930,7 @@ enum vkd3d_result vkd3d_dxbc_binary_to_text(const struct vkd3d_shader_instructio indent = 0; for (i = 0; i < instructions->count; ++i) { - struct vkd3d_shader_instruction *ins = &instructions->elements[i]; + struct ir_instr *ins = &instructions->elements[i];
switch (ins->handler_idx) { diff --git a/libs/vkd3d-shader/d3dbc.c b/libs/vkd3d-shader/d3dbc.c index 369112ce1..3c785f3f5 100644 --- a/libs/vkd3d-shader/d3dbc.c +++ b/libs/vkd3d-shader/d3dbc.c @@ -985,7 +985,7 @@ static void shader_sm1_read_comment(struct vkd3d_shader_sm1_parser *sm1) } }
-static void shader_sm1_validate_instruction(struct vkd3d_shader_sm1_parser *sm1, struct vkd3d_shader_instruction *ins) +static void shader_sm1_validate_instruction(struct vkd3d_shader_sm1_parser *sm1, struct ir_instr *ins) { if ((ins->handler_idx == VKD3DSIH_BREAKP || ins->handler_idx == VKD3DSIH_IF) && ins->flags) { @@ -1003,7 +1003,7 @@ static unsigned int mask_from_swizzle(unsigned int swizzle) | (1u << vkd3d_swizzle_get_component(swizzle, 3)); }
-static void shader_sm1_read_instruction(struct vkd3d_shader_sm1_parser *sm1, struct vkd3d_shader_instruction *ins) +static void shader_sm1_read_instruction(struct vkd3d_shader_sm1_parser *sm1, struct ir_instr *ins) { struct vkd3d_shader_src_param *src_params, *predicate; const struct vkd3d_sm1_opcode_info *opcode_info; @@ -1216,8 +1216,8 @@ int vkd3d_shader_sm1_parser_create(const struct vkd3d_shader_compile_info *compi struct vkd3d_shader_message_context *message_context, struct vkd3d_shader_parser **parser) { struct vkd3d_shader_instruction_array *instructions; - struct vkd3d_shader_instruction *ins; struct vkd3d_shader_sm1_parser *sm1; + struct ir_instr *ins; int ret;
if (!(sm1 = vkd3d_calloc(1, sizeof(*sm1)))) diff --git a/libs/vkd3d-shader/glsl.c b/libs/vkd3d-shader/glsl.c index f8d68b5a7..3edf36e7c 100644 --- a/libs/vkd3d-shader/glsl.c +++ b/libs/vkd3d-shader/glsl.c @@ -55,8 +55,7 @@ static void VKD3D_PRINTF_FUNC(3, 4) vkd3d_glsl_compiler_error( generator->failed = true; }
-static void shader_glsl_ret(struct vkd3d_glsl_generator *generator, - const struct vkd3d_shader_instruction *ins) +static void shader_glsl_ret(struct vkd3d_glsl_generator *generator, const struct ir_instr *ins) { const struct vkd3d_shader_version *version = &generator->version;
@@ -71,7 +70,7 @@ static void shader_glsl_ret(struct vkd3d_glsl_generator *generator, }
static void vkd3d_glsl_handle_instruction(struct vkd3d_glsl_generator *generator, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { switch (instruction->handler_idx) { diff --git a/libs/vkd3d-shader/ir.c b/libs/vkd3d-shader/ir.c index 9eefb82c2..6d1866d97 100644 --- a/libs/vkd3d-shader/ir.c +++ b/libs/vkd3d-shader/ir.c @@ -23,13 +23,13 @@ static inline bool shader_register_is_phase_instance_id(const struct vkd3d_shade return reg->type == VKD3DSPR_FORKINSTID || reg->type == VKD3DSPR_JOININSTID; }
-static bool shader_instruction_is_dcl(const struct vkd3d_shader_instruction *ins) +static bool ir_instr_is_dcl(const struct ir_instr *ins) { return (VKD3DSIH_DCL <= ins->handler_idx && ins->handler_idx <= VKD3DSIH_DCL_VERTICES_OUT) || ins->handler_idx == VKD3DSIH_HS_DECLS; }
-static void vkd3d_shader_instruction_make_nop(struct vkd3d_shader_instruction *ins) +static void ir_instr_make_nop(struct ir_instr *ins) { ins->handler_idx = VKD3DSIH_NOP; ins->dst_count = 0; @@ -53,8 +53,7 @@ static void shader_register_eliminate_phase_addressing(struct vkd3d_shader_regis } }
-static void shader_instruction_eliminate_phase_instance_id(struct vkd3d_shader_instruction *ins, - unsigned int instance_id) +static void ir_instr_eliminate_phase_instance_id(struct ir_instr *ins, unsigned int instance_id) { struct vkd3d_shader_register *reg; unsigned int i; @@ -119,7 +118,7 @@ struct shader_phase_location_array static void flattener_eliminate_phase_related_dcls(struct hull_flattener *normaliser, unsigned int index, struct shader_phase_location_array *locations) { - struct vkd3d_shader_instruction *ins = &normaliser->instructions.elements[index]; + struct ir_instr *ins = &normaliser->instructions.elements[index]; struct shader_phase_location *loc; bool b;
@@ -132,20 +131,20 @@ static void flattener_eliminate_phase_related_dcls(struct hull_flattener *normal normaliser->instance_count = 1; /* Leave the first occurrence and delete the rest. */ if (b) - vkd3d_shader_instruction_make_nop(ins); + ir_instr_make_nop(ins); return; } else if (ins->handler_idx == VKD3DSIH_DCL_HS_FORK_PHASE_INSTANCE_COUNT || ins->handler_idx == VKD3DSIH_DCL_HS_JOIN_PHASE_INSTANCE_COUNT) { normaliser->instance_count = ins->declaration.count + !ins->declaration.count; - vkd3d_shader_instruction_make_nop(ins); + ir_instr_make_nop(ins); return; } else if (ins->handler_idx == VKD3DSIH_DCL_INPUT && shader_register_is_phase_instance_id( &ins->declaration.dst.reg)) { - vkd3d_shader_instruction_make_nop(ins); + ir_instr_make_nop(ins); return; } else if (ins->handler_idx == VKD3DSIH_DCL_TEMPS && normaliser->phase != VKD3DSIH_INVALID) @@ -154,12 +153,12 @@ static void flattener_eliminate_phase_related_dcls(struct hull_flattener *normal if (!normaliser->max_temp_count) normaliser->temp_dcl_idx = index; else - vkd3d_shader_instruction_make_nop(ins); + ir_instr_make_nop(ins); normaliser->max_temp_count = max(normaliser->max_temp_count, ins->declaration.count); return; }
- if (normaliser->phase == VKD3DSIH_INVALID || shader_instruction_is_dcl(ins)) + if (normaliser->phase == VKD3DSIH_INVALID || ir_instr_is_dcl(ins)) return;
if (normaliser->phase_body_idx == ~0u) @@ -167,7 +166,7 @@ static void flattener_eliminate_phase_related_dcls(struct hull_flattener *normal
if (ins->handler_idx == VKD3DSIH_RET) { - vkd3d_shader_instruction_make_nop(ins); + ir_instr_make_nop(ins); if (locations->count >= ARRAY_SIZE(locations->locations)) { FIXME("Insufficient space for phase location.\n"); @@ -222,7 +221,7 @@ static enum vkd3d_result flattener_flatten_phases(struct hull_flattener *normali for (j = 0; j < loc->instance_count; ++j) { for (k = 0; k < loc->instruction_count; ++k) - shader_instruction_eliminate_phase_instance_id( + ir_instr_eliminate_phase_instance_id( &normaliser->instructions.elements[loc->index + loc->instruction_count * j + k], j); } } @@ -247,7 +246,7 @@ static void shader_register_init(struct vkd3d_shader_register *reg, enum vkd3d_s reg->immconst_type = VKD3D_IMMCONST_SCALAR; }
-static void shader_instruction_init(struct vkd3d_shader_instruction *ins, enum vkd3d_shader_opcode handler_idx) +static void ir_instr_init(struct ir_instr *ins, enum vkd3d_shader_opcode handler_idx) { memset(ins, 0, sizeof(*ins)); ins->handler_idx = handler_idx; @@ -277,7 +276,7 @@ enum vkd3d_result instruction_array_flatten_hull_shader_phases(struct vkd3d_shad
if (!shader_instruction_array_reserve(&flattener.instructions, flattener.instructions.count + 1)) return VKD3D_ERROR_OUT_OF_MEMORY; - shader_instruction_init(&instructions->elements[instructions->count++], VKD3DSIH_RET); + ir_instr_init(&instructions->elements[instructions->count++], VKD3DSIH_RET); }
*src_instructions = flattener.instructions; @@ -340,10 +339,10 @@ static void shader_dst_param_io_init(struct vkd3d_shader_dst_param *param, const static enum vkd3d_result control_point_normaliser_emit_hs_input(struct control_point_normaliser *normaliser, const struct shader_signature *s, unsigned int input_control_point_count, unsigned int dst) { - struct vkd3d_shader_instruction *ins; struct vkd3d_shader_dst_param *param; const struct signature_element *e; unsigned int i, count; + struct ir_instr *ins;
for (i = 0, count = 1; i < s->element_count; ++i) count += !!s->elements[i].used_mask; @@ -356,7 +355,7 @@ static enum vkd3d_result control_point_normaliser_emit_hs_input(struct control_p normaliser->instructions.count += count;
ins = &normaliser->instructions.elements[dst]; - shader_instruction_init(ins, VKD3DSIH_HS_CONTROL_POINT_PHASE); + ir_instr_init(ins, VKD3DSIH_HS_CONTROL_POINT_PHASE); ins->flags = 1; ++ins;
@@ -368,13 +367,13 @@ static enum vkd3d_result control_point_normaliser_emit_hs_input(struct control_p
if (e->sysval_semantic != VKD3D_SHADER_SV_NONE) { - shader_instruction_init(ins, VKD3DSIH_DCL_INPUT_SIV); + ir_instr_init(ins, VKD3DSIH_DCL_INPUT_SIV); param = &ins->declaration.register_semantic.reg; ins->declaration.register_semantic.sysval_semantic = vkd3d_siv_from_sysval(e->sysval_semantic); } else { - shader_instruction_init(ins, VKD3DSIH_DCL_INPUT); + ir_instr_init(ins, VKD3DSIH_DCL_INPUT); param = &ins->declaration.dst; }
@@ -394,8 +393,8 @@ enum vkd3d_result instruction_array_normalise_hull_shader_control_point_io( struct vkd3d_shader_instruction_array *instructions; struct control_point_normaliser normaliser; unsigned int input_control_point_count; - struct vkd3d_shader_instruction *ins; enum vkd3d_result ret; + struct ir_instr *ins; unsigned int i, j;
if (!(normaliser.outpointid_param = instruction_array_create_outpointid_param(src_instructions))) @@ -419,7 +418,7 @@ enum vkd3d_result instruction_array_normalise_hull_shader_control_point_io( normaliser.phase = ins->handler_idx; break; default: - if (shader_instruction_is_dcl(ins)) + if (ir_instr_is_dcl(ins)) break; for (j = 0; j < ins->dst_count; ++j) shader_dst_param_normalise_outpointid((struct vkd3d_shader_dst_param *)&ins->dst[j], &normaliser); @@ -559,7 +558,7 @@ static void range_map_set_register_range(uint8_t range_map[][VKD3D_VEC4_SIZE], u }
static void io_normaliser_add_index_range(struct io_normaliser *normaliser, - const struct vkd3d_shader_instruction *ins) + const struct ir_instr *ins) { const struct vkd3d_shader_index_range *range = &ins->declaration.index_range; const struct vkd3d_shader_register *reg = &range->dst.reg; @@ -944,8 +943,7 @@ static void shader_src_param_io_normalise(struct vkd3d_shader_src_param *src_par } }
-static void shader_instruction_normalise_io_params(struct vkd3d_shader_instruction *ins, - struct io_normaliser *normaliser) +static void ir_instr_normalise_io_params(struct ir_instr *ins, struct io_normaliser *normaliser) { struct vkd3d_shader_register *reg; bool keep = true; @@ -960,7 +958,7 @@ static void shader_instruction_normalise_io_params(struct vkd3d_shader_instructi /* We don't need to keep OUTCONTROLPOINT or PATCHCONST input declarations since their * equivalents were declared earlier, but INCONTROLPOINT may be the first occurrence. */ if (reg->type == VKD3DSPR_OUTCONTROLPOINT || reg->type == VKD3DSPR_PATCHCONST) - vkd3d_shader_instruction_make_nop(ins); + ir_instr_make_nop(ins); else if (reg->type == VKD3DSPR_INCONTROLPOINT) reg->type = VKD3DSPR_INPUT; } @@ -986,7 +984,7 @@ static void shader_instruction_normalise_io_params(struct vkd3d_shader_instructi memset(normaliser->pc_dcl_params, 0, sizeof(normaliser->pc_dcl_params)); break; default: - if (shader_instruction_is_dcl(ins)) + if (ir_instr_is_dcl(ins)) break; for (i = 0; i < ins->dst_count; ++i) shader_dst_param_io_normalise((struct vkd3d_shader_dst_param *)&ins->dst[i], false, normaliser); @@ -996,7 +994,7 @@ static void shader_instruction_normalise_io_params(struct vkd3d_shader_instructi }
if (!keep) - shader_instruction_init(ins, VKD3DSIH_NOP); + ir_instr_init(ins, VKD3DSIH_NOP); }
enum vkd3d_result instruction_array_normalise_io_registers(struct vkd3d_shader_instruction_array *instructions, @@ -1004,8 +1002,8 @@ enum vkd3d_result instruction_array_normalise_io_registers(struct vkd3d_shader_i struct shader_signature *output_signature, struct shader_signature *patch_constant_signature) { struct io_normaliser normaliser = {*instructions}; - struct vkd3d_shader_instruction *ins; bool has_control_point_phase; + struct ir_instr *ins; unsigned int i, j;
normaliser.phase = VKD3DSIH_INVALID; @@ -1025,7 +1023,7 @@ enum vkd3d_result instruction_array_normalise_io_registers(struct vkd3d_shader_i break; case VKD3DSIH_DCL_INDEX_RANGE: io_normaliser_add_index_range(&normaliser, ins); - vkd3d_shader_instruction_make_nop(ins); + ir_instr_make_nop(ins); break; case VKD3DSIH_HS_CONTROL_POINT_PHASE: has_control_point_phase = true; @@ -1065,7 +1063,7 @@ enum vkd3d_result instruction_array_normalise_io_registers(struct vkd3d_shader_i
normaliser.phase = VKD3DSIH_INVALID; for (i = 0; i < normaliser.instructions.count; ++i) - shader_instruction_normalise_io_params(&normaliser.instructions.elements[i], &normaliser); + ir_instr_normalise_io_params(&normaliser.instructions.elements[i], &normaliser);
*instructions = normaliser.instructions; return VKD3D_OK; diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 5535a6503..3daa9d54f 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -5236,7 +5236,7 @@ static size_t spirv_compiler_get_current_function_location(struct spirv_compiler }
static void spirv_compiler_emit_dcl_global_flags(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { unsigned int flags = instruction->flags;
@@ -5285,7 +5285,7 @@ static void spirv_compiler_emit_temps(struct spirv_compiler *compiler, uint32_t }
static void spirv_compiler_emit_dcl_indexable_temp(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { const struct vkd3d_shader_indexable_temp *temp = &instruction->declaration.indexable_temp; struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; @@ -5473,7 +5473,7 @@ static uint32_t spirv_compiler_build_descriptor_variable(struct spirv_compiler * }
static void spirv_compiler_emit_dcl_constant_buffer(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { const struct vkd3d_shader_constant_buffer *cb = &instruction->declaration.cb; struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; @@ -5524,7 +5524,7 @@ static void spirv_compiler_emit_dcl_constant_buffer(struct spirv_compiler *compi }
static void spirv_compiler_emit_dcl_immediate_constant_buffer(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { const struct vkd3d_shader_immediate_constant_buffer *icb = instruction->declaration.icb; uint32_t *elements, length_id, type_id, const_id, ptr_type_id, icb_id; @@ -5557,7 +5557,7 @@ static void spirv_compiler_emit_dcl_immediate_constant_buffer(struct spirv_compi }
static void spirv_compiler_emit_dcl_sampler(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { const struct vkd3d_shader_sampler *sampler = &instruction->declaration.sampler; const SpvStorageClass storage_class = SpvStorageClassUniformConstant; @@ -5874,7 +5874,7 @@ static void spirv_compiler_emit_resource_declaration(struct spirv_compiler *comp }
static void spirv_compiler_emit_dcl_resource(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { const struct vkd3d_shader_semantic *semantic = &instruction->declaration.semantic; enum vkd3d_shader_resource_type resource_type = semantic->resource_type; @@ -5895,7 +5895,7 @@ static void spirv_compiler_emit_dcl_resource(struct spirv_compiler *compiler, }
static void spirv_compiler_emit_dcl_resource_raw(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { const struct vkd3d_shader_raw_resource *resource = &instruction->declaration.raw_resource; uint32_t flags = instruction->flags; @@ -5910,7 +5910,7 @@ static void spirv_compiler_emit_dcl_resource_raw(struct spirv_compiler *compiler }
static void spirv_compiler_emit_dcl_resource_structured(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { const struct vkd3d_shader_structured_resource *resource = &instruction->declaration.structured_resource; unsigned int stride = resource->byte_stride; @@ -5951,7 +5951,7 @@ static void spirv_compiler_emit_workgroup_memory(struct spirv_compiler *compiler }
static void spirv_compiler_emit_dcl_tgsm_raw(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { const struct vkd3d_shader_tgsm_raw *tgsm_raw = &instruction->declaration.tgsm_raw; spirv_compiler_emit_workgroup_memory(compiler, &tgsm_raw->reg.reg, @@ -5959,7 +5959,7 @@ static void spirv_compiler_emit_dcl_tgsm_raw(struct spirv_compiler *compiler, }
static void spirv_compiler_emit_dcl_tgsm_structured(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { const struct vkd3d_shader_tgsm_structured *tgsm_structured = &instruction->declaration.tgsm_structured; unsigned int stride = tgsm_structured->byte_stride / 4; @@ -5968,7 +5968,7 @@ static void spirv_compiler_emit_dcl_tgsm_structured(struct spirv_compiler *compi }
static void spirv_compiler_emit_dcl_input(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { const struct vkd3d_shader_dst_param *dst = &instruction->declaration.dst;
@@ -5984,13 +5984,13 @@ static void spirv_compiler_emit_dcl_input(struct spirv_compiler *compiler, }
static void spirv_compiler_emit_dcl_input_ps(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { spirv_compiler_emit_input(compiler, &instruction->declaration.dst, VKD3D_SIV_NONE, instruction->flags); }
static void spirv_compiler_emit_dcl_input_ps_sysval(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { const struct vkd3d_shader_register_semantic *semantic = &instruction->declaration.register_semantic;
@@ -5998,14 +5998,14 @@ static void spirv_compiler_emit_dcl_input_ps_sysval(struct spirv_compiler *compi }
static void spirv_compiler_emit_dcl_input_sysval(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { spirv_compiler_emit_input(compiler, &instruction->declaration.register_semantic.reg, instruction->declaration.register_semantic.sysval_semantic, VKD3DSIM_NONE); }
static void spirv_compiler_emit_dcl_output(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { const struct vkd3d_shader_dst_param *dst = &instruction->declaration.dst;
@@ -6017,7 +6017,7 @@ static void spirv_compiler_emit_dcl_output(struct spirv_compiler *compiler, }
static void spirv_compiler_emit_dcl_output_siv(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { enum vkd3d_shader_input_sysval_semantic sysval; const struct vkd3d_shader_dst_param *dst; @@ -6029,7 +6029,7 @@ static void spirv_compiler_emit_dcl_output_siv(struct spirv_compiler *compiler, }
static void spirv_compiler_emit_dcl_stream(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { unsigned int stream_idx = instruction->src[0].reg.idx[0].offset;
@@ -6038,14 +6038,14 @@ static void spirv_compiler_emit_dcl_stream(struct spirv_compiler *compiler, }
static void spirv_compiler_emit_output_vertex_count(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { spirv_compiler_emit_execution_mode1(compiler, SpvExecutionModeOutputVertices, instruction->declaration.count); }
static void spirv_compiler_emit_dcl_input_primitive(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { enum vkd3d_primitive_type primitive_type = instruction->declaration.primitive_type.type; SpvExecutionMode mode; @@ -6097,7 +6097,7 @@ static void spirv_compiler_emit_point_size(struct spirv_compiler *compiler) }
static void spirv_compiler_emit_dcl_output_topology(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { enum vkd3d_primitive_type primitive_type = instruction->declaration.primitive_type.type; SpvExecutionMode mode; @@ -6123,13 +6123,13 @@ static void spirv_compiler_emit_dcl_output_topology(struct spirv_compiler *compi }
static void spirv_compiler_emit_dcl_gs_instances(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { compiler->spirv_builder.invocation_count = instruction->declaration.count; }
static void spirv_compiler_emit_dcl_tessellator_domain(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { enum vkd3d_tessellator_domain domain = instruction->declaration.tessellator_domain; SpvExecutionMode mode; @@ -6214,7 +6214,7 @@ static void spirv_compiler_emit_tessellator_partitioning(struct spirv_compiler * }
static void spirv_compiler_emit_dcl_thread_group(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { const struct vkd3d_shader_thread_group_size *group_size = &instruction->declaration.thread_group_size; const uint32_t local_size[] = {group_size->x, group_size->y, group_size->z}; @@ -6253,7 +6253,7 @@ static void spirv_compiler_leave_shader_phase(struct spirv_compiler *compiler) }
static void spirv_compiler_enter_shader_phase(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; uint32_t function_id, void_id, function_type_id; @@ -6442,7 +6442,7 @@ static void spirv_compiler_emit_hull_shader_main(struct spirv_compiler *compiler vkd3d_spirv_build_op_function_end(builder); }
-static SpvOp spirv_compiler_map_alu_instruction(const struct vkd3d_shader_instruction *instruction) +static SpvOp spirv_compiler_map_alu_instruction(const struct ir_instr *instruction) { static const struct { @@ -6491,7 +6491,7 @@ static SpvOp spirv_compiler_map_alu_instruction(const struct vkd3d_shader_instru }
static void spirv_compiler_emit_alu_instruction(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; const struct vkd3d_shader_dst_param *dst = instruction->dst; @@ -6540,7 +6540,7 @@ static void spirv_compiler_emit_alu_instruction(struct spirv_compiler *compiler, }
static enum GLSLstd450 spirv_compiler_map_ext_glsl_instruction( - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { static const struct { @@ -6584,7 +6584,7 @@ static enum GLSLstd450 spirv_compiler_map_ext_glsl_instruction( }
static void spirv_compiler_emit_ext_glsl_instruction(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; const struct vkd3d_shader_dst_param *dst = instruction->dst; @@ -6626,7 +6626,7 @@ static void spirv_compiler_emit_ext_glsl_instruction(struct spirv_compiler *comp }
static void spirv_compiler_emit_mov(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; struct vkd3d_shader_register_info dst_reg_info, src_reg_info; @@ -6687,7 +6687,7 @@ general_implementation: }
static void spirv_compiler_emit_movc(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; const struct vkd3d_shader_dst_param *dst = instruction->dst; @@ -6710,7 +6710,7 @@ static void spirv_compiler_emit_movc(struct spirv_compiler *compiler, }
static void spirv_compiler_emit_swapc(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; const struct vkd3d_shader_dst_param *dst = instruction->dst; @@ -6737,7 +6737,7 @@ static void spirv_compiler_emit_swapc(struct spirv_compiler *compiler, }
static void spirv_compiler_emit_dot(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; const struct vkd3d_shader_dst_param *dst = instruction->dst; @@ -6777,7 +6777,7 @@ static void spirv_compiler_emit_dot(struct spirv_compiler *compiler, }
static void spirv_compiler_emit_rcp(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; const struct vkd3d_shader_dst_param *dst = instruction->dst; @@ -6798,7 +6798,7 @@ static void spirv_compiler_emit_rcp(struct spirv_compiler *compiler, }
static void spirv_compiler_emit_sincos(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { const struct vkd3d_shader_dst_param *dst_sin = &instruction->dst[0]; const struct vkd3d_shader_dst_param *dst_cos = &instruction->dst[1]; @@ -6833,7 +6833,7 @@ static void spirv_compiler_emit_sincos(struct spirv_compiler *compiler, }
static void spirv_compiler_emit_imul(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; const struct vkd3d_shader_dst_param *dst = instruction->dst; @@ -6857,7 +6857,7 @@ static void spirv_compiler_emit_imul(struct spirv_compiler *compiler, }
static void spirv_compiler_emit_imad(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; const struct vkd3d_shader_dst_param *dst = instruction->dst; @@ -6878,7 +6878,7 @@ static void spirv_compiler_emit_imad(struct spirv_compiler *compiler, }
static void spirv_compiler_emit_udiv(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { uint32_t type_id, val_id, src0_id, src1_id, condition_id, uint_max_id; struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; @@ -6931,7 +6931,7 @@ static void spirv_compiler_emit_udiv(struct spirv_compiler *compiler, }
static void spirv_compiler_emit_bitfield_instruction(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { uint32_t src_ids[4], constituents[VKD3D_VEC4_SIZE], type_id, mask_id; struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; @@ -6985,7 +6985,7 @@ static void spirv_compiler_emit_bitfield_instruction(struct spirv_compiler *comp }
static void spirv_compiler_emit_f16tof32(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { uint32_t instr_set_id, type_id, scalar_type_id, src_id, result_id; struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; @@ -7018,7 +7018,7 @@ static void spirv_compiler_emit_f16tof32(struct spirv_compiler *compiler, }
static void spirv_compiler_emit_f32tof16(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { uint32_t instr_set_id, type_id, scalar_type_id, src_id, zero_id, constituents[2]; struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; @@ -7054,7 +7054,7 @@ static void spirv_compiler_emit_f32tof16(struct spirv_compiler *compiler, }
static void spirv_compiler_emit_comparison_instruction(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; const struct vkd3d_shader_dst_param *dst = instruction->dst; @@ -7098,7 +7098,7 @@ static void spirv_compiler_emit_comparison_instruction(struct spirv_compiler *co }
static uint32_t spirv_compiler_emit_conditional_branch(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction, uint32_t target_block_id) + const struct ir_instr *instruction, uint32_t target_block_id) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; const struct vkd3d_shader_src_param *src = instruction->src; @@ -7116,7 +7116,7 @@ static uint32_t spirv_compiler_emit_conditional_branch(struct spirv_compiler *co }
static void spirv_compiler_emit_return(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
@@ -7128,7 +7128,7 @@ static void spirv_compiler_emit_return(struct spirv_compiler *compiler, }
static void spirv_compiler_emit_retc(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; uint32_t target_id, merge_block_id; @@ -7142,7 +7142,7 @@ static void spirv_compiler_emit_retc(struct spirv_compiler *compiler, }
static void spirv_compiler_emit_kill(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; uint32_t target_id, merge_block_id; @@ -7220,7 +7220,7 @@ static struct vkd3d_control_flow_info *spirv_compiler_find_innermost_breakable_c }
static int spirv_compiler_emit_control_flow_instruction(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { uint32_t loop_header_block_id, loop_body_block_id, continue_block_id; struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; @@ -7537,7 +7537,7 @@ static int spirv_compiler_emit_control_flow_instruction(struct spirv_compiler *c }
static void spirv_compiler_emit_deriv_instruction(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; const struct vkd3d_shader_dst_param *dst = instruction->dst; @@ -7759,8 +7759,7 @@ static void spirv_compiler_prepare_image(struct spirv_compiler *compiler, }
static uint32_t spirv_compiler_emit_texel_offset(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction, - const struct vkd3d_spirv_resource_type *resource_type_info) + const struct ir_instr *instruction, const struct vkd3d_spirv_resource_type *resource_type_info) { const struct vkd3d_shader_texel_offset *offset = &instruction->texel_offset; unsigned int component_count = resource_type_info->offset_component_count; @@ -7770,7 +7769,7 @@ static uint32_t spirv_compiler_emit_texel_offset(struct spirv_compiler *compiler }
static void spirv_compiler_emit_ld(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; const struct vkd3d_shader_dst_param *dst = instruction->dst; @@ -7796,7 +7795,7 @@ static void spirv_compiler_emit_ld(struct spirv_compiler *compiler, image_operands[image_operand_count++] = spirv_compiler_emit_load_src(compiler, &src[0], VKD3DSP_WRITEMASK_3); } - if (vkd3d_shader_instruction_has_texel_offset(instruction)) + if (ir_instr_has_texel_offset(instruction)) { operands_mask |= SpvImageOperandsConstOffsetMask; image_operands[image_operand_count++] = spirv_compiler_emit_texel_offset(compiler, @@ -7817,7 +7816,7 @@ static void spirv_compiler_emit_ld(struct spirv_compiler *compiler, }
static void spirv_compiler_emit_lod(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; const struct vkd3d_shader_dst_param *dst = instruction->dst; @@ -7843,7 +7842,7 @@ static void spirv_compiler_emit_lod(struct spirv_compiler *compiler, }
static void spirv_compiler_emit_sample(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; const struct vkd3d_shader_dst_param *dst = instruction->dst; @@ -7893,7 +7892,7 @@ static void spirv_compiler_emit_sample(struct spirv_compiler *compiler, return; }
- if (vkd3d_shader_instruction_has_texel_offset(instruction)) + if (ir_instr_has_texel_offset(instruction)) { operands_mask |= SpvImageOperandsConstOffsetMask; image_operands[image_operand_count++] = spirv_compiler_emit_texel_offset(compiler, @@ -7911,7 +7910,7 @@ static void spirv_compiler_emit_sample(struct spirv_compiler *compiler, }
static void spirv_compiler_emit_sample_c(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; const struct vkd3d_shader_dst_param *dst = instruction->dst; @@ -7938,7 +7937,7 @@ static void spirv_compiler_emit_sample_c(struct spirv_compiler *compiler, spirv_compiler_prepare_image(compiler, &image, &src[1].reg, &src[2].reg, VKD3D_IMAGE_FLAG_SAMPLED | VKD3D_IMAGE_FLAG_DEPTH);
- if (vkd3d_shader_instruction_has_texel_offset(instruction)) + if (ir_instr_has_texel_offset(instruction)) { operands_mask |= SpvImageOperandsConstOffsetMask; image_operands[image_operand_count++] = spirv_compiler_emit_texel_offset(compiler, @@ -7957,7 +7956,7 @@ 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 ir_instr *instruction) { const struct vkd3d_shader_src_param *addr, *offset, *resource, *sampler; uint32_t sampled_type_id, coordinate_id, component_id, dref_id, val_id; @@ -7995,7 +7994,7 @@ static void spirv_compiler_emit_gather4(struct spirv_compiler *compiler, image_operands[image_operand_count++] = spirv_compiler_emit_load_src(compiler, offset, (1u << image.resource_type_info->offset_component_count) - 1); } - else if (vkd3d_shader_instruction_has_texel_offset(instruction)) + else if (ir_instr_has_texel_offset(instruction)) { operands_mask |= SpvImageOperandsConstOffsetMask; image_operands[image_operand_count++] = spirv_compiler_emit_texel_offset(compiler, @@ -8058,7 +8057,7 @@ static uint32_t spirv_compiler_emit_raw_structured_addressing( }
static void spirv_compiler_emit_ld_raw_structured_srv_uav(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { uint32_t coordinate_id, type_id, val_id, texel_type_id, ptr_type_id, ptr_id; struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; @@ -8142,7 +8141,7 @@ static void spirv_compiler_emit_ld_raw_structured_srv_uav(struct spirv_compiler }
static void spirv_compiler_emit_ld_tgsm(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; const struct vkd3d_shader_dst_param *dst = instruction->dst; @@ -8183,7 +8182,7 @@ static void spirv_compiler_emit_ld_tgsm(struct spirv_compiler *compiler, }
static void spirv_compiler_emit_ld_raw_structured(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { enum vkd3d_shader_register_type reg_type = instruction->src[instruction->src_count - 1].reg.type; switch (reg_type) @@ -8201,7 +8200,7 @@ static void spirv_compiler_emit_ld_raw_structured(struct spirv_compiler *compile }
static void spirv_compiler_emit_store_uav_raw_structured(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { uint32_t coordinate_id, type_id, val_id, data_id, ptr_type_id, ptr_id; struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; @@ -8279,7 +8278,7 @@ static void spirv_compiler_emit_store_uav_raw_structured(struct spirv_compiler * }
static void spirv_compiler_emit_store_tgsm(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { uint32_t coordinate_id, type_id, val_id, ptr_type_id, ptr_id, data_id; struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; @@ -8320,7 +8319,7 @@ static void spirv_compiler_emit_store_tgsm(struct spirv_compiler *compiler, }
static void spirv_compiler_emit_store_raw_structured(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { enum vkd3d_shader_register_type reg_type = instruction->dst[0].reg.type; switch (reg_type) @@ -8337,7 +8336,7 @@ static void spirv_compiler_emit_store_raw_structured(struct spirv_compiler *comp }
static void spirv_compiler_emit_ld_uav_typed(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; uint32_t coordinate_id, type_id, val_id, ptr_type_id, ptr_id; @@ -8380,7 +8379,7 @@ static void spirv_compiler_emit_ld_uav_typed(struct spirv_compiler *compiler, }
static void spirv_compiler_emit_store_uav_typed(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { uint32_t coordinate_id, texel_id, type_id, val_id, ptr_type_id, ptr_id; struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; @@ -8421,7 +8420,7 @@ static void spirv_compiler_emit_store_uav_typed(struct spirv_compiler *compiler, }
static void spirv_compiler_emit_uav_counter_instruction(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; const struct vkd3d_shader_dst_param *dst = instruction->dst; @@ -8495,7 +8494,7 @@ static void spirv_compiler_emit_uav_counter_instruction(struct spirv_compiler *c spirv_compiler_emit_store_dst(compiler, dst, result_id); }
-static SpvOp spirv_compiler_map_atomic_instruction(const struct vkd3d_shader_instruction *instruction) +static SpvOp spirv_compiler_map_atomic_instruction(const struct ir_instr *instruction) { static const struct { @@ -8541,7 +8540,7 @@ static bool is_imm_atomic_instruction(enum vkd3d_shader_opcode handler_idx) }
static void spirv_compiler_emit_atomic_instruction(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; const struct vkd3d_shader_dst_param *dst = instruction->dst; @@ -8660,7 +8659,7 @@ static void spirv_compiler_emit_atomic_instruction(struct spirv_compiler *compil }
static void spirv_compiler_emit_bufinfo(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; const struct vkd3d_shader_dst_param *dst = instruction->dst; @@ -8712,7 +8711,7 @@ static void spirv_compiler_emit_bufinfo(struct spirv_compiler *compiler, }
static void spirv_compiler_emit_resinfo(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; const struct vkd3d_shader_dst_param *dst = instruction->dst; @@ -8796,7 +8795,7 @@ static uint32_t spirv_compiler_emit_query_sample_count(struct spirv_compiler *co }
static void spirv_compiler_emit_sample_info(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; const struct vkd3d_shader_dst_param *dst = instruction->dst; @@ -8833,7 +8832,7 @@ static void spirv_compiler_emit_sample_info(struct spirv_compiler *compiler,
/* XXX: This is correct only when standard sample positions are used. */ static void spirv_compiler_emit_sample_position(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { /* Standard sample locations from the Vulkan spec. */ static const float standard_sample_positions[][2] = @@ -8929,7 +8928,7 @@ static void spirv_compiler_emit_sample_position(struct spirv_compiler *compiler, }
static void spirv_compiler_emit_eval_attrib(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; const struct vkd3d_shader_dst_param *dst = instruction->dst; @@ -8983,7 +8982,7 @@ static void spirv_compiler_emit_eval_attrib(struct spirv_compiler *compiler, * "Scope for memory must be limited to: * Device * Workgroup * Invocation" */ static void spirv_compiler_emit_sync(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { unsigned int memory_semantics = SpvMemorySemanticsAcquireReleaseMask; unsigned int flags = instruction->flags; @@ -9027,7 +9026,7 @@ static void spirv_compiler_emit_sync(struct spirv_compiler *compiler, }
static void spirv_compiler_emit_emit_stream(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; unsigned int stream_idx; @@ -9048,7 +9047,7 @@ static void spirv_compiler_emit_emit_stream(struct spirv_compiler *compiler, }
static void spirv_compiler_emit_cut_stream(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; unsigned int stream_idx; @@ -9084,7 +9083,7 @@ static bool is_dcl_instruction(enum vkd3d_shader_opcode handler_idx) }
static int spirv_compiler_handle_instruction(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { int ret = VKD3D_OK;
diff --git a/libs/vkd3d-shader/tpf.c b/libs/vkd3d-shader/tpf.c index 290fdcb3f..731117813 100644 --- a/libs/vkd3d-shader/tpf.c +++ b/libs/vkd3d-shader/tpf.c @@ -596,7 +596,7 @@ struct vkd3d_sm4_opcode_info enum vkd3d_shader_opcode handler_idx; char dst_info[SM4_MAX_DST_COUNT]; char src_info[SM4_MAX_SRC_COUNT]; - void (*read_opcode_func)(struct vkd3d_shader_instruction *ins, uint32_t opcode, uint32_t opcode_token, + void (*read_opcode_func)(struct ir_instr *ins, uint32_t opcode, uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv); };
@@ -688,7 +688,7 @@ static bool shader_sm4_read_register_space(struct vkd3d_shader_sm4_parser *priv, return true; }
-static void shader_sm4_read_conditional_op(struct vkd3d_shader_instruction *ins, uint32_t opcode, +static void shader_sm4_read_conditional_op(struct ir_instr *ins, uint32_t opcode, uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv) { shader_sm4_read_src_param(priv, &tokens, &tokens[token_count], VKD3D_DATA_UINT, @@ -697,7 +697,7 @@ static void shader_sm4_read_conditional_op(struct vkd3d_shader_instruction *ins, VKD3D_SHADER_CONDITIONAL_OP_NZ : VKD3D_SHADER_CONDITIONAL_OP_Z; }
-static void shader_sm4_read_shader_data(struct vkd3d_shader_instruction *ins, uint32_t opcode, uint32_t opcode_token, +static void shader_sm4_read_shader_data(struct ir_instr *ins, uint32_t opcode, uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv) { struct vkd3d_shader_immediate_constant_buffer *icb; @@ -747,7 +747,7 @@ static void shader_sm4_set_descriptor_register_range(struct vkd3d_shader_sm4_par } }
-static void shader_sm4_read_dcl_resource(struct vkd3d_shader_instruction *ins, uint32_t opcode, +static void shader_sm4_read_dcl_resource(struct ir_instr *ins, uint32_t opcode, uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv) { struct vkd3d_shader_semantic *semantic = &ins->declaration.semantic; @@ -802,7 +802,7 @@ static void shader_sm4_read_dcl_resource(struct vkd3d_shader_instruction *ins, u shader_sm4_read_register_space(priv, &tokens, end, &semantic->resource.range.space); }
-static void shader_sm4_read_dcl_constant_buffer(struct vkd3d_shader_instruction *ins, uint32_t opcode, +static void shader_sm4_read_dcl_constant_buffer(struct ir_instr *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 *end = &tokens[token_count]; @@ -828,7 +828,7 @@ static void shader_sm4_read_dcl_constant_buffer(struct vkd3d_shader_instruction } }
-static void shader_sm4_read_dcl_sampler(struct vkd3d_shader_instruction *ins, uint32_t opcode, uint32_t opcode_token, +static void shader_sm4_read_dcl_sampler(struct ir_instr *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 *end = &tokens[token_count]; @@ -846,7 +846,7 @@ static bool sm4_parser_is_in_fork_or_join_phase(const struct vkd3d_shader_sm4_pa return sm4->phase == VKD3DSIH_HS_FORK_PHASE || sm4->phase == VKD3DSIH_HS_JOIN_PHASE; }
-static void shader_sm4_read_dcl_index_range(struct vkd3d_shader_instruction *ins, uint32_t opcode, +static void shader_sm4_read_dcl_index_range(struct ir_instr *ins, uint32_t opcode, uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv) { struct vkd3d_shader_index_range *index_range = &ins->declaration.index_range; @@ -946,7 +946,7 @@ static void shader_sm4_read_dcl_index_range(struct vkd3d_shader_instruction *ins } }
-static void shader_sm4_read_dcl_output_topology(struct vkd3d_shader_instruction *ins, uint32_t opcode, +static void shader_sm4_read_dcl_output_topology(struct ir_instr *ins, uint32_t opcode, uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv) { enum vkd3d_sm4_output_primitive_type primitive_type; @@ -961,7 +961,7 @@ static void shader_sm4_read_dcl_output_topology(struct vkd3d_shader_instruction FIXME("Unhandled output primitive type %#x.\n", primitive_type); }
-static void shader_sm4_read_dcl_input_primitive(struct vkd3d_shader_instruction *ins, uint32_t opcode, +static void shader_sm4_read_dcl_input_primitive(struct ir_instr *ins, uint32_t opcode, uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv) { enum vkd3d_sm4_input_primitive_type primitive_type; @@ -985,7 +985,7 @@ static void shader_sm4_read_dcl_input_primitive(struct vkd3d_shader_instruction FIXME("Unhandled input primitive type %#x.\n", primitive_type); }
-static void shader_sm4_read_declaration_count(struct vkd3d_shader_instruction *ins, uint32_t opcode, +static void shader_sm4_read_declaration_count(struct ir_instr *ins, uint32_t opcode, uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv) { ins->declaration.count = *tokens; @@ -993,13 +993,13 @@ static void shader_sm4_read_declaration_count(struct vkd3d_shader_instruction *i priv->p.shader_desc.temp_count = max(priv->p.shader_desc.temp_count, *tokens); }
-static void shader_sm4_read_declaration_dst(struct vkd3d_shader_instruction *ins, uint32_t opcode, +static void shader_sm4_read_declaration_dst(struct ir_instr *ins, uint32_t opcode, uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv) { shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], VKD3D_DATA_FLOAT, &ins->declaration.dst); }
-static void shader_sm4_read_declaration_register_semantic(struct vkd3d_shader_instruction *ins, uint32_t opcode, +static void shader_sm4_read_declaration_register_semantic(struct ir_instr *ins, uint32_t opcode, uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv) { shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], VKD3D_DATA_FLOAT, @@ -1007,14 +1007,14 @@ static void shader_sm4_read_declaration_register_semantic(struct vkd3d_shader_in ins->declaration.register_semantic.sysval_semantic = *tokens; }
-static void shader_sm4_read_dcl_input_ps(struct vkd3d_shader_instruction *ins, uint32_t opcode, +static void shader_sm4_read_dcl_input_ps(struct ir_instr *ins, uint32_t opcode, uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv) { ins->flags = (opcode_token & VKD3D_SM4_INTERPOLATION_MODE_MASK) >> VKD3D_SM4_INTERPOLATION_MODE_SHIFT; shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], VKD3D_DATA_FLOAT, &ins->declaration.dst); }
-static void shader_sm4_read_dcl_input_ps_siv(struct vkd3d_shader_instruction *ins, uint32_t opcode, +static void shader_sm4_read_dcl_input_ps_siv(struct ir_instr *ins, uint32_t opcode, uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv) { ins->flags = (opcode_token & VKD3D_SM4_INTERPOLATION_MODE_MASK) >> VKD3D_SM4_INTERPOLATION_MODE_SHIFT; @@ -1023,7 +1023,7 @@ static void shader_sm4_read_dcl_input_ps_siv(struct vkd3d_shader_instruction *in ins->declaration.register_semantic.sysval_semantic = *tokens; }
-static void shader_sm4_read_dcl_indexable_temp(struct vkd3d_shader_instruction *ins, uint32_t opcode, +static void shader_sm4_read_dcl_indexable_temp(struct ir_instr *ins, uint32_t opcode, uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv) { ins->declaration.indexable_temp.register_idx = *tokens++; @@ -1031,13 +1031,13 @@ static void shader_sm4_read_dcl_indexable_temp(struct vkd3d_shader_instruction * ins->declaration.indexable_temp.component_count = *tokens; }
-static void shader_sm4_read_dcl_global_flags(struct vkd3d_shader_instruction *ins, uint32_t opcode, +static void shader_sm4_read_dcl_global_flags(struct ir_instr *ins, uint32_t opcode, uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv) { ins->flags = (opcode_token & VKD3D_SM4_GLOBAL_FLAGS_MASK) >> VKD3D_SM4_GLOBAL_FLAGS_SHIFT; }
-static void shader_sm5_read_fcall(struct vkd3d_shader_instruction *ins, uint32_t opcode, uint32_t opcode_token, +static void shader_sm5_read_fcall(struct ir_instr *ins, uint32_t opcode, uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv) { struct vkd3d_shader_src_param *src_params = (struct vkd3d_shader_src_param *)ins->src; @@ -1045,20 +1045,20 @@ static void shader_sm5_read_fcall(struct vkd3d_shader_instruction *ins, uint32_t shader_sm4_read_src_param(priv, &tokens, &tokens[token_count], VKD3D_DATA_OPAQUE, &src_params[0]); }
-static void shader_sm5_read_dcl_function_body(struct vkd3d_shader_instruction *ins, uint32_t opcode, +static void shader_sm5_read_dcl_function_body(struct ir_instr *ins, uint32_t opcode, uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv) { ins->declaration.index = *tokens; }
-static void shader_sm5_read_dcl_function_table(struct vkd3d_shader_instruction *ins, uint32_t opcode, +static void shader_sm5_read_dcl_function_table(struct ir_instr *ins, uint32_t opcode, uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv) { ins->declaration.index = *tokens++; FIXME("Ignoring set of function bodies (count %u).\n", *tokens); }
-static void shader_sm5_read_dcl_interface(struct vkd3d_shader_instruction *ins, uint32_t opcode, +static void shader_sm5_read_dcl_interface(struct ir_instr *ins, uint32_t opcode, uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv) { ins->declaration.fp.index = *tokens++; @@ -1068,41 +1068,41 @@ static void shader_sm5_read_dcl_interface(struct vkd3d_shader_instruction *ins, FIXME("Ignoring set of function tables (count %u).\n", ins->declaration.fp.table_count); }
-static void shader_sm5_read_control_point_count(struct vkd3d_shader_instruction *ins, uint32_t opcode, +static void shader_sm5_read_control_point_count(struct ir_instr *ins, uint32_t opcode, uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv) { ins->declaration.count = (opcode_token & VKD3D_SM5_CONTROL_POINT_COUNT_MASK) >> VKD3D_SM5_CONTROL_POINT_COUNT_SHIFT; }
-static void shader_sm5_read_dcl_tessellator_domain(struct vkd3d_shader_instruction *ins, uint32_t opcode, +static void shader_sm5_read_dcl_tessellator_domain(struct ir_instr *ins, uint32_t opcode, uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv) { ins->declaration.tessellator_domain = (opcode_token & VKD3D_SM5_TESSELLATOR_MASK) >> VKD3D_SM5_TESSELLATOR_SHIFT; }
-static void shader_sm5_read_dcl_tessellator_partitioning(struct vkd3d_shader_instruction *ins, uint32_t opcode, +static void shader_sm5_read_dcl_tessellator_partitioning(struct ir_instr *ins, uint32_t opcode, uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv) { ins->declaration.tessellator_partitioning = (opcode_token & VKD3D_SM5_TESSELLATOR_MASK) >> VKD3D_SM5_TESSELLATOR_SHIFT; }
-static void shader_sm5_read_dcl_tessellator_output_primitive(struct vkd3d_shader_instruction *ins, uint32_t opcode, +static void shader_sm5_read_dcl_tessellator_output_primitive(struct ir_instr *ins, uint32_t opcode, uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv) { ins->declaration.tessellator_output_primitive = (opcode_token & VKD3D_SM5_TESSELLATOR_MASK) >> VKD3D_SM5_TESSELLATOR_SHIFT; }
-static void shader_sm5_read_dcl_hs_max_tessfactor(struct vkd3d_shader_instruction *ins, uint32_t opcode, +static void shader_sm5_read_dcl_hs_max_tessfactor(struct ir_instr *ins, uint32_t opcode, uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv) { ins->declaration.max_tessellation_factor = *(float *)tokens; }
-static void shader_sm5_read_dcl_thread_group(struct vkd3d_shader_instruction *ins, uint32_t opcode, +static void shader_sm5_read_dcl_thread_group(struct ir_instr *ins, uint32_t opcode, uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv) { ins->declaration.thread_group_size.x = *tokens++; @@ -1110,7 +1110,7 @@ static void shader_sm5_read_dcl_thread_group(struct vkd3d_shader_instruction *in ins->declaration.thread_group_size.z = *tokens++; }
-static void shader_sm5_read_dcl_uav_raw(struct vkd3d_shader_instruction *ins, uint32_t opcode, uint32_t opcode_token, +static void shader_sm5_read_dcl_uav_raw(struct ir_instr *ins, uint32_t opcode, uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv) { struct vkd3d_shader_raw_resource *resource = &ins->declaration.raw_resource; @@ -1122,7 +1122,7 @@ static void shader_sm5_read_dcl_uav_raw(struct vkd3d_shader_instruction *ins, ui shader_sm4_read_register_space(priv, &tokens, end, &resource->resource.range.space); }
-static void shader_sm5_read_dcl_uav_structured(struct vkd3d_shader_instruction *ins, uint32_t opcode, +static void shader_sm5_read_dcl_uav_structured(struct ir_instr *ins, uint32_t opcode, uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv) { struct vkd3d_shader_structured_resource *resource = &ins->declaration.structured_resource; @@ -1137,7 +1137,7 @@ static void shader_sm5_read_dcl_uav_structured(struct vkd3d_shader_instruction * shader_sm4_read_register_space(priv, &tokens, end, &resource->resource.range.space); }
-static void shader_sm5_read_dcl_tgsm_raw(struct vkd3d_shader_instruction *ins, uint32_t opcode, +static void shader_sm5_read_dcl_tgsm_raw(struct ir_instr *ins, uint32_t opcode, uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv) { shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], VKD3D_DATA_FLOAT, &ins->declaration.tgsm_raw.reg); @@ -1146,7 +1146,7 @@ static void shader_sm5_read_dcl_tgsm_raw(struct vkd3d_shader_instruction *ins, u FIXME("Byte count %u is not multiple of 4.\n", ins->declaration.tgsm_raw.byte_count); }
-static void shader_sm5_read_dcl_tgsm_structured(struct vkd3d_shader_instruction *ins, uint32_t opcode, +static void shader_sm5_read_dcl_tgsm_structured(struct ir_instr *ins, uint32_t opcode, uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv) { shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], VKD3D_DATA_FLOAT, @@ -1157,7 +1157,7 @@ static void shader_sm5_read_dcl_tgsm_structured(struct vkd3d_shader_instruction FIXME("Byte stride %u is not multiple of 4.\n", ins->declaration.tgsm_structured.byte_stride); }
-static void shader_sm5_read_dcl_resource_structured(struct vkd3d_shader_instruction *ins, uint32_t opcode, +static void shader_sm5_read_dcl_resource_structured(struct ir_instr *ins, uint32_t opcode, uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv) { struct vkd3d_shader_structured_resource *resource = &ins->declaration.structured_resource; @@ -1171,7 +1171,7 @@ static void shader_sm5_read_dcl_resource_structured(struct vkd3d_shader_instruct shader_sm4_read_register_space(priv, &tokens, end, &resource->resource.range.space); }
-static void shader_sm5_read_dcl_resource_raw(struct vkd3d_shader_instruction *ins, uint32_t opcode, +static void shader_sm5_read_dcl_resource_raw(struct ir_instr *ins, uint32_t opcode, uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv) { struct vkd3d_shader_raw_resource *resource = &ins->declaration.raw_resource; @@ -1182,7 +1182,7 @@ static void shader_sm5_read_dcl_resource_raw(struct vkd3d_shader_instruction *in shader_sm4_read_register_space(priv, &tokens, end, &resource->resource.range.space); }
-static void shader_sm5_read_sync(struct vkd3d_shader_instruction *ins, uint32_t opcode, uint32_t opcode_token, +static void shader_sm5_read_sync(struct ir_instr *ins, uint32_t opcode, uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv) { ins->flags = (opcode_token & VKD3D_SM5_SYNC_FLAGS_MASK) >> VKD3D_SM5_SYNC_FLAGS_SHIFT; @@ -2051,7 +2051,7 @@ static bool shader_sm4_read_dst_param(struct vkd3d_shader_sm4_parser *priv, cons return true; }
-static void shader_sm4_read_instruction_modifier(DWORD modifier, struct vkd3d_shader_instruction *ins) +static void shader_sm4_read_instruction_modifier(DWORD modifier, struct ir_instr *ins) { enum vkd3d_sm4_instruction_modifier modifier_type = modifier & VKD3D_SM4_MODIFIER_MASK;
@@ -2135,7 +2135,7 @@ static void shader_sm4_read_instruction_modifier(DWORD modifier, struct vkd3d_sh } }
-static void shader_sm4_read_instruction(struct vkd3d_shader_sm4_parser *sm4, struct vkd3d_shader_instruction *ins) +static void shader_sm4_read_instruction(struct vkd3d_shader_sm4_parser *sm4, struct ir_instr *ins) { const struct vkd3d_sm4_opcode_info *opcode_info; uint32_t opcode_token, opcode, previous_token; @@ -2433,8 +2433,8 @@ int vkd3d_shader_sm4_parser_create(const struct vkd3d_shader_compile_info *compi { struct vkd3d_shader_instruction_array *instructions; struct vkd3d_shader_desc *shader_desc; - struct vkd3d_shader_instruction *ins; struct vkd3d_shader_sm4_parser *sm4; + struct ir_instr *ins; int ret;
if (!(sm4 = vkd3d_calloc(1, sizeof(*sm4)))) diff --git a/libs/vkd3d-shader/vkd3d_shader_main.c b/libs/vkd3d-shader/vkd3d_shader_main.c index f26050bb0..06b6f3dc1 100644 --- a/libs/vkd3d-shader/vkd3d_shader_main.c +++ b/libs/vkd3d-shader/vkd3d_shader_main.c @@ -717,7 +717,7 @@ static struct vkd3d_shader_descriptor_info *vkd3d_shader_scan_get_uav_descriptor return NULL; }
-static bool vkd3d_shader_instruction_is_uav_read(const struct vkd3d_shader_instruction *instruction) +static bool ir_instr_is_uav_read(const struct ir_instr *instruction) { enum vkd3d_shader_opcode handler_idx = instruction->handler_idx; return (VKD3DSIH_ATOMIC_AND <= handler_idx && handler_idx <= VKD3DSIH_ATOMIC_XOR) @@ -739,7 +739,7 @@ static void vkd3d_shader_scan_record_uav_read(struct vkd3d_shader_scan_context * d->flags |= VKD3D_SHADER_DESCRIPTOR_INFO_FLAG_UAV_READ; }
-static bool vkd3d_shader_instruction_is_uav_counter(const struct vkd3d_shader_instruction *instruction) +static bool ir_instr_is_uav_counter(const struct ir_instr *instruction) { enum vkd3d_shader_opcode handler_idx = instruction->handler_idx; return handler_idx == VKD3DSIH_IMM_ATOMIC_ALLOC @@ -758,7 +758,7 @@ static void vkd3d_shader_scan_record_uav_counter(struct vkd3d_shader_scan_contex d->flags |= VKD3D_SHADER_DESCRIPTOR_INFO_FLAG_UAV_COUNTER; }
-static bool vkd3d_shader_instruction_is_uav_atomic_op(const struct vkd3d_shader_instruction *instruction) +static bool ir_instr_is_uav_atomic_op(const struct ir_instr *instruction) { enum vkd3d_shader_opcode handler_idx = instruction->handler_idx; return (VKD3DSIH_ATOMIC_AND <= handler_idx && handler_idx <= VKD3DSIH_ATOMIC_XOR) @@ -823,7 +823,7 @@ static bool vkd3d_shader_scan_add_uav_range(struct vkd3d_shader_scan_context *co }
static void vkd3d_shader_scan_constant_buffer_declaration(struct vkd3d_shader_scan_context *context, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { const struct vkd3d_shader_constant_buffer *cb = &instruction->declaration.cb;
@@ -835,7 +835,7 @@ static void vkd3d_shader_scan_constant_buffer_declaration(struct vkd3d_shader_sc }
static void vkd3d_shader_scan_sampler_declaration(struct vkd3d_shader_scan_context *context, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { const struct vkd3d_shader_sampler *sampler = &instruction->declaration.sampler; unsigned int flags; @@ -871,7 +871,7 @@ static void vkd3d_shader_scan_resource_declaration(struct vkd3d_shader_scan_cont }
static void vkd3d_shader_scan_typed_resource_declaration(struct vkd3d_shader_scan_context *context, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { const struct vkd3d_shader_semantic *semantic = &instruction->declaration.semantic; enum vkd3d_shader_resource_data_type resource_data_type; @@ -940,7 +940,7 @@ static void vkd3d_shader_scan_error(struct vkd3d_shader_scan_context *context, }
static int vkd3d_shader_scan_instruction(struct vkd3d_shader_scan_context *context, - const struct vkd3d_shader_instruction *instruction) + const struct ir_instr *instruction) { struct vkd3d_shader_cf_info *cf_info; unsigned int i; @@ -1087,7 +1087,7 @@ static int vkd3d_shader_scan_instruction(struct vkd3d_shader_scan_context *conte break; }
- if (vkd3d_shader_instruction_is_uav_read(instruction)) + if (ir_instr_is_uav_read(instruction)) { for (i = 0; i < instruction->dst_count; ++i) { @@ -1101,10 +1101,10 @@ static int vkd3d_shader_scan_instruction(struct vkd3d_shader_scan_context *conte } }
- if (vkd3d_shader_instruction_is_uav_counter(instruction)) + if (ir_instr_is_uav_counter(instruction)) vkd3d_shader_scan_record_uav_counter(context, &instruction->src[0].reg);
- if (vkd3d_shader_instruction_is_uav_atomic_op(instruction)) + if (ir_instr_is_uav_atomic_op(instruction)) { for (i = 0; i < instruction->dst_count; ++i) { @@ -1122,8 +1122,8 @@ static int scan_with_parser(const struct vkd3d_shader_compile_info *compile_info { struct vkd3d_shader_scan_descriptor_info *scan_descriptor_info; struct vkd3d_shader_scan_signature_info *signature_info; - struct vkd3d_shader_instruction *instruction; struct vkd3d_shader_scan_context context; + struct ir_instr *instruction; int ret = VKD3D_OK; unsigned int i;
@@ -1859,7 +1859,7 @@ static struct vkd3d_shader_src_param *shader_instruction_array_clone_src_params( bool shader_instruction_array_clone_instruction(struct vkd3d_shader_instruction_array *instructions, unsigned int dst, unsigned int src) { - struct vkd3d_shader_instruction *ins = &instructions->elements[dst]; + struct ir_instr *ins = &instructions->elements[dst];
*ins = instructions->elements[src];
diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h index 85fca9642..82fdf9ba2 100644 --- a/libs/vkd3d-shader/vkd3d_shader_private.h +++ b/libs/vkd3d-shader/vkd3d_shader_private.h @@ -922,7 +922,7 @@ struct vkd3d_shader_primitive_type unsigned int patch_vertex_count; };
-struct vkd3d_shader_instruction +struct ir_instr { enum vkd3d_shader_opcode handler_idx; DWORD flags; @@ -962,7 +962,7 @@ struct vkd3d_shader_instruction } declaration; };
-static inline bool vkd3d_shader_instruction_has_texel_offset(const struct vkd3d_shader_instruction *ins) +static inline bool ir_instr_has_texel_offset(const struct ir_instr *ins) { return ins->texel_offset.u || ins->texel_offset.v || ins->texel_offset.w; } @@ -1021,7 +1021,7 @@ static inline struct vkd3d_shader_dst_param *shader_dst_param_allocator_get(
struct vkd3d_shader_instruction_array { - struct vkd3d_shader_instruction *elements; + struct ir_instr *elements; size_t capacity; size_t count;
This merge request was approved by Giovanni Mascellani.
I'm tempted to suggest "vkil_instruction". "vkil" for "vkd3d-shader intermediate language", of course ;), and "instruction" because I do tend to prefer using proper words where reasonably possible.
I'm tempted to suggest "vkil_instruction". "vkil" for "vkd3d-shader intermediate language", of course ;), and "instruction" because I do tend to prefer using proper words where reasonably possible.
That seems fine to me. I'm a little concerned that "vkil" implies Vulkan, which isn't really the case (granted, we already crossed that line with "vkd3d", but we needn't cross it again), but it's probably good enough anyway.
I prefer `vsil_instruction` to avoid, as Zeb said, the implication it mainly contains Vulkan objects.
Are there differences between 'intermediate language' and 'intermediate representation' that favour using IL here?
I prefer `vsil_instruction` to avoid, as Zeb said, the implication it mainly contains Vulkan objects.
Are there differences between 'intermediate language' and 'intermediate representation' that favour using IL here?
I don't think so—Henri said on IRC it was mostly for similarity with وکیل, to appeal to my interest in puns and non-utilitarian names, but I didn't catch it because I don't actually know Semitic languages (just 'vizier') Of course, for that matter there's also وصل (wṣl / vasl, "unite/connect").
But yeah, realistically something like vsir/vsil is probably the best/clearest option.
For consistency I favour `vsir_instruction` over `vsil_instruction`.
I'm not terribly convinced this is something that needs changing. Personally I don't particularly care about identifier length at all, slightly preferring more descriptive names even. I'm not all that convinced about distinguishing between external and internal API based on naming either—essentially, something is internal until we decide to export it—but I'll grant that there are fewer constraints on names for purely internal API.
I'm willing to humour people on this, but that would be predicated on there being a clear consensus on the replacement...
If we do end up doing something like this it would be very helpful to hold it until the SM 6 work is mostly upstream.
I'm not terribly convinced this is something that needs changing. Personally I don't particularly care about identifier length at all, slightly preferring more descriptive names even.
I don't want to push this to an annoying degree, but I do care. Long names take longer to type, and they increase the likelihood that lines will need to wrap, which I think makes them categorically less readable. Autocomplete can help, especially if your editor supports partial autocomplete, but it can't really help if your identifiers share common prefixes (Vulkan "vk" vs. "vkd3d_" vs. "vkd3d_shader_"). The key sequence 'd3d' is also kind of nasty to qwerty keyboards [which is unavoidable to a degree in this line of work, but still.]
I'm not all that convinced about distinguishing between external and internal API based on naming either—essentially, something is internal until we decide to export it—but I'll grant that there are fewer constraints on names for purely internal API.
The reason I like this distinction is that it helps reading comprehension. It makes it easier to understand the scope of the code you're working with and how it fits together [which is a bit of a vague statement but I think still true]. It makes it clear what you can and can't refactor and why a function call or whatever is arranged the way it is.
Currently if I want that I have to intrinsically remember what is and isn't API, which is hard and I still have to look up identifiers sometimes, even after working on this code base for quite a while. [E.g. enum vkd3d_shader_type, enum vkd3d_shader_register_precision, enum vkd3d_data_type, enum vkd3d_shader_input_sysval_semantic, struct vkd3d_shader_version, struct vkd3d_shader_desc, look like public API but aren't.]
I'd also like to point out that the naming of this IR layer doesn't really make it clear that it is an IR layer, that's something I'd like to change.
If we do end up doing something like this it would be very helpful to hold it until the SM 6 work is mostly upstream.
Yeah, that's fair. I usually err on the side of doing refactors first, to lessen the amount of code they thrash, but this is definitely creating more work for other people at this rate.
On Thu Jul 13 14:21:07 2023 +0000, Zebediah Figura wrote:
I'm not terribly convinced this is something that needs changing.
Personally I don't particularly care about identifier length at all, slightly preferring more descriptive names even. I don't want to push this to an annoying degree, but I do care. Long names take longer to type, and they increase the likelihood that lines will need to wrap, which I think makes them categorically less readable. Autocomplete can help, especially if your editor supports partial autocomplete, but it can't really help if your identifiers share common prefixes (Vulkan "vk" vs. "vkd3d_" vs. "vkd3d_shader_"). The key sequence 'd3d' is also kind of nasty to qwerty keyboards [which is unavoidable to a degree in this line of work, but still.]
I'm not all that convinced about distinguishing between external and
internal API based on naming either—essentially, something is internal until we decide to export it—but I'll grant that there are fewer constraints on names for purely internal API. The reason I like this distinction is that it helps reading comprehension. It makes it easier to understand the scope of the code you're working with and how it fits together [which is a bit of a vague statement but I think still true]. It makes it clear what you can and can't refactor and why a function call or whatever is arranged the way it is. Currently if I want that I have to intrinsically remember what is and isn't API, which is hard and I still have to look up identifiers sometimes, even after working on this code base for quite a while. [E.g. enum vkd3d_shader_type, enum vkd3d_shader_register_precision, enum vkd3d_data_type, enum vkd3d_shader_input_sysval_semantic, struct vkd3d_shader_version, struct vkd3d_shader_desc, look like public API but aren't.] I'd also like to point out that the naming of this IR layer doesn't really make it clear that it is an IR layer, that's something I'd like to change.
If we do end up doing something like this it would be very helpful to
hold it until the SM 6 work is mostly upstream. Yeah, that's fair. I usually err on the side of doing refactors first, to lessen the amount of code they thrash, but this is definitely creating more work for other people at this rate.
For the record, I happen to agree with Zeb here, though not with a very strong opinion. Meaning that I also believe that shortening that identifier can save me a little amount of work, but not more than a little one.
This merge request was closed by Zebediah Figura.