diff options
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_eu_emit.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 5 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_reg.h | 13 |
3 files changed, 15 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index 8f15db9f728..c26bed2dee3 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -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; diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp index ab848f1714a..d473739452d 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp @@ -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); diff --git a/src/mesa/drivers/dri/i965/brw_reg.h b/src/mesa/drivers/dri/i965/brw_reg.h index 76d3248bd7e..782cae18fc7 100644 --- a/src/mesa/drivers/dri/i965/brw_reg.h +++ b/src/mesa/drivers/dri/i965/brw_reg.h @@ -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); |