summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-05-18 10:36:50 -0600
committerBrian Paul <brianp@vmware.com>2009-05-18 10:36:50 -0600
commitedfbf7dccb1d90ebedfa08fe06e1db7fff9f94d4 (patch)
tree0e224de2fac2fc5c632b2398a372b658c66a36d7 /src/mesa
parent27206add2738f9813d1e9f42fe3b1bdfbd9b8aa4 (diff)
parent7ce105d2e6885eeac73c59dc14c4cd59a89c1425 (diff)
Merge branch 'mesa_7_5_branch'
Conflicts: Makefile src/mesa/main/version.h
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/r300/r300_context.c7
-rw-r--r--src/mesa/drivers/dri/r300/r300_texstate.c22
-rw-r--r--src/mesa/main/mipmap.c3
-rw-r--r--src/mesa/state_tracker/st_gen_mipmap.c10
4 files changed, 31 insertions, 11 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c
index 12bee1a8fb..8f0effd83e 100644
--- a/src/mesa/drivers/dri/r300/r300_context.c
+++ b/src/mesa/drivers/dri/r300/r300_context.c
@@ -43,6 +43,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "main/matrix.h"
#include "main/extensions.h"
#include "main/state.h"
+#include "main/texobj.h"
#include "main/bufferobj.h"
#include "swrast/swrast.h"
@@ -500,6 +501,7 @@ void r300DestroyContext(__DRIcontextPrivate * driContextPriv)
r300ContextPtr r300 = (r300ContextPtr) driContextPriv->driverPrivate;
radeonContextPtr radeon = (radeonContextPtr) r300;
radeonContextPtr current = ctx ? RADEON_CONTEXT(ctx) : NULL;
+ int i;
if (RADEON_DEBUG & DEBUG_DRI) {
fprintf(stderr, "Destroying context !\n");
@@ -553,6 +555,11 @@ void r300DestroyContext(__DRIcontextPrivate * driContextPriv)
assert(is_empty_list(&r300->swapped));
}
+ /* Drop texture object references from current hardware state */
+ for (i = 0; i < 8; i++) {
+ _mesa_reference_texobj(&r300->state.texture.unit[i].texobj, NULL);
+ }
+
radeonCleanupContext(&r300->radeon);
#ifdef USER_BUFFERS
diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c
index abe613e27b..f6ae4b675b 100644
--- a/src/mesa/drivers/dri/r300/r300_texstate.c
+++ b/src/mesa/drivers/dri/r300/r300_texstate.c
@@ -557,12 +557,15 @@ static GLboolean r300UpdateTexture(GLcontext * ctx, int unit)
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- r300TexObjPtr t = (r300TexObjPtr) tObj->DriverData;
+ struct gl_texture_object *tObj = texUnit->_ReallyEnabled ?
+ texUnit->_Current : NULL;
+ r300TexObjPtr t = tObj ? (r300TexObjPtr) tObj->DriverData : NULL;
/* Fallback if there's a texture border */
- if (tObj->Image[0][tObj->BaseLevel]->Border > 0)
- return GL_FALSE;
+ if (tObj && tObj->Image[0][tObj->BaseLevel]->Border > 0) {
+ tObj = NULL;
+ t = NULL;
+ }
/* Update state if this is a different texture object to last
* time.
@@ -579,11 +582,14 @@ static GLboolean r300UpdateTexture(GLcontext * ctx, int unit)
}
_mesa_reference_texobj(&rmesa->state.texture.unit[unit].texobj, tObj);
- t->base.bound |= (1 << unit);
- driUpdateTextureLRU(&t->base); /* XXX: should be locked! */
+
+ if (t) {
+ t->base.bound |= (1 << unit);
+ driUpdateTextureLRU(&t->base); /* XXX: should be locked! */
+ }
}
- return !t->border_fallback;
+ return !t || !t->border_fallback;
}
void r300SetTexOffset(__DRIcontext * pDRICtx, GLint texname,
@@ -651,7 +657,7 @@ static GLboolean r300UpdateTextureUnit(GLcontext * ctx, int unit)
} else if (texUnit->_ReallyEnabled) {
return GL_FALSE;
} else {
- return GL_TRUE;
+ return r300UpdateTexture(ctx, unit);
}
}
diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
index 47db2acdf0..872982fa43 100644
--- a/src/mesa/main/mipmap.c
+++ b/src/mesa/main/mipmap.c
@@ -1370,6 +1370,9 @@ make_2d_stack_mipmap(GLenum datatype, GLuint comps, GLint border,
/**
* Down-sample a texture image to produce the next lower mipmap level.
+ * \param comps components per texel (1, 2, 3 or 4)
+ * \param srcRowStride stride between source rows, in texels
+ * \param dstRowStride stride between destination rows, in texels
*/
void
_mesa_generate_mipmap_level(GLenum target,
diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c
index e159b4c9db..dc6d77825f 100644
--- a/src/mesa/state_tracker/st_gen_mipmap.c
+++ b/src/mesa/state_tracker/st_gen_mipmap.c
@@ -87,7 +87,7 @@ st_render_mipmap(struct st_context *st,
assert(target != GL_TEXTURE_3D); /* not done yet */
/* check if we can render in the texture's format */
- if (!screen->is_format_supported(screen, pt->format, target,
+ if (!screen->is_format_supported(screen, pt->format, pt->target,
PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) {
return FALSE;
}
@@ -123,6 +123,7 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
struct pipe_transfer *srcTrans, *dstTrans;
const ubyte *srcData;
ubyte *dstData;
+ int srcStride, dstStride;
srcTrans = st_cond_flush_get_tex_transfer(st_context(ctx), pt, face,
srcLevel, zslice,
@@ -139,14 +140,17 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
srcData = (ubyte *) screen->transfer_map(screen, srcTrans);
dstData = (ubyte *) screen->transfer_map(screen, dstTrans);
+ srcStride = srcTrans->stride / srcTrans->block.size;
+ dstStride = dstTrans->stride / dstTrans->block.size;
+
_mesa_generate_mipmap_level(target, datatype, comps,
0 /*border*/,
pt->width[srcLevel], pt->height[srcLevel], pt->depth[srcLevel],
srcData,
- srcTrans->stride, /* stride in bytes */
+ srcStride, /* stride in texels */
pt->width[dstLevel], pt->height[dstLevel], pt->depth[dstLevel],
dstData,
- dstTrans->stride); /* stride in bytes */
+ dstStride); /* stride in texels */
screen->transfer_unmap(screen, srcTrans);
screen->transfer_unmap(screen, dstTrans);