CPC G06T 15/005 (2013.01) [G06T 15/40 (2013.01)] | 11 Claims |
1. A method of compiling a fragment shader for a graphics processor to generate a render output, the graphics processor including an execution unit that is operable to execute fragment shaders to process fragments to generate fragment shaded data for the render output, wherein a fragment shader may in addition to generating the fragment shaded data include one or more fragment shader side effects, wherein the graphics processor is configured to:
render primitives in a sequence of primitives for a render output by:
performing a first, pre-pass operation in which primitives in the sequence of primitives are processed into respective sets of one or more fragments, each fragment associated with a respective set of one or more sampling positions within the render output, and the resulting fragments are processed to determine visibility information for the sequence of primitives, wherein the first, pre-pass operation is operable to execute a first fragment shader routine for a fragment, if required, to determine the visibility information for the sequence of primitives; and
thereafter performing a second, main pass operation in which primitives that were processed by the first, pre-pass operation are processed again into their respective sets of one or more fragments for processing for respective sampling positions within the render output, wherein the fragment processing during the second, main pass is controlled based on the determined visibility information, and wherein for fragments that the visibility information indicates should be processed further to generate rendered output data, a second fragment shader routine is executed to generate the rendered output data for the sampling position or positions to which the fragments relate;
the method comprising:
including in a fragment shader for execution by the execution unit of the graphics processor a sequence of instructions that when executed by the first fragment shader routine and/or by the second fragment shader routine controls the execution of one or more fragment shader side effects for a fragment for a primitive such that for any fragments for which both the first fragment shader routine and the second fragment shader routine are executed, the one or more fragment shader side effects associated with the fragment shader are only executed once.
|