aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/r300/r500_fragprog.c
diff options
context:
space:
mode:
authorNicolai Haehnle <[email protected]>2008-07-05 22:21:24 +0200
committerNicolai Haehnle <[email protected]>2008-07-06 09:59:43 +0200
commit62bccd6df0c963a14e801bcac95dc8046b978a7f (patch)
treebef7225f252c272272cc445c24c1935967554d37 /src/mesa/drivers/dri/r300/r500_fragprog.c
parent77fdfaa23adeaaf6a217ef1ee751410c6a5b0d21 (diff)
r300: Allow adding parameters during fragprog transform, share LIT code
Diffstat (limited to 'src/mesa/drivers/dri/r300/r500_fragprog.c')
-rw-r--r--src/mesa/drivers/dri/r300/r500_fragprog.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/r300/r500_fragprog.c b/src/mesa/drivers/dri/r300/r500_fragprog.c
index 7ee84947225..1cdb065354b 100644
--- a/src/mesa/drivers/dri/r300/r500_fragprog.c
+++ b/src/mesa/drivers/dri/r300/r500_fragprog.c
@@ -212,7 +212,7 @@ static void insert_WPOS_trailer(struct r500_fragment_program_compiler *compiler)
i++;
/* viewport transformation */
- window_index = _mesa_add_state_reference(compiler->fp->mesa_program.Base.Parameters, tokens);
+ window_index = _mesa_add_state_reference(compiler->program->Parameters, tokens);
fpi[i].Opcode = OPCODE_MAD;
@@ -332,6 +332,11 @@ void r500TranslateFragmentShader(r300ContextPtr r300,
fp->translated = r500FragmentProgramEmit(&compiler);
+ /* Subtle: Rescue any parameters that have been added during transformations */
+ _mesa_free_parameter_list(fp->mesa_program.Base.Parameters);
+ fp->mesa_program.Base.Parameters = compiler.program->Parameters;
+ compiler.program->Parameters = 0;
+
_mesa_reference_program(r300->radeon.glCtx, &compiler.program, 0);
r300UpdateStateParameters(r300->radeon.glCtx, _NEW_PROGRAM);
@@ -461,9 +466,8 @@ static void dump_program(struct r500_fragment_program_code *code)
if (code->const_nr) {
fprintf(stderr, "--------\nConstants:\n");
for (n = 0; n < code->const_nr; n++) {
- fprintf(stderr, "Constant %d: %f %f\n\t %f %f\n", n,
- code->constant[n][0], code->constant[n][1], code->constant[n][2],
- code->constant[n][3]);
+ fprintf(stderr, "Constant %d: %i[%i]\n", n,
+ code->constant[n].File, code->constant[n].Index);
}
fprintf(stderr, "--------\n");
}