mesa: point size arrays
authorBrian Paul <brian.paul@tungstengraphics.com>
Wed, 25 Jun 2008 14:45:14 +0000 (08:45 -0600)
committerKeith Whitwell <keith@tungstengraphics.com>
Mon, 22 Sep 2008 05:13:56 +0000 (22:13 -0700)
src/mesa/main/arrayobj.c
src/mesa/main/enable.c
src/mesa/main/glheader.h
src/mesa/main/mfeatures.h
src/mesa/main/mtypes.h
src/mesa/main/varray.c
src/mesa/main/varray.h
src/mesa/vbo/vbo_exec_array.c

index b50e9d1d56a8e68c248ffac553d20d0c60418a65..1461239317609a6773938cb936ae04bc6854010a 100644 (file)
@@ -164,6 +164,15 @@ _mesa_initialize_array_object( GLcontext *ctx,
       obj->VertexAttrib[i].Normalized = GL_FALSE;
    }
 
+#if FEATURE_point_size_array
+   obj->PointSize.Type = GL_FLOAT;
+   obj->PointSize.Stride = 0;
+   obj->PointSize.StrideB = 0;
+   obj->PointSize.Ptr = NULL;
+   obj->PointSize.Enabled = GL_FALSE;
+   obj->PointSize.BufferObj = ctx->Array.NullBufferObj;
+#endif
+
 #if FEATURE_ARB_vertex_buffer_object
    /* Vertex array buffers */
    obj->Vertex.BufferObj = ctx->Array.NullBufferObj;
index 827d84765afb81d8ff95d7ec97a1c78aabaec9b8..e0483a72e816fda7387240f64bf78d4126b9ed9b 100644 (file)
@@ -93,6 +93,13 @@ client_state(GLcontext *ctx, GLenum cap, GLboolean state)
          flag = _NEW_ARRAY_COLOR1;
          break;
 
+#if FEATURE_point_size_array
+      case GL_POINT_SIZE_ARRAY_OES:
+         var = &ctx->Array.ArrayObj->PointSize.Enabled;
+         flag = _NEW_ARRAY_POINT_SIZE;
+         break;
+#endif
+
 #if FEATURE_NV_vertex_program
       case GL_VERTEX_ATTRIB_ARRAY0_NV:
       case GL_VERTEX_ATTRIB_ARRAY1_NV:
@@ -665,6 +672,7 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state)
       case GL_EDGE_FLAG_ARRAY:
       case GL_FOG_COORDINATE_ARRAY_EXT:
       case GL_SECONDARY_COLOR_ARRAY_EXT:
+      case GL_POINT_SIZE_ARRAY_OES:
          client_state( ctx, cap, state );
          return;
 
@@ -1189,6 +1197,10 @@ _mesa_IsEnabled( GLenum cap )
       case GL_SECONDARY_COLOR_ARRAY_EXT:
          CHECK_EXTENSION(EXT_secondary_color);
          return (ctx->Array.ArrayObj->SecondaryColor.Enabled != 0);
+#if FEATURE_point_size_array
+      case GL_POINT_SIZE_ARRAY_OES:
+         return (ctx->Array.ArrayObj->PointSize.Enabled != 0);
+#endif
 
       /* GL_EXT_histogram */
       case GL_HISTOGRAM:
index e85b10bee3b3cb4924ec2fb5d95cbd0161aa5c9f..c5f4ca9b34065f787a37e270f0422fe9162c00a4 100644 (file)
 #endif
 
 
+#ifndef GL_OES_point_size_array
+#define GL_POINT_SIZE_ARRAY_OES                                 0x8B9C
+#define GL_POINT_SIZE_ARRAY_TYPE_OES                            0x898A
+#define GL_POINT_SIZE_ARRAY_STRIDE_OES                          0x898B
+#define GL_POINT_SIZE_ARRAY_POINTER_OES                         0x898C
+#define GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES                  0x8B9F
+#endif
+
+
+
 #if !defined(CAPI) && defined(WIN32) && !defined(BUILD_FOR_SNAP)
 #define CAPI _cdecl
 #endif
index 6e73620a77efaf1f04c00d3d114a577d19917e1c..ed78f57edf6b8c27d82c72c18f0ec2f1e9852a72 100644 (file)
@@ -49,6 +49,7 @@
 #define FEATURE_fixedpt 0
 #define FEATURE_histogram  _HAVE_FULL_GL
 #define FEATURE_pixel_transfer  _HAVE_FULL_GL
+#define FEATURE_point_size_array 0
 #define FEATURE_texgen  _HAVE_FULL_GL
 #define FEATURE_texture_fxt1  _HAVE_FULL_GL
 #define FEATURE_texture_s3tc  _HAVE_FULL_GL
