Processing device and processing method for ray tracing

By introducing optional parameters and necessary attribute parts into the ray tracing instructions, the ray tracing process is optimized, solving the problem of low efficiency in the prior art and achieving more efficient ray tracing processing.

CN115205437BActive Publication Date: 2026-01-06SHANGHAI BIREN TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210888011.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-25
Publication Date
2026-01-06
Estimated Expiration
2042-07-25

AI Technical Summary

Technical Problem

Existing ray tracing techniques are inefficient when dealing with complex scenes, especially when dealing with a large number of primitives and rays. Traditional ray tracing methods cannot efficiently perform intersection tests.

Method used

By introducing optional parameters and necessary attributes into the ray tracing instructions, the traversal engine determines whether to use the optional content to perform ray tracing based on these parameters, thereby accelerating the structure's ray tracing and optimizing the transmission process to improve efficiency.

Benefits of technology

It effectively reduces unnecessary information transmission during the ray tracing process, saves transmission bandwidth and cache resources, and improves the processing efficiency of ray tracing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115205437B_ABST
    Figure CN115205437B_ABST
Patent Text Reader

Abstract

The present application provides a ray tracing processing device, a processing method and a machine readable storage medium. The processing device comprises a shader and a traversal engine. The shader provides a ray tracing instruction with an optional section parameter and a necessary attribute section to the traversal engine. The traversal engine checks the optional section parameter to determine whether the ray tracing instruction is still with an optional section. When the ray tracing instruction is with an optional section, the traversal engine uses the content of the necessary attribute section and the optional section to execute the ray tracing instruction to perform ray tracing on a ray tracing acceleration structure. When the ray tracing instruction is not with an optional section, the traversal engine uses the content of the necessary attribute section to execute the ray tracing instruction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to an image processing technology, and more particularly to a ray tracing processing apparatus and method. Background Technology

[0002] Ray tracing is a technique that simulates the interaction between light and a scene. For example, ray tracing can be used in graphics rendering systems to produce 3D images. 3D images typically consist of a large number of primitives. Primitives are usually triangular, but can sometimes be other shapes, such as other polygons, lines, or points. Ray tracing identifies primitives in the scene that intersect with rays and processes these identified primitives (e.g., by executing shader procedures to process the primitives) to mimic the natural interaction between light and the scene. Intersection testing between rays and primitives in the scene involves a lot of processing. Simple ray tracing techniques can test every ray for every primitive in the scene. For scenes with millions or even tens of billions of primitives, and for applications that need to trace millions of rays, this simple ray tracing technique is inefficient. Therefore, ray tracing techniques often use acceleration structures. Ray tracing acceleration structures are able to reduce intersection testing. How to handle ray tracing is one of the many challenges in this field. Summary of the Invention

[0003] The present invention provides a ray tracing processing apparatus, a processing method, and a machine-readable storage medium for efficiently transmitting ray tracing instructions.

[0004] In an embodiment of the present invention, the processing method includes: a shader providing a ray tracing instruction with at least one optional part parameter and at least one mandatory attribute part to a traversal engine; the traversal engine checking the optional part parameter to determine whether the ray tracing instruction still has at least one optional part; when the optional part parameter indicates that the ray tracing instruction has an optional part, the traversal engine using the contents of the mandatory attribute part and the optional part to execute the ray tracing instruction to perform ray tracing on the ray tracing acceleration structure; and when the optional part parameter indicates that the ray tracing instruction does not have an optional part, the traversal engine using the contents of the mandatory attribute part to execute the ray tracing instruction.

[0005] In an embodiment of the invention, the processing apparatus includes a shader and a traversal engine. The shader provides ray tracing instructions with at least one optional parameter and at least one necessary attribute. The traversal engine is coupled to the shader to receive the ray tracing instructions. The traversal engine executes the ray tracing instructions to perform ray tracing on a ray tracing acceleration structure. The traversal engine checks the optional parameter to determine whether the ray tracing instructions also have at least one optional parameter. When the optional parameter indicates that the ray tracing instructions have optional parameters, the traversal engine executes the ray tracing instructions using the necessary attribute and the contents of the optional parameter. When the optional parameter indicates that the ray tracing instructions do not have optional parameters, the traversal engine executes the ray tracing instructions using the contents of the necessary attribute.

[0006] In an embodiment of the invention, the machine-readable storage medium is used to store non-transitory machine-readable instructions. When these non-transitory machine-readable instructions are executed by a computer, the ray tracing processing method described above can be implemented.

