summaryrefslogtreecommitdiffstats
path: root/src/mesa/tnl
diff options
context:
space:
mode:
authorJouk <joukj@tarantella.nano.tudelft.nl>2007-10-31 08:18:58 +0100
committerJouk <joukj@tarantella.nano.tudelft.nl>2007-10-31 08:18:58 +0100
commitd1414da8f9dbf3c27cf05509be51e8c70ed1185d (patch)
treeb6b3fdccea77d6173c1a829e0d2710d5b973dd5a /src/mesa/tnl
parentb263435a98173645fa3f4a5dce4566e53470f38f (diff)
parentd2f19a554a9089fddb5e978e3a732bbf71d77f93 (diff)
downloadexternal_mesa3d-d1414da8f9dbf3c27cf05509be51e8c70ed1185d.zip
external_mesa3d-d1414da8f9dbf3c27cf05509be51e8c70ed1185d.tar.gz
external_mesa3d-d1414da8f9dbf3c27cf05509be51e8c70ed1185d.tar.bz2
Merge branch 'master' of git+ssh://joukj@git.freedesktop.org/git/mesa/mesa
Diffstat (limited to 'src/mesa/tnl')
-rw-r--r--src/mesa/tnl/t_vb_fog.c20
-rw-r--r--src/mesa/tnl/t_vp_build.c14
2 files changed, 16 insertions, 18 deletions
diff --git a/src/mesa/tnl/t_vb_fog.c b/src/mesa/tnl/t_vb_fog.c
index f651850..d8bca38 100644
--- a/src/mesa/tnl/t_vb_fog.c
+++ b/src/mesa/tnl/t_vb_fog.c
@@ -41,7 +41,6 @@
struct fog_stage_data {
GLvector4f fogcoord; /* has actual storage allocated */
- GLvector4f input; /* points into VB->EyePtr Z values */
};
#define FOG_STAGE_DATA(stage) ((struct fog_stage_data *)stage->privatePtr)
@@ -91,7 +90,8 @@ init_static_data( void )
* evaluating the GL_LINEAR, GL_EXP or GL_EXP2 fog function.
* Fog coordinates are distances from the eye (typically between the
* near and far clip plane distances).
- * Note the fog (eye Z) coords may be negative so we use ABS(z) below.
+ * Note that fogcoords may be negative, if eye z is source absolute
+ * value must be taken earlier.
* Fog blend factors are in the range [0,1].
*/
static void
@@ -169,13 +169,10 @@ run_fog_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage)
*/
input = &store->fogcoord;
- /* NOTE: negate plane here so we get positive fog coords! */
- /* NOTE2: this doesn't always work (tests/fog - all frag depth fog
- coords will be negative). */
- plane[0] = -m[2];
- plane[1] = -m[6];
- plane[2] = -m[10];
- plane[3] = -m[14];
+ plane[0] = m[2];
+ plane[1] = m[6];
+ plane[2] = m[10];
+ plane[3] = m[14];
/* Full eye coords weren't required, just calculate the
* eye Z values.
*/
@@ -189,12 +186,12 @@ run_fog_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage)
NOTE should avoid going through array twice */
coord = input->start;
for (i = 0; i < input->count; i++) {
- input->data[i][0] = FABSF(*coord);
+ *coord = FABSF(*coord);
STRIDE_F(coord, input->stride);
}
}
else {
- /* fog coordinates = eye Z coordinates (use ABS later) */
+ /* fog coordinates = eye Z coordinates - need to copy for ABS */
input = &store->fogcoord;
if (VB->EyePtr->size < 2)
@@ -249,7 +246,6 @@ alloc_fog_data(GLcontext *ctx, struct tnl_pipeline_stage *stage)
return GL_FALSE;
_mesa_vector4f_alloc( &store->fogcoord, 0, tnl->vb.Size, 32 );
- _mesa_vector4f_init( &store->input, 0, NULL );
if (!inited)
init_static_data();
diff --git a/src/mesa/tnl/t_vp_build.c b/src/mesa/tnl/t_vp_build.c
index 63f7890..b7bc197 100644
--- a/src/mesa/tnl/t_vp_build.c
+++ b/src/mesa/tnl/t_vp_build.c
@@ -489,8 +489,8 @@ static void emit_dst( struct prog_dst_register *dst,
dst->Index = reg.idx;
/* allow zero as a shorthand for xyzw */
dst->WriteMask = mask ? mask : WRITEMASK_XYZW;
- dst->CondMask = COND_TR;
- dst->CondSwizzle = 0;
+ dst->CondMask = COND_TR; /* always pass cond test */
+ dst->CondSwizzle = SWIZZLE_NOOP;
dst->CondSrc = 0;
dst->pad = 0;
}
@@ -513,7 +513,7 @@ static void debug_insn( struct prog_instruction *inst, const char *fn,
static void emit_op3fn(struct tnl_program *p,
- GLuint op,
+ enum prog_opcode op,
struct ureg dest,
GLuint mask,
struct ureg src0,
@@ -699,7 +699,7 @@ static struct ureg get_eye_normal( struct tnl_program *p )
struct ureg rescale = register_param2(p, STATE_INTERNAL,
STATE_NORMAL_SCALE);
- emit_op2( p, OPCODE_MUL, p->eye_normal, 0, normal,
+ emit_op2( p, OPCODE_MUL, p->eye_normal, 0, p->eye_normal,
swizzle1(rescale, X));
}
}
@@ -1123,8 +1123,6 @@ static void build_fog( struct tnl_program *p )
{
struct ureg fog = register_output(p, VERT_RESULT_FOGC);
struct ureg input;
- GLuint useabs = p->state->fog_source_is_depth && p->state->fog_mode &&
- (p->state->fog_mode != FOG_EXP2);
if (p->state->fog_source_is_depth) {
input = swizzle1(get_eye_position(p), Z);
@@ -1137,6 +1135,7 @@ static void build_fog( struct tnl_program *p )
struct ureg params = register_param2(p, STATE_INTERNAL,
STATE_FOG_PARAMS_OPTIMIZED);
struct ureg tmp = get_temp(p);
+ GLboolean useabs = (p->state->fog_mode != FOG_EXP2);
if (useabs) {
emit_op1(p, OPCODE_ABS, tmp, 0, input);
@@ -1169,7 +1168,10 @@ static void build_fog( struct tnl_program *p )
/* results = incoming fog coords (compute fog per-fragment later)
*
* KW: Is it really necessary to do anything in this case?
+ * BP: Yes, we always need to compute the absolute value, unless
+ * we want to push that down into the fragment program...
*/
+ GLboolean useabs = GL_TRUE;
emit_op1(p, useabs ? OPCODE_ABS : OPCODE_MOV, fog, WRITEMASK_X, input);
}
}