# US 8,542,247 B1 · Cull before vertex attribute fetch and vertex lighting

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 8,542,247 B1
- Document ID: US8542247B1
- Status: Granted
- Kind: B1
- Application number: 12/505,398
- Filed: 2009-07-17
- Granted: 2013-09-24
- Earliest claimed: 2009-07-17
- Assignees: NVIDIA Corporation
- Applicants: Ziyad S. Hakura; John Erik Lindholm; Emmett M. Kilgariff; Robert Ohannessian; Scott R. Whitman; James C. Bowman; Patrick R. Brown; Ross A. Cunniff
- Inventors: Ziyad S. Hakura; John Erik Lindholm; Emmett M. Kilgariff; Robert Ohannessian; Scott R. Whitman; James C. Bowman; Patrick R. Brown; Ross A. Cunniff
- Web page: https://patentgrep.com/patent/US8542247B1

## CPC

- G06T 15/005: {General purpose rendering architectures}
- G06T 15/40: Hidden part removal
- G09G 5/363: {Graphics controllers}
- G09G 5/393: Arrangements for updating the contents of the bit-mapped memory
- G09G 2360/06: Use of more than one graphics processor to process data before displaying to one or more screens
- G09G 2360/08: Power processing, i.e. workload management for processors involved in display operations, such as CPUs or GPUs
- G06T: IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G09G: ARRANGEMENTS OR CIRCUITS FOR CONTROL OF INDICATING DEVICES USING STATIC MEANS TO PRESENT VARIABLE INFORMATION (arrangements for transferring data between digital computers and displays G06F3/14; static indicating arrangements comprising an association of a number of separate sources or light control cells G09F9/00; static indicating arrangements comprising integral associations of a number of light sources H01J, H01K, H10H, H05B33/12; scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission, details thereof H04N1/00)

## Abstract

One embodiment of the invention sets forth a mechanism for compiling a vertex shader program into two portions, a culling portion and a shading portion. The culling portion of the compiled vertex shader program specifies vertex attributes and instructions of the vertex shader program needed to determine whether early vertex culling operations should be performed on a batch of vertices associated with one or more primitives of a graphics scene. The shading portion of the compiled vertex shader program specifies the remaining vertex attributes and instructions of the vertex shader program for performing vertex lighting and performing other operations on the vertices in the batch of vertices. When the compiled vertex shader program is executed by graphics processing hardware, the shading portion of the compiled vertex shader is executed only when early vertex culling operations are not performed on the batch of vertices.

## Claims

### Claim 1

A computer-implemented method for generating a compiled program configured to allow early culling operations related to one or more primitives in a graphics scene to be performed, the method comprising:
generating a first portion of the compiled program that includes a first set of instructions specified in an uncompiled program for computing one or more culling attributes related to the one or more primitives and needed to perform the early culling operations related to the one or more primitives and a first set of input attribute identifiers specified in the first set of instructions;
inserting culling instructions into the first portion of the compiled program that, when executed, generate a clip status that is based on the culling attributes associated with the one or more primitives and indicates whether the early culling operations related to the one or more primitives should be performed; and
generating a second portion of the compiled program for performing one or more additional operations on the set of primitives, wherein the second portion includes a second set of instructions specified in the uncompiled program and a second set of input attribute identifiers specified in the second set of instructions.

### Claim 2 (depends on 1)

The method of claim 1, wherein the second set of instructions includes instructions specified in the uncompiled program that are not included in the first set of instructions.

### Claim 3 (depends on 1)

The method of claim 1, wherein the second set of input attribute identifiers includes input attribute identifiers specified in the uncompiled program that are not included in the first set of input attribute identifiers.

### Claim 4 (depends on 1)

The method of claim 1, wherein the first set of instructions and the culling instructions included in the first portion of the compiled program and the second set of instructions included in the second portion of the compiled program comprise a single set of instructions making up the compiled program.

