diff options
author | Francisco Jerez <[email protected]> | 2010-09-15 01:56:04 +0200 |
---|---|---|
committer | Francisco Jerez <[email protected]> | 2010-09-16 19:44:21 +0200 |
commit | bec626ff63ad1d5c7c3e4b5b1d7a741e4f7d55ac (patch) | |
tree | dd65de1371423cb6b8a07e481276df0bda275ce4 /src | |
parent | aa317a40ced575024924ef5697fc0b96c76e3d90 (diff) |
dri/nv04: Mipmapping fixes.
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nouveau_texture.c | 28 | ||||
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nv04_state_tex.c | 8 |
2 files changed, 21 insertions, 15 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c b/src/mesa/drivers/dri/nouveau/nouveau_texture.c index 442f4e899ee..d86f78b4371 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c @@ -178,15 +178,21 @@ nouveau_choose_tex_format(GLcontext *ctx, GLint internalFormat, } static GLboolean -teximage_fits(struct gl_texture_object *t, int level) +teximage_fits(GLcontext *ctx, 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]; - return ti && to_nouveau_teximage(ti)->surface.bo && - (t->Target == GL_TEXTURE_RECTANGLE || - (s->bo && s->format == ti->TexFormat && - s->width == ti->Width && s->height == ti->Height)); + if (!ti || !to_nouveau_teximage(ti)->surface.bo) + return GL_FALSE; + + if (context_chipset(ctx) < 0x10 && + level == t->BaseLevel && (s->offset & 0x7f)) + return GL_FALSE; + + return t->Target == GL_TEXTURE_RECTANGLE || + (s->bo && s->format == ti->TexFormat && + s->width == ti->Width && s->height == ti->Height); } static GLboolean @@ -196,7 +202,7 @@ validate_teximage(GLcontext *ctx, struct gl_texture_object *t, { struct gl_texture_image *ti = t->Image[0][level]; - if (teximage_fits(t, level)) { + if (teximage_fits(ctx, t, level)) { struct nouveau_surface *ss = to_nouveau_texture(t)->surfaces; struct nouveau_surface *s = &to_nouveau_teximage(ti)->surface; @@ -284,8 +290,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(t, t->BaseLevel) || - !teximage_fits(t, last)) + if (!teximage_fits(ctx, t, t->BaseLevel) || + !teximage_fits(ctx, t, last)) return GL_FALSE; if (nt->dirty) { @@ -308,8 +314,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(t, t->BaseLevel) || - !teximage_fits(t, get_last_level(t))) { + if (!teximage_fits(ctx, t, t->BaseLevel) || + !teximage_fits(ctx, t, get_last_level(t))) { texture_dirty(t); relayout_texture(ctx, t); nouveau_texture_validate(ctx, t); @@ -371,7 +377,7 @@ nouveau_teximage(GLcontext *ctx, GLint dims, GLenum target, GLint level, } if (level == t->BaseLevel) { - if (!teximage_fits(t, level)) + if (!teximage_fits(ctx, t, level)) relayout_texture(ctx, t); nouveau_texture_validate(ctx, t); } diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_tex.c b/src/mesa/drivers/dri/nouveau/nv04_state_tex.c index 6d8762b7d1e..4ac8327b871 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_state_tex.c +++ b/src/mesa/drivers/dri/nouveau/nv04_state_tex.c @@ -103,7 +103,7 @@ nv04_emit_tex_obj(GLcontext *ctx, int emit) 0, 15) + 1; lod_bias = CLAMP(ctx->Texture.Unit[i].LodBias + - t->LodBias, 0, 15); + t->LodBias, -16, 15) * 8; } format |= get_wrap_mode(t->WrapT) << 28 | @@ -117,7 +117,7 @@ nv04_emit_tex_obj(GLcontext *ctx, int emit) nvgl_filter_mode(t->MagFilter) << 28 | log2i(t->MaxAnisotropy) << 27 | nvgl_filter_mode(t->MinFilter) << 24 | - lod_bias << 16; + (lod_bias & 0xff) << 16; } else { s = &to_nv04_context(ctx)->dummy_texture; @@ -134,7 +134,7 @@ nv04_emit_tex_obj(GLcontext *ctx, int emit) if (nv04_mtex_engine(fahrenheit)) { nouveau_bo_markl(bctx, fahrenheit, NV04_MULTITEX_TRIANGLE_OFFSET(i), - s->bo, 0, bo_flags); + s->bo, s->offset, bo_flags); nouveau_bo_mark(bctx, fahrenheit, NV04_MULTITEX_TRIANGLE_FORMAT(i), @@ -149,7 +149,7 @@ nv04_emit_tex_obj(GLcontext *ctx, int emit) } else { nouveau_bo_markl(bctx, fahrenheit, NV04_TEXTURED_TRIANGLE_OFFSET, - s->bo, 0, bo_flags); + s->bo, s->offset, bo_flags); nouveau_bo_mark(bctx, fahrenheit, NV04_TEXTURED_TRIANGLE_FORMAT, |