mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 00:00:11 +01:00
i965: Extract scalar region checking logic
There are currently 2 users of this functionality. I have 2 more users coming up, and having a simple function makes the results much cleaner. The existing interface semantics was proposed by Matt. v2 (Ken): Rename to region_matches()/has_scalar_region(). Signed-off-by: Ben Widawsky <ben@bwidawsk.net> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
parent
9394f58383
commit
169d7e5cb1
3 changed files with 15 additions and 7 deletions
|
|
@ -1893,9 +1893,7 @@ void gen4_math(struct brw_compile *p,
|
|||
struct brw_context *brw = p->brw;
|
||||
brw_inst *insn = next_insn(p, BRW_OPCODE_SEND);
|
||||
unsigned data_type;
|
||||
if (src.vstride == BRW_VERTICAL_STRIDE_0 &&
|
||||
src.width == BRW_WIDTH_1 &&
|
||||
src.hstride == BRW_HORIZONTAL_STRIDE_0) {
|
||||
if (has_scalar_region(src)) {
|
||||
data_type = BRW_MATH_DATA_SCALAR;
|
||||
} else {
|
||||
data_type = BRW_MATH_DATA_VECTOR;
|
||||
|
|
|
|||
|
|
@ -1347,10 +1347,7 @@ fs_generator::generate_set_omask(fs_inst *inst,
|
|||
mask.width == BRW_WIDTH_8 &&
|
||||
mask.hstride == BRW_HORIZONTAL_STRIDE_1);
|
||||
|
||||
bool stride_0_1_0 =
|
||||
(mask.vstride == BRW_VERTICAL_STRIDE_0 &&
|
||||
mask.width == BRW_WIDTH_1 &&
|
||||
mask.hstride == BRW_HORIZONTAL_STRIDE_0);
|
||||
bool stride_0_1_0 = has_scalar_region(mask);
|
||||
|
||||
assert(stride_8_8_1 || stride_0_1_0);
|
||||
assert(dst.type == BRW_REGISTER_TYPE_UW);
|
||||
|
|
|
|||
|
|
@ -902,6 +902,19 @@ brw_indirect(unsigned addr_subnr, int offset)
|
|||
return ptr;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
region_matches(struct brw_reg reg, enum brw_vertical_stride v,
|
||||
enum brw_width w, enum brw_horizontal_stride h)
|
||||
{
|
||||
return reg.vstride == v &&
|
||||
reg.width == w &&
|
||||
reg.hstride == h;
|
||||
}
|
||||
|
||||
#define has_scalar_region(reg) \
|
||||
region_matches(reg, BRW_VERTICAL_STRIDE_0, BRW_WIDTH_1, \
|
||||
BRW_HORIZONTAL_STRIDE_0)
|
||||
|
||||
/* brw_packed_float.c */
|
||||
int brw_float_to_vf(float f);
|
||||
float brw_vf_to_float(unsigned char vf);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue