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/main/texenvprogram.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/mesa/main/texenvprogram.c') diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 8cd8a8630e..9e04181147 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -428,7 +428,7 @@ static struct ureg register_param6( struct texenv_fragment_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); } @@ -441,7 +441,7 @@ static struct ureg register_param6( struct texenv_fragment_program *p, static struct ureg register_input( struct texenv_fragment_program *p, GLuint input ) { - p->program->InputsRead |= (1<program->Base.InputsRead |= (1 << input); return make_ureg(PROGRAM_INPUT, input); } @@ -478,7 +478,7 @@ emit_op(struct texenv_fragment_program *p, struct ureg src2 ) { GLuint nr = p->program->Base.NumInstructions++; - struct prog_instruction *inst = &p->program->Instructions[nr]; + struct prog_instruction *inst = &p->program->Base.Instructions[nr]; _mesa_memset(inst, 0, sizeof(*inst)); inst->Opcode = op; @@ -577,7 +577,7 @@ static struct ureg register_const4f( struct texenv_fragment_program *p, values[1] = s1; values[2] = s2; values[3] = s3; - idx = _mesa_add_unnamed_constant( p->program->Parameters, values ); + idx = _mesa_add_unnamed_constant( p->program->Base.Parameters, values ); return make_ureg(PROGRAM_STATE_VAR, idx); } @@ -986,7 +986,7 @@ static void create_new_program(struct state_key *key, GLcontext *ctx, p.state = key; p.program = program; - p.program->Instructions = MALLOC(sizeof(struct prog_instruction) * 100); + p.program->Base.Instructions = MALLOC(sizeof(struct prog_instruction) * 100); p.program->Base.NumInstructions = 0; p.program->Base.Target = GL_FRAGMENT_PROGRAM_ARB; p.program->NumTexIndirections = 1; /* correct? */ @@ -997,10 +997,10 @@ static void create_new_program(struct state_key *key, GLcontext *ctx, 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->Base.Parameters = _mesa_new_parameter_list(); - p.program->InputsRead = 0; - p.program->OutputsWritten = 1 << FRAG_RESULT_COLR; + p.program->Base.InputsRead = 0; + p.program->Base.OutputsWritten = 1 << FRAG_RESULT_COLR; for (unit = 0; unit < MAX_TEXTURE_UNITS; unit++) p.src_texture[unit] = undef; @@ -1076,8 +1076,7 @@ static void create_new_program(struct state_key *key, GLcontext *ctx, &p.program->Base ); if (DISASSEM) { - _mesa_print_program(p.program->NumTexInstructions + p.program->NumAluInstructions, - p.program->Instructions); + _mesa_print_program(&p.program->Base); _mesa_printf("\n"); } -- cgit v1.2.3