summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/context.c6
-rw-r--r--src/mesa/main/fbobject.c2
-rw-r--r--src/mesa/main/texobj.c4
-rw-r--r--src/mesa/main/texstore.c132
4 files changed, 102 insertions, 42 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 27e5e2fcce9..32460e92c3c 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -120,9 +120,7 @@
#include "macros.h"
#include "matrix.h"
#include "multisample.h"
-#if FEATURE_pixel_transfer
#include "pixel.h"
-#endif
#include "pixelstore.h"
#include "points.h"
#include "polygon.h"
@@ -1035,11 +1033,7 @@ init_attrib_groups(GLcontext *ctx)
_mesa_init_lighting( ctx );
_mesa_init_matrix( ctx );
_mesa_init_multisample( ctx );
-#if FEATURE_pixel_transfer
_mesa_init_pixel( ctx );
-#else
- ctx->Pixel.ReadBuffer = ctx->Visual.doubleBufferMode ? GL_BACK : GL_FRONT;
-#endif
_mesa_init_pixelstore( ctx );
_mesa_init_point( ctx );
_mesa_init_polygon( ctx );
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 960cc6da229..b5605a199c5 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -508,6 +508,7 @@ _mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb)
}
}
+#ifndef FEATURE_OES_framebuffer_object
/* Check that all DrawBuffers are present */
for (j = 0; j < ctx->Const.MaxDrawBuffers; j++) {
if (fb->ColorDrawBuffer[j] != GL_NONE) {
@@ -533,6 +534,7 @@ _mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb)
return;
}
}
+#endif
if (numImages == 0) {
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT;
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index b77a00dd15c..c163a8158fe 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -875,9 +875,9 @@ _mesa_BindTexture( GLenum target, GLuint texName )
if (newTexObj) {
/* error checking */
if (newTexObj->Target != 0 && newTexObj->Target != target) {
- /* the named texture object's dimensions don't match the target */
+ /* the named texture object's target doesn't match the given target */
_mesa_error( ctx, GL_INVALID_OPERATION,
- "glBindTexture(wrong dimensionality)" );
+ "glBindTexture(target mismatch)" );
return;
}
if (newTexObj->Target == 0 && target == GL_TEXTURE_RECTANGLE_NV) {
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index 97fdfd39b2a..e821d9f367f 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -2,7 +2,7 @@
* Mesa 3-D graphics library
* Version: 7.1
*
- * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2008 Brian Paul 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"),
@@ -678,56 +678,116 @@ static void
swizzle_copy(GLubyte *dst, GLuint dstComponents, const GLubyte *src,
GLuint srcComponents, const GLubyte *map, GLuint count)
{
+#define SWZ_CPY(dst, src, count, dstComps, srcComps) \
+ do { \
+ GLuint i; \
+ for (i = 0; i < count; i++) { \
+ GLuint j; \
+ if (srcComps == 4) { \
+ COPY_4UBV(tmp, src); \
+ } \
+ else { \
+ for (j = 0; j < srcComps; j++) { \
+ tmp[j] = src[j]; \
+ } \
+ } \
+ src += srcComps; \
+ for (j = 0; j < dstComps; j++) { \
+ dst[j] = tmp[map[j]]; \
+ } \
+ dst += dstComps; \
+ } \
+ } while (0)
+
GLubyte tmp[6];
- GLuint i;
tmp[ZERO] = 0x0;
tmp[ONE] = 0xff;
+ ASSERT(srcComponents <= 4);
+ ASSERT(dstComponents <= 4);
+
switch (dstComponents) {
case 4:
- for (i = 0; i < count; i++) {
- COPY_4UBV(tmp, src);
- src += srcComponents;
- dst[0] = tmp[map[0]];
- dst[1] = tmp[map[1]];
- dst[2] = tmp[map[2]];
- dst[3] = tmp[map[3]];
- dst += 4;
+ switch (srcComponents) {
+ case 4:
+ SWZ_CPY(dst, src, count, 4, 4);
+ break;
+ case 3:
+ SWZ_CPY(dst, src, count, 4, 3);
+ break;
+ case 2:
+ SWZ_CPY(dst, src, count, 4, 2);
+ break;
+ case 1:
+ SWZ_CPY(dst, src, count, 4, 1);
+ break;
+ default:
+ ;
}
break;
case 3:
- for (i = 0; i < count; i++) {
- COPY_4UBV(tmp, src);
- src += srcComponents;
- dst[0] = tmp[map[0]];
- dst[1] = tmp[map[1]];
- dst[2] = tmp[map[2]];
- dst += 3;
+ switch (srcComponents) {
+ case 4:
+ SWZ_CPY(dst, src, count, 3, 4);
+ break;
+ case 3:
+ SWZ_CPY(dst, src, count, 3, 3);
+ break;
+ case 2:
+ SWZ_CPY(dst, src, count, 3, 2);
+ break;
+ case 1:
+ SWZ_CPY(dst, src, count, 3, 1);
+ break;
+ default:
+ ;
}
break;
case 2:
- for (i = 0; i < count; i++) {
- COPY_4UBV(tmp, src);
- src += srcComponents;
- dst[0] = tmp[map[0]];
- dst[1] = tmp[map[1]];
- dst += 2;
+ switch (srcComponents) {
+ case 4:
+ SWZ_CPY(dst, src, count, 2, 4);
+ break;
+ case 3:
+ SWZ_CPY(dst, src, count, 2, 3);
+ break;
+ case 2:
+ SWZ_CPY(dst, src, count, 2, 2);
+ break;
+ case 1:
+ SWZ_CPY(dst, src, count, 2, 1);
+ break;
+ default:
+ ;
}
break;
case 1:
- /* XXX investigate valgrind invalid read when running demos/texenv.c */
- for (i = 0; i < count; i++) {
- COPY_4UBV(tmp, src);
- src += srcComponents;
- dst[0] = tmp[map[0]];
- dst += 1;
+ switch (srcComponents) {
+ case 4:
+ SWZ_CPY(dst, src, count, 1, 4);
+ break;
+ case 3:
+ SWZ_CPY(dst, src, count, 1, 3);
+ break;
+ case 2:
+ SWZ_CPY(dst, src, count, 1, 2);
+ break;
+ case 1:
+ SWZ_CPY(dst, src, count, 1, 1);
+ break;
+ default:
+ ;
}
break;
+ default:
+ ;
}
+#undef SWZ_CPY
}
+
static const GLubyte map_identity[6] = { 0, 1, 2, 3, ZERO, ONE };
static const GLubyte map_3210[6] = { 3, 2, 1, 0, ZERO, ONE };
@@ -1100,7 +1160,8 @@ _mesa_texstore_z32(TEXSTORE_PARAMS)
ASSERT(dstFormat == &_mesa_texformat_z32);
ASSERT(dstFormat->TexelBytes == sizeof(GLuint));
- if (!ctx->_ImageTransferState &&
+ if (ctx->Pixel.DepthScale == 1.0f &&
+ ctx->Pixel.DepthBias == 0.0f &&
!srcPacking->SwapBytes &&
baseInternalFormat == GL_DEPTH_COMPONENT &&
srcFormat == GL_DEPTH_COMPONENT &&
@@ -1147,7 +1208,8 @@ _mesa_texstore_z16(TEXSTORE_PARAMS)
ASSERT(dstFormat == &_mesa_texformat_z16);
ASSERT(dstFormat->TexelBytes == sizeof(GLushort));
- if (!ctx->_ImageTransferState &&
+ if (ctx->Pixel.DepthScale == 1.0f &&
+ ctx->Pixel.DepthBias == 0.0f &&
!srcPacking->SwapBytes &&
baseInternalFormat == GL_DEPTH_COMPONENT &&
srcFormat == GL_DEPTH_COMPONENT &&
@@ -2345,7 +2407,8 @@ _mesa_texstore_z24_s8(TEXSTORE_PARAMS)
ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT);
ASSERT(srcType == GL_UNSIGNED_INT_24_8_EXT);
- if (!ctx->_ImageTransferState &&
+ if (ctx->Pixel.DepthScale == 1.0f &&
+ ctx->Pixel.DepthBias == 0.0f &&
!srcPacking->SwapBytes) {
/* simple path */
memcpy_texture(ctx, dims,
@@ -2416,7 +2479,7 @@ _mesa_texstore_s8_z24(TEXSTORE_PARAMS)
ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT || srcFormat == GL_DEPTH_COMPONENT);
ASSERT(srcFormat != GL_DEPTH_STENCIL_EXT || srcType == GL_UNSIGNED_INT_24_8_EXT);
- /* Incase we only upload depth we need to preserve the stencil */
+ /* In case we only upload depth we need to preserve the stencil */
if (srcFormat == GL_DEPTH_COMPONENT) {
for (img = 0; img < srcDepth; img++) {
GLuint *dstRow = (GLuint *) dstAddr
@@ -2444,7 +2507,8 @@ _mesa_texstore_s8_z24(TEXSTORE_PARAMS)
dstRow += dstRowStride / sizeof(GLuint);
}
}
- } else {
+ }
+ else {
for (img = 0; img < srcDepth; img++) {
GLuint *dstRow = (GLuint *) dstAddr
+ dstImageOffsets[dstZoffset + img]