On Thu, 8 Dec 2011 17:07:58 -0800, Kenneth Graunke <[email protected]> wrote: > This translates the GLSL compiler's IR into vec4_instruction IR, > generating code to load coordinates, LOD info, shadow comparitors, and > so on into the appropriate message registers. > > It turns out that the SIMD4x2 parameters are identical on Gen 5-7, and > the Gen4 code is similar enough that, unlike in the FS, it's easy enough > to support all generations in a single function. > > Signed-off-by: Kenneth Graunke <[email protected]> > --- > src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 114 > ++++++++++++++++++++++-- > 1 files changed, 107 insertions(+), 7 deletions(-) > > diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp > b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp > index 853c3ee..85490bb 100644 > --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp > +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> + vec4_instruction *inst;
> + switch (ir->op) {
> + case ir_tex:
Isn't this one invalid for vertex shaders, too?
> + case ir_txl:
> + inst = new(mem_ctx) vec4_instruction(this, SHADER_OPCODE_TXL);
> + break;
> + case ir_txd:
> + inst = new(mem_ctx) vec4_instruction(this, SHADER_OPCODE_TXD);
> + break;
> + case ir_txf:
> + inst = new(mem_ctx) vec4_instruction(this, SHADER_OPCODE_TXF);
> + break;
> + case ir_txs:
> + inst = new(mem_ctx) vec4_instruction(this, SHADER_OPCODE_TXS);
> + break;
> + case ir_txb:
> + assert(!"TXB is not valid for vertex shaders.");
> + }
> + /* Load the LOD info */
> + if (ir->op == ir_txl) {
> + ir->lod_info.lod->accept(this);
> + int mrf, writemask;
> + if (intel->gen >= 5) {
> + mrf = param_base + 1;
> + writemask = ir->shadow_comparitor ? WRITEMASK_Y : WRITEMASK_X;
> + inst->mlen++;
> + } else /* intel->gen == 4 */ {
> + mrf = param_base;
> + writemask = WRITEMASK_Z;
> + }
> + emit(MOV(dst_reg(MRF, mrf, ir->lod_info.lod->type, writemask),
> + this->result));
I'd move the accept down next to the MOV. I'm always afraid of the
hidden return data from accept getting trashed before it gets consumed.
I wish the visitor stuff let us do the sensible thing and produce a
return value.
pgpQn39oTYCht.pgp
Description: PGP signature
_______________________________________________ mesa-dev mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-dev
