aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-01-25 08:24:51 +0100
committermarha <marha@users.sourceforge.net>2012-01-25 08:24:51 +0100
commite6432710d8a586386b3c7025e845cf4f80830da3 (patch)
treea403fa86779a287c97f5605f9b4d455d662ece66 /mesalib/src/mesa/main
parentd3f0fe49b8cb29295f3e529cc699a2abde1515a1 (diff)
downloadvcxsrv-e6432710d8a586386b3c7025e845cf4f80830da3.tar.gz
vcxsrv-e6432710d8a586386b3c7025e845cf4f80830da3.tar.bz2
vcxsrv-e6432710d8a586386b3c7025e845cf4f80830da3.zip
mesa git update 25 jan 2012
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r--mesalib/src/mesa/main/arrayobj.c16
-rw-r--r--mesalib/src/mesa/main/attrib.c55
-rw-r--r--mesalib/src/mesa/main/dd.h40
-rw-r--r--mesalib/src/mesa/main/image.c12
-rw-r--r--mesalib/src/mesa/main/imports.c2
-rw-r--r--mesalib/src/mesa/main/mtypes.h86
-rw-r--r--mesalib/src/mesa/main/pack.c112
-rw-r--r--mesalib/src/mesa/main/pack_tmp.h115
-rw-r--r--mesalib/src/mesa/main/renderbuffer.c30
-rw-r--r--mesalib/src/mesa/main/state.c9
-rw-r--r--mesalib/src/mesa/main/texcompress.c2
-rw-r--r--mesalib/src/mesa/main/texcompress_etc.c2
-rw-r--r--mesalib/src/mesa/main/texcompress_fxt1.c4
-rw-r--r--mesalib/src/mesa/main/texcompress_rgtc.c24
-rw-r--r--mesalib/src/mesa/main/texcompress_s3tc.c8
-rw-r--r--mesalib/src/mesa/main/texgetimage.c127
-rw-r--r--mesalib/src/mesa/main/teximage.c39
-rw-r--r--mesalib/src/mesa/main/varray.c2
18 files changed, 431 insertions, 254 deletions
diff --git a/mesalib/src/mesa/main/arrayobj.c b/mesalib/src/mesa/main/arrayobj.c
index 328774543..d9ae187bb 100644
--- a/mesalib/src/mesa/main/arrayobj.c
+++ b/mesalib/src/mesa/main/arrayobj.c
@@ -372,6 +372,14 @@ bind_vertex_array(struct gl_context *ctx, GLuint id, GLboolean genRequired)
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindVertexArrayAPPLE");
return;
}
+
+ /* The "Interactions with APPLE_vertex_array_object" section of the
+ * GL_ARB_vertex_array_object spec says:
+ *
+ * "The first bind call, either BindVertexArray or
+ * BindVertexArrayAPPLE, determines the semantic of the object."
+ */
+ newObj->ARBsemantics = genRequired;
save_array_object(ctx, newObj);
}
}
@@ -468,8 +476,7 @@ _mesa_DeleteVertexArraysAPPLE(GLsizei n, const GLuint *ids)
* \param vboOnly Will arrays have to reside in VBOs?
*/
static void
-gen_vertex_arrays(struct gl_context *ctx, GLsizei n, GLuint *arrays,
- GLboolean vboOnly)
+gen_vertex_arrays(struct gl_context *ctx, GLsizei n, GLuint *arrays)
{
GLuint first;
GLint i;
@@ -496,7 +503,6 @@ gen_vertex_arrays(struct gl_context *ctx, GLsizei n, GLuint *arrays,
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenVertexArraysAPPLE");
return;
}
- obj->VBOonly = vboOnly;
save_array_object(ctx, obj);
arrays[i] = first + i;
}
@@ -511,7 +517,7 @@ void GLAPIENTRY
_mesa_GenVertexArrays(GLsizei n, GLuint *arrays)
{
GET_CURRENT_CONTEXT(ctx);
- gen_vertex_arrays(ctx, n, arrays, GL_TRUE);
+ gen_vertex_arrays(ctx, n, arrays);
}
@@ -523,7 +529,7 @@ void GLAPIENTRY
_mesa_GenVertexArraysAPPLE(GLsizei n, GLuint *arrays)
{
GET_CURRENT_CONTEXT(ctx);
- gen_vertex_arrays(ctx, n, arrays, GL_FALSE);
+ gen_vertex_arrays(ctx, n, arrays);
}
diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c
index 1c1ee5dde..01e79455c 100644
--- a/mesalib/src/mesa/main/attrib.c
+++ b/mesalib/src/mesa/main/attrib.c
@@ -58,6 +58,8 @@
#include "viewport.h"
#include "mtypes.h"
#include "main/dispatch.h"
+#include "hash.h"
+#include <stdbool.h>
/**
@@ -1320,7 +1322,7 @@ copy_array_object(struct gl_context *ctx,
/* skip RefCount */
/* In theory must be the same anyway, but on recreate make sure it matches */
- dest->VBOonly = src->VBOonly;
+ dest->ARBsemantics = src->ARBsemantics;
for (i = 0; i < Elements(src->VertexAttrib); i++)
_mesa_copy_client_array(ctx, &dest->VertexAttrib[i], &src->VertexAttrib[i]);
@@ -1337,7 +1339,8 @@ copy_array_object(struct gl_context *ctx,
static void
copy_array_attrib(struct gl_context *ctx,
struct gl_array_attrib *dest,
- struct gl_array_attrib *src)
+ struct gl_array_attrib *src,
+ bool vbo_deleted)
{
/* skip ArrayObj */
/* skip DefaultArrayObj, Objects */
@@ -1349,7 +1352,8 @@ copy_array_attrib(struct gl_context *ctx,
/* skip NewState */
/* skip RebindArrays */
- copy_array_object(ctx, dest->ArrayObj, src->ArrayObj);
+ if (!vbo_deleted)
+ copy_array_object(ctx, dest->ArrayObj, src->ArrayObj);
/* skip ArrayBufferObj */
/* skip ElementArrayBufferObj */
@@ -1367,7 +1371,7 @@ save_array_attrib(struct gl_context *ctx,
* Needs to match value in the object hash. */
dest->ArrayObj->Name = src->ArrayObj->Name;
/* And copy all of the rest. */
- copy_array_attrib(ctx, dest, src);
+ copy_array_attrib(ctx, dest, src, false);
/* Just reference them here */
_mesa_reference_buffer_object(ctx, &dest->ArrayBufferObj,
@@ -1384,17 +1388,44 @@ restore_array_attrib(struct gl_context *ctx,
struct gl_array_attrib *dest,
struct gl_array_attrib *src)
{
- /* Restore or recreate the array object by its name ... */
- _mesa_BindVertexArrayAPPLE(src->ArrayObj->Name);
+ /* The ARB_vertex_array_object spec says:
+ *
+ * "BindVertexArray fails and an INVALID_OPERATION error is generated
+ * if array is not a name returned from a previous call to
+ * GenVertexArrays, or if such a name has since been deleted with
+ * DeleteVertexArrays."
+ *
+ * Therefore popping a deleted VAO cannot magically recreate it.
+ *
+ * The semantics of objects created using APPLE_vertex_array_objects behave
+ * differently. These objects expect to be recreated by pop. Alas.
+ */
+ const bool arb_vao = (src->ArrayObj->Name != 0
+ && src->ArrayObj->ARBsemantics);
+
+ if (arb_vao && !_mesa_IsVertexArrayAPPLE(src->ArrayObj->Name))
+ return;
- /* ... and restore its content */
- copy_array_attrib(ctx, dest, src);
+ _mesa_BindVertexArrayAPPLE(src->ArrayObj->Name);
/* Restore or recreate the buffer objects by the names ... */
- _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB,
- src->ArrayBufferObj->Name);
- _mesa_BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB,
- src->ArrayObj->ElementArrayBufferObj->Name);
+ if (!arb_vao
+ || src->ArrayBufferObj->Name == 0
+ || _mesa_IsBufferARB(src->ArrayBufferObj->Name)) {
+ /* ... and restore its content */
+ copy_array_attrib(ctx, dest, src, false);
+
+ _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB,
+ src->ArrayBufferObj->Name);
+ } else {
+ copy_array_attrib(ctx, dest, src, true);
+ }
+
+ if (!arb_vao
+ || src->ArrayObj->ElementArrayBufferObj->Name == 0
+ || _mesa_IsBufferARB(src->ArrayObj->ElementArrayBufferObj->Name))
+ _mesa_BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB,
+ src->ArrayObj->ElementArrayBufferObj->Name);
/* Better safe than sorry?! */
dest->RebindArrays = GL_TRUE;
diff --git a/mesalib/src/mesa/main/dd.h b/mesalib/src/mesa/main/dd.h
index 8393f328f..96311131a 100644
--- a/mesalib/src/mesa/main/dd.h
+++ b/mesalib/src/mesa/main/dd.h
@@ -398,18 +398,16 @@ struct dd_function_table {
GLenum format,
GLsizei imageSize, const GLvoid *data);
-
/**
* Called by glGetCompressedTexImage.
*/
void (*GetCompressedTexImage)(struct gl_context *ctx,
struct gl_texture_image *texImage,
GLvoid *data);
-
/*@}*/
/**
- * \name Texture object functions
+ * \name Texture object / image functions
*/
/*@{*/
@@ -420,24 +418,20 @@ struct dd_function_table {
struct gl_texture_object *tObj );
/**
- * Called to allocate a new texture object.
- * A new gl_texture_object should be returned. The driver should
- * attach to it any device-specific info it needs.
+ * Called to allocate a new texture object. Drivers will usually
+ * allocate/return a subclass of gl_texture_object.
*/
- struct gl_texture_object * (*NewTextureObject)( struct gl_context *ctx, GLuint name,
- GLenum target );
+ struct gl_texture_object * (*NewTextureObject)(struct gl_context *ctx,
+ GLuint name, GLenum target);
/**
- * Called when a texture object is about to be deallocated.
- *
- * Driver should delete the gl_texture_object object and anything
- * hanging off of it.
+ * Called to delete/free a texture object. Drivers should free the
+ * object and any image data it contains.
*/
- void (*DeleteTexture)( struct gl_context *ctx, struct gl_texture_object *tObj );
+ void (*DeleteTexture)(struct gl_context *ctx,
+ struct gl_texture_object *texObj);
- /**
- * Called to allocate a new texture image object.
- */
- struct gl_texture_image * (*NewTextureImage)( struct gl_context *ctx );
+ /** Called to allocate a new texture image object. */
+ struct gl_texture_image * (*NewTextureImage)(struct gl_context *ctx);
/** Called to free a texture image object returned by NewTextureImage() */
void (*DeleteTextureImage)(struct gl_context *ctx,
@@ -449,10 +443,9 @@ struct dd_function_table {
gl_format format, GLsizei width,
GLsizei height, GLsizei depth);
- /**
- * Called to free tImage->Data.
- */
- void (*FreeTextureImageBuffer)( struct gl_context *ctx, struct gl_texture_image *tImage );
+ /** Free the memory for a single texture image */
+ void (*FreeTextureImageBuffer)(struct gl_context *ctx,
+ struct gl_texture_image *texImage);
/** Map a slice of a texture image into user space.
* Note: for GL_TEXTURE_1D_ARRAY, height must be 1, y must be 0 and slice
@@ -476,11 +469,6 @@ struct dd_function_table {
struct gl_texture_image *texImage,
GLuint slice);
- /** Map texture image data into user space */
- void (*MapTexture)( struct gl_context *ctx, struct gl_texture_object *tObj );
- /** Unmap texture images from user space */
- void (*UnmapTexture)( struct gl_context *ctx, struct gl_texture_object *tObj );
-
/** For GL_ARB_texture_storage. Allocate memory for whole mipmap stack.
* All the gl_texture_images in the texture object will have their
* dimensions, format, etc. initialized already.
diff --git a/mesalib/src/mesa/main/image.c b/mesalib/src/mesa/main/image.c
index b37cd7e7d..8b65cf0f0 100644
--- a/mesalib/src/mesa/main/image.c
+++ b/mesalib/src/mesa/main/image.c
@@ -759,36 +759,48 @@ _mesa_is_color_format(GLenum format)
/* sized integer formats */
case GL_RGBA32UI_EXT:
case GL_RGB32UI_EXT:
+ case GL_RG32UI:
+ case GL_R32UI:
case GL_ALPHA32UI_EXT:
case GL_INTENSITY32UI_EXT:
case GL_LUMINANCE32UI_EXT:
case GL_LUMINANCE_ALPHA32UI_EXT:
case GL_RGBA16UI_EXT:
case GL_RGB16UI_EXT:
+ case GL_RG16UI:
+ case GL_R16UI:
case GL_ALPHA16UI_EXT:
case GL_INTENSITY16UI_EXT:
case GL_LUMINANCE16UI_EXT:
case GL_LUMINANCE_ALPHA16UI_EXT:
case GL_RGBA8UI_EXT:
case GL_RGB8UI_EXT:
+ case GL_RG8UI:
+ case GL_R8UI:
case GL_ALPHA8UI_EXT:
case GL_INTENSITY8UI_EXT:
case GL_LUMINANCE8UI_EXT:
case GL_LUMINANCE_ALPHA8UI_EXT:
case GL_RGBA32I_EXT:
case GL_RGB32I_EXT:
+ case GL_RG32I:
+ case GL_R32I:
case GL_ALPHA32I_EXT:
case GL_INTENSITY32I_EXT:
case GL_LUMINANCE32I_EXT:
case GL_LUMINANCE_ALPHA32I_EXT:
case GL_RGBA16I_EXT:
case GL_RGB16I_EXT:
+ case GL_RG16I:
+ case GL_R16I:
case GL_ALPHA16I_EXT:
case GL_INTENSITY16I_EXT:
case GL_LUMINANCE16I_EXT:
case GL_LUMINANCE_ALPHA16I_EXT:
case GL_RGBA8I_EXT:
case GL_RGB8I_EXT:
+ case GL_RG8I:
+ case GL_R8I:
case GL_ALPHA8I_EXT:
case GL_INTENSITY8I_EXT:
case GL_LUMINANCE8I_EXT:
diff --git a/mesalib/src/mesa/main/imports.c b/mesalib/src/mesa/main/imports.c
index bbc6ac6e2..82713a13b 100644
--- a/mesalib/src/mesa/main/imports.c
+++ b/mesalib/src/mesa/main/imports.c
@@ -764,7 +764,7 @@ float
_mesa_strtof( const char *s, char **end )
{
#if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) && \
- !defined(ANDROID)
+ !defined(ANDROID) && !defined(__HAIKU__)
static locale_t loc = NULL;
if (!loc) {
loc = newlocale(LC_CTYPE_MASK, "C", NULL);
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 2ff608596..760113172 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -1614,7 +1614,22 @@ struct gl_array_object
GLint RefCount;
_glthread_Mutex Mutex;
- GLboolean VBOonly; /**< require all arrays to live in VBOs? */
+
+ /**
+ * Does the VAO use ARB semantics or Apple semantics?
+ *
+ * There are several ways in which ARB_vertex_array_object and
+ * APPLE_vertex_array_object VAOs have differing semantics. At the very
+ * least,
+ *
+ * - ARB VAOs require that all array data be sourced from vertex buffer
+ * objects, but Apple VAOs do not.
+ *
+ * - ARB VAOs require that names come from GenVertexArrays.
+ *
+ * This flag notes which behavior governs this VAO.
+ */
+ GLboolean ARBsemantics;
/** Vertex attribute arrays */
struct gl_client_array VertexAttrib[VERT_ATTRIB_MAX];
@@ -2515,85 +2530,34 @@ struct gl_shared_state
-
/**
- * A renderbuffer stores colors or depth values or stencil values.
- * A framebuffer object will have a collection of these.
- * Data are read/written to the buffer with a handful of Get/Put functions.
- *
- * Instances of this object are allocated with the Driver's NewRenderbuffer
- * hook. Drivers will likely wrap this class inside a driver-specific
- * class to simulate inheritance.
+ * Renderbuffers represent drawing surfaces such as color, depth and/or
+ * stencil. A framebuffer object has a set of renderbuffers.
+ * Drivers will typically derive subclasses of this type.
*/
struct gl_renderbuffer
{
- _glthread_Mutex Mutex; /**< for thread safety */
+ _glthread_Mutex Mutex; /**< for thread safety */
GLuint ClassID; /**< Useful for drivers */
GLuint Name;
GLint RefCount;
GLuint Width, Height;
- GLint RowStride; /**< Padded width in units of pixels */
- GLboolean Purgeable; /**< Is the buffer purgeable under memory pressure? */
-
+ GLboolean Purgeable; /**< Is the buffer purgeable under memory pressure? */
GLboolean AttachedAnytime; /**< TRUE if it was attached to a framebuffer */
-
GLubyte NumSamples;
-
GLenum InternalFormat; /**< The user-specified format */
GLenum _BaseFormat; /**< Either GL_RGB, GL_RGBA, GL_DEPTH_COMPONENT or
GL_STENCIL_INDEX. */
gl_format Format; /**< The actual renderbuffer memory format */
- GLenum DataType; /**< Type of values passed to the Get/Put functions */
- GLvoid *Data; /**< This may not be used by some kinds of RBs */
-
- /* Used to wrap one renderbuffer around another: */
- struct gl_renderbuffer *Wrapped;
-
- /* Delete this renderbuffer */
+ /** Delete this renderbuffer */
void (*Delete)(struct gl_renderbuffer *rb);
- /* Allocate new storage for this renderbuffer */
- GLboolean (*AllocStorage)(struct gl_context *ctx, struct gl_renderbuffer *rb,
+ /** Allocate new storage for this renderbuffer */
+ GLboolean (*AllocStorage)(struct gl_context *ctx,
+ struct gl_renderbuffer *rb,
GLenum internalFormat,
GLuint width, GLuint height);
-
- /* Lock/Unlock are called before/after calling the Get/Put functions.
- * Not sure this is the right place for these yet.
- void (*Lock)(struct gl_context *ctx, struct gl_renderbuffer *rb);
- void (*Unlock)(struct gl_context *ctx, struct gl_renderbuffer *rb);
- */
-
- /* Return a pointer to the element/pixel at (x,y).
- * Should return NULL if the buffer memory can't be directly addressed.
- */
- void *(*GetPointer)(struct gl_context *ctx, struct gl_renderbuffer *rb,
- GLint x, GLint y);
-
- /* Get/Read a row of values.
- * The values will be of format _BaseFormat and type DataType.
- */
- void (*GetRow)(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- GLint x, GLint y, void *values);
-
- /* Get/Read values at arbitrary locations.
- * The values will be of format _BaseFormat and type DataType.
- */
- void (*GetValues)(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- const GLint x[], const GLint y[], void *values);
-
- /* Put/Write a row of values.
- * The values will be of format _BaseFormat and type DataType.
- */
- void (*PutRow)(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- GLint x, GLint y, const void *values, const GLubyte *mask);
-
- /* Put/Write values at arbitrary locations.
- * The values will be of format _BaseFormat and type DataType.
- */
- void (*PutValues)(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- const GLint x[], const GLint y[], const void *values,
- const GLubyte *mask);
};
diff --git a/mesalib/src/mesa/main/pack.c b/mesalib/src/mesa/main/pack.c
index 8f2c8fd97..f874ab21a 100644
--- a/mesalib/src/mesa/main/pack.c
+++ b/mesalib/src/mesa/main/pack.c
@@ -448,65 +448,75 @@ get_type_min_max(GLenum type, GLfloat *min, GLfloat *max)
}
}
-/*
- * integer packing , no transfer operations only packs
- * to dst of GL_UNSIGNED_INT or GL_INT
+/* Customization of integer packing. We always treat src as uint, and can pack dst
+ * as any integer type/format combo.
*/
+#define SRC_TYPE GLuint
+
+#define DST_TYPE GLuint
+#define SRC_CONVERT(x) (x)
+#define FN_NAME pack_uint_from_uint_rgba
+#include "pack_tmp.h"
+#undef DST_TYPE
+#undef SRC_CONVERT
+#undef FN_NAME
+
+#define DST_TYPE GLushort
+#define SRC_CONVERT(x) (x)
+#define FN_NAME pack_ushort_from_uint_rgba
+#include "pack_tmp.h"
+#undef DST_TYPE
+#undef SRC_CONVERT
+#undef FN_NAME
+
+#define DST_TYPE GLshort
+#define SRC_CONVERT(x) (x)
+#define FN_NAME pack_short_from_uint_rgba
+#include "pack_tmp.h"
+#undef DST_TYPE
+#undef SRC_CONVERT
+#undef FN_NAME
+
+#define DST_TYPE GLubyte
+#define SRC_CONVERT(x) (x)
+#define FN_NAME pack_ubyte_from_uint_rgba
+#include "pack_tmp.h"
+#undef DST_TYPE
+#undef SRC_CONVERT
+#undef FN_NAME
+
+#define DST_TYPE GLbyte
+#define SRC_CONVERT(x) (x)
+#define FN_NAME pack_byte_from_uint_rgba
+#include "pack_tmp.h"
+#undef DST_TYPE
+#undef SRC_CONVERT
+#undef FN_NAME
+
void
_mesa_pack_rgba_span_int(struct gl_context *ctx, GLuint n, GLuint rgba[][4],
GLenum dstFormat, GLenum dstType,
GLvoid *dstAddr)
{
- int i;
-
switch(dstType) {
- case GL_UNSIGNED_INT: {
- GLuint *dst = (GLuint *) dstAddr;
- switch (dstFormat) {
- case GL_RED_INTEGER_EXT:
- case GL_GREEN_INTEGER_EXT:
- case GL_BLUE_INTEGER_EXT:
- case GL_ALPHA_INTEGER_EXT:
- case GL_RG_INTEGER:
- case GL_RGB_INTEGER_EXT:
- case GL_RGBA_INTEGER_EXT:
- case GL_BGR_INTEGER_EXT:
- case GL_BGRA_INTEGER_EXT:
- case GL_LUMINANCE_INTEGER_EXT:
- case GL_LUMINANCE_ALPHA_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i*4+0] = (GLuint) rgba[i][RCOMP];
- dst[i*4+1] = (GLuint) rgba[i][GCOMP];
- dst[i*4+2] = (GLuint) rgba[i][BCOMP];
- dst[i*4+3] = (GLuint) rgba[i][ACOMP];
- }
- break;
- }
- }
+ case GL_UNSIGNED_INT:
+ pack_uint_from_uint_rgba(dstAddr, dstFormat, rgba, n);
break;
- case GL_INT: {
- GLint *dst = (GLint *) dstAddr;
- switch (dstFormat) {
- case GL_RED_INTEGER_EXT:
- case GL_GREEN_INTEGER_EXT:
- case GL_BLUE_INTEGER_EXT:
- case GL_ALPHA_INTEGER_EXT:
- case GL_RG_INTEGER:
- case GL_RGB_INTEGER_EXT:
- case GL_RGBA_INTEGER_EXT:
- case GL_BGR_INTEGER_EXT:
- case GL_BGRA_INTEGER_EXT:
- case GL_LUMINANCE_INTEGER_EXT:
- case GL_LUMINANCE_ALPHA_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i*4+0] = (GLint) rgba[i][RCOMP];
- dst[i*4+1] = (GLint) rgba[i][GCOMP];
- dst[i*4+2] = (GLint) rgba[i][BCOMP];
- dst[i*4+3] = (GLint) rgba[i][ACOMP];
- }
- break;
- }
- }
+ case GL_INT:
+ /* No conversion necessary. */
+ pack_uint_from_uint_rgba(dstAddr, dstFormat, rgba, n);
+ break;
+ case GL_UNSIGNED_SHORT:
+ pack_ushort_from_uint_rgba(dstAddr, dstFormat, rgba, n);
+ break;
+ case GL_SHORT:
+ pack_short_from_uint_rgba(dstAddr, dstFormat, rgba, n);
+ break;
+ case GL_UNSIGNED_BYTE:
+ pack_ubyte_from_uint_rgba(dstAddr, dstFormat, rgba, n);
+ break;
+ case GL_BYTE:
+ pack_byte_from_uint_rgba(dstAddr, dstFormat, rgba, n);
break;
default:
assert(0);
diff --git a/mesalib/src/mesa/main/pack_tmp.h b/mesalib/src/mesa/main/pack_tmp.h
new file mode 100644
index 000000000..83b655729
--- /dev/null
+++ b/mesalib/src/mesa/main/pack_tmp.h
@@ -0,0 +1,115 @@
+/*
+ * Copyright © 2012 Intel Corporation
+ *
+ * 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 (including the next
+ * paragraph) 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
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ */
+
+static void
+FN_NAME(DST_TYPE *dst,
+ GLenum dstFormat,
+ SRC_TYPE rgba[][4],
+ int n)
+{
+ int i;
+
+ switch (dstFormat) {
+ case GL_RED_INTEGER_EXT:
+ for (i=0;i<n;i++) {
+ dst[i] = SRC_CONVERT(rgba[i][RCOMP]);
+ }
+ break;
+
+ case GL_GREEN_INTEGER_EXT:
+ for (i=0;i<n;i++) {
+ dst[i] = SRC_CONVERT(rgba[i][GCOMP]);
+ }
+ break;
+
+ case GL_BLUE_INTEGER_EXT:
+ for (i=0;i<n;i++) {
+ dst[i] = SRC_CONVERT(rgba[i][BCOMP]);
+ };
+ break;
+
+ case GL_ALPHA_INTEGER_EXT:
+ for (i=0;i<n;i++) {
+ dst[i] = SRC_CONVERT(rgba[i][ACOMP]);
+ }
+ break;
+
+ case GL_RG_INTEGER:
+ for (i=0;i<n;i++) {
+ dst[i*2+0] = SRC_CONVERT(rgba[i][RCOMP]);
+ dst[i*2+1] = SRC_CONVERT(rgba[i][GCOMP]);
+ }
+ break;
+
+ case GL_RGB_INTEGER_EXT:
+ for (i=0;i<n;i++) {
+ dst[i*3+0] = SRC_CONVERT(rgba[i][RCOMP]);
+ dst[i*3+1] = SRC_CONVERT(rgba[i][GCOMP]);
+ dst[i*3+2] = SRC_CONVERT(rgba[i][BCOMP]);
+ }
+ break;
+
+ case GL_RGBA_INTEGER_EXT:
+ for (i=0;i<n;i++) {
+ dst[i*4+0] = SRC_CONVERT(rgba[i][RCOMP]);
+ dst[i*4+1] = SRC_CONVERT(rgba[i][GCOMP]);
+ dst[i*4+2] = SRC_CONVERT(rgba[i][BCOMP]);
+ dst[i*4+3] = SRC_CONVERT(rgba[i][ACOMP]);
+ }
+ break;
+
+ case GL_BGR_INTEGER_EXT:
+ for (i=0;i<n;i++) {
+ dst[i*3+0] = SRC_CONVERT(rgba[i][BCOMP]);
+ dst[i*3+1] = SRC_CONVERT(rgba[i][GCOMP]);
+ dst[i*3+2] = SRC_CONVERT(rgba[i][RCOMP]);
+ }
+ break;
+
+ case GL_BGRA_INTEGER_EXT:
+ for (i=0;i<n;i++) {
+ dst[i*4+0] = SRC_CONVERT(rgba[i][BCOMP]);
+ dst[i*4+1] = SRC_CONVERT(rgba[i][GCOMP]);
+ dst[i*4+2] = SRC_CONVERT(rgba[i][RCOMP]);
+ dst[i*4+3] = SRC_CONVERT(rgba[i][ACOMP]);
+ }
+ break;
+
+ case GL_LUMINANCE_INTEGER_EXT:
+ for (i=0;i<n;i++) {
+ dst[i] = SRC_CONVERT(rgba[i][RCOMP] +
+ rgba[i][GCOMP] +
+ rgba[i][BCOMP]);
+ }
+ break;
+
+ case GL_LUMINANCE_ALPHA_INTEGER_EXT:
+ for (i=0;i<n;i++) {
+ dst[i*2+0] = SRC_CONVERT(rgba[i][RCOMP] +
+ rgba[i][GCOMP] +
+ rgba[i][BCOMP]);
+ dst[i*2+1] = SRC_CONVERT(rgba[i][ACOMP]);
+ }
+ break;
+ }
+}
diff --git a/mesalib/src/mesa/main/renderbuffer.c b/mesalib/src/mesa/main/renderbuffer.c
index 08e694673..1bb09bfe6 100644
--- a/mesalib/src/mesa/main/renderbuffer.c
+++ b/mesalib/src/mesa/main/renderbuffer.c
@@ -33,17 +33,6 @@
/**
- * Default GetPointer routine. Always return NULL to indicate that
- * direct buffer access is not supported.
- */
-static void *
-nop_get_pointer(struct gl_context *ctx, struct gl_renderbuffer *rb, GLint x, GLint y)
-{
- return NULL;
-}
-
-
-/**
* Initialize the fields of a gl_renderbuffer to default values.
*/
void
@@ -65,20 +54,6 @@ _mesa_init_renderbuffer(struct gl_renderbuffer *rb, GLuint name)
rb->Height = 0;
rb->InternalFormat = GL_RGBA;
rb->Format = MESA_FORMAT_NONE;
-
- rb->DataType = GL_NONE;
- rb->Data = NULL;
-
- /* Point back to ourself so that we don't have to check for Wrapped==NULL
- * all over the drivers.
- */
- rb->Wrapped = rb;
-
- rb->GetPointer = nop_get_pointer;
- rb->GetRow = NULL;
- rb->GetValues = NULL;
- rb->PutRow = NULL;
- rb->PutValues = NULL;
}
@@ -104,10 +79,7 @@ _mesa_new_renderbuffer(struct gl_context *ctx, GLuint name)
void
_mesa_delete_renderbuffer(struct gl_renderbuffer *rb)
{
- if (rb->Data) {
- free(rb->Data);
- }
- free(rb);
+ /* no-op */
}
diff --git a/mesalib/src/mesa/main/state.c b/mesalib/src/mesa/main/state.c
index 39d7294f7..20fd17d06 100644
--- a/mesalib/src/mesa/main/state.c
+++ b/mesalib/src/mesa/main/state.c
@@ -136,6 +136,8 @@ update_program(struct gl_context *ctx)
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current,
(struct gl_fragment_program *)
fsProg->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program);
+ _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram,
+ NULL);
}
else if (ctx->FragmentProgram._Enabled) {
/* Use user-defined fragment program */
@@ -144,6 +146,8 @@ update_program(struct gl_context *ctx)
NULL);
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current,
ctx->FragmentProgram.Current);
+ _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram,
+ NULL);
}
else if (ctx->FragmentProgram._MaintainTexEnvProgram) {
/* Use fragment program generated from fixed-function state */
@@ -155,10 +159,15 @@ update_program(struct gl_context *ctx)
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current,
(struct gl_fragment_program *)
f->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program);
+ _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram,
+ (struct gl_fragment_program *)
+ f->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program);
}
else {
/* No fragment program */
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL);
+ _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram,
+ NULL);
}
if (gsProg && gsProg->LinkStatus
diff --git a/mesalib/src/mesa/main/texcompress.c b/mesalib/src/mesa/main/texcompress.c
index 5045aef06..44590ea96 100644
--- a/mesalib/src/mesa/main/texcompress.c
+++ b/mesalib/src/mesa/main/texcompress.c
@@ -478,7 +478,7 @@ _mesa_decompress_image(gl_format format, GLuint width, GLuint height,
/* setup dummy texture image info */
memset(&texImage, 0, sizeof(texImage));
- texImage.Data = (void *) src;
+ texImage.Map = (void *) src;
texImage.RowStride = srcRowStride;
switch (format) {
diff --git a/mesalib/src/mesa/main/texcompress_etc.c b/mesalib/src/mesa/main/texcompress_etc.c
index 4d3b857cf..5b331a92a 100644
--- a/mesalib/src/mesa/main/texcompress_etc.c
+++ b/mesalib/src/mesa/main/texcompress_etc.c
@@ -58,7 +58,7 @@ _mesa_fetch_texel_2d_f_etc1_rgb8(const struct swrast_texture_image *texImage,
GLubyte dst[3];
const GLubyte *src;
- src = (const GLubyte *) texImage->Data +
+ src = (const GLubyte *) texImage->Map +
(((texImage->RowStride + 3) / 4) * (j / 4) + (i / 4)) * 8;
etc1_parse_block(&block, src);
diff --git a/mesalib/src/mesa/main/texcompress_fxt1.c b/mesalib/src/mesa/main/texcompress_fxt1.c
index 2480ffb38..eafa18794 100644
--- a/mesalib/src/mesa/main/texcompress_fxt1.c
+++ b/mesalib/src/mesa/main/texcompress_fxt1.c
@@ -163,7 +163,7 @@ _mesa_fetch_texel_2d_f_rgba_fxt1( const struct swrast_texture_image *texImage,
/* just sample as GLubyte and convert to float here */
GLubyte rgba[4];
(void) k;
- fxt1_decode_1(texImage->Data, texImage->RowStride, i, j, rgba);
+ fxt1_decode_1(texImage->Map, texImage->RowStride, i, j, rgba);
texel[RCOMP] = UBYTE_TO_FLOAT(rgba[RCOMP]);
texel[GCOMP] = UBYTE_TO_FLOAT(rgba[GCOMP]);
texel[BCOMP] = UBYTE_TO_FLOAT(rgba[BCOMP]);
@@ -178,7 +178,7 @@ _mesa_fetch_texel_2d_f_rgb_fxt1( const struct swrast_texture_image *texImage,
/* just sample as GLubyte and convert to float here */
GLubyte rgba[4];
(void) k;
- fxt1_decode_1(texImage->Data, texImage->RowStride, i, j, rgba);
+ fxt1_decode_1(texImage->Map, texImage->RowStride, i, j, rgba);
texel[RCOMP] = UBYTE_TO_FLOAT(rgba[RCOMP]);
texel[GCOMP] = UBYTE_TO_FLOAT(rgba[GCOMP]);
texel[BCOMP] = UBYTE_TO_FLOAT(rgba[BCOMP]);
diff --git a/mesalib/src/mesa/main/texcompress_rgtc.c b/mesalib/src/mesa/main/texcompress_rgtc.c
index b8e334b45..f707a0994 100644
--- a/mesalib/src/mesa/main/texcompress_rgtc.c
+++ b/mesalib/src/mesa/main/texcompress_rgtc.c
@@ -296,7 +296,7 @@ _mesa_fetch_texel_2d_f_red_rgtc1(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
GLubyte red;
- unsigned_fetch_texel_rgtc(texImage->RowStride, texImage->Data,
+ unsigned_fetch_texel_rgtc(texImage->RowStride, texImage->Map,
i, j, &red, 1);
texel[RCOMP] = UBYTE_TO_FLOAT(red);
texel[GCOMP] = 0.0;
@@ -309,7 +309,7 @@ _mesa_fetch_texel_2d_f_signed_red_rgtc1(const struct swrast_texture_image *texIm
GLint i, GLint j, GLint k, GLfloat *texel)
{
GLbyte red;
- signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Data),
+ signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Map),
i, j, &red, 1);
texel[RCOMP] = BYTE_TO_FLOAT_TEX(red);
texel[GCOMP] = 0.0;
@@ -322,9 +322,9 @@ _mesa_fetch_texel_2d_f_rg_rgtc2(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
GLubyte red, green;
- unsigned_fetch_texel_rgtc(texImage->RowStride, texImage->Data,
+ unsigned_fetch_texel_rgtc(texImage->RowStride, texImage->Map,
i, j, &red, 2);
- unsigned_fetch_texel_rgtc(texImage->RowStride, texImage->Data + 8,
+ unsigned_fetch_texel_rgtc(texImage->RowStride, texImage->Map + 8,
i, j, &green, 2);
texel[RCOMP] = UBYTE_TO_FLOAT(red);
texel[GCOMP] = UBYTE_TO_FLOAT(green);
@@ -337,9 +337,9 @@ _mesa_fetch_texel_2d_f_signed_rg_rgtc2(const struct swrast_texture_image *texIma
GLint i, GLint j, GLint k, GLfloat *texel)
{
GLbyte red, green;
- signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Data),
+ signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Map),
i, j, &red, 2);
- signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Data) + 8,
+ signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Map) + 8,
i, j, &green, 2);
texel[RCOMP] = BYTE_TO_FLOAT_TEX(red);
texel[GCOMP] = BYTE_TO_FLOAT_TEX(green);
@@ -352,7 +352,7 @@ _mesa_fetch_texel_2d_f_l_latc1(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
GLubyte red;
- unsigned_fetch_texel_rgtc(texImage->RowStride, texImage->Data,
+ unsigned_fetch_texel_rgtc(texImage->RowStride, texImage->Map,
i, j, &red, 1);
texel[RCOMP] =
texel[GCOMP] =
@@ -365,7 +365,7 @@ _mesa_fetch_texel_2d_f_signed_l_latc1(const struct swrast_texture_image *texImag
GLint i, GLint j, GLint k, GLfloat *texel)
{
GLbyte red;
- signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Data),
+ signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Map),
i, j, &red, 1);
texel[RCOMP] =
texel[GCOMP] =
@@ -378,9 +378,9 @@ _mesa_fetch_texel_2d_f_la_latc2(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
GLubyte red, green;
- unsigned_fetch_texel_rgtc(texImage->RowStride, texImage->Data,
+ unsigned_fetch_texel_rgtc(texImage->RowStride, texImage->Map,
i, j, &red, 2);
- unsigned_fetch_texel_rgtc(texImage->RowStride, texImage->Data + 8,
+ unsigned_fetch_texel_rgtc(texImage->RowStride, texImage->Map + 8,
i, j, &green, 2);
texel[RCOMP] =
texel[GCOMP] =
@@ -393,9 +393,9 @@ _mesa_fetch_texel_2d_f_signed_la_latc2(const struct swrast_texture_image *texIma
GLint i, GLint j, GLint k, GLfloat *texel)
{
GLbyte red, green;
- signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Data),
+ signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Map),
i, j, &red, 2);
- signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Data) + 8,
+ signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Map) + 8,
i, j, &green, 2);
texel[RCOMP] =
texel[GCOMP] =
diff --git a/mesalib/src/mesa/main/texcompress_s3tc.c b/mesalib/src/mesa/main/texcompress_s3tc.c
index 995e079fd..e30890c8b 100644
--- a/mesalib/src/mesa/main/texcompress_s3tc.c
+++ b/mesalib/src/mesa/main/texcompress_s3tc.c
@@ -374,7 +374,7 @@ fetch_texel_2d_rgb_dxt1( const struct swrast_texture_image *texImage,
(void) k;
if (fetch_ext_rgb_dxt1) {
fetch_ext_rgb_dxt1(texImage->RowStride,
- texImage->Data, i, j, texel);
+ texImage->Map, i, j, texel);
}
else
_mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgb_dxt1");
@@ -402,7 +402,7 @@ fetch_texel_2d_rgba_dxt1( const struct swrast_texture_image *texImage,
(void) k;
if (fetch_ext_rgba_dxt1) {
fetch_ext_rgba_dxt1(texImage->RowStride,
- texImage->Data, i, j, texel);
+ texImage->Map, i, j, texel);
}
else
_mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgba_dxt1\n");
@@ -430,7 +430,7 @@ fetch_texel_2d_rgba_dxt3( const struct swrast_texture_image *texImage,
(void) k;
if (fetch_ext_rgba_dxt3) {
fetch_ext_rgba_dxt3(texImage->RowStride,
- texImage->Data, i, j, texel);
+ texImage->Map, i, j, texel);
}
else
_mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgba_dxt3\n");
@@ -458,7 +458,7 @@ fetch_texel_2d_rgba_dxt5( const struct swrast_texture_image *texImage,
(void) k;
if (fetch_ext_rgba_dxt5) {
fetch_ext_rgba_dxt5(texImage->RowStride,
- texImage->Data, i, j, texel);
+ texImage->Map, i, j, texel);
}
else
_mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgba_dxt5\n");
diff --git a/mesalib/src/mesa/main/texgetimage.c b/mesalib/src/mesa/main/texgetimage.c
index 8c85c1e54..818deb8e4 100644
--- a/mesalib/src/mesa/main/texgetimage.c
+++ b/mesalib/src/mesa/main/texgetimage.c
@@ -312,18 +312,26 @@ get_tex_rgba_uncompressed(struct gl_context *ctx, GLuint dimensions,
const gl_format texFormat =
_mesa_get_srgb_format_linear(texImage->TexFormat);
const GLuint width = texImage->Width;
- const GLuint height = texImage->Height;
- const GLuint depth = texImage->Depth;
+ GLuint height = texImage->Height;
+ GLuint depth = texImage->Depth;
GLuint img, row;
GLfloat (*rgba)[4];
+ GLuint (*rgba_uint)[4];
+ GLboolean is_integer = _mesa_is_format_integer_color(texImage->TexFormat);
/* Allocate buffer for one row of texels */
rgba = (GLfloat (*)[4]) malloc(4 * width * sizeof(GLfloat));
+ rgba_uint = (GLuint (*)[4]) rgba;
if (!rgba) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage()");
return;
}
+ if (texImage->TexObject->Target == GL_TEXTURE_1D_ARRAY) {
+ depth = height;
+ height = 1;
+ }
+
for (img = 0; img < depth; img++) {
GLubyte *srcMap;
GLint rowstride;
@@ -339,44 +347,83 @@ get_tex_rgba_uncompressed(struct gl_context *ctx, GLuint dimensions,
width, height, format, type,
img, row, 0);
- _mesa_unpack_rgba_row(texFormat, width, src, rgba);
-
- if (texImage->_BaseFormat == GL_ALPHA) {
- GLint col;
- for (col = 0; col < width; col++) {
- rgba[col][RCOMP] = 0.0F;
- rgba[col][GCOMP] = 0.0F;
- rgba[col][BCOMP] = 0.0F;
- }
- }
- else if (texImage->_BaseFormat == GL_LUMINANCE) {
- GLint col;
- for (col = 0; col < width; col++) {
- rgba[col][GCOMP] = 0.0F;
- rgba[col][BCOMP] = 0.0F;
- rgba[col][ACOMP] = 1.0F;
- }
- }
- else if (texImage->_BaseFormat == GL_LUMINANCE_ALPHA) {
- GLint col;
- for (col = 0; col < width; col++) {
- rgba[col][GCOMP] = 0.0F;
- rgba[col][BCOMP] = 0.0F;
- }
- }
- else if (texImage->_BaseFormat == GL_INTENSITY) {
- GLint col;
- for (col = 0; col < width; col++) {
- rgba[col][GCOMP] = 0.0F;
- rgba[col][BCOMP] = 0.0F;
- rgba[col][ACOMP] = 1.0F;
- }
- }
-
- _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba,
- format, type, dest,
- &ctx->Pack, transferOps);
- }
+ if (is_integer) {
+ _mesa_unpack_uint_rgba_row(texFormat, width, src, rgba_uint);
+
+ if (texImage->_BaseFormat == GL_ALPHA) {
+ GLuint col;
+ for (col = 0; col < width; col++) {
+ rgba_uint[col][RCOMP] = 0;
+ rgba_uint[col][GCOMP] = 0;
+ rgba_uint[col][BCOMP] = 0;
+ }
+ }
+ else if (texImage->_BaseFormat == GL_LUMINANCE) {
+ GLuint col;
+ for (col = 0; col < width; col++) {
+ rgba_uint[col][GCOMP] = 0;
+ rgba_uint[col][BCOMP] = 0;
+ rgba_uint[col][ACOMP] = 1;
+ }
+ }
+ else if (texImage->_BaseFormat == GL_LUMINANCE_ALPHA) {
+ GLuint col;
+ for (col = 0; col < width; col++) {
+ rgba_uint[col][GCOMP] = 0;
+ rgba_uint[col][BCOMP] = 0;
+ }
+ }
+ else if (texImage->_BaseFormat == GL_INTENSITY) {
+ GLuint col;
+ for (col = 0; col < width; col++) {
+ rgba_uint[col][GCOMP] = 0;
+ rgba_uint[col][BCOMP] = 0;
+ rgba_uint[col][ACOMP] = 1;
+ }
+ }
+
+ _mesa_pack_rgba_span_int(ctx, width, rgba_uint,
+ format, type, dest);
+ } else {
+ _mesa_unpack_rgba_row(texFormat, width, src, rgba);
+
+ if (texImage->_BaseFormat == GL_ALPHA) {
+ GLuint col;
+ for (col = 0; col < width; col++) {
+ rgba[col][RCOMP] = 0.0F;
+ rgba[col][GCOMP] = 0.0F;
+ rgba[col][BCOMP] = 0.0F;
+ }
+ }
+ else if (texImage->_BaseFormat == GL_LUMINANCE) {
+ GLuint col;
+ for (col = 0; col < width; col++) {
+ rgba[col][GCOMP] = 0.0F;
+ rgba[col][BCOMP] = 0.0F;
+ rgba[col][ACOMP] = 1.0F;
+ }
+ }
+ else if (texImage->_BaseFormat == GL_LUMINANCE_ALPHA) {
+ GLuint col;
+ for (col = 0; col < width; col++) {
+ rgba[col][GCOMP] = 0.0F;
+ rgba[col][BCOMP] = 0.0F;
+ }
+ }
+ else if (texImage->_BaseFormat == GL_INTENSITY) {
+ GLuint col;
+ for (col = 0; col < width; col++) {
+ rgba[col][GCOMP] = 0.0F;
+ rgba[col][BCOMP] = 0.0F;
+ rgba[col][ACOMP] = 1.0F;
+ }
+ }
+
+ _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba,
+ format, type, dest,
+ &ctx->Pack, transferOps);
+ }
+ }
/* Unmap the src texture buffer */
ctx->Driver.UnmapTextureImage(ctx, texImage, img);
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index 39732522c..c64b10b04 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -1938,6 +1938,24 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions,
return GL_TRUE;
}
+ /* From the EXT_texture_integer spec:
+ *
+ * "INVALID_OPERATION is generated by CopyTexImage* and CopyTexSubImage*
+ * if the texture internalformat is an integer format and the read color
+ * buffer is not an integer format, or if the internalformat is not an
+ * integer format and the read color buffer is an integer format."
+ */
+ if (_mesa_is_color_format(internalFormat)) {
+ struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer;
+
+ if (_mesa_is_integer_format(rb->InternalFormat) !=
+ _mesa_is_integer_format(internalFormat)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glCopyTexImage%dD(integer vs non-integer)", dimensions);
+ return GL_TRUE;
+ }
+ }
+
/* Do size, level checking */
sizeOK = (proxyTarget == GL_PROXY_TEXTURE_CUBE_MAP_ARB)
? (width == height) : 1;
@@ -2153,16 +2171,21 @@ copytexsubimage_error_check2( struct gl_context *ctx, GLuint dimensions,
return GL_TRUE;
}
- /* If copying into an integer texture, the source buffer must also be
- * integer-valued.
+ /* From the EXT_texture_integer spec:
+ *
+ * "INVALID_OPERATION is generated by CopyTexImage* and CopyTexSubImage*
+ * if the texture internalformat is an integer format and the read color
+ * buffer is not an integer format, or if the internalformat is not an
+ * integer format and the read color buffer is an integer format."
*/
- if (_mesa_is_format_integer_color(teximage->TexFormat)) {
+ if (_mesa_is_color_format(teximage->InternalFormat)) {
struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer;
- if (!_mesa_is_format_integer_color(rb->Format)) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glCopyTexSubImage%dD(source buffer is not integer format)",
- dimensions);
- return GL_TRUE;
+
+ if (_mesa_is_format_integer_color(rb->Format) !=
+ _mesa_is_format_integer_color(teximage->TexFormat)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glCopyTexImage%dD(integer vs non-integer)", dimensions);
+ return GL_TRUE;
}
}
diff --git a/mesalib/src/mesa/main/varray.c b/mesalib/src/mesa/main/varray.c
index 9078d1161..77c1d7d9b 100644
--- a/mesalib/src/mesa/main/varray.c
+++ b/mesalib/src/mesa/main/varray.c
@@ -194,7 +194,7 @@ update_array(struct gl_context *ctx,
return;
}
- if (ctx->Array.ArrayObj->VBOonly &&
+ if (ctx->Array.ArrayObj->ARBsemantics &&
!_mesa_is_bufferobj(ctx->Array.ArrayBufferObj)) {
/* GL_ARB_vertex_array_object requires that all arrays reside in VBOs.
* Generate GL_INVALID_OPERATION if that's not true.