summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2005-10-21 15:23:13 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2005-10-21 15:23:13 +0000
commit2fd1ed1b4549db9cc60765eccdc8b8c566e995da (patch)
tree53287c39af9af86ee16ec374609b011bea349888
parent66b928e95e348dfd83e540a49296e7ea071bdeea (diff)
fix broken SWZ instruction
-rw-r--r--src/mesa/shader/arbprogparse.c21
-rw-r--r--src/mesa/swrast/s_nvfragprog.c8
2 files changed, 13 insertions, 16 deletions
diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c
index e671c3fd3a9..e139072c303 100644
--- a/src/mesa/shader/arbprogparse.c
+++ b/src/mesa/shader/arbprogparse.c
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.2
+ * Version: 6.4
*
- * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -2444,15 +2444,15 @@ parse_swizzle_mask (GLubyte ** inst, GLubyte * mask, GLint len)
/**
*/
static GLuint
-parse_extended_swizzle_mask (GLubyte ** inst, GLubyte * mask, GLboolean * Negate)
+parse_extended_swizzle_mask(GLubyte **inst, GLubyte *mask, GLubyte *negate)
{
GLint a;
GLubyte swz;
- *Negate = GL_FALSE;
+ *negate = 0x0;
for (a = 0; a < 4; a++) {
if (parse_sign (inst) == -1)
- *Negate = GL_TRUE;
+ *negate |= (1 << a);
swz = *(*inst)++;
@@ -3037,18 +3037,15 @@ parse_fp_instruction (GLcontext * ctx, GLubyte ** inst,
{
GLubyte Swizzle[4]; /* FP's swizzle mask is a GLubyte, while VP's is GLuint */
- GLubyte Negate[4];
+ GLubyte negateMask;
GLint File, Index;
if (parse_src_reg(ctx, inst, vc_head, Program, &File, &Index, &rel))
return 1;
- parse_extended_swizzle_mask (inst, Swizzle, Negate);
+ parse_extended_swizzle_mask (inst, Swizzle, &negateMask);
fp->SrcReg[0].File = File;
fp->SrcReg[0].Index = Index;
- fp->SrcReg[0].NegateBase = (Negate[0] << 0 |
- Negate[1] << 1 |
- Negate[2] << 2 |
- Negate[3] << 3);
+ fp->SrcReg[0].NegateBase = negateMask;
fp->SrcReg[0].Swizzle = (Swizzle[0] << 0 |
Swizzle[1] << 3 |
Swizzle[2] << 6 |
@@ -3262,6 +3259,7 @@ parse_vp_instruction (GLcontext * ctx, GLubyte ** inst,
vp->SrcReg[0].Swizzle = SWIZZLE_NOOP;
vp->SrcReg[1].Swizzle = SWIZZLE_NOOP;
vp->SrcReg[2].Swizzle = SWIZZLE_NOOP;
+ vp->SrcReg[3].Swizzle = SWIZZLE_NOOP;
vp->DstReg.WriteMask = 0xf;
switch (type) {
@@ -3886,7 +3884,6 @@ static int set_reg8 (GLcontext *ctx, grammar id, const byte *name, byte value)
static int extension_is_supported (const GLubyte *ext)
{
- GET_CURRENT_CONTEXT(ctx);
const GLubyte *extensions = CALL_GetString(GET_DISPATCH(), (GL_EXTENSIONS));
const GLubyte *end = extensions + _mesa_strlen ((const char *) extensions);
const GLint ext_len = (GLint)_mesa_strlen ((const char *) ext);
diff --git a/src/mesa/swrast/s_nvfragprog.c b/src/mesa/swrast/s_nvfragprog.c
index 22dbb17fb03..8e149b66d4e 100644
--- a/src/mesa/swrast/s_nvfragprog.c
+++ b/src/mesa/swrast/s_nvfragprog.c
@@ -1157,15 +1157,15 @@ execute_program( GLcontext *ctx,
GLuint i;
/* do extended swizzling here */
- for (i = 0; i < 3; i++) {
+ for (i = 0; i < 4; i++) {
if (GET_SWZ(source->Swizzle, i) == SWIZZLE_ZERO)
result[i] = 0.0;
else if (GET_SWZ(source->Swizzle, i) == SWIZZLE_ONE)
- result[i] = -1.0;
+ result[i] = 1.0;
else
- result[i] = -src[GET_SWZ(source->Swizzle, i)];
+ result[i] = src[GET_SWZ(source->Swizzle, i)];
- if (source->NegateBase)
+ if (source->NegateBase & (1 << i))
result[i] = -result[i];
}
store_vector4( inst, machine, result );