1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
4<meta http-equiv="Content-Style-Type" content="text/css">
5<title>Intermediate Object Files</title>
6<style type="text/css">
7<!--
8body {
9/*
10    font-size       : 10pt;
11*/
12    font-weight     : normal;
13    color           : #000000;
14    margin          : 8px;
15}
16
17div {
18    width           : 98%;
19    white-space     : nowrap;
20}
21
22div.title {
23    text-align      : left;
24    font-weight     : bold;
25/*
26    font-size       : 16pt;
27*/
28    font-size       : 150%;
29    color           : #202020;
30    border-style    : double;
31    border-width    : 8px;
32    /* タイトルを囲む枠線の色を指定 */
33    border-color    : #CD202C;
34
35    /* RVLプラットフォーム系列 */
36/*
37    border-color    : #34beed;
38*/
39
40    /* TWLプラットフォーム系列 */
41/*
42    border-color    : #ff458f;
43*/
44
45    margin          : 4px;
46    padding         : 4px;
47}
48H1 {
49  font-size             : 150%;
50  font-family           : Arial;
51  border-bottom-width   : 5px;
52  border-bottom-style   : solid;
53  border-bottom-color   : #CD202C;
54  padding-bottom        : 1px;
55  margin-bottom         : 20px;
56  letter-spacing        : normal;
57  font-weight           : bold;
58}
59
60h2 {
61    font-weight     : bold;
62/*
63    font-size       : 16pt;
64*/
65    font-size       : 150%;
66    border-style    : none none solid double;
67    border-width    : 0px 0px 2px 8px;
68    /* 見出しの線の色を指定 */
69    border-color    : #CD202C;
70
71    /* RVLプラットフォーム系列 */
72/*
73    border-color    : #34beed;
74*/
75
76    /* TWLプラットフォーム系列 */
77/*
78    border-color    : #ff458f;
79*/
80
81    margin-left     : 2px;
82    padding-left    : 4px;
83}
84CODE {
85  font-family       : "Courier New", monospace;
86  position          : normal;
87  left              : 12px;
88  font-size         : 90%;
89}
90table {
91  width             : 90%;
92  margin-top        : 2pt;
93  margin-bottom     : 2pt;
94  margin-left       : 0pt;
95  margin-right      : 0pt;
96  padding-left      : 0pt;
97  padding-right     : 0pt;
98  position          : relative;
99  left              : 12px;
100  font-family       : Arial;
101  font-size         : 90%;
102  border-style      : none none none none;
103}
104td,th {
105  padding           : 2pt;
106  border-width      : 2pt;
107  border-style      : none none none none;
108  font-style        : normal;
109  text-align        : left;
110}
111td {
112  background        : #e8f4f4;
113  font-weight       : normal;
114}
115th {
116  background        : #c0d8d8;
117  font-weight       : bold;
118}
119
120p {
121    margin-left     : 4px;
122}
123p.code {
124  font-family       : "Courier New", monospace;
125  position          : normal;
126  left              : 12px;
127  font-size         : 90%;
128  background        : #e8f4f4;
129}
130
131p.notice {
132  color             : black;
133  font-weight       : bold;
134  font-size         : 90%;
135  border            : solid 1px black;
136  padding           : 1em;
137}
138
139-->
140</style>
141
142</head>
143<body>
144
145  <h1><a name="top">Intermediate Object Files</a></h1>
146  <p>
147    This page describes the format of intermediate object files created using <CODE>ctr_VertexShaderAssembler</CODE>.<BR>
148  </p>
149
150  <h2><a name="block_list">File Organization</a></h2>
151  <p>
152    Intermediate object files consist of the following blocks.<BR> <br>
153    <table>
154      <tr>
155        <th>Blocks</th>
156        <th>Structures</th>
157        <th>Start position offset (in bytes)</th>
158        <th>Number of blocks</th>
159        <th>Size per block (in bytes)</th>
160      </tr>
161      <tr>
162        <th><a href="#file_header">File Header</a></th>
163        <td>OBJFILEHEADER</td>
164        <td>0</td>
165        <td>1</td>
166        <td>88</td>
167      </tr>
168      <tr>
169        <th><a href="#setup_info">Setup Information</a></th>
170        <td>SETUPINFO</td>
171        <td>OBJFILEHEADER.setupOffset</td>
172        <td>OBJFILEHEADER.setupCount</td>
173        <td>20</td>
174      </tr>
175      <tr>
176        <th><a href="#label_info">Label Information</a></th>
177        <td>LABELINFO</td>
178        <td>OBJFILEHEADER.labelOffset</td>
179        <td>OBJFILEHEADER.labelCount</td>
180        <td>16</td>
181      </tr>
182      <tr>
183        <th><a href="#code_info">Program Code Information</a></th>
184        <td>----</td>
185        <td>OBJFILEHEADER.instOffset</td>
186        <td>1</td>
187        <td>OBJFILEHEADER.instCount</td>
188      </tr>
189      <tr>
190        <th><a href="#swizzle_info">Swizzle Data Information</a></th>
191        <td>SWIZZLEINFO</td>
192        <td>OBJFILEHEADER.swizzleOffset</td>
193        <td>OBJFILEHEADER.swizzleCount</td>
194        <td>8</td>
195      </tr>
196      <tr>
197        <th><a href="#line_info">Line Information</a></th>
198        <td>LINEINFO</td>
199        <td>OBJFILEHEADER.lineOffset</td>
200        <td>OBJFILEHEADER.lineCount</td>
201        <td>8</td>
202      </tr>
203      <tr>
204        <th><a href="#relocation_info">Relocation Information</a></th>
205        <td>RELOCATIONINFO</td>
206        <td>OBJFILEHEADER.relocOffset</td>
207        <td>OBJFILEHEADER.relocCount</td>
208        <td>12</td>
209      </tr>
210      <tr>
211        <th><a href="#outmap_info">Outmap Information</a></th>
212        <td>OUTMAPINFO</td>
213        <td>OBJFILEHEADER.outmapOffset</td>
214        <td>OBJFILEHEADER.outmapCount</td>
215        <td>8</td>
216      </tr>
217      <tr>
218        <th><a href="#bindsymbol_info">Bind Symbol Information</a></th>
219        <td>BINDSYMBOLINFO</td>
220        <td>OBJFILEHEADER.bsymOffset</td>
221        <td>OBJFILEHEADER.bsymCount</td>
222        <td>8</td>
223      </tr>
224      <tr>
225        <th><a href="#string_info">String Data</a></th>
226        <td>----</td>
227        <td>OBJFILEHEADER.stringOffset</td>
228        <td>1</td>
229        <td>OBJFILEHEADER.stringSize</td>
230      </tr>
231    </table>
232    <br> <br>
233  </p>
234
235  <h2><a name="file_header">File Header</a></h2>
236  <p>
237    The fixed file header is located at the start of the file.<BR> You can get the location of data in each information block and the number of instances of data based on header information.<BR> <br> The file header consists of the following.<br> <br>
238<pre><p class="code">typedef struct tagOBJFILEHEADER {
239  char signature[4];
240  char     version[2];
241  unsigned char  shaderType;
242  unsigned char  mergeOutputMapsDebug;
243  unsigned short inputMask;
244  unsigned short outputMask;
245  unsigned char  geometryDataMode;
246  unsigned char  startIndex;
247  unsigned char  subdivPatchSize;
248  unsigned char  constVertexNumber;
249  unsigned int   setupOffset;
250  unsigned int   setupCount;
251  unsigned int   labelOffset;
252  unsigned int   labelCount;
253  unsigned int instOffset;
254  unsigned int instCount;
255  unsigned int swizzleOffset;
256  unsigned int swizzleCount;
257  unsigned int lineOffset;
258  unsigned int lineCount;
259  unsigned int   relocOffset;
260  unsigned int   relocCount;
261  unsigned int   outmapOffset;
262  unsigned int   outmapCount;
263  unsigned int   bsymOffset;
264  unsigned int   bsymCount;
265  unsigned int stringOffset;
266  unsigned int stringSize;
267} OBJFILEHEADER</p></pre>
268    <table>
269      <tr>
270        <th width="20%">Name</th>
271        <th>Description</th>
272      </tr>
273      <tr>
274        <td>signature</td>
275        <td>Stores the character string &quot;DVOJ&quot;.</td>
276      </tr>
277      <tr>
278        <td>version</td>
279        <td>Stores the assembler tool version. The first byte represents the major version number and the second byte represents the minor version number.</td>
280      </tr>
281      <tr>
282        <td>shaderType</td>
283        <td>Set to <CODE>0</CODE> if the executable image is a vertex shader assembler, or <CODE>1</CODE> if it is a geometry shader assembler.</td>
284      </tr>
285      <tr>
286        <td>mergeOutputMapsDebug</td>
287        <td>Bit <CODE>0</CODE> is used for internal settings of the geometry shader.<BR>Bit <CODE>1</CODE> indicates a debug build if set to <CODE>1</CODE>, or other than a debug build if set to <CODE>0</CODE>.</td>
288      </tr>
289      <tr>
290        <td>inputMask</td>
291        <td>Information on input registers being used. <CODE>1</CODE> is set for input registers defined using <CODE>#pragma bind_symbol</CODE>.</td>
292      </tr>
293      <tr>
294        <td>outputMask</td>
295        <td>Information on output registers being used. <CODE>1</CODE> is set for output registers defined using<CODE> #pragma output_map</CODE>.</td>
296      </tr>
297      <tr>
298        <td>geometryDataMode</td>
299        <td>Internal information about the geometry shaders.</td>
300      </tr>
301      <tr>
302        <td>startIndex</td>
303        <td>Internal information about the geometry shaders.</td>
304      </tr>
305      <tr>
306        <td>subdivPatchSize</td>
307        <td>Internal information about the geometry shaders.</td>
308      </tr>
309      <tr>
310        <td>constVertexNumber</td>
311        <td>Internal information about the geometry shaders.</td>
312      </tr>
313      <tr>
314        <td>setupOffset</td>
315        <td>The offset in bytes from the start of the file to the setup information block.</td>
316      </tr>
317      <tr>
318        <td>setupCount</td>
319        <td>The number of instances of setup information.</td>
320      </tr>
321      <tr>
322        <td>labelOffset</td>
323        <td>The offset in bytes from the start of the file to the label information block.</td>
324      </tr>
325      <tr>
326        <td>labelCount</td>
327        <td>The number of instances of label information.</td>
328      </tr>
329      <tr>
330        <td>instOffset</td>
331        <td>The offset in bytes from the start of the file to the program code information block.</td>
332      </tr>
333      <tr>
334        <td>instCount</td>
335        <td>The number of instances of data in program code information.</td>
336      </tr>
337      <tr>
338        <td>swizzleOffset</td>
339        <td>The offset in bytes from the start of the file to the swizzle data information block.</td>
340      </tr>
341      <tr>
342        <td>swizzleCount</td>
343        <td>The number of instances of data in swizzle data information.</td>
344      </tr>
345      <tr>
346        <td>lineOffset</td>
347        <td>The offset in bytes from the start of the file to the line information block.</td>
348      </tr>
349      <tr>
350        <td>lineCount</td>
351        <td>The number of instances of line information.</td>
352      </tr>
353      <tr>
354        <td>relocOffset</td>
355        <td>The offset in bytes from the start of the file to the relocation information block.</td>
356      </tr>
357      <tr>
358        <td>relocCount</td>
359        <td>The number of instances of relocation information.</td>
360      </tr>
361      <tr>
362        <td>outmapOffset</td>
363        <td>The offset in bytes from the start of the file to the outmap information block.</td>
364      </tr>
365      <tr>
366        <td>outmapCount</td>
367        <td>The number of instances of outmap information.</td>
368      </tr>
369      <tr>
370        <td>bsymOffset</td>
371        <td>The offset in bytes from the start of the file to the bind symbol information block.</td>
372      </tr>
373      <tr>
374        <td>bsymCount</td>
375        <td>The number of instances of bind symbol information.</td>
376      </tr>
377      <tr>
378        <td>stringOffset</td>
379        <td>The offset in bytes from the start of the file to the string data block.</td>
380      </tr>
381      <tr>
382        <td>stringSize</td>
383        <td>The number of bytes of string data.</td>
384      </tr>
385    </table>
386  </p>
387
388  <h2><a name="setup_info">Setup Information</a></h2>
389  <p>
390    The setup information block, given by <CODE>setupOffset</CODE> in the file header, stores the number of instances of setup information given by <CODE>setupCount</CODE>.<BR> Setup information is that information set by the shader assembler using the <CODE>def</CODE>, <CODE>defi</CODE>, and <CODE>defb</CODE> instructions.<BR> <br> Setup information consists of the following.<br> <br>
391<pre><p class="code">typedef struct tagSETUPINFO {
392  unsigned short type;
393  unsigned short index;
394  unsigned int   value[4];
395} SETUPINFO</p></pre>
396    <table>
397      <tr>
398        <th width="20%">Name</th>
399        <th>Description</th>
400      </tr>
401      <tr>
402        <td>type</td>
403        <td>0: Boolean register setting information<BR>1: Integer register setting information<BR>2: Floating point constant register setting information</td>
404      </tr>
405      <tr>
406        <td>index</td>
407        <td>The register index.</td>
408      </tr>
409      <tr>
410        <td>value</td>
411        <td>Stores <CODE>1</CODE> if value[0] is <CODE>true</CODE> or <CODE>0</CODE> if <CODE>false</CODE> in the case of a Boolean register.<BR>Stores three values defined by a <CODE>defi</CODE> instruction in Bit[7:0], Bit[15:8], and Bit[23:16], respectively, of value[0] in the case of an integer register.<BR>Converts four values defined using a <CODE>def</CODE> 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.<BR></td>
412      </tr>
413    </table>
414  </p>
415
416  <h2><a name="label_info">Label Information</a></h2>
417  <p>
418    The label information block, given by <CODE>labelOffset</CODE> in the file header, stores the number of instances of label information given by <CODE>labelCount</CODE>.<BR> Label information represents information about labels used in the shader assembler.<BR> <br> Label information consists of the following.<br> <br>
419<pre><p class="code">typedef struct tagLABELINFO {
420  unsigned int index;
421  unsigned int address;
422  unsigned int length;
423  unsigned int stringIndex;
424} LABELINFO</p></pre>
425    <table>
426      <tr>
427        <th width="20%">Name</th>
428        <th>Description</th>
429      </tr>
430      <tr>
431        <td>index</td>
432        <td>The label information index. Indices are assigned in order and labels are defined in the shader assembler starting from <CODE>0x00010000</CODE>.</td>
433      </tr>
434      <tr>
435        <td>address</td>
436        <td>The address of the shader program where the label is used.</td>
437      </tr>
438      <tr>
439        <td>length</td>
440        <td>The length in bytes from the address the label is used to the associated <CODE>ret</CODE> instruction. This is the subroutine length.</td>
441      </tr>
442      <tr>
443        <td>stringIndex</td>
444        <td>The byte index inside the string data block storing the label name.</td>
445      </tr>
446    </table>
447  </p>
448
449  <h2><a name="code_info">Program Code Information</a></h2>
450  <p>
451    The program code information block, given by <CODE>instOffset</CODE> in the file header, stores the number of instances of program code information given by <CODE>instCount</CODE>.<BR> 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.)<br>
452  </p>
453
454  <h2><a name="swizzle_info">Swizzle Data Information</a></h2>
455  <p>
456    The swizzle data information block, given by <CODE>swizzleOffset</CODE> in the file header, stores the number of instances of swizzle data information given by <CODE>swizzleCount</CODE>.<BR> <br> Swizzle data information consists of the following.<br> <br>
457<pre><p class="code">typedef struct tagSWIZZLEINFO {
458  unsigned int   value;
459  unsigned short usedInfo;
460  unsigned short reserve;
461} SWIZZLEINFO</p></pre>
462    <table>
463      <tr>
464        <th width="20%">Name</th>
465        <th>Description</th>
466      </tr>
467      <tr>
468        <td>value</td>
469        <td>Swizzle information data.</td>
470      </tr>
471      <tr>
472        <td>usedInfo</td>
473        <td>Internal information used during linking.</td>
474      </tr>
475      <tr>
476        <td>reserve</td>
477        <td>The reserved region.</td>
478      </tr>
479    </table>
480  </p>
481
482  <h2><a name="line_info">Line Information</a></h2>
483  <p>
484    The line information block, given by <CODE>lineOffset</CODE> in the file header, stores the number of instances of line information given by <CODE>lineCount</CODE>.<BR> 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.<BR> <br> Line information consists of the following.<br> <br>
485<pre><p class="code">typedef struct tagLINEINFO {
486  unsigned int stringIndex;
487  unsigned int lineNo;
488} LINEINFO</p></pre>
489    <table>
490      <tr>
491        <th width="20%">Name</th>
492        <th>Description</th>
493      </tr>
494      <tr>
495        <td>stringIndex</td>
496        <td>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.</td>
497      </tr>
498      <tr>
499        <td>lineNo</td>
500        <td>The number of shader assembler lines for the corresponding program code.</td>
501      </tr>
502    </table>
503  </p>
504
505  <h2><a name="relocation_info">Relocation Information</a></h2>
506  <p>
507    The relocation information block, given by <CODE>relocOffset</CODE> in the file header, stores the number of instances of relocation information given by <CODE>relocCount</CODE>.<br> Relocation information is accessed during linking.<BR> <br> Relocation information consists of the following.<br> <br>
508<pre><p class="code">typedef struct tagRELOCATIONINFO {
509  unsigned int address;
510  unsigned short type;
511  unsigned short reserve;
512  unsigned int stringIndex;
513} RELOCATIONINFO</p></pre>
514    <table>
515      <tr>
516        <th width="20%">Name</th>
517        <th>Description</th>
518      </tr>
519      <tr>
520        <td>address</td>
521        <td>The program address of the relocation information.</td>
522      </tr>
523      <tr>
524        <td>type</td>
525        <td>0: Address relocation<BR>1: Unresolved subroutine relocation<BR>4: Swizzle index relocation<BR></td>
526      </tr>
527      <tr>
528        <td>reserve</td>
529        <td>The reserved region.</td>
530      </tr>
531      <tr>
532        <td>stringIndex</td>
533        <td>The offset in bytes inside the string data block to the location where unresolved subroutine label names are stored.</td>
534      </tr>
535    </table>
536  </p>
537
538  <h2><a name="outmap_info">Outmap Information</a></h2>
539  <p>
540    The outmap information block, given by <CODE>outmapOffset</CODE> in the file header, stores the number of instances of output information given by <CODE>outputCount</CODE>.<BR> <CODE>Outmap</CODE> information represents information about <CODE>#pragma output_map</CODE> instructions defined in the shader assembler. <br> <CODE>Outmap</CODE> information consists of the following.<br> <br>
541<pre><p class="code">typedef struct tagOUTMAPINFO {
542  unsigned short type;
543  unsigned short index;
544  unsigned short mask;
545  unsigned short reserve;
546} OUTMAPINFO</p></pre>
547    <table>
548      <tr>
549        <th width="20%">Name</th>
550        <th>Description</th>
551      </tr>
552      <tr>
553<td>type</td>
554<td>Stores the attribute type.<BR><BR>0: position<br>1: quaternion<br>2: color<br>3: texcoord0<br>4: texcoord0w<br>5: texcoord1<br>6: texcoord2<br>8: view<br>9: generic<br></td>
555      </tr>
556      <tr>
557        <td>index</td>
558        <td>The output register index.</td>
559      </tr>
560      <tr>
561        <td>mask</td>
562        <td>The specified components. Represents <CODE>x</CODE>, <CODE>y</CODE>, <CODE>z</CODE>, and <CODE>w</CODE> beginning from the low-order bit.</td>
563      </tr>
564      <tr>
565        <td>reserve</td>
566        <td>The reserved region.</td>
567      </tr>
568    </table>
569  </p>
570
571  <h2><a name="bindsymbol_info">Bind Symbol Information</a></h2>
572  <p>
573    The bind symbol information block, given by <CODE>bsymOffset</CODE> in the file information header, stores the number of instances of bind symbol information given by <CODE>bsymCount</CODE>.<BR> Bind symbol information represents information about <CODE>#pragma bind_symbol</CODE> instructions defined in the shader assembler. <br> Bind symbol information consists of the following.<br> <br>
574<pre><p class="code">typedef struct tagBINDSYMBOLINFO {
575  unsigned int stringIndex;
576  unsigned short startIndex;
577  unsigned short endIndex;
578} BINDSYMBOLINFO</p></pre>
579    <table>
580      <tr>
581        <th width="20%">Name</th>
582        <th>Description</th>
583      </tr>
584      <tr>
585        <td>stringIndex</td>
586        <td>The byte index inside the string data block storing the symbol name.</td>
587      </tr>
588      <tr>
589<td>startIndex</td>
590<td>The start register index.<BR><BR>0 - 15: Input registers 0 to 15<BR>16 - 111: Floating point constant registers 0 to 95<BR>112 - 115: Integer registers 0 to 3<BR>120 - 135: Boolean registers 0 to 15<br></td>
591      </tr>
592      <tr>
593        <td>endIndex</td>
594        <td>The end register index. Values are the same as for <CODE>startIndex</CODE>.</td>
595      </tr>
596    </table>
597  </p>
598
599  <h2><a name="string_info">String Data</a></h2>
600  <p>
601    The string data block, given by <CODE>stringOffset</CODE> in the file header, stores string data having the byte size given by <CODE>stringSize</CODE>.<BR> This includes strings such as the label name, symbol name, and file name. Each string is delimited by '\0'.<BR>
602  </p>
603
604
605  <h2>Revision History</h2>
606    <dl class="history">
607      <dt>2011/12/20</dt>
608      <dd>Initial version.<br />
609      </dd>
610    </dl>
611
612<hr><p>CONFIDENTIAL</p></body>
613</html>