From b61f4241f314144d3290085cda5db1959d8960a2 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 2 Jul 2010 16:09:44 -0700 Subject: ir_to_mesa: Add support for shadow comparison to texture instructions. piglit lacks tests for this currently. --- src/mesa/shader/ir_to_mesa.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 53e5242b10..c467825492 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -83,6 +83,7 @@ public: GLboolean cond_update; int sampler; /**< sampler index */ int tex_target; /**< One of TEXTURE_*_INDEX */ + GLboolean tex_shadow; }; class temp_entry : public exec_node { @@ -1361,6 +1362,16 @@ ir_to_mesa_visitor::visit(ir_texture *ir) } } + if (ir->shadow_comparitor) { + /* Slot the shadow value in as the second to last component of the + * coord. + */ + ir->shadow_comparitor->accept(this); + coord_dst.writemask = WRITEMASK_Z; + ir_to_mesa_emit_op1(ir, OPCODE_MOV, coord_dst, this->result); + coord_dst.writemask = WRITEMASK_XYZW; + } + if (opcode == OPCODE_TXL || opcode == OPCODE_TXB) { /* Mesa IR stores lod or lod bias in the last channel of the coords. */ coord_dst.writemask = WRITEMASK_W; @@ -1370,6 +1381,9 @@ ir_to_mesa_visitor::visit(ir_texture *ir) inst = ir_to_mesa_emit_op1(ir, opcode, result_dst, coord); + if (ir->shadow_comparitor) + inst->tex_shadow = GL_TRUE; + ir_dereference_variable *sampler = ir->sampler->as_dereference_variable(); assert(sampler); /* FINISHME: sampler arrays */ /* generate the mapping, remove when we generate storage at @@ -1396,8 +1410,6 @@ ir_to_mesa_visitor::visit(ir_texture *ir) assert(!"FINISHME: other texture targets"); } - assert(!ir->shadow_comparitor); /* FINISHME */ - this->result = result_src; } @@ -1726,6 +1738,7 @@ get_mesa_program(GLcontext *ctx, void *mem_ctx, struct gl_shader *shader) mesa_inst->SrcReg[2] = mesa_src_reg_from_ir_src_reg(inst->src_reg[2]); mesa_inst->TexSrcUnit = inst->sampler; mesa_inst->TexSrcTarget = inst->tex_target; + mesa_inst->TexShadow = inst->tex_shadow; mesa_instruction_annotation[i] = inst->ir; mesa_inst++; -- cgit v1.2.3