Intermediate Object Files

This page describes the format of intermediate object files created using ctr_VertexShaderAssembler.

File Organization

Intermediate object files consist of the following blocks.

Blocks Structures Start position offset (in bytes) Number of blocks Size per block (in bytes)
File Header OBJFILEHEADER 0 1 88
Setup Information SETUPINFO OBJFILEHEADER.setupOffset OBJFILEHEADER.setupCount 20
Label Information LABELINFO OBJFILEHEADER.labelOffset OBJFILEHEADER.labelCount 16
Program Code Information ---- OBJFILEHEADER.instOffset 1 OBJFILEHEADER.instCount
Swizzle Data Information SWIZZLEINFO OBJFILEHEADER.swizzleOffset OBJFILEHEADER.swizzleCount 8
Line Information LINEINFO OBJFILEHEADER.lineOffset OBJFILEHEADER.lineCount 8
Relocation Information RELOCATIONINFO OBJFILEHEADER.relocOffset OBJFILEHEADER.relocCount 12
Outmap Information OUTMAPINFO OBJFILEHEADER.outmapOffset OBJFILEHEADER.outmapCount 8
Bind Symbol Information BINDSYMBOLINFO OBJFILEHEADER.bsymOffset OBJFILEHEADER.bsymCount 8
String Data ---- OBJFILEHEADER.stringOffset 1 OBJFILEHEADER.stringSize


File Header

The fixed file header is located at the start of the file.
You can get the location of data in each information block and the number of instances of data based on header information.

The file header consists of the following.

typedef struct tagOBJFILEHEADER { char signature[4]; char version[2]; unsigned char shaderType; unsigned char mergeOutputMapsDebug; unsigned short inputMask; unsigned short outputMask; unsigned char geometryDataMode; unsigned char startIndex; unsigned char subdivPatchSize; unsigned char constVertexNumber; unsigned int setupOffset; unsigned int setupCount; unsigned int labelOffset; unsigned int labelCount; unsigned int instOffset; unsigned int instCount; unsigned int swizzleOffset; unsigned int swizzleCount; unsigned int lineOffset; unsigned int lineCount; unsigned int relocOffset; unsigned int relocCount; unsigned int outmapOffset; unsigned int outmapCount; unsigned int bsymOffset; unsigned int bsymCount; unsigned int stringOffset; unsigned int stringSize; } OBJFILEHEADER

Name Description
signature Stores the character string "DVOJ".
version Stores the assembler tool version. The first byte represents the major version number and the second byte represents the minor version number.
shaderType Set to 0 if the executable image is a vertex shader assembler, or 1 if it is a geometry shader assembler.
mergeOutputMapsDebug Bit 0 is used for internal settings of the geometry shader.
Bit 1 indicates a debug build if set to 1, or other than a debug build if set to 0.
inputMask Information on input registers being used. 1 is set for input registers defined using #pragma bind_symbol.
outputMask Information on output registers being used. 1 is set for output registers defined using #pragma output_map.
geometryDataMode Internal information about the geometry shaders.
startIndex Internal information about the geometry shaders.
subdivPatchSize Internal information about the geometry shaders.
constVertexNumber Internal information about the geometry shaders.
setupOffset The offset in bytes from the start of the file to the setup information block.
setupCount The number of instances of setup information.
labelOffset The offset in bytes from the start of the file to the label information block.
labelCount The number of instances of label information.
instOffset The offset in bytes from the start of the file to the program code information block.
instCount The number of instances of data in program code information.
swizzleOffset The offset in bytes from the start of the file to the swizzle data information block.
swizzleCount The number of instances of data in swizzle data information.
lineOffset The offset in bytes from the start of the file to the line information block.
lineCount The number of instances of line information.
relocOffset The offset in bytes from the start of the file to the relocation information block.
relocCount The number of instances of relocation information.
outmapOffset The offset in bytes from the start of the file to the outmap information block.
outmapCount The number of instances of outmap information.
bsymOffset The offset in bytes from the start of the file to the bind symbol information block.
bsymCount The number of instances of bind symbol information.
stringOffset The offset in bytes from the start of the file to the string data block.
stringSize The number of bytes of string data.

Setup Information

The setup information block, given by setupOffset in the file header, stores the number of instances of setup information given by setupCount.
Setup information is that information set by the shader assembler using the def, defi, and defb instructions.

Setup information consists of the following.

typedef struct tagSETUPINFO { unsigned short type; unsigned short index; unsigned int value[4]; } SETUPINFO

