aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r--mesalib/src/mesa/main/arrayobj.c41
-rw-r--r--mesalib/src/mesa/main/arrayobj.h207
-rw-r--r--mesalib/src/mesa/main/bufferobj.c44
-rw-r--r--mesalib/src/mesa/main/bufferobj.h3
-rw-r--r--mesalib/src/mesa/main/dd.h8
-rw-r--r--mesalib/src/mesa/main/mtypes.h14
-rw-r--r--mesalib/src/mesa/main/shaderobj.c2
-rw-r--r--mesalib/src/mesa/main/state.c126
-rw-r--r--mesalib/src/mesa/main/texformat.c14
-rw-r--r--mesalib/src/mesa/main/texgetimage.c6
-rw-r--r--mesalib/src/mesa/main/teximage.h9
-rw-r--r--mesalib/src/mesa/main/texstore.c4
-rw-r--r--mesalib/src/mesa/main/varray.c2
13 files changed, 232 insertions, 248 deletions
diff --git a/mesalib/src/mesa/main/arrayobj.c b/mesalib/src/mesa/main/arrayobj.c
index 29bfed8f5..328774543 100644
--- a/mesalib/src/mesa/main/arrayobj.c
+++ b/mesalib/src/mesa/main/arrayobj.c
@@ -280,15 +280,26 @@ remove_array_object( struct gl_context *ctx, struct gl_array_object *obj )
/**
- * Helper for update_arrays().
- * \return min(current min, array->_MaxElement).
+ * Helper for _mesa_update_array_object_max_element().
+ * \return min(arrayObj->VertexAttrib[*]._MaxElement).
*/
static GLuint
-update_min(GLuint min, struct gl_client_array *array)
+compute_max_element(struct gl_array_object *arrayObj, GLbitfield64 enabled)
{
- assert(array->Enabled);
- _mesa_update_array_max_element(array);
- return MIN2(min, array->_MaxElement);
+ GLuint min = ~((GLuint)0);
+
+ while (enabled) {
+ struct gl_client_array *client_array;
+ GLint attrib = ffsll(enabled) - 1;
+ enabled ^= BITFIELD64_BIT(attrib);
+
+ client_array = &arrayObj->VertexAttrib[attrib];
+ assert(client_array->Enabled);
+ _mesa_update_array_max_element(client_array);
+ min = MIN2(min, client_array->_MaxElement);
+ }
+
+ return min;
}
@@ -299,17 +310,19 @@ void
_mesa_update_array_object_max_element(struct gl_context *ctx,
struct gl_array_object *arrayObj)
{
- GLbitfield64 enabled = arrayObj->_Enabled;
- GLuint min = ~0u;
-
- while (enabled) {
- GLint attrib = ffsll(enabled) - 1;
- enabled &= ~BITFIELD64_BIT(attrib);
- min = update_min(min, &arrayObj->VertexAttrib[attrib]);
+ GLbitfield64 enabled;
+
+ if (!ctx->VertexProgram._Current ||
+ ctx->VertexProgram._Current == ctx->VertexProgram._TnlProgram) {
+ enabled = _mesa_array_object_get_enabled_ff(arrayObj);
+ } else if (ctx->VertexProgram._Current->IsNVProgram) {
+ enabled = _mesa_array_object_get_enabled_nv(arrayObj);
+ } else {
+ enabled = _mesa_array_object_get_enabled_arb(arrayObj);
}
/* _MaxElement is one past the last legal array element */
- arrayObj->_MaxElement = min;
+ arrayObj->_MaxElement = compute_max_element(arrayObj, enabled);
}
diff --git a/mesalib/src/mesa/main/arrayobj.h b/mesalib/src/mesa/main/arrayobj.h
index 44f771417..717c7916e 100644
--- a/mesalib/src/mesa/main/arrayobj.h
+++ b/mesalib/src/mesa/main/arrayobj.h
@@ -1,85 +1,122 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.6
- *
- * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
- * (C) Copyright IBM Corporation 2006
- * 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 OR IBM 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.
- */
-
-#ifndef ARRAYOBJ_H
-#define ARRAYOBJ_H
-
-#include "glheader.h"
-
-struct gl_context;
-
-/**
- * \file arrayobj.h
- * Functions for the GL_APPLE_vertex_array_object extension.
- *
- * \author Ian Romanick <idr@us.ibm.com>
- * \author Brian Paul
- */
-
-/*
- * Internal functions
- */
-
-extern struct gl_array_object *
-_mesa_new_array_object( struct gl_context *ctx, GLuint name );
-
-extern void
-_mesa_delete_array_object( struct gl_context *ctx, struct gl_array_object *obj );
-
-extern void
-_mesa_reference_array_object(struct gl_context *ctx,
- struct gl_array_object **ptr,
- struct gl_array_object *arrayObj);
-
-extern void
-_mesa_initialize_array_object( struct gl_context *ctx,
- struct gl_array_object *obj, GLuint name );
-
-
-extern void
-_mesa_update_array_object_max_element(struct gl_context *ctx,
- struct gl_array_object *arrayObj);
-
-
-/*
- * API functions
- */
-
-
-void GLAPIENTRY _mesa_BindVertexArray( GLuint id );
-
-void GLAPIENTRY _mesa_BindVertexArrayAPPLE( GLuint id );
-
-void GLAPIENTRY _mesa_DeleteVertexArraysAPPLE(GLsizei n, const GLuint *ids);
-
-void GLAPIENTRY _mesa_GenVertexArrays(GLsizei n, GLuint *arrays);
-
-void GLAPIENTRY _mesa_GenVertexArraysAPPLE(GLsizei n, GLuint *buffer);
-
-GLboolean GLAPIENTRY _mesa_IsVertexArrayAPPLE( GLuint id );
-
-#endif /* ARRAYOBJ_H */
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.6
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ * (C) Copyright IBM Corporation 2006
+ * 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 OR IBM 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.
+ */
+
+#ifndef ARRAYOBJ_H
+#define ARRAYOBJ_H
+
+#include "glheader.h"
+#include "mtypes.h"
+
+struct gl_context;
+
+/**
+ * \file arrayobj.h
+ * Functions for the GL_APPLE_vertex_array_object extension.
+ *
+ * \author Ian Romanick <idr@us.ibm.com>
+ * \author Brian Paul
+ */
+
+/*
+ * Internal functions
+ */
+
+extern struct gl_array_object *
+_mesa_new_array_object( struct gl_context *ctx, GLuint name );
+
+extern void
+_mesa_delete_array_object( struct gl_context *ctx, struct gl_array_object *obj );
+
+extern void
+_mesa_reference_array_object(struct gl_context *ctx,
+ struct gl_array_object **ptr,
+ struct gl_array_object *arrayObj);
+
+extern void
+_mesa_initialize_array_object( struct gl_context *ctx,
+ struct gl_array_object *obj, GLuint name );
+
+
+extern void
+_mesa_update_array_object_max_element(struct gl_context *ctx,
+ struct gl_array_object *arrayObj);
+
+/** Returns the bitmask of all enabled arrays in fixed function mode.
+ *
+ * In fixed function mode only the traditional fixed function arrays
+ * are available.
+ */
+static inline GLbitfield64
+_mesa_array_object_get_enabled_ff(const struct gl_array_object *arrayObj)
+{
+ return arrayObj->_Enabled & VERT_BIT_FF_ALL;
+}
+
+/** Returns the bitmask of all enabled arrays in nv shader mode.
+ *
+ * In nv shader mode, the nv generic arrays take precedence over
+ * the legacy arrays.
+ */
+static inline GLbitfield64
+_mesa_array_object_get_enabled_nv(const struct gl_array_object *arrayObj)
+{
+ GLbitfield64 enabled = arrayObj->_Enabled;
+ return enabled & ~(VERT_BIT_FF_NVALIAS & (enabled >> VERT_ATTRIB_GENERIC0));
+}
+
+/** Returns the bitmask of all enabled arrays in arb/glsl shader mode.
+ *
+ * In arb/glsl shader mode all the fixed function and the arb/glsl generic
+ * arrays are available. Only the first generic array takes
+ * precedence over the legacy position array.
+ */
+static inline GLbitfield64
+_mesa_array_object_get_enabled_arb(const struct gl_array_object *arrayObj)
+{
+ GLbitfield64 enabled = arrayObj->_Enabled;
+ return enabled & ~(VERT_BIT_POS & (enabled >> VERT_ATTRIB_GENERIC0));
+}
+
+
+/*
+ * API functions
+ */
+
+
+void GLAPIENTRY _mesa_BindVertexArray( GLuint id );
+
+void GLAPIENTRY _mesa_BindVertexArrayAPPLE( GLuint id );
+
+void GLAPIENTRY _mesa_DeleteVertexArraysAPPLE(GLsizei n, const GLuint *ids);
+
+void GLAPIENTRY _mesa_GenVertexArrays(GLsizei n, GLuint *arrays);
+
+void GLAPIENTRY _mesa_GenVertexArraysAPPLE(GLsizei n, GLuint *buffer);
+
+GLboolean GLAPIENTRY _mesa_IsVertexArrayAPPLE( GLuint id );
+
+#endif /* ARRAYOBJ_H */
diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c
index 5f8071f58..5b6db78d8 100644
--- a/mesalib/src/mesa/main/bufferobj.c
+++ b/mesalib/src/mesa/main/bufferobj.c
@@ -49,13 +49,6 @@
/*#define BOUNDS_CHECK*/
-#if FEATURE_OES_mapbuffer
-#define DEFAULT_ACCESS GL_MAP_WRITE_BIT
-#else
-#define DEFAULT_ACCESS (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT)
-#endif
-
-
/**
* Used as a placeholder for buffer objects between glGenBuffers() and
* glBindBuffer() so that glIsBuffer() can work correctly.
@@ -122,6 +115,30 @@ get_buffer(struct gl_context *ctx, GLenum target)
}
+static inline GLenum
+default_access_mode(const struct gl_context *ctx)
+{
+ /* Table 2.6 on page 31 (page 44 of the PDF) of the OpenGL 1.5 spec says:
+ *
+ * Name Type Initial Value Legal Values
+ * ... ... ... ...
+ * BUFFER_ACCESS enum READ_WRITE READ_ONLY, WRITE_ONLY
+ * READ_WRITE
+ *
+ * However, table 6.8 in the GL_OES_mapbuffer extension says:
+ *
+ * Get Value Type Get Command Value Description
+ * --------- ---- ----------- ----- -----------
+ * BUFFER_ACCESS_OES Z1 GetBufferParameteriv WRITE_ONLY_OES buffer map flag
+ *
+ * The difference is because GL_OES_mapbuffer only supports mapping buffers
+ * write-only.
+ */
+ return (ctx->API == API_OPENGLES)
+ ? GL_MAP_WRITE_BIT : (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT);
+}
+
+
/**
* Convert a GLbitfield describing the mapped buffer access flags
* into one of GL_READ_WRITE, GL_READ_ONLY, or GL_WRITE_ONLY.
@@ -213,7 +230,7 @@ _mesa_new_buffer_object( struct gl_context *ctx, GLuint name, GLenum target )
(void) ctx;
obj = MALLOC_STRUCT(gl_buffer_object);
- _mesa_initialize_buffer_object(obj, name, target);
+ _mesa_initialize_buffer_object(ctx, obj, name, target);
return obj;
}
@@ -311,7 +328,8 @@ _mesa_reference_buffer_object_(struct gl_context *ctx,
* Initialize a buffer object to default values.
*/
void
-_mesa_initialize_buffer_object( struct gl_buffer_object *obj,
+_mesa_initialize_buffer_object( struct gl_context *ctx,
+ struct gl_buffer_object *obj,
GLuint name, GLenum target )
{
(void) target;
@@ -321,7 +339,7 @@ _mesa_initialize_buffer_object( struct gl_buffer_object *obj,
obj->RefCount = 1;
obj->Name = name;
obj->Usage = GL_STATIC_DRAW_ARB;
- obj->AccessFlags = DEFAULT_ACCESS;
+ obj->AccessFlags = default_access_mode(ctx);
}
@@ -740,7 +758,7 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids)
if (_mesa_bufferobj_mapped(bufObj)) {
/* if mapped, unmap it now */
ctx->Driver.UnmapBuffer(ctx, bufObj);
- bufObj->AccessFlags = DEFAULT_ACCESS;
+ bufObj->AccessFlags = default_access_mode(ctx);
bufObj->Pointer = NULL;
}
@@ -900,7 +918,7 @@ _mesa_BufferDataARB(GLenum target, GLsizeiptrARB size,
if (_mesa_bufferobj_mapped(bufObj)) {
/* Unmap the existing buffer. We'll replace it now. Not an error. */
ctx->Driver.UnmapBuffer(ctx, bufObj);
- bufObj->AccessFlags = DEFAULT_ACCESS;
+ bufObj->AccessFlags = default_access_mode(ctx);
ASSERT(bufObj->Pointer == NULL);
}
@@ -1119,7 +1137,7 @@ _mesa_UnmapBufferARB(GLenum target)
#endif
status = ctx->Driver.UnmapBuffer( ctx, bufObj );
- bufObj->AccessFlags = DEFAULT_ACCESS;
+ bufObj->AccessFlags = default_access_mode(ctx);
ASSERT(bufObj->Pointer == NULL);
ASSERT(bufObj->Offset == 0);
ASSERT(bufObj->Length == 0);
diff --git a/mesalib/src/mesa/main/bufferobj.h b/mesalib/src/mesa/main/bufferobj.h
index c0d5a641a..a7ce37928 100644
--- a/mesalib/src/mesa/main/bufferobj.h
+++ b/mesalib/src/mesa/main/bufferobj.h
@@ -71,7 +71,8 @@ extern struct gl_buffer_object *
_mesa_lookup_bufferobj(struct gl_context *ctx, GLuint buffer);
extern void
-_mesa_initialize_buffer_object( struct gl_buffer_object *obj,
+_mesa_initialize_buffer_object( struct gl_context *ctx,
+ struct gl_buffer_object *obj,
GLuint name, GLenum target );
extern void
diff --git a/mesalib/src/mesa/main/dd.h b/mesalib/src/mesa/main/dd.h
index 24f3d4ca5..8393f328f 100644
--- a/mesalib/src/mesa/main/dd.h
+++ b/mesalib/src/mesa/main/dd.h
@@ -460,7 +460,8 @@ struct dd_function_table {
* \param texImage the texture image
* \param slice the 3D image slice or array texture slice
* \param x, y, w, h region of interest
- * \param mode bitmask of GL_MAP_READ_BIT, GL_MAP_WRITE_BIT
+ * \param mode bitmask of GL_MAP_READ_BIT, GL_MAP_WRITE_BIT and
+ * GL_MAP_INVALIDATE_RANGE_BIT (if writing)
* \param mapOut returns start of mapping of region of interest
* \param rowStrideOut returns row stride (in bytes)
*/
@@ -489,6 +490,11 @@ struct dd_function_table {
GLsizei levels, GLsizei width,
GLsizei height, GLsizei depth);
+ /**
+ * Map a renderbuffer into user space.
+ * \param mode bitmask of GL_MAP_READ_BIT, GL_MAP_WRITE_BIT and
+ * GL_MAP_INVALIDATE_RANGE_BIT (if writing)
+ */
void (*MapRenderbuffer)(struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint x, GLuint y, GLuint w, GLuint h,
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 9fdabf98c..f8ef01d4e 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -199,19 +199,23 @@ typedef enum
#define VERT_BIT_GENERIC0 BITFIELD64_BIT(VERT_ATTRIB_GENERIC0)
#define VERT_BIT(i) BITFIELD64_BIT(i)
-#define VERT_BIT_ALL (BITFIELD64_BIT(VERT_ATTRIB_MAX) - 1)
+#define VERT_BIT_ALL BITFIELD64_RANGE(0, VERT_ATTRIB_MAX)
#define VERT_BIT_FF(i) VERT_BIT(i)
-#define VERT_BIT_FF_ALL (BITFIELD64_BIT(VERT_ATTRIB_FF_MAX) - 1)
+#define VERT_BIT_FF_ALL BITFIELD64_RANGE(0, VERT_ATTRIB_FF_MAX)
#define VERT_BIT_TEX(i) VERT_BIT(VERT_ATTRIB_TEX(i))
#define VERT_BIT_TEX_ALL \
- ((BITFIELD64_BIT(VERT_ATTRIB_TEX_MAX) - 1) << VERT_ATTRIB_TEX(0))
+ BITFIELD64_RANGE(VERT_ATTRIB_TEX(0), VERT_ATTRIB_TEX_MAX)
+#define VERT_BIT_FF_NVALIAS \
+ BITFIELD64_RANGE(VERT_ATTRIB_POS, VERT_ATTRIB_TEX(VERT_ATTRIB_TEX_MAX))
+
#define VERT_BIT_GENERIC_NV(i) VERT_BIT(VERT_ATTRIB_GENERIC_NV(i))
#define VERT_BIT_GENERIC_NV_ALL \
- ((BITFIELD64_BIT(VERT_ATTRIB_GENERIC_NV_MAX) - 1) << (VERT_ATTRIB_GENERIC_NV(0)))
+ BITFIELD64_RANGE(VERT_ATTRIB_GENERIC_NV(0), VERT_ATTRIB_GENERIC_NV_MAX)
+
#define VERT_BIT_GENERIC(i) VERT_BIT(VERT_ATTRIB_GENERIC(i))
#define VERT_BIT_GENERIC_ALL \
- ((BITFIELD64_BIT(VERT_ATTRIB_GENERIC_MAX) - 1) << (VERT_ATTRIB_GENERIC(0)))
+ BITFIELD64_RANGE(VERT_ATTRIB_GENERIC(0), VERT_ATTRIB_GENERIC_MAX)
/*@}*/
diff --git a/mesalib/src/mesa/main/shaderobj.c b/mesalib/src/mesa/main/shaderobj.c
index de66851e9..36f208d6c 100644
--- a/mesalib/src/mesa/main/shaderobj.c
+++ b/mesalib/src/mesa/main/shaderobj.c
@@ -35,6 +35,7 @@
#include "main/mfeatures.h"
#include "main/mtypes.h"
#include "main/shaderobj.h"
+#include "main/uniforms.h"
#include "program/program.h"
#include "program/prog_parameter.h"
#include "program/hash_table.h"
@@ -276,6 +277,7 @@ _mesa_clear_shader_program_data(struct gl_context *ctx,
struct gl_shader_program *shProg)
{
if (shProg->UniformStorage) {
+ _mesa_uniform_detach_all_driver_storage(shProg->UniformStorage);
ralloc_free(shProg->UniformStorage);
shProg->NumUserUniformStorage = 0;
shProg->UniformStorage = NULL;
diff --git a/mesalib/src/mesa/main/state.c b/mesalib/src/mesa/main/state.c
index b910543e2..adbb0c32b 100644
--- a/mesalib/src/mesa/main/state.c
+++ b/mesalib/src/mesa/main/state.c
@@ -63,130 +63,6 @@ update_separate_specular(struct gl_context *ctx)
/**
- * Helper for update_arrays().
- * \return min(current min, array->_MaxElement).
- */
-static GLuint
-update_min(GLuint min, struct gl_client_array *array)
-{
- _mesa_update_array_max_element(array);
- return MIN2(min, array->_MaxElement);
-}
-
-
-/**
- * Update ctx->Array._MaxElement (the max legal index into all enabled arrays).
- * Need to do this upon new array state or new buffer object state.
- */
-static void
-update_arrays( struct gl_context *ctx )
-{
- struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
- GLuint i, min = ~0;
-
- /* find min of _MaxElement values for all enabled arrays.
- * Note that the generic arrays always take precedence over
- * the legacy arrays.
- */
-
- /* 0 */
- if (ctx->VertexProgram._Current
- && arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC0].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC0]);
- }
- else if (arrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_POS]);
- }
-
- /* 1 */
- if (ctx->VertexProgram._Enabled
- && arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC1].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC1]);
- }
- /* no conventional vertex weight array */
-
- /* 2 */
- if (ctx->VertexProgram._Enabled
- && arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC2].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC2]);
- }
- else if (arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL]);
- }
-
- /* 3 */
- if (ctx->VertexProgram._Enabled
- && arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC3].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC3]);
- }
- else if (arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0]);
- }
-
- /* 4 */
- if (ctx->VertexProgram._Enabled
- && arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC4].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC4]);
- }
- else if (arrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR1]);
- }
-
- /* 5 */
- if (ctx->VertexProgram._Enabled
- && arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC5].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC5]);
- }
- else if (arrayObj->VertexAttrib[VERT_ATTRIB_FOG].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_FOG]);
- }
-
- /* 6 */
- if (ctx->VertexProgram._Enabled
- && arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC6].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC6]);
- }
- else if (arrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX]);
- }
-
- /* 7 */
- if (ctx->VertexProgram._Enabled
- && arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC7].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC7]);
- }
-
- /* 8..15 */
- for (i = 0; i < VERT_ATTRIB_TEX_MAX; i++) {
- if (ctx->VertexProgram._Enabled
- && arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC8 + i].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC8 + i]);
- }
- else if (i < ctx->Const.MaxTextureCoordUnits
- && arrayObj->VertexAttrib[VERT_ATTRIB_TEX(i)].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_TEX(i)]);
- }
- }
-
- /* 16..31 */
- if (ctx->VertexProgram._Current) {
- for (i = 0; i < VERT_ATTRIB_GENERIC_MAX; i++) {
- if (arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(i)].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(i)]);
- }
- }
- }
-
- if (arrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG]);
- }
-
- /* _MaxElement is one past the last legal array element */
- arrayObj->_MaxElement = min;
-}
-
-
-/**
* Update the following fields:
* ctx->VertexProgram._Enabled
* ctx->FragmentProgram._Enabled
@@ -690,7 +566,7 @@ _mesa_update_state_locked( struct gl_context *ctx )
}
if (new_state & (_NEW_ARRAY | _NEW_PROGRAM | _NEW_BUFFER_OBJECT))
- update_arrays( ctx );
+ _mesa_update_array_object_max_element(ctx, ctx->Array.ArrayObj);
out:
new_prog_state |= update_program_constants(ctx);
diff --git a/mesalib/src/mesa/main/texformat.c b/mesalib/src/mesa/main/texformat.c
index 7e60541c3..259eb9044 100644
--- a/mesalib/src/mesa/main/texformat.c
+++ b/mesalib/src/mesa/main/texformat.c
@@ -323,6 +323,7 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
case GL_ALPHA16F_ARB:
RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT16);
RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
break;
case GL_ALPHA32F_ARB:
@@ -334,6 +335,7 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
case GL_LUMINANCE16F_ARB:
RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT16);
RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
break;
case GL_LUMINANCE32F_ARB:
@@ -345,6 +347,7 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
case GL_LUMINANCE_ALPHA16F_ARB:
RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16);
RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
break;
case GL_LUMINANCE_ALPHA32F_ARB:
@@ -356,6 +359,7 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
case GL_INTENSITY16F_ARB:
RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT16);
RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
break;
case GL_INTENSITY32F_ARB:
@@ -786,21 +790,31 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
switch (internalFormat) {
case GL_R16F:
RETURN_IF_SUPPORTED(MESA_FORMAT_R_FLOAT16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT16);
RETURN_IF_SUPPORTED(MESA_FORMAT_R_FLOAT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
break;
case GL_R32F:
RETURN_IF_SUPPORTED(MESA_FORMAT_R_FLOAT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT32);
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_R_FLOAT16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
break;
case GL_RG16F:
RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT16);
RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
break;
case GL_RG32F:
RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT32);
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
break;
default:
diff --git a/mesalib/src/mesa/main/texgetimage.c b/mesalib/src/mesa/main/texgetimage.c
index f848aa89d..8c85c1e54 100644
--- a/mesalib/src/mesa/main/texgetimage.c
+++ b/mesalib/src/mesa/main/texgetimage.c
@@ -837,6 +837,9 @@ _mesa_GetnTexImageARB( GLenum target, GLint level, GLenum format,
texObj = _mesa_get_current_tex_object(ctx, target);
texImage = _mesa_select_tex_image(ctx, texObj, target, level);
+ if (_mesa_is_zero_size_texture(texImage))
+ return;
+
if (MESA_VERBOSE & (VERBOSE_API | VERBOSE_TEXTURE)) {
_mesa_debug(ctx, "glGetTexImage(tex %u) format = %s, w=%d, h=%d,"
" dstFmt=0x%x, dstType=0x%x\n",
@@ -970,6 +973,9 @@ _mesa_GetnCompressedTexImageARB(GLenum target, GLint level, GLsizei bufSize,
texObj = _mesa_get_current_tex_object(ctx, target);
texImage = _mesa_select_tex_image(ctx, texObj, target, level);
+ if (_mesa_is_zero_size_texture(texImage))
+ return;
+
if (MESA_VERBOSE & (VERBOSE_API | VERBOSE_TEXTURE)) {
_mesa_debug(ctx,
"glGetCompressedTexImage(tex %u) format = %s, w=%d, h=%d\n",
diff --git a/mesalib/src/mesa/main/teximage.h b/mesalib/src/mesa/main/teximage.h
index 12af0e6d6..e2bdaca01 100644
--- a/mesalib/src/mesa/main/teximage.h
+++ b/mesalib/src/mesa/main/teximage.h
@@ -44,7 +44,14 @@ _mesa_is_cube_face(GLenum target)
target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB);
}
-
+/** Is any of the dimensions of given texture equal to zero? */
+static inline GLboolean
+_mesa_is_zero_size_texture(const struct gl_texture_image *texImage)
+{
+ return (texImage->Width == 0 ||
+ texImage->Height == 0 ||
+ texImage->Depth == 0);
+}
/** \name Internal functions */
/*@{*/
diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c
index a9c64cede..600dab302 100644
--- a/mesalib/src/mesa/main/texstore.c
+++ b/mesalib/src/mesa/main/texstore.c
@@ -4404,7 +4404,7 @@ get_read_write_mode(GLenum userFormat, gl_format texFormat)
&& _mesa_get_format_base_format(texFormat) == GL_DEPTH_STENCIL)
return GL_MAP_READ_BIT | GL_MAP_WRITE_BIT;
else
- return GL_MAP_WRITE_BIT;
+ return GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_RANGE_BIT;
}
@@ -4805,7 +4805,7 @@ _mesa_store_compressed_texsubimage2d(struct gl_context *ctx,
/* Map dest texture buffer */
ctx->Driver.MapTextureImage(ctx, texImage, 0,
xoffset, yoffset, width, height,
- GL_MAP_WRITE_BIT,
+ GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_RANGE_BIT,
&dstMap, &dstRowStride);
if (dstMap) {
diff --git a/mesalib/src/mesa/main/varray.c b/mesalib/src/mesa/main/varray.c
index 540e8963c..9078d1161 100644
--- a/mesalib/src/mesa/main/varray.c
+++ b/mesalib/src/mesa/main/varray.c
@@ -555,7 +555,7 @@ get_vertex_array_attrib(struct gl_context *ctx, GLuint index, GLenum pname,
case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB:
return array->BufferObj->Name;
case GL_VERTEX_ATTRIB_ARRAY_INTEGER:
- if (ctx->Extensions.EXT_gpu_shader4) {
+ if (ctx->VersionMajor >= 3 || ctx->Extensions.EXT_gpu_shader4) {
return array->Integer;
}
goto error;