[Mesa-dev] [PATCH 14/14] st/mesa: Use compressed fog mode for atifs.
Marek Olšák
maraeo at gmail.com
Fri Apr 7 14:41:17 UTC 2017
For patches 12-14:
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Marek
On Thu, Mar 30, 2017 at 8:09 PM, Gustaw Smolarczyk <wielkiegie at gmail.com> wrote:
> Signed-off-by: Gustaw Smolarczyk <wielkiegie at gmail.com>
> ---
> src/mesa/state_tracker/st_atifs_to_tgsi.c | 6 +++---
> src/mesa/state_tracker/st_atom_shader.c | 17 +----------------
> 2 files changed, 4 insertions(+), 19 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_atifs_to_tgsi.c b/src/mesa/state_tracker/st_atifs_to_tgsi.c
> index 64879f1b27..90286a1115 100644
> --- a/src/mesa/state_tracker/st_atifs_to_tgsi.c
> +++ b/src/mesa/state_tracker/st_atifs_to_tgsi.c
> @@ -705,7 +705,7 @@ transform_inst:
> }
>
> /* compute the 1 component fog factor f */
> - if (ctx->key->fog == 1) {
> + if (ctx->key->fog == FOG_LINEAR) {
> /* LINEAR formula: f = (end - z) / (end - start)
> * with optimized parameters:
> * f = MAD(fogcoord, oparams.x, oparams.y)
> @@ -721,7 +721,7 @@ transform_inst:
> SET_SRC(&inst, 1, TGSI_FILE_CONSTANT, MAX_NUM_FRAGMENT_CONSTANTS_ATI, X, X, X, X);
> SET_SRC(&inst, 2, TGSI_FILE_CONSTANT, MAX_NUM_FRAGMENT_CONSTANTS_ATI, Y, Y, Y, Y);
> tctx->emit_instruction(tctx, &inst);
> - } else if (ctx->key->fog == 2) {
> + } else if (ctx->key->fog == FOG_EXP) {
> /* EXP formula: f = exp(-dens * z)
> * with optimized parameters:
> * f = MUL(fogcoord, oparams.z); f= EX2(-f)
> @@ -747,7 +747,7 @@ transform_inst:
> SET_SRC(&inst, 0, TGSI_FILE_TEMPORARY, ctx->fog_factor_temp, X, Y, Z, W);
> inst.Src[0].Register.Negate = 1;
> tctx->emit_instruction(tctx, &inst);
> - } else if (ctx->key->fog == 3) {
> + } else if (ctx->key->fog == FOG_EXP2) {
> /* EXP2 formula: f = exp(-(dens * z)^2)
> * with optimized parameters:
> * f = MUL(fogcoord, oparams.w); f=MUL(f, f); f= EX2(-f)
> diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c
> index f79afe0b1c..ee97c69df3 100644
> --- a/src/mesa/state_tracker/st_atom_shader.c
> +++ b/src/mesa/state_tracker/st_atom_shader.c
> @@ -54,19 +54,6 @@
> #include "st_texture.h"
>
>
> -/** Compress the fog function enums into a 2-bit value */
> -static GLuint
> -translate_fog_mode(GLenum mode)
> -{
> - switch (mode) {
> - case GL_LINEAR: return 1;
> - case GL_EXP: return 2;
> - case GL_EXP2: return 3;
> - default:
> - return 0;
> - }
> -}
> -
> static unsigned
> get_texture_target(struct gl_context *ctx, const unsigned unit)
> {
> @@ -132,9 +119,7 @@ update_fp( struct st_context *st )
> _mesa_geometric_samples(st->ctx->DrawBuffer) > 1;
>
> if (stfp->ati_fs) {
> - if (st->ctx->Fog.Enabled) {
> - key.fog = translate_fog_mode(st->ctx->Fog.Mode);
> - }
> + key.fog = st->ctx->Fog._PackedEnabledMode;
>
> for (unsigned u = 0; u < MAX_NUM_FRAGMENT_REGISTERS_ATI; u++) {
> key.texture_targets[u] = get_texture_target(st->ctx, u);
> --
> 2.12.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list