From 25ca9cc8236845a4be32a6f39b4a6d1664d4b403 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 4 Jul 2012 13:31:46 -0700 Subject: [PATCH] i965/vs: Move the other two src_reg/dst_reg constructors to brw_vec4.cpp. Reviewed-by: Kenneth Graunke --- src/mesa/drivers/dri/i965/brw_vec4.cpp | 43 +++++++++++++++++++ .../drivers/dri/i965/brw_vec4_visitor.cpp | 43 ------------------- 2 files changed, 43 insertions(+), 43 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp index 37bb33531e2..2941729c4a0 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp @@ -104,6 +104,36 @@ src_reg::src_reg(int32_t i) this->imm.i = i; } +src_reg::src_reg(dst_reg reg) +{ + init(); + + this->file = reg.file; + this->reg = reg.reg; + this->reg_offset = reg.reg_offset; + this->type = reg.type; + this->reladdr = reg.reladdr; + this->fixed_hw_reg = reg.fixed_hw_reg; + + int swizzles[4]; + int next_chan = 0; + int last = 0; + + for (int i = 0; i < 4; i++) { + if (!(reg.writemask & (1 << i))) + continue; + + swizzles[next_chan++] = last = i; + } + + for (; next_chan < 4; next_chan++) { + swizzles[next_chan] = last; + } + + this->swizzle = BRW_SWIZZLE4(swizzles[0], swizzles[1], + swizzles[2], swizzles[3]); +} + bool vec4_instruction::is_tex() { @@ -154,6 +184,19 @@ dst_reg::dst_reg(struct brw_reg reg) this->fixed_hw_reg = reg; } +dst_reg::dst_reg(src_reg reg) +{ + init(); + + this->file = reg.file; + this->reg = reg.reg; + this->reg_offset = reg.reg_offset; + this->type = reg.type; + this->writemask = WRITEMASK_XYZW; + this->reladdr = reg.reladdr; + this->fixed_hw_reg = reg.fixed_hw_reg; +} + bool vec4_instruction::is_math() { diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp index 25d3c92f835..c77dc91fc1f 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp @@ -30,49 +30,6 @@ extern "C" { namespace brw { -src_reg::src_reg(dst_reg reg) -{ - init(); - - this->file = reg.file; - this->reg = reg.reg; - this->reg_offset = reg.reg_offset; - this->type = reg.type; - this->reladdr = reg.reladdr; - this->fixed_hw_reg = reg.fixed_hw_reg; - - int swizzles[4]; - int next_chan = 0; - int last = 0; - - for (int i = 0; i < 4; i++) { - if (!(reg.writemask & (1 << i))) - continue; - - swizzles[next_chan++] = last = i; - } - - for (; next_chan < 4; next_chan++) { - swizzles[next_chan] = last; - } - - this->swizzle = BRW_SWIZZLE4(swizzles[0], swizzles[1], - swizzles[2], swizzles[3]); -} - -dst_reg::dst_reg(src_reg reg) -{ - init(); - - this->file = reg.file; - this->reg = reg.reg; - this->reg_offset = reg.reg_offset; - this->type = reg.type; - this->writemask = WRITEMASK_XYZW; - this->reladdr = reg.reladdr; - this->fixed_hw_reg = reg.fixed_hw_reg; -} - vec4_instruction::vec4_instruction(vec4_visitor *v, enum opcode opcode, dst_reg dst, src_reg src0, src_reg src1, src_reg src2) -- 2.30.2