### Claim 5 (depends on 1)

The method of claim 1, wherein the uncompiled program comprises an uncompiled vertex shader program, the compiled program comprises a compiled vertex shader program, the first portion of the compiled program is configured to be executed by graphics processing hardware on a plurality of vertices associated with the one or more primitives, the clip status indicates whether the plurality of vertices should be culled, and the second portion of the compiled program is configured to be executed by the graphics processing hardware on the plurality of vertices to perform one or more vertex shading operations on the plurality of vertices when the clip status indicates that the plurality of vertices should not be culled.

### Claim 6 (depends on 5)

The method of claim 5, wherein vertex attributes associated with the first set of input attribute identifiers of vertices included in the plurality of vertices are used to compute the one or more culling attributes, and wherein vertex attributes associated with the second set of input attribute identifiers of the vertices included in the plurality of vertices are used to perform the one or more vertex shading operations on the plurality of vertices.

### Claim 7 (depends on 5)

The method of claim 5, wherein the uncompiled program specifies load instructions for fetching vertex attributes associated with the first set of input attribute identifiers from memory, and load instructions for fetching vertex attributes associated with the second set of vertex attribute identifiers from memory.

### Claim 8 (depends on 7)

The method of claim 7, wherein the load instructions for fetching vertex attributes associated with the first set of input vertex attribute identifiers from memory are included in the first portion of the compiled program, and the load instructions for fetching vertex attributes associated with the second set of input attribute identifiers from memory are included in the second portion of the compiled program.

### Claim 9 (depends on 5)

The method of claim 5, wherein the clip status indicates that the plurality of vertices should be culled when the one or more primitives lie outside of a view frustum and/or one or more user clip planes, and the clip status indicates that the plurality of vertices should not be culled when the one or more primitives lie within the view frustum and the one or more user clip planes.

### Claim 10 (depends on 1)

The method of claim 1, wherein the uncompiled program comprises an uncompiled geometry shader program, the compiled program comprises a compiled geometry shader program, the first portion of the compiled program is configured to be executed by graphics processing hardware on a plurality of primitives associated with the one or more primitives, the clip status indicates whether the plurality of primitives should be culled, and the second portion of the compiled program is configured to be executed by the graphics processing hardware on the plurality of primitives to perform one or more geometry shading operations on the plurality of primitives when the clip status indicates that the plurality of primitives should not be culled.

### Claim 11 (depends on 5)

The method of claim 5, wherein the clip status indicates that the plurality of vertices should be culled when the one or more primitives fall on a first side of a user clip plane defined by a software driver that reflects a split frame boundary of a frame, and wherein vertices of the one or more primitives falling on the first side of the user clip plane are processed by a first processing unit, and vertices of the one or more primitives falling on a second side of the user clip plane are executed by a second processing unit.

### Claim 12 (depends on 1)

The method of claim 1, wherein the uncompiled program comprises an uncompiled tessellation shader program, the compiled program comprises a compiled tessellation shader program, the first portion of the compiled program is configured to be executed by graphics processing hardware on a plurality of vertices associated with the one or more primitives, the clip status indicates whether the plurality of vertices should be culled, and the second portion of the compiled program is configured to be executed by the graphics processing hardware on the plurality of vertices to perform one or more tessellation operations on the plurality of vertices when the clip status indicates that the plurality of vertices should not be culled.

### Claim 13

A non-transitory computer-readable medium for storing instructions that, when executed, cause a processor to generate a compiled program configured to allow early culling operations related to one or more primitives in a graphics scene to be performed by performing the steps of:
generating a first portion of the compiled program that includes a first set of instructions specified in an uncompiled program for computing one or more culling attributes related to the one or more primitives and needed to perform the early culling operations related to the one or more primitives and a first set of input attribute identifiers specified in the first set of instructions;
inserting culling instructions into the first portion of the compiled program that, when executed, generate a clip status that is based on the culling attributes associated with the one or more primitives and indicates whether the early culling operations related to the one or more primitives should be performed; and
generating a second portion of the compiled program for performing one or more additional operations on the set of primitives, wherein the second portion includes a second set of instructions specified in the uncompiled program and a second set of input attribute identifiers specified in the second set of instructions.

