SHBIN

From 3dbrew
Revision as of 11:45, 23 February 2014 by Smea (talk | contribs)
Jump to navigation Jump to search

Overview

The SHBIN (SHader BINary) file is used to contain compiled and linked shader programs. These can include vertex shaders (typically compiled from .vsh files) and geometry shaders (typically compiled from .gsh files, though .asm have been observed). In commercial games/apps, SHBIN files can be found as standalone files with the extension .shbin, or contained within .bcsdr files. BCSDR files use CGFX as a container, but the underlying DVLB/DVLP/DVLE structure remains unchanged.

A SHBIN's structure starts with a header, then a DVLP, then DVLE(s).

Header

OFFSET SIZE DESCRIPTION
0x0 0x4 MAGIC "DVLB"
0x4 0x4 Amount of DVLEs in SHBIN
0x8 0x4 DVLE 1 offset

If there is more than 1 DVLE ( Amount > 0x01 ) the header continues with more offsets.

So if there are 3 DVLEs then 0xC would be DVLE 2's offset, 0x10 would be DVLE 3's offset, ect...

The DVLP file comes directly after the header.

DVLP

OFFSET SIZE DESCRIPTION
0x0 0x4 MAGIC "DVLP"

Contains ASM of the VSH?

DVLE

OFFSET SIZE DESCRIPTION
0x0 0x4 MAGIC "DVLE"

Contains registers of the VSH?