mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 11:00:11 +01:00
tweaks to the LIT instructions
This commit is contained in:
parent
244adeb639
commit
55481b3a29
2 changed files with 11 additions and 14 deletions
|
|
@ -412,17 +412,12 @@ _mesa_exec_vertex_program(GLcontext *ctx, const struct vertex_program *program)
|
|||
break;
|
||||
case VP_OPCODE_LIT:
|
||||
{
|
||||
const GLfloat epsilon = 1.0e-5F; /* XXX fix? */
|
||||
const GLfloat epsilon = 1.0F / 256.0F; /* per NV spec */
|
||||
GLfloat t[4], lit[4];
|
||||
fetch_vector4( &inst->SrcReg[0], state, t );
|
||||
if (t[3] < -(128.0F - epsilon))
|
||||
t[3] = - (128.0F - epsilon);
|
||||
else if (t[3] > 128.0F - epsilon)
|
||||
t[3] = 128.0F - epsilon;
|
||||
if (t[0] < 0.0)
|
||||
t[0] = 0.0;
|
||||
if (t[1] < 0.0)
|
||||
t[1] = 0.0;
|
||||
t[0] = MAX2(t[0], 0.0F);
|
||||
t[1] = MAX2(t[1], 0.0F);
|
||||
t[3] = CLAMP(t[3], -(128.0F - epsilon), (128.0F - epsilon));
|
||||
lit[0] = 1.0;
|
||||
lit[1] = t[0];
|
||||
lit[2] = (t[0] > 0.0) ? (GLfloat) exp(t[3] * log(t[1])) : 0.0F;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.1
|
||||
* Version: 6.3
|
||||
*
|
||||
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
|
||||
*
|
||||
|
|
@ -805,14 +805,16 @@ execute_program( GLcontext *ctx,
|
|||
break;
|
||||
case FP_OPCODE_LIT:
|
||||
{
|
||||
const GLfloat epsilon = 1.0F / 256.0F; /* from NV VP spec */
|
||||
GLfloat a[4], result[4];
|
||||
fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a );
|
||||
if (a[0] < 0.0F)
|
||||
a[0] = 0.0F;
|
||||
if (a[1] < 0.0F)
|
||||
a[1] = 0.0F;
|
||||
a[0] = MAX2(a[0], 0.0F);
|
||||
a[1] = MAX2(a[1], 0.0F);
|
||||
/* XXX ARB version clamps a[3], NV version doesn't */
|
||||
a[3] = CLAMP(a[3], -(128.0F - epsilon), (128.0F - epsilon));
|
||||
result[0] = 1.0F;
|
||||
result[1] = a[0];
|
||||
/* XXX we could probably just use pow() here */
|
||||
result[2] = (a[0] > 0.0F) ? (GLfloat) exp(a[3] * log(a[1])) : 0.0F;
|
||||
result[3] = 1.0F;
|
||||
store_vector4( inst, machine, result );
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue