From: Nicolai Hähnle Date: Thu, 16 Jul 2009 20:23:48 +0000 (+0200) Subject: r300: Remove GLcontext requirement from radeon_program_pair X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d29cdde569cc685beb791a6693f8ae28e2ef5115;p=mesa.git r300: Remove GLcontext requirement from radeon_program_pair Signed-off-by: Nicolai Hähnle --- diff --git a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c index 1aeba8f4984..d6784d1c22a 100644 --- a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c +++ b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c @@ -334,7 +334,7 @@ GLboolean r300BuildFragmentProgramHwCode(struct r300_fragment_program_compiler * code->node[0].alu_end = -1; code->node[0].tex_end = -1; - if (!radeonPairProgram(compiler->ctx, compiler->program, &pair_handler, compiler)) + if (!radeonPairProgram(compiler->program, &pair_handler, compiler)) return GL_FALSE; if (!finish_node(compiler)) diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c index b5f665b66c3..3d5ddbb981b 100644 --- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c +++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c @@ -310,7 +310,7 @@ GLboolean r500BuildFragmentProgramHwCode(struct r300_fragment_program_compiler * code->inst_offset = 0; code->inst_end = -1; - if (!radeonPairProgram(compiler->ctx, compiler->program, &pair_handler, compiler)) + if (!radeonPairProgram(compiler->program, &pair_handler, compiler)) return GL_FALSE; if ((code->inst[code->inst_end].inst0 & R500_INST_TYPE_MASK) != R500_INST_TYPE_OUT) { diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c index 3274c83d4da..4be948b0c11 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c @@ -41,7 +41,7 @@ #include "shader/prog_print.h" #define error(fmt, args...) do { \ - _mesa_problem(s->Ctx, "%s::%s(): " fmt "\n", \ + fprintf(stderr, "r300 driver problem: %s::%s(): " fmt "\n", \ __FILE__, __FUNCTION__, ##args); \ s->Error = GL_TRUE; \ } while(0) @@ -120,7 +120,6 @@ struct pair_register_translation { }; struct pair_state { - GLcontext *Ctx; struct memory_pool Pool; struct gl_program *Program; const struct radeon_pair_handler *Handler; @@ -175,7 +174,7 @@ static GLuint get_hw_reg(struct pair_state *s, GLuint file, GLuint index) struct pair_register_translation *t = get_register(s, file, index); if (!t) { - _mesa_problem(s->Ctx, "get_hw_reg: %i[%i]\n", file, index); + error("get_hw_reg: %i[%i]\n", file, index); return 0; } @@ -456,7 +455,7 @@ static void allocate_input_registers(struct pair_state *s) InputsRead &= ~FRAG_BIT_COL1; /* Texcoords */ - for (i = 0; i < s->Ctx->Const.MaxTextureUnits; i++) { + for (i = 0; i < 8; i++) { if (InputsRead & (FRAG_BIT_TEX0 << i)) alloc_hw_reg(s, PROGRAM_INPUT, FRAG_ATTRIB_TEX0+i, hwindex++); } @@ -877,13 +876,12 @@ static void emit_alu(struct pair_state *s) } -GLboolean radeonPairProgram(GLcontext *ctx, struct gl_program *program, +GLboolean radeonPairProgram(struct gl_program *program, const struct radeon_pair_handler* handler, void *userdata) { struct pair_state s; _mesa_bzero(&s, sizeof(s)); - s.Ctx = ctx; memory_pool_init(&s.Pool); s.Program = program; s.Handler = handler; diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.h b/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.h index f203d4886f2..9f479766332 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.h @@ -139,7 +139,7 @@ struct radeon_pair_handler { GLuint MaxHwTemps; }; -GLboolean radeonPairProgram(GLcontext *ctx, struct gl_program *program, +GLboolean radeonPairProgram(struct gl_program *program, const struct radeon_pair_handler*, void *userdata); void radeonPrintPairInstruction(struct radeon_pair_instruction *inst);