-/* $Id: t_vb_program.c,v 1.13 2002/06/23 02:40:48 brianp Exp $ */
+/* $Id: t_vb_program.c,v 1.14 2002/08/08 16:55:56 brianp Exp $ */
/*
* Mesa 3-D graphics library
struct vp_program *program = ctx->VertexProgram.Current;
GLuint i;
- _mesa_init_tracked_matrices(ctx);
- _mesa_init_vp_registers(ctx); /* init temp and result regs */
- /* XXX if GL_FOG is enabled but the program doesn't write to the
- * o[FOGC] register, set the fog result to 1.0
- */
- /* XXX if GL_VERTEX_PROGRAM_POINT_SIZE_NV is enabled but the program
- * doesn't write the PSIZ variable then use ctx->Point.Size
- */
+ _mesa_init_tracked_matrices(ctx); /* load registers with matrices */
+ _mesa_init_vp_registers(ctx); /* init temp and result regs */
for (i = 0; i < VB->Count; i++) {
GLuint attr;
/* execute the program */
ASSERT(program);
_mesa_exec_program(ctx, program);
+
#if 0
printf("Output %d: %f, %f, %f, %f\n", i,
machine->Registers[VP_OUTPUT_REG_START + 0][0],
machine->Registers[VP_OUTPUT_REG_START + VERT_RESULT_PSIZ][0]);
#endif
+ /* Fixup fog an point size results if needed */
+ if (ctx->Fog.Enabled &&
+ (program->OutputsWritten & (1 << VERT_RESULT_FOGC)) == 0) {
+ machine->Registers[VP_OUTPUT_REG_START + VERT_RESULT_FOGC][0] = 1.0;
+ }
+
+ if (ctx->VertexProgram.PointSizeEnabled &&
+ (program->OutputsWritten & (1 << VERT_RESULT_PSIZ)) == 0) {
+ machine->Registers[VP_OUTPUT_REG_START + VERT_RESULT_PSIZ][0]
+ = ctx->Point.Size;
+ }
+
/* copy the output registers into the VB->attribs arrays */
/* XXX (optimize) could use a conditional and smaller loop limit here */
for (attr = 0; attr < 15; attr++) {