summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/prog_execute.c
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-02-25 18:39:46 -0700
committerBrian <[email protected]>2007-02-25 18:39:46 -0700
commit6774f32adba96237d7a2f422435044661772d70c (patch)
treef09a2a3ce770f64ad8cef32a164fb2f6eb1a5c35 /src/mesa/shader/prog_execute.c
parent21bcb2e1f64fe7161e05e4dbb7bea5609ba30e2a (diff)
simplify _mesa_get_program_register()
Diffstat (limited to 'src/mesa/shader/prog_execute.c')
-rw-r--r--src/mesa/shader/prog_execute.c63
1 files 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.