1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2<html xml:lang="en-US" lang="en-US" xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5 <meta http-equiv="Content-Style-Type" content="text/css" /> 6 <link rel="stylesheet" href="../css/manpage.css" type="text/css" /> 7 <link rel="stylesheet" href="../css/timetable.css" type="text/css" /> 8 <title>#pragma output_map ( data_name , mapped_register )</title> 9 </head> 10 <body> 11 <h1>#pragma output_map ( data_name , mapped_register )</h1> 12 13 <h2>Overview</h2> 14 <div class="section"> 15 <p> 16 Sets the attributes for the data output by the vertex shader. The settings determine which data will be output to the fragment pipeline.<br> <br> Specify one of the following for <SPAN class="argument">data_name</SPAN>:<br> <br> 17 <table> 18 <tr><th>position</th><td>Vertex coordinates (x y z w)</td></tr> 19 <tr><th>color</th><td>Vertex color (R G B A)</td></tr> 20 <tr><th>texture0</th><td>Texture coordinate 0 (u v)</td></tr> 21 <tr><th>texture0w</th><td>Texture coordinate 0 third component (w)</td></tr> 22 <tr><th>texture1</th><td>Texture coordinate 1 (u v)</td></tr> 23 <tr><th>texture2</th><td>Texture coordinate 2 (u v)</td></tr> 24 <tr><th>quaternion</th><td>Quaternion (x y z w)</td></tr> 25 <tr><th>view</th><td>View vector (x y z)</td></tr> 26 <tr><th>generic</th><td>Generic attribute (optional)</td></tr> 27 </table> 28 <br>Specify the corresponding output register to <SPAN class="argument">mapped_register</SPAN>. Since components can be specified, you can also pack multiple attributes into a single register.<br> <br> Use the <CODE>generic</CODE> attribute to use the geometry shader.<br> <br> 29 </p> 30 <p class="notice"> 31 Once everything has been written to the output registers specified by these settings, the processing in the vertex shader is forcibly stopped and the process transitions to the next set of vertex data. (The <CODE>end</CODE> instruction that follows the data must be called.)<br> For this reason, in some cases instructions may not get executed after the last attribute data has been written to the output registers.<br> 32 </p> 33 <p> 34 Examples of what can happen to instructions meant to be executed after writing to the output registers:<br> 35<pre class="definition"> 36mov o0, r0 37mov o1, r1 // If only o0,o1 has been specified, execution ends at this point. 38end // The end instruction is required. 39nop // In some cases this instruction may not be executed. 40nop // In some cases this instruction may not be executed. 41</pre> 42 </p> 43 <p class="notice"> 44 The vertex shader must write everything to the registers specified by these settings.<br> (x, y, z and w must all be written to the specified registers. Even if all components have not been set in <CODE>output_map</CODE>, you still need to write all components by writing dummy values for those components that have not been set.)<br> 45 </p> 46 <p> 47 Examples of writing everything to specified output registers:<br> 48<pre class="definition"> 49#pragma output_map ( position , o0 ) 50#pragma output_map ( color , o1 ) 51#pragma output_map ( texture0 , o2.xy ) 52#pragma output_map ( texture1 , o3.xy ) 53#pragma output_map ( texture2 , o4.xy ) 54 55... 56mov o0, r0 57mov o1, r1 58mov o2, r2 // o2,o3,o4 only specify x and y, but 59mov o3, r3 // you also need to write arbitrary values to z and w. 60mov o4, r4 // 61</pre> 62 </p> 63 <p class="notice"> 64 After the vertex shader has written everything to the output registers specified by these settings, you must not use any instructions that read/write to registers. <br> Behavior is not guaranteed if you use instructions that read or write to registers after the last write to the output registers has taken place.<br> 65 </p> 66 <p> 67 Examples of illegal instruction execution after the last write to the output registers:<br> 68<pre class="definition"> 69mov o0, r0 70mov o1, r1 // If only o0,o1 has been specified, execution ends at this point. 71mov r0, c0 // Execution of instructions that access registers is prohibited here. 72end // The end instruction is required. 73mov r1, c1 // Execution of instructions that access registers is prohibited here. 74</pre> 75 </p> 76 <p class="notice"> 77 The vertex shader cannot cannot write multiple times to a given output register. For every vertex process, write to each output register component only once.<br> You also cannot write multiple times to a given component. Behavior is not guaranteed if you write multiple times.<br> 78 </p> 79 <p> 80 Examples related to writing multiple times to output registers:<br> 81<pre class="definition"> 82//Example of correct process 83mov o0.xy, c0 84mov o0.zw, c1.w // Each component is written only once 85 86// Example of illegal process 87mov o0.xy, c0 88mov o0, c1.w // o0.x and o0.y are written twice 89</pre> 90 </p> 91 <p class="notice"> 92 For attributes other than the <CODE>generic</CODE> attribute, up to seven output registers can be specified for <CODE>output_map</CODE>.<br> To set eight or more attributes (other than the <CODE>generic</CODE> attribute) in output registers, you will need to pack several attributes together and set them in an output register.<br> If attributes (other than the <CODE>generic</CODE> attribute) have been set for eight or more output registers, the <CODE>glShaderBinary</CODE> function will generate an <CODE>INVALID_OPERATION</CODE> error when loading. 93 </p> 94 <p> 95 Example of packing multiple attributes into one output register:<br> 96<pre class="definition"> 97#pragma output_map ( position , o0 ) 98#pragma output_map ( color , o1 ) 99#pragma output_map ( texture0 , o2.xy ) 100#pragma output_map ( texture1 , o2.zw ) // Multiple attributes packed into o2 101 102... 103mov o0, r0 104mov o1, r1 105mov o2.xy, r2.xy 106mov o2.zw, r3.xxxy 107</pre> 108 </p> 109 110 </div> 111 112 113 <h2>Revision History</h2> 114 <div class="section"> 115 <dl class="history"> 116 <dt>2011/12/20</dt> 117 <dd>Initial version.<br /> 118 </dd> 119 </dl> 120 </div> 121 122 <hr><p>CONFIDENTIAL</p></body> 123</html>