X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fdrivers%2Fnv50%2Fnv50_tex.c;h=5ea0c1d726452e6ab7b20d83f50edf4dc82f9018;hb=23808f1b5e88373534c7ff546cdd89030ce1e935;hp=85ab947c0063eae6afb15cf51f4246e0db618100;hpb=f0f04cd12db156ec53b7ea46fae27199af121f90;p=mesa.git diff --git a/src/gallium/drivers/nv50/nv50_tex.c b/src/gallium/drivers/nv50/nv50_tex.c index 85ab947c006..5ea0c1d7264 100644 --- a/src/gallium/drivers/nv50/nv50_tex.c +++ b/src/gallium/drivers/nv50/nv50_tex.c @@ -22,6 +22,7 @@ #include "nv50_context.h" #include "nv50_texture.h" +#include "nv50_resource.h" #include "nouveau/nouveau_stateobj.h" #include "nouveau/nouveau_reloc.h" @@ -62,8 +63,8 @@ static const uint32_t nv50_texture_formats[PIPE_FORMAT_COUNT] = _(DXT3_RGBA, UNORM, C0, C1, C2, C3, DXT3), _(DXT5_RGBA, UNORM, C0, C1, C2, C3, DXT5), - _MIXED(S8Z24_UNORM, UINT, UNORM, UINT, UINT, C1, C1, C1, ONE, 24_8), - _MIXED(Z24S8_UNORM, UNORM, UINT, UINT, UINT, C0, C0, C0, ONE, 8_24), + _MIXED(S8_USCALED_Z24_UNORM, UINT, UNORM, UINT, UINT, C1, C1, C1, ONE, 24_8), + _MIXED(Z24_UNORM_S8_USCALED, UNORM, UINT, UINT, UINT, C0, C0, C0, ONE, 8_24), _(R16G16B16A16_SNORM, UNORM, C0, C1, C2, C3, 16_16_16_16), _(R16G16B16A16_UNORM, SNORM, C0, C1, C2, C3, 16_16_16_16), @@ -182,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); @@ -213,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) {