[0007] Based on the above, ray tracing instructions include a necessary attribute section. In some embodiments, the content of the necessary attribute section includes physical information of the target ray, such as the starting coordinates, direction, minimum ray distance, and / or maximum ray distance. Ray tracing instructions may also optionally include an optional section. Depending on the actual design, in some embodiments, the content of the optional section includes a flag field, a trail snapshot field, or other optional information fields. In some practical applications, the shader may need to send certain optional information (e.g., flag information) to the traversal engine along with the ray tracing instructions. However, in other practical applications, the ray tracing instructions sent by the shader to the traversal engine may not require flag information. Frequently sending flag information to the traversal engine when it does not require flag information wastes the transmission bandwidth between the shader and the traversal engine. Furthermore, when the shader frequently sends unnecessary optional information to the traversal engine, the unnecessary optional information will occupy the traversal engine's cache resources. By configuring optional parameters in ray tracing instructions, the ray tracing instructions transmitted between the shader and the traversal engine can be flexibly configured with optional parameters (or without optional parameters) depending on the actual application scenario. Therefore, the processing device can efficiently transmit ray tracing instructions between the shader and the traversal engine. Attached Figure Description

[0008] Figure 1 This is a schematic diagram of a circuit block of a ray tracing processing device according to an embodiment of the present invention.

[0009] Figure 2 This is a schematic flowchart of a ray tracing processing method according to an embodiment of the present invention.

[0010] Explanation of reference numerals in the attached figures

[0011] 100: Processing device

[0012] 110: Shaders

[0013] 120: Traversal Engine

[0014] TRACE: Ray Tracing Command

[0015] S210, S220, S230, S240, S250: Steps Detailed Implementation

[0016] Reference will now be made in detail to exemplary embodiments of the invention, examples of which are illustrated in the accompanying drawings. Wherever possible, the same component reference numerals are used in the drawings and description to denote the same or similar parts.

[0017] The term "coupled (or connected)" as used throughout this specification (including the claims) may refer to any direct or indirect means of connection. For example, if the text describes a first device coupled (or connected) to a second device, it should be interpreted as the first device being directly connected to the second device, or the first device being indirectly connected to the second device through other devices or some means of connection. The terms "first," "second," etc., used throughout this specification (including the claims) are used to name components, and are not intended to limit the upper or lower limit of the number of components, nor to limit the order of components. Furthermore, wherever possible, components / components / steps using the same reference numerals in the drawings and embodiments represent the same or similar parts. Components / components / steps using the same reference numerals or the same terms in different embodiments may be referred to mutually in the relevant descriptions.

[0018] Figure 1 This is a schematic diagram of a circuit block of a ray tracing processing device 100 according to an embodiment of the present invention. Figure 1The processing apparatus 100 shown includes a shader 110 and a traversal engine 120. Depending on different design requirements, in some embodiments, the shader 110 and / or the traversal engine 120 may be implemented as hardware circuitry. In other embodiments, the shader 110 and / or the traversal engine 120 may be implemented as firmware, software (i.e., a program), or a combination of both. In still other embodiments, the shader 110 and / or the traversal engine 120 may be implemented as a combination of hardware, firmware, and software.

[0019] In hardware terms, the shader 110 and / or traversal engine 120 described above can be implemented as logic circuits on an integrated circuit. For example, the functions of shader 110 and / or traversal engine 120 can be implemented as various logic blocks, modules, and circuits in one or more controllers, microcontrollers, microprocessors, application-specific integrated circuits (ASICs), digital signal processors (DSPs), field-programmable gate arrays (FPGAs), and / or other processing units. The functions of shader 110 and / or traversal engine 120 can be implemented as hardware circuits, such as various logic blocks, modules, and circuits in an integrated circuit, using hardware description languages ​​(such as Verilog HDL or VHDL) or other suitable programming languages.

