Matt Turner <matts...@gmail.com> writes: > --- > src/mesa/drivers/dri/i965/brw_fs.cpp | 20 ++++++++++++++++++++ > src/mesa/drivers/dri/i965/brw_fs.h | 1 + > src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 3 +++ > 3 files changed, 24 insertions(+) > > diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp > b/src/mesa/drivers/dri/i965/brw_fs.cpp > index 983e8db..ffe0a5b 100644 > --- a/src/mesa/drivers/dri/i965/brw_fs.cpp > +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp > @@ -44,6 +44,7 @@ extern "C" { > #include "brw_context.h" > #include "brw_eu.h" > #include "brw_wm.h" > +#include "brw_packed_float.h" > } > #include "brw_fs.h" > #include "brw_cfg.h" > @@ -581,6 +582,18 @@ fs_reg::fs_reg(uint32_t u) > this->width = 1; > } > > +/** Vector float immediate value constructor. */ > +fs_reg::fs_reg(uint8_t vf[4]) > +{ > + init(); > + this->file = IMM; > + this->type = BRW_REGISTER_TYPE_VF; > + this->fixed_hw_reg.dw1.ud = (vf[0] << 0) | > + (vf[1] << 8) | > + (vf[2] << 16) | > + (vf[3] << 24); > +} > +
IMHO it would be a lot more convenient to have this function take four float arguments and carry out the conversion to 8-bit here. I suspect that in most cases the arguments of this constructor (and the same goes for src_reg) will be known at compile time so we could just add an assertion to check that the conversion was carried out exactly. > /** Fixed brw_reg. */ > fs_reg::fs_reg(struct brw_reg fixed_hw_reg) > { > @@ -3218,6 +3231,13 @@ fs_visitor::dump_instruction(backend_instruction > *be_inst, FILE *file) > case BRW_REGISTER_TYPE_UD: > fprintf(file, "%uu", inst->src[i].fixed_hw_reg.dw1.ud); > break; > + case BRW_REGISTER_TYPE_VF: > + fprintf(stderr, "[%.7f, %.7f, %.7f, %.7f]", Again the formatting seems inconsistent with the formatting of other floating point values. > + brw_vf_to_float((inst->src[i].fixed_hw_reg.dw1.ud >> 0) > & 0xff), > + brw_vf_to_float((inst->src[i].fixed_hw_reg.dw1.ud >> 8) > & 0xff), > + brw_vf_to_float((inst->src[i].fixed_hw_reg.dw1.ud >> 16) > & 0xff), > + brw_vf_to_float((inst->src[i].fixed_hw_reg.dw1.ud >> 24) > & 0xff)); > + break; > default: > fprintf(file, "???"); > break; > diff --git a/src/mesa/drivers/dri/i965/brw_fs.h > b/src/mesa/drivers/dri/i965/brw_fs.h > index 67956bc..5ab1771 100644 > --- a/src/mesa/drivers/dri/i965/brw_fs.h > +++ b/src/mesa/drivers/dri/i965/brw_fs.h > @@ -76,6 +76,7 @@ public: > explicit fs_reg(float f); > explicit fs_reg(int32_t i); > explicit fs_reg(uint32_t u); > + explicit fs_reg(uint8_t vf[4]); > fs_reg(struct brw_reg fixed_hw_reg); > fs_reg(enum register_file file, int reg); > fs_reg(enum register_file file, int reg, enum brw_reg_type type); > diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp > b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp > index c2010c0..f55b54c 100644 > --- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp > +++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp > @@ -1243,6 +1243,9 @@ brw_reg_from_fs_reg(fs_reg *reg) > 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"); > } > -- > 2.0.4
pgppDPynwIDaF.pgp
Description: PGP signature
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev