r300/fragprog: Finally get rid of the duplicate program copy
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user