summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/r300/compiler/radeon_program.c
diff options
context:
space:
mode:
authorNicolai Hähnle <nhaehnle@gmail.com>2009-07-24 22:41:14 +0200
committerNicolai Hähnle <nhaehnle@gmail.com>2009-07-27 20:32:07 +0200
commit800f48258623f8caf25d013f44784edb7caa3f93 (patch)
treebb187a8b98e920f24762516620587402b6ab2c4b /src/mesa/drivers/dri/r300/compiler/radeon_program.c
parent92f7a599c7e94b0687d02efef1890e1a8ed2f9f3 (diff)
r300: Allow compiler to add constants in a cleaner way
Adding constants is used in a number of non-native instruction rewrites, and it required us to keep copies of modified gl_programs around. This is a first step towards ending this. Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
Diffstat (limited to 'src/mesa/drivers/dri/r300/compiler/radeon_program.c')
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_program.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program.c b/src/mesa/drivers/dri/r300/compiler/radeon_program.c
index 5f35f56a23..50a0ce8743 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_program.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_program.c
@@ -28,6 +28,7 @@
#include "radeon_program.h"
#include "radeon_compiler.h"
+#include "shader/prog_parameter.h"
#include "shader/prog_print.h"
@@ -190,6 +191,7 @@ void rc_remove_instruction(struct rc_instruction * inst)
void rc_mesa_to_rc_program(struct radeon_compiler * c, struct gl_program * program)
{
struct prog_instruction *source;
+ unsigned int i;
for(source = program->Instructions; source->Opcode != OPCODE_END; ++source) {
struct rc_instruction * dest = rc_insert_new_instruction(c, c->Program.Instructions.Prev);
@@ -199,6 +201,15 @@ void rc_mesa_to_rc_program(struct radeon_compiler * c, struct gl_program * progr
c->Program.ShadowSamplers = program->ShadowSamplers;
c->Program.InputsRead = program->InputsRead;
c->Program.OutputsWritten = program->OutputsWritten;
+
+ for(i = 0; i < program->Parameters->NumParameters; ++i) {
+ struct rc_constant constant;
+
+ constant.Type = RC_CONSTANT_EXTERNAL;
+ constant.u.External = i;
+
+ rc_constants_add(&c->Program.Constants, &constant);
+ }
}