mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/tpf: Do not emit HLSL_IR_CONSTANT instructions.
Since constants are now inlined.
This commit is contained in:
parent
a471c5567a
commit
7c360330d7
Notes:
Alexandre Julliard
2023-05-29 22:32:48 +02:00
Approved-by: Zebediah Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/215
@ -3004,6 +3004,10 @@ static void allocate_temp_registers_recurse(struct hlsl_ctx *ctx,
|
||||
|
||||
LIST_FOR_EACH_ENTRY(instr, &block->instrs, struct hlsl_ir_node, entry)
|
||||
{
|
||||
/* In SM4 all constants are inlined. */
|
||||
if (ctx->profile->major_version >= 4 && instr->type == HLSL_IR_CONSTANT)
|
||||
continue;
|
||||
|
||||
if (!instr->reg.allocated && instr->last_read)
|
||||
{
|
||||
instr->reg = allocate_numeric_registers_for_type(ctx, allocator, instr->index, instr->last_read,
|
||||
|
@ -4003,24 +4003,6 @@ static void write_sm4_binary_op_with_two_destinations(struct vkd3d_bytecode_buff
|
||||
write_sm4_instruction(buffer, &instr);
|
||||
}
|
||||
|
||||
static void write_sm4_constant(struct hlsl_ctx *ctx,
|
||||
struct vkd3d_bytecode_buffer *buffer, const struct hlsl_ir_constant *constant)
|
||||
{
|
||||
const unsigned int dimx = constant->node.data_type->dimx;
|
||||
struct sm4_instruction instr;
|
||||
|
||||
memset(&instr, 0, sizeof(instr));
|
||||
instr.opcode = VKD3D_SM4_OP_MOV;
|
||||
|
||||
sm4_dst_from_node(&instr.dsts[0], &constant->node);
|
||||
instr.dst_count = 1;
|
||||
|
||||
sm4_src_from_constant_value(&instr.srcs[0], &constant->value, dimx, instr.dsts[0].writemask);
|
||||
instr.src_count = 1;
|
||||
|
||||
write_sm4_instruction(buffer, &instr);
|
||||
}
|
||||
|
||||
static void write_sm4_ld(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *buffer,
|
||||
const struct hlsl_type *resource_type, const struct hlsl_ir_node *dst,
|
||||
const struct hlsl_deref *resource, const struct hlsl_ir_node *coords,
|
||||
@ -5097,16 +5079,19 @@ static void write_sm4_block(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *
|
||||
}
|
||||
|
||||
assert(instr->data_type->class == HLSL_CLASS_SCALAR || instr->data_type->class == HLSL_CLASS_VECTOR);
|
||||
|
||||
if (!instr->reg.allocated)
|
||||
{
|
||||
assert(instr->type == HLSL_IR_CONSTANT);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
switch (instr->type)
|
||||
{
|
||||
case HLSL_IR_CALL:
|
||||
vkd3d_unreachable();
|
||||
|
||||
case HLSL_IR_CONSTANT:
|
||||
write_sm4_constant(ctx, buffer, hlsl_ir_constant(instr));
|
||||
break;
|
||||
vkd3d_unreachable();
|
||||
|
||||
case HLSL_IR_EXPR:
|
||||
write_sm4_expr(ctx, buffer, hlsl_ir_expr(instr));
|
||||
|
Loading…
Reference in New Issue
Block a user