GXT: Difference between revisions

From Vita Developer wiki
Jump to navigation Jump to search
(Created page with "Category:Software<noinclude>Category:Main</noinclude> <div style="color: #ffffff; background-color: #475854; border: 1px solid #808000; padding: 5px; {{box-shadow|4px...")
 
(→‎Texture Base Format: via https://zenhax.com/viewtopic.php?p=37727#p37727)
 
(12 intermediate revisions by one other user not shown)
Line 1: Line 1:
[[Category:Software]]<noinclude>[[Category:Main]]</noinclude>
[[Category:Software]]<noinclude>[[Category:Main]]</noinclude>
<div style="float:right">[[File:Texture-Icon-BB.JPG|100px|thumb|left|Standard test image widely used]]</div>


<div style="color: #ffffff; background-color: #475854; border: 1px solid #808000; padding: 5px; {{box-shadow|4px|4px|8px|#b0b090}}">
<div style="color: #ffffff; background-color: #475854; border: 1px solid #808000; padding: 5px; {{box-shadow|4px|4px|8px|#b0b090}}">
Gxt is a container for storing one or multiple graphic textures for the PSVita and PSP.
GXT is a file format (used on PS Vita and PSP) for storing textures. The purpose of this format is to use it in the runtime without any additional formatting of the data.  
</div>
</div>
== Features ==
*Memory ready format
*Supports multiple textures in one file
*Supports compressed, swizzled, and linear texture layouts
*Supports mipmaps
*Suports palettized textures


== File format ==
== File format ==
The GXT (.gxt) format consists of:
The GXT (.gxt) format consists of:


Header (for single texture):
{| class="wikitable" style="text-align: center;"
|-
! style="background-color:#475854; color:#FFFFFF;" |'''File Layout'''
|-
| style="background-color:lightblue; color:#000000;" |'''GXT Header'''
|-
| style="background-color:lightblue; color:#000000;" |'''GXT Specification Texture 1 info'''
|-
| style="background-color:lightblue; color:#000000;" |'''GXT Specification Texture 2 info'''
|-
| style="background-color:lightblue; color:#000000;" |'''...'''
|-
| style="background-color:lightblue; color:#000000;" |'''Texture 1'''
|-
| style="background-color:lightblue; color:#000000;" |'''Padding'''
|-
| style="background-color:lightblue; color:#000000;" |'''Texture 2'''
|-
| style="background-color:lightblue; color:#000000;" |'''...'''
|-
| style="background-color:lightblue; color:#000000;" |'''Palette P4'''
|-
| style="background-color:lightblue; color:#000000;" |'''Palette P8'''
|-
|}
 
*For a single texture:


{| class="wikitable" style="text-align: center;"
{| class="wikitable" style="text-align: center;"
Line 22: Line 58:
| 0x00 || 0x04 || 47 58 54 00 || "GXT " || Magic
| 0x00 || 0x04 || 47 58 54 00 || "GXT " || Magic
|-
|-
| 0x04 || 0x04 || 03 00 00 10 || || Version
| 0x04 || 0x04 || 03 00 00 10 || 3.01 || Version
|-
| 0x08 || 0x04 || 01 00 00 00 || 1 || Number of textures embedded
|-
| 0x0C || 0x04 || 40 00 00 00 || 0x40 || Offset of the texture data/ header size
|-
| 0x10 || 0x04 || 00 00 02 00 || 0x20000 || Total size of the Textures
|-
| 0x14 || 0x04 || 00 00 00 00 || 0 || Number of 16 entry palettes (P4)
|-
| 0x18 || 0x04 || 00 00 00 00 || 0 || Number of 256 entry palettes (P8)
|-
| 0x1C || 0x04 || 00 00 00 00 || 0 || Padding
|-
|colspan="5" style="text-align:center; background-color:lightblue;" | <span style="color:black;">GXT specification per texture</span>
|-
| 0x20 || 0x04 || 40 00 00 00 || 0x40 || Offset of the single texture data
|-
| 0x24 || 0x04 || 00 00 02 00 || 0x20000 || Size of the single texture data.
|-
| 0x28 || 0x04 || FF FF FF FF || - || Index of the palette
|-
|-
| 0x08 || 0x04 || 01 00 00 00 || 40 || Number of textures embedded
| 0x2C || 0x04 || 00 00 00 00 || - || Texture flags/Not used?
|-
|-
| 0x0C || 0x04 || 40 00 00 00 || 40 || Offset of the texture data
| 0x30 || 0x04 || 00 00 00 00 || - || Texture Type
|-
|-
| 0x10 || 0x04 || 00 00 00 80 || || Number of 16 entry palettes
| 0x34 || 0x04 || 00 00 00 85 || 0x85000000 (DXT1) || Texture Base Format
|-
|-
| 0x14 || 0x04 || 00 00 00 00 || || Number of 256 entry palettes
| 0x38 || 0x02  || 00 02 || 0x200 (512) || Width
|-
|-
| 0x18 || 0x08 || 00 ... 00  || 00 || Padding
| 0x3A || 0x02  || 00 02 || 0x200 (512) || Height
|-
|-
|colspan="5" style="text-align:center; background-color:lightblue;" | <span style="color:black;">GXT specification</span>
| 0x3C || 0x02 || - || - || Mipmaps
|-
|-
| 0x20 || 0x04  || 40 00 00 00 || 40 || Offset to the texture data relative to the start of the file
| 0x3E || 0x02 || - || - || Not Used?/Padding
|-
|-
|}
|}
=== Texture type ===
{| class="wikitable" style="text-align: center;"
|-
| style="background-color:#475854; color:#FFFFFF;" |'''Name'''
| style="background-color:#475854; color:#FFFFFF;" |'''Value (h)'''
| style="background-color:#475854; color:#FFFFFF;" |'''Description'''
|-
|colspan="5" style="text-align:center; background-color:lightblue;" | <span style="color:black;">Texture Type</span>
|-
| SWIZZLED || 0x00 ||
|-
| CUBE || 0x40 ||
|-
| LINEAR || 0x60 ||
|-
| TILED || 0x80 ||
|-
| LINEAR STRIDED || 0x0C ||
|-
|}
=== Texture Base Format ===
{| class="wikitable" style="text-align: center;"
|-
| style="background-color:#475854; color:#FFFFFF;" |'''Name'''
| style="background-color:#475854; color:#FFFFFF;" |'''Value (h)'''
| style="background-color:#475854; color:#FFFFFF;" |'''Description'''
|-
|colspan="5" style="text-align:center; background-color:lightblue;" | <span style="color:black;">Texture Base Format</span>
|-
| PVRT2BPP || 00 00 00 80 || PVR 2 bits per pixel mode
|-
| PVRT4BPP || 00 00 00 81 || PVR 4 bits per pixel mode
|-
| PVRTII2BPP || 00 00 00 82 || PVR II 2 bits per pixel mode
|-
| PVRTII4BPP || 00 00 00 83 || PVR II  4 bits per pixel mode
|-
| UBC1 || 00 00 00 85 || DXT1 4 bits per pixel, no alpha
|-
| UBC2 || 00 00 00 86 || DXT3 8 bits per pixel
|-
| UBC3 || 00 00 00 87 || DXT5 8 bits per pixel
|-
| || 10 00 04 00 || 1555
|-
| || 00 00 00 10 || ARGB4444
|-
| || 00 10 00 0C || ARGB8888
|-
| || 00 50 00 0C || XRGB888
|-
| || 00 10 00 98 || RGB888
|-
| || 00 10 00 05 || RGB565
|-
| || 00 50 00 04 || RGB555
|-
| || 00 10 00 02 || RGB4444
|-
|}
*[[PVR|PVR file format]]
*[[DXT|DXT file format]]

Latest revision as of 05:19, 3 March 2019


Standard test image widely used

GXT is a file format (used on PS Vita and PSP) for storing textures. The purpose of this format is to use it in the runtime without any additional formatting of the data.

Features[edit | edit source]

  • Memory ready format
  • Supports multiple textures in one file
  • Supports compressed, swizzled, and linear texture layouts
  • Supports mipmaps
  • Suports palettized textures

File format[edit | edit source]

The GXT (.gxt) format consists of:

File Layout
GXT Header
GXT Specification Texture 1 info
GXT Specification Texture 2 info
...
Texture 1
Padding
Texture 2
...
Palette P4
Palette P8
  • For a single texture:
Offset (h) Size (h) Example (h) Value (conversion) Notes
GXT header
0x00 0x04 47 58 54 00 "GXT " Magic
0x04 0x04 03 00 00 10 3.01 Version
0x08 0x04 01 00 00 00 1 Number of textures embedded
0x0C 0x04 40 00 00 00 0x40 Offset of the texture data/ header size
0x10 0x04 00 00 02 00 0x20000 Total size of the Textures
0x14 0x04 00 00 00 00 0 Number of 16 entry palettes (P4)
0x18 0x04 00 00 00 00 0 Number of 256 entry palettes (P8)
0x1C 0x04 00 00 00 00 0 Padding
GXT specification per texture
0x20 0x04 40 00 00 00 0x40 Offset of the single texture data
0x24 0x04 00 00 02 00 0x20000 Size of the single texture data.
0x28 0x04 FF FF FF FF - Index of the palette
0x2C 0x04 00 00 00 00 - Texture flags/Not used?
0x30 0x04 00 00 00 00 - Texture Type
0x34 0x04 00 00 00 85 0x85000000 (DXT1) Texture Base Format
0x38 0x02 00 02 0x200 (512) Width
0x3A 0x02 00 02 0x200 (512) Height
0x3C 0x02 - - Mipmaps
0x3E 0x02 - - Not Used?/Padding

Texture type[edit | edit source]

Name Value (h) Description
Texture Type
SWIZZLED 0x00
CUBE 0x40
LINEAR 0x60
TILED 0x80
LINEAR STRIDED 0x0C

Texture Base Format[edit | edit source]

Name Value (h) Description
Texture Base Format
PVRT2BPP 00 00 00 80 PVR 2 bits per pixel mode
PVRT4BPP 00 00 00 81 PVR 4 bits per pixel mode
PVRTII2BPP 00 00 00 82 PVR II 2 bits per pixel mode
PVRTII4BPP 00 00 00 83 PVR II 4 bits per pixel mode
UBC1 00 00 00 85 DXT1 4 bits per pixel, no alpha
UBC2 00 00 00 86 DXT3 8 bits per pixel
UBC3 00 00 00 87 DXT5 8 bits per pixel
10 00 04 00 1555
00 00 00 10 ARGB4444
00 10 00 0C ARGB8888
00 50 00 0C XRGB888
00 10 00 98 RGB888
00 10 00 05 RGB565
00 50 00 04 RGB555
00 10 00 02 RGB4444