X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fnvvertexec.c;h=9663b38157df1de60c754b704fc925cf69bcea98;hb=263581bba4d61291c54313648063a30c47106f0b;hp=d73f82b9738ace8b0f54d0be4b0db8ceb56a5c5b;hpb=8a299e78882f10b1895ad1af7bbbf778d20b7e33;p=mesa.git diff --git a/src/mesa/main/nvvertexec.c b/src/mesa/main/nvvertexec.c index d73f82b9738..9663b38157d 100644 --- a/src/mesa/main/nvvertexec.c +++ b/src/mesa/main/nvvertexec.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 5.1 + * Version: 6.0.1 * - * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2004 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"), @@ -234,7 +234,8 @@ get_register_pointer( const struct vp_src_register *source, { if (source->RelAddr) { const GLint reg = source->Index + state->AddressReg[0]; - ASSERT(source->File == PROGRAM_ENV_PARAM); + ASSERT( (source->File == PROGRAM_ENV_PARAM) || + (source->File == PROGRAM_STATE_VAR) ); if (reg < 0 || reg > MAX_NV_VERTEX_PROGRAM_PARAMS) return zeroVec; else @@ -325,8 +326,16 @@ store_vector4( const struct vp_dst_register *dest, case PROGRAM_OUTPUT: dst = state->Outputs[dest->Index]; break; + case PROGRAM_ENV_PARAM: + { + /* a slight hack */ + GET_CURRENT_CONTEXT(ctx); + dst = ctx->VertexProgram.Parameters[dest->Index]; + } + break; default: - _mesa_problem(NULL, "Invalid register file in fetch_vector1(vp)"); + _mesa_problem(NULL, "Invalid register file in store_vector4(file=%d)", + dest->File); return; } @@ -369,7 +378,19 @@ _mesa_exec_vertex_program(GLcontext *ctx, const struct vertex_program *program) ctx->_CurrentProgram = GL_VERTEX_PROGRAM_ARB; /* or NV, doesn't matter */ - for (inst = program->Instructions; inst->Opcode != VP_OPCODE_END; inst++) { + /* If the program is position invariant, multiply the input + * position and the MVP matrix and stick it into the output pos slot + */ + if (ctx->VertexProgram.Current->IsPositionInvariant) { + TRANSFORM_POINT( ctx->VertexProgram.Outputs[0], + ctx->_ModelProjectMatrix.m, + ctx->VertexProgram.Inputs[0]); + + /* XXX: This could go elsewhere */ + ctx->VertexProgram.Current->OutputsWritten |= 0x1; + } + + for (inst = program->Instructions; /*inst->Opcode != VP_OPCODE_END*/; inst++) { if (ctx->VertexProgram.CallbackEnabled && ctx->VertexProgram.Callback) {