[Mesa-dev] [PATCH v2 3/9] radeonsi: remove unused si_llvm_cube_to_2d_coords
Nicolai Hähnle
nhaehnle at gmail.com
Thu Jan 12 15:39:29 UTC 2017
From: Nicolai Hähnle <nicolai.haehnle at amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
---
src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c | 30 +----------------------
1 file changed, 1 insertion(+), 29 deletions(-)
diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c
index 60346cb..c410a8b 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c
@@ -1008,48 +1008,20 @@ static void build_cube_select(LLVMBuilderRef builder,
out_st[1] = LLVMBuildFMul(builder, tmp, sgn, "");
/* Select ma */
tmp = LLVMBuildSelect(builder, is_ma_z, coords[2],
LLVMBuildSelect(builder, is_ma_y, coords[1], coords[0], ""), "");
sgn = LLVMBuildSelect(builder, is_ma_positive,
LLVMConstReal(f32, 2.0), LLVMConstReal(f32, -2.0), "");
*out_ma = LLVMBuildFMul(builder, tmp, sgn, "");
}
-static void si_llvm_cube_to_2d_coords(struct lp_build_tgsi_context *bld_base,
- LLVMValueRef *in, LLVMValueRef *out)
-{
- struct gallivm_state *gallivm = bld_base->base.gallivm;
- LLVMBuilderRef builder = gallivm->builder;
- LLVMTypeRef type = bld_base->base.elem_type;
- struct cube_selection_coords coords;
- LLVMValueRef invma;
- LLVMValueRef mad_args[3];
-
- build_cube_intrinsic(gallivm, in, &coords);
-
- invma = lp_build_intrinsic(builder, "llvm.fabs.f32",
- type, &coords.ma, 1, LP_FUNC_ATTR_READNONE);
- invma = lp_build_emit_llvm_unary(bld_base, TGSI_OPCODE_RCP, invma);
-
- mad_args[1] = coords[2];
- mad_args[2] = LLVMConstReal(type, 1.5);
-
- for (int i = 0; i < 2; ++i) {
- mad_args[0] = coords.stc[i];
- out[i] = lp_build_emit_llvm_ternary(bld_base, TGSI_OPCODE_MAD,
- mad_args[0], mad_args[1], mad_args[2]);
- }
-
- out[2] = coords.id;
-}
-
void si_prepare_cube_coords(struct lp_build_tgsi_context *bld_base,
struct lp_build_emit_data *emit_data,
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;
@@ -1111,21 +1083,21 @@ void si_prepare_cube_coords(struct lp_build_tgsi_context *bld_base,
LLVMBuildFMul(builder, deriv_ma, coords[i], ""), "");
}
memcpy(derivs_arg, derivs, sizeof(derivs));
}
/* Shift the texture coordinate. This must be applied after the
* derivative calculation.
*/
for (int i = 0; i < 2; ++i)
- coords[i] = LLVMBuildFAdd(builder, coords[i], LLVMConstReal(type, 0.5), "");
+ coords[i] = LLVMBuildFAdd(builder, coords[i], LLVMConstReal(type, 1.5), "");
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. */
--
2.7.4
More information about the mesa-dev
mailing list