From 948e9f7c887158835c82881c73d4f728937d19f7 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sun, 11 Apr 2010 11:36:34 +0200 Subject: [PATCH] nv50: fix texture relocs The new address should go to TIC entries 1, 2 instead of entry 0. Also, using PIPE_SHADER_* for the program type was wrong, they're ordered like the tesla method now, sorry for the confusion. --- src/gallium/drivers/nv50/nv50_tex.c | 50 ++++++++++++++++------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_tex.c b/src/gallium/drivers/nv50/nv50_tex.c index 2c628db97da..5ea0c1d7264 100644 --- a/src/gallium/drivers/nv50/nv50_tex.c +++ b/src/gallium/drivers/nv50/nv50_tex.c @@ -183,8 +183,10 @@ nv50_validate_textures(struct nv50_context *nv50, struct nouveau_stateobj *so, struct nv50_miptree *mt = nv50_miptree(view->pipe.texture); + tic2 &= ~NV50TIC_0_2_NORMALIZED_COORDS; if (nv50->sampler[p][unit]->normalized) tic2 |= NV50TIC_0_2_NORMALIZED_COORDS; + view->tic[2] = tic2; so_data (so, view->tic[0]); so_reloc (so, mt->base.bo, 0, rll, 0, 0); @@ -214,37 +216,39 @@ nv50_validate_textures(struct nv50_context *nv50, struct nouveau_stateobj *so, return TRUE; } -void -nv50_tex_relocs(struct nv50_context *nv50) +static void +nv50_emit_texture_relocs(struct nv50_context *nv50, int prog) { - struct nouveau_channel *chan = nv50->screen->tesla->channel; - int p, unit; + struct nouveau_channel *chan = nv50->screen->base.channel; + struct nouveau_bo *tic = nv50->screen->tic; + int unit; - p = PIPE_SHADER_FRAGMENT; - for (unit = 0; unit < nv50->sampler_view_nr[p]; unit++) { - struct pipe_sampler_view *view = nv50->sampler_views[p][unit]; - if (!view) - continue; - nouveau_reloc_emit(chan, nv50->screen->tic, - ((p * 32) + unit) * 32, NULL, - nv50_miptree(view->texture)->base.bo, 0, 0, - NOUVEAU_BO_VRAM | NOUVEAU_BO_LOW | - NOUVEAU_BO_RD, 0, 0); - } + for (unit = 0; unit < nv50->sampler_view_nr[prog]; unit++) { + struct nv50_sampler_view *view; + struct nv50_miptree *mt; + const unsigned base = ((prog * 32) + unit) * 32; - p = PIPE_SHADER_VERTEX; - for (unit = 0; unit < nv50->sampler_view_nr[p]; unit++) { - struct pipe_sampler_view *view = nv50->sampler_views[p][unit]; + view = nv50_sampler_view(nv50->sampler_views[prog][unit]); if (!view) continue; - nouveau_reloc_emit(chan, nv50->screen->tic, - ((p * 32) + unit) * 32, NULL, - nv50_miptree(view->texture)->base.bo, 0, 0, - NOUVEAU_BO_VRAM | NOUVEAU_BO_LOW | - NOUVEAU_BO_RD, 0, 0); + mt = nv50_miptree(view->pipe.texture); + + nouveau_reloc_emit(chan, tic, base + 4, NULL, mt->base.bo, 0, 0, + NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | + NOUVEAU_BO_LOW, 0, 0); + nouveau_reloc_emit(chan, tic, base + 8, NULL, mt->base.bo, 0, 0, + NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | + NOUVEAU_BO_HIGH, view->tic[2], view->tic[2]); } } +void +nv50_tex_relocs(struct nv50_context *nv50) +{ + nv50_emit_texture_relocs(nv50, 2); /* FP */ + nv50_emit_texture_relocs(nv50, 0); /* VP */ +} + struct nouveau_stateobj * nv50_tex_validate(struct nv50_context *nv50) { -- 2.30.2