[0020] In software and / or firmware form, the functions of the shader 110 and / or traversal engine 120 can be implemented as programming codes. For example, the shader 110 and / or traversal engine 120 can be implemented using common programming languages ​​(such as C, C++, or assembly language) or other suitable programming languages. The programming code can be recorded / stored in a non-transitory machine-readable storage medium. In some embodiments, the machine-readable storage medium includes, for example, semiconductor memory and / or storage devices. The semiconductor memory includes memory cards, read-only memory (ROM), flash memory, programmable logic circuits, or other semiconductor memory. The storage device includes tape, disk, hard disk drive (HDD), solid-state drive (SSD), or other storage devices. An electronic device (e.g., a computer, central processing unit (CPU), controller, microcontroller, or microprocessor) can read and execute the programming code from the machine-readable storage medium to implement the functions of shader 110 and / or traversal engine 120. Alternatively, the programming code can be provided to the electronic device via any transmission medium (e.g., a communication network or broadcast radio waves). The communication network is, for example, the Internet, a wired communication network, a wireless communication network, or other communication media.

[0021] Figure 2 This is a schematic flowchart of a ray tracing processing method according to an embodiment of the present invention. In some embodiments, Figure 2 The ray tracing processing method shown can be implemented in firmware or software (i.e., programs). For example, Figure 2 The operations related to the ray tracing processing method shown can be implemented as non-transitory machine-readable instructions (programming code or program), and these non-transitory machine-readable instructions can be stored in a machine-readable storage medium. When these non-transitory machine-readable instructions are executed by a computer, they can be implemented... Figure 2 The ray tracing processing method shown is illustrated. In other embodiments, Figure 2 The ray tracing processing method shown can be implemented in hardware, for example, in... Figure 1The processing device 100 shown.

[0022] Please refer to Figure 1 and Figure 2 In step S210, shader 110 provides ray tracing instruction TRACE with at least one optional part parameter and at least one mandatory attribute part to traversal engine 120. For example, depending on the actual operating situation, ray tracing instruction TRACE can be the following pseudo code [1] or pseudo code [2]. In the following pseudo code [1] and pseudo code [2], TRACE represents ray tracing instruction, OPP represents at least one optional part parameter of ray tracing instruction TRACE, MAP represents at least one mandatory attribute part of ray tracing instruction TRACE, and OP represents at least one optional part of ray tracing instruction TRACE. When the optional part parameter OPP represents ray tracing instruction TRACE without optional part OP, ray tracing instruction TRACE can be the following pseudo code [1]. When the optional part parameter OPP represents ray tracing instruction TRACE with optional part OP, ray tracing instruction TRACE can be the following pseudo code [2].

[0023] TRACE.OPP MAP; Pseudocode [1]

[0024] TRACE.OPP MAP OP; Pseudocode[2]

[0025] The essential attribute section MAP contains the information necessary for the traversal engine 120 to perform ray tracing. For example, the essential attribute section MAP includes the physical information of the target ray. According to the actual design, the physical information includes the starting coordinates, direction, minimum ray distance, and maximum ray distance of the target ray. For example, the following pseudocode [3] is an example of the essential attribute section MAP. Pseudocode [3] can be referred to the relevant explanation of pseudocode [1], and pseudocode [2] can be referred to the relevant explanation of pseudocode [3] and deduced by analogy. In the following pseudocode [3], org represents the starting coordinates of the target ray in the essential attribute section MAP, tmin represents the minimum ray distance of the target ray in the essential attribute section MAP (the starting point on the target ray), dir represents the direction of the target ray in the essential attribute section MAP, and tmax represents the maximum ray distance of the target ray in the essential attribute section MAP (the ending point on the target ray).

[0026] TRACE.OPP org tmin dir tmax; Pseudocode [3]

[0027] Traversal engine 120 is coupled to shader 110 to receive ray tracing instructions (TRACE). Traversal engine 120 executes the ray tracing instructions (TRACE) to perform ray tracing on the ray tracing acceleration structure. The ray tracing acceleration structure can use a bounding volume hierarchy (BVH) or a bounding box hierarchy. In the ray tracing acceleration structure, large bounding boxes surround one or more smaller bounding boxes, and each bounding box surrounds multiple primitives. Generally, the ray tracing acceleration structure is a BVH tree. Based on such a bounding volume hierarchy, intersection testing for ray tracing becomes easier. If a target ray misses a bounding box, no intersection test is needed for any child nodes (primitives) within that bounding box. Therefore, the ray tracing acceleration structure can reduce intersection testing.

