From de99760bf3511d05185799c4fb4347f9e5f420f4 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 12 Nov 2005 17:53:14 +0000 Subject: Move stuff common to vertex/fragment_program into the base class, including: Instructions, InputsRead, OutputsWritten, and Parameters. Also, added debug functions: _mesa_print_instruction(), _mesa_print_program_parameters() and revamp _mesa_print_program(). --- src/mesa/tnl/t_vp_build.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'src/mesa/tnl/t_vp_build.c') diff --git a/src/mesa/tnl/t_vp_build.c b/src/mesa/tnl/t_vp_build.c index 4ff70cd6ed..0f1f303be2 100644 --- a/src/mesa/tnl/t_vp_build.c +++ b/src/mesa/tnl/t_vp_build.c @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 6.3.1 + * Version: 6.5 * * Copyright (C) 2005 Tungsten Graphics All Rights Reserved. * @@ -124,7 +124,7 @@ static struct state_key *make_state_key( GLcontext *ctx ) */ assert(fp); - key->fragprog_inputs_read = fp->InputsRead; + key->fragprog_inputs_read = fp->Base.InputsRead; key->separate_specular = (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR); @@ -365,13 +365,13 @@ static void release_temps( struct tnl_program *p ) static struct ureg register_input( struct tnl_program *p, GLuint input ) { - p->program->InputsRead |= (1<program->Base.InputsRead |= (1<program->OutputsWritten |= (1<program->Base.OutputsWritten |= (1<program->Parameters, values ); + idx = _mesa_add_unnamed_constant( p->program->Base.Parameters, values ); return make_ureg(PROGRAM_STATE_VAR, idx); } @@ -425,7 +425,7 @@ static struct ureg register_param6( struct tnl_program *p, tokens[3] = s3; tokens[4] = s4; tokens[5] = s5; - idx = _mesa_add_state_reference( p->program->Parameters, tokens ); + idx = _mesa_add_state_reference( p->program->Base.Parameters, tokens ); return make_ureg(PROGRAM_STATE_VAR, idx); } @@ -492,7 +492,7 @@ static void debug_insn( struct prog_instruction *inst, const char *fn, } _mesa_printf("%d:\t", line); - _mesa_print_program(1, inst); + _mesa_print_instruction(inst); } } @@ -508,7 +508,7 @@ static void emit_op3fn(struct tnl_program *p, GLuint line) { GLuint nr = p->program->Base.NumInstructions++; - struct prog_instruction *inst = &p->program->Instructions[nr]; + struct prog_instruction *inst = &p->program->Base.Instructions[nr]; if (p->program->Base.NumInstructions > MAX_INSN) { _mesa_problem(0, "Out of instructions in emit_op3fn\n"); @@ -1406,15 +1406,16 @@ create_new_program( const struct state_key *key, else p.temp_reserved = ~((1<Instructions = MALLOC(sizeof(struct prog_instruction) * MAX_INSN); + p.program->Base.Instructions + = MALLOC(sizeof(struct prog_instruction) * MAX_INSN); p.program->Base.String = 0; p.program->Base.NumInstructions = p.program->Base.NumTemporaries = p.program->Base.NumParameters = p.program->Base.NumAttributes = p.program->Base.NumAddressRegs = 0; - p.program->Parameters = _mesa_new_parameter_list(); - p.program->InputsRead = 0; - p.program->OutputsWritten = 0; + p.program->Base.Parameters = _mesa_new_parameter_list(); + p.program->Base.InputsRead = 0; + p.program->Base.OutputsWritten = 0; build_tnl_program( &p ); } -- cgit v1.2.3