summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/nvfx/nv40_fragtex.c
diff options
context:
space:
mode:
authorLuca Barbieri <luca@luca-barbieri.com>2010-01-15 10:11:11 +0100
committerLuca Barbieri <luca@luca-barbieri.com>2010-08-21 20:42:14 +0200
commited2930e7e2c064458da33089cff902574008bf30 (patch)
tree34f3e56774f1bf861fca7c3d589f09801061c78b /src/gallium/drivers/nvfx/nv40_fragtex.c
parentac97e8dba654b9b3c5a9459953ce27056bcbb021 (diff)
nvfx: new 2D: rewrite miptree code, adapt transfers
Changes: - Disable swizzling on non-RGBA 2D textures, since the current 2D code is mostly broken in those cases. A later patch will fix this. Thanks to Andrew Randrianasulu who reported this. - Fix compressed texture transfers and hack around the current 2D code inability to copy compressed textures by using direct access. Thanks to Andrew Randrianasulu who reported this. This patch rewrites all the miptree layout and transfer code in the nvfx driver. The current code is broken in several ways: 1. 3D textures are laid out first by face, then by level, which is incorrect 2. Cube maps should have 128-byte aligned faces 3. Swizzled textures have a strange alignment test that seems unnecessary 4. We store the image_offsets for each face/slice but they can be easily computed instead 5. "Swizzling" is not supported for compressed formats. They can be "swizzled" but swizzling only means that there are no gaps (pitch is level-dependant) and the layout is still linear 6. Swizzling is not supported for non-RGBA formats. All formats (except possibly depth) can be swizzled according to my testing. The miptree layout is rewritten based on my empirical testing, which I posted in the "miptree findings" mail. The image_offset array is removed, since it can be calculated with a simple multiplication; the only array in the miptree structure is now the one for mipmap level starts, which it seems cannot be easily computed in constant time. Also, we now directly store a nouveau_bo instead of a pipe_buffer in the miptree structure, like nv50 does. Support for render temporaries is removed, and will be readded in a later patch. Note that the current temporary code is broken, because it does not copy the temporary back on render cache flushes.
Diffstat (limited to 'src/gallium/drivers/nvfx/nv40_fragtex.c')
-rw-r--r--src/gallium/drivers/nvfx/nv40_fragtex.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/gallium/drivers/nvfx/nv40_fragtex.c b/src/gallium/drivers/nvfx/nv40_fragtex.c
index 0d3e90dcb0..45c34c7ffd 100644
--- a/src/gallium/drivers/nvfx/nv40_fragtex.c
+++ b/src/gallium/drivers/nvfx/nv40_fragtex.c
@@ -111,9 +111,9 @@ nv40_fragtex_set(struct nvfx_context *nvfx, int unit)
{
struct nouveau_channel* chan = nvfx->screen->base.channel;
struct nvfx_sampler_state *ps = nvfx->tex_sampler[unit];
- struct nvfx_miptree *nv40mt = (struct nvfx_miptree *)nvfx->fragment_sampler_views[unit]->texture;
- struct nouveau_bo *bo = nv40mt->base.bo;
- struct pipe_resource *pt = &nv40mt->base.base;
+ struct nvfx_miptree *mt = (struct nvfx_miptree *)nvfx->fragment_sampler_views[unit]->texture;
+ struct nouveau_bo *bo = mt->base.bo;
+ struct pipe_resource *pt = &mt->base.base;
struct nv40_texture_format *tf;
uint32_t txf, txs, txp;
@@ -149,10 +149,10 @@ nv40_fragtex_set(struct nvfx_context *nvfx, int unit)
return;
}
- if (!(pt->flags & NVFX_RESOURCE_FLAG_LINEAR)) {
+ if (!mt->linear_pitch)
txp = 0;
- } else {
- txp = nv40mt->level[0].pitch;
+ else {
+ txp = mt->linear_pitch;
txf |= NV40TCL_TEX_FORMAT_LINEAR;
}