X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fffvertex_prog.c;h=85f8f24d83019400a5ac5c3e17718b6ebef8c2dd;hb=e618761233a07a350e4d4a24e38c8cf69ba9b6d3;hp=15997ccfdca9027105f67324ebb878f965ae4a88;hpb=81faead818a0b2fde131df019f5dfb0baef49273;p=mesa.git diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 15997ccfdca..85f8f24d830 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -148,11 +148,10 @@ static GLboolean check_active_shininess( struct gl_context *ctx, static void make_state_key( struct gl_context *ctx, struct state_key *key ) { - const struct gl_fragment_program *fp; + const struct gl_program *fp = ctx->FragmentProgram._Current; GLbitfield mask; memset(key, 0, sizeof(struct state_key)); - fp = ctx->FragmentProgram._Current; /* This now relies on texenvprogram.c being active: */ @@ -160,7 +159,7 @@ static void make_state_key( struct gl_context *ctx, struct state_key *key ) key->need_eye_coords = ctx->_NeedEyeCoords; - key->fragprog_inputs_read = fp->Base.InputsRead; + key->fragprog_inputs_read = fp->info.inputs_read; key->varying_vp_inputs = ctx->varying_vp_inputs; if (ctx->RenderMode == GL_FEEDBACK) { @@ -384,8 +383,8 @@ static struct ureg get_temp( struct tnl_program *p ) exit(1); } - if ((GLuint) bit > p->program->NumTemporaries) - p->program->NumTemporaries = bit; + if ((GLuint) bit > p->program->arb.NumTemporaries) + p->program->arb.NumTemporaries = bit; p->temp_in_use |= 1<<(bit-1); return make_ureg(PROGRAM_TEMPORARY, bit-1); @@ -448,7 +447,7 @@ static struct ureg register_input( struct tnl_program *p, GLuint input ) assert(input < VERT_ATTRIB_MAX); if (p->state->varying_vp_inputs & VERT_BIT(input)) { - p->program->InputsRead |= VERT_BIT(input); + p->program->info.inputs_read |= VERT_BIT(input); return make_ureg(PROGRAM_INPUT, input); } else { @@ -462,7 +461,7 @@ static struct ureg register_input( struct tnl_program *p, GLuint input ) */ static struct ureg register_output( struct tnl_program *p, GLuint output ) { - p->program->OutputsWritten |= BITFIELD64_BIT(output); + p->program->info.outputs_written |= BITFIELD64_BIT(output); return make_ureg(PROGRAM_OUTPUT, output); } @@ -578,33 +577,33 @@ static void emit_op3fn(struct tnl_program *p, GLuint nr; struct prog_instruction *inst; - assert(p->program->NumInstructions <= p->max_inst); + assert(p->program->arb.NumInstructions <= p->max_inst); - if (p->program->NumInstructions == p->max_inst) { + if (p->program->arb.NumInstructions == p->max_inst) { /* need to extend the program's instruction array */ struct prog_instruction *newInst; /* double the size */ p->max_inst *= 2; - newInst = _mesa_alloc_instructions(p->max_inst); + newInst = + rzalloc_array(p->program, struct prog_instruction, p->max_inst); if (!newInst) { _mesa_error(NULL, GL_OUT_OF_MEMORY, "vertex program build"); return; } - _mesa_copy_instructions(newInst, p->program->Instructions, - p->program->NumInstructions); + _mesa_copy_instructions(newInst, p->program->arb.Instructions, + p->program->arb.NumInstructions); - _mesa_free_instructions(p->program->Instructions, - p->program->NumInstructions); + ralloc_free(p->program->arb.Instructions); - p->program->Instructions = newInst; + p->program->arb.Instructions = newInst; } - nr = p->program->NumInstructions++; + nr = p->program->arb.NumInstructions++; - inst = &p->program->Instructions[nr]; + inst = &p->program->arb.Instructions[nr]; inst->Opcode = (enum prog_opcode) op; emit_arg( &inst->SrcReg[0], src0 ); @@ -1633,15 +1632,16 @@ create_new_program( const struct state_key *key, * If we need more, we'll grow the instruction array as needed. */ p.max_inst = 32; - p.program->Instructions = _mesa_alloc_instructions(p.max_inst); + p.program->arb.Instructions = + rzalloc_array(program, struct prog_instruction, p.max_inst); p.program->String = NULL; - p.program->NumInstructions = - p.program->NumTemporaries = - p.program->NumParameters = - p.program->NumAttributes = p.program->NumAddressRegs = 0; + p.program->arb.NumInstructions = + p.program->arb.NumTemporaries = + p.program->arb.NumParameters = + p.program->arb.NumAttributes = p.program->arb.NumAddressRegs = 0; p.program->Parameters = _mesa_new_parameter_list(); - p.program->InputsRead = 0; - p.program->OutputsWritten = 0; + p.program->info.inputs_read = 0; + p.program->info.outputs_written = 0; build_tnl_program( &p ); } @@ -1671,7 +1671,7 @@ _mesa_get_fixed_func_vertex_program(struct gl_context *ctx) if (0) printf("Build new TNL program\n"); - prog = ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0); + prog = ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0, true); if (!prog) return NULL;