Patent ID: 8006236

Claim:
A non-transitory computer readable medium storing a compiler, comprising: a transformer configured to: receive a high level primitive program for a programmable graphics pipeline, wherein the high level primitive program is expressed in a shader language and configured to receive a stream of vertices; and produce, by operation of one or more computer processors, another form of the high level primitive program that has been transformed for optimized execution by a target platform; and a micro-code generator configured to: convert the transformed high level primitive program into primitive program micro-code that will process the stream of vertices to produce an ordered stream of primitives when executed by the target platform; and determine, based on the target platform application programming interface (API), whether at least one per-vertex attribute needed to produce a primitive included in the ordered stream of primitives is to be provided by a first vertex of the primitive or a last vertex of the primitive, wherein, when the target platform API comprises a first target platform API, the first vertex provides the at least one per-vertex attribute, and, when the target platform API comprises a second target platform API, the last vertex provides the at least one per-vertex attribute, and wherein the transformed high level primitive program specifies which one of the first vertex or the last vertex is to provide the at least one per-vertex attribute needed to produce the primitive.