mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-05 16:50:37 +02:00
pan/bi: Stop extracting the immediate attribute index from src0
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7636>
This commit is contained in:
parent
549a59f66e
commit
fee4e991fe
5 changed files with 36 additions and 20 deletions
|
|
@ -863,7 +863,9 @@ bi_pack_add(bi_clause *clause, bi_bundle bundle, bi_registers *regs, gl_shader_s
|
|||
pan_pack_add_isub_s32(clause, bundle.add, regs);
|
||||
}
|
||||
case BI_LOAD_ATTR:
|
||||
return pan_pack_add_ld_attr_imm(clause, bundle.add, regs);
|
||||
return bundle.add->attribute.immediate ?
|
||||
pan_pack_add_ld_attr_imm(clause, bundle.add, regs) :
|
||||
pan_pack_add_ld_attr(clause, bundle.add, regs);
|
||||
case BI_LOAD:
|
||||
case BI_LOAD_UNIFORM:
|
||||
assert(u32 || s32 || f32);
|
||||
|
|
@ -877,7 +879,9 @@ bi_pack_add(bi_clause *clause, bi_bundle bundle, bi_registers *regs, gl_shader_s
|
|||
case BI_LOAD_VAR:
|
||||
return bi_pack_add_ld_var(clause, bundle.add, regs);
|
||||
case BI_LOAD_VAR_ADDRESS:
|
||||
return pan_pack_add_lea_attr_imm(clause, bundle.add, regs);
|
||||
return bundle.add->attribute.immediate ?
|
||||
pan_pack_add_lea_attr_imm(clause, bundle.add, regs) :
|
||||
pan_pack_add_lea_attr(clause, bundle.add, regs);
|
||||
case BI_LOAD_TILE:
|
||||
return pan_pack_add_ld_tile(clause, bundle.add, regs);
|
||||
case BI_MINMAX:
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@ bi_print_load_vary(struct bi_load_vary *load, FILE *fp)
|
|||
case BIFROST_UPDATE_STORE: fprintf(fp, ".store"); break;
|
||||
case BIFROST_UPDATE_RETRIEVE: fprintf(fp, ".retrieve"); break;
|
||||
case BIFROST_UPDATE_CONDITIONAL: fprintf(fp, ".conditional"); break;
|
||||
case BIFROST_UPDATE_CLOBBER: fprintf(fp, ".conditional"); break;
|
||||
case BIFROST_UPDATE_CLOBBER: fprintf(fp, ".clobber"); break;
|
||||
default: unreachable("Invalid update mode");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,14 +76,11 @@ emit_jump(bi_context *ctx, nir_jump_instr *instr)
|
|||
}
|
||||
|
||||
static bi_instruction
|
||||
bi_load(enum bi_class T, nir_intrinsic_instr *instr)
|
||||
bi_load(enum bi_class T, nir_intrinsic_instr *instr, unsigned offset_idx)
|
||||
{
|
||||
bi_instruction load = {
|
||||
.type = T,
|
||||
.vector_channels = instr->num_components,
|
||||
.src = { BIR_INDEX_CONSTANT },
|
||||
.src_types = { nir_type_uint32 },
|
||||
.constant = { .u64 = nir_intrinsic_base(instr) },
|
||||
};
|
||||
|
||||
const nir_intrinsic_info *info = &nir_intrinsic_infos[instr->intrinsic];
|
||||
|
|
@ -96,10 +93,14 @@ bi_load(enum bi_class T, nir_intrinsic_instr *instr)
|
|||
|
||||
nir_src *offset = nir_get_io_offset_src(instr);
|
||||
|
||||
if (nir_src_is_const(*offset))
|
||||
load.constant.u64 += nir_src_as_uint(*offset);
|
||||
else
|
||||
load.src[0] = pan_src_index(offset);
|
||||
load.src_types[offset_idx] = nir_type_uint32;
|
||||
if (nir_src_is_const(*offset)) {
|
||||
load.src[offset_idx] = BIR_INDEX_CONSTANT | 0;
|
||||
load.constant.u64 = nir_src_as_uint(*offset) +
|
||||
nir_intrinsic_base(instr);
|
||||
} else {
|
||||
load.src[offset_idx] = pan_src_index(offset);
|
||||
}
|
||||
|
||||
return load;
|
||||
}
|
||||
|
|
@ -397,14 +398,21 @@ bi_emit_frag_out(bi_context *ctx, nir_intrinsic_instr *instr)
|
|||
static bi_instruction
|
||||
bi_load_with_r61(enum bi_class T, nir_intrinsic_instr *instr)
|
||||
{
|
||||
bi_instruction ld = bi_load(T, instr);
|
||||
ld.src[1] = BIR_INDEX_REGISTER | 61; /* TODO: RA */
|
||||
ld.src[2] = BIR_INDEX_REGISTER | 62;
|
||||
bi_instruction ld = bi_load(T, instr, 2);
|
||||
ld.src[0] = BIR_INDEX_REGISTER | 61; /* TODO: RA */
|
||||
ld.src[1] = BIR_INDEX_REGISTER | 62;
|
||||
ld.src_types[0] = nir_type_uint32;
|
||||
ld.src_types[1] = nir_type_uint32;
|
||||
ld.src_types[2] = nir_type_uint32;
|
||||
ld.format = instr->intrinsic == nir_intrinsic_store_output ?
|
||||
nir_intrinsic_src_type(instr) :
|
||||
nir_intrinsic_dest_type(instr);
|
||||
nir_intrinsic_src_type(instr) :
|
||||
nir_intrinsic_dest_type(instr);
|
||||
|
||||
/* Promote to immediate instruction if we can */
|
||||
if (ld.src[0] & BIR_INDEX_CONSTANT && ld.constant.u64 < 16) {
|
||||
ld.attribute.immediate = true;
|
||||
ld.attribute.index = ld.constant.u64;
|
||||
}
|
||||
|
||||
return ld;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -308,6 +308,11 @@ struct bi_special {
|
|||
enum bi_subgroup_sz subgroup_sz;
|
||||
};
|
||||
|
||||
struct bi_attribute {
|
||||
unsigned index;
|
||||
bool immediate;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct list_head link; /* Must be first */
|
||||
enum bi_class type;
|
||||
|
|
@ -405,6 +410,7 @@ typedef struct {
|
|||
struct bi_bitwise bitwise;
|
||||
struct bi_texture texture;
|
||||
struct bi_special special;
|
||||
struct bi_attribute attribute;
|
||||
};
|
||||
} bi_instruction;
|
||||
|
||||
|
|
|
|||
|
|
@ -391,7 +391,7 @@ def pack_derived(pos, exprs, imm_map, body, pack_exprs):
|
|||
# lookup the value in the IR, performing adjustments as needed
|
||||
|
||||
IMMEDIATE_TABLE = {
|
||||
'attribute_index': 'bi_get_immediate(ins, 0)',
|
||||
'attribute_index': 'ins->attribute.index',
|
||||
'varying_index': 'ins->texture.varying_index',
|
||||
'index': 'ins->load_vary.index',
|
||||
'texture_index': 'ins->texture.texture_index',
|
||||
|
|
@ -452,8 +452,6 @@ def pack_variant(opname, states):
|
|||
if staging in ["r", "rw"]:
|
||||
offset += 1
|
||||
|
||||
offset += len(set(["attribute_index"]) & set([x[0] for x in states[0][1].get("immediates", [])]))
|
||||
|
||||
pack_sources(states[0][1].get("srcs", []), common_body, pack_exprs, offset)
|
||||
|
||||
modifiers_handled = []
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue