Sets the attributes for the data output by the vertex shader. The settings determine which data will be output to the fragment pipeline.
Specify one of the following for data_name:
| position | Vertex coordinates (x y z w) |
|---|---|
| color | Vertex color (R G B A) |
| texture0 | Texture coordinate 0 (u v) |
| texture0w | Texture coordinate 0 third component (w) |
| texture1 | Texture coordinate 1 (u v) |
| texture2 | Texture coordinate 2 (u v) |
| quaternion | Quaternion (x y z w) |
| view | View vector (x y z) |
| generic | Generic attribute (optional) |
generic attribute to use the geometry shader.
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 end instruction that follows the data must be called.)
For this reason, in some cases instructions may not get executed after the last attribute data has been written to the output registers.
Examples of what can happen to instructions meant to be executed after writing to the output registers:
mov o0, r0 mov o1, r1 // If only o0,o1 has been specified, execution ends at this point. end // The end instruction is required. nop // In some cases this instruction may not be executed. nop // In some cases this instruction may not be executed.
The vertex shader must write everything to the registers specified by these settings.
(x, y, z and w must all be written to the specified registers. Even if all components have not been set in output_map, you still need to write all components by writing dummy values for those components that have not been set.)
Examples of writing everything to specified output registers:
#pragma output_map ( position , o0 ) #pragma output_map ( color , o1 ) #pragma output_map ( texture0 , o2.xy ) #pragma output_map ( texture1 , o3.xy ) #pragma output_map ( texture2 , o4.xy ) ... mov o0, r0 mov o1, r1 mov o2, r2 // o2,o3,o4 only specify x and y, but mov o3, r3 // you also need to write arbitrary values to z and w. mov o4, r4 //
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.
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.
Examples of illegal instruction execution after the last write to the output registers:
mov o0, r0 mov o1, r1 // If only o0,o1 has been specified, execution ends at this point. mov r0, c0 // Execution of instructions that access registers is prohibited here. end // The end instruction is required. mov r1, c1 // Execution of instructions that access registers is prohibited here.
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.
You also cannot write multiple times to a given component. Behavior is not guaranteed if you write multiple times.
Examples related to writing multiple times to output registers:
//Example of correct process mov o0.xy, c0 mov o0.zw, c1.w // Each component is written only once // Example of illegal process mov o0.xy, c0 mov o0, c1.w // o0.x and o0.y are written twice
For attributes other than the generic attribute, up to seven output registers can be specified for output_map.
To set eight or more attributes (other than the generic attribute) in output registers, you will need to pack several attributes together and set them in an output register.
If attributes (other than the generic attribute) have been set for eight or more output registers, the glShaderBinary function will generate an INVALID_OPERATION error when loading.
Example of packing multiple attributes into one output register:
#pragma output_map ( position , o0 ) #pragma output_map ( color , o1 ) #pragma output_map ( texture0 , o2.xy ) #pragma output_map ( texture1 , o2.zw ) // Multiple attributes packed into o2 ... mov o0, r0 mov o1, r1 mov o2.xy, r2.xy mov o2.zw, r3.xxxy
CONFIDENTIAL