summaryrefslogtreecommitdiff
path: root/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/arrayobj.c9
-rw-r--r--src/mesa/main/enable.c12
-rw-r--r--src/mesa/main/ffvertex_prog.c36
-rw-r--r--src/mesa/main/glheader.h10
-rw-r--r--src/mesa/main/mfeatures.h1
-rw-r--r--src/mesa/main/mtypes.h5
-rw-r--r--src/mesa/main/state.c2
-rw-r--r--src/mesa/main/varray.c31
-rw-r--r--src/mesa/main/varray.h4
9 files changed, 105 insertions, 5 deletions
diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index f08f99d8e1..d62661e2b5 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -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;
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 6b4ad8eea3..9dc55d4e69 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -92,6 +92,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:
@@ -652,6 +659,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;
@@ -1174,6 +1182,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:
diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c
index e6c7c1040f..5f3def257d 100644
--- a/src/mesa/main/ffvertex_prog.c
+++ b/src/mesa/main/ffvertex_prog.c
@@ -63,6 +63,7 @@ struct state_key {
unsigned separate_specular:1;
unsigned fog_mode:2;
unsigned point_attenuated:1;
+ unsigned point_array:1;
unsigned texture_enabled_global:1;
unsigned fragprog_inputs_read:12;
@@ -264,6 +265,11 @@ static struct state_key *make_state_key( GLcontext *ctx )
if (ctx->Point._Attenuated)
key->point_attenuated = 1;
+#if FEATURE_point_size_array
+ if (ctx->Array.ArrayObj->PointSize.Enabled)
+ key->point_array = 1;
+#endif
+
if (ctx->Texture._TexGenEnabled ||
ctx->Texture._TexMatEnabled ||
ctx->Texture._EnabledUnits)
@@ -444,12 +450,18 @@ static void release_temps( struct tnl_program *p )
+/**
+ * \param input one of VERT_ATTRIB_x tokens.
+ */
static struct ureg register_input( struct tnl_program *p, GLuint input )
{
p->program->Base.InputsRead |= (1<<input);
return make_ureg(PROGRAM_INPUT, input);
}
+/**
+ * \param input one of VERT_RESULT_x tokens.
+ */
static struct ureg register_output( struct tnl_program *p, GLuint output )
{
p->program->Base.OutputsWritten |= (1<<output);
@@ -1518,7 +1530,10 @@ static void build_texture_transform( struct tnl_program *p )
}
-static void build_pointsize( struct tnl_program *p )
+/**
+ * Point size attenuation computation.
+ */
+static void build_atten_pointsize( struct tnl_program *p )
{
struct ureg eye = get_eye_position_z(p);
struct ureg state_size = register_param1(p, STATE_POINT_SIZE);
@@ -1555,13 +1570,24 @@ static void build_pointsize( struct tnl_program *p )
/**
* Emit constant point size.
*/
-static void constant_pointsize( struct tnl_program *p )
+static void build_constant_pointsize( struct tnl_program *p )
{
struct ureg state_size = register_param1(p, STATE_POINT_SIZE);
struct ureg out = register_output(p, VERT_RESULT_PSIZ);
emit_op1(p, OPCODE_MOV, out, WRITEMASK_X, state_size);
}
+/**
+ * Pass-though per-vertex point size, from user's point size array.
+ */
+static void build_array_pointsize( struct tnl_program *p )
+{
+ struct ureg in = register_input(p, VERT_ATTRIB_POINT_SIZE);
+ struct ureg out = register_output(p, VERT_RESULT_PSIZ);
+ emit_op1(p, OPCODE_MOV, out, WRITEMASK_X, in);
+}
+
+
static void build_tnl_program( struct tnl_program *p )
{ /* Emit the program, starting with modelviewproject:
*/
@@ -1589,10 +1615,12 @@ static void build_tnl_program( struct tnl_program *p )
build_texture_transform(p);
if (p->state->point_attenuated)
- build_pointsize(p);
+ build_atten_pointsize(p);
+ else if (p->state->point_array)
+ build_array_pointsize(p);
#if 0
else
- constant_pointsize(p);
+ build_constant_pointsize(p);
#endif
/* Finish up:
diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h
index 57d7e60ad3..3131a356b8 100644
--- a/src/mesa/main/glheader.h
+++ b/src/mesa/main/glheader.h
@@ -167,6 +167,16 @@
#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
diff --git a/src/mesa/main/mfeatures.h b/src/mesa/main/mfeatures.h
index a305bbd605..c3c337ea90 100644
--- a/src/mesa/main/mfeatures.h
+++ b/src/mesa/main/mfeatures.h
@@ -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
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 8a6c84368a..0a065541e1 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -151,6 +151,7 @@ enum
VERT_ATTRIB_COLOR1 = 4,
VERT_ATTRIB_FOG = 5,
VERT_ATTRIB_COLOR_INDEX = 6,
+ VERT_ATTRIB_POINT_SIZE = 6, /*alias*/
VERT_ATTRIB_EDGEFLAG = 7,
VERT_ATTRIB_TEX0 = 8,
VERT_ATTRIB_TEX1 = 9,
@@ -1707,6 +1708,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 */
@@ -2267,6 +2269,7 @@ struct gl_renderbuffer
GLubyte IndexBits;
GLubyte DepthBits;
GLubyte StencilBits;
+ GLubyte Samples; /**< Number of samples - 0 if not multisampled */
GLvoid *Data; /**< This may not be used by some kinds of RBs */
/* Used to wrap one renderbuffer around another: */
@@ -2748,6 +2751,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
@@ -2765,6 +2769,7 @@ struct gl_matrix_stack
/*@}*/
+
/**
* \name A bunch of flags that we think might be useful to drivers.
*
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 4d1fdbf47c..315253d90a 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -448,7 +448,7 @@ _mesa_update_state_locked( GLcontext *ctx )
prog_flags |= (_NEW_TEXTURE | _NEW_FOG | _DD_NEW_SEPARATE_SPECULAR);
}
if (ctx->VertexProgram._MaintainTnlProgram) {
- prog_flags |= (_NEW_TEXTURE | _NEW_TEXTURE_MATRIX |
+ prog_flags |= (_NEW_ARRAY | _NEW_TEXTURE | _NEW_TEXTURE_MATRIX |
_NEW_TRANSFORM | _NEW_POINT |
_NEW_FOG | _NEW_LIGHT |
_MESA_NEW_NEED_EYE_COORDS);
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 220db35855..50fe874556 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -468,6 +468,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,
diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h
index ba91ecf5f6..f557940738 100644
--- a/src/mesa/main/varray.h
+++ b/src/mesa/main/varray.h
@@ -112,6 +112,10 @@ _mesa_SecondaryColorPointerEXT(GLint size, GLenum type,
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);