[0028] Ray tracing acceleration structures include a bottom-level acceleration structure (BLAS) and a top-level acceleration structure (TLAS). Both BLAS and TLAS can be BVH trees. BLAS has leaf nodes that act as object primitives. The top level of a BLAS is a single root node. For example, a BLAS can be used to describe a model of a single object or a group of objects in a scene. TLAS describes a higher level of the scene, starting from the root node at the top level and ending at the lowest level of the BLAS. TLAS can describe multiple instances of the same BLAS. For example, a BLAS can simulate a single chair, while a TLAS can simulate a concert hall containing hundreds of chairs (instances), each instance representing a different chair in a different position and / or orientation within the concert hall. Intersection testing is performed by traversing the BVH tree (BLAS and TLAS). If a target ray "hits" a bounding box (node), the target ray needs to be tested against each child node of that bounding box (node). This continues down through the BVH tree until the target ray hits at least one primitive (leaf node), or the target ray does not hit any of the child nodes of an intersecting node.

[0029] When traversal engine 120 executes the ray tracing instruction TRACE, it can traverse the ray tracing acceleration structure (BVH tree). Based on the target ray defined by the ray tracing instruction TRACE, traversal engine 120 can start from the root node of the ray tracing acceleration structure (BVH tree) and perform ray tracing (intersection testing) on ​​the child nodes. This embodiment does not limit the details of traversal of the ray tracing acceleration structure. According to actual design, in some embodiments, traversal engine 120 can use well-known ray tracing acceleration structure traversal algorithms or other algorithms to perform ray tracing (intersection testing) on ​​the ray tracing acceleration structure (BVH tree).

[0030] The traversal engine 120 can check the optional parameter OPP in step S220 and determine whether the ray tracing instruction TRACE still has an optional parameter OP in step S230. When the optional parameter OPP indicates that the ray tracing instruction TRACE has an optional parameter OP (the determination result of step S230 is "yes"), the traversal engine 120 can use the contents of the necessary attribute section MAP and the optional parameter OP to execute the ray tracing instruction TRACE in step S240. This embodiment does not limit the specific contents of the optional parameter OPP and the optional parameter OP. When the optional parameter OPP indicates that the ray tracing instruction TRACE does not have an optional parameter OP (the determination result of step S230 is "no"), the traversal engine 120 can use the contents of the necessary attribute section MAP to execute the ray tracing instruction TRACE in step S250.

[0031] In some embodiments, the optional part OP includes a flag field, and the optional part parameter OPP includes a flag enable parameter. For example, the following pseudocode [4] and pseudocode [5] are examples of the optional part parameter OPP and the optional part OP. Pseudocode [1] can be deduced by referring to the relevant explanation of pseudocode [4], and pseudocode [2] can be deduced by referring to the relevant explanation of pseudocode [5]. The necessary attribute part MAP in pseudocode [4] and pseudocode [5] can be deduced by referring to the relevant explanation of pseudocode [3]. In the following pseudocode [4], flag0 represents the flag enable parameter in the optional part parameter OPP, which indicates that "the ray tracing instruction TRACE does not have a flag field (optional part OP)". In the following pseudocode [5], fn-f0 represents the flag field in the optional part OP, and flag1 represents the flag enable parameter in the optional part parameter OPP, which indicates that "the ray tracing instruction TRACE has the flag field fn-f0 (optional part OP)". The flag field fn-f0 represents n flags, where the number of flags n and the meaning of each individual flag can be determined according to the actual design. For example, flags f7 to f0 (bits 7 to 0) in the flag field fn-f0 can represent "instance inclusion mask", flag f8 (bit 8) in the flag field fn-f0 can represent "Opaque. All primitives are forced to be opaque", flag f9 (bit 9) in the flag field fn-f0 can represent "NonOpaque. All primitives are forced to be non-opaque", flag f10 (bit 10) in the flag field fn-f0 can be the flag TerminateOnFirstHit to represent "Terminates on the first hit", and flag f11 (bit 11) in the flag field fn-f0 can be the flag SkipClosestHitShader to represent "Skips the closest hit shader".

[0032] TRACE.flag0 MAP; Pseudocode[4]

[0033] TRACE.flag1 MAP fn-f0; Pseudocode [5]

[0034] Each flag in the flag fields fn-f0 represents a corresponding operation parameter for ray tracing. When the flag enable parameter in the optional parameter OPP is "flag1" (indicating that the ray tracing instruction TRACE includes the flag fields fn-f0), the traversal engine 120 can use the contents of the necessary attribute section MAP and at least one flag in the flag fields fn-f0 to execute the ray tracing instruction TRACE. When the flag enable parameter in the optional parameter OPP is "flag0" (indicating that the ray tracing instruction TRACE does not include the flag field fn-f0), the traversal engine 120 can use at least one default flag value to replace at least one flag in the flag fields fn-f0 to execute the ray tracing instruction TRACE. That is, when the flag enable parameter is "flag0", the traversal engine 120 can use the contents of the necessary attribute section MAP and the default flag value to execute the ray tracing instruction TRACE. The default flag value can be predefined according to the actual design.

