aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/varray.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-08-11 21:14:48 +0200
committermarha <marha@users.sourceforge.net>2014-08-11 21:14:48 +0200
commitfdbedba4d50e1b28b0249c83ba11c029f096e400 (patch)
treea80ccb6275fd99644c79c67856e9c1bf1b323d62 /mesalib/src/mesa/main/varray.c
parentb33b8d8ae86876b50df96881b96074b3fe177cce (diff)
downloadvcxsrv-fdbedba4d50e1b28b0249c83ba11c029f096e400.tar.gz
vcxsrv-fdbedba4d50e1b28b0249c83ba11c029f096e400.tar.bz2
vcxsrv-fdbedba4d50e1b28b0249c83ba11c029f096e400.zip
fontconfig libX11 libxcb libxcb/xcb-proto mesa xserver xkeyboard-config git update 11 Aug 2014
xserver commit 3714f5401690b288045090c4bcd9cb01c6e4860e libxcb commit 966fba6ba4838949d0727dfa45eeb9392d1f85d9 libxcb/xcb-proto commit 4b384d2a015c50d0e93dcacda4b8260a3fd37640 xkeyboard-config commit 651a00ab656a1754b9183a383970a735209bbb50 libX11 commit 368a6401c6a3275d3497fec38a3dcbc38cd9df60 libXdmcp commit fe8eab93e9bcdbe8bb8052434bb5e676e3a0ee8f libXext commit efdcbb7634501e1117d422636a0a75d7ea84b16b libfontenc commit 0037a42107b952c9d903719615747e760e4e7247 libXinerama commit edd95182b26eb5d576d4878c559e0f17dddaa909 libXau commit 1e4635be11154dd8262f37b379511bd627defa2a xkbcomp commit d4e02a09258063c6d024c3ccd42d6b22212e6e18 pixman commit 6d2cf40166d81bfc63108504c8022dc4fec37ff5 xextproto commit 66afec3f49e8eb0d4c2e9af7088fc3116d4bafd7 randrproto commit a4a6694c059d74247c16527eef4a0ec9f56bbef6 glproto commit f84853d97d5749308992412a215fa518b6536eb3 mkfontscale commit 47908fd7a0d061fdcd21e3498da4e223ca9136d9 xwininfo commit 017b3736489985999d8dcf4d9e473e1fd6dd3647 libXft commit 214f9b5306d833e2787c75fe41dfdc9228fcb738 libXmu commit 22d9c590901e121936f50dee97dc60c4f7defb63 libxtrans commit a57a7f62242e1ea972b81414741729bf3dbae0a4 fontconfig commit 841753a93f0e5698663b7931b8456e7b96259f54 mesa commit f24be7340162c6a831b392d46d6637e9656e7a8a
Diffstat (limited to 'mesalib/src/mesa/main/varray.c')
-rw-r--r--mesalib/src/mesa/main/varray.c130
1 files changed, 80 insertions, 50 deletions
diff --git a/mesalib/src/mesa/main/varray.c b/mesalib/src/mesa/main/varray.c
index 46956efb5..230fb30cb 100644
--- a/mesalib/src/mesa/main/varray.c
+++ b/mesalib/src/mesa/main/varray.c
@@ -24,6 +24,8 @@
*/
+#include <inttypes.h> /* for PRId64 macro */
+
#include "glheader.h"
#include "imports.h"
#include "bufferobj.h"
@@ -46,21 +48,22 @@
/** Used to indicate which GL datatypes are accepted by each of the
* glVertex/Color/Attrib/EtcPointer() functions.
*/
-#define BOOL_BIT 0x1
-#define BYTE_BIT 0x2
-#define UNSIGNED_BYTE_BIT 0x4
-#define SHORT_BIT 0x8
-#define UNSIGNED_SHORT_BIT 0x10
-#define INT_BIT 0x20
-#define UNSIGNED_INT_BIT 0x40
-#define HALF_BIT 0x80
-#define FLOAT_BIT 0x100
-#define DOUBLE_BIT 0x200
-#define FIXED_ES_BIT 0x400
-#define FIXED_GL_BIT 0x800
-#define UNSIGNED_INT_2_10_10_10_REV_BIT 0x1000
-#define INT_2_10_10_10_REV_BIT 0x2000
-#define UNSIGNED_INT_10F_11F_11F_REV_BIT 0x4000
+#define BOOL_BIT (1 << 0)
+#define BYTE_BIT (1 << 1)
+#define UNSIGNED_BYTE_BIT (1 << 2)
+#define SHORT_BIT (1 << 3)
+#define UNSIGNED_SHORT_BIT (1 << 4)
+#define INT_BIT (1 << 5)
+#define UNSIGNED_INT_BIT (1 << 6)
+#define HALF_BIT (1 << 7)
+#define FLOAT_BIT (1 << 8)
+#define DOUBLE_BIT (1 << 9)
+#define FIXED_ES_BIT (1 << 10)
+#define FIXED_GL_BIT (1 << 11)
+#define UNSIGNED_INT_2_10_10_10_REV_BIT (1 << 12)
+#define INT_2_10_10_10_REV_BIT (1 << 13)
+#define UNSIGNED_INT_10F_11F_11F_REV_BIT (1 << 14)
+#define ALL_TYPE_BITS ((1 << 15) - 1)
/** Convert GL datatype enum into a <type>_BIT value seen above */
@@ -179,6 +182,53 @@ vertex_binding_divisor(struct gl_context *ctx, GLuint bindingIndex,
/**
+ * Examine the API profile and extensions to determine which types are legal
+ * for vertex arrays. This is called once from update_array_format().
+ */
+static GLbitfield
+get_legal_types_mask(const struct gl_context *ctx)
+{
+ GLbitfield legalTypesMask = ALL_TYPE_BITS;
+
+ if (_mesa_is_gles(ctx)) {
+ legalTypesMask &= ~(FIXED_GL_BIT |
+ DOUBLE_BIT |
+ UNSIGNED_INT_10F_11F_11F_REV_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. GL_HALF_FLOAT data is not allowed
+ * until 3.0 or with the GL_OES_vertex_half float extension, which isn't
+ * quite as trivial as we'd like because it uses a different enum value
+ * for GL_HALF_FLOAT_OES.
+ */
+ 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 |
+ HALF_BIT);
+ }
+ }
+ 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_vertex_type_10f_11f_11f_rev)
+ legalTypesMask &= ~UNSIGNED_INT_10F_11F_11F_REV_BIT;
+ }
+
+ return legalTypesMask;
+}
+
+
+/**
* Does error checking and updates the format in an attrib array.
*
* Called by update_array() and VertexAttrib*Format().
@@ -208,40 +258,19 @@ update_array_format(struct gl_context *ctx,
GLuint elementSize;
GLenum format = GL_RGBA;
- if (_mesa_is_gles(ctx)) {
- legalTypesMask &= ~(FIXED_GL_BIT | DOUBLE_BIT | UNSIGNED_INT_10F_11F_11F_REV_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. GL_HALF_FLOAT data is not allowed
- * until 3.0 or with the GL_OES_vertex_half float extension, which isn't
- * quite as trivial as we'd like because it uses a different enum value
- * for GL_HALF_FLOAT_OES.
+ if (ctx->Array.LegalTypesMask == 0) {
+ /* One-time initialization. We can't do this in _mesa_init_varrays()
+ * below because extensions are not yet enabled at that point.
*/
- 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
- | HALF_BIT);
- }
+ ctx->Array.LegalTypesMask = get_legal_types_mask(ctx);
+ }
+
+ legalTypesMask &= ctx->Array.LegalTypesMask;
+ if (_mesa_is_gles(ctx) && sizeMax == BGRA_OR_4) {
/* 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_vertex_type_10f_11f_11f_rev)
- legalTypesMask &= ~UNSIGNED_INT_10F_11F_11F_REV_BIT;
+ sizeMax = 4;
}
typeBit = type_to_bit(ctx, type);
@@ -1397,7 +1426,8 @@ _mesa_BindVertexBuffer(GLuint bindingIndex, GLuint buffer, GLintptr offset,
*/
if (offset < 0) {
_mesa_error(ctx, GL_INVALID_VALUE,
- "glBindVertexBuffer(offset=%lld < 0)", (long long)offset);
+ "glBindVertexBuffer(offset=%" PRId64 " < 0)",
+ (int64_t) offset);
return;
}
@@ -1523,15 +1553,15 @@ _mesa_BindVertexBuffers(GLuint first, GLsizei count, const GLuint *buffers,
*/
if (offsets[i] < 0) {
_mesa_error(ctx, GL_INVALID_VALUE,
- "glBindVertexBuffer(offsets[%u]=%lldd < 0)",
- i, (long long int) offsets[i]);
+ "glBindVertexBuffer(offsets[%u]=%" PRId64 " < 0)",
+ i, (int64_t) offsets[i]);
continue;
}
if (strides[i] < 0) {
_mesa_error(ctx, GL_INVALID_VALUE,
- "glBindVertexBuffer(strides[%u]=%lld < 0)",
- i, (long long int) strides[i]);
+ "glBindVertexBuffer(strides[%u]=%d < 0)",
+ i, strides[i]);
continue;
}