aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-08-19 22:51:51 +0200
committerMarek Olšák <[email protected]>2017-08-22 13:29:47 +0200
commitaddd48194adef0aa3f91a0f0be2551a4611bdf65 (patch)
tree678172dd861bf8f1939176cda3ea459bdfe23b03
parentdc2ac0366919d4eade95923bd6104774f5e7d33c (diff)
radeonsi: use a faster version of PK2H
+ 4 piglit regressions, but it's correct accorcing to the GL spec and performance is more important than piglit. Reviewed-by: Nicolai Hähnle <[email protected]>
-rw-r--r--src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c29
1 files changed, 8 insertions, 21 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c
index 12f8de40564..405469dd284 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c
@@ -656,27 +656,14 @@ static void emit_pk2h(const struct lp_build_tgsi_action *action,
struct lp_build_tgsi_context *bld_base,
struct lp_build_emit_data *emit_data)
{
- LLVMBuilderRef builder = bld_base->base.gallivm->builder;
- LLVMContextRef context = bld_base->base.gallivm->context;
- struct lp_build_context *uint_bld = &bld_base->uint_bld;
- LLVMTypeRef fp16, i16;
- LLVMValueRef const16, comp[2];
- unsigned i;
-
- fp16 = LLVMHalfTypeInContext(context);
- i16 = LLVMInt16TypeInContext(context);
- const16 = lp_build_const_int32(uint_bld->gallivm, 16);
-
- for (i = 0; i < 2; i++) {
- comp[i] = LLVMBuildFPTrunc(builder, emit_data->args[i], fp16, "");
- comp[i] = LLVMBuildBitCast(builder, comp[i], i16, "");
- comp[i] = LLVMBuildZExt(builder, comp[i], uint_bld->elem_type, "");
- }
-
- comp[1] = LLVMBuildShl(builder, comp[1], const16, "");
- comp[0] = LLVMBuildOr(builder, comp[0], comp[1], "");
-
- emit_data->output[emit_data->chan] = comp[0];
+ /* From the GLSL 4.50 spec:
+ * "The rounding mode cannot be set and is undefined."
+ *
+ * v_cvt_pkrtz_f16 rounds to zero, but it's fastest.
+ */
+ emit_data->output[emit_data->chan] =
+ ac_build_cvt_pkrtz_f16(&si_shader_context(bld_base)->ac,
+ emit_data->args);
}
static void up2h_fetch_args(struct lp_build_tgsi_context *bld_base,