Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

NW > Textures (BNTX)

This is the texture archive format that is used on the Nintendo Switch and Switch 2. This page describes version 4.0.0 of the file format.

A BNTX file can contain multiple textures.

OffsetSizeDescription
0x032Binary file header (BNTX\0\0\0\0)
0x2056Texture container data
0x58320Memory pool (filled with zeros)
0x1988 * NAddresses of nn::gfx::ResTexture blocks (relocated)
String pool
nn::gfx::ResTexture blocks
Texture data block
Relocation table

A BNTX file contains two relocations sections:

  • The first section contains addresses that point into the file header, string table or a nn::gfx::ResTexture block.
  • The second section contains addresses that point into the texture data block.

Pointers that are relocated are marked as such on this page.

Texture Container Data

OffsetSizeDescription
0x204Platform (NX or OUNC)
0x244Number of textures (N)
0x288Address of texture pointers (relocated)
0x308Address of texture data block (relocated)
0x388Address of dictionary (relocated)
0x408Address of memory pool (relocated)
0x4816Padding

Memory Pool

This section is only used at runtime and always contains 320 null bytes in the file.

String Pool

This is a standard string pool section, except there is a dictionary embedded in the string pool section behind the strings.

The dictionary contains the texture names.

nn::gfx::ResTexture

This contains information about a texture. There is one nn::gfx::ResTexture block per texture.

OffsetSizeDescription
0x016Block header (BRTI)
0x1064Texture information
0x504Image data size
0x544Image data alignment
0x581Channel mapping (red)
0x591Channel mapping (green)
0x5A1Channel mapping (blue)
0x5B1Channel mapping (alpha)
0x5C1Image dimension
0x5D3Padding
0x608Address of texture name in string pool (relocated)
0x688Address of texture container data (relocated)
0x708Address of mipmap address table (relocated)
0x788Address of user data (relocated)
0x808Address of texture object (relocated)
0x888Address of texture view (relocated)
0x908Filled at runtime, always 0
0x988Unknown
0xA0256Texture object (filled at runtime, always 0)
0x1A0256Texture view (filled at runtime, always 0)
0x2A0Mipmap address table (8 bytes per mipmap, relocated)

nn::gfx::TextureInfo

OffsetSizeDescription
0x01Flags
0x11Storage dimension
0x22Tile mode
0x42Swizzle value
0x62Mipmap count
0x82Multisample count
0xA2Padding
0xC4Image format
0x104Usage flags
0x144Width
0x184Height
0x1C4Depth
0x204Array length
0x248Packaged texture layout
0x2C20Padding

nn::gfx::ImageStorageDimension

ValueDescription
11D
22D
33D

nn::gfx::ImageDimension

ValueDescription
01D
12D
23D
3Cube map
41D array
52D array
8Cube map array

nn::gfx::ImageFormat

The image format is encoded as (channel_format << 8) | type_format.

nn::gfx::TypeFormat

ValueDescription
1UNORM
2SNORM
3UINT
4SINT
5SINGLE
6SRGB
7UHALF

nn::gfx::ChannelFormat

ValueDescription
2R8
3RGBA4
5RGB5A1
6A1BGR5
7RGB565
8BGR565
9RG8
10R16
11RGBA8
12BGRA8
13RGB9E5
14RGB10A2
15R11G11B10
18RG16
19DEPTH24_STENCIL8
20R32
21RGBA16
22DEPTH32_STENCIL8
23RG32
24RGB32
25RGBA32
26RGBA_DXT1
27RGBA_DXT3
28RGBA_DXT5
29RGTC1
30RGTC2
31BPTC_FLOAT
32BPTC_UNORM
45RGBA_ASTC_4x4
46RGBA_ASTC_5x4
47RGBA_ASTC_5x5
48RGBA_ASTC_6x5
49RGBA_ASTC_6x6
50RGBA_ASTC_8x5
51RGBA_ASTC_8x6
52RGBA_ASTC_8x8
53RGBA_ASTC_10x5
54RGBA_ASTC_10x6
55RGBA_ASTC_10x8
56RGBA_ASTC_10x10
57RGBA_ASTC_12x10
58RGBA_ASTC_12x12
59BGR5A1

nn::gfx::TileMode

ValueDescription
0Swizzled
1Linear

nn::gfx::ChannelMapping

ValueDescription
0Constant zero
1Constant one
2Red
3Green
4Blue
5Alpha

Texture Data Block

OffsetSizeDescription
0x016Block header (BRTD)
0x10Raw texture data

The block header is placed so that the raw texture data is aligned on the required byte boundary.

References