Changes

Jump to navigation Jump to search
453 bytes added ,  17:05, 1 March 2015
Cleanup and restructure and clarify
Line 1: Line 1:  
[[Category:File formats]]
 
[[Category:File formats]]
== 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).
+
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 applications, 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.
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).
+
A SHBIN's structure starts with a generic header (DVLB), then a single program header (DVLP), then DVLE(s). The program header specifies the generic parts of the shader, i.e. the shader program data, the operand descriptor data, and a filename symbol table. The contextual details (entry point, constant values, debug symbols, etc) are specified in an executable header (DVLE). There may be multiple DVLE headers, so in this sense multiple shaders sharing the same program code can be stored in a single SHBIN. Hence for the following note the distinction between "program" and "executable".
   −
== DVLB Header ==
+
For a description of the instruction set, see the following page : [[Shader Instruction Set]]
 +
 
 +
== Header ==
    
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 87: Line 87:  
|  0x8
 
|  0x8
 
|  0x4
 
|  0x4
Program's main offset in binary blob (in words)
+
Executable's main offset in binary blob (in words)
 
|-
 
|-
 
|  0xC
 
|  0xC
 
|  0x4
 
|  0x4
Program's endmain offset in binary blob (in words)
+
Executable's program's endmain offset in binary blob (in words)
 
|-
 
|-
 
|  0x18
 
|  0x18
Line 135: Line 135:  
|}
 
|}
   −
Label table entry :
+
=== Label Table Entry ===
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
Line 160: Line 160:  
|}
 
|}
   −
Constant table entry header :
+
=== Constant Table Entry ===
 +
 
 +
Each executable's constants are stored as in constant uniform table. This information is used by ctrulib's SHDR framework to automatically send those values to the GPU when changing to a given program. An entry is constituted by a header and the constant data, the latter of which uses a format specific to the constant type.
    
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 170: Line 172:  
|  0x0
 
|  0x0
 
|  0x1
 
|  0x1
|  Constant type
+
|  Constant type (0=bool, 1=ivec4, 2=vec4)
 
|-
 
|-
 
|  0x2
 
|  0x2
Line 177: Line 179:  
|}
 
|}
   −
There are (at least) 3 types of constants : 0 is boolean, 1 is integer vec4 and 2 is float24 vec4.
+
Corresponding constant entry formats:
 
  −
Corresponding constant entry formats :
      
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 262: Line 262:  
|}
 
|}
   −
Output register table entry:
+
=== Output Table Entry ===
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
Line 312: Line 312:  
|}
 
|}
   −
Uniform table entry :
+
=== Uniform Table Entry ===
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
Line 332: Line 332:  
|-
 
|-
 
|}
 
|}
  −
Each DVLE is associated to an individual shader shader program contained in the binary blob. A single shader binary blob may contain multiple shader programs of the same kind.
  −
  −
Each program's constants are stored as vec4 in a uniform table. These are sent over to the GPU when changing to a give program.
  −
  −
== Instruction Set ==
  −
  −
For a description of the instruction set, see the following page : [[Shader Instruction Set]]
 
549

edits

Navigation menu