mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 08:50:13 +01:00
nir/serialize: don't serialize mode for deref non-cast instructions
It can be derived from src and var. This frees 10 bits in the header that will be used later. "mode" is moved in the structure, because those bits will be used for something else later. Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
This commit is contained in:
parent
2286340fde
commit
ca201bfe70
1 changed files with 12 additions and 5 deletions
|
|
@ -624,8 +624,8 @@ union packed_instr {
|
|||
struct {
|
||||
unsigned instr_type:4;
|
||||
unsigned deref_type:3;
|
||||
unsigned mode:10;
|
||||
unsigned cast_type_same_as_last:1;
|
||||
unsigned mode:10;
|
||||
unsigned _pad:6;
|
||||
unsigned dest:8;
|
||||
} deref;
|
||||
|
|
@ -851,10 +851,11 @@ write_deref(write_ctx *ctx, const nir_deref_instr *deref)
|
|||
|
||||
header.deref.instr_type = deref->instr.type;
|
||||
header.deref.deref_type = deref->deref_type;
|
||||
header.deref.mode = deref->mode;
|
||||
|
||||
if (deref->deref_type == nir_deref_type_cast)
|
||||
if (deref->deref_type == nir_deref_type_cast) {
|
||||
header.deref.mode = deref->mode;
|
||||
header.deref.cast_type_same_as_last = deref->type == ctx->last_type;
|
||||
}
|
||||
|
||||
write_dest(ctx, &deref->dest, header);
|
||||
|
||||
|
|
@ -900,11 +901,10 @@ read_deref(read_ctx *ctx, union packed_instr header)
|
|||
|
||||
read_dest(ctx, &deref->dest, &deref->instr, header);
|
||||
|
||||
deref->mode = header.deref.mode;
|
||||
|
||||
if (deref_type == nir_deref_type_var) {
|
||||
deref->var = read_object(ctx);
|
||||
deref->type = deref->var->type;
|
||||
deref->mode = deref->var->data.mode;
|
||||
return deref;
|
||||
}
|
||||
|
||||
|
|
@ -947,6 +947,13 @@ read_deref(read_ctx *ctx, union packed_instr header)
|
|||
unreachable("Invalid deref type");
|
||||
}
|
||||
|
||||
if (deref->deref_type == nir_deref_type_cast) {
|
||||
deref->mode = header.deref.mode;
|
||||
} else {
|
||||
assert(deref->parent.is_ssa);
|
||||
deref->mode = nir_instr_as_deref(deref->parent.ssa->parent_instr)->mode;
|
||||
}
|
||||
|
||||
return deref;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue