Graphics processing
By introducing ray tracing accelerated data structures and dynamic storage allocation in the graphics processor, the problem of insufficient storage space in ray tracing rendering is solved, and more efficient storage utilization and performance optimization is achieved.
Patent Information
- Application Number
- CN202410367355.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-05-03
- Filing Date
- 2024-03-28
- Publication Date
- 2024-11-05
AI Technical Summary
Existing graphics processors have insufficient storage space when performing ray tracing rendering, resulting in stack overflow and performance losses.
By introducing ray tracing accelerated data structure and dynamic storage allocation mechanism in the graphics processor, the storage requirements of ray tracing circuits are optimized, and the intersection test of rays and geometric shapes is accelerated using the hierarchical bounding box (BVH) tree structure, and dynamically allocate them if necessary. Additional storage space to avoid stack overflow.
Effectively reduce the area requirement for local storage of graphics processors that perform ray tracing, avoid stack overflow, and achieve more efficient storage utilization without affecting performance.
Smart Images

Figure CN118898537A_ABST
Abstract
Description
[0001] The present invention relates to graphics processing systems and, in particular, to using ray tracing to render frames (images) for display.
[0002] Figure 1 An exemplary system-on-chip (SoC) graphics processing system 8 is shown, comprising a host processor in the form of a central processing unit (CPU) 1 , a graphics processor (GPU) 2 , a display processor 3 and a memory controller 5 .
[0003] like Figure 1 As shown, these units communicate via an interconnect 4 and have access to off-chip memory 6. In this system, a graphics processor 2 will render frames (images) to be displayed, which are then provided by a display processor 3 to a display panel 7 for display.
[0004] In use of the system, an application 13, such as a game, executing on a host processor (CPU) 1 will, for example, need to display frames on a display panel 7. To do this, the application will submit appropriate commands and data to a driver 11 for a graphics processor 2 executing 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 those frames in an appropriate frame buffer, such as in main memory 6. The display processor 3 will then read those frames into a buffer for display, and then read those frames from that buffer and display them on the display panel 7 of the display.
[0005] One rendering process that may be performed by a graphics processor is what is known as "ray tracing." Ray tracing is a rendering process that involves tracing the paths of rays from a viewpoint (sometimes called a "camera") through sampling locations in an image plane into a scene, and simulating the effects of interactions between those rays and objects in the scene. The output data values for the sampling locations in the image (plane) are determined based on the objects in the scene that are intersected by the ray that passes through the sampling location, and the properties of the surfaces of those objects. The ray tracing calculations are complex and involve determining, for each sampling location, a set of objects within the scene that are intersected by the ray that passes through the sampling location.
[0006] Figure 2An exemplary "full" ray tracing process is shown. A ray 20 (the "primary ray") is cast backwards from a viewpoint 21 (e.g., a camera position) through a sample location 22 in an image plane (frame) 23 into the scene being rendered. A point 24 is identified at which the ray 20 first intersects an object 25 in the scene, such as a primitive (these primitives may be in the form of, for example, triangles, but may also include other suitable geometric shapes). This first intersection will be with the object in the scene that is closest to the sample location. A secondary ray in the form of a shadow ray 26 may be cast from the first intersection point 24 to a light source 27. Depending on the material of the surface of the object 25, another secondary ray in the form of a reflected ray 28 may be traced from the intersection point 24. If the object is at least somewhat transparent, refracted secondary rays may be taken into account.
[0007] Ray tracing is considered to provide better results than more traditional rasterization rendering techniques, such as more realistic, physically accurate images, especially in the ability to capture reflections, refractions, shadows, and lighting effects. However, ray tracing can be much more processing intensive than traditional rasterization.
[0008] Applicants believe that there remains scope for improved techniques for performing ray tracing using graphics processors.
[0009] According to a first aspect of the present invention, there is provided a graphics processor operable to perform ray tracing, wherein the graphics processor comprises:
[0010] Storage device;
[0011] ray tracing circuitry operable to trace a ray by performing tests to determine whether the ray intersects a geometry representing a scene to be rendered, wherein the ray tracing circuitry is operable to use the storage device to store test record entries for traced rays, wherein each test record entry indicates a test that may need to be performed to trace the ray; and
[0012] A distribution circuit operable to:
[0013] determining whether the ray tracing circuitry may require additional storage space to store test log entries to trace rays; and
[0014] When it is determined that the ray tracing circuit may require additional storage space to store test record entries to trace rays:
[0015] Additional storage space is allocated from the storage device for use by the ray tracing circuit to store test log entries for tracing rays.
[0016] According to a second aspect of the present invention, there is provided a method of operating a graphics processor, the graphics processor being operable to perform ray tracing, wherein the graphics processor comprises:
[0017] storage device; and
[0018] ray tracing circuitry operable to trace a ray by performing a test to determine whether the ray intersects a geometry representing a scene to be rendered, wherein the ray tracing circuitry is operable to use the storage device to store test record entries for traced rays, wherein each test record entry indicates a test that may need to be performed to trace the ray;
[0019] The method includes:
[0020] determining whether the ray tracing circuitry may require additional storage space to store test log entries to trace rays; and
[0021] When it is determined that the ray tracing circuit may require additional storage space to store test record entries to trace rays:
[0022] Additional storage space is allocated from the storage device for use by the ray tracing circuit to store test log entries for tracing rays.
[0023] The present invention relates to a graphics processor that performs ray tracing. In the present invention, the graphics processor includes a ray tracing circuit that can be operated to perform ray tracing, for example, by traversing a ray tracing acceleration data structure. In an embodiment, the ray tracing acceleration data structure includes a plurality of nodes, wherein each node of the ray tracing acceleration data structure represents a corresponding volume.
[0024] In an embodiment, the ray tracing acceleration data structure is arranged as a hierarchy of nodes representing a hierarchy of boxes, for example, and in an embodiment, the ray tracing acceleration data structure includes one or more bounding volume hierarchies (BVHs).
[0025] In an embodiment, the ray tracing circuitry tests the intersection of a ray with a box represented by a node of a ray tracing acceleration data structure (eg, a BVH).
[0026] In an embodiment, the ray tracing circuit maintains a test record in a (local) storage device to manage its test operations. Each entry of the test record for a ray indicates a corresponding test that may need to be performed to trace the ray, for example, and in an embodiment, each entry of the test record for a ray indicates a corresponding node of a ray tracing acceleration data structure (e.g., BVH) that represents a box that the ray may need to be tested to intersect with.
[0027] Therefore, according to an embodiment of the present invention, there is provided a graphics processor operable to perform ray tracing, wherein the graphics processor comprises:
[0028] Storage device;
[0029] ray tracing circuitry operable to trace a ray by traversing a ray tracing acceleration data structure and testing the ray against nodes of the ray tracing acceleration data structure to determine whether the ray intersects a box represented by the node, wherein the ray tracing circuitry is operable to use the storage device to store test record entries for traced rays, wherein each test record entry indicates a node of the ray tracing acceleration data structure against which the ray may need to be tested; and
[0030] A distribution circuit operable to:
[0031] determining whether the ray tracing circuitry may require additional storage space to store test log entries to trace rays; and
[0032] When it is determined that the ray tracing circuit may require additional storage space to store test record entries to trace rays:
[0033] Additional storage space is allocated from the storage device for use by the ray tracing circuit to store test log entries for tracing rays.
[0034] According to an embodiment of the present invention, there is provided a method of operating a graphics processor, the graphics processor being operable to perform ray tracing, wherein the graphics processor comprises:
[0035] storage device; and
[0036] ray tracing circuitry operable to trace a ray by traversing a ray tracing acceleration data structure and testing the ray against nodes of the ray tracing acceleration data structure to determine whether the ray intersects a box represented by the node, wherein the ray tracing circuitry is operable to use the storage device to store test record entries for traced rays, wherein each test record entry indicates a node of the ray tracing acceleration data structure against which the ray may need to be tested;
[0037] The method includes:
[0038] determining whether the ray tracing circuitry may require additional storage space to store test log entries to trace rays; and
[0039] When it is determined that the ray tracing circuit may require additional storage space to store test record entries to trace rays:
[0040] Additional storage space is allocated from the storage device for use by the ray tracing circuit to store test log entries for tracing rays.
[0041] In an embodiment of the present invention, as will be discussed in more detail below, for (each) ray being traced, the ray tracing circuitry may store a test record entry in a (corresponding) reserved area of a storage device, which in an embodiment operates as a stack. Thus, in an embodiment, when it is determined that a ray may need to be tested (e.g., for the node), a test record (stack) entry indicating a test (e.g., indicating a node of a ray tracing acceleration data structure (e.g., a BVH)) is pushed to the stack (reserved area) for the ray, and (by the ray tracing circuitry) which test should be performed next (e.g., which node should be tested next) is determined by popping the (top) test record entry from the stack for the ray and determining that the ray should next be tested according to the popped test record entry (e.g., for the node indicated by the popped test record entry).
[0042] In an embodiment, as will be discussed in more detail below, the ray tracing circuit is operable to trace a group of multiple rays together, and each ray in the group of rays traced together is provided with a corresponding reserved storage area (stack) that the ray tracing circuit can use to store a test record entry for the corresponding ray.
[0043] In the present invention, when it is determined that the ray tracing circuit may require additional storage space to store test record entries to trace rays, for example and in an embodiment, when a reserved area (stack) for rays becomes full, additional storage space is allocated for use by the ray tracing circuit to store (more) test record entries for the rays.
[0044] In an embodiment, the additional storage space is allocated from the storage space shared between all rays in a group of multiple rays that are traced together, and thus the additional storage space can be allocated for tracing any ray in the group of multiple rays.
[0045] Thus, in an embodiment of the present invention, for each ray in a group of multiple rays being traced together, the storage device includes an initial "fixed" ("static") allocated storage area (e.g., a stack) that is reserved for initial use by the ray tracing circuit to store test record entries to trace the corresponding ray. Additional, allocable, shared storage areas are then available for "dynamic" allocation by the ray tracing circuit to store (more) test record entries for any of the multiple rays in the group.
[0046] As will be discussed in more detail below, the inventors have recognized that for commonly encountered ray tracing content, it is generally not necessary to provide for each ray being traced the maximum possible stack depth required to trace the ray, and instead a smaller stack depth is generally sufficient. For example, the inventors have calculated that ray tracing in Vulkan requires a maximum possible stack depth of 102 test record entries per ray, but typical content generally uses 20 to 30 entries per ray.
[0047] The present invention exploits this by allowing dynamic allocation of additional stack depth. Thus, rather than providing the maximum possible required stack depth for each ray in a group of multiple rays being traced together, each ray in the group may be provided with a smaller initial stack depth, but if the need for a larger stack depth arises, additional stack depth can be requested from a shared allocatable storage area.
[0048] This can reduce or avoid the possibility of stack overflows while reducing the overall storage requirements for storing test record entries. Thus, the present invention can reduce the area requirements of the local storage device of the graphics processor performing ray tracing. Moreover, as will be discussed in more detail below, this can be achieved without performance loss.
[0049] It will therefore be appreciated that the present invention may provide improved graphics processors and ray tracing methods.
[0050] The graphics processor of the present invention is operable to perform ray tracing, for example and in an embodiment, to generate a rendered output (such as a frame for display), for example, the rendered output represents a view of a scene including one or more objects. The graphics processor can generally generate multiple rendered outputs (e.g., a series of frames).
[0051] The rendering output will typically include an array of data elements (samples) (e.g., pixels), for each of which appropriate rendering output data (e.g., a set of color value data) is generated by the graphics processor. The rendering output data may include color data such as a set of red, green, and blue RGB values and a transparency (α, a) value.
[0052] The memory of the graphics processor may include any suitable storage device. The storage device should be, and in embodiments is, local to the graphics processor (e.g., on the same chip). The storage device may include, for example, and in embodiments includes, a set of registers and / or RAM, and, for example, forms part of a cache system for the graphics processor. In embodiments, the memory has a fixed storage capacity.
[0053] The graphics processor (ray tracing circuit) can trace separate rays separately. In an embodiment, the graphics processor is operable to trace a group of multiple rays together. Therefore, in an embodiment, the ray tracing circuit traces a group of multiple rays together, for example and in an embodiment, so that all rays in a group of rays traverse (access) the nodes of the ray tracing acceleration data structure in the same node order. In an embodiment, the arrangement in this regard is substantially as described in US2022 / 0392147, the entire contents of which are incorporated herein by reference.
[0054] The graphics processor may perform ray tracing graphics processing operations in any suitable and desired manner. In an embodiment, the graphics processor (e.g., ray tracing circuitry of the graphics processor) includes one or more programmable execution units (e.g., shader cores) operable to execute programs to perform graphics processing operations, and ray tracing-based rendering is triggered and performed by the programmable execution units of the graphics processor executing a graphics processing (e.g., shader) program that causes the programmable execution units to perform a ray tracing rendering process.
[0055] In an embodiment, a program is executed together by a group of multiple execution threads, for example, and in an embodiment, one execution thread is used for each ray in a group of rays that are traced together. Thus, in an embodiment, each ray is traced by a corresponding execution thread executing an appropriate (e.g., shader) program.
[0056] Typically, in ray tracing, one or more rays are used to render (each) sampling position in the rendered output, and for each ray traced, it is determined which geometry defined for the rendered output intersects the ray (if any). The geometry determined to intersect the ray can then be further processed, for example to determine the color of the sampling position under consideration.
[0057] The geometry to be processed to generate the rendered output may include any suitable and desired graphics processing geometry.In an embodiment, the geometry includes a graphics primitive, in the form of a polygon (eg, a triangle), or a bounding box primitive.
[0058] Determining which geometry, if any, intersects a ray may be performed in any suitable and desired manner. Typically, there may be millions of graphics primitives within a given scene, and millions of rays to be tested, making it generally impractical to test each ray for each graphics primitive. To accelerate ray tracing operations, embodiments of the present invention use ray tracing acceleration data structures (such as bounding box hierarchies (BVHs)) that represent the distribution of geometry in a scene (e.g.,) to be rendered to determine the intersection of a ray with geometry (e.g., objects) in the rendered scene (and then render sampling positions in an output rendered frame representing the scene accordingly).
[0059] Thus, ray tracing according to an embodiment of the present invention typically includes (the ray tracing circuit) performing a traversal of a ray tracing acceleration data structure, which traversal involves testing intersections of rays with boxes represented by different nodes of the ray tracing acceleration data structure in order to determine which geometric shapes can intersect with which rays for sampling locations in the rendered output, and therefore which geometric shapes need to be further processed for the rays for the sampling locations.
[0060] The ray tracing acceleration data structure can be arranged in any suitable and desired manner. In an embodiment, the ray tracing acceleration data structure includes a tree structure, which is configured so that each end (leaf) node of the tree structure represents a set of geometric shapes (primitives) defined within a corresponding box corresponding to the end (leaf) node, and other (non-leaf) nodes represent hierarchically arranged larger boxes until the root node at the top level of the tree structure, which root node represents the total box of the considered rendering output (e.g., scene) corresponding to the tree structure.
[0061] Thus, each non-leaf node is, in an embodiment, the parent node of a respective set of multiple child nodes, where the parent node box contains the boxes of its respective child nodes. In an embodiment, each (non-leaf) node is associated with a respective plurality of child node boxes, each representing (in an embodiment, non-overlapping) child boxes within the entire box represented by the (non-leaf) node in question.
[0062] Therefore, in an embodiment, at least one of the nodes of the ray tracing acceleration data structure is associated with a corresponding set of multiple child nodes. In an embodiment, there are multiple such nodes in the ray tracing acceleration data structure. These nodes may be referred to as "parent" nodes. For example, depending on the arrangement of the ray tracing acceleration data structure, these nodes may also be referred to as "internal" or "non-leaf" nodes.
[0063] Thus, in an embodiment, traversal of a ray tracing acceleration data structure includes (the ray tracing circuitry) proceeding along "branches" of a tree structure and testing rays against sub-boxes associated with nodes of a first level of the tree structure to determine which child nodes in the next level of the tree structure should be tested, and so on, until the layer of corresponding end (e.g., leaf) nodes at the end of the branches of the tree structure.
[0064] The ray tracing acceleration data structure may include, for example, a single tree structure (e.g., BVH) that represents the entire scene being rendered. In an embodiment, the ray tracing acceleration data structure includes multiple "layers" of tree structures (e.g., BVH).
[0065] For example, in an embodiment, the ray tracing acceleration data structure includes one or more "lowest level" tree structures (e.g., BVH) (which may also be referred to as a "bottom-level acceleration structure (BLAS)") and a "top-level" tree structure (e.g., BVH) (which may also be referred to as a "top-level acceleration structure (TLAS)"), where each of the "lowest level" tree structures represents a corresponding instance or object within a scene to be rendered, and the "top-level" tree structures refer to one or more "lowest level" tree structures. In this case, each "lowest level" tree structure may include an end (e.g., leaf) node representing a set of geometric shapes (e.g., primitives) associated with the corresponding instance or object, and the "top-level" tree structure may include an end (e.g., leaf) node that points to, for example, a root node of one or more of the one or more "lowest level" tree structures.
[0066] In an embodiment, each "lowest level" tree structure (e.g., BLAS) is defined in a space associated with a corresponding instance or object (e.g., model space), while a "highest level" tree structure (e.g., TLAS) is defined in a space associated with the entire scene (e.g., world space). In this case, each "highest level" tree structure end (e.g., leaf) node may include information indicating the appropriate transformation between the corresponding spaces. Accordingly, traversal of the ray tracing acceleration data structure may include: when reaching an end (e.g., leaf) node of the "highest level" tree structure, applying the transformation indicated by the end (e.g., leaf) node, and then starting to traverse the corresponding "lowest level" tree structure.
[0067] Once it has been determined which end (e.g., leaf) nodes represent geometry that the ray may intersect by performing traversal operations on the ray, the actual geometry that the ray intersects with the geometry occupying the box associated with the intersecting end (e.g., leaf) node can be determined accordingly, such as by testing the ray for intersection with each of the geometry units (e.g., primitives) defined for the rendering output (e.g., scene) occupying the box associated with the end (e.g., leaf) node.
[0068] Thereafter, once it has determined that the geometry of the ray being used to render the sampling location intersects, it can (and in embodiments does) determine what appearance the sampling location should have, and renders the sampling location accordingly.
[0069] Thus, in an embodiment, a graphics processor (e.g., ray tracing circuitry of a graphics processor) is operable to perform (tests including) a ray-by-box intersection test, wherein a determination is made as to whether a ray intersects a box represented by a node of a ray tracing acceleration data structure, and a ray-by-geometry (e.g., primitive) intersection test, wherein a determination is made as to whether a ray intersects a geometry (e.g., primitive) occupying a box represented by a node of a ray tracing acceleration data structure.
[0070] Ray-by-box intersection testing and / or ray-by-geometry (e.g., primitive) intersection testing is performed by a programmable execution unit of a graphics processor executing an appropriate program. In an embodiment, a graphics processor (e.g., a ray tracing circuit of a graphics processor) includes a ray-by-box intersection testing circuit that is operable to perform a ray-by-box intersection testing and that is, in an embodiment, a (substantially) fixed function circuit. In an embodiment, a graphics processor (e.g., a ray tracing circuit of a graphics processor) includes a ray-by-geometry (e.g., primitive) intersection testing circuit that is operable to perform a ray-by-geometry (e.g., primitive) intersection testing and that is, in an embodiment, a (substantially) fixed function circuit.
[0071] In an embodiment, execution of appropriate program instructions triggers the programmable execution unit to send a message to the ray-by-box intersection test circuit to cause the ray-by-box intersection test circuit to perform a ray-by-box intersection test. In an embodiment, execution of appropriate program instructions triggers the programmable execution unit to send a message to the ray-by-geometry (e.g., primitive) intersection test circuit to cause the ray-by-geometry (e.g., primitive) intersection test circuit to perform a ray-by-geometry (e.g., primitive) intersection test.
[0072] In an embodiment, the ray tracing acceleration data structure traversal is performed in a "leaf first" order. That is, in an embodiment, rays are tested for any leaf nodes that have been determined to require testing of rays before any internal nodes have been determined to require testing of rays. In an embodiment, the ray tracing acceleration data structure traversal is performed in an order substantially as described in UK Patent Application No. 2213007.4, the entire contents of which are incorporated herein by reference.
[0073] Other arrangements are possible.
[0074] In an embodiment of the present invention, the ray tracing circuit utilizes a test (traversal) record to manage its traversal and testing operations. A separate test record may be maintained for each ray being traced, or a combined test record may be maintained for, for example, a group of multiple rays being traced together. In an embodiment, the test record includes a list of entries indicating which nodes have been determined to intersect with the ray (and may need to be tested for the ray).
[0075] For example, and in an embodiment, to keep track of which nodes a ray intersects, and therefore needs to be tested against, each time a ray is determined (by ray tracing circuitry) to intersect a given node, then an indication that the node (box) intersects is pushed (added) to a test record for traversal operations. The record of which nodes represent boxes containing geometry that may have intersected the ray can then be read (by the ray tracing circuitry) to determine which nodes need to be tested, for example, at the next level, and so on.
[0076] The ray tracing circuit uses a storage device to store test records for (each) ray it is tracing. Thus, in an embodiment, the ray tracing circuit is operable to generate test (traversal) record entries, store the generated test record entries in the storage device, read the test record entries from the storage device, and process the test record entries read from the storage device.
[0077] In an embodiment, the records are stored in the form of a suitable stack and are managed in an embodiment using a "last in, first out" scheme, e.g., in the normal manner of a stack. Thus, in an embodiment, when a test of a first parent node indicates that one or more of its child nodes intersect, the child nodes are then pushed (added) to the stack, and nodes are popped (removed) to be tested accordingly.
[0078] Therefore, in an embodiment, the ray tracing circuit uses a storage device to store a stack of test record entries. The ray tracing circuit may use a register (of the storage device) to store the top entry of the stack, and use a RAM (of the storage device) to store the other entries of the stack.
[0079] In an embodiment, the storage device includes an initial storage area that is reserved for initial use by the ray tracing circuit to store test records for rays. In an embodiment, the reserved area for a ray is a stack accessible to the execution thread that is executing the program to trace the ray. In an embodiment, for each ray in a group of rays being traced together, there is a corresponding initial area of the storage device (e.g., a stack). Therefore, in an embodiment, there are multiple (e.g., private) reserved areas of storage: one reserved area for each ray in a group of multiple rays being traced together (and correspondingly one reserved area for each thread in a group of threads executing together).
[0080] Thus, in an embodiment, the memory includes an initial storage area that is reserved for initial use by the ray tracing circuit to store test record entries to trace (each) ray. In an embodiment, it is then determined whether the ray tracing circuit may need additional storage space to store test record entries to trace the ray by determining whether the ray tracing circuit may need to store more test record entries to trace the ray than can be stored in the (corresponding) initial storage area for the ray. In an embodiment, when it is determined that the ray tracing circuit may need to store more test record entries to trace the ray than can be stored in the (corresponding) initial storage area for the ray, it is determined that the ray tracing circuit may need additional storage space to store test record entries to trace the ray.
[0081] The initial storage area can be of any suitable and desired size. There can be initial storage areas of different sizes, but in an embodiment, the initial storage areas are all the same size. In an embodiment, (each) initial storage area (e.g., stack) for rays includes less storage than the storage required to store the maximum possible number of test record entries that may need to be stored to trace rays. For example, as described above, the inventors have calculated that the maximum possible number of test record entries that may need to be stored to trace rays in Vulkan (the maximum possible "stack depth") is 102. (Each) initial storage area for a ray may therefore include less storage than the storage required to store, for example, 102 test record entries. Other quantities will be possible.
[0082] In an embodiment, the (each) initial storage area (e.g., stack) for a ray includes sufficient storage to store sufficient test record entries to facilitate the entire tracing of the ray under "normal" expected circumstances. For example, as described above, the inventors have found that tracing rays in Vulkan under normal circumstances typically requires approximately 20-30 test record entries. The (each) initial storage area for a ray may therefore include sufficient storage to store greater than or equal to, for example, 20 to 30 test record entries. Again, other quantities are possible. This can allow typical ray tracing content to be rendered without typically having to request additional storage.
[0083] Thus, in an embodiment, the (each) initial storage area (e.g., stack) for a ray includes sufficient storage space to store a specific, in an embodiment selected, in an embodiment predetermined (maximum) number of test log entries for that ray, such as and in an embodiment 32 test log entries. Other numbers, such as 64, are possible.
[0084] In an embodiment, the storage device (also) includes an (additional) allocatable storage area that is reserved for dynamic allocation (by the allocation circuitry). In an embodiment, the arrangement is such that (when allocated) the ray tracing circuitry can use the initial storage area and the allocatable storage area together (e.g., as a single stack) to store test record entries for tracing rays.
[0085] In an embodiment, the allocatable storage region is "shared" between all rays in a group of multiple rays being traced together. Thus, in an embodiment, there is only one allocatable storage region (per group of multiple rays being traced together).
[0086] Thus, in an embodiment, the storage device includes an allocatable storage area reserved for dynamic allocation (by the allocation circuit) for storing (more) test log entries to trace any ray in a group of multiple rays that are traced together. In an embodiment, when it is determined that the ray tracing circuitry may need additional storage space to store test log entries to trace the ray, the additional storage space is allocated from the allocatable storage area for use by the ray tracing circuitry to store test log entries to trace the ray.
[0087] Thus, in an embodiment, the storage device includes: for each ray in a group of multiple rays being traced together, a corresponding initial storage area (e.g., "fixed" / "statically" allocated) for initial use by the ray tracing circuit to store test record entries to trace the corresponding ray; and another ("shared") allocatable storage area for use by the ray tracing circuit to store (more) test record entries to trace any ray in the group of multiple rays.
[0088] Therefore, according to an embodiment of the present invention, there is provided a graphics processor operable to perform ray tracing, wherein the graphics processor comprises:
[0089] Storage device;
[0090] ray tracing circuitry operable to trace together a set of a plurality of rays by performing tests to determine whether the rays intersect geometry representing a scene to be rendered, wherein the ray tracing circuitry is operable to use the storage device to store test record entries for the rays being traced, wherein each test record entry indicates a test that may need to be performed to trace the ray (e.g., by indicating a node of a ray tracing acceleration data structure against which the ray may need to be tested); and
[0091] A distribution circuit operable to:
[0092] determining whether the ray tracing circuitry may require additional storage space to store a test log entry to trace a ray in a group of multiple rays that are traced together; and
[0093] When it is determined that the ray tracing circuitry may require additional storage space to store a test record entry to trace a ray of a group of multiple rays that are traced together:
[0094] Memory space is allocated from an allocatable memory area of the memory device, the allocatable memory area being reserved for allocation by the allocation circuitry to store a test log entry to track any ray in the set of multiple rays.
[0095] According to an embodiment of the present invention, there is provided a method of operating a graphics processor, the graphics processor being operable to perform ray tracing, wherein the graphics processor comprises:
[0096] storage device; and
[0097] ray tracing circuitry operable to trace together a set of a plurality of rays by performing tests to determine whether the rays intersect geometry representing a scene to be rendered, wherein the ray tracing circuitry is operable to use the storage device to store test record entries for the rays traced, wherein each test record entry indicates a test that may need to be performed to trace the ray (e.g., by indicating a node of a ray tracing acceleration data structure against which the ray may need to be tested);
[0098] The method includes:
[0099] providing an allocatable storage area of a storage device, the allocatable storage area being reserved for allocation to store a test log entry to trace any ray of a group of a plurality of rays being traced together;
[0100] determining whether the ray tracing circuitry may require additional storage space to store a test log entry to trace a ray in a group of multiple rays that are traced together; and
[0101] When it is determined that the ray tracing circuitry may require additional storage space to store a test record entry to trace a ray of a group of multiple rays that are traced together:
[0102] Additional storage space is allocated from the allocatable storage area for use by the ray tracing circuit to store test log entries for tracing rays.
[0103] The allocatable storage area may be of any suitable and desired size. In an embodiment, the arrangement is such that (each) ray is initially provided with enough storage to make progress in the "normal" case, and the allocatable storage area has enough extra space to ensure that progress can be made with at least one ray (of a group of rays being traced together) in the "extreme" case.
[0104] Thus, in an embodiment, the allocatable storage area includes sufficient storage to store, in combination with the initial storage area, the maximum possible number of test log entries that may need to be stored to trace a ray. Thus, for example and in an embodiment, with a maximum of 102 test log entries and the initial storage area being capable of storing 32 test log entries, the allocatable storage area may include sufficient storage to store 70 test log entries. Other quantities are possible.
[0105] In other embodiments, instead of (each) ray being initially provided with a (corresponding) initial ("fixed" / "static") storage area, only dynamically allocatable storage space is available. Thus, in an embodiment, the memory (only) comprises an allocatable storage area reserved for dynamic allocation (by the allocation circuit) for storing test record entries to trace any ray (of a set of multiple rays being traced together). In this case, the allocatable storage area should, and in an embodiment does, have enough space to ensure that progress can be made with at least one ray (of a set of multiple rays being traced together) in any case.
[0106] The allocatable storage region may be allocated for use (by the allocation circuit) in any suitable and desired manner.In an embodiment, the allocatable storage region is allocated in response to a suitable request, for example from a programmable execution unit of a graphics processor.
[0107] Allocating additional storage space from the allocatable storage region may include allocating the allocatable storage region as a whole. Thus, the allocatable storage region may be allocated to only (only) one ray in a group of rays (or a thread in a group of threads) at a time. In this case, in an embodiment, the ray requiring additional storage may need to wait for another ray to finish using the allocatable storage region before it can continue.
[0108] Alternatively, different parts of the allocatable storage area may be allocated differently.For example, different parts of the allocatable storage area may be allocated to different rays in a group of rays (different threads in a group of threads) at the same time, for example.
[0109] For example and in an embodiment, the allocatable storage area may be dynamically allocatable in steps corresponding to a particular, in an embodiment selected, in an embodiment predetermined number of test record entries (such as 1, 2, 4, 8, 16, 32, 64, or another number).
[0110] In the present invention, in response to determining that the ray tracing circuit may need additional storage space to store test log entries to trace rays, "dynamic" allocation is triggered (by the allocation circuit). The "dynamic" allocation can be triggered in response to determining that the ray tracing circuit does need additional storage space, or in response to determining that the ray tracing circuit may need additional storage space.
[0111] In an embodiment, it is determined whether the maximum number of test record entries that can be stored for a ray (currently) is being stored (currently). For example, it can be determined whether the initial storage area (stack) for the ray is full, that is, whether the initial storage area (stack) for the ray is storing the maximum number (e.g., 32) of test record entries. Then, when it is determined that the maximum number of test record entries that can be stored (currently) for the ray is being stored (e.g., when it is determined that the initial storage area (stack) for the ray is full), it can be determined that the ray tracing circuit may need additional storage space to store the test record entries to trace the ray.
[0112] In other embodiments, (when determining that a maximum number of test record entries (currently) that can be stored for a ray (currently) are being stored), it is determined whether a next operation (test) to be performed by the ray tracing circuit to trace the ray may require storing another test record entry for the ray, and when it is determined that the next operation (test) to be performed by the ray tracing circuit to trace the ray may require storing another test record entry for the ray, it is determined that the ray tracing circuit may require additional storage space to store test record entries to trace the ray.
[0113] It may be determined whether the next operation (test) to be performed by the ray tracing circuitry to trace the ray may require storing another test log entry in any suitable and desired manner. In an embodiment, it is determined (by the allocation circuitry) whether the next operation (test) is a ray-with-box intersection test, and when the next operation (test) is determined to be a ray-with-box intersection test, determining the next operation (test) to be performed by the ray tracing circuitry to trace the ray may require storing another test log entry in the storage device.
[0114] Accordingly, in an embodiment, when it is determined that the next operation (test) is a test of intersection of a ray with a geometry (e.g., a primitive), the next operation (test) determined (by the allocation circuitry) to be performed by the ray tracing circuitry to trace the ray will not require storing another test record entry.
[0115] In an embodiment, (the allocation circuitry) allocates additional storage space when needed, and the additional storage space can be released (deallocated) when it is no longer needed. Therefore, in an embodiment, (by the allocation circuitry) it is determined whether the ray tracing circuitry needs to store fewer test record entries than can (currently) be stored for the ray to trace the ray, and when it is determined that the ray tracing circuitry needs to store fewer test record entries than can (currently) be stored for the ray to trace the ray, (by the allocation circuitry) de-allocates (releases) the storage space used by the ray tracing circuitry to trace the ray.
[0116] The storage space may be deallocated (released) in any suitable and desired manner. The storage space may be, for example, deallocated stepwise, for example substantially as described above for the allocation process. In an embodiment, deallocating the storage space comprises deallocating the allocatable storage area as a whole.
[0117] In an embodiment, it is determined (by the allocation circuitry) whether the ray tracing circuitry needs to store the same or fewer test record entries as can be stored in the initial storage area for the ray to trace the ray, and when it is determined that the ray tracing circuitry needs to store the same or fewer test record entries as can be stored in the initial storage area for the ray to trace the ray, the allocatable storage area is deallocated. The allocatable storage area is then available for (re)allocation (e.g., to a ray in the same group of rays).
[0118] The present invention can be implemented in any suitable system such as a suitably configurable microprocessor-based system. In an embodiment, the present invention is implemented in a computer and / or microprocessor-based system. In an embodiment, the present invention is implemented in a portable device (such as and in an embodiment, a mobile phone or tablet computer).
[0119] The present invention is applicable to graphics processors and graphics processing systems of any suitable form or configuration, such as graphics processors (and systems) having a "pipeline" arrangement (in which case the graphics processor implements a rendering pipeline).
[0120] In an embodiment, the various functions of the present invention are performed on a single data processing platform that generates and outputs data, such as for a display device.
[0121] Those skilled in the art will appreciate that a graphics processing system may include (e.g., and in embodiments) a host processor that, for example, executes an application that needs to be processed by a graphics processor. The host processor will send appropriate commands and data to the graphics processor to control the graphics processor to perform graphics processing operations and generate graphics processing outputs required by the application executed on the host processor. To facilitate this, the host processor should (and in embodiments) also execute a driver for the processor and optionally one or more compilers for compiling (e.g., shader) programs to be executed by (e.g., (programmable) execution units of) the processor.
[0122] The processor may also include and / or communicate with one or more memories and / or memory devices storing data described herein and / or storing software (e.g., (shader) programs) for performing the processes described herein. The processor may also communicate with a host microprocessor and / or with a display for displaying images based on data generated by the processor.
[0123] The present invention can be used for all forms of input and / or output that can be used or generated by a graphics processor. For example, a graphics processor can execute a graphics processing pipeline that generates frames for display, rendering to texture output, etc. In an embodiment, output data values from the processing pipeline are exported to an external device (e.g., main memory) for storage and use, such as being exported to a frame buffer for display.
[0124] The various functions of the present invention may be performed in any desired and suitable manner. For example, the functions of the present invention may be implemented in hardware or software as required. Thus, for example, the various functional elements, stages and "devices" of the present invention may include one or more suitable processors, one or more controllers, functional units, circuit systems, circuits, processing logic components, microprocessor arrangements, etc. that can be operated to perform various functions, etc., such as appropriately dedicated hardware elements (processing circuits) and / or programmable hardware elements (processing circuits) that can be programmed to operate in a desired manner.
[0125] It should also be noted here that, as will be appreciated by those skilled in the art, the various functions of the present invention may be repeated and / or executed in parallel on a given processor, etc. Likewise, the various processing stages may share processing circuitry, etc., if desired.
[0126] Furthermore, any one or more or all of the processing stages of the present invention may be embodied as processing level circuitry / circuitry, for example, in the form of one or more fixed function units (hardware) (processing circuitry / circuitry) and / or in the form of programmable processing circuitry / circuitry that can be programmed to perform desired operations. Likewise, any one or more of the processing stages and processing level circuitry / circuitry of the present invention may be provided as independent circuit elements to any one or more of the other processing stages or processing level circuitry / circuitry, and / or any one or more or all of the processing stages and processing level circuitry / circuitry may be formed, at least in part, from shared processing circuitry / circuitry.
[0127] The components of the data processing system may originally include any one or more or all of the usual functional units and the like included in such components, depending on any hardware required to perform the specific functions described above.
[0128] It will also be appreciated by those skilled in the art that all described embodiments of the present invention may optionally include any one or more or all of the optional features described herein.
[0129] The method according to the invention can be implemented at least in part using software such as a computer program. It will therefore be appreciated that when considered from other embodiments, the invention provides: computer software that is particularly suitable for performing the method described herein when installed on a data processor; a computer program element that includes computer software code portions for performing the method described herein when the program element is run on a data processor; and a computer program that includes code suitable for performing all the steps of the method described herein when the program is run on a data processing system. The data processing system may be a microprocessor, a programmable FPGA (field programmable gate array), etc. ...
[0130] The invention also extends to a computer software carrier comprising such software which, when used to operate a data processor, a renderer or other system comprising a data processor, causes the data processor, the processor, the renderer or the system to perform the steps of the method of the invention in combination with the data processor, the processor, the renderer or the system. Such a computer software carrier may be a physical storage medium such as a ROM chip, a CD ROM, a RAM, a flash memory or a disk, or may be a signal such as an electronic signal via a wire, an optical signal or a radio signal such as a signal to a satellite or the like.
[0131] It will also be appreciated that not all steps of the method of the present invention need be performed by computer software, and therefore according to a broader embodiment, the present invention provides computer software and such software installed on a computer software carrier for performing at least one of the steps of the method set out herein.
[0132] The present invention may therefore be suitably embodied as a computer program product for use with a computer system. Such a specific implementation may include a series of computer-readable instructions fixed on a tangible non-transitory medium, such as a computer-readable medium, for example a disk, CD ROM, ROM, RAM, flash memory or hard disk. It may also include a series of computer-readable instructions that can be transmitted to a computer system via a modem or other interface device through a tangible medium (including but not limited to optical communication lines or analog communication lines) or passively using wireless technology (including but not limited to microwave, infrared or other transmission technology). The series of computer-readable instructions embodies all or part of the functionality previously described herein.
[0133] Those skilled in the art will appreciate that such computer readable instructions may be written in a variety of programming languages for use with many computer architectures or operating systems. In addition, such instructions may be stored using any current or future memory technology (including but not limited to semiconductor, magnetic, or optical technology), or transmitted using any current or future communication technology (including but not limited to optical, infrared, or microwave technology). It is contemplated that such computer program products may be distributed as removable media with accompanying printed or electronic documentation (e.g., shrink-wrapped software), may be preloaded with a computer system, such as on a system ROM or fixed disk, or may be distributed via a network (e.g., the Internet or the World Wide Web) from a server or electronic bulletin board.
[0134] Embodiments of the present invention will now be described, by way of example only, with reference to the accompanying drawings, in which:
[0135] Figure 1 An exemplary graphics processing system is shown;
[0136] Figure 2 is a schematic diagram showing the "full" ray tracing process;
[0137] Figure 3A and Figure 3B An exemplary ray tracing acceleration data structure is shown;
[0138] Figure 4A and Figure 4B is a flow chart illustrating an embodiment of a full ray tracing process;
[0139] Figure 5 is a schematic diagram illustrating a "hybrid" ray tracing process;
[0140] Figure 6 Schematically illustrates an embodiment of a graphics processor capable of operating in the manner of the present invention;
[0141] Figure 7 schematically showing in more detail the elements of a graphics processor capable of operating in the manner of the present invention;
[0142] Fig. 8A and Figure 8B schematically illustrates a stack layout that may be used to manage ray tracing traversal operations in an embodiment of the present invention;
[0143] Fig. 9 is a flow chart illustrating an embodiment of a ray tracing traversal operation;
[0144] Fig.10 is a schematic diagram showing a storage layout according to an embodiment of the present invention; and
[0145] Fig.11 is a flow chart illustrating a storage allocation process according to an embodiment of the present invention.
[0146] This embodiment relates to the operation of a graphics processor, such as in Figure 1 In the graphics processing system shown, when a ray tracing-based rendering process is used to perform rendering of a scene to be displayed.
[0147] Ray tracing is a rendering process that involves tracing the paths of rays from a viewpoint (sometimes called a "camera") through sample locations in an image plane (which is the frame being rendered) into a scene, and simulating the effects of interactions between those rays and objects in the scene. Output data values (e.g., the color of a sample location in an image) are determined based on the objects in the scene that are intersected by the ray that passes through the sample location, and the properties of the surfaces of those objects. Thus, the ray tracing process involves determining, for each sample location, a set of objects within the scene that are intersected by the ray that passes through the sample location.
[0148] Figure 2 An exemplary "full" ray tracing process is shown. A ray 20 (the "primary ray") is cast backwards from a viewpoint 21 (e.g., a camera position) through a sample position 22 in an image plane (frame) 23 into the scene being rendered. A point 24 is identified at which the ray 20 first intersects an object 25 in the scene, such as a primitive (in the present embodiment, the primitive is in the form of a triangle, but other suitable geometric shapes may also be included). This first intersection will be with the object in the scene that is closest to the sample position.
[0149] A secondary ray in the form of a shadow ray 26 may be projected from the first intersection point 24 to a light source 27. Depending on the material of the surface of the object 25, another secondary ray in the form of a reflected ray 28 may be traced from the intersection point 24. If the object is at least to some extent transparent, refracted secondary rays may be considered.
[0150] Such casting of secondary rays may be used where it is desired to add shadows and reflections to an image. A secondary ray may be cast in the direction of each light source (and, depending on whether the light source is a point source, more than one secondary ray may be cast back to a point on the light source).
[0151] exist Figure 2 In the example shown, only a single bounce of the chief ray 20 is considered before tracing the reflected ray back to the light source. However, a higher number of bounces may be considered if desired.
[0152] The output data for the sampling position 22, ie its color value (eg RGB value), is then determined based on the intersection of the primary ray and any secondary raycasts with objects in the scene. The same process is performed for each sampling position to be considered in the image plane (frame) 23.
[0153] To facilitate such ray tracing processing, in an embodiment of the present invention, when determining intersection data for a ray associated with a sampling position in an image plane, an acceleration data structure indicating geometry (e.g., objects) in the scene to be rendered is used to identify a subset of geometry that is capable of intersecting the ray.
[0154] The ray tracing acceleration data structure represents and indicates the distribution of geometry (e.g., objects) in the scene being rendered, and in particular, represents and indicates the geometry that falls within corresponding (sub) boxes within the overall box of the scene (i.e., the one being considered).
[0155] In this embodiment, the ray tracing acceleration data structure is in the form of one or more hierarchical bounding box (BVH) trees. The use of BVH trees allows and facilitates testing rays against a hierarchy of bounding boxes until a leaf node is found. Then only the geometry associated with a particular leaf node needs to be tested to see if it intersects with the ray.
[0156] Figure 3A An exemplary BVH tree 30 is shown, which is constructed by enclosing a box in an axis-aligned bounding volume (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 a desired minimum subdivision (box) is reached.
[0157] In this example, BVH tree 30 is a relatively "wide" tree, in which each bounding box is subdivided into up to six child AABVs. However, in general, any other suitable tree structure may be used, and a given node of the tree may have any suitable and desired number of child nodes.
[0158] Thus, each node in the BVH tree 30 will have a corresponding box associated with it, with the terminal, leaf nodes 31 each representing a particular minimum subdivision box, and any parent node representing and being associated with the boxes of its child nodes.
[0159] The entire scene may be represented by a single BVH tree, e.g., the tree stores the geometry of the scene in world space. In this case, each leaf node of the BVH tree 30 may also be associated with a geometry defined for the scene that at least partially falls within the box corresponding to the leaf node (e.g., its centroid falls within the box under consideration). A leaf node 31 may be represented as a unique (non-overlapping) subset of primitives defined for the scene that falls within the corresponding box of the leaf node 31.
[0160] In this embodiment, a two-layer ray tracing acceleration data structure is used. Figure 3B An exemplary two-layer ray tracing acceleration data structure is shown, wherein each instance or object is associated with a corresponding underlying acceleration structure (BLAS) 300, 301, which in this embodiment is in 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 the instance or object falling within the corresponding box.
[0161] A separate top-level acceleration structure (TLAS) 302 then contains references to a set of bottom-level acceleration structures (BLAS), and a corresponding set of shading and transformation information for each bottom-level acceleration structure (BLAS). In the present embodiment, the top-level acceleration structure (TLAS) 302 is defined in world space and is in the form of a BVH tree with leaf nodes 312, each leaf node pointing to one or more bottom-level acceleration structures in the bottom-level acceleration structure (BLAS) 300, 301.
[0162] Other forms of ray tracing acceleration data structures will be possible.
[0163] Figure 4A is a flow chart showing an overall ray tracing process that may be performed on and by the graphics processor 2.
[0164] First, the geometry of the scene is analyzed and used to obtain an acceleration data structure (step 40), for example in the form of one or more BVH tree structures, as described above. This can be done in any suitable and desired manner, for example by an initial processing pass on the graphics processor 2.
[0165] A primary ray is then generated, passing from the camera through a particular sampling position (frame) in the image plane (step 41). The acceleration data structure is then traversed for the primary ray (step 42), and a leaf node corresponding to the first box passed by the ray, which contains geometry that the ray may intersect, is identified. It is then determined whether the ray intersects any geometry, such as primitives, in the leaf node (if any) (step 43).
[0166] If no (valid) geometry that intersects the ray is identified in the node, the process returns to step 42 and the ray continues to traverse the acceleration data structure and the leaf nodes of the next box through which the ray passes, which next box may contain geometry that is identified to intersect the ray, and a test for intersection is performed at step 43.
[0167] This process is repeated for each leaf node that (potentially) intersects the ray, until a geometry that intersects the ray is identified.
[0168] When a geometry that intersects the ray is identified, it is then determined whether to cast any additional (secondary) rays for the primary ray in question (and therefore the sampling position) (step 44). This may be based on (for example, and in one embodiment is based on) the nature of the geometry that the ray has been found to intersect (for example, its surface characteristics), and the complexity of the ray tracing process used.
[0169] Therefore, if Figure 4A As shown, one or more secondary rays (eg, shadow rays, refracted rays, and / or reflected rays, etc.) may be generated from the intersection point. Steps 42, 43, and 44 are then performed with respect to each secondary ray.
[0170] Once there are no additional rays to be cast, the shading color for the sample position corresponding to the ray is determined based on the casting result of the primary ray and any secondary rays considered, taking into account the surface characteristics of the object at the primary intersection point, any geometric shapes intersected by the secondary ray, etc. (step 45). The shading color for the sample position is then stored in the frame buffer (step 46).
[0171] If in step 42 no (valid) nodes can be identified that could include geometry that intersects a given ray (whether primary or secondary) (and there are no further rays to be cast for the sample position), the process moves to step 45 and shading is performed. In this case, the shading is in one embodiment based on some form of "default" shading operation that is to be performed in the event that no intersecting geometry with the ray is found. This may include, for example, simply assigning a default color to the sample position, and / or having a defined default geometry to use in the event that no actual geometry intersection is found in the scene, wherein the sample position is then shaded according to the default geometry. Other arrangements will be possible.
[0172] This process is performed for each sampling position to be considered in the image plane (frame). Once the final output value for the sampling position under consideration has been generated, processing is completed with respect to that sampling position. The next sampling position may then be processed in a similar manner, and so on, until all sampling positions of the frame are appropriately shaded. The frame may then be output, e.g., for display, and the next frame processed in a similar manner, and so on.
[0173] Figure 4B is shown in more detail in the case of a two-layer acceleration data structure (e.g., as shown in the above reference Figure 3B Flowchart of accelerating structure traversal as described in Figure 4B As shown, in this case, the acceleration structure traversal starts with a TLAS traversal (step 420), and the TLAS traversal continues to search for TLAS leaf nodes (steps 421, 422). If a TLAS leaf node cannot be identified, a "default" shading operation ("missing shader") can be performed (step 423), for example, as described above.
[0174] When a TLAS leaf node is identified (at 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).
[0175] If a TLAS leaf node cannot be selected from further processing, the instance transformation information associated with the leaf node is used to transform the ray to the appropriate space for BLAS traversal (step 425). The BLAS traversal is then started (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 the TLAS traversal (step 420).
[0176] In this embodiment, the geometry associated with a BLAS leaf node may be in the form of a set of triangle primitives or axis-aligned bounding box (AABB) primitives. When a BLAS leaf node is identified (at step 427), it is determined whether the geometry associated with the leaf node is in the form of a set of triangle primitives or axis-aligned bounding box (AABB) primitives (at step 430). Figure 4B As shown in , when an axis-aligned bounding box (AABB) primitive is encountered, execution of a shader program ("intersection shader") defining a procedural object surrounded by an axis-aligned bounding box (AABB) is triggered (step 431) to determine whether the ray intersects the procedural object defined by the shader program. On the other hand, when a set of triangle primitives is encountered, a determination of whether the ray intersects any triangle primitive is performed by the fixed function circuit system (step 432) (as will be discussed further below). Other arrangements will be possible.
[0177] If no (valid) triangle primitive can be identified in the node that the ray intersects, the process returns to the BLAS traversal (step 426). If the ray is found to intersect the triangle primitive, it is determined whether the triangle primitive is opaque (step 433). In the event that the triangle primitive is found to be non-opaque, execution of an appropriate shader program ("any hit shader") may be triggered (step 434). Otherwise, in the event that the triangle primitive is found to be opaque, intersection may be determined without executing a shader program (step 440). Traversal of one or more secondary rays may be appropriately triggered, such as described above.
[0178] Figure 5 An alternative ray tracing process that can be used in embodiments of the present invention is shown, in which only some of the steps of the full ray tracing process described above are performed. Such an alternative ray tracing process may be referred to as a "hybrid" ray tracing process.
[0179] In this process, if Figure 5 As shown, the first intersection 50 of each sampling position in the image plane (frame) is first determined using a rasterization process and stored in an intermediate data structure called a "G-buffer" 51. Therefore, the process of generating a primary ray for each sampling position and identifying the first intersection of the primary ray with a geometric shape in the scene is replaced by an initial rasterization process to generate a "G-buffer". The G-buffer includes information indicating the depth, color, normal, and surface characteristics of each first (nearest) intersection of each sampling position in the image plane (frame) (as well as any other appropriate and desired data, such as albedo, etc.).
[0180] Secondary rays (eg, shadow rays 52 to light source 53) and reflection rays 54 may then be cast starting from the first intersection point 50, and the shading for these sample locations is determined based on the characteristics of the geometry first intersected and the intersection of the secondary rays with geometry in the scene.
[0181] See also Figure 4A In such a hybrid process, the initial pass of steps 41, 42 and 43 of the full ray tracing process for the primary rays is omitted because there is no need to cast the primary rays and determine their first intersection with the geometry in the scene. Instead, the first intersection data for each sampling position is obtained from the G-buffer.
[0182] The process may then proceed to a shading stage 45 based on the first intersection point for each pixel obtained from the G-buffer or, where secondary rays emanating from the first intersection point are to be considered, these secondary rays will need to be cast in the manner described with reference to Figure 4. Thus, steps 42, 43 and 44 will be performed in the same manner as previously described for the full ray tracing process for any secondary rays.
[0183] The color determined for the sampled position will be based on the shading color determined for the sampled position to match the Figure 4A The framebuffer is written in the same manner as step 46 of , with the shading color being based on the first intersection point (as obtained from the G-buffer) and, where applicable, any secondary ray intersections with objects in the scene determined using ray tracing.
[0184] The present embodiments specifically relate to the operation of a graphics processor when performing ray tracing-based rendering, for example, as described above, and specifically to ray tracing acceleration data structure traversals performed as part of ray tracing operations.
[0185] Figure 6 Relevant elements and components of a graphics processing unit (GPU) 2, 60 of the present embodiment are schematically shown.
[0186] like Figure 6 As shown, the GPU 60 comprises one or more shader (processing) cores 61 , 62 as well as a memory management unit 63 and a L2 cache 64 operable to communicate with an off-chip memory system 68 (eg via appropriate interconnects and (dynamic) memory controllers).
[0187] Figure 6 The relevant configuration of one shader core 61 is schematically shown, but as will be appreciated by those skilled in the art, any other shader core of the graphics processor 60 will be configured in a corresponding manner.
[0188] A graphics processing unit (GPU) shader core 61, 62 is a programmable processing unit (circuitry) that performs processing operations by running a small program for each "item" in the output to be generated (such as a render target, e.g., a frame). In this regard, an "item" may be, for example, a vertex, one or more sample positions, etc. The shader core will process each "item" through one or more execution threads, which will execute the instructions of the shader program in question for the "item" in question. Typically, there will be multiple execution threads, each executing simultaneously (in parallel).
[0189] Figure 6 The main elements of the graphics processor 60 that are relevant to the operation of the present embodiment are shown. As will be appreciated by those skilled in the art, there may be Figure 6 Other components not shown in FIG. It should also be noted here that Figure 6 This is only schematic and, for example, in practice, even if the functional units shown are Figure 6 Although schematically shown as separate units, these functional units may also share important hardware circuits. It should also be understood that unless otherwise indicated, Figure 6 Each of the illustrated elements and units, etc. of the graphics processor may be implemented as required and will accordingly include, for example, appropriate circuits (processing logic), etc. for performing the necessary operations and functions.
[0190] like Figure 6 As shown, each shader core of graphics processor 60 includes a suitable programmable execution unit (execution engine) 65 operable to execute graphics shader programs for use by the execution thread in performing graphics processing operations.
[0191] The shader core 61 also includes an instruction cache 66 that stores instructions to be executed by the programmable execution unit 65 to perform graphics processing operations. Figure 6 As shown, the instructions to be executed will be obtained from the memory system 68 via the interconnect 69 and the micro TLB (translation lookaside buffer) 70.
[0192] The shader core 61 also includes an appropriate load / store unit 76 in communication with the programmable execution unit 65, which 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 data loading and storage of programs executed in the programmable execution unit). Likewise, such data will be obtained / stored by the load / store unit 76 via the interconnect 69 and the micro TLB 70.
[0193] To perform graphics processing operations, programmable execution unit 65 will execute a graphics shader program (sequence of instructions) for a corresponding execution thread (eg, corresponding to a corresponding sampling location of a frame to be rendered).
[0194] Therefore, if Figure 6 As shown, shader core 61 also includes a thread creator (generator) 72 that is operable to generate execution threads for execution by programmable execution unit 65 .
[0195] In this embodiment, a ray tracing traversal operation is performed together for a group of multiple rays, for example substantially as described in US2022 / 0392147. This allows the processing resources of the ray group to be shared.
[0196] In particular, the ray tracing traversal program is executed by a group ("warp") of multiple execution threads, where each ray in the group of multiple rays is processed by a corresponding execution thread in a group of multiple execution threads that are executing the program simultaneously. Thread creator (generator) 72 may thus generate multiple groups ("warps") of multiple execution threads, and programmable execution unit 65 may execute the shader program of the group ("warp") of multiple execution threads together, for example, in lockstep (e.g., one instruction at a time).
[0197] In the present embodiment, each group of rays includes 32 rays (and correspondingly each group ("bundle") of execution threads includes 32 threads), but other numbers are possible.
[0198] like Figure 6 As shown, the shader core 61 in this embodiment also includes a ray tracing circuit (unit) ("RTU") 74 that communicates with the programmable execution unit 65 and, in response to messages 75 received from the programmable execution unit 65, is operable to perform ray tracing acceleration data structure traversals (e.g., Figure 4A During the operation of step 42 of ), the required ray and box tests are performed on the rays processed as part of the ray tracing based rendering process.
[0199] In this embodiment, the RTU 74 is also operable to perform the required ray and primitive tests (i.e., Figure 4A The RTU 74 is also capable of communicating with the load / store unit 76 for loading the data required for such intersection testing.
[0200] In the present embodiment, the RTU 74 of the graphics processor is a (substantially) fixed-function hardware unit (circuitry) that is configured to perform the required ray-with-box intersection tests and ray-with-primitive intersection tests during the traversal of the ray tracing acceleration data structures to determine the geometry of the scene to be rendered that may (and does) intersect with the ray being used for the ray tracing operation. However, a certain amount of configurability may be provided. Other arrangements would be possible. For example, the ray-with-box and / or ray-with-primitive intersection tests may be performed by the programmable execution unit 65 (e.g., in software).
[0201] Figure 7 The communication between the RTU 74 and the shader cores 61, 62 in this embodiment is shown in more detail. Figure 7 As shown, in the present embodiment, the RTU 74 includes corresponding hardware circuits for performing a ray and box test (RT_RAY_BOX) 77 and for performing a ray and primitive test (RT-RAY-TRI) 75. Therefore, the shader cores 61, 62 include appropriate message blocks 614, 616, 624, 626 for sending messages to the corresponding ray and box test circuit 77 and ray and primitive test circuit 75 when it is desired to perform an intersection test during a traversal operation.
[0202] In the present embodiment, execution of an appropriate ray and box test instruction ("RT_RAY_BOX") included in the shader program triggers the execution unit 65 to send a message to the ray and box intersection test circuit 77 of the RTU 74 to perform the desired ray and box test. Similarly, execution of an appropriate instruction ("RT_RAY_TRI") included in the shader program triggers the execution unit to send a message to the ray and primitive intersection test circuit 75 of the RTU 74 to perform the desired ray and primitive test.
[0203] like Figure 7 As shown, these message blocks communicate with respective local storage devices 612, 622 of the shader cores 61, 62 so that the results of the intersection test can be stored locally.
[0204] In particular, in this embodiment, traversal operations are managed together for a group of multiple rays using a traversal stack maintained in local storage 612, 622. Local storage 612, 622 may include any suitable and desired type of storage, such as registers, RAM, and the like.
[0205] The traversal stack includes stack entries, each stack entry indicating a node to be visited and tested, wherein the top entry in the stack indicates the next node to be visited and tested for the ray. The top entry in the stack is popped accordingly to determine the next node to be visited and tested, and when it is determined that a new node should be visited and tested, the corresponding stack entry is pushed into the stack.
[0206] Fig. 8A 2 shows exemplary stack entries according to various embodiments. Fig. 8A As shown, in this embodiment, each stack entry includes node information 81, which includes information indicating the box associated with the node to be tested and any child nodes associated with the node. The stack entry associated with the leaf node also includes leaf information 82, which can indicate the geometry represented by the leaf node under consideration (e.g., in the case of a BLAS leaf node) or a reference to one or more other (e.g., BLAS) acceleration structures and shading and transformation information (e.g., in the case of a TLAS leaf node).
[0207] like Fig. 8A As shown in , in the present embodiment, the node information 81 comprises 32 bits and the leaf information 82 comprises 64 bits. The leaf node stack entry thus comprises 96 bits, while the internal node stack entry comprises only 32 bits. Other arrangements are possible.
[0208] Figure 8B An exemplary stack of entries to be processed by the shader cores 61, 62 is shown. Figure 8B As shown in , in this example, the stack includes six stack entries 801-806 for the BLAS node at the top of the stack, and four stack entries 807-810 for the TLAS node at the bottom of the stack.
[0209] In this embodiment, the acceleration structure traversal order is configured so that when there is a choice between visiting a leaf node or an internal node of the acceleration structure next, the leaf node is visited next. To facilitate this, Figure 8B As shown in , in this embodiment, BLAS leaf node entry 801 (when present in the stack) is maintained as the top-most BLAS stack entry, and TLAS leaf node entry 807 (when present in the stack) is maintained as the top-most TLAS stack entry. Furthermore, this means that at any one time there can be at most one BLAS leaf node stack entry and one TLAS leaf node stack entry in the stack. Therefore, and as Figure 8B As shown in , in this example, there is only one BLAS leaf node entry 801 and there is only one TLAS leaf node entry 807.
[0210] In this embodiment, each shader core's local storage 612, 622 is equipped with registers (flops) that can store two larger (e.g., 96-bit) leaf node entries for each ray it is tracing. The topmost BLAS stack entry and the topmost TLAS stack entry are then stored in these registers. This facilitates fast stack access because the top entry in the stack is accessed most frequently.
[0211] The other (less frequently accessed) entries are then stored in the L1 cache (RAM). Since each of these other entries can only be a small (eg 32 bit) internal node stack entry, this can minimize RAM requirements. Other arrangements are possible.
[0212] Fig. 9 is a flow chart illustrating the operation of the shader cores 61, 62 of the graphics processors 2, 60 when performing a ray tracing based rendering process in an embodiment of the present invention. Fig. 9 The operation is shown for a given ray, and will be performed for each ray being traced.
[0213] like Fig. 9 As shown, the process begins with the first entry being pushed onto the stack corresponding to the TLAS root node (step 901). A check is then made to determine whether tracing of the current ray is complete (step 902), and if not, the process continues with the top entry in the stack being popped off (step 903) for processing.
[0214] Since the TLAS root node should be an internal node (i.e., not a leaf node) (at step 904), it is tested for ray intersection with the box (at step 905), and for any child nodes that are determined to be intersected (at step 906), the corresponding stack entry is pushed onto the stack (at step 907). The process then returns to step 902 to determine whether tracing the current ray is complete, and if not, the process continues with the top entry in the stack being popped (step 903) for processing.
[0215] like Fig. 9 As shown, when a TLAS leaf node is reached (step 908), the light is transformed using the transformation information associated with the leaf node (step 909), and the stack entry corresponding to the BLAS root node is pushed onto the stack (step 910). The process then returns to step 902 to determine whether tracing the current light ray is complete, and if not, the process continues with the top entry in the stack being popped (step 903) for processing.
[0216] Since the BLAS root node should be an internal node (i.e., not a leaf node) (at step 904), a ray-box intersection test is performed on it (at step 905), and for any child nodes determined to be intersected (at step 906), the corresponding stack entry is pushed onto the stack (at step 907). The process then returns to step 902 to determine whether tracing the current ray is complete, and if not, the process continues with the top entry in the stack being popped (at step 903) for processing.
[0217] like Fig. 9 As shown, when a BLAS leaf node is reached (step 908), the geometry associated with the leaf node is tested for ray intersection with the primitive (step 911). The process then returns to step 902 to determine whether tracing the current ray is complete, and if not, the process continues with the top entry in the stack being popped (step 903) for processing.
[0218] A stack overflow may occur if the stack does not have enough space to accept another entry. The inventors have recognized that a ray tracing API may implicitly impose a maximum possible number of stack entries per ray. For example, in the case of Vulkan's ray tracing, the inventors have calculated a maximum possible stack depth of 102 entries per ray. Therefore, by providing sufficient local storage 612, 622 to store the maximum possible number of stack entries per ray implied by the API (e.g., 102 stack entries per ray in the case of Vulkan), the possibility of a stack overflow may be avoided.
[0219] However, the inventors have found that typical content may actually use a maximum stack depth of between 20 and 30 stack entries per ray, and so there may be a relatively large mismatch between the maximum stack depth implied by the API and the stack depth typically required in real applications.
[0220] Fig.10 2 shows a memory layout for a group (bundle) of 32 rays according to an embodiment of the present invention. Fig.10 As shown, in these embodiments, each ray in a group of 32 rays is provided with a respective "fixed" ("static") initial allocation 1001 of local storage 612, 622 that is large enough to store a maximum of 32 stack entries. Thus, each ray is initially provided with sufficient stack depth to handle typical ray tracing operations.
[0221] like Fig.10As shown, the group of rays as a whole is then provided with another allocatable area 1002 of the local storage 612, 622 that is large enough to store a maximum of 70 stack entries.
[0222] Any ray in the group that needs to store more stack entries than can be stored in its initial allocation 1001 of local storage 612, 622 may then request a dynamic allocation of the allocatable area 1002 of local storage 612, 622. In this way, it is possible for rays in the group to reach the API-implied maximum stack depth of 32+70=102 stack entries, thus avoiding the possibility of a stack overflow.
[0223] It should be understood that in this embodiment, rather than the local storage devices 612, 622 needing sufficient storage to store the maximum of 32×102=3264 stack entries per ray group implied by the API, the local storage devices 612, 622 only need sufficient storage to store (32x32)+70=1094 stack entries per ray group.
[0224] Embodiments of the present invention can accordingly minimize local storage (and therefore area) requirements while avoiding the possibility of stack overflows. Furthermore, this can usually be achieved without a significant performance penalty because each ray is initially provided with sufficient stack depth to handle typical ray tracing operations, so that dynamic allocation operations are usually only triggered rarely.
[0225] Fig.11 FIG. 2 shows a stack allocation process according to an embodiment of the present invention. Fig.11 As shown, it is determined (at step 1102) whether the next operation for a ray may require the storage of more stack entries than can be stored in the traversal stack maintained for the ray. If it is determined (at step 1102) that the next operation for the ray may require the storage of more stack entries than can be stored in the traversal stack maintained for the ray, a request for a dynamic allocation of the allocatable memory area 1002 is sent (at step 1103).
[0226] The process then waits (at step 1104) for the dynamic allocation to succeed before performing the next operation on the ray (at step 1105). The allocatable memory area 1002 thus becomes part of the memory available for storing the stack entry for the ray, so that the stack entry for the ray can then be stored in the corresponding initial allocation 1001 together with the allocatable memory area 1002.
[0227] A request for dynamic allocation may be triggered whenever the top active entry of the stack for a ray corresponds to the last (32nd) entry of the initial allocation 1001. Alternatively, a request for dynamic allocation may be triggered in response to determining that the next operation may require storage of an additional (33rd) stack entry.
[0228] For example, when the top active entry of the stack for a ray corresponds to the last (32nd) entry of the initial allocation 1001, it may be determined whether the next operation is a ray-with-primitive intersection test or a ray-with-box intersection test, and a request for dynamic allocation may be triggered in response to determining that the next operation is a ray-with-box intersection test, for example because the result of the ray-with-box intersection test may trigger a new stack entry to be pushed to the stack. On the other hand, a request for dynamic allocation may not be triggered in response to determining that the next operation is a ray-with-primitive intersection test, because the result of the ray-with-primitive intersection test may not trigger a new stack entry to be pushed to the stack.
[0229] like Fig.11 As shown, it is determined (at step 1106) whether the allocatable region 1002 allocated to the ray is no longer needed. If it is determined (at step 1106) that the allocatable region 1002 allocated to the ray is no longer needed, the allocatable region 1002 is released (at step 1107) so that it can be used for dynamic allocation again.
[0230] Whenever the top active entry of the stack for a ray returns to the last (32nd) entry of the initial allocation 1001 or another entry of the initial allocation 1001 (eg, the second to last (31st) entry), the release of the allocatable area 1002 may be triggered.
[0231] It should be understood that in an embodiment, allocatable region 1002 can store enough stack entries to enable at least one ray in a group of rays to reach the maximum stack depth implied by the API (e.g., 102 stack entries in this embodiment). This can avoid the possibility of deadlock.
[0232] In this embodiment, the allocatable region 1002 as a whole can only be allocated to one ray at a time. A ray in a group that needs additional stacks may therefore need to wait until another ray in the group has released the allocatable region 1002. However, in other embodiments, the allocatable region 1002 may be allocated in smaller blocks and / or allocated to different rays in a group. The allocatable region 1002 may be allocated, for example, in steps of 1, 2, 4, 8, 16, 32, 64, or other number of stack entries.
[0233] Although in the above embodiment, there is an initial allocation 1001 that can store 32 stack entries for each ray in a group of 32 rays, an allocatable area 1002 that can store 70 stack entries for the group, and therefore a maximum stack depth of 102 for rays, it should be understood that other numbers are possible. For example, there may be more or less than 32 rays in a group, such as 1, 2, 4, 8, 16, or 64 rays per group. Similarly, the allocatable area 1002 may be able to store more or less than 70 stack entries. Correspondingly, the maximum stack depth may be greater than or less than 102. Similarly, each ray in a group may initially be allocated more or less than the storage amount of 32 stack entries, such as 2, 4, 8, 16, or 64 stack entries.
[0234] In some embodiments, each ray in a group is not initially provided with an initial allocation, and storage for all stack entries is provided by dynamic allocations from allocatable pool 1002 .
[0235] It should be appreciated from the above that the present invention, at least in its embodiments, provides an arrangement that can reduce the storage (stack) requirements for ray tracing test record entries. In embodiments of the present invention, this is achieved at least by providing a shared allocatable storage area that can be dynamically allocated to different rays when additional storage for ray tracing test record entries is needed.
[0236] The above specific embodiments are presented for the purpose of illustration and description. It is not intended to be exhaustive or to limit the technology to the precise form disclosed. In accordance with the above teachings, many modifications and variations are possible. The embodiments are selected to best explain the principles of the present technology and its practical application, so that other technical personnel in the field can best utilize the technology in various embodiments and have various modifications suitable for the specific purposes envisioned. The scope of the present invention is intended to be defined by the appended claims.
Claims
1. A graphics processor operable to perform ray tracing, wherein the graphics processor comprises: Storage device; ray tracing circuitry operable to trace rays by performing tests to determine whether the rays intersect a geometric shape representing a scene to be rendered, wherein the ray tracing circuitry is operable to use the storage device to store test record entries for traced rays, wherein each test record entry indicates a test that may need to be performed to trace the ray; and A distribution circuit operable to: determining whether the ray tracing circuitry may require additional storage space to store test log entries to trace rays; and When it is determined that the ray tracing circuit may require additional storage space to store test log entries to trace rays: Additional storage space is allocated from the storage device for use by the ray tracing circuit to store test log entries to trace the ray.
2. The graphics processor of claim 1 , wherein the storage device comprises an initial storage area reserved for initial use by the ray tracing circuit to store test log entries to trace rays; and The distribution circuit is operable to: determining whether the ray tracing circuitry may require additional storage space to store test log entries to trace the ray by determining whether the ray tracing circuitry may need to store more test log entries to trace the ray than can be stored in the initial storage area for the ray; and When it is determined that the ray tracing circuitry may need to store more test log entries to trace the ray than can be stored in the initial storage area for the ray, it is determined that the ray tracing circuitry may need additional storage space to store test log entries to trace the ray.
3. The graphics processor of claim 2, wherein the initial storage area is capable of storing only fewer test log entries than a maximum possible number of test log entries that the ray tracing circuitry may need to store to trace rays.
4. The graphics processor according to claim 2 or 3, wherein the initial storage area is capable of storing a predetermined number of test log entries.
5. A graphics processor according to any preceding claim, wherein the ray tracing circuit is operable to trace a group of multiple rays together, and the storage device includes an allocatable storage area, which is reserved for allocation by the allocation circuit for use by the ray tracing circuit to store test record entries to trace any ray in the group of multiple rays.
6. The graphics processor of claim 5, wherein the allocation circuit is operable to allocate the allocatable storage region as a whole.
7. The graphics processor of claim 5, wherein the allocation circuitry is operable to allocate a portion of the allocatable storage area.
8. A graphics processor according to any preceding claim, wherein the allocation circuitry is operable to determine whether the ray tracing circuitry may require additional storage space to store test log entries to trace rays by: determining whether a maximum number of test log entries that can be stored for the ray are being stored; and When it is determined that a maximum number of test log entries that can be stored for the ray is being stored, it is determined that the ray tracing circuitry may require additional storage space to store the test log entries to trace the ray.
9. The graphics processor of any one of claims 1 to 7, wherein the allocation circuit is operable to determine whether the ray tracing circuit may require additional storage space to store test log entries to trace rays by: determining whether a maximum number of test log entries that can be stored for the ray are being stored; When determining that the maximum number of test log entries that can be stored for the ray is being stored: determining whether a next operation to be performed by the ray tracing circuitry to trace the ray may require storing another test log entry for the ray; and When it is determined that a next operation to be performed by the ray tracing circuitry to trace a ray may require storing another test log entry for the ray, it is determined that the ray tracing circuitry may require additional storage space to store test log entries to trace the ray.
10. The graphics processor of claim 9, wherein the allocation circuitry is operable to determine whether a next operation to be performed by the ray tracing circuitry to trace the ray may require storing another test log entry for the ray by: determining whether the next operation is a ray-box intersection test; and When it is determined that the next operation to be performed by the ray tracing circuitry to trace the ray is a ray-box intersection test, determining the next operation may require storing another test log entry for the ray.
11. A graphics processor according to any preceding claim, wherein the allocation circuit is operable to: determining whether the ray tracing circuitry needs to store fewer test log entries than can be stored for a ray to trace the ray; and When it is determined that the ray tracing circuit needs to store fewer test log entries than can be stored for a ray to trace the ray: The memory space used by the ray tracing circuit to trace the ray is deallocated.
12. A graphics processor as claimed in any preceding claim, wherein the ray tracing circuit is operable to use the storage device to store a stack of test log entries.
13. A graphics processor as claimed in claim 12, wherein the storage device comprises registers and RAM, and the ray tracing circuit is operable to use the registers to store a top entry of the stack and to use the RAM to store other entries of the stack.
14. A method of operating a graphics processor, the graphics processor being operable to perform ray tracing, wherein the graphics processor comprises: Storage device; and ray tracing circuitry operable to trace rays by performing tests to determine whether the rays intersect a geometric shape representing a scene to be rendered, wherein the ray tracing circuitry is operable to use the storage device to store test record entries for traced rays, wherein each test record entry indicates a test that may need to be performed to trace the ray; The method comprises: determining whether the ray tracing circuitry may require additional storage space to store test log entries to trace rays; as well as When it is determined that the ray tracing circuit may require additional storage space to store test log entries to trace rays: Additional storage space is allocated from the storage device for use by the ray tracing circuit to store test log entries to trace the ray.
15. The method according to claim 14, comprising: providing an initial storage area of the storage device, the initial storage area being reserved for initial use by the ray tracing circuit to store test log entries to trace rays; determining whether the ray tracing circuitry may require additional storage space to store test log entries to trace the ray by determining whether the ray tracing circuitry may need to store more test log entries to trace the ray than can be stored in the initial storage area for the ray; as well as When it is determined that the ray tracing circuitry may need to store more test log entries to trace the ray than can be stored in the initial storage area for the ray, it is determined that the ray tracing circuitry may need additional storage space to store test log entries to trace the ray.
16. The method of claim 15, wherein the initial storage area is capable of storing only fewer test log entries than a maximum possible number of test log entries that the ray tracing circuitry may need to store to trace rays.
17. The method of claim 15 or 16, wherein the initial storage area is capable of storing a predetermined number of test log entries.
18. A method according to any one of claims 14 to 17, wherein the ray tracing circuit is operable to trace a group of multiple rays together, and the method comprises: An allocatable storage area of the storage device is provided, the allocatable storage area being reserved for allocation for use by the ray tracing circuitry to store a test log entry to trace any ray of the set of multiple rays.
19. A method according to claim 18, comprising allocating the allocatable storage area as a whole.
20. The method of claim 18, comprising allocating a portion of the allocatable storage area.
21. The method of any one of claims 14 to 20, comprising determining whether the ray tracing circuit may require additional storage space to store test log entries to trace rays by: determining whether a maximum number of test log entries that can be stored for the ray are being stored; and When it is determined that a maximum number of test log entries that can be stored for the ray is being stored, it is determined that the ray tracing circuitry may require additional storage space to store the test log entries to trace the ray.
22. The method of any one of claims 14 to 20, comprising determining whether the ray tracing circuit may require additional storage space to store test log entries to trace rays by: determining whether a maximum number of test log entries that can be stored for the ray are being stored; When determining that the maximum number of test log entries that can be stored for the ray is being stored: determining whether a next operation to be performed by the ray tracing circuitry to trace the ray may require storing another test log entry for the ray; and When it is determined that a next operation to be performed by the ray tracing circuitry to trace a ray may require storing another test log entry for the ray, it is determined that the ray tracing circuitry may require additional storage space to store test log entries to trace the ray.
23. The method of claim 22, comprising determining whether a next operation to be performed by the ray tracing circuitry to trace the ray may require storing another test log entry for the ray by: determining whether the next operation is a ray-box intersection test; and When it is determined that the next operation to be performed by the ray tracing circuitry to trace the ray is a ray-box intersection test, determining the next operation may require storing another test log entry for the ray.
24. A method according to any one of claims 14 to 23, comprising: determining whether the ray tracing circuitry needs to store fewer test log entries than can be stored for a ray to trace the ray; as well as When determining that the ray tracing circuitry needs to store fewer test log entries than can be stored for a ray to trace the ray: The memory space used by the ray tracing circuit to trace the ray is deallocated.
25. A computer program comprising computer software code for performing a method according to any one of claims 14 to 24 when said program is run on data processing means.
Citation Information
Patent Citations
Graphics processing
US20220392147A1
