[Mesa-dev] [PATCH] r300g: Fix the ATI1N swizzle.

Stefan Dösinger stefandoesinger at gmx.at
Mon Mar 9 09:11:08 PDT 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 2015-03-09 um 16:53 schrieb Stefan Dösinger:
> I did test if LATC_UNORM and LATC_SNORM still work after my fix. 
> LATC_SNORM is unchanged (broken in the same way as RGTC_SNORM) and 
> LATC_UNORM now has the proper precision like RGTC_UNORM.
I think the reason why _SNORM is broken is that the way the driver
tries to emulate them is conceptually broken. It handles them like the
_UNORM variant, but afterwards does a red = red > 0.5 ? red * 2 - 2 :
red * 2.

That may work for an uncompressed signed format, but it doesn't take
into account the block decompression of RGTC1. For example consider a
block that has red1 = 0x7f and red2 = 0x80. As an unsigned value, red2
is the bigger value(127 vs 128). If it is a signed value, red1 is
bigger (127 vs -128). The only way this will work is if the driver
adds +128 to red1 and red2 for each block before loading (sucks if
it's in a PBO) and after sampling does red = red * 2.0 - 1.0. And I'm
not even sure if that will work. It will at least break exact zeros.

Note that I don't care about the signed RGTC formats. Wine on this
card will only ever need the unsigned ones, as they match ATI1N and
ATI2N in d3d.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBAgAGBQJU/cYcAAoJEN0/YqbEcdMwdygQAIlgA+nSg42o/7xAOogeOHeq
IUf/3WKz0GVAhlA+wbli4UoxZgALUHf5PxWgshBvEZZgpzoEYAqpfTVLQm3cUXDd
p3eQkDyGucttgnt1zC5q1jNjkP2io114XRqcTwbMHmMJRfZavzNRK805UBuy1Jd4
sOuxsRT7cTnI+iCkbfqHBdyHo2OSegJ0FDpj35aGzpsc3cDQH9oW/jchryoQJo6V
luf3KvdyP5QQlmglp8I2V28n7uBypwVZywAxKg4jR00IalZXCXt/vj2SFBojDQal
z2Xr9xSz0ccoV+yFutbRwe8wuoUwTBpOFrpnZnx1PQ1RoG34plpgdLg5AVn/t8+A
5UJv5Op51y0KmWqDGadlGV+8RlpdDWCCV6dOdDsOJbrS1/gOJj3Z+VI8rdrrb4Tt
n/eY45OWoF3E0v73aMRLdr220wjgFWcgv7Je16xiER4oSemkCfSsl3kKD7RNy8rS
oNhd6VL18UcefgrssVLptWYI/M7M1Zs6tbtPmh6WIFjFFpikzIjX51UBrIppCIxr
YKZQ0HtML5PJ9JtdHJR6kjqCFKpNO5ZMZtY5HFOuSD+SAu0jnYpTqe/X0etrCy9r
PAKwuCLaOqciqANkhYQBq9quwvv9HwDa9huI0GxSk5xkEd5J4eTqxeKPAURkGx4Y
SBzv2N9WDEDhnGuzYgs9
=8Wzg
-----END PGP SIGNATURE-----


More information about the mesa-dev mailing list