aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-02-22 09:17:57 +0100
committermarha <marha@users.sourceforge.net>2012-02-22 09:17:57 +0100
commit6baac61e6ca9cd314e689dfe7f84771aad08c66e (patch)
tree2a8a059fc83d3f7acc1034071ed3a9f7ff3c0027 /mesalib/src/mesa/main
parent0ae7710db53515dab4a35c33ba9a030bbfc2ac5b (diff)
downloadvcxsrv-6baac61e6ca9cd314e689dfe7f84771aad08c66e.tar.gz
vcxsrv-6baac61e6ca9cd314e689dfe7f84771aad08c66e.tar.bz2
vcxsrv-6baac61e6ca9cd314e689dfe7f84771aad08c66e.zip
fontconfig libX11 libxcb mesa pixman xserver git update 22 Feb 2012
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r--mesalib/src/mesa/main/attrib.c24
-rw-r--r--mesalib/src/mesa/main/fbobject.c11
-rw-r--r--mesalib/src/mesa/main/format_pack.c36
-rw-r--r--mesalib/src/mesa/main/format_unpack.c20
-rw-r--r--mesalib/src/mesa/main/image.c9
-rw-r--r--mesalib/src/mesa/main/mtypes.h2
-rw-r--r--mesalib/src/mesa/main/shared.c8
-rw-r--r--mesalib/src/mesa/main/teximage.c81
-rw-r--r--mesalib/src/mesa/main/texobj.c126
-rw-r--r--mesalib/src/mesa/main/texobj.h4
-rw-r--r--mesalib/src/mesa/main/texstate.c10
-rw-r--r--mesalib/src/mesa/main/varray.c42
-rw-r--r--mesalib/src/mesa/main/version.h2
13 files changed, 281 insertions, 94 deletions
diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c
index 846da35e9..7042312a8 100644
--- a/mesalib/src/mesa/main/attrib.c
+++ b/mesalib/src/mesa/main/attrib.c
@@ -122,7 +122,6 @@ struct gl_enable_attrib
GLboolean SampleAlphaToCoverage; /* GL_ARB_multisample */
GLboolean SampleAlphaToOne; /* GL_ARB_multisample */
GLboolean SampleCoverage; /* GL_ARB_multisample */
- GLboolean SampleCoverageInvert; /* GL_ARB_multisample */
GLboolean RasterPositionUnclipped; /* GL_IBM_rasterpos_clip */
GLbitfield Texture[MAX_TEXTURE_UNITS];
@@ -314,7 +313,6 @@ _mesa_PushAttrib(GLbitfield mask)
attr->SampleAlphaToCoverage = ctx->Multisample.SampleAlphaToCoverage;
attr->SampleAlphaToOne = ctx->Multisample.SampleAlphaToOne;
attr->SampleCoverage = ctx->Multisample.SampleCoverage;
- attr->SampleCoverageInvert = ctx->Multisample.SampleCoverageInvert;
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
attr->Texture[i] = ctx->Texture.Unit[i].Enabled;
attr->TexGen[i] = ctx->Texture.Unit[i].TexGenEnabled;
@@ -608,9 +606,6 @@ pop_enable_group(struct gl_context *ctx, const struct gl_enable_attrib *enable)
TEST_AND_UPDATE(ctx->Multisample.SampleCoverage,
enable->SampleCoverage,
GL_SAMPLE_COVERAGE_ARB);
- TEST_AND_UPDATE(ctx->Multisample.SampleCoverageInvert,
- enable->SampleCoverageInvert,
- GL_SAMPLE_COVERAGE_INVERT_ARB);
/* GL_ARB_vertex_program, GL_NV_vertex_program */
TEST_AND_UPDATE(ctx->VertexProgram.Enabled,
enable->VertexProgram,
@@ -622,8 +617,6 @@ pop_enable_group(struct gl_context *ctx, const struct gl_enable_attrib *enable)
enable->VertexProgramTwoSide,
GL_VERTEX_PROGRAM_TWO_SIDE_ARB);
-#undef TEST_AND_UPDATE
-
/* texture unit enables */
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
const GLbitfield enabled = enable->Texture[i];
@@ -1275,6 +1268,23 @@ _mesa_PopAttrib(void)
{
const struct gl_multisample_attrib *ms;
ms = (const struct gl_multisample_attrib *) attr->data;
+
+ TEST_AND_UPDATE(ctx->Multisample.Enabled,
+ ms->Enabled,
+ GL_MULTISAMPLE);
+
+ TEST_AND_UPDATE(ctx->Multisample.SampleCoverage,
+ ms->SampleCoverage,
+ GL_SAMPLE_COVERAGE);
+
+ TEST_AND_UPDATE(ctx->Multisample.SampleAlphaToCoverage,
+ ms->SampleAlphaToCoverage,
+ GL_SAMPLE_ALPHA_TO_COVERAGE);
+
+ TEST_AND_UPDATE(ctx->Multisample.SampleAlphaToOne,
+ ms->SampleAlphaToOne,
+ GL_SAMPLE_ALPHA_TO_ONE);
+
_mesa_SampleCoverageARB(ms->SampleCoverageValue,
ms->SampleCoverageInvert);
}
diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c
index 987d687b9..6ee062d0b 100644
--- a/mesalib/src/mesa/main/fbobject.c
+++ b/mesalib/src/mesa/main/fbobject.c
@@ -1758,11 +1758,8 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer)
if (bindDrawBuf) {
FLUSH_VERTICES(ctx, _NEW_BUFFERS);
- /* check if old read/draw buffers were render-to-texture */
- if (!bindReadBuf)
- check_end_texture_render(ctx, oldReadFb);
-
- if (oldDrawFb != oldReadFb)
+ /* check if old framebuffer had any texture attachments */
+ if (oldDrawFb)
check_end_texture_render(ctx, oldDrawFb);
/* check if newly bound framebuffer has any texture attachments */
@@ -2026,7 +2023,7 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target,
BUFFER_STENCIL);
} else if (attachment == GL_STENCIL_ATTACHMENT &&
texObj == fb->Attachment[BUFFER_DEPTH].Texture) {
- /* As above, but with depth and stencil juxtasposed. */
+ /* As above, but with depth and stencil juxtaposed. */
reuse_framebuffer_texture_attachment(fb, BUFFER_STENCIL,
BUFFER_DEPTH);
} else {
@@ -2269,7 +2266,7 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
ASSERT_OUTSIDE_BEGIN_END(ctx);
- /* The error differs in GL andd GLES. */
+ /* The error differs in GL and GLES. */
err = ctx->API == API_OPENGL ? GL_INVALID_OPERATION : GL_INVALID_ENUM;
buffer = get_framebuffer_target(ctx, target);
diff --git a/mesalib/src/mesa/main/format_pack.c b/mesalib/src/mesa/main/format_pack.c
index ea1d95ee9..ff08ac561 100644
--- a/mesalib/src/mesa/main/format_pack.c
+++ b/mesalib/src/mesa/main/format_pack.c
@@ -42,6 +42,14 @@
#include "../../gallium/auxiliary/util/u_format_r11g11b10f.h"
+/** Helper struct for MESA_FORMAT_Z32_FLOAT_X24S8 */
+struct z32f_x24s8
+{
+ float z;
+ uint32_t x24s8;
+};
+
+
typedef void (*pack_ubyte_rgba_row_func)(GLuint n,
const GLubyte src[][4], void *dst);
@@ -2372,10 +2380,10 @@ _mesa_pack_float_z_row(gl_format format, GLuint n,
break;
case MESA_FORMAT_Z32_FLOAT_X24S8:
{
- GLfloat *d = ((GLfloat *) dst);
+ struct z32f_x24s8 *d = (struct z32f_x24s8 *) dst;
GLuint i;
for (i = 0; i < n; i++) {
- d[i * 2] = src[i];
+ d[i].z = src[i];
}
}
break;
@@ -2445,13 +2453,13 @@ _mesa_pack_uint_z_row(gl_format format, GLuint n,
break;
case MESA_FORMAT_Z32_FLOAT_X24S8:
{
- GLfloat *d = ((GLfloat *) dst);
+ struct z32f_x24s8 *d = (struct z32f_x24s8 *) dst;
const GLdouble scale = 1.0 / (GLdouble) 0xffffffff;
GLuint i;
for (i = 0; i < n; i++) {
- d[i * 2] = src[i] * scale;
- assert(d[i * 2] >= 0.0f);
- assert(d[i * 2] <= 1.0f);
+ d[i].z = src[i] * scale;
+ assert(d[i].z >= 0.0f);
+ assert(d[i].z <= 1.0f);
}
}
break;
@@ -2495,10 +2503,10 @@ _mesa_pack_ubyte_stencil_row(gl_format format, GLuint n,
break;
case MESA_FORMAT_Z32_FLOAT_X24S8:
{
- GLuint *d = dst;
+ struct z32f_x24s8 *d = (struct z32f_x24s8 *) dst;
GLuint i;
for (i = 0; i < n; i++) {
- d[i * 2 + 1] = src[i];
+ d[i].x24s8 = src[i];
}
}
break;
@@ -2530,6 +2538,18 @@ _mesa_pack_uint_24_8_depth_stencil_row(gl_format format, GLuint n,
}
}
break;
+ case MESA_FORMAT_Z32_FLOAT_X24S8:
+ {
+ const GLdouble scale = 1.0 / (GLdouble) 0xffffff;
+ struct z32f_x24s8 *d = (struct z32f_x24s8 *) dst;
+ GLint i;
+ for (i = 0; i < n; i++) {
+ GLfloat z = (src[i] >> 8) * scale;
+ d[i].z = z;
+ d[i].x24s8 = src[i];
+ }
+ }
+ break;
default:
_mesa_problem(NULL, "bad format %s in _mesa_pack_ubyte_s_row",
_mesa_get_format_name(format));
diff --git a/mesalib/src/mesa/main/format_unpack.c b/mesalib/src/mesa/main/format_unpack.c
index a484979e2..b00e01236 100644
--- a/mesalib/src/mesa/main/format_unpack.c
+++ b/mesalib/src/mesa/main/format_unpack.c
@@ -29,6 +29,13 @@
#include "../../gallium/auxiliary/util/u_format_r11g11b10f.h"
+/** Helper struct for MESA_FORMAT_Z32_FLOAT_X24S8 */
+struct z32f_x24s8
+{
+ float z;
+ uint32_t x24s8;
+};
+
/* Expand 1, 2, 3, 4, 5, 6-bit values to fill 8 bits */
@@ -2825,10 +2832,10 @@ unpack_float_z_Z32F(GLuint n, const void *src, GLfloat *dst)
static void
unpack_float_z_Z32X24S8(GLuint n, const void *src, GLfloat *dst)
{
- const GLfloat *s = ((const GLfloat *) src);
+ const struct z32f_x24s8 *s = (const struct z32f_x24s8 *) src;
GLuint i;
for (i = 0; i < n; i++) {
- dst[i] = s[i * 2];
+ dst[i] = s[i].z;
}
}
@@ -2929,11 +2936,6 @@ unpack_uint_z_Z32_FLOAT(const void *src, GLuint *dst, GLuint n)
static void
unpack_uint_z_Z32_FLOAT_X24S8(const void *src, GLuint *dst, GLuint n)
{
- struct z32f_x24s8 {
- float z;
- uint32_t x24s8;
- };
-
const struct z32f_x24s8 *s = (const struct z32f_x24s8 *) src;
GLuint i;
@@ -3015,10 +3017,10 @@ static void
unpack_ubyte_s_Z32_FLOAT_X24S8(const void *src, GLubyte *dst, GLuint n)
{
GLuint i;
- const GLuint *src32 = src;
+ const struct z32f_x24s8 *s = (const struct z32f_x24s8 *) src;
for (i = 0; i < n; i++)
- dst[i] = src32[i * 2 + 1] & 0xff;
+ dst[i] = s[i].x24s8 & 0xff;
}
void
diff --git a/mesalib/src/mesa/main/image.c b/mesalib/src/mesa/main/image.c
index 750db9444..b6c2645e9 100644
--- a/mesalib/src/mesa/main/image.c
+++ b/mesalib/src/mesa/main/image.c
@@ -428,6 +428,15 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
}
return GL_NO_ERROR;
+ case GL_UNSIGNED_INT_10F_11F_11F_REV:
+ if (!ctx->Extensions.EXT_packed_float) {
+ return GL_INVALID_ENUM;
+ }
+ if (format != GL_RGB) {
+ return GL_INVALID_OPERATION;
+ }
+ return GL_NO_ERROR;
+
default:
; /* fall-through */
}
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 5ef97c86c..9200f3fc4 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -2483,7 +2483,7 @@ struct gl_shared_state
struct gl_texture_object *DefaultTex[NUM_TEXTURE_TARGETS];
/** Fallback texture used when a bound texture is incomplete */
- struct gl_texture_object *FallbackTex;
+ struct gl_texture_object *FallbackTex[NUM_TEXTURE_TARGETS];
/**
* \name Thread safety and statechange notification for texture
diff --git a/mesalib/src/mesa/main/shared.c b/mesalib/src/mesa/main/shared.c
index c07ce8238..226947638 100644
--- a/mesalib/src/mesa/main/shared.c
+++ b/mesalib/src/mesa/main/shared.c
@@ -307,9 +307,11 @@ free_shared_state(struct gl_context *ctx, struct gl_shared_state *shared)
{
GLuint i;
- /* Free the dummy/fallback texture object */
- if (shared->FallbackTex)
- ctx->Driver.DeleteTexture(ctx, shared->FallbackTex);
+ /* Free the dummy/fallback texture objects */
+ for (i = 0; i < NUM_TEXTURE_TARGETS; i++) {
+ if (shared->FallbackTex[i])
+ ctx->Driver.DeleteTexture(ctx, shared->FallbackTex[i]);
+ }
/*
* Free display lists
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index e4eb7f67d..9b6c6c896 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -1083,11 +1083,13 @@ _mesa_init_teximage_fields(struct gl_context *ctx,
GLint border, GLenum internalFormat,
gl_format format)
{
+ GLenum target;
ASSERT(img);
ASSERT(width >= 0);
ASSERT(height >= 0);
ASSERT(depth >= 0);
+ target = img->TexObject->Target;
img->_BaseFormat = _mesa_base_tex_format( ctx, internalFormat );
ASSERT(img->_BaseFormat > 0);
img->InternalFormat = internalFormat;
@@ -1099,26 +1101,72 @@ _mesa_init_teximage_fields(struct gl_context *ctx,
img->Width2 = width - 2 * border; /* == 1 << img->WidthLog2; */
img->WidthLog2 = _mesa_logbase2(img->Width2);
- if (height == 1) { /* 1-D texture */
- img->Height2 = 1;
+ switch(target) {
+ case GL_TEXTURE_1D:
+ case GL_TEXTURE_BUFFER:
+ case GL_PROXY_TEXTURE_1D:
+ if (height == 0)
+ img->Height2 = 0;
+ else
+ img->Height2 = 1;
img->HeightLog2 = 0;
- }
- else {
+ if (depth == 0)
+ img->Depth2 = 0;
+ else
+ img->Depth2 = 1;
+ img->DepthLog2 = 0;
+ break;
+ case GL_TEXTURE_1D_ARRAY:
+ case GL_PROXY_TEXTURE_1D_ARRAY:
+ img->Height2 = height; /* no border */
+ img->HeightLog2 = 0; /* not used */
+ if (depth == 0)
+ img->Depth2 = 0;
+ else
+ img->Depth2 = 1;
+ img->DepthLog2 = 0;
+ break;
+ case GL_TEXTURE_2D:
+ case GL_TEXTURE_RECTANGLE:
+ case GL_TEXTURE_CUBE_MAP:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ case GL_TEXTURE_EXTERNAL_OES:
+ case GL_PROXY_TEXTURE_2D:
+ case GL_PROXY_TEXTURE_RECTANGLE:
+ case GL_PROXY_TEXTURE_CUBE_MAP:
img->Height2 = height - 2 * border; /* == 1 << img->HeightLog2; */
img->HeightLog2 = _mesa_logbase2(img->Height2);
- }
-
- if (depth == 1) { /* 2-D texture */
- img->Depth2 = 1;
+ if (depth == 0)
+ img->Depth2 = 0;
+ else
+ img->Depth2 = 1;
img->DepthLog2 = 0;
- }
- else {
+ break;
+ case GL_TEXTURE_2D_ARRAY:
+ case GL_PROXY_TEXTURE_2D_ARRAY:
+ img->Height2 = height - 2 * border; /* == 1 << img->HeightLog2; */
+ img->HeightLog2 = _mesa_logbase2(img->Height2);
+ img->Depth2 = depth; /* no border */
+ img->DepthLog2 = 0; /* not used */
+ break;
+ case GL_TEXTURE_3D:
+ case GL_PROXY_TEXTURE_3D:
+ img->Height2 = height - 2 * border; /* == 1 << img->HeightLog2; */
+ img->HeightLog2 = _mesa_logbase2(img->Height2);
img->Depth2 = depth - 2 * border; /* == 1 << img->DepthLog2; */
img->DepthLog2 = _mesa_logbase2(img->Depth2);
+ break;
+ default:
+ _mesa_problem(NULL, "invalid target 0x%x in _mesa_init_teximage_fields()",
+ target);
}
img->MaxLog2 = MAX2(img->WidthLog2, img->HeightLog2);
-
img->TexFormat = format;
}
@@ -1852,6 +1900,17 @@ subtexture_error_check2( struct gl_context *ctx, GLuint dimensions,
}
}
+ if (ctx->VersionMajor >= 3 || ctx->Extensions.EXT_texture_integer) {
+ /* both source and dest must be integer-valued, or neither */
+ if (_mesa_is_format_integer_color(destTex->TexFormat) !=
+ _mesa_is_integer_format(format)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glTexSubImage%dD(integer/non-integer format mismatch)",
+ dimensions);
+ return GL_TRUE;
+ }
+ }
+
return GL_FALSE;
}
diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c
index 1b61d3a63..590594826 100644
--- a/mesalib/src/mesa/main/texobj.c
+++ b/mesalib/src/mesa/main/texobj.c
@@ -759,59 +759,127 @@ _mesa_dirty_texobj(struct gl_context *ctx, struct gl_texture_object *texObj,
/**
- * Return pointer to a default/fallback texture.
- * The texture is a 2D 8x8 RGBA texture with all texels = (0,0,0,1).
- * That's the value a sampler should get when sampling from an
+ * Return pointer to a default/fallback texture of the given type/target.
+ * The texture is an RGBA texture with all texels = (0,0,0,1).
+ * That's the value a GLSL sampler should get when sampling from an
* incomplete texture.
*/
struct gl_texture_object *
-_mesa_get_fallback_texture(struct gl_context *ctx)
+_mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex)
{
- if (!ctx->Shared->FallbackTex) {
+ if (!ctx->Shared->FallbackTex[tex]) {
/* create fallback texture now */
- static GLubyte texels[8 * 8][4];
+ const GLsizei width = 1, height = 1, depth = 1;
+ GLubyte texel[4];
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
gl_format texFormat;
- GLuint i;
-
- for (i = 0; i < 8 * 8; i++) {
- texels[i][0] =
- texels[i][1] =
- texels[i][2] = 0x0;
- texels[i][3] = 0xff;
+ GLuint dims, face, numFaces = 1;
+ GLenum target;
+
+ texel[0] =
+ texel[1] =
+ texel[2] = 0x0;
+ texel[3] = 0xff;
+
+ switch (tex) {
+ case TEXTURE_2D_ARRAY_INDEX:
+ dims = 3;
+ target = GL_TEXTURE_2D_ARRAY;
+ break;
+ case TEXTURE_1D_ARRAY_INDEX:
+ dims = 2;
+ target = GL_TEXTURE_1D_ARRAY;
+ break;
+ case TEXTURE_CUBE_INDEX:
+ dims = 2;
+ target = GL_TEXTURE_CUBE_MAP;
+ numFaces = 6;
+ break;
+ case TEXTURE_3D_INDEX:
+ dims = 3;
+ target = GL_TEXTURE_3D;
+ break;
+ case TEXTURE_RECT_INDEX:
+ dims = 2;
+ target = GL_TEXTURE_RECTANGLE;
+ break;
+ case TEXTURE_2D_INDEX:
+ dims = 2;
+ target = GL_TEXTURE_2D;
+ break;
+ case TEXTURE_1D_INDEX:
+ dims = 1;
+ target = GL_TEXTURE_1D;
+ break;
+ case TEXTURE_BUFFER_INDEX:
+ case TEXTURE_EXTERNAL_INDEX:
+ default:
+ /* no-op */
+ return NULL;
}
/* create texture object */
- texObj = ctx->Driver.NewTextureObject(ctx, 0, GL_TEXTURE_2D);
+ texObj = ctx->Driver.NewTextureObject(ctx, 0, target);
+ if (!texObj)
+ return NULL;
+
assert(texObj->RefCount == 1);
texObj->Sampler.MinFilter = GL_NEAREST;
texObj->Sampler.MagFilter = GL_NEAREST;
- /* create level[0] texture image */
- texImage = _mesa_get_tex_image(ctx, texObj, GL_TEXTURE_2D, 0);
-
texFormat = ctx->Driver.ChooseTextureFormat(ctx, GL_RGBA, GL_RGBA,
GL_UNSIGNED_BYTE);
- /* init the image fields */
- _mesa_init_teximage_fields(ctx, texImage,
- 8, 8, 1, 0, GL_RGBA, texFormat);
+ /* need a loop here just for cube maps */
+ for (face = 0; face < numFaces; face++) {
+ GLenum faceTarget;
- ASSERT(texImage->TexFormat != MESA_FORMAT_NONE);
-
- /* set image data */
- ctx->Driver.TexImage2D(ctx, texImage, GL_RGBA,
- 8, 8, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, texels,
- &ctx->DefaultPacking);
+ if (target == GL_TEXTURE_CUBE_MAP)
+ faceTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X + face;
+ else
+ faceTarget = target;
+
+ /* initialize level[0] texture image */
+ texImage = _mesa_get_tex_image(ctx, texObj, faceTarget, 0);
+
+ _mesa_init_teximage_fields(ctx, texImage,
+ width,
+ (dims > 1) ? height : 1,
+ (dims > 2) ? depth : 1,
+ 0, /* border */
+ GL_RGBA, texFormat);
+
+ switch (dims) {
+ case 1:
+ ctx->Driver.TexImage1D(ctx, texImage, GL_RGBA,
+ width, 0,
+ GL_RGBA, GL_UNSIGNED_BYTE, texel,
+ &ctx->DefaultPacking);
+ break;
+ case 2:
+ ctx->Driver.TexImage2D(ctx, texImage, GL_RGBA,
+ width, height, 0,
+ GL_RGBA, GL_UNSIGNED_BYTE, texel,
+ &ctx->DefaultPacking);
+ break;
+ case 3:
+ ctx->Driver.TexImage3D(ctx, texImage, GL_RGBA,
+ width, height, depth, 0,
+ GL_RGBA, GL_UNSIGNED_BYTE, texel,
+ &ctx->DefaultPacking);
+ break;
+ default:
+ _mesa_problem(ctx, "bad dims in _mesa_get_fallback_texture()");
+ }
+ }
_mesa_test_texobj_completeness(ctx, texObj);
assert(texObj->_Complete);
- ctx->Shared->FallbackTex = texObj;
+ ctx->Shared->FallbackTex[tex] = texObj;
}
- return ctx->Shared->FallbackTex;
+ return ctx->Shared->FallbackTex[tex];
}
diff --git a/mesalib/src/mesa/main/texobj.h b/mesalib/src/mesa/main/texobj.h
index 9ca7a4c9e..03dfbe304 100644
--- a/mesalib/src/mesa/main/texobj.h
+++ b/mesalib/src/mesa/main/texobj.h
@@ -34,8 +34,8 @@
#include "compiler.h"
#include "glheader.h"
+#include "mtypes.h"
-struct gl_context;
/**
* \name Internal functions
@@ -89,7 +89,7 @@ _mesa_dirty_texobj(struct gl_context *ctx, struct gl_texture_object *texObj,
GLboolean invalidate_state);
extern struct gl_texture_object *
-_mesa_get_fallback_texture(struct gl_context *ctx);
+_mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex);
extern void
_mesa_unlock_context_textures( struct gl_context *ctx );
diff --git a/mesalib/src/mesa/main/texstate.c b/mesalib/src/mesa/main/texstate.c
index cc49916a9..187ec9c36 100644
--- a/mesalib/src/mesa/main/texstate.c
+++ b/mesalib/src/mesa/main/texstate.c
@@ -586,9 +586,15 @@ update_texture_state( struct gl_context *ctx )
* object, but there isn't one (or it's incomplete). Use the
* fallback texture.
*/
- struct gl_texture_object *texObj = _mesa_get_fallback_texture(ctx);
- texUnit->_ReallyEnabled = 1 << TEXTURE_2D_INDEX;
+ struct gl_texture_object *texObj;
+ gl_texture_index texTarget;
+
+ assert(_mesa_bitcount(enabledTargets) == 1);
+
+ texTarget = (gl_texture_index) (ffs(enabledTargets) - 1);
+ texObj = _mesa_get_fallback_texture(ctx, texTarget);
_mesa_reference_texobj(&texUnit->_Current, texObj);
+ texUnit->_ReallyEnabled = 1 << texTarget;
}
else {
/* fixed-function: texture unit is really disabled */
diff --git a/mesalib/src/mesa/main/varray.c b/mesalib/src/mesa/main/varray.c
index 77c1d7d9b..39d3a27e0 100644
--- a/mesalib/src/mesa/main/varray.c
+++ b/mesalib/src/mesa/main/varray.c
@@ -185,6 +185,7 @@ update_array(struct gl_context *ctx,
(type == GL_UNSIGNED_INT_2_10_10_10_REV ||
type == GL_INT_2_10_10_10_REV) && size != 4) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s(size=%d)", func, size);
+ return;
}
ASSERT(size <= 4);
@@ -482,6 +483,7 @@ _mesa_VertexAttribIPointer(GLuint index, GLint size, GLenum type,
void GLAPIENTRY
_mesa_EnableVertexAttribArrayARB(GLuint index)
{
+ struct gl_array_object *arrayObj;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
@@ -491,18 +493,24 @@ _mesa_EnableVertexAttribArrayARB(GLuint index)
return;
}
- ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(ctx->Array.ArrayObj->VertexAttrib));
+ arrayObj = ctx->Array.ArrayObj;
+
+ ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(arrayObj->VertexAttrib));
- FLUSH_VERTICES(ctx, _NEW_ARRAY);
- ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled = GL_TRUE;
- ctx->Array.ArrayObj->_Enabled |= VERT_BIT_GENERIC(index);
- ctx->Array.NewState |= VERT_BIT_GENERIC(index);
+ if (!arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled) {
+ /* was disabled, now being enabled */
+ FLUSH_VERTICES(ctx, _NEW_ARRAY);
+ arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled = GL_TRUE;
+ arrayObj->_Enabled |= VERT_BIT_GENERIC(index);
+ ctx->Array.NewState |= VERT_BIT_GENERIC(index);
+ }
}
void GLAPIENTRY
_mesa_DisableVertexAttribArrayARB(GLuint index)
{
+ struct gl_array_object *arrayObj;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
@@ -512,12 +520,17 @@ _mesa_DisableVertexAttribArrayARB(GLuint index)
return;
}
- ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(ctx->Array.ArrayObj->VertexAttrib));
+ arrayObj = ctx->Array.ArrayObj;
+
+ ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(arrayObj->VertexAttrib));
- FLUSH_VERTICES(ctx, _NEW_ARRAY);
- ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled = GL_FALSE;
- ctx->Array.ArrayObj->_Enabled &= ~VERT_BIT_GENERIC(index);
- ctx->Array.NewState |= VERT_BIT_GENERIC(index);
+ if (arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled) {
+ /* was enabled, now being disabled */
+ FLUSH_VERTICES(ctx, _NEW_ARRAY);
+ arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled = GL_FALSE;
+ arrayObj->_Enabled &= ~VERT_BIT_GENERIC(index);
+ ctx->Array.NewState |= VERT_BIT_GENERIC(index);
+ }
}
@@ -1087,11 +1100,12 @@ _mesa_PrimitiveRestartIndex(GLuint index)
return;
}
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
- ctx->Array.RestartIndex = index;
+ if (ctx->Array.RestartIndex != index) {
+ FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
+ ctx->Array.RestartIndex = index;
+ }
}
diff --git a/mesalib/src/mesa/main/version.h b/mesalib/src/mesa/main/version.h
index 35bf53392..94a9855d9 100644
--- a/mesalib/src/mesa/main/version.h
+++ b/mesalib/src/mesa/main/version.h
@@ -35,7 +35,7 @@ struct gl_context;
#define MESA_MAJOR 8
#define MESA_MINOR 1
#define MESA_PATCH 0
-#define MESA_VERSION_STRING "8.0-devel"
+#define MESA_VERSION_STRING "8.1-devel"
/* To make version comparison easy */
#define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))