}
/* 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)
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)
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)
#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)
{
_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);