summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/nvprogram.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2009-09-23 16:49:52 -0700
committerEric Anholt <[email protected]>2009-09-24 13:34:06 -0700
commit601769a2c0071e23ade32de4e8911d75d7f324d2 (patch)
tree6a63a0086c9adeb38ed34dbce670ef564d8eea64 /src/mesa/shader/nvprogram.c
parentb849c6f1b3b38a68fae32d4dea16dd7431e41b6e (diff)
mesa: Initialize NV_vertex_program fields for the parameter lists and such.
This helps let drivers treat NV_vp like ARB_vp.
Diffstat (limited to 'src/mesa/shader/nvprogram.c')
-rw-r--r--src/mesa/shader/nvprogram.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/mesa/shader/nvprogram.c b/src/mesa/shader/nvprogram.c
index d6469b17bea..fdb2f4210ad 100644
--- a/src/mesa/shader/nvprogram.c
+++ b/src/mesa/shader/nvprogram.c
@@ -511,6 +511,34 @@ _mesa_GetVertexAttribPointervNV(GLuint index, GLenum pname, GLvoid **pointer)
+void
+_mesa_setup_nv_temporary_count(GLcontext *ctx, struct gl_program *program)
+{
+ int i;
+
+ program->NumTemporaries = 0;
+ for (i = 0; i < program->NumInstructions; i++) {
+ struct prog_instruction *inst = &program->Instructions[i];
+
+ if (inst->DstReg.File == PROGRAM_TEMPORARY) {
+ program->NumTemporaries = MAX2(program->NumTemporaries,
+ inst->DstReg.Index + 1);
+ }
+ if (inst->SrcReg[0].File == PROGRAM_TEMPORARY) {
+ program->NumTemporaries = MAX2(program->NumTemporaries,
+ inst->SrcReg[0].Index + 1);
+ }
+ if (inst->SrcReg[1].File == PROGRAM_TEMPORARY) {
+ program->NumTemporaries = MAX2(program->NumTemporaries,
+ inst->SrcReg[1].Index + 1);
+ }
+ if (inst->SrcReg[2].File == PROGRAM_TEMPORARY) {
+ program->NumTemporaries = MAX2(program->NumTemporaries,
+ inst->SrcReg[2].Index + 1);
+ }
+ }
+}
+
/**
* Load/parse/compile a program.
* \note Called from the GL API dispatcher.