summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorGustaw Smolarczyk <[email protected]>2017-03-30 20:09:33 +0200
committerMarek Olšák <[email protected]>2017-04-08 20:29:58 +0200
commita2eae66b8b12749c07743676863d665ac82c0e31 (patch)
tree0be40a640a87171344d66c37201db4be77b737fa /src/mesa/state_tracker
parent8a4b93b1d9aa72c00a29d3a1f26b42e3eca03768 (diff)
st/mesa: Use compressed fog mode for atifs.
Signed-off-by: Gustaw Smolarczyk <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Signed-off-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_atifs_to_tgsi.c6
-rw-r--r--src/mesa/state_tracker/st_atom_shader.c17
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 64879f1b277..90286a11153 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 f79afe0b1c2..ee97c69df33 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);