}
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
{
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;
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) {
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);
}
if (level == t->BaseLevel) {
- if (!teximage_fits(t, level))
+ if (!teximage_fits(ctx, t, level))
relayout_texture(ctx, t);
nouveau_texture_validate(ctx, t);
}
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 |
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;
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),
} 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,