ScarletNX / ScarletNX documentation / NVN reference · ← previous · next →
Measured against the game's driver
An earlier tree had a verify mode, which ran the game's own NVN driver beside the runtime's handlers on shadow
objects, decoded its pushbuffer, and compared each draw. It went with the old Maxwell decoder. What it measured is
below and in the comments that cite it, and what its first runs found is in
the NVN investigation.
Texture storage answers
Games place textures in their pools by nvnTextureBuilderGetStorageSize, GetStorageAlignment, GetStorageClass
and GetZCullStorageSize. nvn_tex_storage (gpu/nvn/nvn_tex.c) answers them with the rules read from two
drivers' code (NVN 12.3 and 55.15, the same rules):
- The kind (the class is 0x100 with it): 0 for a buffer or a linear texture. A depth or stencil format has a depth
kind. A COMPRESSIBLE color format of one-texel blocks and 4 bytes or more has a compression kind. Else 0xfe.
- The alignment: 0x80 for LINEAR_RENDER_TARGET, 0x20 for LINEAR, a buffer's element size, else 0x200. Every kind but 0
and 0xfe takes the big page, 64 KiB, and its size is rounded up to it.
- The ZCull area: 0 for a format without depth bits (stencil only counts with ZCULL_SUPPORT_STENCIL). Else 0x20 bytes
for each 32x32 tile of each layer, plus 0xE0 of headers (nvdrv's ZCULL_GET_INFO answer).
- A multisampled or rectangle texture has one level, whatever the builder says.
- A SPARSE block-linear texture is mapped in 64 KiB tiles of the standard shapes (2D 256x256 to 64x64 blocks, 3D
64x32x32 to 16x16x16, by the block's bytes): its blocks are as high and deep as the tile, a level at least a tile
wide, high and deep has rows of whole tiles, and the storage is whole tiles. Each page is then one tile, the tiles
across, down and deep, where the game maps it, whether or not the texture ends inside its last tile across. Its
texture header gives the tile's GOBs across (word 3 bits 10-12, log2), as the driver writes it, and the renderer
pads the same rows with it.
The layout (nvn_tex_layout) stays the texture's extent, which tests/nvn_tex_storage.c keeps inside the answered
size over targets, formats, sizes, levels, samples and flags. The verify mode's storage sweep ran the driver's
getters and nvn's on the same 7,986 builder states at the game's first query: sizes, alignments and ZCull areas
agreed.
The compression kinds agree too, over the swept formats: a compression kind has one value for no multisampling and one
more at 2, 4 and 8 samples (depth: the base kind plus 0, 1, 2, 3; color: a table by element size). The 8-sample
kinds and the formats outside the sweep are extrapolated from that pattern.
← previous · next →