Graphics processing
By introducing ray tracing circuitry units and accelerated data structures into the graphics processor, the ray tracing process is optimized, solving the problem of low efficiency in existing technologies and achieving more efficient rendering results.
Patent Information
- Application Number
- CN202480036778.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-05-03
- Filing Date
- 2024-03-26
- Publication Date
- 2026-01-30
AI Technical Summary
Existing technologies are inefficient when using graphics processors to perform ray tracing, especially in the process of handling complex ray tracing rendering, resulting in wasted computing resources and performance bottlenecks.
Ray tracing circuit units are used to accelerate the ray tracing process. By using ray tracing to accelerate the collaborative work of data structures and programmable execution units, redundant calculations and resource management pressure are reduced, thereby improving rendering efficiency.
It improves the efficiency of graphics processors in the ray tracing rendering process, reduces the waste of computing resources, and enhances rendering performance and image quality.
Smart Images

Figure CN121444136A_ABST
Abstract
Description
Background Technology
[0001] The techniques described in this article relate to graphics processing systems, and more specifically to the operation of a graphics processor when using a "ray tracing" rendering process (e.g., for rendering frames (images) for display).
[0002] Figure 1 An exemplary system-on-chip (SoC) graphics processing system 8 is shown, which includes a host processor in the form of a central processing unit (CPU) 1, a graphics processing unit (GPU) 2, a display processor 3, and a memory controller 5.
[0003] like Figure 1 As shown, these units communicate via interconnect 4 and have access to off-chip memory 6. In this system, graphics processor 2 renders frames (images) to be displayed, and then display processor 3 provides these frames to display panel 7 for display.
[0004] In the use of this system, an application 13, such as a game, running on the host processor (CPU) 1, will, for example, need to display frames on the display panel 7. To do this, the application will submit appropriate commands and data to the driver 11 for the graphics processor 2 running on the CPU 1. The driver 11 will then generate appropriate commands and data to cause the graphics processor 2 to render appropriate frames for display and store these frames in appropriate frame buffers, such as in main memory 6. The display processor 3 will then read these frames into the buffer for display, and then read these frames from the buffer and display them on the display panel 7 of the monitor.
[0005] One rendering process that can be performed by a graphics processor is called "ray tracing." Ray tracing is a rendering process that involves tracing the path of light rays from a viewpoint (sometimes called the "camera") through sampled locations in the image plane into the scene, and simulating the interaction between these rays and objects in the scene. The output data values (e.g., the appearance (color) of the sampled locations in the image) are determined based on the objects in the scene that intersect with the rays passing through the sampled locations, and the characteristics of the surfaces of those objects. Ray tracing calculations are complex and involve first identifying a set of objects within the scene that intersect with the rays passing through the sampled locations for each sampled location.
[0006] Ray tracing is considered to offer better results than more traditional rasterization rendering techniques, such as more realistic and physically accurate images, especially in its ability to capture reflections, refractions, shadows, and lighting effects. However, ray tracing is much more intensive than traditional rasterization processing.
[0007] The applicant believes that there is still a range of improved techniques available for performing ray tracing using graphics processors. Attached Figure Description
[0008] Implementations of the techniques described herein will now be described by way of example only, with reference to the accompanying drawings, wherein:
[0009] Figure 1 An exemplary graphics processing system is shown;
[0010] Figure 2 This is a schematic diagram illustrating the "full" ray tracing process;
[0011] Figure 3 An exemplary ray tracing acceleration data structure is shown;
[0012] Figure 4 An exemplary multi-layered arrangement of ray tracing acceleration data structures is shown in more detail for use in implementations that can be adapted to the techniques described herein;
[0013] Figure 5 This is a flowchart illustrating an implementation scheme for the full ray tracing process;
[0014] Figure 6 This is a schematic diagram illustrating the "hybrid" ray tracing process;
[0015] Figure 7 An implementation scheme of a graphics processor capable of operating in the manner described herein is illustrated schematically;
[0016] Figure 8 This is a flowchart illustrating a ray tracing operation that can be performed by a ray tracing unit (“RTU”) of a graphics processor in response to a notification from a programmable execution unit of the graphics processor to the RTU to determine, if any, the geometry intersecting a particular ray.
[0017] Figure 9 This is a flowchart illustrating the ray tracing operations that can be performed by the RTU when the RTU resumes processing the ray after the RTU has stopped processing the ray and before the ray has completed its traversal of one or more ray tracing acceleration data structures to be traversed in order to return processing of the ray to the programmable execution unit for execution of the "any hit" or "intersection" shader.
[0018] Figure 10 It shows when according to Figure 9 How can the processing of light be accelerated when using ray tracing operations in the flowchart to restore the processing of light?
[0019] Figure 11 This is a flowchart illustrating how the RTU can select multiple beams to be returned together to the programmable execution unit for further processing by the corresponding execution thread group;
[0020] Figure 12 This illustrates an example of how an RTU can group the rays to be returned to a programmable execution unit for further processing by the corresponding execution thread group;
[0021] Figure 13 This shows another example of how an RTU can group the rays to be returned to a programmable execution unit for further processing by the corresponding execution thread group;
[0022] Figure 14 This shows yet another example of how the RTU can group the rays to be returned to the programmable execution unit for further processing by the corresponding execution thread group;
[0023] Figure 15 The format of messages transmitted between the RTU and the programmable execution unit according to an embodiment of the technology described herein is illustrated schematically; and
[0024] Figure 16 An implementation scheme of the shader program compilation process for an implementation of the technology described herein is shown.
[0025] Where appropriate, similar reference numerals are used for similar elements in the accompanying drawings. Detailed Implementation
[0026] A first embodiment of the technology described herein includes a method for operating a graphics processor to generate rendered output by performing a ray tracing process, in which multiple rays traverse a scene to be rendered are traced.
[0027] The ray tracing process uses one or more ray tracing acceleration data structures that indicate the distribution of geometry within the scene to be rendered to determine which geometry intersects with the rays being used in the ray tracing process.
[0028] The graphics processor includes a programmable execution unit capable of executing a graphics processing program, wherein the program can be executed by a group of one or more execution threads.
[0029] The graphics processor also includes a ray tracing circuit (unit) that can be instructed by a programmable execution unit to perform ray tracing during program execution to determine, if any, the geometry intersecting with the ray for which ray tracing is being performed.
[0030] The method includes:
[0031] The program used to perform ray tracing includes one or more sets of "ray tracing" instructions, wherein the program is executed by one or more sets of execution threads, each thread in the set of one or more execution threads corresponding to a specific ray for which ray tracing is being performed, and the set of ray tracing instructions, when executed by the set of execution threads, will cause:
[0032] The programmable execution unit sends a message to the ray tracing circuit (unit) to determine, for the corresponding thread in the group of one or more execution threads executing the group of one or more ray tracing instructions, the geometry (if any) intersecting with the ray for at least one ray tracing. In order to determine the geometry intersecting with the ray, the ray tracing circuit (unit) is operable to perform a corresponding traversal of at least one ray tracing acceleration data structure and to test the ray for the one or more acceleration data structures being traversed to determine which geometry (if any) intersects with the ray.
[0033] The method also includes:
[0034] When one or more execution threads are executing the program for a corresponding set of one or more rays that are being used in the ray tracing process:
[0035] In response to the execution of this group of execution threads, one or more ray tracing instructions included in this program are executed:
[0036] The programmable execution unit sends a message to the ray tracing circuit (unit) to determine, for the corresponding thread in the group of one or more execution threads executing the group of one or more ray tracing instructions, the geometry intersecting with at least one ray for which the program is executed to perform ray tracing.
[0037] A second embodiment of the technology described herein includes a graphics processing system comprising a graphics processor operable to generate rendering output by performing a ray tracing process in which multiple rays traverse a scene to be rendered.
[0038] The ray tracing process uses one or more ray tracing acceleration data structures that indicate the distribution of geometry within the scene to be rendered to determine which geometry intersects with the rays being used in the ray tracing process.
[0039] The graphics processor includes a programmable execution unit capable of executing a graphics processing program, wherein the program can be executed by a group of one or more execution threads.
[0040] The graphics processor also includes a ray tracing circuit (unit) that can be instructed by a programmable execution unit to perform ray tracing during program execution to determine, if any, the geometry intersecting with the ray for which ray tracing is being performed.
[0041] The graphics processing system also includes:
[0042] The processing circuit is configured as follows:
[0043] The program used to perform ray tracing includes one or more sets of "ray tracing" instructions, wherein the program is executed by one or more sets of execution threads, each thread in the set of one or more execution threads corresponding to a specific ray for which ray tracing is being performed, and the set of ray tracing instructions, when executed by the set of execution threads, will cause:
[0044] The programmable execution unit sends a message to the ray tracing circuit (unit) to determine, for the corresponding thread in the group of one or more execution threads executing the group of one or more ray tracing instructions, the geometry (if any) intersecting with the ray for at least one ray tracing. In order to determine the geometry intersecting with the ray, the ray tracing circuit (unit) is operable to perform a corresponding traversal of at least one ray tracing acceleration data structure and to test the ray for the one or more acceleration data structures being traversed to determine which geometry (if any) intersects with the ray.
[0045] The programmable execution unit is configured such that when one or more execution threads are executing the program for a corresponding set of one or more rays being used in the ray tracing process:
[0046] In response to the execution of this group of execution threads, one or more ray tracing instructions included in this program are executed:
[0047] The programmable execution unit sends a message to the ray tracing circuit (unit) to determine, for the corresponding thread in the group of one or more execution threads executing the group of one or more ray tracing instructions, the geometry intersecting with at least one ray for which the program is executed to perform ray tracing.
[0048] The techniques described herein relate to performing ray tracing on a graphics processing unit (GPU) to generate desired rendering output, such as for rendering frames representing a particular scene view. Specifically, the techniques described herein provide more efficient GPU operation when performing ray tracing. As will be explained further below, this is achieved by providing the GPU with a ray tracing circuit (unit) that can and is indeed used by the GPU as an accelerator for ray tracing operations, wherein when a program is executed to perform ray tracing, a programmable execution unit of the GPU is configured and operable to send a message to the ray tracing circuit (unit) to trigger the ray tracing circuit (unit) to determine, for example, the geometry (if any) intersecting the ray being traced against the ray for which the program is being executed. When the ray is passed to the ray tracing circuit (unit) (i.e., when the programmable execution unit sends a message to the ray tracing circuit (unit) to determine the geometry (if any) intersecting the ray), the ray tracing circuit (unit) then manages and performs the determination of the geometry (if any) intersecting the ray itself (e.g., rather than having that determination managed by the programmable execution unit).
[0049] Once the ray tracing circuit (unit) has determined the geometry (if any) that intersects with a particular ray, the ray tracing circuit (unit) can then (and in one embodiment does) subsequently return the ray (i.e., return the processing of the ray) to the programmable execution unit for further processing, for example, based on the geometry (if any) determined to intersect with the ray in question.
[0050] For example, a ray tracing process typically involves tracing multiple rays through a scene to be rendered in order to determine the corresponding output values that a sampled location should have within the rendered output (e.g., the appearance (e.g., color) that the sampled location should have within the frame being rendered), based on the intersection of the rays with geometry defined within the scene (e.g., the geometric representation of objects within the scene). Therefore, when performing a ray tracing operation, for each ray that is being used to render the sampled location in the output being rendered (e.g., a frame), in order to render the sampled location, it is first necessary to determine which geometry (if any) defined by the scene intersects with the ray (and subsequently, once the geometry has been determined, the sampled location in the rendered output (frame) representation of the scene can (and indeed) be rendered accordingly).
[0051] There are multiple ways to determine which geometry in a scene to be rendered intersects with which ray in the ray being used in the ray tracing process, depending on the requirements. However, typically, there may be millions of graphics primitives and millions of rays to be tested within a given scene, making it impractical to test every ray for every graphics primitive. To accelerate ray tracing operations, the technique described in this paper therefore uses one or more ray tracing acceleration data structures to represent the distribution of geometry in the scene to be rendered, thereby accelerating the determination of which geometry (if any) in the scene being rendered intersects with a given ray being used in the ray tracing process.
[0052] One or more ray tracing acceleration data structures used in the techniques described herein can (and do) be traversed in one implementation to corresponding “endpoints” of one or more ray tracing acceleration data structures having their associated geometry (although an “endpoint” of a given ray tracing acceleration data structure can also, for example, lead to another ray tracing acceleration data structure). Therefore, determining the geometry that intersects with a given ray thus involves performing a corresponding traversal of the one or more ray tracing acceleration data structures to be traversed by the ray to determine which “endpoint” of the ray tracing acceleration data structures represents the geometry that intersects with the ray (if any).
[0053] For example, and in one embodiment, one or more ray tracing acceleration data structures used in the techniques described herein typically include multiple nodes, each node being associated with a corresponding box within the scene, wherein the corresponding box encompasses at least some of the geometry defined within the geometry of the scene to be rendered. A given ray tracing acceleration data structure will typically (and in one embodiment) include multiple internal nodes whose boxes, in one embodiment, encompass the corresponding boxes of one or more other (“child”) nodes within the same ray tracing acceleration data structure, and thus lead to other nodes within the same ray tracing acceleration data structure.
[0054] Ray tracing acceleration data structures typically (and in one implementation) also include multiple end nodes (e.g., "leaf" nodes in the case of a BVH tree structure). End nodes can (and at least some end nodes in at least one of the ray tracing acceleration data structures will) represent a corresponding set of geometries encompassed by corresponding boxes associated with those end nodes. That is, an end node can be associated with a bounding box drawn around a corresponding set of geometries, the bounding box associated with the end node thus representing the lowest-level box subdivision within the scene, such that if it is determined that a ray intersects the box associated with the corresponding end node along a particular branch of the ray tracing acceleration data structure, there are no additional (child) node volumes to be tested along that branch of the ray tracing acceleration data structure, and therefore the ray should be tested relative to the geometric unit represented by the end node in question.
[0055] However, it's also possible that instead of directly representing a set of geometries, the end nodes of a ray tracing acceleration data structure can point to another ray tracing acceleration data structure representing a different distribution of geometry. Therefore, in this case, if it's determined that a ray intersects with a box associated with such an end node, the ray should then continue traversing that other ray tracing acceleration data structure represented by the end node in question, for example, by referring to the end nodes of that other ray tracing acceleration data structure to determine which geometry (if any) it intersects with.
[0056] For example, in one implementation, one or more ray tracing accelerated data structures include a set of nested bounding box hierarchy (BVH) tree structures, where a corresponding "top-level" BVH tree structure represents a relatively coarse-level geometry distribution, and at least some end nodes of the top-level BVH tree structure point to another ("bottom-level") BVH tree structure representing a relatively fine-level geometry distribution. Therefore, in some implementations, traversal can be performed on multiple different ray tracing accelerated data structures representing different levels of subdivision of the scene to be rendered. In this case, at least the end nodes of the lowest-level subdivision of the ray tracing accelerated data structure should represent the actual geometry encompassed by the corresponding boxes of those end nodes.
[0057] Therefore, a given ray tracing accelerated data structure's corresponding end node can typically represent the geometry encompassed by the corresponding box associated with that end node (e.g., a set of primitives), but it can also point to another ray tracing accelerated data structure to be traversed, for example, representing the distribution of geometry within the corresponding box associated with that end node. In this regard, it should be understood that it is possible for all end nodes of a particular ray tracing accelerated data structure to represent geometry or all to point to another ray tracing accelerated data structure to be traversed (i.e., the end nodes are all of the same "type"), but it is also possible (and will often be the case) for a given ray tracing accelerated data structure's end nodes to include a mixture of end nodes representing geometry and end nodes pointing to another ray tracing accelerated data structure to be traversed.
[0058] Therefore, the at least one ray tracing acceleration data structure whose end nodes represent geometry may, in some cases, be the first (and in some embodiments, the only) ray tracing acceleration data structure used in the ray tracing process. However, in other embodiments, the at least one ray tracing acceleration data structure whose end nodes represent geometry may be reached by previously traversing one or more other ray tracing acceleration data structures.
[0059] In this respect, various arrangements for representing the distribution of geometry in a scene will be possible.
[0060] To determine the geometry that intersects with a given ray being used in the ray tracing process, the ray tracing operation according to the techniques described herein typically includes performing a traversal of at least one ray tracing acceleration data structure. This traversal involves testing the ray against one or more ray tracing acceleration data structures. For example, and in one embodiment, this is done by testing the intersection of the ray with boxes represented by different nodes of the one or more ray tracing acceleration data structures being traversed, to first determine which geometry potentially intersects with the ray by referring to the one or more ray tracing acceleration data structures being traversed (e.g., node boxes). (This traversal may, for example, and in one embodiment, indeed begin from a corresponding “starting point,” which, for example, corresponds to, for example, the corresponding parent, “root” node of a first acceleration data structure. Then, by traversing the first acceleration data structure, either it is determined that the nodes of the first acceleration data structure represent the geometry that potentially intersects with the ray, or it is determined that the ray should continue traversing a second acceleration data structure to refer to the nodes of the second acceleration data structure to determine which geometry potentially intersects with the ray, and so on.) Once the reference to one or more ray tracing acceleration data structures being traversed determines which (end) nodes represent a set of geometries that potentially intersect with the ray, the ray tracing operation then tests the intersection of the ray with the actual geometric units represented by those nodes to determine which geometry (if any) it intersects with (and therefore which geometry requires further processing for the ray used to sample the location).
[0061] Although the above description of the ray tracing process pertains to a single ray for ease of explanation, it should be understood that a typical ray tracing process involves tracing a large number of rays (e.g., millions of rays) across a scene to generate a rendered output. Therefore, this process is repeated for multiple rays used in the ray tracing process to determine which geometry intersects with which ray for different sampling locations within a frame of the scene being rendered, wherein in one implementation, each ray is similarly processed in the manner described herein.
[0062] In the technique described herein, a programmable execution unit of a graphics processor initially executes the entire ray tracing operation for the ray being used in the ray tracing process (and typically for each ray in the ray being used), the programmable execution unit executing a graphics processing program to perform the ray tracing process with respect to the ray in question. However, as will be further explained below, as part of the execution of the ray tracing program, the programmable execution unit is able to operate to trigger the ray tracing circuitry (unit) to perform the necessary traversal of one or more ray tracing acceleration data structures for which ray tracing is being performed, and to determine the geometry (if any) intersecting with the ray.
[0063] The ray tracing circuit (unit) can then process the rays accordingly. For example, and in one embodiment, the result of these operations on each ray being processed by the ray tracing circuit (unit) can be determined, and the result can then be used to determine how the ray should be further processed. For example, in one embodiment, the ray tracing circuit (unit) returns the result of these operations on one or more rays to a programmable execution unit to execute a suitable shader program routine, for example, selecting the shader program to be executed based on the result of these operations (e.g., according to which geometry, if any, is determined to intersect with the corresponding ray).
[0064] Therefore, according to the techniques described herein, when a ray is passed to a ray tracing circuit (unit) to determine the geometry (if any) intersecting with the ray, the ray tracing circuit (unit) then performs a traversal of at least one accelerated data structure to determine the geometry (if any) intersecting with the ray. For example, in an embodiment, as mentioned above, one or more (or each) ray tracing accelerated data structures include a plurality of nodes, each node associated with a corresponding box within the scene, and wherein at least some nodes of at least one accelerated data structure represent a set of corresponding geometries covered by the corresponding boxes associated with the nodes of the accelerated data structure. In this case, in one embodiment, traversal involves testing the intersection of the ray with the boxes and / or geometries represented by the corresponding nodes of the one or more ray tracing accelerated data structures being traversed (as applicable), thereby determining the geometry (if any) intersecting with the ray.
[0065] In one implementation, the ray tracing circuit (unit) then returns the result of the operation to the programmable execution unit (e.g., and in one implementation, by returning an instruction for each ray on how the ray tracing operation should be performed based on the geometry determined to intersect with the ray, or correspondingly based on the ray tracing circuit (unit) determining that the ray does not intersect with any geometry in the scene), and then continues the entire ray tracing operation accordingly, for example by executing an appropriate shader routine, based on the returned result.
[0066] In one implementation, the ray tracing circuitry (unit) also returns to the programmable execution unit an indication of the shader program routines to be executed for further processing of the ray (e.g., in terms of the shader index identifying the shader program routine). In this regard, as will be explained further below, the applicant recognizes that enabling the ray tracing circuitry (unit) to perform ray tracing operations up to and including determining the shader program routines to be executed can be particularly efficient because the ray tracing circuitry (unit) in this case can use appropriate (hardware) circuitry configured to perform the required calculations at the desired level of accuracy to consistently perform the required calculations, while still ensuring correct results, and avoiding the need to manage or repeat these calculations across different processing elements (i.e., this might be the case if the ray returns to the programmable execution unit earlier than the shader (index) is determined). Therefore, the applicant has found that enabling the ray tracing circuitry (unit) to manage and execute ray tracing operations up to and including determining the desired shader program routines to be executed for the ray (before the ray subsequently returns to the programmable execution unit for execution of the desired shader program routine) provides particularly efficient graphics processor operation.
[0067] In this regard, the applicant recognizes that there are several reasons why a ray tracing circuit (unit) according to the technology described herein may need to return the processing of rays to a programmable execution unit to execute shader routines.
[0068] For example, one reason why the ray tracing circuit (unit) might need to return the processing of a ray to the programmable execution unit to execute shader routines is that the ray tracing circuit (unit) has completed its processing of the ray and has either determined the relevant geometry intersecting with the ray, or conversely, determined that the ray does not intersect with any geometry, and therefore should return the processing of the ray to the programmable execution unit to execute the appropriate shader routines based on that determination. That is, when the ray tracing circuit (unit) has completed its processing of the ray and determined its final result regarding the geometry intersecting with the ray (if any), the ray tracing circuit (unit) should then, and in one embodiment, indeed return the processing of the ray to the programmable execution unit to execute the desired shader routines based on the result of the geometry intersection determination.
[0069] Therefore, for example, if the ray tracing circuitry determines that nothing intersects with a particular ray being processed (i.e., no intersection is found) (an intersection "miss"), there may be a corresponding "miss" shader routine that should be executed for the ray. For example, in response to determining that the ray does not intersect with any geometry within the scene to be rendered, there may be a specific, selected, predefined "default" operation for further processing of the sampled location in question, in one embodiment. This default operation may include, for example, assuming an intersection with the bounding box or "skybox" or calculating a procedural color for the background, but various other arrangements will be possible in this regard. Thus, if the ray tracing circuitry determines that nothing intersects with the ray, the ray tracing circuitry can, and in one embodiment, indeed instruct the programmable execution unit to execute the desired "miss" shader routine for that ray. The programmable execution unit can then shade the sampled location accordingly (however, as will be explained further below, in one embodiment, shading (rendering) of a given sampled location is not performed until all (desired) rays have been cast for that sampled location).
[0070] On the other hand, if the ray tracing circuit (unit) determines that the ray does indeed intersect with at least some geometry in the scene to be rendered (i.e., there is an intersection "hit"), the ray tracing circuit (unit) can, and in one embodiment, indeed instruct the programmable execution unit to execute the appropriate "hit" shader routine, wherein, for example, and in one embodiment, the "hit" shader routine to be executed is selected based on the type of the intersecting geometry.
[0071] For example, in one embodiment, the ray tracing circuit (unit) is configured to determine and record, in particular, the "closest hit" geometry (i.e., the geometry that intersects the ray and is closest to the ray's origin) for each ray it is processing. That is, in the embodiment, the determination of the geometry intersecting the ray (if any) by the ray tracing circuit (unit) specifically includes at least determining the closest hit geometry of the ray (and in some embodiments, the determination of the geometry intersecting the ray (if any) includes only determining the closest hit geometry of the ray).
[0072] Ray tracing circuitry (units) can therefore, and indeed in one implementation, maintain a record of the (at least) closest-hitting geometry for each ray it is processing, which can be updated, as appropriate, each time a new geometry is found to intersect. Thus, when a ray is first found to intersect a geometry within the scene, that geometry is recorded as the closest-hitting geometry in one implementation (e.g., by storing in the record a suitable indicator of the intersecting geometry (e.g., a geometry index identifying the geometry in question)). If a ray is subsequently found to intersect with another geometry closer to the ray's origin than the geometry currently recorded as the closest-hitting geometry, the record can (and indeed) be updated accordingly, and so on, until all geometries in the scene have been processed and considered and a closest-hitting geometry has been found (or it is found that the ray does not intersect with any geometry within the scene).
[0073] Once the closest hitting geometry is found, the graphics processor should (and in one implementation does) return the processing of the ray to the programmable execution unit to execute the appropriate "closest hit" shader routine. The closest hit shader then calculates the effect of the interaction occurring at the intersection and may also generate new (e.g., secondary) rays as needed. This will typically depend on the characteristics of the geometry found to be intersecting. For example, the interaction occurring at the intersection of geometry may differ for geometry with reflective surfaces compared to the interaction for geometry with non-reflective surfaces.
[0074] Therefore, it is possible that multiple different shaders may be invoked depending on the type of geometry found to intersect (e.g., in one embodiment, multiple different "closest to hit" shaders). For example, and in one embodiment, for each different class (or subclass) of geometry that can be defined within a given scene, there may be a corresponding shader program to be invoked for a ray when it is determined that the ray intersects with that type of geometry. For example, for a given scene, there may be a first shader to be invoked for a ray that hits a first type of geometry (e.g., geometry with a first surface texture and / or opacity), and a different second shader to be invoked for a ray that hits a second type of geometry. Each different available shader can be uniquely indexed and stored, for example, in a suitable "shader binding table" that is pre-configured based on the different types of geometry that can be defined for the scene in question. The corresponding entry in the shader binding table thus corresponds to the corresponding shader program that can be executed, and may also specify, for example, data (e.g., the texture to be applied) when executing the shader program. Each of these different shader routines can therefore be associated with a corresponding shader index that uniquely identifies the shader routine within such a “shader binding table”. The required shader index identifying the shader routine that should be executed in response to determining that a ray intersects with a particular type of geometry can then be calculated, for example, based on the characteristics of the ray and the characteristics of the geometry found to intersect with the ray (and in one implementation, this is done by the ray tracing circuitry (unit), as will be explained further below).
[0075] Therefore, in one implementation, a “shader binding table” is provided as a resource for the ray tracing circuitry (unit), wherein the shader binding table indicates which of a plurality of available shaders should be invoked for which types of geometry can (or actually) be represented by one or more ray tracing acceleration data structures being used in the ray tracing process. In one implementation, the shader binding table also indicates the required data (e.g., textures) to be applied when the corresponding shader is invoked. Thus, in one implementation, the shader binding table is pre-configured based on the content of the scene to be rendered (and the different types of geometry that can be represented within the scene), and wherein shader indices are appropriately defined such that the required shader indices can be appropriately calculated based on the characteristics of the rays and / or geometry in question.
[0076] When performing such operations, the nearest hit information is automatically updated (the hit is "submitted") as long as the intersecting geometry is found to be opaque, and traversal continues as expected until all geometry has been considered. Once the ray tracing unit (circuit) has finished processing the rays and determined the overall nearest hit geometry accordingly, the appropriate shader (index) for the discovered intersecting geometry can be determined, and the ray (processing) is returned to the programmable execution unit to execute the required ("nearest hit") shader routine.
[0077] However, in cases where a ray is found to intersect a non-opaque (e.g., transparent) geometry, or where the ray tracing process requires that a shader (e.g., the "any hit" shader) be executed whenever an intersection is found, regardless of whether other (potential) geometries intersect, the traversal may need to, and in one implementation, actually stop at that point, so that the ray's processing can return to the programmable execution unit to execute the appropriate shader routine (e.g., the "any hit" shader) to determine the effect of the intersection on the traversal operation. That is, there may be certain types of geometry, such as certain types of non-opaque (e.g., transparent) geometry, where whenever an intersection with that geometry is found, the appropriate shader routine needs to be invoked, for example, to determine whether the geometry should be recorded as the closest hit, or whether the intersection should, for example, be discarded. This behavior can be specified by the application programmer, for example, based on the characteristics of the geometry defined within the scene, such that, at least for certain types of geometry, the traversal can be stopped immediately to allow the execution of the required shader routine, and then the traversal is continued (resumed) (depending on the situation).
[0078] Similarly, it should be understood that there may be other types of geometry represented by a given ray tracing acceleration data structure, and the ray tracing circuit (unit) of the techniques described herein is not configured to process these geometries. For these geometries, when the reference ray tracing acceleration data structure determines that a ray may potentially intersect such geometry, the ray tracing circuit (unit) may need, and in one implementation does, return the processing of the ray to the programmable execution unit to execute an appropriate "intersection" shader to determine whether the geometry actually intersects, such that ray-geometry intersection can (and in some cases does) be performed by the programmable execution unit, but the result is then returned to the ray tracing circuit (unit) that manages the overall determination of the intersecting geometry (if any).
[0079] For example, most of the geometry within a given scene can, and indeed does, in one implementation, be represented by relatively simple primitives (e.g., polygons), and in this case, the ray tracing circuitry (units) can be configured to perform the required ray-primitive intersections as needed. However, at least some geometry within a given scene can be defined in different primitive formats, such as axis-aligned bounding box primitives, for which a corresponding intersection shader needs to be executed to determine ray-primitive intersections.
[0080] That is, instead of designing the ray tracing circuit (unit) to handle all possible types of geometry that may be encountered in a given ray tracing process, in some embodiments, the ray tracing circuit (unit) is configured to handle only some types of geometry (e.g., the most frequent types of geometry, such as polygon primitives (e.g., triangles)), but there may be some other types of geometry that can be represented by ray tracing acceleration data structures that the ray tracing circuit (unit) of the embodiment according to the technology described herein cannot handle, and therefore should (and does in one embodiment) be returned to the programmable execution unit to perform the required intersection test.
[0081] In this regard, various arrangements will be possible, and in general, ray tracing circuits (units) can be configured to handle any (e.g., all) suitable geometry as needed.
[0082] According to the techniques described herein, the ray tracing circuit (unit) is thus configured in one embodiment to pass the ray back to the programmable execution unit (i.e., return the ray (processing) to the programmable execution unit) once the processing of the ray is complete. For example, and in one embodiment, an appropriate (e.g., "closest to hit") shader is executed for geometry that has been found to intersect, or correspondingly, an appropriate "miss" shader is executed for the sampling location of the projected ray if it is found that the ray does not intersect any geometry.
[0083] However, the ray tracing circuitry (unit) may also need, and in some embodiments, be able to operate to pass the ray back to the programmable execution unit to execute shader routines before the ray tracing circuitry (unit) completes its processing of the ray (e.g., before the ray completes its traversal through at least one ray tracing accelerated data structure to be traversed), because the shader routines may need to be executed before the traversal of one or more ray tracing accelerated data structures can continue. In such cases, as will be further explained below, the ray traversal of the currently traversed ray tracing accelerated data structure stops at that point in one embodiment, allowing the ray (processing) to return to the programmable execution unit to execute the desired shader (which may be, for example, an "any hit" or "intersection" shader, depending on why the ray is returning), where the traversal then resumes once the shader has been executed.
[0084] Therefore, there are a variety of reasons why the ray tracing circuit (unit) of the technology described herein may need to return the ray (processing) to the programmable execution unit to execute the appropriate shader routine, where different shaders need to be executed, depending on the reason why the ray is returned, and also depending on the result of the ray tracing circuit (unit) processing the ray (e.g., depending on the type of intersecting geometry (if any)).
[0085] When the ray tracing circuit (unit) returns the ray (processing) to the programmable execution unit to execute the shader program, in one embodiment, the ray tracing circuit (unit) also returns an indication of why the ray has been returned. In one embodiment, the ray tracing circuit (unit) also returns an indication of the shader program routine that should be executed with respect to the ray.
[0086] In other words, in one implementation, the ray tracing circuit (unit) itself is able to operate as part of its processing of rays to determine whether a shader program routine needs to be executed with respect to a given ray and which shader program routine needs to be executed, and to provide the programmable execution unit with an indication of the required shader program routine when the ray (processing) returns to the programmable execution unit to execute the shader program routine in question.
[0087] Therefore, in one implementation, the ray tracing circuitry (unit) determines, as part of its processing of the ray, whether and when it may be necessary to execute a shader program routine with respect to the ray. When it is determined that a shader program routine needs to be executed with respect to the ray, in one implementation, the ray tracing circuitry (unit) then determines the shader program routine to be executed (e.g., by calculating an index identifying the desired shader program routine), and then returns the ray (processing) along with an indication of which shader program routine needs to be executed (e.g., the shader index) to the programmable execution unit.
[0088] In this regard, it should be understood that, as mentioned above, the shader routines that need to be executed will generally depend on the type of geometry found to intersect. Therefore, for a given scene where there are potentially different types (or subtypes) of geometry, an appropriate “shader binding table” can be generated that indexes the corresponding different shader routines that may need to be executed, so that different shader routines can be uniquely identified based on their respective unique shader indices. Shader indices are specifically defined such that they can be computed based on the properties of the rays in question and the intersecting geometry. These computations can be performed in any suitable and desirable manner, for example, as specified in the API requirements. However, in the techniques described herein, in one implementation, these computations are performed by the ray tracing circuitry (unit) itself (using hardware configured to perform these computations) (e.g., instead of returning the geometry determination results to the programmable execution unit and having the programmable execution unit then perform the shader index computation itself). Similarly, all of these effects help improve the overall efficiency of ray tracing operations because, for example, shader index calculations can then be performed by a circuit system (circuit) that can, and in one implementation is indeed optimized, to perform shader index calculations as part of the ray tracing circuit (unit)'s processing of light, which also frees up programmable execution units to perform other processing.
[0089] As mentioned above, in one implementation, once the ray tracing circuit (unit) has finished processing the ray, particularly in response to determining the overall closest-to-hit geometry of the ray, it performs these shader index calculations such that, when the ray tracing circuit (unit) has completed its processing of the ray and determined the closest-to-hit geometry, in one implementation, the ray tracing circuit (unit) determines, based on the type of the intersecting geometry that has been found, which closest-to-hit shader routine should be executed (indexed in the shader binding table of different available closest-to-hit shader routines). The ray tracing circuit (unit) can then, and in one implementation, indeed return the ray along with the shader index identifying the closest-to-hit shader routine that needs to be executed by the programmable execution unit for further processing of the ray to the programmable execution unit.
[0090] However, these shader index calculations can also, and indeed do, in one implementation, be performed as needed during the ray tracing circuit's (unit's) processing of the ray (before the processing of the ray is complete). Therefore, when it is determined, as part of the ray tracing circuit's (unit's) processing of the ray, that ray intersects or potentially intersects a geometry, for that geometry, a shader routine needs to be executed at that point before the ray tracing circuit's (unit's) processing of the ray can continue (i.e., before the traversal of the currently traversed ray-accelerated data structure can continue). In one implementation, the ray tracing circuit is then configured to determine the shader routines that need to be executed for the ray, and then return the ray to the programmable execution unit along with the shader index identifying the shader routines that need to be executed by the programmable execution unit for further processing of the ray (but in this case, once the required shader routines have been executed, the ray is subsequently passed back to the ray tracing circuit's (unit) to continue its processing).
[0091] Therefore, in the implementation, when a ray is found to intersect or potentially intersect with a geometry within the scene, the ray tracing circuit (unit) can be configured to determine, based on the characteristics of the geometry in question, whether a shader needs to be executed at that point (which may be, for example, an "intersecting" or "any hit" shader), and if so, to perform the required shader index calculation to determine the specific shader routine that should be executed with respect to the ray (and then return the shader index along with the ray to the programmable execution unit accordingly for further processing of the ray).
[0092] If the ray tracing circuitry (unit) determines that nothing intersects with the ray (there is an intersection miss), the ray tracing circuitry (unit) should also, and indeed in one implementation, return an indication of the appropriate "miss" shader routine. It should be understood that "miss" shader routines are typically pre-specified for the sampling location or ray in question. That is, for each sampling location in the rendered output, there is a "default" operation selected in one implementation and predefined in another, controlled by executing a specific "miss" shader routine. Therefore, for different sampling locations within a given rendered output, different "miss" shaders may exist and will typically exist. Therefore, in one implementation, an indication of the "miss" shader routine to be executed when the ray does not intersect any geometry is provided to the ray tracing circuitry (unit) along with the data defining the ray in question, rather than having to be calculated by the ray tracing circuitry (unit). For example, in one implementation, a miss index identifying the miss routine that should be invoked for a particular ray is provided to the ray tracing circuit (unit) as part of a message that triggers the ray tracing circuit (unit) to process the ray, as will be explained further below. In the case of an intersection miss, the ray tracing circuit (unit) can then use the provided miss index to look up the relevant miss shader in the shader binding table and then provide that information back to the programmable execution unit to execute the specified miss shader.
[0093] Therefore, in the implementation, once the ray tracing circuit (unit) determines the geometry that intersects with the ray, the ray tracing circuit (unit) is configured to further determine the corresponding shader routine that should be executed with respect to the ray based on the intersecting geometry (or based on determining that the ray does not actually intersect with any geometry in the scene), and return the indication of the shader routine that needs to be executed for the ray to the programmable execution unit.
[0094] In this regard, as described above, there may be (and will exist in the implementation) multiple different shader program routines that can be executed based on the results determined by geometry intersection. For example, there may be one or more different “hit” routines, where the appropriate “hit” routine is determined based on the type of geometry found to intersect with the ray. There may also be (and does exist in the implementation) “miss” routines that should be executed if the ray is found not to intersect with any geometry in the scene. As mentioned above, different shader program routines that may be needed and available for ray invocation may be indexed relative to a shader binding table in one implementation, which has been configured for one or more ray tracing acceleration data structures being used in the ray tracing process, wherein the shader indexes are selected such that the required shader indexes can be appropriately computed by the ray tracing circuitry (unit) based on the characteristics of the ray and / or geometry in question.
[0095] In the techniques described herein, the calculation of which shader routine should be executed is, in one implementation, performed by the ray tracing circuitry itself using an appropriate circuitry configured to do so (e.g., instead of returning the results of the traversal to a programmable execution unit to perform general calculations to compute the required shader index).
[0096] Therefore, in one implementation, the ray tracing circuit (unit) is configured to return to the programmable execution unit an indication of the shader program routines that should be executed by the programmable execution unit with respect to the ray (or set of rays) that has been processed by the ray tracing circuit (unit). That is, in one implementation, when returning a ray or set of rays to the programmable execution unit to execute a shader program routine, the ray tracing circuit (unit) also returns to the programmable execution unit an indication of the shader program routines (or routines) to be executed with respect to the one or more rays in question. In one implementation, the ray tracing circuit (unit) also returns an indication of the reason for the ray being returned.
[0097] The programmable execution unit then generates (generates) a corresponding group of execution threads for executing the specified shader routines for one or more rays in question.
[0098] In other words, according to the techniques described herein, instead of attempting to execute and manage the entire ray tracing operation via a graphics processor's programmable execution unit (GPU), the GPU offloads some of the processing to associated hardware circuitry. Specifically, it offloads the operations of traversing one or more ray tracing acceleration data structures and managing and performing the necessary ray-box or ray-geometry intersection tests to associated hardware circuitry configured and operated to perform such operations, thereby determining which geometry (if any) intersects with the ray, and returning the results of these operations to the programmable execution circuitry (as applicable). In this way, the determination of which geometry (if any) intersects with the ray—and the determination of the appropriate shader routines to be executed based on that determination—can (and in one embodiment does) be executed and managed in hardware by appropriate (e.g., in one embodiment, dedicated) "ray tracing circuitry (unit)" (e.g., as described above).
[0099] This thus has the effect of using dedicated circuitry (hardware) to perform and manage some of the operations in a ray tracing operation (i.e., determining the geometry (if any) that intersects with the ray for which a ray tracing operation is being performed, and in one embodiment, also determining one or more shader routines that should be performed for the ray based on the geometry intersection determination) (rather than, for example, using a more general programmable processing circuitry system (circuit) programmed to perform the desired operations to perform some or all of those operations).
[0100] This results in the determination of which geometries intersect with which rays, for example, being faster and more efficient than, for instance, an arrangement that is accomplished by executing appropriate programs using programmable processing circuitry (which is relatively less efficient, for example, due to poor memory access locality of execution threads corresponding to different rays). This also allows accelerated ray tracing of data structures and determination of geometric intersections to be performed in parallel (simultaneously) with other processing performed by programmable execution units, thereby promoting more efficient overall graphics processor operation, for example and particularly for graphics processors where limited processing resources exist (e.g., graphics processors such as those for mobile devices).
[0101] Furthermore, as described above, by having the ray tracing circuitry (unit) manage all operations in one implementation—up to and including determining the shader routines that need to be executed by the programmable execution unit based on geometric intersections before returning the rays to the programmable execution unit—it means that the calculations involved in these operations can be simplified because they can all be executed in a consistent manner by the ray tracing circuitry (unit). That is, therefore, having the ray tracing circuitry (unit) manage all operations—up to and including determining the shader routines that need to be executed by the programmable execution unit (before passing the rays back to the programmable execution unit along with appropriate indicators (e.g., indexes) for the shader routines that the ray tracing circuitry (unit) has determined should be executed) has specific benefits because this not only allows the required calculations to be performed in a more optimized manner (using appropriate hardware that can and does indeed configure for the required calculations), but also means that the same values can be carried through the hardware calculations as needed and reused as appropriate, saving time that must be repeated for these calculations, and also ensuring more consistent (and correct) results because the calculations can all be performed by the ray tracing circuitry (unit) at the desired level of accuracy.
[0102] For example, when traversing multiple ray tracing acceleration data structures, as described above, it is common practice that rays need to be transformed into different coordinate systems when moving between different ray tracing acceleration data structures. In the techniques described herein, these transformations are performed by the ray tracing circuitry (unit) in one implementation. This means that when performing subsequent calculations such as shader (index) determination, the ray tracing circuitry (unit) already has access to the transformed ray coordinates. Therefore, having the ray tracing circuitry (unit) perform the shader (index) determination calculation itself allows the calculations to be performed by the ray tracing circuitry (unit), using appropriate circuitry (circuit) to do so, while still ensuring correct and consistent results, and without having to recalculate the transformed ray coordinates.
[0103] In contrast, if the ray tracing circuit (unit) returns the ray to the programmable execution unit and enables the programmable execution unit to determine the shader to execute, then the programmable execution unit may need to, for example, recalculate the transformed ray coordinates, or otherwise attempt to trace the results of these calculations between the ray tracing circuit (unit) and the programmable execution unit. However, the programmable execution unit (APU) may not (and generally will not) perform computations in the same way. For example, because the APU of a graphics processor is typically configured to perform computations in floating-point format (e.g., with relatively high precision, such as FP32 precision, and in one embodiment, this is also the case in the technology described herein), while the ray tracing circuitry (unit) can, and in one embodiment, is indeed configured to perform computations in lower precision (e.g., in integer format). Therefore, prematurely returning the ray to the APU is not only less efficient (because the APU will potentially have to recalculate such transformations and then perform the required shader (index) determination computations (instead of doing so in the ray tracing circuitry (unit) to free up the APU to perform other required processing), but there is also a potential risk that the result of the computation performed by the APU may differ from the result obtained by the ray tracing circuitry (unit), which could lead to inconsistencies if not handled properly.
[0104] Therefore, the techniques described herein provide a particularly efficient implementation of the ray tracing process for the use of ray tracing circuits (units) as described herein.
[0105] To further facilitate the operation of the graphics processor in this manner, the techniques described herein also provide a set of one or more dedicated “ray tracing” instructions (e.g., and in one embodiment, a single dedicated “ray tracing” instruction) that can be included in a graphics processing program to perform ray tracing, and which, when executed by one or more execution threads executing a program to perform ray tracing for a corresponding set of one or more rays, includes such instructions as causing a programmable execution unit to trigger a ray tracing circuit (unit) to determine, if any, the geometry (if any) intersecting with a ray in the set of one or more rays by performing an appropriate traversal of the ray in question for an accelerated data structure.
[0106] In other words, in the technique described herein, the entire ray tracing operation is initially performed by the programmable execution unit of the graphics processor executing the graphics processing program to perform the ray tracing operation, as mentioned above. However, when the program performing ray tracing needs to determine which geometry (if any) intersects with the ray, "ray tracing" instructions can (and indeed) be appropriately included in the program, such that when the instruction set is executed as part of the program execution, the programmable execution unit subsequently sends a message to the ray tracing circuit (unit) and triggers the ray tracing circuit (unit) to perform the required traversal and determine the geometry (if any) intersecting with the ray in question.
[0107] According to the specific requirements of the technology described herein, the programmable execution unit can be any suitable and desired programmable execution unit (circuit) that a graphics processor can include. Therefore, the programmable execution unit should (and indeed) be able to operate to execute graphics shading programs to perform graphics processing operations. Thus, the programmable execution unit will receive graphics threads to be executed and execute appropriate graphics shading programs for those threads to generate the desired graphics output.
[0108] Once a thread has completed its processing operation, it can "exit," for example, a new thread can be derived from its position.
[0109] A graphics processor may include a single programmable execution unit or may have multiple programmable execution units. In the presence of multiple programmable execution units, each programmable execution unit may, and indeed does, operate in the manner described herein in one embodiment. In the presence of multiple programmable execution units, each programmable execution unit may be provided as a separate circuit to the other programmable execution units of the data processor, or the programmable execution units may share some or all of their circuitry (circuit elements).
[0110] The (and each) execution unit shall include, and in one implementation scheme, appropriate circuitry (processing circuitry / logic) for performing the operations required to execute the programmable execution unit.
[0111] As is common with graphics processors, in one implementation, the programmable execution unit in the technology described herein is capable of operating to execute a program for a group of multiple threads together, for example, in a lockstep manner (e.g., one instruction at a time) (e.g., in a Single Instruction Multithreaded (SIMT) execution state). This group of execution threads is commonly referred to as a "warp," and both the terms "warp" and "execution thread group" can be used in this application to refer to such a group of threads executing together. In this case, each individual thread in the corresponding thread group (warp) can therefore, and in one implementation, actually execute a graphics processing program to perform ray tracing against a corresponding ray, such that the program is executed against a corresponding set of multiple rays (however, it should be understood here that some threads within the corresponding thread group may be "inactive," in which case there is no corresponding ray for which a program is being executed, for example, because the ray has been discarded at this time (and therefore the corresponding thread terminates), or because the thread group initially produces fewer rays than the number of available execution channels (i.e., the number of rays for which the corresponding thread group is performing ray tracing is less than the maximum width of the thread group (warp)).
[0112] The graphics processor can therefore be configured and operated to group rays together to perform ray tracing, such that the ray tracing program is (at least initially) executed by a corresponding execution thread group for each ray.
[0113] Once a set of rays to be ray-traced together has been selected, the rays should be processed as a group, for example, by deriving a suitable execution thread group and having the execution thread group execute in the manner described above so that the multiple rays can be ray-traced together.
[0114] Therefore, in the techniques described herein, the group of one or more execution threads performing a ray tracing procedure may, and in one embodiment does, include multiple execution threads, and correspond to, for example, a group of threads (warped) that execute the procedure together in a lockstep manner. In one embodiment, the group of execution threads includes more than two execution threads, such as four, eight, or sixteen (or more, such as 32, 64, or 128) execution threads.
[0115] Therefore, the programmable execution unit in the technology described herein, in one embodiment, is operable to trigger a ray tracing circuit (unit) to simultaneously perform geometry determination operations for a group of rays (e.g., equivalent to fully warped rays). Thus, in one embodiment, in response to a group of execution threads executing a "ray tracing" instruction, the programmable execution unit subsequently sends a message to the ray tracing circuit (unit) to determine the geometry (if any) intersecting with a corresponding ray in a group of multiple rays. For example, in one embodiment, the programmable execution unit sends a message to the ray tracing circuit (unit) to process all rays for which the corresponding execution thread in the group executing the "ray tracing" instruction is executing a program to perform ray tracing (i.e., all rays for which the execution thread is actively executing a program to perform ray tracing). (On the other hand, any inactive execution thread, i.e., any ray not currently active for the ray tracing program, is ignored by the ray tracing circuit (unit) in one embodiment.)
[0116] Therefore, in the implementation, there is a set of multiple execution threads whose executors perform ray tracing for a corresponding set of multiple rays, and in response to a thread in the set of multiple execution threads executing a set of one or more ray tracing instructions included in the program, the programmable execution unit is configured to send (and actually send) a message to the ray tracing circuit (unit) about the set of multiple rays to determine the geometry (if any) intersecting with at least one ray in the set (e.g., and in one implementation, for each ray in the set of multiple rays).
[0117] However, as will be explained further below, in one embodiment, the ray tracing circuit (unit) is then configured to individually process and dispose of a ray from a set of rays that trigger the operation of the ray tracing circuit (unit) for the purpose of determining the corresponding geometry that intersects with the corresponding ray delivered to the ray tracing circuit (unit), such that the ray tracing circuit (unit) is configured and is operable to individually determine the geometry that intersects with each ray in the ray to be processed by the ray tracing circuit (unit), wherein in one embodiment, a separate determination is performed for each individual ray that has been notified to the ray tracing circuit (unit) in order to determine the geometry that intersects with the ray (although it will be appreciated here that there may be cases where some of these rays may be discarded within the ray tracing circuit (unit), for example, if the entire ray tracing operation is terminated earlier, such that the ray tracing circuit (unit) does not actually perform geometry intersection determination for the discarded rays, even if it is notified to do so.
[0118] In other words, once a ray has been passed to the ray tracing circuit (unit), in one implementation the ray tracing circuit (unit) processes the ray individually for the purpose of determining the geometry (if any) where it intersects with the ray (e.g., rather than trying a set of rays together to traverse the ray tracing acceleration data structure).
[0119] Therefore, the ray tracing circuit (unit) is operable to determine a corresponding individual result for each corresponding ray being processed by the ray tracing circuit (unit) (i.e., a corresponding determination of the intersecting geometry (e.g., and in one embodiment, the "closest to hit" geometry)), and in one embodiment, it is operable to determine one or more corresponding shader procedures to be performed for each individual ray.
[0120] Once the ray tracing circuit (unit) has finished processing a ray or a group of rays, in one embodiment, the ray tracing circuit (unit) then accordingly notifies the programmable execution unit, for example, by providing the programmable execution unit with a shader index that identifies one or more shader programs that should be executed for further processing of the single ray or multiple rays in question.
[0121] In this regard, it should be understood that even if the ray tracing circuit (unit) performs individual determination for each individual ray, the ray tracing circuit (unit) may, and in one embodiment, return a group of multiple rays together to the programmable execution circuit (unit) for further processing, for example, and in one embodiment, by sending a message about a group of multiple rays to the programmable execution unit at once (e.g., in a manner similar to the programmable execution unit initially notifying the ray tracing circuit (unit) to trigger the geometry intersection determination for a group (e.g., equivalent to warped) of rays at once).
[0122] Therefore, in one embodiment, the ray tracing circuit (unit) is configured and operable to determine which geometry (if any) intersects with a single ray being used in the ray tracing process and which ray has been passed to the ray tracing circuit (unit) in the manner described above. However, in one embodiment, the ray tracing circuit (unit) is subsequently configured and operable to return the results of geometry determination for one or more (e.g., multiple) rays at a time (e.g., by indicating the corresponding shader program routines to be executed). Thus, in one embodiment, the ray tracing circuit (unit) sends a message about a set of rays to a programmable execution unit to trigger further processing of the rays in that set by a set of execution threads that have been generated to process the set of rays, which execute one or more corresponding shader program routines to further process the rays.
[0123] Ray tracing circuits (units) can be configured to process one ray at a time, for example, such that when the operation of the ray tracing circuits (units) is triggered for a group of rays, the corresponding rays within that group are then processed sequentially one after another.
[0124] However, in implementations, the ray tracing circuit (unit) is capable of operating to process multiple rays in parallel (e.g., simultaneously). The ray tracing circuit (unit) can therefore be configured to have multiple parallel processing "channels," each capable of operating to manage the traversal of a corresponding ray. The ray tracing circuit (unit) can be configured and capable of operating to traverse any desired number of rays in parallel. For example, the ray tracing circuit (unit) can be configured such that the number of channels available for traversal is the same as the number of threads that the programmable execution unit can execute together as part of a (single) corresponding thread group (e.g., in a lockstep manner). However, in general, the ray tracing circuit (unit) can be configured to trace more or fewer rays than the number of rays within the corresponding execution thread group of the programmable execution unit.
[0125] This can then provide various beneficial effects in terms of sharing resources (e.g., memory access) across multiple rays that are being processed in parallel by the ray tracing circuitry (cells).
[0126] For example, as will be explained further below, ray tracing circuit (cell) operation for a single ray typically involves retrieving various node data (which may include node box data, but when the node is an end node, it may also include geometry data or data identifying another ray tracing accelerated data structure to be traversed, for example, according to the construction of the ray tracing accelerated data structure) associated with the node from memory, and then appropriately using the associated node data to test the ray relative to the node.
[0127] Therefore, in one embodiment, the ray tracing circuit (unit) is capable of operating to process multiple rays in parallel, and in another embodiment, different rays have access to shared resources, such as shared memory access paths, through which desired node data can (and indeed) be retrieved from memory as needed.
[0128] This can then help further improve the efficiency of the ray tracing process, since the acquisition of node data and the testing of ray correspondence can be fully managed by the ray tracing circuit (unit), and therefore can be performed in a more optimized manner (e.g., compared to performing this using a programmable execution unit).
[0129] In this regard, various arrangements for optimizing the parallel processing of multiple different rays within a ray tracing circuit (unit) will be possible.
[0130] As mentioned above, the operation of the ray tracing circuit (unit) in the technology described herein can (and does) be triggered in response to one or more threads of a program being executed to perform ray tracing with respect to a corresponding set of one or more rays of a set of one or more “ray tracing” instructions (or a single “ray tracing” instruction) that have been included in the program to perform ray tracing.
[0131] Therefore, in response to the thread executing the instruction, the programmable execution unit is then configured to send a message to the ray tracing circuit (unit) so that the ray tracing circuit (unit) begins processing the rays in that set of rays to determine the geometry (if any) intersecting with the respective rays. Upon receiving such a message from the programmable execution unit, the ray tracing circuit (unit) thus creates rays for which geometry determination is to be performed, and then processes them accordingly to determine the geometry (if any) intersecting with the rays.
[0132] In order to create the ray to be traced, the ray tracing circuit (unit) therefore needs to obtain appropriate data defining the ray to be traced. This ray data defining the ray to be traced is typically stored in external memory, such as main memory. The ray tracing circuit (unit) can therefore load the data defining the ray from its location in memory, for example, and in one embodiment, via the graphics processor's cache system (e.g., a load / store cache).
[0133] That is, when the programmable execution unit triggers the ray tracing circuit (unit), the programmable execution unit can, for example, appropriately store the ray data in memory at that time, and the ray tracing circuit (unit) can then load the ray data back to perform the desired geometry determination. Therefore, ray data defining the rays to be traversed can be transferred between the programmable execution unit and the ray tracing circuit (unit) via a memory system, and this can be done in the embodiments. However, this can be relatively inefficient.
[0134] Therefore, in one implementation, the message sent by the programmable execution unit regarding a given ray to trigger the ray tracing circuit (unit) to determine the geometry (if any) intersecting with that ray also includes parameters for creating the ray. That is, in one implementation, the programmable execution unit loads ray data defining the ray at the start of program execution, but subsequently passes the ray data defining the ray to the ray tracing circuit (unit) when needed, without the ray tracing circuit (unit) having to load data from the memory system. This thus avoids the ray tracing circuit (unit) having to load the ray back from memory when it is to be used (and correspondingly also avoids the programmable execution unit having to store the ray in memory at this time).
[0135] Therefore, in the implementation, the message sent by the programmable execution unit to the ray tracing circuit (unit) indicates one or more parameters of the ray (and in the implementation, the ray) to which the ray tracing circuit (unit) will perform traversal.
[0136] For example, each ray can, and indeed in one implementation, be defined based on the origin (starting position (e.g., x, y, z coordinates) of the ray to be tested (to which the traversal of the ray tracing acceleration data structure is to be determined); the direction (direction vector) of the ray to be traversed in the ray tracing acceleration data structure; and the range (distance) of the ray to be traversed (the (minimum and / or maximum) distance of the ray to be traversed in the scene).
[0137] In implementations, the message therefore includes parameters indicating one or more of the following: the origin of the ray, the direction of the ray, and the extent of the ray. These parameters can be indicated in any suitable and desired manner. For example, in one implementation, ray data is initially loaded by a programmable execution unit into a set of registers associated with the programmable execution unit, and in this case, the message may include pointers to relevant data defining the ray (e.g., pointers to registers storing that data). Alternatively, the message may include one or more fields for directly indicating at least some of the parameters defining the ray. In this respect, various other arrangements will certainly be possible.
[0138] Therefore, in one implementation, the ray parameters used to create new rays are passed to the ray tracing circuit (unit) via a register rather than via a memory.
[0139] (For example, when instructions in a program are executed, a programmable execution unit (e.g., an appropriate functional unit of the programmable execution unit, such as an arithmetic unit) typically reads one or more input data values (operands), uses those input data values to perform processing operations to generate output data values, and then returns those output data values, for example, for further processing by subsequent instructions in the executed program and / or for output (for purposes different from those during the execution of the executed program). The input data values to be used when instructions are executed are typically stored "locally" in an appropriate set of registers (register files) accessible to the execution (functional) unit, and the output data values generated by the execution (functional) unit when instructions are executed are written back to that memory (register file) accordingly.)
[0140] To facilitate this operation, each execution thread is allocated one or more register sets accordingly when executing a shader program, for its use during the execution of the shader program. Therefore, when an instruction is executed, the execution thread reads input data values (operands) from one or more registers in one or more register sets allocated to that thread, and writes its output values back to one or more registers allocated to the thread's registers. Data is loaded into registers and written out of registers, or written to or from the appropriate memory system of the graphics processor or a memory system accessible to the graphics processor (e.g., via an appropriate cache system (cache hierarchy)).
[0141] Therefore, in addition to the programmable execution unit, the graphics processor includes a set of registers (register file) that can be manipulated and used to store data for the executing thread. Each of one or more threads in a set of execution programs executing a shader program will have an associated set of registers for storing data allocated to it (as well as the execution thread being executed by the programmable execution unit) from the entire set of registers (register file) available to it (input data to be processed by the execution thread or output data generated by the execution thread).
[0142] A register set (register file) can take any suitable and desired form and be arranged in any suitable and desired manner, such as including a single or multiple memory banks.
[0143] The graphics processor will accordingly include appropriate load / store units and communication paths for transferring data between registers / register files and the graphics processor's memory system or a memory system accessible to the graphics processor (e.g., and in an embodiment, via an appropriate cache hierarchy).
[0144] Therefore, in one embodiment, the graphics processor has a suitable interface to and communicates with the graphics processor's memory (memory system) or the memory accessible to the graphics processor (memory system).
[0145] In one embodiment, the memory and memory system are the main memory of the graphics processor or main memory accessible to the graphics processor, such as memory dedicated to the graphics processor, or main memory of a data processing system in which the graphics processor is part. In one embodiment, the memory system includes a suitable cache hierarchy located between the main memory of the memory system and the programmable execution unit of the graphics processor.
[0146] The message that triggers the ray tracing circuit (unit) to perform a traversal for a given ray may also contain any other suitable parameters or other information that can be expected to be passed from the programmable execution unit to the ray tracing circuit (unit). For example, in the case of multiple different ray tracing acceleration data structures, the message may also indicate which ray tracing acceleration data structure the ray should traverse (e.g., by referring to the "root" node of the ray tracing acceleration data structure to which the ray should begin its traversal).
[0147] At least in cases where the graphics processor includes multiple programmable execution units, the message in one implementation also indicates the sender of the message (i.e., which programmable execution unit has sent the message), so that the result of the traversal can be returned to the correct programmable execution unit.
[0148] The message sent from the programmable execution unit to the ray tracing circuit (unit) may also contain other information, including, for example, an indication of a “missing” shader (which may, for example and indeed in one embodiment, be provided in the form of a missing shader index identifying the desired “missing” shader among a plurality of available “missing” shaders), which shall be executed if the ray tracing circuit (unit) determines that the ray does not intersect any geometry (such that in this case, the ray tracing circuit (unit) can then use the provided missing index to look up the relevant “missing” shader in the shader binding table and then return the specified “missing” shader to the programmable execution unit for execution).
[0149] In the implementation, as mentioned above, the ray tracing circuit (unit) is also operable to pass the ray back to the programmable execution unit, for example, to execute a desired shader program routine for further processing of the ray in question. For example, this could be a situation where the ray tracing circuit (unit) has already completed its processing of the ray. In this case, in one implementation, the ray tracing circuit (unit) sends a message to the programmable execution unit to execute the desired shader program routine.
[0150] However, before the ray tracing circuitry (unit) has finished processing the rays (i.e., during the traversal of the ray tracing accelerated data structure), the ray tracing circuitry (unit) can also instruct the programmable execution unit to execute desired shader routines, such as "intersection" or "any hit" shaders. This might be the case, for example, when the ray tracing circuitry (unit) determines that a ray intersects or potentially intersects with some type of geometry for which its shader needs to be executed in order to determine whether an intersection should be counted. In this case, once the desired shader routine has been executed, the programmable execution unit should therefore (and in one embodiment does) pass the ray back to the ray tracing circuitry (unit) so that the ray tracing circuitry (unit) can resume the ray traversal.
[0151] In this context, the messages passed back and forth between the programmable execution unit and the ray tracing circuit (unit) can, and in one implementation, also indicate the current progress or state of the ray traversal. This information can then be used to accelerate the traversal upon resumption, for example by allowing at least some tests to be skipped when resuming the traversal if the result of the test is known from the previous traversal (i.e., the traversal that was stopped to execute the shader routine).
[0152] Therefore, the messages sent to the ray tracing circuit (unit) can further indicate the current progress or status of the ray traversal. This will be explained further below.
[0153] In any of these cases, when the ray returns from the ray tracing circuit (unit) to the programmable execution unit, the message sent by the ray tracing circuit (unit) to the programmable execution unit includes, in one embodiment, an indication of the reason for the ray's return, and in another embodiment, an indication of the shader routine to be executed (e.g., a shader index identifying the desired shader routine), for example, as mentioned above.
[0154] As noted above, in the implementation, the ray tracing circuit (unit) is configured and operable to return a group of one or more rays together to the programmable execution unit, such that the programmable execution unit can generate a corresponding set of one or more execution threads for processing the rays. Therefore, in one implementation, the ray tracing circuit (unit) is configured to return the result of the traversal operation to the programmable execution unit (by sending an appropriate message indicating the result) with respect to a group of multiple rays (particularly corresponding to a group of rays for which the shader program can be executed by the corresponding set of execution threads within the programmable execution unit).
[0155] Therefore, in some implementations, the ray tracing circuit (unit) returns the result of a group of multiple rays at a time. In this regard, it should be understood that the ray tracing circuit (unit) does not need to return the same group of rays that were executed as part of the corresponding thread group that triggered the operation of the ray tracing circuit (unit). Thus, while the ray tracing circuit (unit) can, and does maintain, the original group of rays in some implementations, in some implementations the ray tracing circuit (unit) is operable to return arbitrary groups of rays to the programmable execution unit, and can then generate a corresponding thread group for them. Therefore, in some implementations the ray tracing circuit (unit) is operable to regroup rays, for example, and in one implementation, to attempt to optimize the sequential execution of the ray tracing procedure. For example, the ray tracing circuit (unit) may attempt to return a group of rays that will need to execute the same shader routines (e.g., to increase code consistency) or that are spatially close to each other. Alternatively, the ray tracing circuit (unit) may simply group rays based on completion time, for example, in a "first-come, first-served" manner to ensure continuous throughput. Various other arrangements will be possible in this regard.
[0156] In one implementation, the message sent (returned) from the ray tracing circuit (unit) to the programmable execution unit also includes parameters defining the ray (e.g., the same parameters sent from the programmable execution unit to the ray tracing circuit (unit)).
[0157] In this regard, it should be understood that the traversal operation performed by the ray tracing circuit (unit) can allow for the updating of ray properties. For example, in response to determining that a ray intersects with some opaque geometry, the range (distance) that the ray will traverse can be shortened (because it is known that the ray will not traverse the scene beyond the intersecting opaque geometry). Because the traversal is managed by the ray tracing circuit (unit), the ray tracing circuit (unit) should therefore, and in one implementation, indeed, pass back the (updated) parameters defining the ray to the programmable execution unit.
[0158] (It should be understood that when the processing of rays is returned to the programmable execution unit for the execution of the desired "intersection" or "any hit" shader, and where the rays will subsequently be passed back to the ray tracing circuitry (unit) to complete its processing, passing updated ray parameters to the programmable execution unit at this time, so that they can be returned accordingly to the ray tracing circuitry (unit) when processing of the rays is to continue, can also help the ray tracing circuitry (unit) accelerate the processing of ray recovery, because in this case, the updated ray parameters can allow for further selection of one or more ray tracing acceleration data structures to be traversed. Therefore, this can provide additional beneficial effects in this respect.)
[0159] In one implementation, before the ray tracing circuit (unit) returns the ray to the programmable execution unit, the ray tracing circuit (unit) also stores in memory the (updated) parameters defining the ray and any other information about the results of the traversal so far, such as the determination of the geometry that has been found to intersect with the ray (if any), for example, and in one implementation, this information is stored in memory. That is, when the ray tracing circuit (unit) needs to return the ray (processing) to the programmable execution unit, in one implementation, the ray tracing circuit (unit) writes the results of its processing operation to memory at this time, making the data available for further use. Similarly, having the ray tracing circuit (unit) manage memory write operations helps reduce memory access bandwidth because the ray tracing circuit (unit) is configured in one implementation to handle most of the processing itself, thus reducing the amount of memory writes in one implementation. For example, typically, it is expected that the ray tracing circuit (unit) may only need to pass the ray back to the programmable execution unit once the processing of the ray is complete (i.e., it is expected that the situation where the ray can be returned before processing is complete is relatively rare), so that the results and updated ray data, etc., can be written to memory in a single, relatively "wider" memory transaction.
[0160] In one implementation, the parameters defining the ray can be selectively returned to and written to memory by the ray tracing circuitry (unit). For example, in some cases, the programmable execution unit may only need to know why the ray has been returned, without needing updated ray data. In this case, the message sent by the programmable execution unit to the ray tracing circuitry (unit) can use appropriate fields or tags to indicate that ray data does not need to be stored for the ray in question.
[0161] In this respect, various arrangements will be possible.
[0162] Messages sent between the ray tracing circuitry (unit) and the programmable execution unit can also include, for example, the results of any computations already performed by either unit. This can then help ensure that different units use consistent values, as recalculation results can lead to inconsistencies, since the ray tracing circuitry (unit) and the programmable execution unit will typically perform computations differently (e.g., with different precision and / or using different number formats, such as integers instead of floating-point). This can include, for example, the results of any transformations computed when moving between different ray tracing acceleration data structures.
[0163] Of course, various other suitable information can be transmitted in messages between the ray tracing circuit (unit) and the programmable execution unit as needed. In one implementation, when messages are sent back and forth between the ray tracing circuit (unit) and the programmable execution unit, the same message format is used for message transmission in both directions. However, other arrangements are also possible.
[0164] The actual determination of the geometry (if any) intersecting with a given ray can usually be performed in any suitable and desirable manner.
[0165] However, in general, determining the geometry that intersects with a given ray (if any) involves performing a corresponding traversal of at least one ray tracing acceleration data structure, which involves testing the intersection of the ray being traversed against and the corresponding boxes associated with the nodes of the ray tracing acceleration data structure, in order to determine which nodes potentially contain the geometry that intersects with the ray, and which nodes the traversal should subsequently visit for further intersection testing of the ray.
[0166] Therefore, as mentioned above, ray tracing operations according to the techniques described herein are performed using one or more ray tracing acceleration data structures. The ray tracing acceleration data structures used and traversed in the techniques described herein can be any suitable and desired ray tracing acceleration data structure that indicates (represents) the geometric distribution of the scene to be rendered, and these ray tracing acceleration data structures can be used (and traversed) to determine the geometry of the scene that can intersect with rays being projected into the scene to be rendered.
[0167] In one implementation, one or more ray tracing acceleration data structures represent corresponding boxes within the scene being rendered, and indicate and / or can be used to determine the geometry of the scene to be rendered that exists within those boxes.
[0168] Ray tracing acceleration data structures can take any suitable and desired form. In one embodiment, the ray tracing acceleration data structure includes a tree structure, such as a hierarchical bounding box (BVH) tree. In this case, these hierarchical bounding boxes can be axially aligned (cube) boxes. Each end node can therefore be associated with a corresponding bounding box. The bounding boxes are then recursively clustered and wrapped within each other until a single root node is reached. At each level of recursion, two or more bounding boxes can be clustered into a single parent bounding box. For example, and in one embodiment, each non-leaf node has a corresponding number of child nodes. In one embodiment, the ray tracing acceleration data structure used in the techniques described herein includes a “wide” tree structure, where each parent node can (and does in one embodiment) be associated with more than two child nodes (such as three, four, five, six, or more child nodes). In one embodiment, each parent node can be associated with up to six child nodes.
[0169] However, other suitable ray tracing acceleration data structures can also be used as needed. For example, instead of using a BVH hierarchy, where the scene is subdivided by boxes on a per-object basis, for example by drawing appropriate bounding boxes around subsets of geometry, such that each leaf node (box) corresponds to a certain number of objects (primitives) in one implementation, the scene can be subdivided into sub-boxes of substantially equal size on a per-box basis. For example, ray tracing acceleration data structures can include kd-tree structures, voxels (mesh hierarchy), etc., as needed. A “hybrid” ray tracing acceleration data structure can also be used, where the scene is subdivided partly on a per-object basis and partly on a per-box basis. Various other arrangements are also possible, and the techniques described herein can generally be used with any suitable ray tracing acceleration data structure.
[0170] Therefore, in one implementation, the ray tracing accelerated data structure includes hierarchical bounding boxes, and in another implementation, it includes a BVH tree. When multiple ray tracing accelerated data structures exist, in one implementation, each of these data structures includes a corresponding bounding box hierarchy. However, it is also envisioned that various different types of ray tracing accelerated data structures can be defined to represent the geometric distribution within a given scene.
[0171] In one implementation, at least one primitive (which can be a triangle or other suitable geometric object) is represented at a corresponding end (e.g., leaf) node in the ray tracing acceleration data structure. In this case, the primitive at the end node is enclosed in a bounding box. Therefore, if a ray intersects the bounding box associated with the end node, it means that the ray potentially intersects with the geometry contained within that bounding box, and thus the ray tracing process should continue to test the intersection of the ray with the actual geometric unit to determine which geometry (if any) it actually intersects with.
[0172] Ray tracing accelerated data structures can represent and indicate the geometric distribution of a scene to be rendered in any suitable and desired manner. Therefore, it can represent geometry based on a single graphical primitive or multiple sets of graphical primitives, for example, such that each leaf node of a tree structure is represented as a corresponding subset of graphical primitives defined for the scene occupying the box corresponding to that leaf node. Alternatively, ray tracing accelerated data structures can represent the geometry of a scene in a higher-level representation (description) of the geometry, such as based on a model or object comprising multiple primitives.
[0173] As mentioned above, for a given ray tracing acceleration data structure, geometry can also be represented by additional ray tracing acceleration data structures that indicate the need for analysis. In this case, the initial ray tracing acceleration data structure will, for example, further represent ray tracing acceleration data structures with a finer resolution that need to be considered for different boxes in the scene. As the initial ray tracing acceleration data structure is traversed, one or more additional ray tracing acceleration data structures that need to be traversed are then determined, depending on which boxes in the scene the considered rays intersect with.
[0174] Therefore, ray traversal operations can include transformations between different ray tracing accelerated data structures, such as transformations between different levels of detail (LOD), and / or transformations between different levels of multi-level ray tracing accelerated data structures.
[0175] Ray transformations can also exist between ray tracing accelerated data structure transitions (e.g., enabling automatic transitions between different ray tracing accelerated data structures that have and / or use ray transformations, such as those described by or associated with the metadata of the ray tracing accelerated data structure). For example, transitions between different levels of detail can use identity transformations, and transitions between multi-level ray tracing accelerated data structures can use general affine transformations of these rays. (As briefly mentioned above, in this case, the ray tracing circuitry (unit) is configured in one embodiment to compute such transformations itself (using appropriate, for example, and in one embodiment, dedicated circuitry system (circuit) to do so), and the messages exchanged between the ray tracing circuitry system (unit) and the programmable execution unit are subsequently configured in one embodiment to indicate the result of such computation to save the result, which must be recomputed by different units (with potentially inconsistent results).)
[0176] In this respect, various arrangements will be possible.
[0177] Ray-tracing accelerated data structures can be generated and served in any suitable and desired manner. For example, they can be previously determined and provided as part of, for example, the definition of a scene for rendering by applications that require graphics processing.
[0178] In one implementation, the ray tracing acceleration data structure is generated by the graphics processor itself, for example based on an indication of the geometry of the scene provided to the graphics processor in a preliminary processing pass before rendering the scene.
[0179] It can also be generated by the CPU (e.g., the host processor), for example, as an indication based on scene geometry, such as in the initial processing pass before rendering the scene.
[0180] Of course, other arrangements are possible.
[0181] Depending on the specific requirements of the technology described herein, the traversal operation can traverse one or more ray tracing acceleration data structures in any suitable and desired manner (e.g., and in one implementation, depending on the form of the ray tracing acceleration data structure being traversed). The traversal operation will use the provided information about the ray to traverse one or more ray tracing acceleration data structures to determine the geometry of the scene to be rendered that can intersect with the considered ray.
[0182] For example, as mentioned above, a traversal operation for a given ray typically involves traversing at least one ray tracing acceleration data structure and testing the intersection of the ray with a corresponding box and / or geometry associated with a corresponding node of one or more ray tracing acceleration data structures being traversed (the type of test performed depends on the type of node being tested).
[0183] Therefore, in one implementation, the traversal process is used to traverse one or more ray tracing acceleration data structures to determine whether any geometry (indicated by the ray tracing acceleration data structure) exists within each box of the scene through which the ray passes in sequence. Thus, the ray tracing acceleration data structure is traversed based on the position and direction of the ray to determine whether any geometry (which may subsequently intersect with the ray) exists within a box of the scene along the path of that ray. Of course, other arrangements are possible.
[0184] Specifically, the traversal process involves testing the intersection of a ray with one or more (child) boxes associated with a node in the ray tracing acceleration data structure for the ray being used in the ray tracing process, in order to determine the associated boxes (i.e., child nodes) that intersect with the ray. The traversal process then includes subsequently testing the intersection of the ray with boxes associated with (child) nodes in the next level of the ray tracing acceleration data structure, and so on, down to the lowest level (end, e.g., leaf) nodes. Once the traversal process has passed through the ray tracing acceleration data structure, the required ray-to-box intersection tests are performed on the nodes to determine which boxes (represented by end / leaf nodes) contain geometry that may intersect with the ray. The ray can then be further tested to determine the actual (ray-to-primitive) intersections with the geometry defined within (and only within) those boxes (where any intersecting geometry is then appropriately colored).
[0185] Therefore, in one implementation, traversal is performed by first testing the root node at the top of the first ray traversal data structure and determining whether a ray intersects with the corresponding box of any child node of that root node. If so, the traversal continues to test the ray with respect to the child nodes found to intersect, and then with respect to any child node of the child nodes found to intersect, and so on, until the end node at the lowest level of the first ray traversal data structure.
[0186] Therefore, in one implementation, a suitable traversal record is maintained to track and manage which nodes should be tested during the traversal operation. Thus, in one implementation, the traversal record includes as entries an indication of which nodes of the ray tracing acceleration data structure should be tested (i.e., which nodes have boxes that have been determined to intersect with the rays performing the traversal operation).
[0187] The traversal record can typically take any suitable form, such as those applicable to managing such ray traversal operations, but in one implementation, a traversal "stack" is included.
[0188] Therefore, during a ray traversal operation, when (and whenever) the instance of ray and box testing determines that a (child) node represents a subset of geometry that may intersect with the ray performing the traversal operation, the node's indication (e.g., a pointer to the node) is then included (e.g., pushed into) the traversal record, so that the entry can then be read (popped) from the traversal record, thereby enabling the ray to be tested against that node accordingly, and so on.
[0189] The traversal record can then be processed by reading (popping) record entries accordingly to determine which nodes to test next. In the case of traversing a stack, this is managed in one implementation using a "last-in, first-out" scheme, where intersecting nodes are appropriately pushed onto or popped from the stack. However, various arrangements are also possible for this purpose.
[0190] Therefore, in one implementation, the ray tracing circuit (unit) maintains a corresponding traversal record for each ray performing the traversal (e.g., and in one implementation, in the form of a traversal "stack" as described above), where the traversal record indicates which node should be visited next as part of the traversal. The traversal is then performed accordingly by visiting the nodes in the order they are listed in the record. In this respect, it should be understood that nodes can be added to the traversal record in any suitable and desired order. Various arrangements are contemplated in this regard. For example, it might be more efficient to prioritize testing peer nodes over internal nodes. However, other examples are certainly possible.
[0191] Therefore, in one implementation, when a ray is created at the ray tracing circuit (unit), the ray traversal record (stack) is initialized. Thus, in response to the ray tracing circuit (unit) receiving a message from the programmable execution unit regarding the determination of the geometric intersection of the rays, in one implementation, the ray tracing circuit (unit) then creates the ray to be processed (as described above), and subsequently initializes a corresponding traversal record (stack) for each ray to be processed. That is, in the implementation, each ray has its own corresponding separate traversal record (stack) (e.g., instead of attempting to maintain a total traversal record for multiple rays together).
[0192] In one implementation, the traversal record (stack) is then (fully) managed via ray tracing circuitry (cells), and in another implementation, the traversal record (stack) is not written to memory (except in the case of, for example, overflow).
[0193] Therefore, when it is necessary to return the processing of a ray to the programmable execution unit to execute shader routines (e.g., execute intersection or "any hit" shaders, as mentioned above) before the ray tracing circuit (unit) has finished processing the ray, the current state of the traversal record (stack) is discarded at this time in one implementation (e.g., and in another implementation, it is not saved to memory), so that when the ray is passed back to the ray tracing circuit (unit) to resume its traversal, the traversal is resumed from the starting point, for example from the root node at the top of the corresponding accelerated data structure that the ray is to traverse, and a new traversal record (stack) is created to manage the resumed traversal.
[0194] The traversal operation is then performed accordingly. For example, when a test indication of a ray relative to a given node indicates that one or more other (e.g., child) node boxes associated with that node intersect the ray, the intersecting (child) nodes can then (and in one implementation do) be added accordingly to the traversal record, such that traversal continues by subsequently visiting and testing these nodes, etc., until it is determined that the ray intersects a node box representing the actual geometry (in which case the ray should then be tested relative to the corresponding geometry cell to determine whether it actually intersects the geometry), or conversely until it can be determined that the ray does not intersect any geometry (i.e., there is a "miss").
[0195] In some implementations, the traversal operation iterates through one or more ray tracing acceleration data structures along the path of the ray until a first (possible) intersection of the ray with a geometry defined for the scene is found. However, if desired, the traversal of the ray tracing acceleration data structures can continue after the first (possible) intersection of the ray has been found.
[0196] For example, a ray traversal operation can (and in one implementation) be configured and capable of discarding (ignoring) (potential) intersections and continuing traversal, for example, based on the characteristics of the intersecting geometries under consideration. For example, if the (potentially) intersecting geometries are fully or partially transparent, it may be desirable to continue traversal (and discard or retain the initial "transparent" intersections).
[0197] Of course, other arrangements are possible. For example, as described above, in other embodiments, if the intersecting geometry is (potentially) fully or partially transparent, the ray tracing circuit (unit) can, and in some embodiments is indeed, configured to stop traversal and return the ray to the programmable execution unit to execute an appropriate intersection shader to determine whether the ray actually intersects the geometry and how the traversal should continue.
[0198] Ray tracing acceleration data structure traversal for a ray can include traversing a single ray tracing acceleration data structure for that ray, or traversing multiple ray tracing acceleration data structures for that ray. For example, in cases where the entire box and / or geometry of a scene is represented by multiple different ray tracing acceleration data structures, multiple ray tracing acceleration data structures can be traversed for a ray.
[0199] Therefore, in one implementation, the ray tracing acceleration data structure traversal operation for a ray includes traversing multiple ray tracing acceleration data structures for the ray to determine the geometry of the scene to be rendered that can intersect with the ray.
[0200] For example, as discussed above, in one implementation, a ray tracing acceleration data structure is used to indicate additional ray tracing acceleration data structures to be traversed. Therefore, in this case, the ray tracing acceleration data structure traversal circuitry would first traverse the initial ray tracing acceleration data structure of the ray to determine one or more additional ray tracing acceleration data structures to be traversed for the ray, and then traverse those determined one or more ray tracing acceleration data structures for the ray, and so on, until one or more “end” ray tracing acceleration data structures provide an indication of the geometry of the scene to be rendered for the ray traversal.
[0201] In this respect, various other arrangements will be possible.
[0202] When traversing an accelerated data structure, the ray tracing circuit (unit) therefore tests rays relative to the nodes of the accelerated data structure to determine how the traversal should continue. For this purpose, the ray tracing circuit (unit) therefore needs to obtain the relevant node data for the corresponding nodes of one or more ray tracing accelerated data structures being traversed.
[0203] In one implementation, node data is stored in a specific location in memory, such as external (e.g., main) memory. Therefore, in one implementation, the ray tracing circuitry (unit) is operable to retrieve node data from its location in memory when needed, and subsequently perform the required intersection test relative to the node data as part of a traversal operation.
[0204] As mentioned above, the ray tracing circuit (unit) therefore has an interface to external memory in one embodiment. In one embodiment, the ray tracing circuit (unit) also includes local memory, such as a cache, where node data can be stored locally in the graphics processor. Therefore, in the embodiment, memory access is performed via a cache system accessible by the ray tracing circuit (unit), which may include, for example, the graphics processor's load / store cache.
[0205] Therefore, when a given ray requires data for a specific node (e.g., the corresponding child node box or a corresponding set of geometries covered by the node in question) as part of its traversal, in one implementation, the request for the node data is made via such local storage (e.g., via a cache system, if present). If the node data is already available in local memory, the requested data can be read from there. Otherwise, the ray may need to wait until the node data becomes available. In this case, the ray's traversal may need to be paused until the node data has been acquired in local memory.
[0206] Therefore, the result of ray traversal is to first refer to the corresponding node boxes of one or more ray tracing acceleration data structures or nodes being traversed to determine which geometry (if any) potentially intersects with the ray. Once it has been determined that the ray potentially intersects with the geometry represented by a given end node of the ray tracing acceleration data structure, the ray tracing circuit (cell) continues to determine whether it actually intersects with the geometry represented by the end node.
[0207] The actual intersection test itself can be performed in any appropriate and desired manner, such as in the normal way used for ray tracing operations (the difference being that it is now managed by a new type of ray tracing circuit (unit) of the technology described herein, which is configured to do so).
[0208] As described above, for example, depending on which geometry (if any) intersects with the ray that is being traversed against, there are various options regarding how the traversal operation can then proceed.
[0209] For example, if the ray tracing circuitry (cell) can determine that a ray intersects an opaque geometry, this can be recorded and used to update the record of the "closest hit" geometry (if appropriate), and the traversal operation can then proceed accordingly to test the next geometry cell associated with that end node (or the next node to be tested listed in the traversal record). Once all geometries have been considered and the final determination of the "closest hit" geometry has been made, the result can be recorded accordingly, and the corresponding "closest hit" shader routine can then be executed to render the sampled location associated with the ray accordingly, as described above.
[0210] On the other hand, if the ray tracing circuit (unit) determines that the ray intersects with a non-opaque (e.g., transparent) geometry or other geometry that the ray tracing circuit (unit) itself cannot handle, then in this case, as described above, the ray tracing circuit (unit) may need to immediately return the ray to the programmable execution unit, such that in one embodiment, the ray tracing circuit (unit) is configured to terminate the current traversal operation and return the ray to the programmable execution unit to execute the required shader procedure. In this case, in one embodiment, the traversal is subsequently resumed, for example, and in one embodiment, the traversal is resumed from the starting point.
[0211] Correspondingly, if the ray tracing circuit (unit) determines that the ray does not actually intersect any geometry in the scene, the result can be recorded accordingly, and the corresponding "miss" shader routine can then be executed for that ray, as described above.
[0212] In one implementation, once the ray traversal operation is complete, the ray tracing circuit (unit) writes the result of the traversal operation to memory. In another implementation, any updated ray parameters (e.g., if the ray has been shortened) are also written in a single memory write. In another implementation, after the ray data is initially loaded by the programmable execution unit at the start of program execution, the ray data (and any other information about the progress or result of the ray traversal) is then managed by the ray tracing circuit (unit). In one implementation, any such information is then passed between the ray tracing circuit (unit) and the programmable execution unit by sending appropriate messages (rather than via memory). In some implementations, once the entire traversal operation is complete, the data is written back to memory only by the ray tracing circuit (unit).
[0213] Therefore, the effect of all this is to provide a more efficient overall ray tracing method, particularly where a portion of the ray tracing process can (and indeed) be offloaded to the ray tracing circuit (unit), rather than attempting to perform the entire ray tracing operation through general program execution in a programmable execution unit. The operation of the ray tracing circuit (unit) and the message passing between the ray tracing circuit (unit) and the programmable execution unit are then configured in one implementation to do so in a particularly efficient manner. To trigger the operation of the ray tracing circuit (unit), the techniques described herein also provide corresponding ray tracing instructions that can be included in the program to perform ray tracing as needed, thereby also reducing the burden on application programmers and facilitating more efficient shader program code generation.
[0214] Therefore, the techniques described in this paper are particularly well-suited for using dedicated circuitry (hardware) in this way to provide comprehensive, improved (more efficient) ray tracing operations.
[0215] Therefore, the technique described in this paper can provide a variety of beneficial effects compared to other possible methods.
[0216] The techniques described in this article specifically involve using a ray tracing process to render frames representing a scene view that includes one or more objects.
[0217] In this process, the frame being rendered may, and in one implementation does, include an array of sampling positions, and the ray tracing process will be used to render each of the sampling positions in order to provide a rendering output. For example, the rendering output may include a frame (e.g., an image) representing a desired view of the scene (where the corresponding rays cast correspond to the rendering and are used during rendering, and the corresponding sampling positions of the rendering frame).
[0218] However, in general, the rendering output can be any suitable output that the graphics processor can generate as needed, and does not need to represent graphics (e.g., image) data, but can represent, for example, any suitable image or non-image output that the graphics processor can generate when performing graphics processing work or when used in a more general way.
[0219] The techniques described in this article can be used for any form of ray tracing-based rendering.
[0220] Therefore, for example, the techniques described herein can be used when rendering a scene using a “full” ray tracing process, where a so-called “master” ray is projected from the viewpoint (camera) through a sampling position in an image frame to determine the intersection of that ray with an object in the scene. For example, and in one implementation, the nearest object in the scene to which that ray intersects (the ray’s “first intersection”) is determined for each ray. The method may involve projecting additional (secondary) rays from the corresponding first intersection of the master ray with an object in the scene, and further using the intersection data of the secondary rays to determine the rendering of the sampling position.
[0221] In this context, the operation in the manner described herein can be used (and in one implementation) when analyzing the intersections of the primary ray and secondary rays with objects in the scene.
[0222] The techniques described herein can also be used in so-called “hybrid” ray tracing rendering processes, such as those where both ray tracing and rasterization processes are performed during rendering (e.g., where only some steps of a full ray tracing process are performed, with one or more rasterization processes used to implement the other steps of these “full” ray tracing processes). For example, in an exemplary hybrid ray tracing process, a rasterization process may be used to determine the first intersection of each master ray with an object in the scene, but then a ray tracing process may be used to perform the casting of one or more additional (secondary) rays from the corresponding first intersection of the determined master rays with the object in the scene.
[0223] In this context, the operation in the manner described herein can be used (and in one implementation) when analyzing the intersection of secondary rays with objects in the scene.
[0224] The execution of a shader program for performing a desired ray tracing process can be performed in any other suitable and desirable manner, depending on the specific operation performed in the manner described herein, such as, and in one embodiment, depending on the execution of the shader program in the graphics processor and graphics processing system considered.
[0225] Therefore, the graphics processor (the programmable execution unit of the graphics processor) will be used to execute a shader program that includes a sequence of instructions for performing the desired ray tracing rendering process for multiple (and in one implementation, for each) sampling locations of the frame to be rendered.
[0226] Accordingly, when the ray tracing shader program is executed, the graphics processor will be used to derive (publish) corresponding execution threads for the sampled positions of the frame being rendered, wherein each thread then executes a program to render the sampled positions represented (and corresponding to) by the rendering thread. Therefore, in one embodiment, the graphics processor includes a thread deriver (thread deriving circuitry) that is operable to and configured to derive (publish) execution threads for execution by a programmable execution unit.
[0227] Ray tracing rendering shader programs executed by programmable execution units can be prepared and generated in any suitable and desired manner.
[0228] In one embodiment, the ray tracing rendering shader program is generated by the compiler (shader compiler) of the graphics processor of the graphics processing system under consideration (and therefore in one embodiment, the processing circuitry that generates the shader program includes appropriate compiler circuitry). In one embodiment, the compiler is executed on appropriate programmable processing circuitry of the graphics processing system.
[0229] In a graphics processing system that can operate in a manner described herein, in at least one implementation of the techniques described herein, a compiler (e.g., a compiler executed on a host processor) generates and distributes one or more shader programs to the graphics processor, which, when executed, will perform the required ray-tracing-based rendering operations in accordance with the techniques described herein. The programs are then executed by the graphics processor (a programmable execution unit of the graphics processor) to perform ray-tracing-based rendering, and, as part of the execution of the programs, exchange the aforementioned messages with the ray tracing circuitry (unit) of the graphics processor.
[0230] Therefore, one or more graphics shader programs are deployed to the graphics processor and executed by a programmable execution unit. These one or more graphics shader programs include a set of program instructions (sequences) that, when executed, will perform the desired ray-tracing rendering process. If necessary, the one or more shader programs may include only the instructions required to perform rendering operations based on a specific ray tracing, or they may include other instructions, such as those for performing other shading operations.
[0231] As described above, specific operations of the techniques described herein can be implemented and triggered by including appropriate “ray tracing” instructions in the ray tracing rendering shader program to be executed by a programmable execution unit. These instructions will trigger the programmable execution unit to send appropriate messages to the ray tracing circuit (unit) to trigger the execution of the desired traversal of one or more ray tracing acceleration data structures to be traversed by the ray in question and thereby determine the geometry (if any) intersecting with one or more rays that trigger the operation therefor (wherein the programmable execution unit subsequently sends messages when it reaches (executes) the relevant instructions in the shader program).
[0232] Such instructions may be included in shader programs so that they may be executed by programmable execution units in any suitable and desired manner and by any suitable and desired element of the overall data (graphics) processing system.
[0233] For example, in one implementation, "ray tracing" instructions (or instruction sets) are included in the shader program by a compiler for the graphics processor (shader compiler). Thus, in one implementation, the compiler inserts a set of one or more ray tracing instructions at appropriate points in the ray tracing rendering shader program that performs ray tracing.
[0234] In one implementation, "ray tracing" (acceleration) instructions are included in a ray tracing rendering shader program that is to be executed by the graphics processor via a compiler in response to appropriate ray tracing instructions (e.g., "trace()" calls), which are included in a (high-level) shader program provided by the application requiring graphics processing. Thus, for example, and in one implementation, the application would be able to include explicit instructions for performing traversal operations, to which the compiler then, in response to this, includes appropriate "ray tracing" (acceleration) instructions in the compiled shader program. The compiler may also include its own "ray tracing" (acceleration) instructions, for example, where the compiler is able to evaluate the shader program being compiled to identify when and where to include one or more "ray tracing" (acceleration) instructions, even in the absence of explicit instructions.
[0235] In one implementation, the compiler analyzes, for example, the shader program code provided by an application on the host processor that requires graphics processing, and includes one or more ray tracing acceleration instructions at appropriate points in the shader program (e.g., by inserting instructions into the (compiled) shader program).
[0236] The techniques described in this article also extend to and include such operations by compilers.
[0237] Therefore, another embodiment of the technology described herein includes a method for compiling a shader program to be executed by a programmable execution unit of a graphics processor, the programmable execution unit being operable to execute a graphics processing program to perform graphics processing operations, wherein the graphics processor also includes a ray tracing circuit (unit) that is instructed by the programmable execution unit as part of a program to perform ray tracing to determine, if any, the geometry intersecting with the ray for which ray tracing is being performed.
[0238] The method includes:
[0239] For a shader program executed by the programmable execution unit of the graphics processor during ray tracing, the ray tracing process uses one or more ray tracing acceleration data structures that indicate the distribution of geometry within the scene to be rendered to determine which geometry intersects with the rays being used in the ray tracing process, and
[0240] The program will be executed by a group of one or more execution threads, where each thread in the group of one or more execution threads corresponds to the corresponding ray for which ray tracing is being performed:
[0241] The shader program includes a set of one or more ray tracing instructions, which, when executed by the set of execution threads, will cause:
[0242] The programmable execution unit sends a message to the ray tracing circuit (unit) to determine, for the corresponding thread in the group of one or more execution threads executing the group of one or more ray tracing instructions, the geometry (if any) intersecting with the ray for at least one ray tracing. In order to determine the geometry intersecting with the ray, the ray tracing circuit (unit) is operable to perform a corresponding traversal of at least one ray tracing acceleration data structure and to test the ray for the one or more acceleration data structures being traversed to determine which geometry (if any) intersects with the ray.
[0243] Another embodiment of the technology described herein includes a compiler for compiling a shader program to be executed by a programmable execution unit of a graphics processor, the programmable execution unit being operable to execute a graphics processing program to perform graphics processing operations, wherein the graphics processor also includes a ray tracing circuit (unit) that is instructed by the programmable execution unit as part of a program to perform ray tracing to determine, if any, the geometry intersecting with the ray being ray-traced.
[0244] The compiler includes processing circuitry configured as follows:
[0245] For a shader program executed by the programmable execution unit of the graphics processor during ray tracing, the ray tracing process uses one or more ray tracing acceleration data structures that indicate the distribution of geometry within the scene to be rendered to determine which geometry intersects with the rays being used in the ray tracing process, and
[0246] The program will be executed by a group of one or more execution threads, where each thread in the group of one or more execution threads corresponds to the corresponding ray for which ray tracing is being performed:
[0247] The shader program includes a set of one or more ray tracing instructions, which, when executed by the set of execution threads, will cause:
[0248] The programmable execution unit sends a message to the ray tracing circuit (unit) to determine, for the corresponding thread in the group of one or more execution threads executing the group of one or more ray tracing instructions, the geometry (if any) intersecting with the ray for at least one ray tracing. In order to determine the geometry intersecting with the ray, the ray tracing circuit (unit) is operable to perform a corresponding traversal of at least one ray tracing acceleration data structure and to test the ray for the one or more acceleration data structures being traversed to determine which geometry (if any) intersects with the ray.
[0249] A compiler (compiler processing circuitry) is part of the central processing unit (CPU) of a graphics processing system (such as a host processor) in one embodiment and executes on the CPU in another embodiment, and is part of the driver (e.g., the host processor) of the graphics processor that executes on the CPU in yet another embodiment.
[0250] In this scenario, the compiler and compiled code would run on a separate processor within the entire graphics processing system. However, other arrangements are possible if needed, such as the compiler running on the same processor as the compiled code.
[0251] The compilation process (compiler) can generate ray tracing rendering shader programs in any suitable and desired manner, for example, and in one implementation, any suitable and desired compiler technology for that purpose is used.
[0252] Therefore, in one implementation, a shader program is generated by a compiler, and the compiler is configured to include instructions used in the techniques described herein within that shader program. Other arrangements are, of course, possible.
[0253] The generated shader program can then be sent to the programmable execution unit of the graphics processor for execution.
[0254] The techniques described in this article also extend to the operation of the graphics processor itself when shader programs are executed.
[0255] Therefore, another embodiment of the technology described herein includes a method for operating a graphics processor to generate rendering output by performing a ray tracing process, in which multiple rays passing through the scene to be rendered are traced.
[0256] The ray tracing process uses one or more ray tracing acceleration data structures that indicate the distribution of geometry within the scene to be rendered to determine which geometry intersects with the rays being used in the ray tracing process.
[0257] The graphics processor includes a programmable execution unit capable of executing a graphics processing program, wherein the program can be executed by a group of one or more execution threads.
[0258] The graphics processor also includes a ray tracing circuit (unit) that can be instructed by a programmable execution unit as part of a program to perform ray tracing to determine, if any, the geometry intersecting with the ray being traced.
[0259] The method includes:
[0260] A program is executed by a group of one or more execution threads to perform ray tracing, wherein each execution thread in the group corresponds to a corresponding ray in a set of rays for which ray tracing is being performed;
[0261] The method also includes:
[0262] In response to this group of execution threads, one or more ray tracing instructions included in the program are executed to perform ray tracing:
[0263] The programmable execution unit sends a message to the ray tracing circuit (unit) to determine, for the corresponding thread in the group of one or more execution threads executing the group of one or more ray tracing instructions, the geometry (if any) intersecting with the ray for at least one ray tracing. In order to determine the geometry intersecting with the ray, the ray tracing circuit (unit) is operable to perform a corresponding traversal of at least one ray tracing acceleration data structure and to test the ray for the one or more acceleration data structures being traversed to determine which geometry (if any) intersects with the ray.
[0264] Another embodiment of the technology described herein includes a graphics processor capable of generating rendering output by performing a ray tracing process in which multiple rays pass through a scene to be rendered.
[0265] The ray tracing process uses one or more ray tracing acceleration data structures that indicate the distribution of geometry within the scene to be rendered to determine which geometry intersects with the rays being used in the ray tracing process.
[0266] The graphics processor includes a programmable execution unit capable of executing a graphics processing program, wherein the program can be executed by a group of one or more execution threads.
[0267] The graphics processor also includes a ray tracing circuit (unit) that can be instructed by a programmable execution unit as part of a program to perform ray tracing to determine, if any, the geometry intersecting with the ray being traced.
[0268] The programmable execution unit is configured such that when one or more execution threads are executing a program to perform ray tracing, wherein each execution thread in the group corresponds to a corresponding ray in a set of rays for which ray tracing is being performed, the group of execution threads executes one or more ray tracing instructions included in the program to perform ray tracing:
[0269] The programmable execution unit sends a message to the ray tracing circuit (unit) to determine, for the corresponding thread in the group of one or more execution threads executing the group of one or more ray tracing instructions, the geometry (if any) intersecting with the ray for at least one ray tracing. In order to determine the geometry intersecting with the ray, the ray tracing circuit (unit) is operable to perform a corresponding traversal of at least one ray tracing acceleration data structure and to test the ray for the one or more acceleration data structures being traversed to determine which geometry (if any) intersects with the ray.
[0270] As those skilled in the art will understand, these additional embodiments of the technology described herein in relation to the operation of the compiler and / or graphics processor may, as appropriate, include any one or more or all features of the technology described herein, and in one embodiment, indeed include any one or more or all features of the technology described herein.
[0271] For example, and in embodiments, as mentioned above, one or more (or each) ray tracing acceleration data structures for these additional embodiments of the technology described herein include a plurality of nodes, each associated with a corresponding box within the scene, and wherein at least some nodes of at least one acceleration data structure represent a set of corresponding geometries covered by the corresponding boxes associated with the nodes of that acceleration data structure. In this case, traversal in one embodiment involves (as applicable) the intersection of a test ray with the boxes and / or geometries represented by the corresponding nodes of the one or more ray tracing acceleration data structures being traversed, thereby determining the geometry intersecting with the ray (if any).
[0272] When a shader program is executed to perform a ray-tracing-based rendering process, because it is a ray-tracing-based rendering process, the execution of the process will include tracing rays into and through the scene being rendered (e.g., and in one implementation) to determine how a given sampling position corresponding to one or more rays under consideration should be rendered to display the desired view of the scene at that sampling position.
[0273] Therefore, the graphics processor then uses the determination of which geometry (if any) intersects with the light to proceed with the (ray tracing / rendering) operation.
[0274] For example, the above operation can then be repeated for other groups of rays at the sampling location, and once completed, the sampling location can then be rendered accordingly, for example, in the usual way for ray tracing operations.
[0275] For any geometry (primitive) that is determined to actually intersect with the light ray, various processing steps can then be taken to determine the effect (e.g., appearance) that this should have at the sampling location where the light ray is projected.
[0276] Therefore, once the geometry (if any) where the ray will actually intersect has been determined, the programmable execution unit performs further processing on the sampling position corresponding to the ray in the frame based on (any) geometry of the scene determined to intersect the ray.
[0277] In this regard, further processing of the sampling location may include (for example, and in one embodiment, based on and determined to be any geometry of the scene intersecting with the light) any suitable and desired processing of the sampling location due to the ray tracing operation of the light under consideration.
[0278] As described above, further processing performed in one embodiment is controlled by executing appropriate shader procedural routines determined in one embodiment, and selected based on and according to the geometry of the scene determined to intersect with the ray, and / or based on and according to the specific ray-tracing based rendering process being performed (e.g., whether the ray tracing process requires casting secondary rays (where appropriate), and / or casting specific types of secondary rays, or whether the ray-tracing based rendering is intended to be based solely on the determined first intersection point). For example, this further processing may be (and in one embodiment is) based on the surface type of the determined intersecting geometry, and predefined operations for that surface type (e.g., in relation to casting any secondary rays).
[0279] Of course, other arrangements are possible.
[0280] Therefore, in one implementation, further processing of the sampling position, which can be performed based on any geometry of the scene determined to intersect with the ray corresponding to the sampling position, includes triggering the projection of additional (e.g., secondary) rays into the scene at the considered sampling position, and a corresponding shader routine can be selected to control this further processing.
[0281] However, further processing of the sampling position corresponding to the ray in the frame may (and is) be performed based on any geometry of the scene determined to intersect with the ray (and in one embodiment may also) include rendering (shading) the sampling position of the frame to generate an output data value (color value) for that sampling position, for example, and in one embodiment, for displaying a scene view at the sampling position of the frame under consideration.
[0282] In this respect, various arrangements will be possible.
[0283] Therefore, in one implementation, further processing performed on the sampling position corresponding to the ray in the frame includes one of the following:
[0284] Triggering the tracing (projection) of additional (e.g., secondary) rays to the considered sampling location; and
[0285] The sampling location is rendered (colored) to provide an output color value for that sampling location in the frame.
[0286] Correspondingly, in one embodiment, the technique described herein includes returning the light to a programmable execution unit to execute appropriate shader procedural routines for further processing of the light, wherein further processing includes shading the sampled location based on the intersection and / or casting additional light into the scene based on the intersection.
[0287] The rendering (shading) of the sampling location can be performed in any suitable and desired manner, and in one implementation, this is determined in part by the ray tracing circuitry (unit), for example, by the ray tracing circuitry (unit) determining the appropriate shader routines that should be executed for one or more rays that it is processing.
[0288] In one implementation, it is based on and according to the result of the projection of one or more rays at the sampling location, and the determined intersecting geometry (if any), and / or based on and according to the specific ray-tracing based rendering process being performed. For example, the rendering (shading) process may be (and in one implementation is) based on the surface type of the determined intersecting geometry, and predefined shading operations for that surface type.
[0289] In one implementation, the rendering (shading) takes into account all the light rays that have been projected toward the sampling location, and thus in one implementation, the results of any additional (sub)light rays projected toward the sampling location are used to determine, for example, any lighting, reflection, or refraction effects.
[0290] Of course, other arrangements are possible.
[0291] In one implementation, once all (desired) rays have been projected toward the sampling location (and the geometry of all rays to be projected toward the considered sampling location has been determined to intersect (if any)), rendering (shading) of that sampling location is performed. (As described above, the ray tracing process for a given sampling location may include determining any geometry that intersects with the “master” ray projected from the sampling location itself, and determining the geometry of any secondary rays projected toward the considered sampling location, etc., for example as a result of one or more intersections determined for the master ray.)
[0292] Therefore, in one implementation, once the final result of the light rays (geometric intersections, if any) has been determined for the sampling location, the programmable execution unit will (at least) render the sampling location in the frame based on any geometry of the scene that is determined to intersect with the light rays projected for the sampling location.
[0293] Similarly, this can be done in any suitable and desirable manner, and can use any suitable and desirable properties such as geometry that is determined to intersect one or more rays at the sampling location.
[0294] Once the ray-tracing-based rendering process has been completed for the sampling location, this will (and in one implementation, it does) generate an appropriate set of output data for the sampling location as described above, for example, and in one implementation, in the form of color (e.g., RGB) data for the appropriate set of sampling locations.
[0295] This will be performed for each sampling position in the frame (therefore, the operation performed in the manner described herein is performed for multiple (and in one embodiment, for each) sampling positions of the frame being rendered) in one embodiment, such that a final output frame showing a view of the scene to be rendered will be generated, which can then be written to memory and / or otherwise processed for further use, such as for display on a suitable display.
[0296] The process can then be repeated for the next frame (e.g., the next frame to be displayed), and so on.
[0297] Depending on the specific requirements of the technology described herein, the graphics processor can be any suitable and desired graphics processor that includes a programmable execution unit (circuit) that executes program instructions.
[0298] As mentioned above, the graphics processor in the technology described herein also includes a novel ray tracing circuit (unit) configured and operable to determine, if any, the geometry intersecting with a ray that has been passed to the ray tracing circuit (unit).
[0299] The ray tracing circuitry (unit) of the graphics processor should be, and in one embodiment, a (substantially) fixed-function hardware unit (circuit) configured to perform ray tracing operations according to the techniques described herein. The ray tracing circuitry (unit) should therefore include one or more suitable fixed-function circuits to perform the desired operations, but in use it may include and have some limited form of configurability, for example, if desired.
[0300] There may be one or more ray tracing circuits (units), for example, such that multiple programmable execution units share a given (or a single) ray tracing circuit (unit), and / or such that a given programmable execution unit has access to and can communicate with and use multiple different intersection test circuits. In the presence of multiple ray tracing circuits (units), in one embodiment, each circuit may operate in a manner described herein.
[0301] The ray tracing circuit (unit) (or multiple circuits / units) should also, and in one implementation, have a suitable message interface for communicating with the programmable execution unit of the graphics processor as needed.
[0302] Therefore, in the techniques described herein, during a ray tracing operation, when the entire ray tracing operation requires determining the geometry (if any) that intersects with a given ray (or a set of rays), in one embodiment a programmable execution unit triggers a ray tracing circuit (unit) to perform a desired (ray-box) intersection test for the ray in question.
[0303] Communication between ray tracing circuits (units) and programmable execution units can be facilitated as needed. In one embodiment, a suitable communication (messaging) network exists for passing messages between the various units. This communication (messaging) network can operate according to any desired communication protocol and standard, such as using a suitable interconnect / messaging protocol.
[0304] When the programmable execution unit requests the ray tracing circuit (unit) to perform a geometry intersection determination operation, the programmable execution unit in one embodiment therefore sends a message to the ray tracing circuit (unit) regarding the effect, as described above.
[0305] In addition to the ray tracing circuit (unit), other accelerators (dedicated units) capable of communicating with the programmable execution unit may also exist if needed, such as load / store units (circuits), one or more arithmetic units (circuits), texture mappers, etc.
[0306] The techniques described herein can be used for all forms of output that a graphics processor is capable of producing. Therefore, they can be used to generate frames for display, output for rendering to textures, and so on. In one implementation, the output from the graphics processor is exported externally (e.g., to main memory) for storage and use.
[0307] Depending on the requirements for operating in the manner described herein, a graphics processor may otherwise have any suitable and desired form or configuration of a graphics processor, and include and execute any other suitable and desired processing elements, circuits, units and stages that a graphics processor may contain, and execute any suitable and desired form of graphics processing pipeline.
[0308] In one embodiment, the graphics processor (GPU) is part of an overall graphics (data) processing system (e.g., and in one embodiment, including a host processor (CPU) that, for example, executes applications that require processing by the GPU. The host processor sends appropriate commands and data to the GPU to control it to perform graphics processing operations and produce the graphics processing output required by the applications executing on the host processor. For this purpose, the host processor should (and in one embodiment) also execute a driver for the GPU and one or more compilers for compiling programs to be executed by the programmable execution unit of the GPU.
[0309] The overall graphics processing system may include, for example, one or more of the following: a host processor (central processing unit (CPU)), a graphics processor (processing unit), a display processor, a video processor (codec), a system bus, and a memory controller.
[0310] The graphics processor and / or graphics processing system may also include one or more memory and / or memory devices storing the data described herein and / or output data generated by the graphics processor, and / or storing software (e.g., a (shader) program) for performing the processes described herein, and / or communicating with said one or more memory and / or memory devices. The graphics processor and / or graphics processing system may also communicate with a display for displaying images based on data generated by the graphics processor.
[0311] The techniques described in this article also extend to the overall graphics processing system and its operation.
[0312] Therefore, another embodiment of the technology described herein includes a method for operating a graphics processing system, the graphics processing system comprising:
[0313] The graphics processor includes:
[0314] A programmable execution unit capable of operating to execute a graphics processing program, wherein the program can be executed by a group of one or more execution threads, and
[0315] The graphics processor also includes a ray tracing circuit (unit) that can be instructed by a programmable execution unit as part of a program to perform ray tracing to determine, if any, the geometry intersecting with the ray being traced.
[0316] The method includes:
[0317] One or more graphics shader programs are generated, which, when executed by the programmable execution unit of the graphics processor, cause the graphics processor to use a ray tracing process to render frames representing a scene view that includes one or more objects.
[0318] The ray tracing process uses one or more ray tracing acceleration data structures that indicate the distribution of geometry within the scene to be rendered to determine which geometry intersects with the rays being used in the ray tracing process.
[0319] The ray tracing process includes traversing at least one ray tracing acceleration data structure for multiple rays, and determining the geometry of the scene to be rendered that intersects with the ray (if any) by testing the ray against one or more acceleration data structures being traversed.
[0320] Generating one or more graphics shader programs, which, when executed by the programmable execution unit of the graphics processor, cause the graphics processor to use a ray tracing process to render a frame representing a scene view including one or more objects, including:
[0321] The program used to perform ray tracing includes one or more sets of "ray tracing" instructions, wherein the program is executed by one or more sets of execution threads, each thread in the set of one or more execution threads corresponding to a specific ray for which ray tracing is being performed, and the set of ray tracing instructions, when executed by the set of execution threads, will cause:
[0322] The programmable execution unit sends a message to the ray tracing circuit (unit) to determine, for the corresponding thread in the group of one or more execution threads executing the group of one or more ray tracing instructions, the geometry (if any) intersecting with the ray for at least one ray tracing. In order to determine the geometry intersecting with the ray, the ray tracing circuit (unit) is operable to perform a corresponding traversal of at least one ray tracing acceleration data structure and to test the ray for the one or more acceleration data structures being traversed to determine which geometry (if any) intersects with the ray.
[0323] The method also includes:
[0324] Provide the graphics processor with one or more generated graphics shader programs for execution by the programmable execution unit; and
[0325] The programmable execution unit of the graphics processor:
[0326] Execute the one or more graphics shader programs to render frames representing a scene view including one or more objects using a ray tracing process; and
[0327] When a group of execution threads is executing one or more programs for a corresponding set of rays, in response to that group of execution threads, execute the one or more ray tracing instructions included in the program:
[0328] The programmable execution unit sends a message to the ray tracing circuit (unit) to determine, for the corresponding thread in the group of one or more execution threads executing the group of one or more ray tracing instructions, the geometry intersecting with at least one ray for which the program is executed to perform ray tracing.
[0329] Therefore, another embodiment of the technology described herein includes a graphics processing system comprising:
[0330] The graphics processor includes:
[0331] A programmable execution unit, operable to execute a graphics processing program, wherein the program can be executed by a group of one or more execution threads, and
[0332] The graphics processor also includes a ray tracing circuit (unit) that can be instructed by a programmable execution unit as part of a program to perform ray tracing to determine, if any, the geometry intersecting with the ray being traced.
[0333] The graphics processing system also includes:
[0334] The processing circuit is configured as follows:
[0335] One or more graphics shader programs are generated, which, when executed by the programmable execution unit of the graphics processor, cause the graphics processor to use a ray tracing process to render frames representing a scene view that includes one or more objects.
[0336] The ray tracing process uses one or more ray tracing acceleration data structures that indicate the distribution of geometry within the scene to be rendered to determine which geometry intersects with the rays being used in the ray tracing process.
[0337] The ray tracing process includes traversing at least one ray tracing acceleration data structure for multiple rays, and determining the geometry of the scene to be rendered that intersects with the ray (if any) by testing the ray against one or more acceleration data structures being traversed.
[0338] Generating one or more graphics shader programs, which, when executed by the programmable execution unit of the graphics processor, cause the graphics processor to use a ray tracing process to render a frame representing a scene view including one or more objects, including:
[0339] The program used to perform ray tracing includes one or more sets of "ray tracing" instructions, wherein the program is executed by one or more sets of execution threads, each thread in the set of one or more execution threads corresponding to a specific ray for which ray tracing is being performed, and the set of ray tracing instructions, when executed by the set of execution threads, will cause:
[0340] The programmable execution unit sends a message to the ray tracing circuit (unit) to determine, for the corresponding thread in the group of one or more execution threads executing the group of one or more ray tracing instructions, the geometry (if any) intersecting with the ray for at least one ray tracing. In order to determine the geometry intersecting with the ray, the ray tracing circuit (unit) is operable to perform a corresponding traversal of at least one ray tracing acceleration data structure and to test the ray for the one or more acceleration data structures being traversed to determine which geometry (if any) intersects with the ray.
[0341] The processing circuit is further configured as follows:
[0342] Provide the graphics processor with one or more generated graphics shader programs for execution by the programmable execution unit; and
[0343] The programmable execution unit of the graphics processor is configured as follows:
[0344] Execute the one or more graphics shader programs to render frames representing a scene view including one or more objects using a ray tracing process; and
[0345] When a group of execution threads is executing one or more programs for a corresponding set of rays, in response to that group of execution threads, execute the one or more ray tracing instructions included in the program:
[0346] The programmable execution unit sends a message to the ray tracing circuit (unit) to determine, for the corresponding thread in the group of one or more execution threads executing the group of one or more ray tracing instructions, the geometry intersecting with at least one ray for which the program is executed to perform ray tracing.
[0347] As those skilled in the art will understand, these embodiments of the technology described herein may (and in one embodiment, certainly) include any one or all of the features of the technology described herein.
[0348] Therefore, for example, in one embodiment, one or more shader programs provided to a graphics processor for execution (and prepared by a compiler) include: a first instruction sequence that performs appropriate graphics processing operations up to and including a traversal operation for a ray-tracing-based rendering process; and one or more instruction sequences to be executed once a response is received from the traversal operation (and, in one embodiment, to be executed depending on the response from a ray-tracing accelerated data structure, such as geometry / surface type), wherein the execution instruction sequence, when executed, uses an indication of the geometry returned by the ray-tracing accelerated data structure traversal to determine any geometry intersecting with the ray, and then triggers further processing with respect to the sampling location corresponding to that ray (in one embodiment, this further processing may be transmitting additional rays and / or rendering (shading) the sampling location corresponding to that ray).
[0349] Of course, other arrangements are possible.
[0350] Those skilled in the art should understand that all described embodiments of the technology described herein may (and in one embodiment, indeed) appropriately include any one or more or all features of the technology described herein.
[0351] The techniques described herein can be implemented in any suitable system, such as a properly configured microprocessor-based system. In one embodiment, the techniques described herein are implemented in a computer and / or microprocessor-based system. In one embodiment, the techniques described herein are implemented in a portable device, such as a mobile phone or tablet computer in one embodiment.
[0352] The various functions of the technology described herein can be performed in any desired and suitable manner. For example, the functions of the technology described herein can be implemented in hardware or software as needed. Therefore, for example, unless otherwise specified, the various functional elements, stages, units, and “devices” of the technology described herein may include suitable one or more processors, one or more controllers, functional units, circuit systems, circuits, processing logic units, microprocessor arrangements, etc., which are operable to perform various functions, such as suitable dedicated hardware elements (processing circuit systems / circuits) and / or programmable hardware elements (processing circuit systems / circuits) that can be programmed to operate in a desired manner.
[0353] It should also be noted here that, as those skilled in the art will understand, the various functions of the techniques described herein can be copied and / or executed in parallel on a given processor. Similarly, various processing stages can share processing circuitry systems / circuits if desired.
[0354] The various circuit systems, functional elements, stages, units, and “devices” of the technology described herein may include one or more suitable processors, one or more controllers, functional units, circuit systems, circuits, processing logic, microprocessor arrangements, etc., capable of operating to perform various steps or functions, such as appropriate dedicated hardware elements (processing circuits / circuit systems) and / or programmable hardware elements (processing circuits / circuit systems) that can be programmed to operate in a desired manner.
[0355] The methods described herein can be implemented at least in part using software, such as computer programs. Therefore, it can be seen that, when viewed from another embodiment, the techniques described herein provide: computer software particularly suitable for executing the methods described herein when installed on a data processor; computer program elements comprising computer software code portions for executing the methods described herein when the program elements are run on the data processor; and a computer program comprising code suitable for executing all steps of one or more methods described herein when the program is run on a data processing system. The data processor may be a microprocessor system, a programmable FPGA (Field-Programmable Gate Array), etc.
[0356] The techniques described herein also extend to computer software carriers that include such software, when used to operate a display processor or a microprocessor system including a data processor, cause the controller or system to engage the data processor to perform the steps of the methods described herein. Such computer software carriers can be physical storage intermediates, such as ROM chips, CD-ROMs, RAM, flash memory, or disks, or they can be signals, such as electronic signals transmitted through wires, optical signals, or radio signals transmitted to satellites.
[0357] It should also be understood that not all steps of the method described herein need to be performed by computer software. Therefore, in contrast to another broad implementation, the technology described herein provides computer software and such software installed on a computer software carrier for performing at least one step of the method described herein.
[0358] Therefore, the techniques described herein can be suitably embodied as a computer program product for use with a computer system. Such embodiments may include a series of computer-readable instructions fixed on a tangible, non-transitory intermediate, such as a computer-readable intermediate like a disk, CD-ROM, ROM, RAM, flash memory, or hard disk. The embodiment may also include a series of computer-readable instructions capable of being transmitted to the computer system via a modem or other interface device through a tangible intermediate (including, but not limited to, optical or analog communication lines) or passively using wireless technologies (including, but not limited to, microwave, infrared, or other transmission technologies). This series of computer-readable instructions embodies all or part of the functionality previously described herein.
[0359] Those skilled in the art will understand that such computer-readable instructions can be written in a variety of programming languages to be used with many computer architectures or operating systems. Furthermore, such instructions can be stored using any current or future memory technology (including, but not limited to, semiconductor, magnetic, or optical technologies), or transmitted using any current or future communication technology (including, but not limited to, optical, infrared, or microwave technologies). It is conceivable that such computer program products can be distributed as removable intermediates along with accompanying printed or electronic documentation (e.g., shrink-wrapping software), pre-loaded onto computer systems (e.g., system ROM or fixed disks), or distributed via networks (e.g., the Internet or the World Wide Web) from servers or electronic bulletin boards.
[0360] This implementation scheme relates to the operation of a graphics processor, such as in... Figure 1 In the graphics processing system shown, when rendering the scene to be displayed is performed using a ray tracing-based rendering process.
[0361] Ray tracing is a rendering process that involves tracing the path of light rays from a viewpoint (sometimes called the "camera") through sampled locations in the image plane (which is the frame being rendered) into the scene, and simulating the interaction between these rays and objects in the scene. Output data values (e.g., the color of the sampled location in the image) are determined based on the objects in the scene that intersect with the rays passing through the sampled location, and the characteristics of the surfaces of those objects. Therefore, the ray tracing process involves identifying a set of objects within the scene that intersect with the rays passing through the sampled location for each sampled location.
[0362] Figure 2An exemplary “full” ray tracing process is illustrated. Ray 20 (“master ray”) is projected backward from viewpoint 21 (e.g., camera position) through sampling position 22 in image plane (frame) 23 into the scene being rendered. The point 24 where ray 20 first intersects with an object 25 in the scene is identified, which is, for example, a primitive (in this embodiment, the primitive is in the form of a triangle, but may also include other suitable geometries). This first intersection will be with the object in the scene closest to the sampling position.
[0363] A secondary ray in the form of shadow ray 26 can be projected from the first intersection point 24 onto the light source 27. Depending on the material of the surface of the object 25, another secondary ray in the form of reflected ray 28 can be traced from the intersection point 24. If the object is at least partially transparent, refracted secondary rays can be considered.
[0364] Such secondary rays can be used when it is desired to add shadows and reflections to an image. Secondary rays can be projected in the direction of each light source (and, depending on whether the light source is a point source, more than one secondary ray can be projected back to a point on that light source).
[0365] exist Figure 2 In the example shown, only a single bounce of the main ray 20 is considered before tracing the reflected ray back to the source. However, if desired, a higher number of bounces can be considered.
[0366] The output data for sampling position 22, i.e., its color value (e.g., RGB value), is then determined based on the intersection of the main ray and any secondary rays with objects in the scene. The same processing is performed for each sampling position to be considered in the image plane (frame) 23.
[0367] To facilitate such ray tracing processing, in embodiments of the invention, when determining the intersection data of rays associated with sampling locations in the image plane, an accelerated data structure indicating the geometry (e.g., objects) in the scene to be rendered is used to identify a subset of the geometry that can intersect with the rays.
[0368] The ray tracing acceleration data structure represents and indicates the distribution of geometry (e.g., objects) in the scene being rendered, and more specifically, represents and indicates the geometry within the corresponding (sub)boxes that fall within the overall box of the scene (i.e., the one being considered). In this embodiment, a ray tracing acceleration data structure in the form of a hierarchical bounding box (BVH) tree is used.
[0369] Figure 3An exemplary BVH tree 30 is shown, which is constructed by enclosing a box in an axis-aligned bounding box (AABV), such as a cube, and then recursively subdividing the bounding box into consecutive sub-AABVs according to any suitable and desired subdivision scheme until the desired minimum subdivision (box) is reached.
[0370] In this example, BVH tree 30 is a relatively "wide" tree, where each bounding box is subdivided into up to six sub-AABVs. However, in general, any other suitable tree structure can be used, and a given node of the tree can have any suitable and desired number of child nodes.
[0371] Therefore, each node in the BVH tree 30 will have a corresponding box associated with it, where the terminal and leaf nodes 31 each represent a specific minimum subdivision box, and any parent node represents and is associated with the box of its child node.
[0372] The entire scene can be represented by a single BVH tree, for example, the tree stores the geometry of the scene in world space. In this case, each leaf node of the BVH tree 30 can also be associated with a scene-defined geometry that falls at least partially within the box corresponding to that leaf node (e.g., its centroid falls within the box under consideration). Leaf node 31 can be represented as a unique (non-overlapping) subset of the scene-defined primitives that fall within the corresponding box of leaf node 31.
[0373] In this implementation, a two-layer ray tracing acceleration data structure is used to represent the geometric distribution within the scene to be rendered. Figure 4 An exemplary two-layer arrangement of ray tracing acceleration data structure is shown, wherein each instance or object in the scene is associated with a corresponding underlying acceleration structure (BLAS) 300, 301, which in this embodiment takes the form of a corresponding BVH tree storing geometry in model space, wherein each leaf node 310, 311 of the BVH tree represents a unique subset of primitives 320, 321 defined for instances or objects falling into the corresponding boxes.
[0374] The individual top-level acceleration structure (TLAS) 302 then contains references to a set of bottom-level acceleration structures (BLAS), as well as a corresponding set of shading and transformation information for each bottom-level acceleration structure (BLAS). In this embodiment, the top-level acceleration structure (TLAS) 302 is defined in world space and takes the form of a BVH tree with leaf nodes 312, each leaf node pointing to one or more bottom-level acceleration structures (BLAS) 300, 301.
[0375] The BVH tree acceleration data structure also stores (for the nodes themselves or in other ways, such as as sideband information) appropriate information to allow the tree to be traversed box-by-box based on the origin and direction of the ray, so as to be able to identify the leaf nodes representing the boxes through which the ray passes.
[0376] This then allows and facilitates testing rays hierarchically against the bounding boxes in the BVH tree until a leaf node is found. It is then only necessary to test whether the geometry associated with a particular leaf node intersects with that ray.
[0377] Other forms of ray tracing acceleration data structures will be possible.
[0378] Figure 5 This is a flowchart illustrating the overall ray tracing process in an implementation of the technology described herein, and this ray tracing process will be executed by (and by) graphics processor 2.
[0379] First, the geometry of the scene is analyzed and used to obtain an accelerated data structure (step 40), for example, in the form of a BVH tree structure, as described above. This can be accomplished in any suitable and desired manner, such as through an initial processing pass on the graphics processor 2.
[0380] Then, a master ray is generated, passing from the camera through a specific sampling position (frame) in the image plane (step 41). The accelerated data structure is then traversed for the master ray (step 42), and leaf nodes corresponding to the first box through which the ray passes are identified, the first box containing the geometry that may intersect with the ray. It is then determined whether the ray intersects with any geometry, such as primitives (if any), in the leaf node (step 43).
[0381] If no (valid) geometry intersecting the ray is identified in the node, the process returns to step 42, and the ray continues to traverse the accelerated data structure and the leaf nodes of the next box through which the ray passes, which may contain the geometry intersecting the ray, and an intersection test is performed at step 43.
[0382] Repeat this process for each leaf node that (may) intersect with the ray until the geometry intersecting with that ray is identified.
[0383] Once the geometry intersecting the ray is identified, it is then determined whether to project any additional (secondary) rays towards the considered principal ray (and therefore the sampling location) (step 44). This can be based on (e.g., and in one embodiment, on) the nature of the geometry intersecting the ray (e.g., its surface properties) and the complexity of the ray tracing process used. Therefore, as... Figure 5As shown, one or more secondary rays (e.g., shadow rays, refracted rays, and / or reflected rays) can be generated from the intersection point. Steps 42, 43, and 44 are then performed relative to each secondary ray.
[0384] Taking into account the surface characteristics of the object at the primary intersection point, any geometry intersecting with the secondary rays, etc., once there are no other rays to be projected, the shadow color of the sampling position corresponding to the ray is determined based on the projection result of the primary ray and any secondary rays considered (step 45). The shading color for the sampling position is then stored in the frame buffer (step 46).
[0385] If, in step 42, no (valid) node can be identified that includes geometry intersecting a given ray (whether a primary or secondary ray) (and no additional ray is to be projected onto the sampling location), the process proceeds to step 45, and shading is performed. In this case, the shading in one implementation is based on some form of "default" shading operation that is to be performed if no geometry intersecting the ray is found. This could include, for example, simply assigning a default color to the sampling location, and / or having a defined default geometry to use if no actual geometry is found to intersect in the scene, wherein the sampling location is then shading according to that default geometry. Of course, other arrangements will be possible.
[0386] This process is performed for each sampling position to be considered in the image plane (frame).
[0387] Figure 6 Alternative ray tracing processes are shown in implementations of the techniques described herein, wherein only the following is performed: Figure 5 This describes some of the steps in a full ray tracing process. Such alternative ray tracing processes may be referred to as "hybrid" ray tracing processes.
[0388] In this process, such as Figure 6 As shown, a rasterization process is first used to determine the first intersection point 50 of each sampling location in the image plane (frame) and store it in an intermediate data structure called the "G-buffer" 51. Therefore, the process of generating a master ray for each sampling location and identifying the first intersection point of that master ray with the geometry in the scene is replaced by the initial rasterization process to generate the "G-buffer". This G-buffer includes information indicating the depth, color, normal, and surface properties of each first (nearest) intersection point at each sampling location in the image plane (frame) (as well as any other appropriate and desired data, such as albedo, etc.).
[0389] Then, secondary rays (e.g., shadow rays 52 to light source 53) and reflected rays 54 can be projected starting from the first intersection point 50, and the shading of these sampling locations is determined based on the characteristics of the geometry that first intersects and the intersection of the secondary rays with the geometry in the scene.
[0390] See Figure 5 In the flowchart above, the initial passes of steps 41, 42, and 43 of the full ray tracing process for the master ray are omitted during this type of blending process because it is not necessary to project the master rays and determine their first intersections with the geometry in the scene. Instead, the first intersection data for each sampling location is obtained from the G buffer.
[0391] The process can then proceed to shading stage 45 based on the first intersection point of each pixel obtained from the G buffer, or, if necessary, to consider the secondary rays emanating from the first intersection point, which will need to be referenced. Figure 5 The described method is projected. Therefore, steps 42, 43, and 44 will be performed in the same manner as previously described for the full ray tracing process for any sub-ray.
[0392] The color determined for the sampling location will be based on the shading color determined for the sampling location and compared with... Figure 5 Step 46 is written to the frame buffer in the same manner, the shading color being based on the first intersection (as obtained from the G buffer) and, where applicable, any intersections of rays with objects in the scene determined by ray tracing.
[0393] Specifically, this implementation involves operations performed by the graphics processor during ray tracing-based rendering, such as those described above, and more specifically, involves ray tracing accelerated data structure traversal and geometry intersection performed as part of the ray tracing operation. Figure 5 Steps 42 to 43 in the process.
[0394] Figure 7 The relevant elements and components of the graphics processor (GPU) 60 according to an embodiment of the present invention are schematically shown.
[0395] like Figure 7 As shown, GPU 60 includes one or more shader (processing) cores 61, 62, a memory management unit 63, and a secondary cache 64, which is operable to communicate with an off-chip memory system 68 (e.g., via appropriate interconnects and a (dynamic) memory controller).
[0396] Figure 7 The configuration of one shader core 61 is illustrated schematically, but as those skilled in the art will understand, any other shader cores of the graphics processor 60 will be configured in a similar manner.
[0397] (Graphics Processing Unit (GPU) shader cores 61 and 62 are programmable processing units (circuits) that perform processing operations by running small programs for each "item" in the output to be generated (such as a rendering target, e.g., a frame). In this respect, an "item" can be, for example, a vertex, one or more sampled locations, rays, etc. The shader core will process each "item" through one or more execution threads, which will execute instructions of the shader program considered for the "item" under consideration. Typically, there will be multiple execution threads, each executing simultaneously (in parallel).)
[0398] Figure 7 The main components of the graphics processor 60 associated with the operation of this embodiment are shown. As those skilled in the art will understand, the graphics processor 60 may have... Figure 7 Other elements not shown. It should also be noted here that... Figure 7 This is merely illustrative, and, for example, in practice, even if the functional units shown are... Figure 7 The components are schematically shown as independent units, but these functional units may also share important hardware circuitry. It should also be understood that, unless otherwise specified, as... Figure 7 Each of the components and units of the graphics processor shown can be implemented as needed, and will accordingly include, for example, appropriate circuitry (processing logic) for performing the necessary operations and functions.
[0399] like Figure 7 As shown, each shader core of the graphics processor 60 includes a suitable programmable execution unit (execution engine) 65, which is operable to execute a graphics shader program for use by an execution thread to perform graphics processing operations.
[0400] The shader core 61 also includes an instruction cache 66, which stores instructions to be executed by the programmable execution unit 65 to perform graphics processing operations. For example... Figure 7 As shown, the instructions to be executed will be fetched from memory system 68 via interconnect 69 and micro TLB (translation back buffer) 70.
[0401] The shader core 61 also includes a suitable load / store unit 76 in communication with the programmable execution unit 65. This load / store unit is operable to, for example, load appropriate caches, data, etc., for processing by the programmable execution unit 65, and write data back to the memory system 68 (for loading and storing data for the program executed in the programmable execution unit). Similarly, such data is acquired / stored by the load / store unit 76 via interconnect 69 and a miniature TLB 70.
[0402] In order to perform graphics processing operations, the programmable execution unit 65 will execute a graphics shader program (instruction sequence) for the corresponding execution thread (e.g., the corresponding sampling position of the frame to be rendered).
[0403] Therefore, as Figure 7 As shown, the shader core 61 also includes a thread creator (generator) 72, which is operable to generate execution threads that are executed by the programmable execution unit 65.
[0404] like Figure 7 As shown, the shader core 61 also includes a ray tracing circuit (unit) (“RTU”) 74, which communicates with the programmable execution unit 65 and is operable to perform the required geometry intersection determination for the ray being processed as part of the ray tracing-based rendering process in response to a message 75 received from the programmable execution unit 65 (i.e., Figure 4 Steps 42 and 43 involve: traversing the accelerated data structure to determine the geometry that potentially intersects with the ray by referencing the node boxes of the accelerated data structure geometry, and performing the corresponding ray-primitive test to determine which geometry (if any) actually intersects with the ray.
[0405] RTU 74 is also able to communicate with load / store unit 76 to load the necessary data for such intersection tests, such as node data that defines the node to be tested (e.g., which node data may include data that identifies a set of primitives, but may also identify the BLAS to be traversed, and any transformations to be applied, for example).
[0406] In this implementation, the graphics processor's RTU 74 is a (basically) fixed-function hardware unit (circuit) configured to perform the necessary operations during traversal of the ray tracing acceleration data structure to determine the geometry of the scene to be rendered, which may (and does) intersect with the rays being used for ray tracing operations. However, a certain amount of configurability can be provided.
[0407] Figure 8 This is a flowchart illustrating the operation of RTU 74 according to this embodiment in response to a message received from programmable execution unit 65, which determines the geometry (if any) of the intersecting rays of a set of rays being executed by a corresponding thread group (warp) within the programmable execution unit for a program to perform ray tracing on it.
[0408] Figure 8 In particular, the traversal operations performed by the RTU on a two-layer accelerated architecture are shown in more detail, for example, as referenced above. Figure 4 As described. Figure 8As shown, in this case, the accelerated structure traversal begins with a TLAS traversal (step 420), and the TLAS traversal continues to search for TLAS leaf nodes (steps 421, 422).
[0409] When a TLAS leaf node is identified (in step 421), it is determined whether the leaf node can be selected from further processing (step 424). If the leaf node can be selected from further processing, the process returns to the TLAS traversal (step 420).
[0410] If a TLAS leaf node cannot be selected from further processing, the ray is transformed to the appropriate (“object”) space for BLAS traversal using the instance transformation information associated with that leaf node (step 425). BLAS traversal then begins (step 426), and the search for BLAS leaf nodes continues (steps 427, 428). If a BLAS leaf node cannot be identified, the process can return to TLAS traversal (step 420) until all nodes in the node have been tested (if necessary) and the traversal operation is complete.
[0411] In this embodiment, the geometry associated with a BLAS leaf node can be in the form of a set of triangular primitives or axis-aligned bounding box (AABB) primitives. When a BLAS leaf node is identified (in step 427), it is determined whether the geometry associated with that leaf node is in the form of a set of triangular primitives or axis-aligned bounding box (AABB) primitives (step 430). Figure 8 As shown, when an axis-aligned bounding box (AABB) primitive is encountered, the execution of the shader procedure (“intersecting shader”) that defines the process object surrounded by the axis-aligned bounding box (AABB) is triggered (step 431) to determine whether the ray intersects with the process object defined by the shader procedure.
[0412] On the other hand, when encountering a set of triangular primitives, the RTU performs a determination of whether the ray intersects any of the triangular primitives (step 432), such as... Figure 8 As shown. Therefore, if a (valid) triangle primitive intersecting with the ray cannot be identified in the node, the process returns to the BLAS traversal (step 426). If a ray is found to intersect with a triangle primitive, it is determined whether the triangle primitive is opaque (step 433). If the triangle primitive is found to be non-opaque, the execution of the appropriate shader procedure ("any hit" shader) can be triggered (step 434). Otherwise, if the triangle primitive is found to be opaque, the intersection can be determined without executing the shader procedure (step 440), and the BLAS traversal continues accordingly (step 426).
[0413] Therefore, the traversal is performed in this way to determine which nodes (if any) intersect with the ray that is being traversed.
[0414] If a TLAS leaf node intersecting with the ray cannot be identified, an intersection miss is determined, and in this case, a "default" shading operation ("miss" shader) can be performed (step 423), as described above. If the ray does intersect with a geometry, provided that geometry is an opaque triangle (i.e., step 433: yes), the geometry can be automatically submitted, for example, and in the implementation, added to the record of intersecting geometries. Once the traversal is complete (step 422), the appropriate "closest hit" shader can be invoked accordingly (step 423) to further process the ray. For example, depending on the intersecting geometry, rendering (shading) of the sampling location and / or traversal of one or more secondary rays can be appropriately triggered, as described above.
[0415] On the other hand, such as Figure 8 As shown, if a ray is determined to intersect with a more complex (non-triangular) primitive (such as an axis-aligned bounding box (AABB) primitive) (at step 430), the RTU in this embodiment does not automatically submit the hit, but stops traversing at this point, so that the ray can be returned to the programmable execution unit to execute the required "intersection" shader (as determined by the RTU at step 431).
[0416] Similarly, if it is determined that the ray intersects a non-opaque triangle (step 433: No), the RTU in this embodiment also cannot automatically submit the hit, because the appropriate "any hit" shader (as determined by the RTU at step 434) needs to be executed first to determine whether the hit should be submitted. Therefore, in the same case, the traversal is stopped at this point so that the ray can be returned to the programmable execution unit to execute the required "any hit" shader.
[0417] In both cases, traversal is thus stopped so that processing of the ray is returned to the programmable execution unit to execute the required shader routine. However, once the required shader has been executed, the ray should (and) be returned to the RTU to complete its traversal.
[0418] In this embodiment, when the RTU returns the processing of the ray to the programmable execution unit before the RTU has completed its processing of the ray, the ray should then (and does) return to the RTU to complete its traversal, starting the traversal again from the beginning (i.e., from the root node of the TLAS). This thus avoids having to write out the entire current state of the traversal operation (e.g., traversing the stack), which could consume significant memory resources (although this can certainly be done in other possible implementations).
[0419] However, as will be discussed below... Figure 15 Further described, in this embodiment, RTU 74 writes at this time an updated set of ray parameters and an indication of the progress of the ray traversal, specifically in the form of an "instance identifier" that identifies which object instance (i.e., which BLAS structure) is being traversed when traversal stops, and which primitive within a set of primitives represented by the end nodes of the BLAS is found to intersect. Subsequently, as Figure 9 and Figure 10 As shown, this information can be used to accelerate the recovery process of light.
[0420] Therefore, as Figure 9 As shown, when reconstructing the traversal of the light rays, the traversal is as described above regarding... Figure 8 The process proceeds as described above, except that after testing whether a TLAS leaf node can be selected (at step 424), it further checks whether the "instance identifier" associated with the TLAS leaf node matches the "instance identifier" written when the traversal stops (at step 525), and only if a match exists is the BLAS traversal triggered (step 525: Yes). Similarly, BLAS traversal is generally as described above regarding... Figure 8 The process proceeds as described, except that when an intersection of leaf nodes is found, the primitive index is checked to determine from which primitive the traversal should resume (at step 526), and the traversal is resumed only if a match exists (step 526: yes) (at step 527). (Otherwise, if the primitive indexes do not match, this means it is another primitive associated with the same leaf node, and therefore the "intersection" shader will need to be executed, and thus this is done (step 431).)
[0421] In this way, the recovery operation can be accelerated by testing only those nodes indicated as needing to be tested and ignoring all TLAS instances until an instance matching the "instance identifier" included in the recovery message is found, and similarly ignoring all BLAS primitives until the traversal finds a primitive from which traversal stops. It will also be appreciated that selection can be accelerated (at step 424) because the ray parameters can be updated during traversal, which can allow more TLAS to be selected during subsequent recovery traversals.
[0422] therefore, Figure 10 The effect of this situation is illustrated schematically, where when resuming the traversal, the traversal only needs a subset of the test nodes in order to return to the primitive from which the traversal stopped.
[0423] In this embodiment, the ray tracing operation is therefore initially performed by the programmable execution unit 65, which executes the ray tracing. In this regard, the programmable execution unit 65 typically executes programs for multiple rays simultaneously (e.g., in a lockstep manner), where individual rays are handled by corresponding execution threads in a group of execution threads. The program performing the ray tracing includes a "ray tracing" instruction that triggers the operation of the RTU 74. Therefore, when the programmable execution unit performs ray tracing, in response to a group of execution threads executing such a "ray tracing" instruction, the programmable execution unit 65 is able to operate to send a message to the RTU 74 to trigger the RTU to process the rays, for example, as described above.
[0424] Therefore, when executed, the "ray tracing" instruction traces a set of rays (equivalent to warped rays) passing through one or more accelerated data structures to determine the geometry (if any) intersecting with the rays in that set. Once RTU74 is triggered, the rays are processed independently of each other within RTU 74, with corresponding traversals executed and managed until one of the following conditions is met: (i) it is determined that the rays have no intersections (a "miss" exists); (ii) the intersecting primitive closest to the ray's origin is found (the "closest to hit" geometry); (iii) an opaque triangle is found (in this case, the "any hit" shader needs to be executed); or (iv) it intersects with an AABB primitive (in this case, the "intersection" shader needs to be executed). Based on this result, RTU 74 should then and indeed returns the ray to the programmable execution unit 65 to execute the required shader routines for further processing of the ray.
[0425] Therefore, it should be understood that the operation of RTU 74 in this embodiment is typically triggered together for a group of one or more rays (e.g., for that group, the corresponding execution thread group (warp) is executing a program to perform ray tracing). Subsequently, RTU 74 executes and manages the traversal of different rays individually. However, RTU 74 is also configured and operable to return the group of rays to programmable execution unit 65 for execution by the corresponding execution thread group (warp).
[0426] In this regard, RTU 74 could attempt to retain the original set of rays. However, this is not necessary, and RTU 74 in this embodiment is also configured and capable of operating to return arbitrary groups of rays. Therefore, RTU 74 could attempt to group rays based on one or more heuristics to provide more optimized sequential processing of the rays.
[0427] Figure 11 This is a flowchart showing how this can be done. Figure 12 , Figure 13 and Figure 14 Three examples of grouping that can be used are shown.
[0428] like Figure 11 As shown, the RTU 74 can be configured and operated to dynamically group the rays being processed by the RTU 74 according to multiple different heuristics that attempt to optimize continuous ray tracing operations.
[0429] Therefore, as Figure 11 As shown, once RTU 74 determines that processing of the ray should be stopped, either because the traversal is complete or because the traversal needs to be stopped to return the ray to the programmable execution unit 65, RTU 74 calculates the index of the shader routine that should be executed for the ray in question (step 620).
[0430] The calculated shader index is then checked (at step 621) to see if it matches the shader index used for the existing grouping. If not, the RTU 74 starts a new grouping for that shader index (at step 622) and stops the grouping process for that ray.
[0431] If the shader index does indeed match an existing group (step 621: Yes), a hit instance is obtained (step 623), and it is checked whether the hit instance matches an existing group (step 624). If not, the ray is added to the appropriate "shader index" group (step 625), and the grouping process for that ray is stopped.
[0432] On the other hand, if the hit instance also matches an existing group (step 624: yes), the hit geometry index is obtained (step 626), and it is checked whether the hit geometry index matches an existing group (step 627). If not, the ray is added to the appropriate "instance" group (step 628), and the grouping process for that ray is stopped.
[0433] If the hit geometry index matches an existing group (step 627: Yes), the hit primitive index is obtained (step 629), and it is checked whether the hit primitive index matches an existing group (step 630). If not, the ray is added to the appropriate "geometry" group (step 631), and the grouping process for that ray stops. Otherwise, if the hit primitive index also matches an existing group (step 630: Yes), the ray is added to the appropriate "primitive" group (at step 632).
[0434] Therefore, in Figure 11 During the grouping process shown, RTU 74 at least attempts to group rays based on code consistency, but it is also capable of refining the grouping based on spatial locality, so that rays that intersect with end nodes containing the same geometry and with the same primitives within the same instance can (and do) be further grouped.
[0435] Other arrangements are of course possible, and in general, the RTU 74 can group the rays according to any suitable and desired heuristic, taking into account the various weightings of different heuristics according to the desired heuristic.
[0436] For example, Figure 12 An example of grouping rays based on their completion time is shown. In this example, shader index and hit properties (hit primitive, geometry, and index identifier) are ignored, and grouping is based solely on completion time. Specifically, the first four rays to be completed return together as the first output warp (output warp 0), while the next four rays to be completed return together as the second output warp (output warp 1) (note that in this example, the warp size is 4).
[0437] Figure 13 Another example is then shown where rays are grouped based on code consistency, specifically causing the RTU 74 to attempt to group rays that need to execute the same shader routine together into a single output warp. In this example, four rays in the ray need to execute the same shader routine (shader index 0), and therefore these rays are grouped together in the same output warp (output warp 1).
[0438] Figure 14 Another example is shown where rays are grouped based on data locality, specifically causing the RTU74 to attempt to group rays intersecting similar geometries together into a single output warp. In this example, in one implementation, the grouping is therefore as follows: Figure 11 The execution shown involves RTU 74 attempting to prioritize grouping rays that intersect with the same primitives together, and subsequently grouping rays that intersect with the same geometry and the same instance together.
[0439] As can be seen in each of these examples, the rays are thus regrouped so that rays within the output warp do not match rays within the input warp. Instead, in each case, grouping is performed to attempt to optimize the continued execution of the ray tracing program, whether in terms of code consistency and / or data locality, or simply in terms of completion time, to ensure continuous throughput.
[0440] In this respect, various other arrangements will be possible.
[0441] As should be understood from the above, RTU 74 and programmable execution unit 65 are therefore configured and capable of operating to send messages to each other in order to control the entire ray tracing operation, wherein the message passing between RTU 74 and programmable execution unit 65 is for the necessary information to control the processing between the two units.
[0442] Therefore, in this embodiment, the control of ray tracing operations is performed by the programmable execution unit 65 and the RTU 74 exchanging messages with each other, wherein the messages trigger the corresponding operations to be performed (as described above) and also transmit the required information between the two units.
[0443] In the implementation scheme, a "ray tracing" instruction is introduced to control the above message transmission protocol and control. When executed by the programmable execution unit 65, the programmable execution unit 65 sends a message to the RTU 74 to perform geometry determination.
[0444] The execution of the "ray tracing" instruction by the programmable execution unit 65 thus triggers the programmable execution unit 65 to send a message to the RTU 74 to trigger the RTU 74 to perform the traversal. (As mentioned above...) Figure 8 and Figure 9 As described, based on the result of the traversal, the RTU 74 can then pass the ray back to the programmable execution unit 65 for further processing, wherein in this case the message sent by the RTU 74 to the programmable execution unit 65 indicates the shader index of the shader program routine (or routines) to be executed for further processing of the ray.
[0445] Therefore, when the "ray tracing" instruction is executed by the programmable execution unit 65, a pointer to a specific "ray data" data structure 700 is passed to the RTU 74. If the ray tracing program wants to start tracing a new ray, the parameters for creating that ray in the RTU 74 are also passed to the RTU 74 at this time. On the other hand, if the ray tracing program wants to resume tracing an existing ray, the RTU 74 can read the ray from memory.
[0446] The RTU 74 will then trace the ray until a hit or miss is found, and its associated shader must be executed. As described above, this could be because the traversal has been completed and the closest hitting primitive has been found, or an intersecting miss has been determined, but it could also be because the traversal has stopped in response to the RTU 74 determining that the ray has hit a non-opaque or AABB primitive that requires further processing before the traversal can continue.
[0447] In all cases, before returning the ray to the programmable execution unit 65 for further processing, the RTU74 writes to its "ray data" data structure 700, to which a pointer has been passed, and ensures that these writes are completed before the ray is returned to the execution engine.
[0448] Figure 15 The "light data" data structure 700 according to this embodiment is schematically illustrated. For example... Figure 15As shown, the "ray data" data structure 700 typically includes several different fields as described below, used to store information related to traversal, which may need to be transferred between the programmable execution unit 65 and the RTU 74 when the above operations are performed.
[0449] For example, the "ray data" data structure 700 in this embodiment includes a first set of fields ("World Ray API Fields" 701) for storing information related to parameters defining rays to be processed in the world space coordinate system. These fields may include, for example: - x, y, and z components of the world space ray origin; - The x, y, and z components of the direction of light rays in world space; -Minimum and / or maximum light distance in the world; - One or more ray markers are used to control the traversal of the rays; - A selection mask used for light rays; - Indicates the ray offset of the hit group; - The ray stride indicating the hit group stride of the ray; and - The "Missing" index, in response to RTU 74 determining that rays do not intersect, identifies the "Missing" shader routine or ray that should be executed in the shader binding table.
[0450] The ray parameters can therefore be passed from the programmable execution unit 65 to the RTU 74 so that the RTU 74 can create the ray to be processed.
[0451] The “Ray Data” data structure 700 also includes a second set of fields (“Submitted Hit API Fields” 702) for storing information related to any submitted hits of that ray. These fields may include, for example: - The distance at which the light beam hits; - The u and v components of the center of gravity of the light ray; - An index of a set of primitives represented by the given end node that was hit; - An index containing a data structure of primitives represented by the hit end nodes; - The index of the submitted hit primitive instance (BLAS); - Whether the positive indication of the primitive was hit; - An indication of whether the primitive is opaque; - The submitted indication of the "type" that matches; - The geometry index of the submitted hitting primitive (i.e., the "class" of the geometry); and - The instance shader binding table offset of the submitted hit primitive.
[0452] The “ray data” data structure 700 also includes a third set of fields for storing information related to the parameters of the rays to be processed in the object space coordinate system, including the x, y, z coordinates of the object space ray origin and the z, y, z ray directions (“object space ray origin and direction” 703).
[0453] In this regard, it should be understood that when a ray intersects a leaf of a TLAS, traversal should then proceed to traverse the associated BLAS. Therefore, the RTU 74 should load a suitable data structure that defines the object instance represented by the BLAS, containing pointers to the associated BLAS and a suitable transformation matrix for transforming the ray from world space to the object space represented by the BLAS (e.g., as mentioned above regarding...). Figure 8 (As described). The RTU 74 then applies this transformation to calculate the object space ray coordinates. In this respect, it is advantageous for the RTU 74 to be able to write these to the "ray data" data structure 700, so that the transformed ray coordinates can then be used by the programmable execution unit 65, rather than having the programmable execution unit 65 recalculate them (saving effort and avoiding the risk that the programmable execution unit 65 might calculate different results due to performing calculations with different (higher) precision).
[0454] The “Ray Data” data structure 700 also includes a fourth set of fields (“Candidate Hit API Fields” 704) for storing information related to any candidate hits of the ray. That is, in response to RTU 74 determining that the ray potentially intersects or intersects with a geometry requiring an “Intersect” or “Any Hit” shader, the geometry cannot be automatically submitted, and instead, the candidate hit must be passed back to the programmable execution unit for further processing to determine whether the hit should be submitted. These fields may include, for example: - Candidate hit distance of the light ray; - Candidate hit centroids of light rays, u and v components; - An index of a set of primitives represented by the given end node that was hit; - An index containing a data structure of primitives represented by the hit end nodes; - Index of instances of candidate hit primitives (BLAS); - Whether the positive indication of the primitive was hit; - An indication of whether the primitive is opaque; - An indication of the "type" of the candidate hit; - The geometry index of the candidate hit primitive (i.e., the "class" of the geometry); - The instance shader binding table offset of the candidate hit primitive; and - A bitmap of primitives in a set of primitives represented by the hit end node, which still needs to be tested when resuming traversal.
[0455] As mentioned above, when executing the "ray tracing" command, it points to... Figure 15 The pointer to the “ray data” data structure 700 shown is then passed to the RTU 74 for processing. However, it should be understood in this regard that the input register for this instruction can be interpreted differently depending on whether the RTU 74 is notified to trace a new ray (“ray creation” state) or to resume tracing a ray that was previously stopped (“ray resumption” state).
[0456] Therefore, in one implementation, the "ray tracing" instruction also indicates to the RTU 74 whether the ray is a new ray or a ray to be recovered, as part of the message sent.
[0457] When in the "Ray Creation" state, the RTU 74 should (and does) use the World Ray API field to create a new ray, and then iterate over that ray through one or more accelerated data structures that need to be traversed, such as those mentioned above. Figure 8 The description. In this regard, it should be understood that the message also indicates the root node of the TLAS to be traversed, so as to tell RTU 74 where to start the traversal operation.
[0458] On the other hand, when in the "ray recovery" state, RTU 74 reads ray data from memory (because the "ray data" data structure 700 will have been written to by RTU 74 when traversal stops). In this case, RTU 74 should read the information stored in the "candidate hit API field" 704 to allow for faster recovery traversal (i.e., including the information mentioned above). Figure 9 The “instance identifier” mentioned and used in step 525, and the primitive and geometry indexes used in step 526, for example, as mentioned above regarding Figure 9 and Figure 10 Described.
[0459] Therefore, when resuming processing of the light rays, the input register includes the corresponding indices identifying the instance, geometry, and primitives at the point where the previous traversal stopped, as well as a bitmap of the primitives represented by the end nodes that need to be tested during resumption. As described above, when resuming traversal, the traversal restarts from the beginning. Therefore, the message should also indicate the root node of the TLAS to be traversed, telling the RTU 74 where to begin the traversal operation.
[0460] In both cases, whether in the "ray creation" or "ray recovery" state, the traversal continues until the ray needs to return to the programmable execution unit 65 for further processing (for whatever reason). At that point, the RTU 74 writes to the "ray data" data structure 700 and passes information about why the ray is being returned, along with an index to the shader routine that should be executed for further processing of the ray, back to the programmable execution unit 65 via a register.
[0461] The output register therefore includes: - The index of the shader routine in the shader binding table to be executed for this ray; and -The reason why the light returns.
[0462] That is, as mentioned above, the shader program index is calculated by the RTU 74 itself in this embodiment and then returned to the programmable execution unit 65 via an output register. The calculation of the shader program index is typically specified by the API. For example, if a ray is returning because the shader needs to be executed due to a "miss", this is calculated by reading the "miss index" field within the "ray data" data structure.
[0463] On the other hand, if the ray is returning because the hit shader needs to be executed, then the field is calculated as follows, where the hit triangle selection geometry_id should be RayTriangleData:
[0464] Formula 1 :
[0465] instance_sbt_offset + geometry_id * ray_stride + ray_offset
[0466] RTU 74 also returns the reason why the ray was returned. Rays can return from the ray tracing unit for a variety of reasons. The reason describes the type of primitive, triangle, or bounding box hit and whether the hit was committed. This field summarizes the reason the ray tracing unit returned and can be used to determine which code to execute next. Typically, the return reason is determined as follows. Note that when the ray resumes, the ray tracing unit internally updates the candidate hit type to "intersection_none" (see below), but this value is not stored in memory. It is also possible that the ray tracing unit must return because it was requested to stop or because of a timeout.
[0467] Therefore, this field can indicate the following conditions: - No intersections need to be reported; - The candidate triangle has been hit; - The candidate enclosing box primitive has been hit; - Candidate intersections have been generated from the bounding box primitives; - The triangle has been hit and submitted; - The bounding box primitive has been hit and the generated intersection has been submitted.
[0468] Therefore, once RTU 74 has performed one or more necessary traversals of the ray and determined the geometry intersecting the ray, this information is returned to programmable execution unit 65 so that the programmable execution unit can perform further processing for the sampling location in question based on the results of the determined traversal of the ray, wherein the further processing is controlled based on the appropriate shader routine that RTU 74 determines and selects to be executed for further processing of the ray in question.
[0469] For example, the programmable execution unit 65 may then execute an additional "surface treatment" shader program that performs further processing on the considered sampling locations based on the results of ray tracing accelerated data structure traversal, wherein the appropriate "surface treatment" shader program is determined and selected by the RTU 74.
[0470] That is, in this embodiment, there are multiple different sets of additional “surface processing” shader programs that can be executed based on the type of geometry that has been determined by the ray tracing acceleration data structure traversal circuit to intersect with the ray (and specifically, based on the specific surface type (one or more surface properties) of the geometry determined by the RTU).
[0471] Therefore, the process operates to select another “processing” shader program to be executed to perform further processing on the sampling position corresponding to the ray based on the geometry type (and specifically, surface type) that has been determined by the RTU to intersect with the ray, and the RTU 74 then returns the desired shader index to the programmable execution unit 65 (as described above) via the output register to trigger the generation of a new set of execution threads.
[0472] The programmable execution unit 65 then executes the selected additional shader program for the generated thread (e.g., Figure 5 Step 45 in the process.
[0473] Once the final output value for the considered sampling position has been generated, the processing for that sampling position is complete. The next sampling position can then be processed in a similar manner, and so on, until all sampling positions of the frame have been appropriately shaded. The frame can then be output, for example, for display, and the next frame is processed in a similar way, and so on.
[0474] Various other arrangements are also possible.
[0475] As will be understood from the above, the ray tracing-based rendering process of this embodiment involves, in particular, the programmable execution unit 65 of the graphics processor 60 executing appropriate shader programs to perform ray tracing-based rendering. In this embodiment, these shader programs are generated by a compiler (shader compiler) 12 for the graphics processor 60, which executes, for example, on the central processing unit (CPU) of the graphics processing system, such as the host processor (and in one embodiment, as part of the operation of the driver 11 for the graphics processor).
[0476] The compiler (driver) receives one or more advanced ray tracing-based rendering shader programs to be executed from the application 13 that requires ray tracing-based rendering, and then compiles the one or more programs into appropriate shader programs for execution by the graphics processor. As part of this process, as described above, one or more appropriate "ray tracing" instructions are included in one or more of the compiled shader programs to be executed by the graphics processor to cause the programmable execution unit to send a message to the RTU 74 to perform the desired geometry determination.
[0477] The compilation process (compiler) can use any suitable and desired compiler technology to achieve this.
[0478] Figure 16 The implementation scheme of the compilation process is shown.
[0479] like Figure 16 As shown, the compiler for the graphics processor will receive one or more ray-tracing based renderers for compilation (step 100).
[0480] The compiler will then analyze the provided shader program code to identify instances of the required BVH tree structure traversal during ray traversal operations in the shader program code (step 101), and insert the corresponding "ray tracing" instructions at appropriate points in the compiled shader program (step 102).
[0481] It can also identify the required "surface treatment" operations for intersecting geometries (step 103) and compile the corresponding "surface treatment" shader program (step 104). These are appropriately indexed in the corresponding "shader binding table".
[0482] Then, the compiled shader program is issued to the graphics processor for execution (e.g., stored in appropriate memory of the graphics processor and / or accessible to the graphics processor, so that the graphics processor can obtain the required shader program for execution as needed) (step 105).
[0483] As can be seen from the above, the techniques described herein, in their implementations, provide at least a more efficient process for performing ray tracing-based rendering. At least in the implementations of the techniques described herein, this is achieved by using dedicated ray tracing circuitry (units) to execute and manage the traversal of the rays being processed against a ray tracing acceleration data structure (e.g., a BVH tree structure). In these implementations, the ray tracing circuitry (units) is operable to determine the geometry (if any) intersecting with a given ray, and based on this, to determine the index of the corresponding shader program routine that should therefore be executed. The ray tracing circuitry (units) can then return the ray along with the determined shader index to a programmable execution unit, such that further processing of the rays for ray tracing-based rendering can then be performed by executing one or more appropriate shader programs using the programmable execution unit of the graphics processor.
[0484] The specific embodiments described above are presented for illustrative and descriptive purposes. They are not intended to be exhaustive or to limit the technology to the precise forms disclosed. Many modifications and variations are possible in accordance with the above teachings. The described embodiments were chosen to best explain the principles of the technology and its practical application, thereby enabling others skilled in the art to best utilize the technology in various embodiments and to have various modifications suitable for the particular intended use. The scope of the invention is intended to be defined by the appended claims.
Claims
1. A method of operating a graphics processor to generate a rendered output by performing a ray tracing process in which a plurality of rays are traced through a scene to be rendered, wherein the ray tracing process uses one or more ray tracing acceleration data structures indicative of a distribution of geometry within the scene to be rendered to determine which geometry intersects a ray being used for the ray tracing process, the graphics processor comprising a programmable execution unit operable to execute graphics processing programs, and wherein a program is executable by a set of one or more execution threads, the graphics processor further comprising a ray tracing circuit that is notifiable by the programmable execution unit as part of a program to perform ray tracing to determine, for a ray for which the ray tracing is being performed, any geometry that intersects the ray, the method comprising: executing a program by a set of one or more execution threads to perform ray tracing, wherein each execution thread of the set of execution threads corresponds to a respective ray of a set of rays for which the ray tracing is being performed; the method further comprising: in response to the set of execution threads executing a set of one or more ray tracing instructions included in the program to perform ray tracing: the programmable execution unit sending a message to the ray tracing circuit to determine, for a corresponding thread of the set of one or more execution threads executing the set of one or more ray tracing instructions, at least one ray for which the program is being executed to perform ray tracing, any geometry that intersects the ray, wherein to determine the geometry that intersects a ray, the ray tracing circuit is operable to perform a respective traversal of at least one ray tracing acceleration data structure and test the ray against the one or more acceleration data structures being traversed to determine any geometry that intersects the ray.
2. The method of claim 1, the method further comprising: after the programmable execution unit has sent a message to the ray tracing circuit regarding a given ray for the ray tracing circuit to process the ray, the ray tracing circuit subsequently sending a message back to the programmable execution unit for the programmable execution unit to execute a shader program routine regarding the ray, wherein the ray tracing unit is configured to determine, from the geometry that is determined to intersect the ray, if any, a corresponding shader program routine that should be executed by the programmable execution unit to further process the ray, and wherein the message sent by the ray tracing circuit to the programmable execution unit includes an indication of the corresponding shader program routine that the ray tracing unit has determined should be executed to further process the ray.
3. The method of claim 2, comprising: after the ray tracing circuit has completed processing the ray and determining, if any, geometrical shapes that the ray intersects, the ray tracing circuit sends a message to the programmable execution unit to trigger the programmable execution unit to execute a shader program routine, wherein the shader program routine that is executed is a closest hit shader routine or an intersection miss shader routine depending on the result of the processing of the ray by the ray tracing circuit.
4. The method of claim 2 or 3, comprising: in response to the ray tracing circuit determining that a ray intersects or potentially intersects a geometrical shape for which a shader program routine should be executed before traversal of a ray tracing acceleration data structure is complete, the ray tracing circuit sends a message to the programmable execution unit during the traversal with respect to the ray, and wherein once the processing of the ray has been returned to the programmable execution unit and the corresponding shader program routine is executed, the programmable execution unit sends a message to the ray tracing circuit to continue ray traversal of the ray tracing acceleration data structure.
5. The method of any one of claims 2 to 4, wherein the message sent by the ray tracing circuit to the programmable execution unit further comprises an indication of the reason for the ray being returned to the programmable execution unit and / or an updated parameter set defining the ray being returned.
6. The method of any one of claims 2 to 5, wherein prior to the ray tracing circuit passing a ray back to the programmable execution unit, the ray tracing circuit writes to memory an updated parameter set defining the ray and / or a result of a geometrical shape intersection determination based on the processing to a certain extent.
7. The method of any preceding claim, wherein the message sent by the programmable execution unit to the ray tracing circuit with respect to a ray to be processed by the ray tracing circuit comprises one or more parameters for defining the ray, the ray tracing circuit then using the parameters provided by the message to create the ray.
8. The method of claim 7, wherein the message sent by the programmable execution unit to the ray tracing circuit with respect to a ray to be processed by the ray tracing circuit further indicates a miss shader that should be executed for the ray in response to the ray tracing circuit determining that the ray does not intersect any geometrical shapes.
9. A method of compiling a shader program to be executed by a programmable execution unit of a graphics processor, the programmable execution unit being operable to execute a graphics processing program to perform graphics processing operations, wherein the graphics processor further comprises a ray tracing circuit that is notifiable by the programmable execution unit as part of a program to perform ray tracing to determine, for a ray for which the ray tracing is being performed, if any, geometrical shapes that the ray intersects; the method comprising: For a shader program to be executed by a programmable execution unit of a graphics processor in performing ray tracing, wherein the ray tracing process uses one or more ray tracing acceleration data structures indicative of a distribution of geometry within a scene to be rendered to determine which geometry intersects a ray being used for the ray tracing process, and wherein the program is to be executed by a set of one or more execution threads, with individual threads of the set of one or more execution threads corresponding to a respective ray for which the ray tracing is being performed: including in the shader program a set of one or more ray tracing instructions, the set of ray tracing instructions when executed by the set of execution threads to cause: the programmable execution unit to send a message to the ray tracing circuit to determine for a corresponding thread of the set of one or more execution threads executing the set of one or more ray tracing instructions at least one ray for which the program is being executed to perform ray tracing the geometry, if any, that intersects the ray, wherein to determine the geometry that intersects a ray the ray tracing circuit is operable to perform a respective traversal of at least one ray tracing acceleration data structure and test the ray against one or more acceleration data structures being traversed to determine which geometry, if any, intersects the ray.
10. A method of operating a graphics processor to generate a rendered output by performing a ray tracing process in which a plurality of rays are traced through a scene to be rendered, wherein the ray tracing process uses one or more ray tracing acceleration data structures indicative of a distribution of geometry within the scene to be rendered to determine which geometry intersects a ray being used for the ray tracing process, the graphics processor including a programmable execution unit operable to execute graphics processing programs, and wherein a program is executable by a set of one or more execution threads, the graphics processor further including a ray tracing circuit that is notifiable by the programmable execution unit as part of a program to perform ray tracing to determine, for a ray for which the ray tracing is being performed, geometry, if any, that intersects the ray, the method comprising: including in a program for performing ray tracing a set of one or more "ray tracing” instructions, wherein the program is to be executed by a set of one or more execution threads, with individual threads of the set of one or more execution threads corresponding to a respective ray for which the ray tracing is being performed, the set of ray tracing instructions when executed by the set of execution threads to cause: the programmable execution unit sends a message to the ray tracing circuit to determine, for a corresponding thread of the set of one or more execution threads executing the set of one or more ray tracing instructions, at least one geometric shape that, if any, intersects a ray for which the program is being executed to perform ray tracing, wherein to determine geometric shapes that intersect a ray, the ray tracing circuit is operable to perform a respective traversal of at least one ray tracing acceleration data structure and test the ray against one or more acceleration data structures being traversed to determine which, if any, geometric shape intersects the ray; the method further includes: while a set of one or more execution threads are executing the program for a corresponding set of one or more rays being used for a ray tracing process: in response to the set of execution threads executing the set of one or more ray tracing instructions included in the program: the programmable execution unit sends a message to the ray tracing circuit to determine, for a corresponding thread of the set of one or more execution threads executing the set of one or more ray tracing instructions, at least one geometric shape that, if any, intersects a ray for which the program is being executed to perform ray tracing.
11. A graphics processor operable to generate a rendered output by performing a ray tracing process in which a plurality of rays are traced through a scene to be rendered, wherein the ray tracing process uses one or more ray tracing acceleration data structures indicative of a distribution of geometric shapes within the scene to be rendered to determine which geometric shape intersects a ray being used for the ray tracing process, the graphics processor includes a programmable execution unit operable to execute graphics processing programs, and wherein a program is executable by a set of one or more execution threads, the graphics processor further includes a ray tracing circuit that is notifiable by the programmable execution unit as part of a program to perform ray tracing to determine, for a ray for which the ray tracing is being performed, which, if any, geometric shape intersects the ray, wherein the programmable execution unit is configured such that while a set of one or more execution threads are executing a program to perform ray tracing, wherein individual execution threads of the set of execution threads correspond to respective rays of a set of rays for which the ray tracing is being performed, in response to the set of execution threads executing a set of one or more ray tracing instructions included in the program to perform ray tracing: The programmable execution unit sends a message to the ray tracing circuit to determine, for a corresponding thread of the set of one or more execution threads executing the set of one or more ray tracing instructions, the geometry, if any, that the ray intersects for which the program is executed to perform ray tracing.
12. The graphics processor of claim 11, wherein: after the programmable execution unit has sent a message to the ray tracing circuit about a given ray for the ray tracing circuit to process the ray, the ray tracing circuit is configured to subsequently send a message back to the programmable execution unit for the programmable execution unit to execute a shader program routine about the ray, wherein the ray tracing unit is configured to determine, from the geometry, if any, that is determined to intersect the ray, a corresponding shader program routine that should be executed by the programmable execution unit to further process the ray, and wherein the message sent by the ray tracing circuit to the programmable execution unit includes an indication of the corresponding shader program routine that the ray tracing unit has determined should be executed to further process the ray.
13. The graphics processor of claim 12, wherein the ray tracing circuit is operable to send a message to the programmable execution unit to trigger the programmable execution unit to execute a shader program routine after the ray tracing circuit has completed processing the ray and determining the geometry, if any, that intersects the ray, wherein the shader program routine that is executed is a closest hit shader routine or an intersection miss shader routine, depending on the result of the processing of the ray by the ray tracing circuit.
14. The graphics processor of claim 12 or 13, wherein the ray tracing circuit is operable to send a message to the programmable execution unit about the ray during traversal of a ray tracing acceleration data structure in response to the ray tracing circuit determining that a ray intersects a geometry for which a shader program routine should be executed or potentially intersects before traversal of the ray tracing acceleration data structure is completed, and wherein once the processing of the ray has been returned to the programmable execution unit and the corresponding shader program routine is executed, the programmable execution unit sends a message to the ray tracing circuit to continue ray traversal of the ray tracing acceleration data structure.
15. The graphics processor of any one of claims 12 to 14, wherein the message sent by the ray tracing circuit to the programmable execution unit further includes an indication of a reason for the ray being returned to the programmable execution unit and / or an updated parameter set defining the ray that is being returned.
16. The graphics processor of any one of claims 12 to 15, wherein, prior to the ray tracing circuit passing a ray back to the programmable execution unit, the ray tracing circuit is configured to write to memory an updated parameter set defining the ray and / or a result determined based on the processing of the geometric shape intersection to a certain extent.
17. The graphics processor of any one of claims 11 to 16, wherein the message sent by the programmable execution unit to the ray tracing circuit regarding a ray to be processed by the ray tracing circuit includes one or more parameters for defining the ray, the ray tracing circuit then using the parameters provided by the message to create the ray.
18. The graphics processor of claim 17, wherein the message sent by the programmable execution unit to the ray tracing circuit regarding a ray to be processed by the ray tracing circuit further indicates a miss shader that should be executed for the ray in response to the ray tracing circuit determining that the ray does not intersect any geometric shape.
19. A compiler for compiling a shader program to be executed by a programmable execution unit of a graphics processor, the programmable execution unit being operable to execute a graphics processing program to perform graphics processing operations, wherein the graphics processor further comprises a ray tracing circuit that is able to be instructed by the programmable execution unit as part of a program to perform ray tracing to determine, for a ray for which the ray tracing is being performed, any geometric shapes that intersect the ray; the compiler comprising processing circuitry configured to: for a shader program to be executed by a programmable execution unit of a graphics processor in performing ray tracing, wherein the ray tracing process uses one or more ray tracing acceleration data structures indicating a distribution of geometric shapes within a scene to be rendered to determine which geometric shapes intersect the rays being used for the ray tracing process, and wherein the program is to be executed by a set of one or more execution threads, with individual threads of the set of one or more execution threads corresponding to respective rays for which the ray tracing is being performed: include, in the shader program, a set of one or more ray tracing instructions that, when executed by the set of execution threads, will cause: the programmable execution unit to send a message to the ray tracing circuit to determine, for a corresponding thread of the set of one or more execution threads executing the set of one or more ray tracing instructions, at least one ray for which the program is being executed to perform ray tracing, any geometric shapes that intersect the ray, wherein to determine the geometric shapes that intersect a ray, the ray tracing circuit is operable to perform a respective traversal of at least one ray tracing acceleration data structure and test the ray against the one or more acceleration data structures being traversed to determine any geometric shapes that intersect the ray.
20. A graphics processing system comprising a graphics processor operable to generate a rendered output by performing a ray tracing process in which a plurality of rays are traced through a scene to be rendered, wherein the ray tracing process uses one or more ray tracing acceleration data structures indicative of a distribution of geometry within the scene to be rendered to determine which geometry intersects a ray being used for the ray tracing process, the graphics processor comprises a programmable execution unit operable to execute a graphics processing program, and wherein the program is executable by a set of one or more execution threads, the graphics processor further comprises a ray tracing circuitry that is notifiable by the programmable execution unit during program execution to perform ray tracing to determine, for a ray for which the ray tracing is being performed, any geometry that intersects the ray, the graphics processing system further comprises: processing circuitry configured to: include, in a program for performing ray tracing, a set of one or more ray tracing instructions, wherein the program is to be executed by a set of one or more execution threads, wherein individual threads of the set of one or more execution threads correspond to respective rays for which the ray tracing is being performed, the set of ray tracing instructions, when executed by the set of execution threads, to cause: the programmable execution unit to send a message to the ray tracing circuitry to determine, for a corresponding thread of the set of one or more execution threads executing the set of one or more ray tracing instructions, any geometry that intersects at least one ray for which the program is being executed to perform ray tracing, wherein to determine the geometry that intersects a ray, the ray tracing circuitry is operable to perform a respective traversal of at least one ray tracing acceleration data structure and test the ray against the one or more acceleration data structures being traversed to determine any geometry that intersects the ray; wherein the programmable execution unit is configured so that when a set of one or more execution threads are executing the program for a corresponding set of one or more rays being used for a ray tracing process: in response to the set of execution threads executing the set of one or more ray tracing instructions included in the program: the programmable execution unit to send a message to the ray tracing circuitry to determine, for a corresponding thread of the set of one or more execution threads executing the set of one or more ray tracing instructions, any geometry that intersects at least one ray for which the program is being executed to perform ray tracing.
21. A computer program product that, when executed on a data processor, causes the data processor to perform the method of any one of claims 1 to 10.