diff options
author | Marek Olšák <[email protected]> | 2011-09-05 06:11:26 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2011-09-10 08:53:29 +0200 |
commit | 9edd0b5ddf406ef089edebd12999ff2a26774ca3 (patch) | |
tree | a67c0897622f0be01f2197e7f71984c90647163b | |
parent | da7233840f3eca0ba892ca318081c88e2457cc63 (diff) |
glsl_to_tgsi: fix shadow2DArray comparison
v2: adjust the assertion, add a comment
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 9394bea00d3..4a5f6a26854 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -2558,6 +2558,8 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir) break; } + const glsl_type *sampler_type = ir->sampler->type; + if (ir->projector) { if (opcode == TGSI_OPCODE_TEX) { /* Slot the projector in as the last component of the coord. */ @@ -2589,6 +2591,9 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir) tmp_src = get_temp(glsl_type::vec4_type); st_dst_reg tmp_dst = st_dst_reg(tmp_src); + /* Projective division not allowed for array samplers. */ + assert(!sampler_type->sampler_array); + tmp_dst.writemask = WRITEMASK_Z; emit(ir, TGSI_OPCODE_MOV, tmp_dst, this->result); @@ -2613,7 +2618,15 @@ glsl_to_tgsi_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, TGSI_OPCODE_MOV, coord_dst, this->result); coord_dst.writemask = WRITEMASK_XYZW; } @@ -2651,8 +2664,6 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir) inst->tex_offsets[0].SwizzleZ = GET_SWZ(offset.swizzle, 2); } - 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) |