index 867072165a8adf68b39245edc0cf4fe94d15220d..eb284d76734e10337c558f80bc3ab0df67566c8c 100644 (file)
@@ -1693,6 +1693,7 @@ struct gl_array_object
    struct gl_client_array Index;
    struct gl_client_array EdgeFlag;
    struct gl_client_array TexCoord[MAX_TEXTURE_COORD_UNITS];
+   struct gl_client_array PointSize;
    /*@}*/
 
    /** Generic arrays for vertex programs/shaders */
@@ -2734,6 +2735,7 @@ struct gl_matrix_stack
 #define _NEW_ARRAY_FOGCOORD         VERT_BIT_FOG
 #define _NEW_ARRAY_INDEX            VERT_BIT_COLOR_INDEX
 #define _NEW_ARRAY_EDGEFLAG         VERT_BIT_EDGEFLAG
+#define _NEW_ARRAY_POINT_SIZE       VERT_BIT_COLOR_INDEX  /* aliased */
 #define _NEW_ARRAY_TEXCOORD_0       VERT_BIT_TEX0
 #define _NEW_ARRAY_TEXCOORD_1       VERT_BIT_TEX1
 #define _NEW_ARRAY_TEXCOORD_2       VERT_BIT_TEX2
@@ -2751,6 +2753,7 @@ struct gl_matrix_stack
 /*@}*/
 
 
+
 /**
  * \name A bunch of flags that we think might be useful to drivers.
  * 
index 5194523c2457143ce29b5655b39fb2798dd7a5d2..2886dfe5915d4f178187c1b971c9753b8ec92205 100644 (file)
@@ -463,6 +463,37 @@ _mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *ptr)
 }
 
 
+void GLAPIENTRY
+_mesa_PointSizePointer(GLenum type, GLsizei stride, const GLvoid *ptr)
+{
+   GLsizei elementSize;
+   GET_CURRENT_CONTEXT(ctx);
+   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+   if (stride < 0) {
+      _mesa_error( ctx, GL_INVALID_VALUE, "glPointSizePointer(stride)" );
+      return;
+   }
+
+   switch (type) {
+      case GL_FLOAT:
+         elementSize = sizeof(GLfloat);
+         break;
+#if FEATURE_fixedpt
+      case GL_FIXED:
+         elementSize = sizeof(GLfixed);
+         break;
+#endif
+      default:
+         _mesa_error( ctx, GL_INVALID_ENUM, "glPointSizePointer(type)" );
+         return;
+   }
+
+   update_array(ctx, &ctx->Array.ArrayObj->PointSize, _NEW_ARRAY_POINT_SIZE,
+                elementSize, 1, type, stride, GL_FALSE, ptr);
+}
+
+
 #if FEATURE_NV_vertex_program
 void GLAPIENTRY
 _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type,
index bb2d21b469b71af19c1956844ea2a9353d2f8003..6385689fcc9466723276633ec55e0da73985706d 100644 (file)
@@ -111,6 +111,10 @@ _mesa_SecondaryColorPointerEXT(GLint size, GLenum type,
                               GLsizei stride, const GLvoid *ptr);
 
 
+extern void GLAPIENTRY
+_mesa_PointSizePointer(GLenum type, GLsizei stride, const GLvoid *ptr);
+
+
 extern void GLAPIENTRY
 _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type,
                             GLsizei stride, const GLvoid *pointer);
index 1a782da1ea9acb444e78f33c99b6f96cd6da5f09..7541de675c9776e5b7f48ebeb1258e9bfd2a5bf8 100644 (file)
@@ -105,6 +105,10 @@ static void bind_array_obj( GLcontext *ctx )
    exec->array.legacy_array[VERT_ATTRIB_COLOR1] = &ctx->Array.ArrayObj->SecondaryColor;
    exec->array.legacy_array[VERT_ATTRIB_FOG] = &ctx->Array.ArrayObj->FogCoord;
    exec->array.legacy_array[VERT_ATTRIB_COLOR_INDEX] = &ctx->Array.ArrayObj->Index;
+   if (ctx->Array.ArrayObj->PointSize.Enabled) {
+      /* this aliases COLOR_INDEX */
+      exec->array.legacy_array[VERT_ATTRIB_POINT_SIZE] = &ctx->Array.ArrayObj->PointSize;
+   }
    exec->array.legacy_array[VERT_ATTRIB_EDGEFLAG] = &ctx->Array.ArrayObj->EdgeFlag;
 
    for (i = 0; i < 8; i++)