static GLfloat RoughApproxPower(GLfloat x, GLfloat y)
{
- return RoughApproxExp2(y * RoughApproxLog2(x));
+ if (x == 0.0 && y == 0.0)
+ return 1.0; /* spec requires this */
+ else
+ return RoughApproxExp2(y * RoughApproxLog2(x));
}
GLfloat tmp[4];
tmp[0] = 1.0;
- tmp[1] = 0.0;
- tmp[2] = 0.0;
- tmp[3] = 1.0;
-
+ tmp[1] = arg0[0];
if (arg0[0] > 0.0) {
- tmp[1] = arg0[0];
-
- if (arg0[1] > 0.0) {
- tmp[2] = RoughApproxPower(arg0[1], arg0[3]);
- }
+ tmp[2] = RoughApproxPower(arg0[1], arg0[3]);
}
+ else {
+ tmp[2] = 0.0;
+ }
+ tmp[3] = 1.0;
+
COPY_4V(result, tmp);
}
void
_tnl_program_string(GLcontext *ctx, GLenum target, struct program *program)
{
- if (target == GL_VERTEX_PROGRAM_ARB) {
+ if (program->Target == GL_VERTEX_PROGRAM_ARB) {
/* free any existing tnl data hanging off the program */
struct vertex_program *vprog = (struct vertex_program *) program;
if (vprog->TnlData) {