From 5d23721c1df3d1a05c49b705f0d63e409c89d25f Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Sat, 8 Mar 2014 17:25:34 -0800 Subject: [PATCH] i965/fs: Add vector float immediate infrastructure. Reviewed-by: Kenneth Graunke --- src/mesa/drivers/dri/i965/brw_fs.cpp | 19 +++++++++++++++++++ src/mesa/drivers/dri/i965/brw_fs.h | 2 ++ .../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 0ffb07fc8cd..68305eff3dc 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -581,6 +581,18 @@ fs_reg::fs_reg(uint32_t u) this->width = 1; } +/** Vector float immediate value constructor. */ +fs_reg::fs_reg(uint8_t vf0, uint8_t vf1, uint8_t vf2, uint8_t vf3) +{ + init(); + this->file = IMM; + this->type = BRW_REGISTER_TYPE_VF; + this->fixed_hw_reg.dw1.ud = (vf0 << 0) | + (vf1 << 8) | + (vf2 << 16) | + (vf3 << 24); +} + /** Fixed brw_reg. */ fs_reg::fs_reg(struct brw_reg fixed_hw_reg) { @@ -3189,6 +3201,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, "[%-gF, %-gF, %-gF, %-gF]", + 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 ee612079f2a..4421eeda2a6 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -76,6 +76,8 @@ 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]); + explicit fs_reg(uint8_t vf0, uint8_t vf1, uint8_t vf2, uint8_t vf3); 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 06b0f347ae4..2a35fa98945 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp @@ -1255,6 +1255,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.30.2