Difference between revisions of "GPU/Programming Guide"
(Created placeholder programming guide) |
(Add section about Fixed Vertex Attributes) |
||
Line 1: | Line 1: | ||
− | This page is intended to contain more higher-level explanation of concepts and features provided by the 3DS GPU. For more detailed register-level information check [[GPU Internal Registers]] or [[GPU Commands]]. | + | This page is intended to contain more higher-level explanation of concepts and features provided by the 3DS GPU. For more detailed register-level information check [[GPU:Internal Registers]] or [[GPU Commands]]. |
+ | |||
+ | = Geometry Pipeline = | ||
+ | |||
+ | == Fixed Vertex Attributes == | ||
+ | |||
+ | If a certain vertex attribute is constant for the duration of a draw call, instead of specifying a vertex array with repeated contents or changing the shader to use a uniform, *fixed vertex attributes* can be used. They let you specify a fixed value, which will be assumed by the attribute for all vertices of the batch. | ||
+ | |||
+ | To use a fixed attribute, set the bit corresponding to the attribute in [[GPU:Internal Registers#GPUREG_ATTRIBBUFFERS_FORMAT_HIGH|GPUREG_ATTRIBBUFFERS_FORMAT_HIGH]] and ensure that no vertex arrays are configured for the attribute. (Any configured arrays will override the fixed value, regardless of the bit setting.) Even if a vertex array isn't being used for the attribute it still needs to be counted in the number of active attributes specified in the same register. | ||
+ | |||
+ | To specify the actual value of the fixed attribute, write the attribute index to [[GPU:Internal Registers#GPUREG_FIXEDATTRIB_INDEX|GPUREG_FIXEDATTRIB_INDEX]] followed by writes with packed a float24 4-tuple to the 3 [[GPU:Internal Registers#GPUREG_FIXEDATTRIB_DATA|GPUREG_FIXEDATTRIB_DATA]] registers. The value is always specified as a float 4-component vector, the configured type is ignored. |
Revision as of 06:24, 26 July 2015
This page is intended to contain more higher-level explanation of concepts and features provided by the 3DS GPU. For more detailed register-level information check GPU:Internal Registers or GPU Commands.
Geometry Pipeline
Fixed Vertex Attributes
If a certain vertex attribute is constant for the duration of a draw call, instead of specifying a vertex array with repeated contents or changing the shader to use a uniform, *fixed vertex attributes* can be used. They let you specify a fixed value, which will be assumed by the attribute for all vertices of the batch.
To use a fixed attribute, set the bit corresponding to the attribute in GPUREG_ATTRIBBUFFERS_FORMAT_HIGH and ensure that no vertex arrays are configured for the attribute. (Any configured arrays will override the fixed value, regardless of the bit setting.) Even if a vertex array isn't being used for the attribute it still needs to be counted in the number of active attributes specified in the same register.
To specify the actual value of the fixed attribute, write the attribute index to GPUREG_FIXEDATTRIB_INDEX followed by writes with packed a float24 4-tuple to the 3 GPUREG_FIXEDATTRIB_DATA registers. The value is always specified as a float 4-component vector, the configured type is ignored.