nv50: fix typo: s/_/./
[mesa.git] / src / gallium / drivers / nv50 / nv50_tex.c
index aa885e716880d4eec9a836689f63cfe8a6eee18d..5ea0c1d726452e6ab7b20d83f50edf4dc82f9018 100644 (file)
@@ -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),
@@ -105,7 +106,7 @@ nv50_tex_construct(struct nv50_sampler_view *view)
        struct nv50_miptree *mt = nv50_miptree(view->pipe.texture);
        uint32_t swz[4], *tic = view->tic;
 
-       tic[0] = nv50_texture_formats[mt->base.base.format];
+       tic[0] = nv50_texture_formats[view->pipe.format];
 
        swz[0] = nv50_tic_swizzle(tic[0], view->pipe.swizzle_r);
        swz[1] = nv50_tic_swizzle(tic[0], view->pipe.swizzle_g);
@@ -152,8 +153,7 @@ nv50_tex_construct(struct nv50_sampler_view *view)
 
        tic[6] = 0x03000000;
 
-       tic[7] = (view->pipe.last_level - view->pipe.first_level) << 4;
-       tic[7] |= view->pipe.first_level;
+       tic[7] = (view->pipe.last_level << 4) | view->pipe.first_level;
 
        return TRUE;
 }
@@ -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)
 {