diff options
author | marha <marha@users.sourceforge.net> | 2012-08-27 08:17:50 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-08-27 08:17:50 +0200 |
commit | b3462c12542a69eeaa3fe90fddfbb15d30c18158 (patch) | |
tree | 294230cca0e59ee250cd70060ba3f8c3742b4023 /mesalib/src/mesa/main/varray.c | |
parent | e91ed68959d63f79e3b4973bc80c7ebcd07ed021 (diff) | |
download | vcxsrv-b3462c12542a69eeaa3fe90fddfbb15d30c18158.tar.gz vcxsrv-b3462c12542a69eeaa3fe90fddfbb15d30c18158.tar.bz2 vcxsrv-b3462c12542a69eeaa3fe90fddfbb15d30c18158.zip |
xwininfo fontconfig libX11 libXau libXext libxcb mesa pixman
xkeyboard-config git update 27 Aug 2012
Diffstat (limited to 'mesalib/src/mesa/main/varray.c')
-rw-r--r-- | mesalib/src/mesa/main/varray.c | 98 |
1 files changed, 60 insertions, 38 deletions
diff --git a/mesalib/src/mesa/main/varray.c b/mesalib/src/mesa/main/varray.c index 327fabbc1..8c3ddc524 100644 --- a/mesalib/src/mesa/main/varray.c +++ b/mesalib/src/mesa/main/varray.c @@ -133,16 +133,37 @@ update_array(struct gl_context *ctx, GLsizei elementSize; GLenum format = GL_RGBA; - if (ctx->API != API_OPENGLES && ctx->API != API_OPENGLES2) { - /* fixed point arrays / data is only allowed with OpenGL ES 1.x/2.0 */ + if (_mesa_is_gles(ctx)) { + /* Once Mesa gets support for GL_OES_vertex_half_float this mask will + * change. Adding support for this extension isn't quite as trivial as + * we'd like because ES uses a different enum value for GL_HALF_FLOAT. + */ + legalTypesMask &= ~(FIXED_GL_BIT | HALF_BIT | DOUBLE_BIT); + + /* GL_INT and GL_UNSIGNED_INT data is not allowed in OpenGL ES until + * 3.0. The 2_10_10_10 types are added in OpenGL ES 3.0 or + * GL_OES_vertex_type_10_10_10_2. + */ + if (ctx->Version < 30) { + legalTypesMask &= ~(UNSIGNED_INT_BIT + | INT_BIT + | UNSIGNED_INT_2_10_10_10_REV_BIT + | INT_2_10_10_10_REV_BIT); + } + + /* BGRA ordering is not supported in ES contexts. + */ + if (sizeMax == BGRA_OR_4) + sizeMax = 4; + } else { legalTypesMask &= ~FIXED_ES_BIT; - } - if (!ctx->Extensions.ARB_ES2_compatibility) { - legalTypesMask &= ~FIXED_GL_BIT; - } - if (!ctx->Extensions.ARB_vertex_type_2_10_10_10_rev) { - legalTypesMask &= ~(UNSIGNED_INT_2_10_10_10_REV_BIT | - INT_2_10_10_10_REV_BIT); + + if (!ctx->Extensions.ARB_ES2_compatibility) + legalTypesMask &= ~FIXED_GL_BIT; + + if (!ctx->Extensions.ARB_vertex_type_2_10_10_10_rev) + legalTypesMask &= ~(UNSIGNED_INT_2_10_10_10_REV_BIT | + INT_2_10_10_10_REV_BIT); } typeBit = type_to_bit(ctx, type); @@ -228,16 +249,15 @@ update_array(struct gl_context *ctx, void GLAPIENTRY _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { - GLbitfield legalTypes = (SHORT_BIT | INT_BIT | FLOAT_BIT | - DOUBLE_BIT | HALF_BIT | FIXED_ES_BIT | - UNSIGNED_INT_2_10_10_10_REV_BIT | - INT_2_10_10_10_REV_BIT); GET_CURRENT_CONTEXT(ctx); + GLbitfield legalTypes = (ctx->API == API_OPENGLES) + ? (BYTE_BIT | SHORT_BIT | FLOAT_BIT | FIXED_ES_BIT) + : (SHORT_BIT | INT_BIT | FLOAT_BIT | + DOUBLE_BIT | HALF_BIT | + UNSIGNED_INT_2_10_10_10_REV_BIT | + INT_2_10_10_10_REV_BIT); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - if (ctx->API == API_OPENGLES) - legalTypes |= BYTE_BIT; - update_array(ctx, "glVertexPointer", VERT_ATTRIB_POS, legalTypes, 2, 4, size, type, stride, GL_FALSE, GL_FALSE, ptr); @@ -247,12 +267,13 @@ _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) void GLAPIENTRY _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr ) { - const GLbitfield legalTypes = (BYTE_BIT | SHORT_BIT | INT_BIT | - HALF_BIT | FLOAT_BIT | DOUBLE_BIT | - FIXED_ES_BIT | - UNSIGNED_INT_2_10_10_10_REV_BIT | - INT_2_10_10_10_REV_BIT); GET_CURRENT_CONTEXT(ctx); + const GLbitfield legalTypes = (ctx->API == API_OPENGLES) + ? (BYTE_BIT | SHORT_BIT | FLOAT_BIT | FIXED_ES_BIT) + : (BYTE_BIT | SHORT_BIT | INT_BIT | + HALF_BIT | FLOAT_BIT | DOUBLE_BIT | + UNSIGNED_INT_2_10_10_10_REV_BIT | + INT_2_10_10_10_REV_BIT); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); update_array(ctx, "glNormalPointer", VERT_ATTRIB_NORMAL, @@ -264,18 +285,20 @@ _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr ) void GLAPIENTRY _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { - const GLbitfield legalTypes = (BYTE_BIT | UNSIGNED_BYTE_BIT | - SHORT_BIT | UNSIGNED_SHORT_BIT | - INT_BIT | UNSIGNED_INT_BIT | - HALF_BIT | FLOAT_BIT | DOUBLE_BIT | - FIXED_ES_BIT | - UNSIGNED_INT_2_10_10_10_REV_BIT | - INT_2_10_10_10_REV_BIT); GET_CURRENT_CONTEXT(ctx); + const GLbitfield legalTypes = (ctx->API == API_OPENGLES) + ? (UNSIGNED_BYTE_BIT | HALF_BIT | FLOAT_BIT | FIXED_ES_BIT) + : (BYTE_BIT | UNSIGNED_BYTE_BIT | + SHORT_BIT | UNSIGNED_SHORT_BIT | + INT_BIT | UNSIGNED_INT_BIT | + HALF_BIT | FLOAT_BIT | DOUBLE_BIT | + UNSIGNED_INT_2_10_10_10_REV_BIT | + INT_2_10_10_10_REV_BIT); + const GLint sizeMin = (ctx->API == API_OPENGLES) ? 4 : 3; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); update_array(ctx, "glColorPointer", VERT_ATTRIB_COLOR0, - legalTypes, 3, BGRA_OR_4, + legalTypes, sizeMin, BGRA_OR_4, size, type, stride, GL_TRUE, GL_FALSE, ptr); } @@ -330,20 +353,19 @@ void GLAPIENTRY _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { - GLbitfield legalTypes = (SHORT_BIT | INT_BIT | - HALF_BIT | FLOAT_BIT | DOUBLE_BIT | - FIXED_ES_BIT | - UNSIGNED_INT_2_10_10_10_REV_BIT | - INT_2_10_10_10_REV_BIT); GET_CURRENT_CONTEXT(ctx); + GLbitfield legalTypes = (ctx->API == API_OPENGLES) + ? (BYTE_BIT | SHORT_BIT | FLOAT_BIT | FIXED_ES_BIT) + : (SHORT_BIT | INT_BIT | + HALF_BIT | FLOAT_BIT | DOUBLE_BIT | + UNSIGNED_INT_2_10_10_10_REV_BIT | + INT_2_10_10_10_REV_BIT); + const GLint sizeMin = (ctx->API == API_OPENGLES) ? 2 : 1; const GLuint unit = ctx->Array.ActiveTexture; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - if (ctx->API == API_OPENGLES) - legalTypes |= BYTE_BIT; - update_array(ctx, "glTexCoordPointer", VERT_ATTRIB_TEX(unit), - legalTypes, 1, 4, + legalTypes, sizeMin, 4, size, type, stride, GL_FALSE, GL_FALSE, ptr); } |