summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2010-07-02 16:09:44 -0700
committerEric Anholt <[email protected]>2010-07-02 17:06:06 -0700
commitb61f4241f314144d3290085cda5db1959d8960a2 (patch)
tree0b4633ec424d2d34fde60925d68ea0ef25f6abe4 /src
parentd3983ca03248092d92b5240fbc6a30c24f80d313 (diff)
ir_to_mesa: Add support for shadow comparison to texture instructions.
piglit lacks tests for this currently.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/shader/ir_to_mesa.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp
index 53e5242b10b..c4678254925 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++;