Module: Mesa
Branch: master
Commit: 98add55fffc29e0c40859fd5e9cec47fa1e352f5
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=98add55fffc29e0c40859fd5e9cec47fa1e352f5

Author: Francisco Jerez <curroje...@riseup.net>
Date:   Fri Sep 17 20:56:48 2010 +0200

dri/nv10-nv20: Fix texturing in some cases after a base level change.

---

 src/mesa/drivers/dri/nouveau/nouveau_texture.c |   17 ++++++++---------
 src/mesa/drivers/dri/nouveau/nv10_state_tex.c  |    2 +-
 src/mesa/drivers/dri/nouveau/nv20_state_tex.c  |    2 +-
 3 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c 
b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index d86f78b..b2f6faf 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -178,7 +178,7 @@ nouveau_choose_tex_format(GLcontext *ctx, GLint 
internalFormat,
 }
 
 static GLboolean
-teximage_fits(GLcontext *ctx, struct gl_texture_object *t, int level)
+teximage_fits(struct gl_texture_object *t, int level)
 {
        struct nouveau_surface *s = &to_nouveau_texture(t)->surfaces[level];
        struct gl_texture_image *ti = t->Image[0][level];
@@ -186,8 +186,7 @@ teximage_fits(GLcontext *ctx, struct gl_texture_object *t, 
int level)
        if (!ti || !to_nouveau_teximage(ti)->surface.bo)
                return GL_FALSE;
 
-       if (context_chipset(ctx) < 0x10 &&
-           level == t->BaseLevel && (s->offset & 0x7f))
+       if (level == t->BaseLevel && (s->offset & 0x7f))
                return GL_FALSE;
 
        return t->Target == GL_TEXTURE_RECTANGLE ||
@@ -202,7 +201,7 @@ validate_teximage(GLcontext *ctx, struct gl_texture_object 
*t,
 {
        struct gl_texture_image *ti = t->Image[0][level];
 
-       if (teximage_fits(ctx, t, level)) {
+       if (teximage_fits(t, level)) {
                struct nouveau_surface *ss = to_nouveau_texture(t)->surfaces;
                struct nouveau_surface *s = &to_nouveau_teximage(ti)->surface;
 
@@ -290,8 +289,8 @@ nouveau_texture_validate(GLcontext *ctx, struct 
gl_texture_object *t)
        struct nouveau_texture *nt = to_nouveau_texture(t);
        int i, last = get_last_level(t);
 
-       if (!teximage_fits(ctx, t, t->BaseLevel) ||
-           !teximage_fits(ctx, t, last))
+       if (!teximage_fits(t, t->BaseLevel) ||
+           !teximage_fits(t, last))
                return GL_FALSE;
 
        if (nt->dirty) {
@@ -314,8 +313,8 @@ nouveau_texture_validate(GLcontext *ctx, struct 
gl_texture_object *t)
 void
 nouveau_texture_reallocate(GLcontext *ctx, struct gl_texture_object *t)
 {
-       if (!teximage_fits(ctx, t, t->BaseLevel) ||
-           !teximage_fits(ctx, t, get_last_level(t))) {
+       if (!teximage_fits(t, t->BaseLevel) ||
+           !teximage_fits(t, get_last_level(t))) {
                texture_dirty(t);
                relayout_texture(ctx, t);
                nouveau_texture_validate(ctx, t);
@@ -377,7 +376,7 @@ nouveau_teximage(GLcontext *ctx, GLint dims, GLenum target, 
GLint level,
        }
 
        if (level == t->BaseLevel) {
-               if (!teximage_fits(ctx, t, level))
+               if (!teximage_fits(t, level))
                        relayout_texture(ctx, t);
                nouveau_texture_validate(ctx, t);
        }
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c 
b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
index 6dedb18..6961ccb 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
@@ -225,7 +225,7 @@ nv10_emit_tex_obj(GLcontext *ctx, int emit)
                        bo_flags | NOUVEAU_BO_OR);
 
        nouveau_bo_markl(bctx, celsius, NV10TCL_TX_OFFSET(i),
-                        s->bo, 0, bo_flags);
+                        s->bo, s->offset, bo_flags);
 
        BEGIN_RING(chan, celsius, NV10TCL_TX_FILTER(i), 1);
        OUT_RING(chan, tx_filter);
diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c 
b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c
index 2d45513..ea6b9b9 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c
@@ -236,7 +236,7 @@ nv20_emit_tex_obj(GLcontext *ctx, int emit)
                        bo_flags | NOUVEAU_BO_OR);
 
        nouveau_bo_markl(bctx, kelvin, NV20TCL_TX_OFFSET(i),
-                        s->bo, 0, bo_flags);
+                        s->bo, s->offset, bo_flags);
 
        BEGIN_RING(chan, kelvin, NV20TCL_TX_WRAP(i), 1);
        OUT_RING(chan, tx_wrap);

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to