diff options
author | Brian Paul <brianp@vmware.com> | 2010-11-07 18:35:35 -0700 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2010-11-07 18:35:35 -0700 |
commit | 11dd228415d9299f3afa81525d0e588135099b4b (patch) | |
tree | 40a4d9a3468c2cc0b9e519c8984db73b437c5c1e /src/mesa/main | |
parent | 802bd6b7059122bccaf4bd27ae4062a70aa4e918 (diff) |
mesa: make fixed-pt and byte-valued arrays a runtime feature
These ES1 features were only tested for in the vertex array code.
Checking the ctx->API field at runtime is cleaner than the #ifdef
stuff and supports choosing the API at runtime.
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/mfeatures.h | 2 | ||||
-rw-r--r-- | src/mesa/main/varray.c | 46 |
2 files changed, 25 insertions, 23 deletions
diff --git a/src/mesa/main/mfeatures.h b/src/mesa/main/mfeatures.h index 911b30dda2..1b39f5fdd3 100644 --- a/src/mesa/main/mfeatures.h +++ b/src/mesa/main/mfeatures.h @@ -107,9 +107,7 @@ #define FEATURE_texture_s3tc FEATURE_GL #define FEATURE_extra_context_init FEATURE_ES -#define FEATURE_fixedpt FEATURE_ES #define FEATURE_point_size_array FEATURE_ES -#define FEATURE_vertex_array_byte FEATURE_ES #define FEATURE_es2_glsl FEATURE_ES2 diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 6cb9638c9f..340c3fe1d3 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -58,17 +58,6 @@ #define DOUBLE_BIT 0x200 #define FIXED_BIT 0x400 -/* These are specific to certain features/extensions */ -#if FEATURE_fixedpt -#define EXT_FIXED_BIT FIXED_BIT -#else -#define EXT_FIXED_BIT 0x0 -#endif -#if FEATURE_vertex_array_byte -#define EXT_BYTE_BIT BYTE_BIT -#else -#define EXT_BYTE_BIT 0x0 -#endif /** Convert GL datatype enum into a <type>_BIT value seen above */ @@ -138,6 +127,11 @@ update_array(struct gl_context *ctx, GLsizei elementSize; GLenum format = GL_RGBA; + if (ctx->API != API_OPENGLES) { + /* fixed point arrays / data is only allowed with OpenGL ES 1.x */ + legalTypesMask &= ~FIXED_BIT; + } + typeBit = type_to_bit(ctx, type); if (typeBit == 0x0 || (typeBit & legalTypesMask) == 0x0) { _mesa_error(ctx, GL_INVALID_ENUM, "%s(type = %s)", @@ -202,12 +196,14 @@ update_array(struct gl_context *ctx, void GLAPIENTRY _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { - const GLbitfield legalTypes = (SHORT_BIT | INT_BIT | FLOAT_BIT | - DOUBLE_BIT | HALF_BIT | - EXT_FIXED_BIT | EXT_BYTE_BIT); + GLbitfield legalTypes = (SHORT_BIT | INT_BIT | FLOAT_BIT | + DOUBLE_BIT | HALF_BIT | FIXED_BIT); GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (ctx->API == API_OPENGLES) + legalTypes |= BYTE_BIT; + update_array(ctx, "glVertexPointer", &ctx->Array.ArrayObj->Vertex, _NEW_ARRAY_VERTEX, legalTypes, 2, 4, @@ -220,7 +216,7 @@ _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr ) { const GLbitfield legalTypes = (BYTE_BIT | SHORT_BIT | INT_BIT | HALF_BIT | FLOAT_BIT | DOUBLE_BIT | - EXT_FIXED_BIT); + FIXED_BIT); GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); @@ -238,7 +234,7 @@ _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) SHORT_BIT | UNSIGNED_SHORT_BIT | INT_BIT | UNSIGNED_INT_BIT | HALF_BIT | FLOAT_BIT | DOUBLE_BIT | - EXT_FIXED_BIT); + FIXED_BIT); GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); @@ -300,13 +296,15 @@ void GLAPIENTRY _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { - const GLbitfield legalTypes = (EXT_BYTE_BIT | SHORT_BIT | INT_BIT | - HALF_BIT | FLOAT_BIT | DOUBLE_BIT | - EXT_FIXED_BIT); + GLbitfield legalTypes = (SHORT_BIT | INT_BIT | + HALF_BIT | FLOAT_BIT | DOUBLE_BIT); GET_CURRENT_CONTEXT(ctx); const GLuint unit = ctx->Array.ActiveTexture; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (ctx->API == API_OPENGLES) + legalTypes |= BYTE_BIT; + ASSERT(unit < Elements(ctx->Array.ArrayObj->TexCoord)); update_array(ctx, "glTexCoordPointer", @@ -337,10 +335,16 @@ _mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *ptr) void GLAPIENTRY _mesa_PointSizePointer(GLenum type, GLsizei stride, const GLvoid *ptr) { - const GLbitfield legalTypes = (FLOAT_BIT | EXT_FIXED_BIT); + const GLbitfield legalTypes = (FLOAT_BIT | FIXED_BIT); GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (ctx->API != API_OPENGLES) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glPointSizePointer(ES 1.x only)"); + return; + } + update_array(ctx, "glPointSizePointer", &ctx->Array.ArrayObj->PointSize, _NEW_ARRAY_POINT_SIZE, legalTypes, 1, 1, @@ -399,7 +403,7 @@ _mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type, SHORT_BIT | UNSIGNED_SHORT_BIT | INT_BIT | UNSIGNED_INT_BIT | HALF_BIT | FLOAT_BIT | DOUBLE_BIT | - EXT_FIXED_BIT); + FIXED_BIT); GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); |