[0035] In other embodiments, the optional part OP includes a trail snapshot field, and the optional part parameter OPP includes a trail snapshot enable parameter. For example, the following pseudocode [6] and pseudocode [7] are examples of the optional part parameter OPP and the optional part OP. Pseudocode [1] can be deduced by referring to the relevant description of pseudocode [6], and pseudocode [2] can be deduced by referring to the relevant description of pseudocode [7]. The necessary attribute part MAP in pseudocode [6] and pseudocode [7] can be deduced by referring to the relevant description of pseudocode [3]. In the following pseudocode [6], trail0 represents the trail snapshot enable parameter in the optional part parameter OPP, which means "the ray tracing instruction TRACE does not have a trail snapshot field (optional part OP)". In the following pseudocode [7], tsf represents the trail snapshot field in the optional part OP, and trail1 represents the trail snapshot enable parameter in the optional part parameter OPP, which means "the ray tracing instruction TRACE has a trail snapshot field tsf (optional part OP)".

[0036] TRACE.trail0 MAP; Pseudocode[6]

[0037] TRACE.trail1 MAP tsf; Pseudocode[7]

[0038] When the trail snapshot enable parameter trail0 of the TRACE instruction indicates that the optional part OP of the TRACE instruction does not have a trail snapshot field tsf, the traversal engine 120 starts from the root node of the ray traversal acceleration structure and performs ray traversal on the ray traversal acceleration structure. The content of the trail snapshot field tsf is a traversal trail snapshot. According to the actual design, in some embodiments, the traversal trail snapshot includes: the index of the node hit by a target ray in the ray traversal acceleration structure (BVH tree), the index of the last level corresponding to the point when ray traversal (traversal) is paused in the ray traversal acceleration structure, and / or a primitive mask. In other embodiments, the traversal trail snapshot includes: all cached content inside the traversal engine 120 at the point when ray traversal (traversal) is paused in the ray traversal acceleration structure.

[0039] When ray tracing (traversal) of a ray tracing acceleration structure based on a target ray defined by the necessary attribute part MAP is paused, the traversal engine 120 can send back a snapshot of the traversal trajectory corresponding to the point when ray tracing was paused to the shader 110. Next, the shader 110 provides a ray tracing instruction TRACE to the traversal engine 120 based on the same target ray to continue ray tracing (traversal) of the ray tracing acceleration structure based on the same target ray. That is, the shader 110 provides a ray tracing instruction TRACE (same target ray) with a trajectory snapshot enablement parameter "trail1" and a trajectory snapshot field tsf to the traversal engine 120. When the trajectory snapshot enablement parameter of the ray tracing instruction TRACE is "trail1" (indicating that the optional part OP of the ray tracing instruction TRACE has a trajectory snapshot field tsf), the traversal engine 120 can continue "ray tracing of the ray tracing acceleration structure based on the same target ray" based on the content of the traversal trajectory snapshot in the trajectory snapshot field tsf.

[0040] In some other embodiments, the optional part OP includes a flag field and a trajectory snapshot field, while the optional part parameter OPP includes a flag enable parameter and a trajectory snapshot enable parameter. For example, the following pseudocodes [8], [9],

[10] and

[11] are examples of the optional part parameter OPP and the optional part OP. Pseudocode [1] can be deduced by referring to the relevant description of pseudocode [8], and pseudocode [2] can be deduced by referring to the relevant description of pseudocode [9], pseudocode

[10] or pseudocode

[11] . The necessary attribute part MAP in pseudocodes [8] to pseudocode

[11] can be deduced by referring to the relevant description of pseudocode [3]. The flag enable parameters “flag0” and “flag1” in pseudocodes [8] to pseudocode

[11] can be deduced by referring to the relevant description of pseudocodes [4] and pseudocode [5]. The flag enable parameters “trail0” and “trail1” in pseudocodes [8] to

[11] can be found in the relevant descriptions in pseudocodes [6] and [7]. The flag fields fn-f0 in pseudocodes [9] and

[11] can be found in the relevant descriptions in pseudocode [5]. The trajectory snapshot field tsf in pseudocodes

