/*
* Mesa 3-D graphics library
- * Version: 6.5
+ * Version: 6.5.2
*
- * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2006 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"),
GLboolean isStateProgram;
GLboolean isPositionInvariant;
GLboolean isVersion1_1;
- GLuint inputsRead;
- GLuint outputsWritten;
+ GLbitfield inputsRead;
+ GLbitfield outputsWritten;
GLboolean anyProgRegsWritten;
GLuint numInst; /* number of instructions parsed */
};
RETURN_ERROR;
if (token[0] == '-') {
(void) Parse_String(parseState, "-");
- srcReg->NegateBase = GL_TRUE;
+ srcReg->NegateBase = NEGATE_XYZW;
if (!Peek_Token(parseState, token))
RETURN_ERROR;
}
else {
- srcReg->NegateBase = GL_FALSE;
+ srcReg->NegateBase = NEGATE_NONE;
}
/* Src reg can be R<n>, c[n], c[n +/- offset], or a named vertex attrib */
else {
/* 2, 3 or 4-component swizzle */
GLint k;
+
+ srcReg->Swizzle = 0;
+
for (k = 0; token[k] && k < 5; k++) {
if (token[k] == 'x')
srcReg->Swizzle |= 0 << (k*3);
if (!Peek_Token(parseState, token))
RETURN_ERROR;
if (token[0] == '-') {
- srcReg->NegateBase = GL_TRUE;
+ srcReg->NegateBase = NEGATE_XYZW;
(void) Parse_String(parseState, "-"); /* consume '-' */
if (!Peek_Token(parseState, token))
RETURN_ERROR;
}
else {
- srcReg->NegateBase = GL_FALSE;
+ srcReg->NegateBase = NEGATE_NONE;
}
/* Src reg can be R<n>, c[n], c[n +/- offset], or a named vertex attrib */
inst->Opcode = OPCODE_ARL;
inst->StringPos = parseState->curLine - parseState->start;
+ /* Make ARB_vp backends happy */
+ inst->DstReg.File = PROGRAM_ADDRESS;
+ inst->DstReg.WriteMask = WRITEMASK_X;
+ inst->DstReg.Index = 0;
+
/* dest A0 reg */
if (!Parse_AddrReg(parseState))
RETURN_ERROR;
for (len = 0; str[len] != '\''; len++) /* find closing quote */
;
parseState->pos += len + 1;
- msg = _mesa_malloc(len + 1);
+ msg = (GLubyte*) _mesa_malloc(len + 1);
_mesa_memcpy(msg, str, len);
msg[len] = 0;
RETURN_ERROR;
srcReg->RelAddr = GL_FALSE;
- srcReg->NegateBase = GL_FALSE;
+ srcReg->NegateBase = NEGATE_NONE;
srcReg->Swizzle = SWIZZLE_NOOP;
/* Register can be R<n>, c[n], c[n +/- offset], a named vertex attrib,
void
_mesa_parse_nv_vertex_program(GLcontext *ctx, GLenum dstTarget,
const GLubyte *str, GLsizei len,
- struct vertex_program *program)
+ struct gl_vertex_program *program)
{
struct parse_state parseState;
struct prog_instruction instBuffer[MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS];
}
else {
if (!parseState.isPositionInvariant &&
- !(parseState.outputsWritten & 1)) {
+ !(parseState.outputsWritten & (1 << VERT_RESULT_HPOS))) {
/* bit 1 = HPOS register */
_mesa_error(ctx, GL_INVALID_OPERATION,
"glLoadProgramNV(HPOS not written)");
/* copy the compiled instructions */
assert(parseState.numInst <= MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS);
- newInst = (struct prog_instruction *)
- _mesa_malloc(parseState.numInst * sizeof(struct prog_instruction));
+ newInst = _mesa_alloc_instructions(parseState.numInst);
if (!newInst) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
_mesa_free(programString);
}
program->Base.Instructions = newInst;
program->Base.InputsRead = parseState.inputsRead;
+ if (parseState.isPositionInvariant)
+ program->Base.InputsRead |= VERT_BIT_POS;
+ program->Base.NumInstructions = parseState.numInst;
program->Base.OutputsWritten = parseState.outputsWritten;
program->IsPositionInvariant = parseState.isPositionInvariant;
program->IsNVProgram = GL_TRUE;
* Print (unparse) the given vertex program. Just for debugging.
*/
void
-_mesa_print_nv_vertex_program(const struct vertex_program *program)
+_mesa_print_nv_vertex_program(const struct gl_vertex_program *program)
{
const struct prog_instruction *inst;