diff options
author | Nicolai Hähnle <nhaehnle@gmail.com> | 2009-07-25 01:08:37 +0200 |
---|---|---|
committer | Nicolai Hähnle <nhaehnle@gmail.com> | 2009-07-27 22:51:38 +0200 |
commit | 1348a7ebc0524276f2bd53086f13d2c263134db7 (patch) | |
tree | 9bf6e59eb25b1bb63b2eb2433d61929911327e18 /src | |
parent | 3f7838168781b69aea04514a57058d0aa0cc2cbb (diff) |
r300/fragprog: Finally get rid of the duplicate program copy
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c | 9 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/compiler/radeon_compiler.h | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_context.h | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_fragprog_common.c | 11 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_shader.c | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_state.c | 46 |
6 files changed, 12 insertions, 57 deletions
diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c index 014c5fbac0..3c63da8176 100644 --- a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c @@ -146,15 +146,6 @@ static void rewrite_depth_out(struct r300_fragment_program_compiler * c) void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c) { - if (c->Base.Debug) { - fflush(stdout); - _mesa_printf("Fragment Program: Initial program:\n"); - _mesa_print_program(c->program); - fflush(stdout); - } - - rc_mesa_to_rc_program(&c->Base, c->program); - insert_WPOS_trailer(c); rewriteFog(c); diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h index 6b251ba7f1..b9e1a7959a 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h @@ -74,7 +74,6 @@ void rc_transform_fragment_wpos(struct radeon_compiler * c, unsigned wpos, unsig struct r300_fragment_program_compiler { struct radeon_compiler Base; struct rX00_fragment_program_code *code; - struct gl_program * program; struct r300_fragment_program_external_state state; GLboolean is_r500; }; diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index 629fd0af27..56f05723b8 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -428,7 +428,6 @@ struct r300_vertex_program_cont { */ struct r300_fragment_program { GLboolean error; - struct gl_program *Base; struct r300_fragment_program *next; struct r300_fragment_program_external_state state; diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.c b/src/mesa/drivers/dri/r300/r300_fragprog_common.c index 0ce57e834b..05f46ad060 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog_common.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog_common.c @@ -96,14 +96,21 @@ static void translate_fragment_program(GLcontext *ctx, struct r300_fragment_prog compiler.code = &fp->code; compiler.state = fp->state; - compiler.program = _mesa_clone_program(ctx, &cont->Base.Base); compiler.is_r500 = (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) ? GL_TRUE : GL_FALSE; + if (compiler.Base.Debug) { + fflush(stdout); + _mesa_printf("Fragment Program: Initial program:\n"); + _mesa_print_program(&cont->Base.Base); + fflush(stdout); + } + + rc_mesa_to_rc_program(&compiler.Base, &cont->Base.Base); + r3xx_compile_fragment_program(&compiler); fp->error = compiler.Base.Error; fp->InputsRead = compiler.Base.Program.InputsRead; - fp->Base = compiler.program; rc_destroy(&compiler.Base); } diff --git a/src/mesa/drivers/dri/r300/r300_shader.c b/src/mesa/drivers/dri/r300/r300_shader.c index 40b073f2c7..a4f9db13ec 100644 --- a/src/mesa/drivers/dri/r300/r300_shader.c +++ b/src/mesa/drivers/dri/r300/r300_shader.c @@ -39,7 +39,6 @@ static void freeFragProgCache(GLcontext *ctx, struct r300_fragment_program_cont while (fp) { tmp = fp->next; rc_constants_destroy(&fp->code.constants); - _mesa_reference_program(ctx, &fp->Base, NULL); _mesa_free(fp); fp = tmp; } diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index c79601bcb1..1f799d5a6f 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1044,35 +1044,6 @@ void r300UpdateViewportOffset(GLcontext * ctx) radeonUpdateScissor(ctx); } -static void -r300FetchStateParameter(GLcontext * ctx, - const gl_state_index state[STATE_LENGTH], - GLfloat * value) -{ - r300ContextPtr r300 = R300_CONTEXT(ctx); - - switch (state[0]) { - case STATE_INTERNAL: - switch (state[1]) { - case STATE_R300_WINDOW_DIMENSION: { - __DRIdrawablePrivate * drawable = radeon_get_drawable(&r300->radeon); - value[0] = drawable->w * 0.5f; /* width*0.5 */ - value[1] = drawable->h * 0.5f; /* height*0.5 */ - value[2] = 0.5F; /* for moving range [-1 1] -> [0 1] */ - value[3] = 1.0F; /* not used */ - break; - } - - default: - break; - } - break; - - default: - break; - } -} - /** * Update R300's own internal state parameters. * For now just STATE_R300_WINDOW_DIMENSION @@ -1081,7 +1052,6 @@ static void r300UpdateStateParameters(GLcontext * ctx, GLuint new_state) { r300ContextPtr rmesa = R300_CONTEXT(ctx); struct gl_program_parameter_list *paramList; - GLuint i; if (!(new_state & (_NEW_BUFFERS | _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS))) return; @@ -1089,21 +1059,12 @@ static void r300UpdateStateParameters(GLcontext * ctx, GLuint new_state) if (!ctx->FragmentProgram._Current || !rmesa->selected_fp) return; - paramList = rmesa->selected_fp->Base->Parameters; + paramList = ctx->FragmentProgram._Current->Base.Parameters; if (!paramList) return; _mesa_load_state_parameters(ctx, paramList); - - for (i = 0; i < paramList->NumParameters; i++) { - if (paramList->Parameters[i].Type == PROGRAM_STATE_VAR) { - r300FetchStateParameter(ctx, - paramList->Parameters[i]. - StateIndexes, - paramList->ParameterValues[i]); - } - } } /* ============================================================= @@ -2015,12 +1976,11 @@ static const GLfloat *get_fragmentprogram_constant(GLcontext *ctx, GLuint index, { static const GLfloat dummy[4] = { 0, 0, 0, 0 }; r300ContextPtr rmesa = R300_CONTEXT(ctx); - struct r300_fragment_program * fp = rmesa->selected_fp; - struct rc_constant * rcc = &fp->code.constants.Constants[index]; + struct rc_constant * rcc = &rmesa->selected_fp->code.constants.Constants[index]; switch(rcc->Type) { case RC_CONSTANT_EXTERNAL: - return fp->Base->Parameters->ParameterValues[rcc->u.External]; + return ctx->FragmentProgram._Current->Base.Parameters->ParameterValues[rcc->u.External]; case RC_CONSTANT_IMMEDIATE: return rcc->u.Immediate; case RC_CONSTANT_STATE: |