aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesalib/docs/news.html7
-rw-r--r--mesalib/docs/relnotes-7.10.2.html206
-rw-r--r--mesalib/docs/relnotes.html1
-rw-r--r--mesalib/src/mesa/main/arrayobj.c34
-rw-r--r--mesalib/src/mesa/main/extensions.c2
-rw-r--r--mesalib/src/mesa/main/state.c33
-rw-r--r--mesalib/src/mesa/main/varray.c2410
-rw-r--r--mesalib/src/mesa/main/varray.h31
-rw-r--r--pixman/Makefile.am7
-rw-r--r--pixman/pixman/pixman-arm-neon-asm.S5
-rw-r--r--xorg-server/Xext/geext.c9
-rw-r--r--xorg-server/dix/eventconvert.c14
-rw-r--r--xorg-server/dix/getevents.c4
-rw-r--r--xorg-server/xkeyboard-config/rules/base.xml.in2
14 files changed, 1475 insertions, 1290 deletions
diff --git a/mesalib/docs/news.html b/mesalib/docs/news.html
index 8185e14a9..5c21c11cd 100644
--- a/mesalib/docs/news.html
+++ b/mesalib/docs/news.html
@@ -11,6 +11,13 @@
<H1>News</H1>
+<h2>April 6, 2011</h2>
+
+<p>
+<a href="relnotes-7.10.2.html">Mesa 7.10.2</a> is released. This is a bug
+fix release release.
+</p>
+
<h2>March 2, 2011</h2>
<p>
diff --git a/mesalib/docs/relnotes-7.10.2.html b/mesalib/docs/relnotes-7.10.2.html
new file mode 100644
index 000000000..55b6794a1
--- /dev/null
+++ b/mesalib/docs/relnotes-7.10.2.html
@@ -0,0 +1,206 @@
+<HTML>
+
+<head>
+<TITLE>Mesa Release Notes</TITLE>
+<link rel="stylesheet" type="text/css" href="mesa.css">
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+</head>
+
+<BODY>
+
+<body bgcolor="#eeeeee">
+
+<H1>Mesa 7.10.2 Release Notes / April 6, 2011</H1>
+
+<p>
+Mesa 7.10.2 is a bug fix release which fixes bugs found since the 7.10 release.
+</p>
+<p>
+Mesa 7.10.2 implements the OpenGL 2.1 API, but the version reported by
+glGetString(GL_VERSION) depends on the particular driver being used.
+Some drivers don't support all the features required in OpenGL 2.1.
+</p>
+<p>
+See the <a href="install.html">Compiling/Installing page</a> for prerequisites
+for DRI hardware acceleration.
+</p>
+
+
+<h2>MD5 checksums</h2>
+<pre>
+2f9f444265534a2cfd9a99d1a8291089 MesaLib-7.10.2.tar.gz
+f5de82852f1243f42cc004039e10b771 MesaLib-7.10.2.tar.bz2
+47836e37bab6fcafe3ac90c9544ba0e9 MesaLib-7.10.2.zip
+175120325828f313621cc5bc6c504803 MesaGLUT-7.10.2.tar.gz
+8c71d273f5f8d6c5eda4ffc39e0fe03e MesaGLUT-7.10.2.tar.bz2
+03036c8efe7b791a90fa0f2c41b43f43 MesaGLUT-7.10.2.zip
+</pre>
+
+
+<h2>New features</h2>
+<p>None.</p>
+
+<h2>Bug fixes</h2>
+<p>This list is likely incomplete.</p>
+<ul>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=29172">Bug 29172</a> - Arrandale - Pill Popper Pops Pills</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31159">Bug 31159</a> - shadow problem in 0ad game</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32688">Bug 32688</a> - [RADEON:KMS:R300G] some games have a wireframe or outline visible</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32949">Bug 32949</a> - [glsl wine] Need for Speed renders incorrectly with GLSL enabled</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=34203">Bug 34203</a> - [GLSL] fail to call long chains across shaders</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=34376">Bug 34376</a> - [GLSL] allowing assignment to unsized array
+ <ul>
+ <li>The commit message incorrectly
+ lists <a href="https://bugs.freedesktop.org/show_bug.cgi?id=34367">bug
+ 34367</a>.</li>
+ </ul>
+</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=34370">Bug 34370</a> - [GLSL] "i&lt;5 &amp;&amp; i&lt;4" in for loop fails</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=34374">Bug 34374</a> - [GLSL] fail to redeclare an array using initializer</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=35073">Bug 35073</a> - [GM45] Alpha test is broken when rendering to FBO with no color attachment</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=35483">Bug 35483</a> - util_blit_pixels_writemask: crash in line 322 of src/gallium/auxiliary/util/u_blit.c</li>
+
+<!-- <li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=">Bug </a> - </li> -->
+
+</ul>
+
+
+<h2>Changes</h2>
+<p>The full set of changes can be viewed by using the following GIT command:</p>
+
+<pre>
+ git log mesa-7.10.1..mesa-7.10.2
+</pre>
+
+<p><em>Note:</em> Reverted commits and the reverts are not included in this list.</p>
+
+<p>Alex Deucher (2):
+<ul>
+ <li>r600c: add new ontario pci ids</li>
+ <li>r600g: add some additional ontario pci ids</li>
+</ul></p>
+
+<p>Benjamin Franzke (1):
+<ul>
+ <li>st/dri: Fix surfaceless gl using contexts with previous bound surfaces</li>
+</ul></p>
+
+<p>Brian Paul (9):
+<ul>
+ <li>docs: pull 7.9.2 release notes into 7.10 branch</li>
+ <li>docs: update news.html with 7.10.1 and 7.9.2 releases</li>
+ <li>docs: fill in 7.10.1 release data</li>
+ <li>docs: add, fix release notes links</li>
+ <li>docs: update info about Mesa packaging/contents</li>
+ <li>docs: update prerequisites, remove old demo info</li>
+ <li>mesa: Guard against null pointer deref in fbo validation</li>
+ <li>st/mesa: Apply LOD bias from correct texture unit</li>
+ <li>glsl: silence warning in printf() with a cast</li>
+</ul></p>
+
+<p>Chad Versace (1):
+<ul>
+ <li>i965: Fix tex_swizzle when depth mode is GL_RED</li>
+</ul></p>
+
+<p>Dave Airlie (1):
+<ul>
+ <li>r600: don't close fd on failed load</li>
+</ul></p>
+
+<p>Eric Anholt (2):
+<ul>
+ <li>i965: Apply a workaround for the Ironlake "vertex flashing".</li>
+ <li>i965: Fix alpha testing when there is no color buffer in the FBO.</li>
+</ul></p>
+
+<p>Fabian Bieler (1):
+<ul>
+ <li>st/mesa: Apply LOD from texture object</li>
+</ul></p>
+
+<p>Henri Verbeet (1):
+<ul>
+ <li>st/mesa: Validate state before doing blits.</li>
+</ul></p>
+
+<p>Ian Romanick (13):
+<ul>
+ <li>docs: Add 7.10.1 md5sums</li>
+ <li>glsl: Refactor AST-to-HIR code handling variable initializers</li>
+ <li>glsl: Refactor AST-to-HIR code handling variable redeclarations</li>
+ <li>glsl: Process redeclarations before initializers</li>
+ <li>glsl: Function signatures cannot have NULL return type</li>
+ <li>glsl: Add several function / call related validations</li>
+ <li>linker: Add imported functions to the linked IR</li>
+ <li>glsl: Use insert_before for lists instead of open coding it</li>
+ <li>glsl: Only allow unsized array assignment in an initializer</li>
+ <li>glcpp: Refresh autogenerated lexer files</li>
+ <li>docs: Initial bits of 7.10.2 release notes</li>
+ <li>mesa: set version string to 7.10.2</li>
+ <li>mesa: Remove nonexistant files from _FILES lists</li>
+</ul></p>
+
+<p>Jerome Glisse (1):
+<ul>
+ <li>r600g: move user fence into base radeon structure</li>
+</ul></p>
+
+<p>José Fonseca (2):
+<ul>
+ <li>mesa: Fix typo glGet*v(GL_TEXTURE_COORD_ARRAY_*).</li>
+ <li>mesa: More glGet* fixes.</li>
+</ul></p>
+
+<p>Kenneth Graunke (4):
+<ul>
+ <li>glcpp: Rework lexer to use a SKIP state rather than REJECT.</li>
+ <li>glcpp: Remove trailing contexts from #if rules.</li>
+ <li>i965/fs: Fix linear gl_Color interpolation on pre-gen6 hardware.</li>
+ <li>glsl: Accept precision qualifiers on sampler types, but only in ES.</li>
+</ul></p>
+
+<p>Marek Olšák (15):
+<ul>
+ <li>st/mesa: fix crash when DrawBuffer-&gt;_ColorDrawBuffers[0] is NULL</li>
+ <li>st/mesa: fail to alloc a renderbuffer if st_choose_renderbuffer_format fails</li>
+ <li>r300/compiler: fix the saturate modifier when applied to TEX instructions</li>
+ <li>r300/compiler: fix translating the src negate bits in pair_translate</li>
+ <li>r300/compiler: Abs doesn't cancel Negate (in the conversion to native swizzles)</li>
+ <li>r300/compiler: TEX instructions don't support negation on source arguments</li>
+ <li>r300/compiler: do not set TEX_IGNORE_UNCOVERED on r500</li>
+ <li>r300/compiler: saturate Z before the shadow comparison</li>
+ <li>r300/compiler: fix equal and notequal shadow compare functions</li>
+ <li>r300/compiler: remove unused variables</li>
+ <li>st/mesa: fix crash when using both user and vbo buffers with the same stride</li>
+ <li>r300g: fix alpha-test with no colorbuffer</li>
+ <li>r300g: tell the GLSL compiler to lower the continue opcode</li>
+ <li>r300/compiler: propagate SaturateMode down to the result of shadow comparison</li>
+ <li>r300/compiler: apply the texture swizzle to shadow pass and fail values too</li>
+</ul></p>
+
+<p>Michel Dänzer (1):
+<ul>
+ <li>Use proper source row stride when getting depth/stencil texels.</li>
+</ul></p>
+
+<p>Tom Stellard (4):
+<ul>
+ <li>r300/compiler: Use a 4-bit writemask in pair instructions</li>
+ <li>prog_optimize: Fix reallocating registers for shaders with loops</li>
+ <li>r300/compiler: Fix vertex shader MAD instructions with constant swizzles</li>
+ <li>r300/compiler: Don't try to convert RGB to Alpha in full instructions</li>
+</ul></p>
+
+</body>
+</html>
diff --git a/mesalib/docs/relnotes.html b/mesalib/docs/relnotes.html
index 9bbf768fb..794fd60a2 100644
--- a/mesalib/docs/relnotes.html
+++ b/mesalib/docs/relnotes.html
@@ -14,6 +14,7 @@ The release notes summarize what's new or changed in each Mesa release.
<UL>
<LI><A HREF="relnotes-7.11.html">7.11 release notes</A>
+<LI><A HREF="relnotes-7.10.2.html">7.10.2 release notes</A>
<LI><A HREF="relnotes-7.10.1.html">7.10.1 release notes</A>
<LI><A HREF="relnotes-7.10.html">7.10 release notes</A>
<LI><A HREF="relnotes-7.9.2.html">7.9.2 release notes</A>
diff --git a/mesalib/src/mesa/main/arrayobj.c b/mesalib/src/mesa/main/arrayobj.c
index 1033ce639..8fff3c0e2 100644
--- a/mesalib/src/mesa/main/arrayobj.c
+++ b/mesalib/src/mesa/main/arrayobj.c
@@ -50,6 +50,7 @@
#include "arrayobj.h"
#include "macros.h"
#include "mtypes.h"
+#include "varray.h"
#include "main/dispatch.h"
@@ -280,44 +281,13 @@ remove_array_object( struct gl_context *ctx, struct gl_array_object *obj )
/**
- * Compute the index of the last array element that can be safely accessed
- * in a vertex array. We can really only do this when the array lives in
- * a VBO.
- * The array->_MaxElement field will be updated.
- * Later in glDrawArrays/Elements/etc we can do some bounds checking.
- */
-static void
-compute_max_element(struct gl_client_array *array)
-{
- if (array->BufferObj->Name) {
- /* Compute the max element we can access in the VBO without going
- * out of bounds.
- */
- array->_MaxElement = ((GLsizeiptrARB) array->BufferObj->Size
- - (GLsizeiptrARB) array->Ptr + array->StrideB
- - array->_ElementSize) / array->StrideB;
- if (0)
- printf("%s Object %u Size %u MaxElement %u\n",
- __FUNCTION__,
- array->BufferObj->Name,
- (GLuint) array->BufferObj->Size,
- array->_MaxElement);
- }
- else {
- /* user-space array, no idea how big it is */
- array->_MaxElement = 2 * 1000 * 1000 * 1000; /* just a big number */
- }
-}
-
-
-/**
* Helper for update_arrays().
* \return min(current min, array->_MaxElement).
*/
static GLuint
update_min(GLuint min, struct gl_client_array *array)
{
- compute_max_element(array);
+ _mesa_update_array_max_element(array);
if (array->Enabled)
return MIN2(min, array->_MaxElement);
else
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c
index 0c37141cb..6d098788b 100644
--- a/mesalib/src/mesa/main/extensions.c
+++ b/mesalib/src/mesa/main/extensions.c
@@ -908,7 +908,7 @@ _mesa_make_extension_string(struct gl_context *ctx)
return NULL;
}
- extension_indices = malloc(count * sizeof extension_indices);
+ extension_indices = malloc(count * sizeof(extension_index));
if (extension_indices == NULL) {
free(exts);
free(extra_extensions);
diff --git a/mesalib/src/mesa/main/state.c b/mesalib/src/mesa/main/state.c
index ee335340a..685bee010 100644
--- a/mesalib/src/mesa/main/state.c
+++ b/mesalib/src/mesa/main/state.c
@@ -48,6 +48,7 @@
#include "texenvprogram.h"
#include "texobj.h"
#include "texstate.h"
+#include "varray.h"
static void
@@ -61,43 +62,13 @@ update_separate_specular(struct gl_context *ctx)
/**
- * Compute the index of the last array element that can be safely accessed
- * in a vertex array. We can really only do this when the array lives in
- * a VBO.
- * The array->_MaxElement field will be updated.
- * Later in glDrawArrays/Elements/etc we can do some bounds checking.
- */
-static void
-compute_max_element(struct gl_client_array *array)
-{
- assert(array->Enabled);
- if (array->BufferObj->Name) {
- GLsizeiptrARB offset = (GLsizeiptrARB) array->Ptr;
- GLsizeiptrARB obj_size = (GLsizeiptrARB) array->BufferObj->Size;
-
- if (offset < obj_size) {
- array->_MaxElement = (obj_size - offset +
- array->StrideB -
- array->_ElementSize) / array->StrideB;
- } else {
- array->_MaxElement = 0;
- }
- }
- else {
- /* user-space array, no idea how big it is */
- array->_MaxElement = 2 * 1000 * 1000 * 1000; /* just a big number */
- }
-}
-
-
-/**
* Helper for update_arrays().
* \return min(current min, array->_MaxElement).
*/
static GLuint
update_min(GLuint min, struct gl_client_array *array)
{
- compute_max_element(array);
+ _mesa_update_array_max_element(array);
return MIN2(min, array->_MaxElement);
}
diff --git a/mesalib/src/mesa/main/varray.c b/mesalib/src/mesa/main/varray.c
index cfed4b506..1f771a585 100644
--- a/mesalib/src/mesa/main/varray.c
+++ b/mesalib/src/mesa/main/varray.c
@@ -1,1205 +1,1205 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.6
- *
- * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
- * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-#include "glheader.h"
-#include "imports.h"
-#include "bufferobj.h"
-#include "context.h"
-#include "enable.h"
-#include "enums.h"
-#include "hash.h"
-#include "image.h"
-#include "macros.h"
-#include "mfeatures.h"
-#include "mtypes.h"
-#include "varray.h"
-#include "arrayobj.h"
-#include "main/dispatch.h"
-
-
-/** Used to do error checking for GL_EXT_vertex_array_bgra */
-#define BGRA_OR_4 5
-
-
-/** 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_BIT 0x400
-
-
-
-/** Convert GL datatype enum into a <type>_BIT value seen above */
-static GLbitfield
-type_to_bit(const struct gl_context *ctx, GLenum type)
-{
- switch (type) {
- case GL_BOOL:
- return BOOL_BIT;
- case GL_BYTE:
- return BYTE_BIT;
- case GL_UNSIGNED_BYTE:
- return UNSIGNED_BYTE_BIT;
- case GL_SHORT:
- return SHORT_BIT;
- case GL_UNSIGNED_SHORT:
- return UNSIGNED_SHORT_BIT;
- case GL_INT:
- return INT_BIT;
- case GL_UNSIGNED_INT:
- return UNSIGNED_INT_BIT;
- case GL_HALF_FLOAT:
- if (ctx->Extensions.ARB_half_float_vertex)
- return HALF_BIT;
- else
- return 0x0;
- case GL_FLOAT:
- return FLOAT_BIT;
- case GL_DOUBLE:
- return DOUBLE_BIT;
- case GL_FIXED:
- return FIXED_BIT;
- default:
- return 0;
- }
-}
-
-
-/**
- * Do error checking and update state for glVertex/Color/TexCoord/...Pointer
- * functions.
- *
- * \param func name of calling function used for error reporting
- * \param array the array to update
- * \param dirtyBit which bit to set in ctx->Array.NewState for this array
- * \param legalTypes bitmask of *_BIT above indicating legal datatypes
- * \param sizeMin min allowable size value
- * \param sizeMax max allowable size value (may also be BGRA_OR_4)
- * \param size components per element (1, 2, 3 or 4)
- * \param type datatype of each component (GL_FLOAT, GL_INT, etc)
- * \param stride stride between elements, in elements
- * \param normalized are integer types converted to floats in [-1, 1]?
- * \param integer integer-valued values (will not be normalized to [-1,1])
- * \param ptr the address (or offset inside VBO) of the array data
- */
-static void
-update_array(struct gl_context *ctx,
- const char *func,
- struct gl_client_array *array,
- GLbitfield dirtyBit, GLbitfield legalTypesMask,
- GLint sizeMin, GLint sizeMax,
- GLint size, GLenum type, GLsizei stride,
- GLboolean normalized, GLboolean integer,
- const GLvoid *ptr)
-{
- GLbitfield typeBit;
- 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 */
- legalTypesMask &= ~FIXED_BIT;
- }
-
- typeBit = type_to_bit(ctx, type);
- if (typeBit == 0x0 || (typeBit & legalTypesMask) == 0x0) {
- _mesa_error(ctx, GL_INVALID_ENUM, "%s(type = %s)",
- func, _mesa_lookup_enum_by_nr(type));
- return;
- }
-
- /* Do size parameter checking.
- * If sizeMax = BGRA_OR_4 it means that size = GL_BGRA is legal and
- * must be handled specially.
- */
- if (ctx->Extensions.EXT_vertex_array_bgra &&
- sizeMax == BGRA_OR_4 &&
- size == GL_BGRA) {
- if (type != GL_UNSIGNED_BYTE) {
- _mesa_error(ctx, GL_INVALID_VALUE, "%s(GL_BGRA/GLubyte)", func);
- return;
- }
- format = GL_BGRA;
- size = 4;
- }
- else if (size < sizeMin || size > sizeMax || size > 4) {
- _mesa_error(ctx, GL_INVALID_VALUE, "%s(size=%d)", func, size);
- return;
- }
-
- ASSERT(size <= 4);
-
- if (stride < 0) {
- _mesa_error( ctx, GL_INVALID_VALUE, "%s(stride=%d)", func, stride );
- return;
- }
-
- if (ctx->Array.ArrayObj->VBOonly &&
- ctx->Array.ArrayBufferObj->Name == 0) {
- /* GL_ARB_vertex_array_object requires that all arrays reside in VBOs.
- * Generate GL_INVALID_OPERATION if that's not true.
- */
- _mesa_error(ctx, GL_INVALID_OPERATION, "%s(non-VBO array)", func);
- return;
- }
-
- elementSize = _mesa_sizeof_type(type) * size;
-
- array->Size = size;
- array->Type = type;
- array->Format = format;
- array->Stride = stride;
- array->StrideB = stride ? stride : elementSize;
- array->Normalized = normalized;
- array->Ptr = (const GLubyte *) ptr;
- array->_ElementSize = elementSize;
-
- _mesa_reference_buffer_object(ctx, &array->BufferObj,
- ctx->Array.ArrayBufferObj);
-
- ctx->NewState |= _NEW_ARRAY;
- ctx->Array.NewState |= dirtyBit;
-}
-
-
-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_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,
- size, type, stride, GL_FALSE, GL_FALSE, 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_BIT);
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- update_array(ctx, "glNormalPointer",
- &ctx->Array.ArrayObj->Normal, _NEW_ARRAY_NORMAL,
- legalTypes, 3, 3,
- 3, type, stride, GL_TRUE, GL_FALSE, 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_BIT);
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- update_array(ctx, "glColorPointer",
- &ctx->Array.ArrayObj->Color, _NEW_ARRAY_COLOR0,
- legalTypes, 3, BGRA_OR_4,
- size, type, stride, GL_TRUE, GL_FALSE, ptr);
-}
-
-
-void GLAPIENTRY
-_mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr)
-{
- const GLbitfield legalTypes = (HALF_BIT | FLOAT_BIT | DOUBLE_BIT);
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- update_array(ctx, "glFogCoordPointer",
- &ctx->Array.ArrayObj->FogCoord, _NEW_ARRAY_FOGCOORD,
- legalTypes, 1, 1,
- 1, type, stride, GL_FALSE, GL_FALSE, ptr);
-}
-
-
-void GLAPIENTRY
-_mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr)
-{
- const GLbitfield legalTypes = (UNSIGNED_BYTE_BIT | SHORT_BIT | INT_BIT |
- FLOAT_BIT | DOUBLE_BIT);
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- update_array(ctx, "glIndexPointer",
- &ctx->Array.ArrayObj->Index, _NEW_ARRAY_INDEX,
- legalTypes, 1, 1,
- 1, type, stride, GL_FALSE, GL_FALSE, ptr);
-}
-
-
-void GLAPIENTRY
-_mesa_SecondaryColorPointerEXT(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);
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- update_array(ctx, "glSecondaryColorPointer",
- &ctx->Array.ArrayObj->SecondaryColor, _NEW_ARRAY_COLOR1,
- legalTypes, 3, BGRA_OR_4,
- size, type, stride, GL_TRUE, GL_FALSE, ptr);
-}
-
-
-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_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",
- &ctx->Array.ArrayObj->TexCoord[unit],
- _NEW_ARRAY_TEXCOORD(unit),
- legalTypes, 1, 4,
- size, type, stride, GL_FALSE, GL_FALSE,
- ptr);
-}
-
-
-void GLAPIENTRY
-_mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *ptr)
-{
- const GLbitfield legalTypes = UNSIGNED_BYTE_BIT;
- /* see table 2.4 edits in GL_EXT_gpu_shader4 spec: */
- const GLboolean integer = GL_TRUE;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- update_array(ctx, "glEdgeFlagPointer",
- &ctx->Array.ArrayObj->EdgeFlag, _NEW_ARRAY_EDGEFLAG,
- legalTypes, 1, 1,
- 1, GL_UNSIGNED_BYTE, stride, GL_FALSE, integer, ptr);
-}
-
-
-void GLAPIENTRY
-_mesa_PointSizePointer(GLenum type, GLsizei stride, const GLvoid *ptr)
-{
- 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,
- 1, type, stride, GL_FALSE, GL_FALSE, ptr);
-}
-
-
-#if FEATURE_NV_vertex_program
-/**
- * Set a vertex attribute array.
- * Note that these arrays DO alias the conventional GL vertex arrays
- * (position, normal, color, fog, texcoord, etc).
- * The generic attribute slots at #16 and above are not touched.
- */
-void GLAPIENTRY
-_mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type,
- GLsizei stride, const GLvoid *ptr)
-{
- const GLbitfield legalTypes = (UNSIGNED_BYTE_BIT | SHORT_BIT |
- FLOAT_BIT | DOUBLE_BIT);
- GLboolean normalized = GL_FALSE;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (index >= MAX_NV_VERTEX_PROGRAM_INPUTS) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerNV(index)");
- return;
- }
-
- if (type == GL_UNSIGNED_BYTE && size != 4) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerNV(size!=4)");
- return;
- }
-
- update_array(ctx, "glVertexAttribPointerNV",
- &ctx->Array.ArrayObj->VertexAttrib[index],
- _NEW_ARRAY_ATTRIB(index),
- legalTypes, 1, BGRA_OR_4,
- size, type, stride, normalized, GL_FALSE, ptr);
-}
-#endif
-
-
-#if FEATURE_ARB_vertex_program
-/**
- * Set a generic vertex attribute array.
- * Note that these arrays DO NOT alias the conventional GL vertex arrays
- * (position, normal, color, fog, texcoord, etc).
- */
-void GLAPIENTRY
-_mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type,
- GLboolean normalized,
- 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_BIT);
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (index >= ctx->Const.VertexProgram.MaxAttribs) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerARB(index)");
- return;
- }
-
- update_array(ctx, "glVertexAttribPointer",
- &ctx->Array.ArrayObj->VertexAttrib[index],
- _NEW_ARRAY_ATTRIB(index),
- legalTypes, 1, BGRA_OR_4,
- size, type, stride, normalized, GL_FALSE, ptr);
-}
-#endif
-
-
-/**
- * GL_EXT_gpu_shader4 / GL 3.0.
- * Set an integer-valued vertex attribute array.
- * Note that these arrays DO NOT alias the conventional GL vertex arrays
- * (position, normal, color, fog, texcoord, etc).
- */
-void GLAPIENTRY
-_mesa_VertexAttribIPointer(GLuint index, 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);
- const GLboolean normalized = GL_FALSE;
- const GLboolean integer = GL_TRUE;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (index >= ctx->Const.VertexProgram.MaxAttribs) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribIPointer(index)");
- return;
- }
-
- update_array(ctx, "glVertexAttribIPointer",
- &ctx->Array.ArrayObj->VertexAttrib[index],
- _NEW_ARRAY_ATTRIB(index),
- legalTypes, 1, 4,
- size, type, stride, normalized, integer, ptr);
-}
-
-
-
-void GLAPIENTRY
-_mesa_EnableVertexAttribArrayARB(GLuint index)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (index >= ctx->Const.VertexProgram.MaxAttribs) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glEnableVertexAttribArrayARB(index)");
- return;
- }
-
- ASSERT(index < Elements(ctx->Array.ArrayObj->VertexAttrib));
-
- FLUSH_VERTICES(ctx, _NEW_ARRAY);
- ctx->Array.ArrayObj->VertexAttrib[index].Enabled = GL_TRUE;
- ctx->Array.ArrayObj->_Enabled |= _NEW_ARRAY_ATTRIB(index);
- ctx->Array.NewState |= _NEW_ARRAY_ATTRIB(index);
-}
-
-
-void GLAPIENTRY
-_mesa_DisableVertexAttribArrayARB(GLuint index)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (index >= ctx->Const.VertexProgram.MaxAttribs) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glEnableVertexAttribArrayARB(index)");
- return;
- }
-
- ASSERT(index < Elements(ctx->Array.ArrayObj->VertexAttrib));
-
- FLUSH_VERTICES(ctx, _NEW_ARRAY);
- ctx->Array.ArrayObj->VertexAttrib[index].Enabled = GL_FALSE;
- ctx->Array.ArrayObj->_Enabled &= ~_NEW_ARRAY_ATTRIB(index);
- ctx->Array.NewState |= _NEW_ARRAY_ATTRIB(index);
-}
-
-
-/**
- * Return info for a vertex attribute array (no alias with legacy
- * vertex attributes (pos, normal, color, etc)). This function does
- * not handle the 4-element GL_CURRENT_VERTEX_ATTRIB_ARB query.
- */
-static GLuint
-get_vertex_array_attrib(struct gl_context *ctx, GLuint index, GLenum pname,
- const char *caller)
-{
- const struct gl_client_array *array;
-
- if (index >= ctx->Const.VertexProgram.MaxAttribs) {
- _mesa_error(ctx, GL_INVALID_VALUE, "%s(index=%u)", caller, index);
- return 0;
- }
-
- ASSERT(index < Elements(ctx->Array.ArrayObj->VertexAttrib));
-
- array = &ctx->Array.ArrayObj->VertexAttrib[index];
-
- switch (pname) {
- case GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB:
- return array->Enabled;
- case GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB:
- return array->Size;
- case GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB:
- return array->Stride;
- case GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB:
- return array->Type;
- case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB:
- return array->Normalized;
- case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB:
- return array->BufferObj->Name;
- case GL_VERTEX_ATTRIB_ARRAY_INTEGER:
- if (ctx->Extensions.EXT_gpu_shader4) {
- return array->Integer;
- }
- goto error;
- case GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB:
- if (ctx->Extensions.ARB_instanced_arrays) {
- return array->InstanceDivisor;
- }
- goto error;
- default:
- ; /* fall-through */
- }
-
-error:
- _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=0x%x)", caller, pname);
- return 0;
-}
-
-
-static const GLfloat *
-get_current_attrib(struct gl_context *ctx, GLuint index, const char *function)
-{
- if (index == 0) {
- if (ctx->API != API_OPENGLES2) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "%s(index==0)", function);
- return NULL;
- }
- }
- else if (index >= ctx->Const.VertexProgram.MaxAttribs) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "%s(index>=GL_MAX_VERTEX_ATTRIBS)", function);
- return NULL;
- }
-
- FLUSH_CURRENT(ctx, 0);
- return ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index];
-}
-
-void GLAPIENTRY
-_mesa_GetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) {
- const GLfloat *v = get_current_attrib(ctx, index, "glGetVertexAttribfv");
- if (v != NULL) {
- COPY_4V(params, v);
- }
- }
- else {
- params[0] = (GLfloat) get_vertex_array_attrib(ctx, index, pname,
- "glGetVertexAttribfv");
- }
-}
-
-
-void GLAPIENTRY
-_mesa_GetVertexAttribdvARB(GLuint index, GLenum pname, GLdouble *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) {
- const GLfloat *v = get_current_attrib(ctx, index, "glGetVertexAttribdv");
- if (v != NULL) {
- params[0] = (GLdouble) v[0];
- params[1] = (GLdouble) v[1];
- params[2] = (GLdouble) v[2];
- params[3] = (GLdouble) v[3];
- }
- }
- else {
- params[0] = (GLdouble) get_vertex_array_attrib(ctx, index, pname,
- "glGetVertexAttribdv");
- }
-}
-
-
-void GLAPIENTRY
-_mesa_GetVertexAttribivARB(GLuint index, GLenum pname, GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) {
- const GLfloat *v = get_current_attrib(ctx, index, "glGetVertexAttribiv");
- if (v != NULL) {
- /* XXX should floats in[0,1] be scaled to full int range? */
- params[0] = (GLint) v[0];
- params[1] = (GLint) v[1];
- params[2] = (GLint) v[2];
- params[3] = (GLint) v[3];
- }
- }
- else {
- params[0] = (GLint) get_vertex_array_attrib(ctx, index, pname,
- "glGetVertexAttribiv");
- }
-}
-
-
-/** GL 3.0 */
-void GLAPIENTRY
-_mesa_GetVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) {
- const GLfloat *v =
- get_current_attrib(ctx, index, "glGetVertexAttribIiv");
- if (v != NULL) {
- /* XXX we don't have true integer-valued vertex attribs yet */
- params[0] = (GLint) v[0];
- params[1] = (GLint) v[1];
- params[2] = (GLint) v[2];
- params[3] = (GLint) v[3];
- }
- }
- else {
- params[0] = (GLint) get_vertex_array_attrib(ctx, index, pname,
- "glGetVertexAttribIiv");
- }
-}
-
-
-/** GL 3.0 */
-void GLAPIENTRY
-_mesa_GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) {
- const GLfloat *v =
- get_current_attrib(ctx, index, "glGetVertexAttribIuiv");
- if (v != NULL) {
- /* XXX we don't have true integer-valued vertex attribs yet */
- params[0] = (GLuint) v[0];
- params[1] = (GLuint) v[1];
- params[2] = (GLuint) v[2];
- params[3] = (GLuint) v[3];
- }
- }
- else {
- params[0] = get_vertex_array_attrib(ctx, index, pname,
- "glGetVertexAttribIuiv");
- }
-}
-
-
-void GLAPIENTRY
-_mesa_GetVertexAttribPointervARB(GLuint index, GLenum pname, GLvoid **pointer)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (index >= ctx->Const.VertexProgram.MaxAttribs) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribPointerARB(index)");
- return;
- }
-
- if (pname != GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribPointerARB(pname)");
- return;
- }
-
- ASSERT(index < Elements(ctx->Array.ArrayObj->VertexAttrib));
-
- *pointer = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[index].Ptr;
-}
-
-
-void GLAPIENTRY
-_mesa_VertexPointerEXT(GLint size, GLenum type, GLsizei stride,
- GLsizei count, const GLvoid *ptr)
-{
- (void) count;
- _mesa_VertexPointer(size, type, stride, ptr);
-}
-
-
-void GLAPIENTRY
-_mesa_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count,
- const GLvoid *ptr)
-{
- (void) count;
- _mesa_NormalPointer(type, stride, ptr);
-}
-
-
-void GLAPIENTRY
-_mesa_ColorPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count,
- const GLvoid *ptr)
-{
- (void) count;
- _mesa_ColorPointer(size, type, stride, ptr);
-}
-
-
-void GLAPIENTRY
-_mesa_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count,
- const GLvoid *ptr)
-{
- (void) count;
- _mesa_IndexPointer(type, stride, ptr);
-}
-
-
-void GLAPIENTRY
-_mesa_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride,
- GLsizei count, const GLvoid *ptr)
-{
- (void) count;
- _mesa_TexCoordPointer(size, type, stride, ptr);
-}
-
-
-void GLAPIENTRY
-_mesa_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *ptr)
-{
- (void) count;
- _mesa_EdgeFlagPointer(stride, ptr);
-}
-
-
-void GLAPIENTRY
-_mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLboolean tflag, cflag, nflag; /* enable/disable flags */
- GLint tcomps, ccomps, vcomps; /* components per texcoord, color, vertex */
- GLenum ctype = 0; /* color type */
- GLint coffset = 0, noffset = 0, voffset;/* color, normal, vertex offsets */
- const GLint toffset = 0; /* always zero */
- GLint defstride; /* default stride */
- GLint c, f;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- f = sizeof(GLfloat);
- c = f * ((4 * sizeof(GLubyte) + (f - 1)) / f);
-
- if (stride < 0) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glInterleavedArrays(stride)" );
- return;
- }
-
- switch (format) {
- case GL_V2F:
- tflag = GL_FALSE; cflag = GL_FALSE; nflag = GL_FALSE;
- tcomps = 0; ccomps = 0; vcomps = 2;
- voffset = 0;
- defstride = 2*f;
- break;
- case GL_V3F:
- tflag = GL_FALSE; cflag = GL_FALSE; nflag = GL_FALSE;
- tcomps = 0; ccomps = 0; vcomps = 3;
- voffset = 0;
- defstride = 3*f;
- break;
- case GL_C4UB_V2F:
- tflag = GL_FALSE; cflag = GL_TRUE; nflag = GL_FALSE;
- tcomps = 0; ccomps = 4; vcomps = 2;
- ctype = GL_UNSIGNED_BYTE;
- coffset = 0;
- voffset = c;
- defstride = c + 2*f;
- break;
- case GL_C4UB_V3F:
- tflag = GL_FALSE; cflag = GL_TRUE; nflag = GL_FALSE;
- tcomps = 0; ccomps = 4; vcomps = 3;
- ctype = GL_UNSIGNED_BYTE;
- coffset = 0;
- voffset = c;
- defstride = c + 3*f;
- break;
- case GL_C3F_V3F:
- tflag = GL_FALSE; cflag = GL_TRUE; nflag = GL_FALSE;
- tcomps = 0; ccomps = 3; vcomps = 3;
- ctype = GL_FLOAT;
- coffset = 0;
- voffset = 3*f;
- defstride = 6*f;
- break;
- case GL_N3F_V3F:
- tflag = GL_FALSE; cflag = GL_FALSE; nflag = GL_TRUE;
- tcomps = 0; ccomps = 0; vcomps = 3;
- noffset = 0;
- voffset = 3*f;
- defstride = 6*f;
- break;
- case GL_C4F_N3F_V3F:
- tflag = GL_FALSE; cflag = GL_TRUE; nflag = GL_TRUE;
- tcomps = 0; ccomps = 4; vcomps = 3;
- ctype = GL_FLOAT;
- coffset = 0;
- noffset = 4*f;
- voffset = 7*f;
- defstride = 10*f;
- break;
- case GL_T2F_V3F:
- tflag = GL_TRUE; cflag = GL_FALSE; nflag = GL_FALSE;
- tcomps = 2; ccomps = 0; vcomps = 3;
- voffset = 2*f;
- defstride = 5*f;
- break;
- case GL_T4F_V4F:
- tflag = GL_TRUE; cflag = GL_FALSE; nflag = GL_FALSE;
- tcomps = 4; ccomps = 0; vcomps = 4;
- voffset = 4*f;
- defstride = 8*f;
- break;
- case GL_T2F_C4UB_V3F:
- tflag = GL_TRUE; cflag = GL_TRUE; nflag = GL_FALSE;
- tcomps = 2; ccomps = 4; vcomps = 3;
- ctype = GL_UNSIGNED_BYTE;
- coffset = 2*f;
- voffset = c+2*f;
- defstride = c+5*f;
- break;
- case GL_T2F_C3F_V3F:
- tflag = GL_TRUE; cflag = GL_TRUE; nflag = GL_FALSE;
- tcomps = 2; ccomps = 3; vcomps = 3;
- ctype = GL_FLOAT;
- coffset = 2*f;
- voffset = 5*f;
- defstride = 8*f;
- break;
- case GL_T2F_N3F_V3F:
- tflag = GL_TRUE; cflag = GL_FALSE; nflag = GL_TRUE;
- tcomps = 2; ccomps = 0; vcomps = 3;
- noffset = 2*f;
- voffset = 5*f;
- defstride = 8*f;
- break;
- case GL_T2F_C4F_N3F_V3F:
- tflag = GL_TRUE; cflag = GL_TRUE; nflag = GL_TRUE;
- tcomps = 2; ccomps = 4; vcomps = 3;
- ctype = GL_FLOAT;
- coffset = 2*f;
- noffset = 6*f;
- voffset = 9*f;
- defstride = 12*f;
- break;
- case GL_T4F_C4F_N3F_V4F:
- tflag = GL_TRUE; cflag = GL_TRUE; nflag = GL_TRUE;
- tcomps = 4; ccomps = 4; vcomps = 4;
- ctype = GL_FLOAT;
- coffset = 4*f;
- noffset = 8*f;
- voffset = 11*f;
- defstride = 15*f;
- break;
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glInterleavedArrays(format)" );
- return;
- }
-
- if (stride==0) {
- stride = defstride;
- }
-
- _mesa_DisableClientState( GL_EDGE_FLAG_ARRAY );
- _mesa_DisableClientState( GL_INDEX_ARRAY );
- /* XXX also disable secondary color and generic arrays? */
-
- /* Texcoords */
- if (tflag) {
- _mesa_EnableClientState( GL_TEXTURE_COORD_ARRAY );
- _mesa_TexCoordPointer( tcomps, GL_FLOAT, stride,
- (GLubyte *) pointer + toffset );
- }
- else {
- _mesa_DisableClientState( GL_TEXTURE_COORD_ARRAY );
- }
-
- /* Color */
- if (cflag) {
- _mesa_EnableClientState( GL_COLOR_ARRAY );
- _mesa_ColorPointer( ccomps, ctype, stride,
- (GLubyte *) pointer + coffset );
- }
- else {
- _mesa_DisableClientState( GL_COLOR_ARRAY );
- }
-
-
- /* Normals */
- if (nflag) {
- _mesa_EnableClientState( GL_NORMAL_ARRAY );
- _mesa_NormalPointer( GL_FLOAT, stride, (GLubyte *) pointer + noffset );
- }
- else {
- _mesa_DisableClientState( GL_NORMAL_ARRAY );
- }
-
- /* Vertices */
- _mesa_EnableClientState( GL_VERTEX_ARRAY );
- _mesa_VertexPointer( vcomps, GL_FLOAT, stride,
- (GLubyte *) pointer + voffset );
-}
-
-
-void GLAPIENTRY
-_mesa_LockArraysEXT(GLint first, GLsizei count)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug(ctx, "glLockArrays %d %d\n", first, count);
-
- if (first < 0) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glLockArraysEXT(first)" );
- return;
- }
- if (count <= 0) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glLockArraysEXT(count)" );
- return;
- }
- if (ctx->Array.LockCount != 0) {
- _mesa_error( ctx, GL_INVALID_OPERATION, "glLockArraysEXT(reentry)" );
- return;
- }
-
- ctx->Array.LockFirst = first;
- ctx->Array.LockCount = count;
-
- ctx->NewState |= _NEW_ARRAY;
- ctx->Array.NewState |= _NEW_ARRAY_ALL;
-}
-
-
-void GLAPIENTRY
-_mesa_UnlockArraysEXT( void )
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug(ctx, "glUnlockArrays\n");
-
- if (ctx->Array.LockCount == 0) {
- _mesa_error( ctx, GL_INVALID_OPERATION, "glUnlockArraysEXT(reexit)" );
- return;
- }
-
- ctx->Array.LockFirst = 0;
- ctx->Array.LockCount = 0;
- ctx->NewState |= _NEW_ARRAY;
- ctx->Array.NewState |= _NEW_ARRAY_ALL;
-}
-
-
-/* GL_EXT_multi_draw_arrays */
-void GLAPIENTRY
-_mesa_MultiDrawArraysEXT( GLenum mode, const GLint *first,
- const GLsizei *count, GLsizei primcount )
-{
- GET_CURRENT_CONTEXT(ctx);
- GLint i;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- for (i = 0; i < primcount; i++) {
- if (count[i] > 0) {
- CALL_DrawArrays(ctx->Exec, (mode, first[i], count[i]));
- }
- }
-}
-
-
-/* GL_IBM_multimode_draw_arrays */
-void GLAPIENTRY
-_mesa_MultiModeDrawArraysIBM( const GLenum * mode, const GLint * first,
- const GLsizei * count,
- GLsizei primcount, GLint modestride )
-{
- GET_CURRENT_CONTEXT(ctx);
- GLint i;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- for ( i = 0 ; i < primcount ; i++ ) {
- if ( count[i] > 0 ) {
- GLenum m = *((GLenum *) ((GLubyte *) mode + i * modestride));
- CALL_DrawArrays(ctx->Exec, ( m, first[i], count[i] ));
- }
- }
-}
-
-
-/* GL_IBM_multimode_draw_arrays */
-void GLAPIENTRY
-_mesa_MultiModeDrawElementsIBM( const GLenum * mode, const GLsizei * count,
- GLenum type, const GLvoid * const * indices,
- GLsizei primcount, GLint modestride )
-{
- GET_CURRENT_CONTEXT(ctx);
- GLint i;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- /* XXX not sure about ARB_vertex_buffer_object handling here */
-
- for ( i = 0 ; i < primcount ; i++ ) {
- if ( count[i] > 0 ) {
- GLenum m = *((GLenum *) ((GLubyte *) mode + i * modestride));
- CALL_DrawElements(ctx->Exec, ( m, count[i], type, indices[i] ));
- }
- }
-}
-
-
-/**
- * GL_NV_primitive_restart and GL 3.1
- */
-void GLAPIENTRY
-_mesa_PrimitiveRestartIndex(GLuint index)
-{
- GET_CURRENT_CONTEXT(ctx);
-
- if (!ctx->Extensions.NV_primitive_restart &&
- ctx->VersionMajor * 10 + ctx->VersionMinor < 31) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glPrimitiveRestartIndexNV()");
- return;
- }
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
-
- ctx->Array.RestartIndex = index;
-}
-
-
-/**
- * See GL_ARB_instanced_arrays.
- * Note that the instance divisor only applies to generic arrays, not
- * the legacy vertex arrays.
- */
-void GLAPIENTRY
-_mesa_VertexAttribDivisor(GLuint index, GLuint divisor)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- if (!ctx->Extensions.ARB_instanced_arrays) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glVertexAttribDivisor()");
- return;
- }
-
- if (index >= ctx->Const.VertexProgram.MaxAttribs) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glVertexAttribDivisor(index = %u)",
- index);
- return;
- }
-
- ctx->Array.ArrayObj->VertexAttrib[index].InstanceDivisor = divisor;
-}
-
-
-
-/**
- * Copy one client vertex array to another.
- */
-void
-_mesa_copy_client_array(struct gl_context *ctx,
- struct gl_client_array *dst,
- struct gl_client_array *src)
-{
- dst->Size = src->Size;
- dst->Type = src->Type;
- dst->Format = src->Format;
- dst->Stride = src->Stride;
- dst->StrideB = src->StrideB;
- dst->Ptr = src->Ptr;
- dst->Enabled = src->Enabled;
- dst->Normalized = src->Normalized;
- dst->Integer = src->Integer;
- dst->InstanceDivisor = src->InstanceDivisor;
- dst->_ElementSize = src->_ElementSize;
- _mesa_reference_buffer_object(ctx, &dst->BufferObj, src->BufferObj);
- dst->_MaxElement = src->_MaxElement;
-}
-
-
-
-/**
- * Print vertex array's fields.
- */
-static void
-print_array(const char *name, GLint index, const struct gl_client_array *array)
-{
- if (index >= 0)
- printf(" %s[%d]: ", name, index);
- else
- printf(" %s: ", name);
- printf("Ptr=%p, Type=0x%x, Size=%d, ElemSize=%u, Stride=%d, Buffer=%u(Size %lu), MaxElem=%u\n",
- array->Ptr, array->Type, array->Size,
- array->_ElementSize, array->StrideB,
- array->BufferObj->Name, (unsigned long) array->BufferObj->Size,
- array->_MaxElement);
-}
-
-
-/**
- * Print current vertex object/array info. For debug.
- */
-void
-_mesa_print_arrays(struct gl_context *ctx)
-{
- struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
- GLuint i;
-
- _mesa_update_array_object_max_element(ctx, arrayObj);
-
- printf("Array Object %u\n", arrayObj->Name);
- if (arrayObj->Vertex.Enabled)
- print_array("Vertex", -1, &arrayObj->Vertex);
- if (arrayObj->Normal.Enabled)
- print_array("Normal", -1, &arrayObj->Normal);
- if (arrayObj->Color.Enabled)
- print_array("Color", -1, &arrayObj->Color);
- for (i = 0; i < Elements(arrayObj->TexCoord); i++)
- if (arrayObj->TexCoord[i].Enabled)
- print_array("TexCoord", i, &arrayObj->TexCoord[i]);
- for (i = 0; i < Elements(arrayObj->VertexAttrib); i++)
- if (arrayObj->VertexAttrib[i].Enabled)
- print_array("Attrib", i, &arrayObj->VertexAttrib[i]);
- printf(" _MaxElement = %u\n", arrayObj->_MaxElement);
-}
-
-
-/**
- * Initialize vertex array state for given context.
- */
-void
-_mesa_init_varray(struct gl_context *ctx)
-{
- ctx->Array.DefaultArrayObj = _mesa_new_array_object(ctx, 0);
- _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj,
- ctx->Array.DefaultArrayObj);
- ctx->Array.ActiveTexture = 0; /* GL_ARB_multitexture */
-
- ctx->Array.Objects = _mesa_NewHashTable();
-}
-
-
-/**
- * Callback for deleting an array object. Called by _mesa_HashDeleteAll().
- */
-static void
-delete_arrayobj_cb(GLuint id, void *data, void *userData)
-{
- struct gl_array_object *arrayObj = (struct gl_array_object *) data;
- struct gl_context *ctx = (struct gl_context *) userData;
- _mesa_delete_array_object(ctx, arrayObj);
-}
-
-
-/**
- * Free vertex array state for given context.
- */
-void
-_mesa_free_varray_data(struct gl_context *ctx)
-{
- _mesa_HashDeleteAll(ctx->Array.Objects, delete_arrayobj_cb, ctx);
- _mesa_DeleteHashTable(ctx->Array.Objects);
-}
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.6
+ *
+ * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
+ * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include "glheader.h"
+#include "imports.h"
+#include "bufferobj.h"
+#include "context.h"
+#include "enable.h"
+#include "enums.h"
+#include "hash.h"
+#include "image.h"
+#include "macros.h"
+#include "mfeatures.h"
+#include "mtypes.h"
+#include "varray.h"
+#include "arrayobj.h"
+#include "main/dispatch.h"
+
+
+/** Used to do error checking for GL_EXT_vertex_array_bgra */
+#define BGRA_OR_4 5
+
+
+/** 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_BIT 0x400
+
+
+
+/** Convert GL datatype enum into a <type>_BIT value seen above */
+static GLbitfield
+type_to_bit(const struct gl_context *ctx, GLenum type)
+{
+ switch (type) {
+ case GL_BOOL:
+ return BOOL_BIT;
+ case GL_BYTE:
+ return BYTE_BIT;
+ case GL_UNSIGNED_BYTE:
+ return UNSIGNED_BYTE_BIT;
+ case GL_SHORT:
+ return SHORT_BIT;
+ case GL_UNSIGNED_SHORT:
+ return UNSIGNED_SHORT_BIT;
+ case GL_INT:
+ return INT_BIT;
+ case GL_UNSIGNED_INT:
+ return UNSIGNED_INT_BIT;
+ case GL_HALF_FLOAT:
+ if (ctx->Extensions.ARB_half_float_vertex)
+ return HALF_BIT;
+ else
+ return 0x0;
+ case GL_FLOAT:
+ return FLOAT_BIT;
+ case GL_DOUBLE:
+ return DOUBLE_BIT;
+ case GL_FIXED:
+ return FIXED_BIT;
+ default:
+ return 0;
+ }
+}
+
+
+/**
+ * Do error checking and update state for glVertex/Color/TexCoord/...Pointer
+ * functions.
+ *
+ * \param func name of calling function used for error reporting
+ * \param array the array to update
+ * \param dirtyBit which bit to set in ctx->Array.NewState for this array
+ * \param legalTypes bitmask of *_BIT above indicating legal datatypes
+ * \param sizeMin min allowable size value
+ * \param sizeMax max allowable size value (may also be BGRA_OR_4)
+ * \param size components per element (1, 2, 3 or 4)
+ * \param type datatype of each component (GL_FLOAT, GL_INT, etc)
+ * \param stride stride between elements, in elements
+ * \param normalized are integer types converted to floats in [-1, 1]?
+ * \param integer integer-valued values (will not be normalized to [-1,1])
+ * \param ptr the address (or offset inside VBO) of the array data
+ */
+static void
+update_array(struct gl_context *ctx,
+ const char *func,
+ struct gl_client_array *array,
+ GLbitfield dirtyBit, GLbitfield legalTypesMask,
+ GLint sizeMin, GLint sizeMax,
+ GLint size, GLenum type, GLsizei stride,
+ GLboolean normalized, GLboolean integer,
+ const GLvoid *ptr)
+{
+ GLbitfield typeBit;
+ 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 */
+ legalTypesMask &= ~FIXED_BIT;
+ }
+
+ typeBit = type_to_bit(ctx, type);
+ if (typeBit == 0x0 || (typeBit & legalTypesMask) == 0x0) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "%s(type = %s)",
+ func, _mesa_lookup_enum_by_nr(type));
+ return;
+ }
+
+ /* Do size parameter checking.
+ * If sizeMax = BGRA_OR_4 it means that size = GL_BGRA is legal and
+ * must be handled specially.
+ */
+ if (ctx->Extensions.EXT_vertex_array_bgra &&
+ sizeMax == BGRA_OR_4 &&
+ size == GL_BGRA) {
+ if (type != GL_UNSIGNED_BYTE) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s(GL_BGRA/GLubyte)", func);
+ return;
+ }
+ format = GL_BGRA;
+ size = 4;
+ }
+ else if (size < sizeMin || size > sizeMax || size > 4) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s(size=%d)", func, size);
+ return;
+ }
+
+ ASSERT(size <= 4);
+
+ if (stride < 0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "%s(stride=%d)", func, stride );
+ return;
+ }
+
+ if (ctx->Array.ArrayObj->VBOonly &&
+ ctx->Array.ArrayBufferObj->Name == 0) {
+ /* GL_ARB_vertex_array_object requires that all arrays reside in VBOs.
+ * Generate GL_INVALID_OPERATION if that's not true.
+ */
+ _mesa_error(ctx, GL_INVALID_OPERATION, "%s(non-VBO array)", func);
+ return;
+ }
+
+ elementSize = _mesa_sizeof_type(type) * size;
+
+ array->Size = size;
+ array->Type = type;
+ array->Format = format;
+ array->Stride = stride;
+ array->StrideB = stride ? stride : elementSize;
+ array->Normalized = normalized;
+ array->Ptr = (const GLubyte *) ptr;
+ array->_ElementSize = elementSize;
+
+ _mesa_reference_buffer_object(ctx, &array->BufferObj,
+ ctx->Array.ArrayBufferObj);
+
+ ctx->NewState |= _NEW_ARRAY;
+ ctx->Array.NewState |= dirtyBit;
+}
+
+
+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_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,
+ size, type, stride, GL_FALSE, GL_FALSE, 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_BIT);
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ update_array(ctx, "glNormalPointer",
+ &ctx->Array.ArrayObj->Normal, _NEW_ARRAY_NORMAL,
+ legalTypes, 3, 3,
+ 3, type, stride, GL_TRUE, GL_FALSE, 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_BIT);
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ update_array(ctx, "glColorPointer",
+ &ctx->Array.ArrayObj->Color, _NEW_ARRAY_COLOR0,
+ legalTypes, 3, BGRA_OR_4,
+ size, type, stride, GL_TRUE, GL_FALSE, ptr);
+}
+
+
+void GLAPIENTRY
+_mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr)
+{
+ const GLbitfield legalTypes = (HALF_BIT | FLOAT_BIT | DOUBLE_BIT);
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ update_array(ctx, "glFogCoordPointer",
+ &ctx->Array.ArrayObj->FogCoord, _NEW_ARRAY_FOGCOORD,
+ legalTypes, 1, 1,
+ 1, type, stride, GL_FALSE, GL_FALSE, ptr);
+}
+
+
+void GLAPIENTRY
+_mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr)
+{
+ const GLbitfield legalTypes = (UNSIGNED_BYTE_BIT | SHORT_BIT | INT_BIT |
+ FLOAT_BIT | DOUBLE_BIT);
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ update_array(ctx, "glIndexPointer",
+ &ctx->Array.ArrayObj->Index, _NEW_ARRAY_INDEX,
+ legalTypes, 1, 1,
+ 1, type, stride, GL_FALSE, GL_FALSE, ptr);
+}
+
+
+void GLAPIENTRY
+_mesa_SecondaryColorPointerEXT(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);
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ update_array(ctx, "glSecondaryColorPointer",
+ &ctx->Array.ArrayObj->SecondaryColor, _NEW_ARRAY_COLOR1,
+ legalTypes, 3, BGRA_OR_4,
+ size, type, stride, GL_TRUE, GL_FALSE, ptr);
+}
+
+
+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_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",
+ &ctx->Array.ArrayObj->TexCoord[unit],
+ _NEW_ARRAY_TEXCOORD(unit),
+ legalTypes, 1, 4,
+ size, type, stride, GL_FALSE, GL_FALSE,
+ ptr);
+}
+
+
+void GLAPIENTRY
+_mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *ptr)
+{
+ const GLbitfield legalTypes = UNSIGNED_BYTE_BIT;
+ /* see table 2.4 edits in GL_EXT_gpu_shader4 spec: */
+ const GLboolean integer = GL_TRUE;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ update_array(ctx, "glEdgeFlagPointer",
+ &ctx->Array.ArrayObj->EdgeFlag, _NEW_ARRAY_EDGEFLAG,
+ legalTypes, 1, 1,
+ 1, GL_UNSIGNED_BYTE, stride, GL_FALSE, integer, ptr);
+}
+
+
+void GLAPIENTRY
+_mesa_PointSizePointer(GLenum type, GLsizei stride, const GLvoid *ptr)
+{
+ 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,
+ 1, type, stride, GL_FALSE, GL_FALSE, ptr);
+}
+
+
+#if FEATURE_NV_vertex_program
+/**
+ * Set a vertex attribute array.
+ * Note that these arrays DO alias the conventional GL vertex arrays
+ * (position, normal, color, fog, texcoord, etc).
+ * The generic attribute slots at #16 and above are not touched.
+ */
+void GLAPIENTRY
+_mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type,
+ GLsizei stride, const GLvoid *ptr)
+{
+ const GLbitfield legalTypes = (UNSIGNED_BYTE_BIT | SHORT_BIT |
+ FLOAT_BIT | DOUBLE_BIT);
+ GLboolean normalized = GL_FALSE;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (index >= MAX_NV_VERTEX_PROGRAM_INPUTS) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerNV(index)");
+ return;
+ }
+
+ if (type == GL_UNSIGNED_BYTE && size != 4) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerNV(size!=4)");
+ return;
+ }
+
+ update_array(ctx, "glVertexAttribPointerNV",
+ &ctx->Array.ArrayObj->VertexAttrib[index],
+ _NEW_ARRAY_ATTRIB(index),
+ legalTypes, 1, BGRA_OR_4,
+ size, type, stride, normalized, GL_FALSE, ptr);
+}
+#endif
+
+
+#if FEATURE_ARB_vertex_program
+/**
+ * Set a generic vertex attribute array.
+ * Note that these arrays DO NOT alias the conventional GL vertex arrays
+ * (position, normal, color, fog, texcoord, etc).
+ */
+void GLAPIENTRY
+_mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type,
+ GLboolean normalized,
+ 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_BIT);
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (index >= ctx->Const.VertexProgram.MaxAttribs) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerARB(index)");
+ return;
+ }
+
+ update_array(ctx, "glVertexAttribPointer",
+ &ctx->Array.ArrayObj->VertexAttrib[index],
+ _NEW_ARRAY_ATTRIB(index),
+ legalTypes, 1, BGRA_OR_4,
+ size, type, stride, normalized, GL_FALSE, ptr);
+}
+#endif
+
+
+/**
+ * GL_EXT_gpu_shader4 / GL 3.0.
+ * Set an integer-valued vertex attribute array.
+ * Note that these arrays DO NOT alias the conventional GL vertex arrays
+ * (position, normal, color, fog, texcoord, etc).
+ */
+void GLAPIENTRY
+_mesa_VertexAttribIPointer(GLuint index, 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);
+ const GLboolean normalized = GL_FALSE;
+ const GLboolean integer = GL_TRUE;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (index >= ctx->Const.VertexProgram.MaxAttribs) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribIPointer(index)");
+ return;
+ }
+
+ update_array(ctx, "glVertexAttribIPointer",
+ &ctx->Array.ArrayObj->VertexAttrib[index],
+ _NEW_ARRAY_ATTRIB(index),
+ legalTypes, 1, 4,
+ size, type, stride, normalized, integer, ptr);
+}
+
+
+
+void GLAPIENTRY
+_mesa_EnableVertexAttribArrayARB(GLuint index)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (index >= ctx->Const.VertexProgram.MaxAttribs) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glEnableVertexAttribArrayARB(index)");
+ return;
+ }
+
+ ASSERT(index < Elements(ctx->Array.ArrayObj->VertexAttrib));
+
+ FLUSH_VERTICES(ctx, _NEW_ARRAY);
+ ctx->Array.ArrayObj->VertexAttrib[index].Enabled = GL_TRUE;
+ ctx->Array.ArrayObj->_Enabled |= _NEW_ARRAY_ATTRIB(index);
+ ctx->Array.NewState |= _NEW_ARRAY_ATTRIB(index);
+}
+
+
+void GLAPIENTRY
+_mesa_DisableVertexAttribArrayARB(GLuint index)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (index >= ctx->Const.VertexProgram.MaxAttribs) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glDisableVertexAttribArrayARB(index)");
+ return;
+ }
+
+ ASSERT(index < Elements(ctx->Array.ArrayObj->VertexAttrib));
+
+ FLUSH_VERTICES(ctx, _NEW_ARRAY);
+ ctx->Array.ArrayObj->VertexAttrib[index].Enabled = GL_FALSE;
+ ctx->Array.ArrayObj->_Enabled &= ~_NEW_ARRAY_ATTRIB(index);
+ ctx->Array.NewState |= _NEW_ARRAY_ATTRIB(index);
+}
+
+
+/**
+ * Return info for a vertex attribute array (no alias with legacy
+ * vertex attributes (pos, normal, color, etc)). This function does
+ * not handle the 4-element GL_CURRENT_VERTEX_ATTRIB_ARB query.
+ */
+static GLuint
+get_vertex_array_attrib(struct gl_context *ctx, GLuint index, GLenum pname,
+ const char *caller)
+{
+ const struct gl_client_array *array;
+
+ if (index >= ctx->Const.VertexProgram.MaxAttribs) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s(index=%u)", caller, index);
+ return 0;
+ }
+
+ ASSERT(index < Elements(ctx->Array.ArrayObj->VertexAttrib));
+
+ array = &ctx->Array.ArrayObj->VertexAttrib[index];
+
+ switch (pname) {
+ case GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB:
+ return array->Enabled;
+ case GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB:
+ return array->Size;
+ case GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB:
+ return array->Stride;
+ case GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB:
+ return array->Type;
+ case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB:
+ return array->Normalized;
+ case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB:
+ return array->BufferObj->Name;
+ case GL_VERTEX_ATTRIB_ARRAY_INTEGER:
+ if (ctx->Extensions.EXT_gpu_shader4) {
+ return array->Integer;
+ }
+ goto error;
+ case GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB:
+ if (ctx->Extensions.ARB_instanced_arrays) {
+ return array->InstanceDivisor;
+ }
+ goto error;
+ default:
+ ; /* fall-through */
+ }
+
+error:
+ _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=0x%x)", caller, pname);
+ return 0;
+}
+
+
+static const GLfloat *
+get_current_attrib(struct gl_context *ctx, GLuint index, const char *function)
+{
+ if (index == 0) {
+ if (ctx->API != API_OPENGLES2) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "%s(index==0)", function);
+ return NULL;
+ }
+ }
+ else if (index >= ctx->Const.VertexProgram.MaxAttribs) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "%s(index>=GL_MAX_VERTEX_ATTRIBS)", function);
+ return NULL;
+ }
+
+ FLUSH_CURRENT(ctx, 0);
+ return ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index];
+}
+
+void GLAPIENTRY
+_mesa_GetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) {
+ const GLfloat *v = get_current_attrib(ctx, index, "glGetVertexAttribfv");
+ if (v != NULL) {
+ COPY_4V(params, v);
+ }
+ }
+ else {
+ params[0] = (GLfloat) get_vertex_array_attrib(ctx, index, pname,
+ "glGetVertexAttribfv");
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_GetVertexAttribdvARB(GLuint index, GLenum pname, GLdouble *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) {
+ const GLfloat *v = get_current_attrib(ctx, index, "glGetVertexAttribdv");
+ if (v != NULL) {
+ params[0] = (GLdouble) v[0];
+ params[1] = (GLdouble) v[1];
+ params[2] = (GLdouble) v[2];
+ params[3] = (GLdouble) v[3];
+ }
+ }
+ else {
+ params[0] = (GLdouble) get_vertex_array_attrib(ctx, index, pname,
+ "glGetVertexAttribdv");
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_GetVertexAttribivARB(GLuint index, GLenum pname, GLint *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) {
+ const GLfloat *v = get_current_attrib(ctx, index, "glGetVertexAttribiv");
+ if (v != NULL) {
+ /* XXX should floats in[0,1] be scaled to full int range? */
+ params[0] = (GLint) v[0];
+ params[1] = (GLint) v[1];
+ params[2] = (GLint) v[2];
+ params[3] = (GLint) v[3];
+ }
+ }
+ else {
+ params[0] = (GLint) get_vertex_array_attrib(ctx, index, pname,
+ "glGetVertexAttribiv");
+ }
+}
+
+
+/** GL 3.0 */
+void GLAPIENTRY
+_mesa_GetVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) {
+ const GLfloat *v =
+ get_current_attrib(ctx, index, "glGetVertexAttribIiv");
+ if (v != NULL) {
+ /* XXX we don't have true integer-valued vertex attribs yet */
+ params[0] = (GLint) v[0];
+ params[1] = (GLint) v[1];
+ params[2] = (GLint) v[2];
+ params[3] = (GLint) v[3];
+ }
+ }
+ else {
+ params[0] = (GLint) get_vertex_array_attrib(ctx, index, pname,
+ "glGetVertexAttribIiv");
+ }
+}
+
+
+/** GL 3.0 */
+void GLAPIENTRY
+_mesa_GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) {
+ const GLfloat *v =
+ get_current_attrib(ctx, index, "glGetVertexAttribIuiv");
+ if (v != NULL) {
+ /* XXX we don't have true integer-valued vertex attribs yet */
+ params[0] = (GLuint) v[0];
+ params[1] = (GLuint) v[1];
+ params[2] = (GLuint) v[2];
+ params[3] = (GLuint) v[3];
+ }
+ }
+ else {
+ params[0] = get_vertex_array_attrib(ctx, index, pname,
+ "glGetVertexAttribIuiv");
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_GetVertexAttribPointervARB(GLuint index, GLenum pname, GLvoid **pointer)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (index >= ctx->Const.VertexProgram.MaxAttribs) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribPointerARB(index)");
+ return;
+ }
+
+ if (pname != GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribPointerARB(pname)");
+ return;
+ }
+
+ ASSERT(index < Elements(ctx->Array.ArrayObj->VertexAttrib));
+
+ *pointer = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[index].Ptr;
+}
+
+
+void GLAPIENTRY
+_mesa_VertexPointerEXT(GLint size, GLenum type, GLsizei stride,
+ GLsizei count, const GLvoid *ptr)
+{
+ (void) count;
+ _mesa_VertexPointer(size, type, stride, ptr);
+}
+
+
+void GLAPIENTRY
+_mesa_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count,
+ const GLvoid *ptr)
+{
+ (void) count;
+ _mesa_NormalPointer(type, stride, ptr);
+}
+
+
+void GLAPIENTRY
+_mesa_ColorPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count,
+ const GLvoid *ptr)
+{
+ (void) count;
+ _mesa_ColorPointer(size, type, stride, ptr);
+}
+
+
+void GLAPIENTRY
+_mesa_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count,
+ const GLvoid *ptr)
+{
+ (void) count;
+ _mesa_IndexPointer(type, stride, ptr);
+}
+
+
+void GLAPIENTRY
+_mesa_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride,
+ GLsizei count, const GLvoid *ptr)
+{
+ (void) count;
+ _mesa_TexCoordPointer(size, type, stride, ptr);
+}
+
+
+void GLAPIENTRY
+_mesa_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *ptr)
+{
+ (void) count;
+ _mesa_EdgeFlagPointer(stride, ptr);
+}
+
+
+void GLAPIENTRY
+_mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLboolean tflag, cflag, nflag; /* enable/disable flags */
+ GLint tcomps, ccomps, vcomps; /* components per texcoord, color, vertex */
+ GLenum ctype = 0; /* color type */
+ GLint coffset = 0, noffset = 0, voffset;/* color, normal, vertex offsets */
+ const GLint toffset = 0; /* always zero */
+ GLint defstride; /* default stride */
+ GLint c, f;
+
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ f = sizeof(GLfloat);
+ c = f * ((4 * sizeof(GLubyte) + (f - 1)) / f);
+
+ if (stride < 0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glInterleavedArrays(stride)" );
+ return;
+ }
+
+ switch (format) {
+ case GL_V2F:
+ tflag = GL_FALSE; cflag = GL_FALSE; nflag = GL_FALSE;
+ tcomps = 0; ccomps = 0; vcomps = 2;
+ voffset = 0;
+ defstride = 2*f;
+ break;
+ case GL_V3F:
+ tflag = GL_FALSE; cflag = GL_FALSE; nflag = GL_FALSE;
+ tcomps = 0; ccomps = 0; vcomps = 3;
+ voffset = 0;
+ defstride = 3*f;
+ break;
+ case GL_C4UB_V2F:
+ tflag = GL_FALSE; cflag = GL_TRUE; nflag = GL_FALSE;
+ tcomps = 0; ccomps = 4; vcomps = 2;
+ ctype = GL_UNSIGNED_BYTE;
+ coffset = 0;
+ voffset = c;
+ defstride = c + 2*f;
+ break;
+ case GL_C4UB_V3F:
+ tflag = GL_FALSE; cflag = GL_TRUE; nflag = GL_FALSE;
+ tcomps = 0; ccomps = 4; vcomps = 3;
+ ctype = GL_UNSIGNED_BYTE;
+ coffset = 0;
+ voffset = c;
+ defstride = c + 3*f;
+ break;
+ case GL_C3F_V3F:
+ tflag = GL_FALSE; cflag = GL_TRUE; nflag = GL_FALSE;
+ tcomps = 0; ccomps = 3; vcomps = 3;
+ ctype = GL_FLOAT;
+ coffset = 0;
+ voffset = 3*f;
+ defstride = 6*f;
+ break;
+ case GL_N3F_V3F:
+ tflag = GL_FALSE; cflag = GL_FALSE; nflag = GL_TRUE;
+ tcomps = 0; ccomps = 0; vcomps = 3;
+ noffset = 0;
+ voffset = 3*f;
+ defstride = 6*f;
+ break;
+ case GL_C4F_N3F_V3F:
+ tflag = GL_FALSE; cflag = GL_TRUE; nflag = GL_TRUE;
+ tcomps = 0; ccomps = 4; vcomps = 3;
+ ctype = GL_FLOAT;
+ coffset = 0;
+ noffset = 4*f;
+ voffset = 7*f;
+ defstride = 10*f;
+ break;
+ case GL_T2F_V3F:
+ tflag = GL_TRUE; cflag = GL_FALSE; nflag = GL_FALSE;
+ tcomps = 2; ccomps = 0; vcomps = 3;
+ voffset = 2*f;
+ defstride = 5*f;
+ break;
+ case GL_T4F_V4F:
+ tflag = GL_TRUE; cflag = GL_FALSE; nflag = GL_FALSE;
+ tcomps = 4; ccomps = 0; vcomps = 4;
+ voffset = 4*f;
+ defstride = 8*f;
+ break;
+ case GL_T2F_C4UB_V3F:
+ tflag = GL_TRUE; cflag = GL_TRUE; nflag = GL_FALSE;
+ tcomps = 2; ccomps = 4; vcomps = 3;
+ ctype = GL_UNSIGNED_BYTE;
+ coffset = 2*f;
+ voffset = c+2*f;
+ defstride = c+5*f;
+ break;
+ case GL_T2F_C3F_V3F:
+ tflag = GL_TRUE; cflag = GL_TRUE; nflag = GL_FALSE;
+ tcomps = 2; ccomps = 3; vcomps = 3;
+ ctype = GL_FLOAT;
+ coffset = 2*f;
+ voffset = 5*f;
+ defstride = 8*f;
+ break;
+ case GL_T2F_N3F_V3F:
+ tflag = GL_TRUE; cflag = GL_FALSE; nflag = GL_TRUE;
+ tcomps = 2; ccomps = 0; vcomps = 3;
+ noffset = 2*f;
+ voffset = 5*f;
+ defstride = 8*f;
+ break;
+ case GL_T2F_C4F_N3F_V3F:
+ tflag = GL_TRUE; cflag = GL_TRUE; nflag = GL_TRUE;
+ tcomps = 2; ccomps = 4; vcomps = 3;
+ ctype = GL_FLOAT;
+ coffset = 2*f;
+ noffset = 6*f;
+ voffset = 9*f;
+ defstride = 12*f;
+ break;
+ case GL_T4F_C4F_N3F_V4F:
+ tflag = GL_TRUE; cflag = GL_TRUE; nflag = GL_TRUE;
+ tcomps = 4; ccomps = 4; vcomps = 4;
+ ctype = GL_FLOAT;
+ coffset = 4*f;
+ noffset = 8*f;
+ voffset = 11*f;
+ defstride = 15*f;
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glInterleavedArrays(format)" );
+ return;
+ }
+
+ if (stride==0) {
+ stride = defstride;
+ }
+
+ _mesa_DisableClientState( GL_EDGE_FLAG_ARRAY );
+ _mesa_DisableClientState( GL_INDEX_ARRAY );
+ /* XXX also disable secondary color and generic arrays? */
+
+ /* Texcoords */
+ if (tflag) {
+ _mesa_EnableClientState( GL_TEXTURE_COORD_ARRAY );
+ _mesa_TexCoordPointer( tcomps, GL_FLOAT, stride,
+ (GLubyte *) pointer + toffset );
+ }
+ else {
+ _mesa_DisableClientState( GL_TEXTURE_COORD_ARRAY );
+ }
+
+ /* Color */
+ if (cflag) {
+ _mesa_EnableClientState( GL_COLOR_ARRAY );
+ _mesa_ColorPointer( ccomps, ctype, stride,
+ (GLubyte *) pointer + coffset );
+ }
+ else {
+ _mesa_DisableClientState( GL_COLOR_ARRAY );
+ }
+
+
+ /* Normals */
+ if (nflag) {
+ _mesa_EnableClientState( GL_NORMAL_ARRAY );
+ _mesa_NormalPointer( GL_FLOAT, stride, (GLubyte *) pointer + noffset );
+ }
+ else {
+ _mesa_DisableClientState( GL_NORMAL_ARRAY );
+ }
+
+ /* Vertices */
+ _mesa_EnableClientState( GL_VERTEX_ARRAY );
+ _mesa_VertexPointer( vcomps, GL_FLOAT, stride,
+ (GLubyte *) pointer + voffset );
+}
+
+
+void GLAPIENTRY
+_mesa_LockArraysEXT(GLint first, GLsizei count)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glLockArrays %d %d\n", first, count);
+
+ if (first < 0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glLockArraysEXT(first)" );
+ return;
+ }
+ if (count <= 0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glLockArraysEXT(count)" );
+ return;
+ }
+ if (ctx->Array.LockCount != 0) {
+ _mesa_error( ctx, GL_INVALID_OPERATION, "glLockArraysEXT(reentry)" );
+ return;
+ }
+
+ ctx->Array.LockFirst = first;
+ ctx->Array.LockCount = count;
+
+ ctx->NewState |= _NEW_ARRAY;
+ ctx->Array.NewState |= _NEW_ARRAY_ALL;
+}
+
+
+void GLAPIENTRY
+_mesa_UnlockArraysEXT( void )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glUnlockArrays\n");
+
+ if (ctx->Array.LockCount == 0) {
+ _mesa_error( ctx, GL_INVALID_OPERATION, "glUnlockArraysEXT(reexit)" );
+ return;
+ }
+
+ ctx->Array.LockFirst = 0;
+ ctx->Array.LockCount = 0;
+ ctx->NewState |= _NEW_ARRAY;
+ ctx->Array.NewState |= _NEW_ARRAY_ALL;
+}
+
+
+/* GL_EXT_multi_draw_arrays */
+void GLAPIENTRY
+_mesa_MultiDrawArraysEXT( GLenum mode, const GLint *first,
+ const GLsizei *count, GLsizei primcount )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint i;
+
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ for (i = 0; i < primcount; i++) {
+ if (count[i] > 0) {
+ CALL_DrawArrays(ctx->Exec, (mode, first[i], count[i]));
+ }
+ }
+}
+
+
+/* GL_IBM_multimode_draw_arrays */
+void GLAPIENTRY
+_mesa_MultiModeDrawArraysIBM( const GLenum * mode, const GLint * first,
+ const GLsizei * count,
+ GLsizei primcount, GLint modestride )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint i;
+
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ for ( i = 0 ; i < primcount ; i++ ) {
+ if ( count[i] > 0 ) {
+ GLenum m = *((GLenum *) ((GLubyte *) mode + i * modestride));
+ CALL_DrawArrays(ctx->Exec, ( m, first[i], count[i] ));
+ }
+ }
+}
+
+
+/* GL_IBM_multimode_draw_arrays */
+void GLAPIENTRY
+_mesa_MultiModeDrawElementsIBM( const GLenum * mode, const GLsizei * count,
+ GLenum type, const GLvoid * const * indices,
+ GLsizei primcount, GLint modestride )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint i;
+
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ /* XXX not sure about ARB_vertex_buffer_object handling here */
+
+ for ( i = 0 ; i < primcount ; i++ ) {
+ if ( count[i] > 0 ) {
+ GLenum m = *((GLenum *) ((GLubyte *) mode + i * modestride));
+ CALL_DrawElements(ctx->Exec, ( m, count[i], type, indices[i] ));
+ }
+ }
+}
+
+
+/**
+ * GL_NV_primitive_restart and GL 3.1
+ */
+void GLAPIENTRY
+_mesa_PrimitiveRestartIndex(GLuint index)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (!ctx->Extensions.NV_primitive_restart &&
+ ctx->VersionMajor * 10 + ctx->VersionMinor < 31) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glPrimitiveRestartIndexNV()");
+ return;
+ }
+
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
+
+ ctx->Array.RestartIndex = index;
+}
+
+
+/**
+ * See GL_ARB_instanced_arrays.
+ * Note that the instance divisor only applies to generic arrays, not
+ * the legacy vertex arrays.
+ */
+void GLAPIENTRY
+_mesa_VertexAttribDivisor(GLuint index, GLuint divisor)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (!ctx->Extensions.ARB_instanced_arrays) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glVertexAttribDivisor()");
+ return;
+ }
+
+ if (index >= ctx->Const.VertexProgram.MaxAttribs) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glVertexAttribDivisor(index = %u)",
+ index);
+ return;
+ }
+
+ ctx->Array.ArrayObj->VertexAttrib[index].InstanceDivisor = divisor;
+}
+
+
+
+/**
+ * Copy one client vertex array to another.
+ */
+void
+_mesa_copy_client_array(struct gl_context *ctx,
+ struct gl_client_array *dst,
+ struct gl_client_array *src)
+{
+ dst->Size = src->Size;
+ dst->Type = src->Type;
+ dst->Format = src->Format;
+ dst->Stride = src->Stride;
+ dst->StrideB = src->StrideB;
+ dst->Ptr = src->Ptr;
+ dst->Enabled = src->Enabled;
+ dst->Normalized = src->Normalized;
+ dst->Integer = src->Integer;
+ dst->InstanceDivisor = src->InstanceDivisor;
+ dst->_ElementSize = src->_ElementSize;
+ _mesa_reference_buffer_object(ctx, &dst->BufferObj, src->BufferObj);
+ dst->_MaxElement = src->_MaxElement;
+}
+
+
+
+/**
+ * Print vertex array's fields.
+ */
+static void
+print_array(const char *name, GLint index, const struct gl_client_array *array)
+{
+ if (index >= 0)
+ printf(" %s[%d]: ", name, index);
+ else
+ printf(" %s: ", name);
+ printf("Ptr=%p, Type=0x%x, Size=%d, ElemSize=%u, Stride=%d, Buffer=%u(Size %lu), MaxElem=%u\n",
+ array->Ptr, array->Type, array->Size,
+ array->_ElementSize, array->StrideB,
+ array->BufferObj->Name, (unsigned long) array->BufferObj->Size,
+ array->_MaxElement);
+}
+
+
+/**
+ * Print current vertex object/array info. For debug.
+ */
+void
+_mesa_print_arrays(struct gl_context *ctx)
+{
+ struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
+ GLuint i;
+
+ _mesa_update_array_object_max_element(ctx, arrayObj);
+
+ printf("Array Object %u\n", arrayObj->Name);
+ if (arrayObj->Vertex.Enabled)
+ print_array("Vertex", -1, &arrayObj->Vertex);
+ if (arrayObj->Normal.Enabled)
+ print_array("Normal", -1, &arrayObj->Normal);
+ if (arrayObj->Color.Enabled)
+ print_array("Color", -1, &arrayObj->Color);
+ for (i = 0; i < Elements(arrayObj->TexCoord); i++)
+ if (arrayObj->TexCoord[i].Enabled)
+ print_array("TexCoord", i, &arrayObj->TexCoord[i]);
+ for (i = 0; i < Elements(arrayObj->VertexAttrib); i++)
+ if (arrayObj->VertexAttrib[i].Enabled)
+ print_array("Attrib", i, &arrayObj->VertexAttrib[i]);
+ printf(" _MaxElement = %u\n", arrayObj->_MaxElement);
+}
+
+
+/**
+ * Initialize vertex array state for given context.
+ */
+void
+_mesa_init_varray(struct gl_context *ctx)
+{
+ ctx->Array.DefaultArrayObj = _mesa_new_array_object(ctx, 0);
+ _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj,
+ ctx->Array.DefaultArrayObj);
+ ctx->Array.ActiveTexture = 0; /* GL_ARB_multitexture */
+
+ ctx->Array.Objects = _mesa_NewHashTable();
+}
+
+
+/**
+ * Callback for deleting an array object. Called by _mesa_HashDeleteAll().
+ */
+static void
+delete_arrayobj_cb(GLuint id, void *data, void *userData)
+{
+ struct gl_array_object *arrayObj = (struct gl_array_object *) data;
+ struct gl_context *ctx = (struct gl_context *) userData;
+ _mesa_delete_array_object(ctx, arrayObj);
+}
+
+
+/**
+ * Free vertex array state for given context.
+ */
+void
+_mesa_free_varray_data(struct gl_context *ctx)
+{
+ _mesa_HashDeleteAll(ctx->Array.Objects, delete_arrayobj_cb, ctx);
+ _mesa_DeleteHashTable(ctx->Array.Objects);
+}
diff --git a/mesalib/src/mesa/main/varray.h b/mesalib/src/mesa/main/varray.h
index 1e3ab10c9..493494e5c 100644
--- a/mesalib/src/mesa/main/varray.h
+++ b/mesalib/src/mesa/main/varray.h
@@ -34,6 +34,37 @@
struct gl_client_array;
struct gl_context;
+
+/**
+ * Compute the index of the last array element that can be safely accessed in
+ * a vertex array. We can really only do this when the array lives in a VBO.
+ * The array->_MaxElement field will be updated.
+ * Later in glDrawArrays/Elements/etc we can do some bounds checking.
+ */
+static INLINE void
+_mesa_update_array_max_element(struct gl_client_array *array)
+{
+ assert(array->Enabled);
+
+ if (array->BufferObj->Name) {
+ GLsizeiptrARB offset = (GLsizeiptrARB) array->Ptr;
+ GLsizeiptrARB bufSize = (GLsizeiptrARB) array->BufferObj->Size;
+
+ if (offset < bufSize) {
+ array->_MaxElement = (bufSize - offset + array->StrideB
+ - array->_ElementSize) / array->StrideB;
+ }
+ else {
+ array->_MaxElement = 0;
+ }
+ }
+ else {
+ /* user-space array, no idea how big it is */
+ array->_MaxElement = 2 * 1000 * 1000 * 1000; /* just a big number */
+ }
+}
+
+
#if _HAVE_FULL_GL
extern void GLAPIENTRY
diff --git a/pixman/Makefile.am b/pixman/Makefile.am
index 7eb9f59ac..ccfdbe510 100644
--- a/pixman/Makefile.am
+++ b/pixman/Makefile.am
@@ -12,10 +12,10 @@ snapshot:
GPGKEY=6FF7C1A8
USERNAME=$$USER
-RELEASE_OR_SNAPSHOT = $$(if test "x$(CAIRO_VERSION_MINOR)" = "x$$(echo "$(CAIRO_VERSION_MINOR)/2*2" | bc)" ; then echo release; else echo snapshot; fi)
+RELEASE_OR_SNAPSHOT = $$(if test "x$(PIXMAN_VERSION_MINOR)" = "x$$(echo "$(PIXMAN_VERSION_MINOR)/2*2" | bc)" ; then echo release; else echo snapshot; fi)
RELEASE_CAIRO_HOST = $(USERNAME)@cairographics.org
-RELEASE_CAIRO_DIR = /srv/cairo.freedesktop.org/www/releases
-RELEASE_CAIRO_URL = http://cairographics.org/releases
+RELEASE_CAIRO_DIR = /srv/cairo.freedesktop.org/www/$(RELEASE_OR_SNAPSHOT)s
+RELEASE_CAIRO_URL = http://cairographics.org/$(RELEASE_OR_SNAPSHOT)s
RELEASE_XORG_URL = http://xorg.freedesktop.org/archive/individual/lib
RELEASE_XORG_HOST = $(USERNAME)@xorg.freedesktop.org
RELEASE_XORG_DIR = /srv/xorg.freedesktop.org/archive/individual/lib
@@ -83,7 +83,6 @@ release-tag:
git tag -u $(GPGKEY) -m "$(PACKAGE) $(VERSION) release" $(PACKAGE)-$(VERSION)
release-upload: release-check $(tar_gz) $(tar_bz2) $(sha1_tgz) $(sha1_tbz2) $(md5_tgz) $(gpg_file)
- mkdir -p releases
scp $(tar_gz) $(sha1_tgz) $(gpg_file) $(RELEASE_CAIRO_HOST):$(RELEASE_CAIRO_DIR)
scp $(tar_gz) $(tar_bz2) $(RELEASE_XORG_HOST):$(RELEASE_XORG_DIR)
ssh $(RELEASE_CAIRO_HOST) "rm -f $(RELEASE_CAIRO_DIR)/LATEST-$(PACKAGE)-[0-9]* && ln -s $(tar_gz) $(RELEASE_CAIRO_DIR)/LATEST-$(PACKAGE)-$(VERSION)"
diff --git a/pixman/pixman/pixman-arm-neon-asm.S b/pixman/pixman/pixman-arm-neon-asm.S
index 6cca0f2cc..fae51aa7c 100644
--- a/pixman/pixman/pixman-arm-neon-asm.S
+++ b/pixman/pixman/pixman-arm-neon-asm.S
@@ -1358,11 +1358,10 @@ generate_composite_function \
*
* output: updated dest in {d28, d29, d30, d31}
*/
- vmvn.8 d24, d24
- vmvn.8 d25, d25
+ vmvn.8 q12, q12
+ vmvn.8 d26, d26
vmull.u8 q8, d24, d4
vmull.u8 q9, d25, d5
- vmvn.8 d26, d26
vmvn.8 d27, d3
vmull.u8 q10, d26, d6
vmull.u8 q11, d27, d7
diff --git a/xorg-server/Xext/geext.c b/xorg-server/Xext/geext.c
index 93e5277cc..5e7b9c29b 100644
--- a/xorg-server/Xext/geext.c
+++ b/xorg-server/Xext/geext.c
@@ -49,6 +49,7 @@ static const int version_requests[] = {
static void SGEGenericEvent(xEvent* from, xEvent* to);
#define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0]))
+#define EXT_MASK(ext) ((ext) & 0x7F)
/************************************************************/
/* request handlers */
@@ -191,8 +192,8 @@ SGEGenericEvent(xEvent* from, xEvent* to)
return;
}
- if (GEExtensions[gefrom->extension & 0x7F].evswap)
- GEExtensions[gefrom->extension & 0x7F].evswap(gefrom, geto);
+ if (GEExtensions[EXT_MASK(gefrom->extension)].evswap)
+ GEExtensions[EXT_MASK(gefrom->extension)].evswap(gefrom, geto);
}
/* Init extension, register at server.
@@ -241,11 +242,11 @@ void
GERegisterExtension(int extension,
void (*ev_swap)(xGenericEvent* from, xGenericEvent* to))
{
- if ((extension & 0x7F) >= MAXEXTENSIONS)
+ if (EXT_MASK(extension) >= MAXEXTENSIONS)
FatalError("GE: extension > MAXEXTENSIONS. This should not happen.\n");
/* extension opcodes are > 128, might as well save some space here */
- GEExtensions[extension & 0x7f].evswap = ev_swap;
+ GEExtensions[EXT_MASK(extension)].evswap = ev_swap;
}
diff --git a/xorg-server/dix/eventconvert.c b/xorg-server/dix/eventconvert.c
index 6af142860..4fe325922 100644
--- a/xorg-server/dix/eventconvert.c
+++ b/xorg-server/dix/eventconvert.c
@@ -383,12 +383,12 @@ getValuatorEvents(DeviceEvent *ev, deviceValuator *xv)
int i;
int state = 0;
int first_valuator, num_valuators;
- DeviceIntPtr dev = NULL;
num_valuators = countValuators(ev, &first_valuator);
if (num_valuators > 0)
{
+ DeviceIntPtr dev = NULL;
dixLookupDevice(&dev, ev->deviceid, serverClient, DixUseAccess);
/* State needs to be assembled BEFORE the device is updated. */
state = (dev && dev->key) ? XkbStateFieldFromRec(&dev->key->xkbInfo->state) : 0;
@@ -405,14 +405,10 @@ getValuatorEvents(DeviceEvent *ev, deviceValuator *xv)
xv->deviceid = ev->deviceid;
xv->device_state = state;
- for (j = 0; j < xv->num_valuators; j++) {
- if (BitIsOn(ev->valuators.mask, xv->first_valuator + j))
- valuators[j] = ev->valuators.data[xv->first_valuator + j];
- else if (dev->valuator->axes[xv->first_valuator + j].mode == Absolute)
- valuators[j] = dev->valuator->axisVal[xv->first_valuator + j];
- else
- valuators[j] = 0;
- }
+ /* Unset valuators in masked valuator events have the proper data values
+ * in the case of an absolute axis in between two set valuators. */
+ for (j = 0; j < xv->num_valuators; j++)
+ valuators[j] = ev->valuators.data[xv->first_valuator + j];
if (i + 6 < num_valuators)
xv->deviceid |= MORE_EVENTS;
diff --git a/xorg-server/dix/getevents.c b/xorg-server/dix/getevents.c
index 7f273fb2d..c8fb48192 100644
--- a/xorg-server/dix/getevents.c
+++ b/xorg-server/dix/getevents.c
@@ -220,6 +220,8 @@ set_valuators(DeviceIntPtr dev, DeviceEvent* event, ValuatorMask *mask)
{
int i;
+ /* Set the data to the previous value for unset absolute axes. The values
+ * may be used when sent as part of an XI 1.x valuator event. */
for (i = 0; i < valuator_mask_size(mask); i++)
{
if (valuator_mask_isset(mask, i))
@@ -231,6 +233,8 @@ set_valuators(DeviceIntPtr dev, DeviceEvent* event, ValuatorMask *mask)
event->valuators.data_frac[i] =
dev->last.remainder[i] * (1 << 16) * (1 << 16);
}
+ else if (valuator_get_mode(dev, i) == Absolute)
+ event->valuators.data[i] = dev->valuator->axisVal[i];
}
}
diff --git a/xorg-server/xkeyboard-config/rules/base.xml.in b/xorg-server/xkeyboard-config/rules/base.xml.in
index 2257d156f..1a2377843 100644
--- a/xorg-server/xkeyboard-config/rules/base.xml.in
+++ b/xorg-server/xkeyboard-config/rules/base.xml.in
@@ -5459,7 +5459,7 @@
<option>
<configItem>
<name>lv3:bksl_switch_latch</name>
- <_description>Backslash chooses 3rd level, latches when pressed together with another 3rd-level-chooser)</_description>
+ <_description>Backslash (chooses 3rd level, latches when pressed together with another 3rd-level-chooser)</_description>
</configItem>
</option>
<option>