From 6774f32adba96237d7a2f422435044661772d70c Mon Sep 17 00:00:00 2001 From: Brian Date: Sun, 25 Feb 2007 18:39:46 -0700 Subject: [PATCH] simplify _mesa_get_program_register() --- src/mesa/shader/prog_execute.c | 63 +++++++++++++--------------------- 1 file changed, 24 insertions(+), 39 deletions(-) diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c index 1b7ed4c5d0e..562650e8ca9 100644 --- a/src/mesa/shader/prog_execute.c +++ b/src/mesa/shader/prog_execute.c @@ -74,45 +74,6 @@ static const GLfloat ZeroVec[4] = { 0.0F, 0.0F, 0.0F, 0.0F }; -#if FEATURE_MESA_program_debug -static struct gl_program_machine *CurrentMachine = NULL; - -/** - * For GL_MESA_program_debug. - * Return current value (4*GLfloat) of a program register. - * Called via ctx->Driver.GetFragmentProgramRegister(). - */ -void -_mesa_get_program_register(GLcontext *ctx, enum register_file file, - GLuint index, GLfloat val[4]) -{ - if (CurrentMachine) { - switch (file) { - case PROGRAM_INPUT: - if (CurrentMachine->CurProgram->Target == GL_VERTEX_PROGRAM_ARB) { - COPY_4V(val, CurrentMachine->VertAttribs[index]); - } - else { - COPY_4V(val, - CurrentMachine->Attribs[index][CurrentMachine->CurElement]); - } - break; - case PROGRAM_OUTPUT: - COPY_4V(val, CurrentMachine->Outputs[index]); - break; - case PROGRAM_TEMPORARY: - COPY_4V(val, CurrentMachine->Temporaries[index]); - break; - default: - _mesa_problem(NULL, - "bad register file in _swrast_get_program_register"); - } - } -} -#endif /* FEATURE_MESA_program_debug */ - - - /** * Return a pointer to the 4-element float vector specified by the given * source register. @@ -187,6 +148,30 @@ get_register_pointer(GLcontext * ctx, } +#if FEATURE_MESA_program_debug +static struct gl_program_machine *CurrentMachine = NULL; + +/** + * For GL_MESA_program_debug. + * Return current value (4*GLfloat) of a program register. + * Called via ctx->Driver.GetProgramRegister(). + */ +void +_mesa_get_program_register(GLcontext *ctx, enum register_file file, + GLuint index, GLfloat val[4]) +{ + if (CurrentMachine) { + struct prog_src_register src; + const GLfloat *reg; + src.File = file; + src.Index = index; + reg = get_register_pointer(ctx, &src, CurrentMachine); + COPY_4V(val, reg); + } +} +#endif /* FEATURE_MESA_program_debug */ + + /** * Fetch a 4-element float vector from the given source register. * Apply swizzling and negating as needed. -- 2.30.2