summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2009-09-09 19:56:57 +0200
committerNicolai Hähnle <[email protected]>2009-09-21 12:56:16 +0200
commit736e1ae42fd61f2b9f982b0491ca7daea7e615ed (patch)
tree4237ef2f34e7110b6f2453ba29c2d5f48950a568
parent1d4dbd8d9b00cdba8c4aef4a3994d8763fea0dff (diff)
r300: Fix handling of NV_vertex_program parameters
The handling is a bit inefficient, unfortunately, but I don't want to make any intrusive changes for Mesa 7.6. Signed-off-by: Nicolai Hähnle <[email protected]>
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_program.c35
-rw-r--r--src/mesa/shader/program.c1
2 files changed, 30 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program.c b/src/mesa/drivers/dri/r300/compiler/radeon_program.c
index bbbf0dd7768..b636f90a968 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_program.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_program.c
@@ -150,14 +150,37 @@ void rc_mesa_to_rc_program(struct radeon_compiler * c, struct gl_program * progr
c->Program.InputsRead = program->InputsRead;
c->Program.OutputsWritten = program->OutputsWritten;
- for(i = 0; i < program->Parameters->NumParameters; ++i) {
- struct rc_constant constant;
+ int isNVProgram = 0;
- constant.Type = RC_CONSTANT_EXTERNAL;
- constant.Size = 4;
- constant.u.External = i;
+ if (program->Target == GL_VERTEX_PROGRAM_ARB) {
+ struct gl_vertex_program * vp = (struct gl_vertex_program *) program;
+ isNVProgram = vp->IsNVProgram;
+ }
+
+ if (isNVProgram) {
+ /* NV_vertex_program has a fixed-sized constant environment.
+ * This could be handled more efficiently for programs that
+ * do not use relative addressing.
+ */
+ for(i = 0; i < 96; ++i) {
+ struct rc_constant constant;
- rc_constants_add(&c->Program.Constants, &constant);
+ constant.Type = RC_CONSTANT_EXTERNAL;
+ constant.Size = 4;
+ constant.u.External = i;
+
+ rc_constants_add(&c->Program.Constants, &constant);
+ }
+ } else {
+ for(i = 0; i < program->Parameters->NumParameters; ++i) {
+ struct rc_constant constant;
+
+ constant.Type = RC_CONSTANT_EXTERNAL;
+ constant.Size = 4;
+ constant.u.External = i;
+
+ rc_constants_add(&c->Program.Constants, &constant);
+ }
}
}
diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c
index 963478fccdb..2cd6eb8a389 100644
--- a/src/mesa/shader/program.c
+++ b/src/mesa/shader/program.c
@@ -502,6 +502,7 @@ _mesa_clone_program(GLcontext *ctx, const struct gl_program *prog)
= (const struct gl_vertex_program *) prog;
struct gl_vertex_program *vpc = (struct gl_vertex_program *) clone;
vpc->IsPositionInvariant = vp->IsPositionInvariant;
+ vpc->IsNVProgram = vp->IsNVProgram;
}
break;
case GL_FRAGMENT_PROGRAM_ARB: