intel/brw: Replace some fs_reg constructors with functions

Create three helper functions for ATTR, UNIFORM and VGRF creation.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29791>
This commit is contained in:
Caio Oliveira
2024-06-18 15:25:22 -07:00
committed by Marge Bot
parent 06fbab3a74
commit d00329e821
17 changed files with 111 additions and 119 deletions
+2 -39
View File
@@ -538,34 +538,15 @@ fs_inst::can_change_types() const
!src[1].abs && !src[1].negate && src[1].file != ATTR));
}
void
fs_reg::init()
/** Generic unset register constructor. */
fs_reg::fs_reg()
{
memset((void*)this, 0, sizeof(*this));
type = BRW_TYPE_UD;
stride = 1;
}
/** Generic unset register constructor. */
fs_reg::fs_reg()
{
init();
this->file = BAD_FILE;
}
fs_reg::fs_reg(struct ::brw_reg reg) :
brw_reg(reg)
{
this->offset = 0;
this->stride = 1;
if (this->file == IMM &&
(this->type != BRW_TYPE_V &&
this->type != BRW_TYPE_UV &&
this->type != BRW_TYPE_VF)) {
this->stride = 0;
}
}
bool
brw_reg::equals(const brw_reg &r) const
{
@@ -1070,24 +1051,6 @@ fs_inst::has_sampler_residency() const
}
}
fs_reg::fs_reg(enum brw_reg_file file, unsigned nr)
{
init();
this->file = file;
this->nr = nr;
this->type = BRW_TYPE_F;
this->stride = (file == UNIFORM ? 0 : 1);
}
fs_reg::fs_reg(enum brw_reg_file file, unsigned nr, enum brw_reg_type type)
{
init();
this->file = file;
this->nr = nr;
this->type = type;
this->stride = (file == UNIFORM ? 0 : 1);
}
/* For SIMD16, we need to follow from the uniform setup of SIMD8 dispatch.
* This brings in those uniform definitions
*/