[Mesa-dev] [PATCH 05/13] ir_to_mesa: fix shadow2DArray comparison
Ian Romanick
idr at freedesktop.org
Mon Sep 5 15:21:53 PDT 2011
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 09/05/2011 02:44 PM, Marek Olšák wrote:
> The depth should be in W.
> ---
> src/mesa/program/ir_to_mesa.cpp | 15 ++++++++++++---
> 1 files changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
> index 9813c4a..f705dc7 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,10 @@ 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 shadow2DArray. */
> + assert(sampler_type->sampler_dimensionality != GLSL_SAMPLER_DIM_2D ||
> + !sampler_type->sampler_array);
> +
It's not allowed for 1D array textures or cube map array textures (in
GL_ARB_texture_cube_map_array) either. The assertion should probably be
assert(!sampler_type->sampler_array);
> tmp_dst.writemask = WRITEMASK_Z;
> emit(ir, OPCODE_MOV, tmp_dst, this->result);
>
> @@ -2211,7 +2217,12 @@ ir_to_mesa_visitor::visit(ir_texture *ir)
> * coord.
> */
> ir->shadow_comparitor->accept(this);
> - coord_dst.writemask = WRITEMASK_Z;
> + if (sampler_type->sampler_dimensionality == GLSL_SAMPLER_DIM_2D &&
> + sampler_type->sampler_array) {
> + coord_dst.writemask = WRITEMASK_W;
> + } else {
> + coord_dst.writemask = WRITEMASK_Z;
> + }
It's probably worth adding a note here and in glsl_to_tgsi that this
will need updates for cube map array textures.
> emit(ir, OPCODE_MOV, coord_dst, this->result);
> coord_dst.writemask = WRITEMASK_XYZW;
> }
> @@ -2235,8 +2246,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)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iEYEARECAAYFAk5lS4EACgkQX1gOwKyEAw8akgCfcYdEPnblPkMP8qlPJtAXnzGW
dWcAn1EbxKDzxwnwz2U0znPYvaM4VDpn
=Q5LC
-----END PGP SIGNATURE-----
More information about the mesa-dev
mailing list