Graphics processing systems for performing per-fragment operations when executing a fragment shader program
AssigneeArm Limited
InventorJorn Nystad
Life of this patent
Estimating the term…
Abstract
A graphics processing pipeline (30) includes a programmable fragment shader (40) that is operable to, in response to a “test” instruction included in a fragment shader program that it is executing, trigger, if appropriate, the performance of an alpha-to-coverage operation (41), a late stencil test (42), and a late depth test (43) for a fragment being processed, and to then return updated coverage information to the fragment shader (40). This allows alpha-to-coverage and late stencil and depth test operations to be triggered and performed during shader execution, rather than having to wait until shader execution has been completed before performing those operations.
Claims22
A method of operating a graphics processing system that includes a graphics processing pipeline circuit, comprising:
- including in a fragment shader program to be executed by a programmable fragment shading stage circuit of the graphics processing pipeline circuit, a first graphics program instruction that when executed will cause the programmable fragment shading stage circuit to determine whether a per-fragment operation can be performed for a fragment being processed, and to:
- when it is determined, in response to the first graphics program instruction, that the per-fragment operation can be performed for a fragment being processed, trigger the performance of the per-fragment operation for the fragment being processed;
- and
- when it is determined, in response to the first graphics program instruction, that the per-fragment operation cannot be performed for a fragment that is being processed, not trigger the performance of the per-fragment operation for the fragment that is being processed in response to the first graphics program instruction and continue executing the fragment shader program for the fragment that is being processed;
- the method further comprising:
- including in the fragment shader program to be executed by the programmable fragment shading stage circuit of the graphics processing pipeline circuit, a second graphics program instruction after the first graphics program instruction and a third graphics program instruction before the first graphics program instruction, wherein the third graphics program instruction, when executed, triggers the performance of a first fragment shading operation for the fragment that is being processed, and wherein the second graphics program instruction, when executed, triggers the performance of a second fragment shading operation for the fragment that is being processed;
- and
- the programmable fragment shading stage circuit of the graphics processing pipeline circuit, when executing the fragment shader program to process a fragment:
- before executing the first graphics program instruction, performing the first fragment shading operation for the fragment that is being processed in response to the third graphics program instruction;
- in response to the first graphics program instruction:
- determining whether a per-fragment operation can be performed for the fragment that is being processed;
- and
- when it is determined, in response to the first graphics program instruction, that a per-fragment operation can be performed for a fragment that is being processed, triggering the performance of the per-fragment operation for the fragment that is being processed in response to the first graphics program instruction, to thereby generate the result of the per-fragment operation for the fragment that is being processed;
- and
- when it is determined, in response to the first graphics program instruction, that a per-fragment operation cannot be performed for a fragment that is being processed, not triggering the performance of the per-fragment operation for the fragment that is being processed in response to the first graphics program instruction, and continuing execution of the fragment shader program for the fragment that is being processed to continue processing the fragment that is being processed, including executing the second graphics program instruction and, in response to the second graphics program instruction, triggering the performance of the second fragment shading operation for the fragment that is being processed;
- wherein the per-fragment operation is at least one of:
- an operation that will affect and/or determine the coverage for the fragment that is being processed;
- an alpha-to-coverage and/or an alpha test operation;
- and
- a depth and/or a stencil test.
A graphics processing system comprising:
- a graphics processing pipeline circuit comprising:
- a rasteriser circuit that rasterises input primitives to generate graphics fragments to be processed, each graphics fragment having one or more sampling points associated with it;
- and
- a programmable fragment shading stage circuit which executes fragment shader programs to perform fragment shading operations on graphics fragments generated by the rasteriser;
- the graphics processing system further comprising:
- a processing circuit configured to include in a fragment shader program to be executed by the programmable fragment shading stage circuit of the graphics processing pipeline circuit, a first graphics program instruction that when executed will cause the programmable fragment shading stage circuit to determine whether a per-fragment operation can be performed for a fragment being processed, and to:
- when it is determined, in response to the first graphics program instruction, that the per-fragment operation can be performed for a fragment being processed, trigger the performance of the per-fragment operation for the fragment being processed;
- and
- when it is determined, in response to the first graphics program instruction, that the per-fragment operation cannot be performed for a fragment that is being processed, not trigger the performance of the per-fragment operation for the fragment that is being processed in response to the first graphics program instruction and continue executing the fragment shader program for the fragment that is being processed;
- the processing circuit further configured to include in the fragment shader program to be executed by the programmable fragment shading stage circuit of the graphics processing pipeline circuit, a second graphics program instruction after the first graphics program instruction and a third graphics program instruction before the first graphics program instruction, wherein the third graphics program instruction, when executed, triggers the performance of a first fragment shading operation for the fragment that is being processed, and wherein the second graphics program instruction, when executed, triggers the performance of a second fragment shading operation for the fragment that is being processed;
- and wherein:
- the programmable fragment shading stage circuit of the graphics processing pipeline circuit is configured to, when executing the fragment shader program to process a fragment:
- before executing the first graphics program instruction, perform the first fragment shading operation for the fragment that is being processed in response to the third graphics program instruction;
- in response to the first graphics program instruction:
- determine whether a per-fragment operation can be performed for the fragment that is being processed;
- and
- when it is determined, in response to the first graphics program instruction, that a per-fragment operation can be performed for a fragment that is being processed, trigger the performance of the per-fragment operation for the fragment that is being processed in response to the first graphics program instruction, to thereby generate the result of the per-fragment operation for the fragment that is being processed;
- and
- when it is determined, in response to the first graphics program instruction, that a per-fragment operation cannot be performed for a fragment that is being processed, not trigger the performance of the per-fragment operation for the fragment that is being processed in response to the first graphics program instruction, and continue execution of the fragment shader program for the fragment that is being processed to continue processing the fragment that is being processed, including executing the second graphics program instruction and, in response to the second graphics program instruction, trigger the performance of the second fragment shading operation for the fragment that is being processed;
- wherein the per-fragment operation is at least one of:
- an operation that will affect and/or determine the coverage for the fragment that is being processed;
- an alpha-to-coverage and/or an alpha test operation;
- and
- a depth and/or a stencil test.
A programmable fragment shading stage circuit for a graphics processing pipeline circuit, comprising:
- a processing circuit that executes fragment shader programs to perform fragment shading operations on graphics fragments generated by a rasteriser;
- and
- wherein the programmable fragment shading stage circuit is configured to, when executing a fragment shader program to process a fragment:
- before executing a first graphics program instruction included in the fragment shader program, perform a first fragment shading operation for the fragment that is being processed in response to a third graphics program instruction that is included in the fragment shader program before the first graphics program instruction;
- in response to the first graphics program instruction included in the fragment shader program:
- determine whether a per-fragment operation can be performed for the fragment that is being processed;
- and
- when it is determined, in response to the first graphics program instruction, that a per-fragment operation can be performed for a fragment that is being processed, trigger the performance of the per-fragment operation for the fragment that is being processed in response to the first graphics program instruction, to thereby generate the result of the per-fragment operation for the fragment that is being processed;
- and
- when it is determined, in response to the first graphics program instruction, that a per-fragment operation cannot be performed for a fragment that is being processed, not trigger the performance of the per-fragment operation for the fragment that is being processed in response to the first graphics program instruction, and continue execution of the fragment shader program for the fragment that is being processed to continue processing the fragment that is being processed, including executing a second graphics program instruction included in the fragment shader program after the first graphics program instruction and, in response to the second graphics program instruction, trigger the performance of a second fragment shading operation for the fragment that is being processed;
- wherein the per-fragment operation is at least one of:
- an operation that will affect and/or determine the coverage for the fragment that is being processed;
- an alpha-to-coverage and/or an alpha test operation;
- and
- a depth and/or a stencil test.
A computer readable non-transitory storage medium storing computer software code which when executing on a data processor performs a method of compiling programs to generate instructions for execution by a programmable fragment shading stage circuit of a graphics processing pipeline circuit, the method comprising:
- including in a fragment shader program to be executed by a programmable fragment shading stage circuit of a graphics processing pipeline circuit, a first graphics program instruction that when executed will cause the programmable fragment shading stage circuit to determine whether a per-fragment operation can be performed for a fragment being processed, and to:
- when it is determined, in response to the first graphics program instruction, that the per-fragment operation can be performed for a fragment being processed, trigger the performance of the per-fragment operation for the fragment being processed in response to the first graphics program instruction, to thereby generate the result of the per-fragment operation for the fragment that is being processed;
- and
- when it is determined, in response to the first graphics program instruction, that the per-fragment operation cannot be performed for a fragment that is being processed, not trigger the performance of the per-fragment operation for the fragment that is being processed in response to the first graphics program instruction and continue executing the fragment shader program for the fragment that is being processed;
- the method further comprising:
- including in the fragment shader program to be executed by the programmable fragment shading stage circuit of the graphics processing pipeline circuit, a second graphics program instruction after the first graphics program instruction and a third graphics program instruction before the first graphics program instruction, wherein the third graphics program instruction, when executed, triggers the performance of a first fragment shading operation for the fragment that is being processed, and wherein the second graphics program instruction, when executed, triggers the performance of a second fragment shading operation for the fragment that is being processed;
- wherein the per-fragment operation is at least one of:
- an operation that will affect and/or determine the coverage for the fragment that is being processed;
- an alpha-to-coverage and/or an alpha test operation;
- and
- a depth and/or a stencil test.
Dependencies are inferred from the claim text.