From: Nicolai Hähnle <nicolai.haeh...@amd.com>

Sourcing coords_arg[4] is actually never correct, since bias is handled
differently in tex_fetch_args anyway.
---
 src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c 
b/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c
index 4021800..6850bf4 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c
@@ -1020,21 +1020,21 @@ void si_prepare_cube_coords(struct 
lp_build_tgsi_context *bld_base,
                            LLVMValueRef *coords_arg,
                            LLVMValueRef *derivs_arg)
 {
 
        unsigned target = emit_data->inst->Texture.Texture;
        unsigned opcode = emit_data->inst->Instruction.Opcode;
        struct gallivm_state *gallivm = bld_base->base.gallivm;
        LLVMBuilderRef builder = gallivm->builder;
        LLVMTypeRef type = bld_base->base.elem_type;
        struct cube_selection_coords selcoords;
-       LLVMValueRef coords[4];
+       LLVMValueRef coords[3];
        LLVMValueRef invma;
        LLVMValueRef mad_args[3];
 
        build_cube_intrinsic(gallivm, coords_arg, &selcoords);
 
        invma = lp_build_intrinsic(builder, "llvm.fabs.f32",
                        type, &selcoords.ma, 1, LP_FUNC_ATTR_READNONE);
        invma = lp_build_emit_llvm_unary(bld_base, TGSI_OPCODE_RCP, invma);
 
        mad_args[1] = invma;
@@ -1094,23 +1094,12 @@ void si_prepare_cube_coords(struct 
lp_build_tgsi_context *bld_base,
        }
 
        if (target == TGSI_TEXTURE_CUBE_ARRAY ||
            target == TGSI_TEXTURE_SHADOWCUBE_ARRAY) {
                /* for cube arrays coord.z = coord.w(array_index) * 8 + face */
                /* coords_arg.w component - array_index for cube arrays */
                coords[2] = lp_build_emit_llvm_ternary(bld_base, 
TGSI_OPCODE_MAD,
                                                       coords_arg[3], 
lp_build_const_float(gallivm, 8.0), coords[2]);
        }
 
-       /* Preserve compare/lod/bias. Put it in coords.w. */
-       if (opcode == TGSI_OPCODE_TEX2 ||
-           opcode == TGSI_OPCODE_TXB2 ||
-           opcode == TGSI_OPCODE_TXL2) {
-               coords[3] = coords_arg[4];
-       } else if (opcode == TGSI_OPCODE_TXB ||
-                  opcode == TGSI_OPCODE_TXL ||
-                  target == TGSI_TEXTURE_SHADOWCUBE) {
-               coords[3] = coords_arg[3];
-       }
-
        memcpy(coords_arg, coords, sizeof(coords));
 }
-- 
2.7.4

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to