[10] and

[11] can be found in the relevant descriptions in pseudocode [7].

[0041] TRACE.flag0.trail0 MAP; Pseudocode [8]

[0042] TRACE.flag1.trail0 MAP fn-f0; Pseudocode [9]

[0043] TRACE.flag0.trail1 MAP tsf; Pseudocode

[10]

[0044] TRACE.flag1.trail1 MAP fn-f0 tsf; Pseudocode

[11]

[0045] For example, Table 1 below shows pseudocode[8], pseudocode[9], pseudocode

[10] and pseudocode

[11] as specific examples. The component offset and number of components shown in Table 1 are specific examples. The component offset and number of components can be determined according to the actual design and / or application requirements. Input components are placed consecutively in staging registers. For example, the component offset for the minimum ray distance tmin of the target ray is 3. An input attribute can have multiple components. For example, the starting coordinate org of the target ray has 3 components. The total number of input components depends on the optional part parameters OPP, such as the flag enablement parameters “flag0”, “flag1”, “trail0” and “trail1”.

[0046] Table 1: Specific examples of the TRACE instruction

[0047]

[0048] In summary, the ray tracing instruction TRACE carries a necessary attribute section MAP. In some embodiments, the content of the necessary attribute section MAP includes the physical information of the target ray, such as the starting coordinates org, direction dir, minimum ray distance tmin, and / or maximum ray distance tmax. The ray tracing instruction TRACE may also optionally carry an optional section OP. Depending on the actual design, in some embodiments, the content of the optional section OP includes flag fields fn-f0, trajectory snapshot field tsf, and / or other optional information fields. In some practical applications, the shader 110 may need to send certain optional information (such as flag information and / or traversal trajectory snapshots) to the traversal engine 120 along with the ray tracing instruction TRACE. However, in other practical applications, the ray tracing instruction TRACE sent by the shader 110 to the traversal engine 120 may not require flag information and / or traversal trajectory snapshots. If the traversal engine 120 does not require flag information, the shader 110 frequently sends flag information to the traversal engine 120, which wastes the transmission bandwidth between the shader 110 and the traversal engine 120. Furthermore, when the shader 110 frequently sends unnecessary optional information to the traversal engine 120, this unnecessary optional information will occupy the buffer resources of the traversal engine 120. By configuring the optional parameter OPP in the ray tracing instruction TRACE, the ray tracing instruction TRACE transmitted between the shader 110 and the traversal engine 120 can flexibly include the optional parameter OPP (or not include the optional parameter OPP) according to the actual application scenario. Therefore, the processing device 100 can efficiently transmit the ray tracing instruction TRACE between the shader 110 and the traversal engine 120.

[0049] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A processing method of ray tracing, characterized by, The processing method comprises: providing, by a shader, a ray tracing instruction with at least one optional section parameter and at least one mandatory attribute section to a traversal engine, wherein the mandatory attribute section comprises physical information of a target ray; checking, by the traversal engine, the optional section parameter to determine whether the ray tracing instruction further has at least one optional section; when the optional section parameter indicates that the ray tracing instruction has the optional section, executing, by the traversal engine, the ray tracing instruction using the mandatory attribute section and content of the optional section to perform ray tracing on a ray tracing acceleration structure; and when the optional section parameter indicates that the ray tracing instruction does not have the optional section, executing, by the traversal engine, the ray tracing instruction using content of the mandatory attribute section, wherein the optional section comprises a flag field, the optional section parameter comprises a flag enable parameter, and the processing method further comprises: when the flag enable parameter indicates that the ray tracing instruction has the flag field, executing, by the traversal engine, the ray tracing instruction using content of the mandatory attribute section and at least one flag of the flag field, wherein the at least one flag is used to indicate at least one operation parameter of the ray tracing; and when the flag enable parameter indicates that the ray tracing instruction does not have the flag field, executing, by the traversal engine, the ray tracing instruction using at least one default flag value instead of the at least one flag of the flag field.

2. The treatment method according to claim 1, characterized in that, The ray tracing acceleration structure comprises a bottom layer acceleration structure and a top layer acceleration structure.

3. The treatment method of claim 1, wherein The physical information comprises a starting coordinate, a direction, a minimum ray distance and a maximum ray distance of the target ray.

