Difference between revisions of "SHBIN"

From 3dbrew
Jump to navigation Jump to search
m
Line 11: Line 11:
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
OFFSET
+
Offset
SIZE
+
Size
DESCRIPTION
+
Description
 
|-
 
|-
 
|  0x0
 
|  0x0
Line 21: Line 21:
 
|  0x4
 
|  0x4
 
|  0x4
 
|  0x4
Amount of DVLEs in SHBIN
+
N = number of DVLEs in SHBIN
 
|-
 
|-
 
|  0x8
 
|  0x8
|  0x4
+
|  0x4*N
|  DVLE 1 offset
+
|  DVLE offset table; each offset is a u32 relative to the start of the DVLB section
 
|-
 
|-
 
|}
 
|}
 
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.
 
The DVLP file comes directly after the header.
Line 39: Line 35:
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
OFFSET
+
Offset
SIZE
+
Size
DESCRIPTION
+
Description
 
|-
 
|-
 
|  0x0
 
|  0x0
 
|  0x4
 
|  0x4
 
|  MAGIC "DVLP"
 
|  MAGIC "DVLP"
 +
|-
 +
|  0x4
 +
|  0x4
 +
|  ?
 +
|-
 +
|  0x8
 +
|  0x4
 +
|  Offset (relative to DVLP start) to shader program binary blob
 +
|-
 +
|  0xC
 +
|  0x4
 +
|  Size of shader program binary blob, in words
 +
|-
 +
|  0x10
 +
|  0x4
 +
|  Offset (relative to DVLP start) to "shader table" (?)
 +
|-
 +
|  0x14
 +
|  0x4
 +
|  Number of "shader table" entries (each entry is 8-byte long)
 +
|-
 +
|  0x18
 +
|  0x4
 +
|  Offset (relative to DVLP start) to filename symbol table
 
|-
 
|-
 
|}
 
|}
 
Contains ASM of the VSH?
 
  
 
== DVLE ==
 
== DVLE ==
Line 65: Line 83:
 
|}
 
|}
  
Contains registers of the VSH?
+
Each DVLE is associated to an individual shader pipeline stage. Typically, the first DVLE is associated to the program's vertex shader and the second is associated to the program's geometry shader.

Revision as of 12:51, 23 February 2014

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 N = number of DVLEs in SHBIN
0x8 0x4*N DVLE offset table; each offset is a u32 relative to the start of the DVLB section

The DVLP file comes directly after the header.

DVLP

Offset Size Description
0x0 0x4 MAGIC "DVLP"
0x4 0x4 ?
0x8 0x4 Offset (relative to DVLP start) to shader program binary blob
0xC 0x4 Size of shader program binary blob, in words
0x10 0x4 Offset (relative to DVLP start) to "shader table" (?)
0x14 0x4 Number of "shader table" entries (each entry is 8-byte long)
0x18 0x4 Offset (relative to DVLP start) to filename symbol table

DVLE

OFFSET SIZE DESCRIPTION
0x0 0x4 MAGIC "DVLE"

Each DVLE is associated to an individual shader pipeline stage. Typically, the first DVLE is associated to the program's vertex shader and the second is associated to the program's geometry shader.