diff options
author | Matt Turner <[email protected]> | 2014-11-28 12:21:03 -0800 |
---|---|---|
committer | Matt Turner <[email protected]> | 2014-12-05 09:49:42 -0800 |
commit | db186f2a38120860710fa98375589599654d694e (patch) | |
tree | 5994c1869bcd27b8a6b9a74cfaf56bee132b3fe5 /src/mesa | |
parent | 2881b123d00562fee8b7d2b4f7825f89a73e0d9f (diff) |
i965/fs: Make brw_reg_from_fs_reg static and remove prototype.
And move it above its first use in brw_fs_generator.cpp.
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.h | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 140 |
2 files changed, 70 insertions, 72 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index c7bc55cb929..daaa89fe98f 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -810,5 +810,3 @@ private: bool brw_do_channel_expressions(struct exec_list *instructions); bool brw_do_vector_splitting(struct exec_list *instructions); - -struct brw_reg brw_reg_from_fs_reg(fs_reg *reg); diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp index bbed4cc444e..47fcf126b3b 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp @@ -36,6 +36,76 @@ extern "C" { #include "brw_fs.h" #include "brw_cfg.h" +static struct brw_reg +brw_reg_from_fs_reg(fs_reg *reg) +{ + struct brw_reg brw_reg; + + switch (reg->file) { + case GRF: + case MRF: + if (reg->stride == 0) { + brw_reg = brw_vec1_reg(brw_file_from_reg(reg), reg->reg, 0); + } else if (reg->width < 8) { + brw_reg = brw_vec8_reg(brw_file_from_reg(reg), reg->reg, 0); + brw_reg = stride(brw_reg, reg->width * reg->stride, + reg->width, reg->stride); + } else { + /* From the Haswell PRM: + * + * VertStride must be used to cross GRF register boundaries. This + * rule implies that elements within a 'Width' cannot cross GRF + * boundaries. + * + * So, for registers with width > 8, we have to use a width of 8 + * and trust the compression state to sort out the exec size. + */ + brw_reg = brw_vec8_reg(brw_file_from_reg(reg), reg->reg, 0); + brw_reg = stride(brw_reg, 8 * reg->stride, 8, reg->stride); + } + + brw_reg = retype(brw_reg, reg->type); + brw_reg = byte_offset(brw_reg, reg->subreg_offset); + break; + case IMM: + switch (reg->type) { + case BRW_REGISTER_TYPE_F: + brw_reg = brw_imm_f(reg->fixed_hw_reg.dw1.f); + break; + case BRW_REGISTER_TYPE_D: + brw_reg = brw_imm_d(reg->fixed_hw_reg.dw1.d); + break; + case BRW_REGISTER_TYPE_UD: + brw_reg = brw_imm_ud(reg->fixed_hw_reg.dw1.ud); + break; + case BRW_REGISTER_TYPE_VF: + brw_reg = brw_imm_vf(reg->fixed_hw_reg.dw1.ud); + break; + default: + unreachable("not reached"); + } + break; + case HW_REG: + assert(reg->type == reg->fixed_hw_reg.type); + brw_reg = reg->fixed_hw_reg; + break; + case BAD_FILE: + /* Probably unused. */ + brw_reg = brw_null_reg(); + break; + case UNIFORM: + unreachable("not reached"); + default: + unreachable("not reached"); + } + if (reg->abs) + brw_reg = brw_abs(brw_reg); + if (reg->negate) + brw_reg = negate(brw_reg); + + return brw_reg; +} + fs_generator::fs_generator(struct brw_context *brw, void *mem_ctx, const struct brw_wm_prog_key *key, @@ -1200,76 +1270,6 @@ static uint32_t brw_file_from_reg(fs_reg *reg) } } -struct brw_reg -brw_reg_from_fs_reg(fs_reg *reg) -{ - struct brw_reg brw_reg; - - switch (reg->file) { - case GRF: - case MRF: - if (reg->stride == 0) { - brw_reg = brw_vec1_reg(brw_file_from_reg(reg), reg->reg, 0); - } else if (reg->width < 8) { - brw_reg = brw_vec8_reg(brw_file_from_reg(reg), reg->reg, 0); - brw_reg = stride(brw_reg, reg->width * reg->stride, - reg->width, reg->stride); - } else { - /* From the Haswell PRM: - * - * VertStride must be used to cross GRF register boundaries. This - * rule implies that elements within a 'Width' cannot cross GRF - * boundaries. - * - * So, for registers with width > 8, we have to use a width of 8 - * and trust the compression state to sort out the exec size. - */ - brw_reg = brw_vec8_reg(brw_file_from_reg(reg), reg->reg, 0); - brw_reg = stride(brw_reg, 8 * reg->stride, 8, reg->stride); - } - - brw_reg = retype(brw_reg, reg->type); - brw_reg = byte_offset(brw_reg, reg->subreg_offset); - break; - case IMM: - switch (reg->type) { - case BRW_REGISTER_TYPE_F: - brw_reg = brw_imm_f(reg->fixed_hw_reg.dw1.f); - break; - case BRW_REGISTER_TYPE_D: - brw_reg = brw_imm_d(reg->fixed_hw_reg.dw1.d); - break; - case BRW_REGISTER_TYPE_UD: - brw_reg = brw_imm_ud(reg->fixed_hw_reg.dw1.ud); - break; - case BRW_REGISTER_TYPE_VF: - brw_reg = brw_imm_vf(reg->fixed_hw_reg.dw1.ud); - break; - default: - unreachable("not reached"); - } - break; - case HW_REG: - assert(reg->type == reg->fixed_hw_reg.type); - brw_reg = reg->fixed_hw_reg; - break; - case BAD_FILE: - /* Probably unused. */ - brw_reg = brw_null_reg(); - break; - case UNIFORM: - unreachable("not reached"); - default: - unreachable("not reached"); - } - if (reg->abs) - brw_reg = brw_abs(brw_reg); - if (reg->negate) - brw_reg = negate(brw_reg); - - return brw_reg; -} - /** * Sets the first word of a vgrf for gen7+ simd4x2 uniform pull constant * sampler LD messages. |