09-19-2017, 09:33 AM
Hi gdkchan, good job at trying to unravel this tile addressing on your own!
I came across this thread while googling to see if anyone else had managed to make a BNTX loader yet, and I thought you might like to know that this is a well-documented tiling method called Block Linear tiling, or "BlockLinearGOB" as exposed in the latest release of Noesis. A complete description can be found in the Tegra X1 TRM, which is floating around online and freely accessible on nvidia's developer site. Each GoB (group of bytes) is 512 bytes, and from the looks of it, what your code is doing is effectively trying to compensate for different block heights.
The key bit for BNTX is that you need to respect the texture info's mip0 block height field (it is not always 4/16, some BNTX files explicitly use 0 to force a block height of 1), then you need to mimic the expected GPU behavior of fitting the block height to each mip above mip0. Noesis also has a BNTX loader in its latest release, which mimics the algorithm described in the TRM. So far it seems to load every BNTX I've been able to throw at it, but let me know if you come across anything that fails.
I just made this account here and will probably forget to check back, but feel free to message me if you have any questions!
I came across this thread while googling to see if anyone else had managed to make a BNTX loader yet, and I thought you might like to know that this is a well-documented tiling method called Block Linear tiling, or "BlockLinearGOB" as exposed in the latest release of Noesis. A complete description can be found in the Tegra X1 TRM, which is floating around online and freely accessible on nvidia's developer site. Each GoB (group of bytes) is 512 bytes, and from the looks of it, what your code is doing is effectively trying to compensate for different block heights.
The key bit for BNTX is that you need to respect the texture info's mip0 block height field (it is not always 4/16, some BNTX files explicitly use 0 to force a block height of 1), then you need to mimic the expected GPU behavior of fitting the block height to each mip above mip0. Noesis also has a BNTX loader in its latest release, which mimics the algorithm described in the TRM. So far it seems to load every BNTX I've been able to throw at it, but let me know if you come across anything that fails.
I just made this account here and will probably forget to check back, but feel free to message me if you have any questions!