nouveau: Fix glTexSubImage on swizzled surfaces on <=NV40
authorLuca Barbieri <luca@luca-barbieri.com>
Wed, 30 Dec 2009 01:54:39 +0000 (02:54 +0100)
committerFrancisco Jerez <currojerez@riseup.net>
Wed, 30 Dec 2009 13:37:19 +0000 (14:37 +0100)
commit9656177bc0fac5785d01900a768c2855bdc04b5a
treeea17536e44438bde6735a8e1fcc61b54a194e137
parent1677d5c0aebe8edb54aa3236294acede536013f3
nouveau: Fix glTexSubImage on swizzled surfaces on <=NV40

Currently in nvXX_transfer_new a temporary as large as the surface is created.
If the subrectangle is not the whole texture we would need to read
back the whole texture, but we aren't.
Thus, everything but the subrectangle specified is loaded as garbage.
This can be seen in progs/demos/ray.

This patch fixes the problem by creating a temporary that covers only
the desired subrectangle.

That makes us hit an alignment assert in nv04_surface_2d.c. Fix it
using the point registers instead of manipulating the swizzled surface
offset to account for the destination coordinates (which do not seem
to have a 1024 limit).

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
src/gallium/drivers/nv04/nv04_surface_2d.c
src/gallium/drivers/nv04/nv04_transfer.c
src/gallium/drivers/nv10/nv10_transfer.c
src/gallium/drivers/nv20/nv20_transfer.c
src/gallium/drivers/nv30/nv30_transfer.c
src/gallium/drivers/nv40/nv40_transfer.c