mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 13:18:04 +02:00
brw: Let the builder fill the sources of brw_inst
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36730>
This commit is contained in:
parent
506fce20f0
commit
3ef86a8d00
3 changed files with 13 additions and 10 deletions
|
|
@ -328,15 +328,18 @@ public:
|
||||||
emit(enum opcode opcode, const brw_reg &dst, const brw_reg &src0,
|
emit(enum opcode opcode, const brw_reg &dst, const brw_reg &src0,
|
||||||
const brw_reg &src1, const brw_reg &src2) const
|
const brw_reg &src1, const brw_reg &src2) const
|
||||||
{
|
{
|
||||||
brw_reg srcs[] = { src0, src1, src2 };
|
brw_inst *inst = brw_new_inst(*shader, opcode, dispatch_width(), dst, 3);
|
||||||
|
inst->src[0] = src0;
|
||||||
|
inst->src[1] = src1;
|
||||||
|
inst->src[2] = src2;
|
||||||
|
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
case BRW_OPCODE_BFE:
|
case BRW_OPCODE_BFE:
|
||||||
case BRW_OPCODE_BFI2:
|
case BRW_OPCODE_BFI2:
|
||||||
case BRW_OPCODE_MAD:
|
case BRW_OPCODE_MAD:
|
||||||
case BRW_OPCODE_LRP:
|
case BRW_OPCODE_LRP:
|
||||||
for (int i = 0; i < 3; i++)
|
for (unsigned i = 0; i < 3; i++)
|
||||||
srcs[i] = fix_3src_operand(srcs[i]);
|
inst->src[i] = fix_3src_operand(inst->src[i]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
@ -344,7 +347,7 @@ public:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return emit(brw_new_inst(*shader, opcode, dispatch_width(), dst, srcs, 3));
|
return emit(inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -361,7 +364,10 @@ public:
|
||||||
if (num_srcs == 3) {
|
if (num_srcs == 3) {
|
||||||
return emit(opcode, dst, srcs[0], srcs[1], srcs[2]);
|
return emit(opcode, dst, srcs[0], srcs[1], srcs[2]);
|
||||||
} else {
|
} else {
|
||||||
return emit(brw_new_inst(*shader, opcode, dispatch_width(), dst, srcs, num_srcs));
|
brw_inst *inst = brw_new_inst(*shader, opcode, dispatch_width(), dst, num_srcs);
|
||||||
|
for (unsigned i = 0; i < num_srcs; i++)
|
||||||
|
inst->src[i] = srcs[i];
|
||||||
|
return emit(inst);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,16 +29,13 @@ brw_alloc_inst(brw_shader &s, unsigned num_srcs)
|
||||||
|
|
||||||
brw_inst *
|
brw_inst *
|
||||||
brw_new_inst(brw_shader &s, enum opcode opcode, unsigned exec_size,
|
brw_new_inst(brw_shader &s, enum opcode opcode, unsigned exec_size,
|
||||||
const brw_reg &dst, const brw_reg srcs[], unsigned num_srcs)
|
const brw_reg &dst, unsigned num_srcs)
|
||||||
{
|
{
|
||||||
assert(exec_size != 0);
|
assert(exec_size != 0);
|
||||||
assert(dst.file != IMM && dst.file != UNIFORM);
|
assert(dst.file != IMM && dst.file != UNIFORM);
|
||||||
|
|
||||||
brw_inst *inst = brw_alloc_inst(s, num_srcs);
|
brw_inst *inst = brw_alloc_inst(s, num_srcs);
|
||||||
|
|
||||||
for (unsigned i = 0; i < num_srcs; i++)
|
|
||||||
inst->src[i] = srcs[i];
|
|
||||||
|
|
||||||
inst->opcode = opcode;
|
inst->opcode = opcode;
|
||||||
inst->dst = dst;
|
inst->dst = dst;
|
||||||
inst->exec_size = exec_size;
|
inst->exec_size = exec_size;
|
||||||
|
|
|
||||||
|
|
@ -372,5 +372,5 @@ bool brw_insert_load_reg(brw_shader &s);
|
||||||
bool brw_lower_load_reg(brw_shader &s);
|
bool brw_lower_load_reg(brw_shader &s);
|
||||||
|
|
||||||
brw_inst *brw_new_inst(brw_shader &s, enum opcode opcode, unsigned exec_size,
|
brw_inst *brw_new_inst(brw_shader &s, enum opcode opcode, unsigned exec_size,
|
||||||
const brw_reg &dst, const brw_reg srcs[], unsigned num_srcs);
|
const brw_reg &dst, unsigned num_srcs);
|
||||||
brw_inst *brw_clone_inst(brw_shader &s, const brw_inst *inst);
|
brw_inst *brw_clone_inst(brw_shader &s, const brw_inst *inst);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue