diff options
author | Marek Olšák <[email protected]> | 2011-09-05 06:09:37 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2011-09-10 08:53:29 +0200 |
commit | da7233840f3eca0ba892ca318081c88e2457cc63 (patch) | |
tree | 5ce0b4050e21bf0c6c77eba98dd115bd0379f61b /src/mesa | |
parent | 274768856dc2b6d3dea254383199366bb4cd3cbc (diff) |
ir_to_mesa: fix shadow2DArray comparison
The depth should be in W.
v2: adjust the assertion, add a comment
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/program/ir_to_mesa.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 9813c4ae8a5..69a84de397b 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2156,6 +2156,8 @@ ir_to_mesa_visitor::visit(ir_texture *ir) break; } + const glsl_type *sampler_type = ir->sampler->type; + if (ir->projector) { if (opcode == OPCODE_TEX) { /* Slot the projector in as the last component of the coord. */ @@ -2187,6 +2189,9 @@ ir_to_mesa_visitor::visit(ir_texture *ir) tmp_src = get_temp(glsl_type::vec4_type); dst_reg tmp_dst = dst_reg(tmp_src); + /* Projective division not allowed for array samplers. */ + assert(!sampler_type->sampler_array); + tmp_dst.writemask = WRITEMASK_Z; emit(ir, OPCODE_MOV, tmp_dst, this->result); @@ -2211,7 +2216,15 @@ ir_to_mesa_visitor::visit(ir_texture *ir) * coord. */ ir->shadow_comparitor->accept(this); - coord_dst.writemask = WRITEMASK_Z; + + /* XXX This will need to be updated for cubemap array samplers. */ + if (sampler_type->sampler_dimensionality == GLSL_SAMPLER_DIM_2D && + sampler_type->sampler_array) { + coord_dst.writemask = WRITEMASK_W; + } else { + coord_dst.writemask = WRITEMASK_Z; + } + emit(ir, OPCODE_MOV, coord_dst, this->result); coord_dst.writemask = WRITEMASK_XYZW; } @@ -2235,8 +2248,6 @@ ir_to_mesa_visitor::visit(ir_texture *ir) this->shader_program, this->prog); - const glsl_type *sampler_type = ir->sampler->type; - switch (sampler_type->sampler_dimensionality) { case GLSL_SAMPLER_DIM_1D: inst->tex_target = (sampler_type->sampler_array) |