### Claim 14 (depends on 13)

The non-transitory computer-readable medium of claim 13, wherein the second set of instructions includes instructions specified in the uncompiled program that are not included in the first set of instructions.

### Claim 15 (depends on 13)

The non-transitory computer-readable medium of claim 13, wherein the second set of input attribute identifiers includes input attribute identifiers specified in the uncompiled program that are not included in the first set of input attribute identifiers.

### Claim 16 (depends on 13)

The non-transitory computer-readable medium of claim 13, wherein the first set of instructions and the culling instructions included in the first portion of the compiled program and the second set of instructions included in the second portion of the compiled program comprise a single set of instructions making up the compiled program.

### Claim 17 (depends on 13)

The non-transitory computer-readable medium of claim 13, wherein the uncompiled program comprises an uncompiled vertex shader program, the compiled program comprises a compiled vertex shader program, the first portion of the compiled program is configured to be executed by graphics processing hardware on a plurality of vertices associated with the one or more primitives, the clip status indicates whether the plurality of vertices should be culled, and the second portion of the compiled program is configured to be executed by the graphics processing hardware on the plurality of vertices to perform one or more vertex shading operations on the plurality of vertices when the clip status indicates that the plurality of vertices should not be culled.

### Claim 18 (depends on 17)

The non-transitory computer-readable medium of claim 17, wherein vertex attributes associated with the first set of input attribute identifiers of vertices included in the plurality of vertices are used to compute culling attributes associated with the plurality of vertices, and wherein vertex attributes associated with the second set of input attribute identifiers of the vertices included in the plurality of vertices are used to perform the one or more vertex shading operations on the plurality of vertices.

### Claim 19 (depends on 17)

The non-transitory computer-readable medium of claim 17, wherein the uncompiled program specifies load instructions for fetching vertex attributes associated with the first set of input attribute identifiers from memory, and load instructions for fetching vertex attributes associated with the second set of vertex attribute identifiers from memory.

### Claim 20 (depends on 19)

The non-transitory computer-readable medium of claim 19, wherein the load instructions for fetching vertex attributes associated with the first set of input vertex attribute identifiers from memory are included in the first portion of the compiled program, and the load instructions for fetching vertex attributes associated with the second set of input attribute identifiers from memory are included in the second portion of the compiled program.

### Claim 21 (depends on 17)

The non-transitory computer-readable medium of claim 17, wherein the clip status indicates that the plurality of vertices should be culled when each of the one or more primitives lie outside of a view frustum and/or one or more user clip planes, and the clip status indicates that the plurality of vertices should not be culled when the one or more primitives lie within the view frustum and the one or more user clip planes.

### Claim 22

A computer system for generating a compiled program configured to allow early culling operations related to one or more primitives in a graphics scene to be performed, the computer system comprising:
a processing unit; and
a memory configured to stored instructions that, when executed by the processing unit, cause the processing unit to perform the steps of:
generating a first portion of the compiled program that includes a first set of instructions specified in an uncompiled program for computing one or more culling attributes related to the one or more primitives and needed to perform the early culling operations related to the one or more primitives and a first set of input attribute identifiers specified in the first set of instructions,
inserting culling instructions into the first portion of the compiled program that, when executed, generate a clip status that is based on the culling attributes associated with the one or more primitives and indicates whether the early culling operations related to the one or more primitives should be performed, and
generating a second portion of the compiled program for performing one or more additional operations on the set of primitives, wherein the second portion includes a second set of instructions specified in the uncompiled program and a second set of input attribute identifiers specified in the second set of instructions.
