aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/r300/r300_vertprog.c
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2009-09-21 13:26:50 +0200
committerNicolai Hähnle <[email protected]>2009-09-21 13:26:50 +0200
commit81c7561d9d3faf70ac22c6a5f3fbea18f53eed92 (patch)
tree5ec097e0e1fe99804104d3a56923c16edf1533aa /src/mesa/drivers/dri/r300/r300_vertprog.c
parentf02f63997ce65530788a6dfcb28f11790a14d938 (diff)
parent3083ba38f4c884b32cd0460607b5064b6b7008d2 (diff)
Merge branch 'master' into r300-compiler
There were additional non-textual conflicts. Conflicts: src/gallium/drivers/r300/r300_tgsi_to_rc.c src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c src/mesa/drivers/dri/r300/compiler/radeon_program.c src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c
Diffstat (limited to 'src/mesa/drivers/dri/r300/r300_vertprog.c')
-rw-r--r--src/mesa/drivers/dri/r300/r300_vertprog.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c
index d5e2cf9b14d..8ad75fb5c06 100644
--- a/src/mesa/drivers/dri/r300/r300_vertprog.c
+++ b/src/mesa/drivers/dri/r300/r300_vertprog.c
@@ -203,6 +203,34 @@ static void t_inputs_outputs(struct r300_vertex_program_compiler * c)
}
}
+/**
+ * The NV_vertex_program spec mandates that all registers be
+ * initialized to zero. We do this here unconditionally.
+ *
+ * \note We rely on dead-code elimination in the compiler.
+ */
+static void initialize_NV_registers(struct radeon_compiler * compiler)
+{
+ unsigned int reg;
+ struct rc_instruction * inst;
+
+ for(reg = 0; reg < 12; ++reg) {
+ inst = rc_insert_new_instruction(compiler, &compiler->Program.Instructions);
+ inst->I.Opcode = RC_OPCODE_MOV;
+ inst->I.DstReg.File = RC_FILE_TEMPORARY;
+ inst->I.DstReg.Index = reg;
+ inst->I.SrcReg[0].File = RC_FILE_NONE;
+ inst->I.SrcReg[0].Swizzle = RC_SWIZZLE_0000;
+ }
+
+ inst = rc_insert_new_instruction(compiler, &compiler->Program.Instructions);
+ inst->I.Opcode = RC_OPCODE_ARL;
+ inst->I.DstReg.File = RC_FILE_ADDRESS;
+ inst->I.DstReg.Index = 0;
+ inst->I.DstReg.WriteMask = WRITEMASK_X;
+ inst->I.SrcReg[0].File = RC_FILE_NONE;
+ inst->I.SrcReg[0].Swizzle = RC_SWIZZLE_0000;
+}
static struct r300_vertex_program *build_program(GLcontext *ctx,
struct r300_vertex_program_key *wanted_key,
@@ -234,6 +262,9 @@ static struct r300_vertex_program *build_program(GLcontext *ctx,
radeon_mesa_to_rc_program(&compiler.Base, &vp->Base->Base);
+ if (mesa_vp->IsNVProgram)
+ initialize_NV_registers(&compiler.Base);
+
rc_move_output(&compiler.Base, VERT_RESULT_PSIZ, VERT_RESULT_PSIZ, WRITEMASK_X);
if (vp->key.WPosAttr != FRAG_ATTRIB_MAX) {