4. The treatment method of claim 1, wherein The optional section comprises a trajectory snapshot field, the optional section parameter comprises a trajectory snapshot enable parameter, and the processing method further comprises: when the ray tracing on the ray tracing acceleration structure based on the target ray is paused, returning, by the traversal engine, a traversal trajectory snapshot at a time point when the ray tracing is paused to the shader; providing, by the shader, the ray tracing instruction to the traversal engine based on the target ray to continue the ray tracing on the ray tracing acceleration structure based on the target ray, wherein the trajectory snapshot enable parameter of the ray tracing instruction indicates that the optional section of the ray tracing instruction has the trajectory snapshot field, and content of the trajectory snapshot field is the traversal trajectory snapshot; and continuing, by the traversal engine, the ray tracing on the ray tracing acceleration structure based on the target ray based on the content of the traversal trajectory snapshot of the trajectory snapshot field.

5. The treatment method according to claim 4, characterized in that, The traversal trajectory snapshot comprises an index of a node hit by the target ray in the ray tracing acceleration structure, an index of a last layer corresponding to the time point when the ray tracing is paused in the ray tracing acceleration structure, and a primitive mask.

6. The treatment method of claim 1, wherein The optional section comprises a trajectory snapshot field, the optional section parameter comprises a trajectory snapshot enable parameter, and the processing method further comprises: When the trajectory snapshot parameter of the ray tracing instruction indicates that the optional section of the ray tracing instruction has the trajectory snapshot field, the traversal engine starts the ray tracing on the ray tracing acceleration structure from a root node of the ray tracing acceleration structure.

7. A processing device for ray tracing, characterized in that The processing device includes: a shader to provide a ray tracing instruction with at least one optional section parameter and at least one mandatory attribute section, wherein the mandatory attribute section includes physical information of a target ray; and a traversal engine coupled to the shader to receive the ray tracing instruction to execute the ray tracing instruction to perform ray tracing on a ray tracing acceleration structure, wherein the traversal engine checks the optional section parameter to determine whether the ray tracing instruction has at least one optional section, when the optional section parameter indicates that the ray tracing instruction has the optional section, the traversal engine uses the mandatory attribute section and contents of the optional section to execute the ray tracing instruction, and when the optional section parameter indicates that the ray tracing instruction does not have the optional section, the traversal engine uses contents of the mandatory attribute section to execute the ray tracing instruction, wherein the optional section includes a flag field, the optional section parameter includes a flag parameter, when the flag parameter indicates that the ray tracing instruction has the flag field, the traversal engine uses contents of the mandatory attribute section and at least one flag of the flag field to execute the ray tracing instruction, wherein the at least one flag is used to indicate at least one operation parameter of the ray tracing, and when the flag parameter indicates that the ray tracing instruction does not have the flag field, the traversal engine uses at least one default flag value instead of the at least one flag of the flag field to execute the ray tracing instruction.

8. The processing device of claim 7, wherein, The ray tracing acceleration structure includes a bottom-level acceleration structure and a top-level acceleration structure.

9. The processing device of claim 7, wherein, The physical information includes a starting coordinate, a direction, a minimum ray distance, and a maximum ray distance of the target ray.

10. The processing device of claim 7, wherein, The optional section includes a trajectory snapshot field, the optional section parameter includes a trajectory snapshot parameter, when the ray tracing based on a target ray on the ray tracing acceleration structure is paused, the traversal engine returns a traversal trajectory snapshot at a time point when the ray tracing is paused to the shader, the shader provides the ray tracing instruction based on the target ray to the traversal engine to continue the ray tracing based on the target ray on the ray tracing acceleration structure, the trajectory snapshot parameter of the ray tracing instruction indicates that the optional section of the ray tracing instruction has the trajectory snapshot field, contents of the trajectory snapshot field are the traversal trajectory snapshot, and the traversal engine continues the ray tracing based on the target ray on the ray tracing acceleration structure based on the contents of the traversal trajectory snapshot of the trajectory snapshot field.

11. The processing device of claim 10, wherein, The traversal trajectory snapshot includes an index of a node hit by the target ray in the ray tracing acceleration structure, an index of a last layer corresponding to the time point at which the ray tracing is suspended in the ray tracing acceleration structure, and a primitive mask.

12. A machine readable storage medium for storing non-transitory machine readable instructions which, when executed by a computer, implement the processing method of ray tracing according to any one of claims 1-6.

Citation Information

Patent Citations

  • Apparatus and method for compressing ray tracing acceleration structure build data

    US20220051466A1