Name Description
type 0: Boolean register setting information
1: Integer register setting information
2: Floating point constant register setting information
index The register index.
value Stores 1 if value[0] is true or 0 if false in the case of a Boolean register.
Stores three values defined by a defi instruction in Bit[7:0], Bit[15:8], and Bit[23:16], respectively, of value[0] in the case of an integer register.
Converts four values defined using a def instruction to 24-bit floating point numbers, and stores them in value[0] through value[3] in the case of a floating point constant register.

Label Information

The label information block, given by labelOffset in the file header, stores the number of instances of label information given by labelCount.
Label information represents information about labels used in the shader assembler.

Label information consists of the following.

typedef struct tagLABELINFO { unsigned int index; unsigned int address; unsigned int length; unsigned int stringIndex; } LABELINFO

Name Description
index The label information index. Indices are assigned in order and labels are defined in the shader assembler starting from 0x00010000.
address The address of the shader program where the label is used.
length The length in bytes from the address the label is used to the associated ret instruction. This is the subroutine length.
stringIndex The byte index inside the string data block storing the label name.

Program Code Information

The program code information block, given by instOffset in the file header, stores the number of instances of program code information given by instCount.
Program code information is represented by 32-bit data that corresponds to a single shader assembler instruction. (Not including define instructions. Macro instructions and flow control instructions do not always have a one-to-one correspondence between a single instruction and a single instance of program code information.)

Swizzle Data Information

The swizzle data information block, given by swizzleOffset in the file header, stores the number of instances of swizzle data information given by swizzleCount.

Swizzle data information consists of the following.

typedef struct tagSWIZZLEINFO { unsigned int value; unsigned short usedInfo; unsigned short reserve; } SWIZZLEINFO

Name Description
value Swizzle information data.
usedInfo Internal information used during linking.
reserve The reserved region.

Line Information

The line information block, given by lineOffset in the file header, stores the number of instances of line information given by lineCount.
Line information has a one-to-one correspondence with program code information. It possesses the same information regarding the file name and number of lines for the shader assembler having program code information with the same index.

Line information consists of the following.

typedef struct tagLINEINFO { unsigned int stringIndex; unsigned int lineNo; } LINEINFO

Name Description
stringIndex The index to the location where the shader assembler file name is stored for the corresponding program code. This is the byte index inside the string data block.
lineNo The number of shader assembler lines for the corresponding program code.

Relocation Information

The relocation information block, given by relocOffset in the file header, stores the number of instances of relocation information given by relocCount.
Relocation information is accessed during linking.

Relocation information consists of the following.

typedef struct tagRELOCATIONINFO { unsigned int address; unsigned short type; unsigned short reserve; unsigned int stringIndex; } RELOCATIONINFO

Name Description
address The program address of the relocation information.
type 0: Address relocation
1: Unresolved subroutine relocation
4: Swizzle index relocation
reserve The reserved region.
stringIndex The offset in bytes inside the string data block to the location where unresolved subroutine label names are stored.

Outmap Information

The outmap information block, given by outmapOffset in the file header, stores the number of instances of output information given by outputCount.
Outmap information represents information about #pragma output_map instructions defined in the shader assembler.
Outmap information consists of the following.

typedef struct tagOUTMAPINFO { unsigned short type; unsigned short index; unsigned short mask; unsigned short reserve; } OUTMAPINFO

Name Description
type Stores the attribute type.

0: position
1: quaternion
2: color
3: texcoord0
4: texcoord0w
5: texcoord1
6: texcoord2
8: view
9: generic
index The output register index.
mask The specified components. Represents x, y, z, and w beginning from the low-order bit.
reserve The reserved region.

Bind Symbol Information

The bind symbol information block, given by bsymOffset in the file information header, stores the number of instances of bind symbol information given by bsymCount.
Bind symbol information represents information about #pragma bind_symbol instructions defined in the shader assembler.
Bind symbol information consists of the following.

typedef struct tagBINDSYMBOLINFO { unsigned int stringIndex; unsigned short startIndex; unsigned short endIndex; } BINDSYMBOLINFO

Name Description
stringIndex The byte index inside the string data block storing the symbol name.
startIndex The start register index.

0 - 15: Input registers 0 to 15
16 - 111: Floating point constant registers 0 to 95
112 - 115: Integer registers 0 to 3
120 - 135: Boolean registers 0 to 15
endIndex The end register index. Values are the same as for startIndex.

String Data

The string data block, given by stringOffset in the file header, stores string data having the byte size given by stringSize.
This includes strings such as the label name, symbol name, and file name. Each string is delimited by '\0'.

Revision History

2011/12/20
Initial version.

CONFIDENTIAL