Mesa (master): mesa: minor code simplification in _mesa_GetVertexAttribfvARB()

Brian Paul brianp at kemper.freedesktop.org
Thu May 21 22:12:23 UTC 2009


Module: Mesa
Branch: master
Commit: 254845fad064eabd92c7a72322e647137ec719e9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=254845fad064eabd92c7a72322e647137ec719e9

Author: Brian Paul <brianp at vmware.com>
Date:   Thu May 21 15:57:29 2009 -0600

mesa: minor code simplification in _mesa_GetVertexAttribfvARB()

---

 src/mesa/shader/arbprogram.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/mesa/shader/arbprogram.c b/src/mesa/shader/arbprogram.c
index 317d623..98c2e30 100644
--- a/src/mesa/shader/arbprogram.c
+++ b/src/mesa/shader/arbprogram.c
@@ -302,6 +302,7 @@ _mesa_GetVertexAttribdvARB(GLuint index, GLenum pname, GLdouble *params)
 void GLAPIENTRY
 _mesa_GetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat *params)
 {
+   const struct gl_client_array *array;
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
@@ -310,21 +311,23 @@ _mesa_GetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat *params)
       return;
    }
 
+   array = &ctx->Array.ArrayObj->VertexAttrib[index];
+
    switch (pname) {
       case GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB:
-         params[0] = (GLfloat) ctx->Array.ArrayObj->VertexAttrib[index].Enabled;
+         params[0] = (GLfloat) array->Enabled;
          break;
       case GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB:
-         params[0] = (GLfloat) ctx->Array.ArrayObj->VertexAttrib[index].Size;
+         params[0] = (GLfloat) array->Size;
          break;
       case GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB:
-         params[0] = (GLfloat) ctx->Array.ArrayObj->VertexAttrib[index].Stride;
+         params[0] = (GLfloat) array->Stride;
          break;
       case GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB:
-         params[0] = (GLfloat) ctx->Array.ArrayObj->VertexAttrib[index].Type;
+         params[0] = (GLfloat) array->Type;
          break;
       case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB:
-         params[0] = ctx->Array.ArrayObj->VertexAttrib[index].Normalized;
+         params[0] = array->Normalized;
          break;
       case GL_CURRENT_VERTEX_ATTRIB_ARB:
          if (index == 0) {
@@ -336,7 +339,7 @@ _mesa_GetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat *params)
          COPY_4V(params, ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index]);
          break;
       case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB:
-         params[0] = (GLfloat) ctx->Array.ArrayObj->VertexAttrib[index].BufferObj->Name;
+         params[0] = (GLfloat) array->BufferObj->Name;
          break;
       default:
          _mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribfvARB(pname)");




More information about the mesa-commit mailing list