[Mesa-dev] [PATCH 2/3] tgsi: fix-up KILP comments
Christoph Bumiller
e0425955 at student.tuwien.ac.at
Thu Jul 11 16:33:17 PDT 2013
On 12.07.2013 01:26, Brian Paul wrote:
> KILP is really unconditional fragment kill.
>
> We've had KIL and KILP transposed forever. I'll fix that next.
I think the 'P' meant to indicate that the condition, if there is any,
would be a predicate register, whereas KIL no-P is supposed to represent
the KIL/TEXKILL instruction from those old shader languages.
So, it's not transposed, it's just an initially confusing name. Maybe
just s/KILP/DISCARD instead of swapping them ?
> ---
> src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 3 +--
> src/gallium/auxiliary/tgsi/tgsi_exec.c | 5 ++---
> src/gallium/docs/source/tgsi.rst | 10 +++++-----
> src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 1 +
> 4 files changed, 9 insertions(+), 10 deletions(-)
>
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> index 43724e7..43182ee 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> @@ -2096,8 +2096,7 @@ emit_kil(
>
>
> /**
> - * Predicated fragment kill.
> - * XXX Actually, we do an unconditional kill (as in tgsi_exec.c).
> + * Unconditional fragment kill.
> * The only predication is the execution mask which will apply if
> * we're inside a loop or conditional.
> */
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
> index e0000af..035b105 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
> +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
> @@ -1614,8 +1614,7 @@ exec_kil(struct tgsi_exec_machine *mach,
> }
>
> /**
> - * Execute NVIDIA-style KIL which is predicated by a condition code.
> - * Kill fragment if the condition code is TRUE.
> + * Unconditional fragment kill/discard.
> */
> static void
> exec_kilp(struct tgsi_exec_machine *mach,
> @@ -1623,7 +1622,7 @@ exec_kilp(struct tgsi_exec_machine *mach,
> {
> uint kilmask; /* bit 0 = pixel 0, bit 1 = pixel 1, etc */
>
> - /* "unconditional" kil */
> + /* kill fragment for all fragments currently executing */
> kilmask = mach->ExecMask;
> mach->Temps[TEMP_KILMASK_I].xyzw[TEMP_KILMASK_C].u[0] |= kilmask;
> }
> diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst
> index 3f48b51..8c6fec9 100644
> --- a/src/gallium/docs/source/tgsi.rst
> +++ b/src/gallium/docs/source/tgsi.rst
> @@ -471,11 +471,6 @@ This instruction replicates its result.
> dst.w = partialy(src.w)
>
>
> -.. opcode:: KILP - Predicated Discard
> -
> - Not really predicated, just unconditional discard
> -
> -
> .. opcode:: PK2H - Pack Two 16-bit Floats
>
> TBD
> @@ -755,6 +750,11 @@ This instruction replicates its result.
> endif
>
>
> +.. opcode:: KILP - Discard
> +
> + Unconditional discard. Allowed in fragment shaders only.
> +
> +
> .. opcode:: SCS - Sine Cosine
>
> .. math::
> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> index 64e0a8a..9e0a648 100644
> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> @@ -2978,6 +2978,7 @@ glsl_to_tgsi_visitor::visit(ir_discard *ir)
> this->result.negate = ~this->result.negate;
> emit(ir, TGSI_OPCODE_KIL, undef_dst, this->result);
> } else {
> + /* unconditional kil */
> emit(ir, TGSI_OPCODE_KILP);
> }
> }
More information about the mesa-dev
mailing list