A graphics processor, and ray tracing method, device and medium

By employing hardware ray tracing, and leveraging the collaborative work of the ray generation shader unit and the ray tracing core unit, the efficiency issues in graphics rendering are resolved, achieving optimization of hardware resources and flexible scene rendering effects.

CN122390956APending Publication Date: 2026-07-14RICUN TECH (SHANGHAI) CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
RICUN TECH (SHANGHAI) CO LTD
Filing Date
2026-06-12
Publication Date
2026-07-14

AI Technical Summary

Technical Problem

In existing technologies, the problems of low graphics rendering efficiency and limited scene usage are mainly due to the insufficient utilization of hardware resources caused by pure software implementation.

Method used

The hardware ray tracing method is adopted. The ray generation shader unit generates thread bundles and stores them in the suspension and resumption buffer. Combined with the buffer space judgment and intersection test shader request generation method of the ray tracing core unit, the image rendering process is performed.

Benefits of technology

It significantly improves the computational performance of hardware ray tracing, enhances the efficiency, flexibility, and comprehensiveness of scene rendering, and solves the problem of low image rendering efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122390956A_ABST
    Figure CN122390956A_ABST
Patent Text Reader

Abstract

The application discloses a graphics processor, and a ray tracing method, device and medium. The graphics processor comprises a ray generation shader unit, a ray tracing core unit, a thread grouping unit and a storage unit; the ray generation shader unit communicates with the storage unit and the ray tracing core unit; the ray generation shader unit applies for a preset size of a thread bundle suspension and recovery buffer to the storage unit before executing a ray emission instruction of a current shader; the ray generation shader unit stores a thread bundle corresponding to a scene image to be rendered and generated by the ray generation shader unit based on the ray emission instruction in the thread bundle suspension and recovery buffer; and the ray tracing core unit communicates with the thread grouping unit and sends address information of the thread bundle to the thread grouping unit. The technical scheme of the embodiment of the application can rely on a hardware architecture to realize ray tracing operation and improve the efficiency of hardware ray tracing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of ray tracing technology, and more particularly to a graphics processor, as well as a ray tracing method, apparatus and medium. Background Technology

[0002] Ray tracing is a graphics rendering technique that simulates the behavior of light rays. It renders images based on the intersections of light rays with objects in the scene, producing more vivid and realistic results compared to traditional rasterization. Specifically, it works as follows: First, a top-down BVH (Bounding Volume Hierarchy) tree structure is constructed based on the scene. Second, a ray is emitted from each pixel on the screen as a target. The ray intersects with objects in the scene (i.e., traversing the nodes in the BVH structure). During this traversal, different types of shaders may be executed to perform rendering operations depending on the properties of the primitives.

[0003] In their actual research, the inventors discovered the following shortcomings in the existing technology: Existing graphics processing technology generally uses software to implement ray tracing and graphics rendering. This purely software-based approach leads to problems such as low graphics rendering efficiency and limited scene usage. Summary of the Invention

[0004] This invention provides a graphics processor, as well as a ray tracing method, apparatus, and medium to improve the efficiency of hardware ray tracing.

[0005] According to one aspect of the present invention, a graphics processor is provided, wherein the graphics processor includes a ray generation shader unit, a ray tracing core unit, a thread grouping unit, and a storage unit; The ray generation shader unit communicates with the storage unit and the ray tracing core unit; the ray generation shader unit is used to request a thread bundle suspension and resumption buffer of a preset size from the storage unit before the ray emission command of the current shader is executed; The ray generation shader unit is used to store the current thread bundle corresponding to the scene image to be rendered, which is generated by the ray generation shader unit based on the ray emission command, in the current thread bundle suspension and resumption buffer. The ray tracing core unit communicates with the thread grouping unit and sends the received address information of the current thread bundle to the thread grouping unit.

[0006] According to another aspect of the present invention, a ray tracing method is provided, comprising: Obtain the scene image to be rendered, instruct the ray generation shader unit to generate the current thread bundle, and store the current thread bundle in the current thread bundle suspension and resumption buffer obtained from the storage unit; The hardware architecture ray tracing system includes a ray generation shader unit, a ray tracing core unit, a thread grouping unit, and a storage unit. The ray generation shader unit is instructed to request current ray buffer space quota from the ray tracing core unit. If the space quota meets the requirements, the current thread bundle is sent to the ray tracing core unit. By using a preset intersection test shader request generation method, the ray tracing subunit in the ray tracing core unit is instructed to process the scene image to be rendered using the current thread bundle to obtain the current ray information and primitive description information; Based on the current ray information and primitive description information, the thread grouping unit and the ray generation shader unit are instructed to process the target scene rendering result corresponding to the scene image to be rendered through a preset shader request.

[0007] According to another aspect of the present invention, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the ray tracing method according to any embodiment of the present invention.

[0008] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the ray tracing method according to any embodiment of the present invention.

[0009] The technical solution of this invention generates the current thread bundle through the ray generation shader unit and stores it in a pre-allocated current thread bundle suspension and resumption buffer. Combined with the judgment of requesting ray buffer space quota from the ray tracing core unit and the operation of image rendering processing and shader request processing using the intersection test shader request generation method, it solves the problems of low image rendering efficiency and limited scene use caused by performing ray tracing and graphics rendering in pure software. It can realize ray tracing operation based on hardware architecture, significantly improve the computing performance of hardware ray tracing, and also greatly improve the efficiency, flexibility and comprehensiveness of scene rendering.

[0010] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0011] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0012] Figure 1 This is a schematic diagram of the structure of a graphics processor according to Embodiment 1 of the present invention; Figure 2 This is a flowchart of a ray tracing method provided according to Embodiment 2 of the present invention; Figure 3 This is a detailed flowchart of a ray tracing method provided according to Embodiment 3 of the present invention; Figure 4 This is a schematic diagram of the structure of a ray tracing device according to Embodiment 4 of the present invention; Figure 5 This is a schematic diagram of the structure of an electronic device provided in Embodiment 5 of the present invention. Detailed Implementation

[0013] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0014] It should be noted that the terms "target," "current," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0015] It is worth noting that the information collected in the technical solution of this application is information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data all comply with the relevant laws, regulations and standards of the relevant countries and regions, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entry points for users to choose to authorize or refuse; if the user chooses to refuse, the process will proceed to the expert decision-making process.

[0016] Example 1 Figure 1 This is a schematic diagram of a graphics processor according to Embodiment 1 of the present invention. The graphics processor 100 includes a ray generation shader unit 110, a ray tracing core unit 120, a thread grouping unit 130, and a storage unit 140.

[0017] The ray generation shader unit 110 communicates with the storage unit 140 and the ray tracing core unit 120. The ray generation shader unit 110 is used to request a thread bundle suspension and resumption buffer of a preset size from the storage unit 140 before the ray emission command of the current shader is executed. The ray generation shader unit 110 is used to store the current thread bundle corresponding to the scene image to be rendered, which is generated by the ray generation shader unit 110 based on the ray emission command, in the current thread bundle suspension and resumption buffer. The ray tracing core unit 120 communicates with the thread grouping unit 130 and sends the received address information of the current thread bundle to the thread grouping unit 130.

[0018] The ray generation shader unit 110 can generate a thread bundle composed of ray information, and the thread bundle corresponds to the current thread bundle description information; the current thread bundle includes at least one ray, and each ray corresponds to a ray payload information.

[0019] The current thread bundle suspension and resumption buffer can be used to manage the suspension and resumption status of thread bundles and store thread bundle description information and the ray payload information corresponding to each ray.

[0020] Among them, the ray tracing core unit 120 can correspond to a ray tracing subunit. The ray tracing subunit (RTU) can refer to a hardware module in the graphics processor chip that is specifically responsible for performing specific tasks such as finding the intersection of rays and triangles and BVH traversal.

[0021] The thread grouping unit 130 communicates with the ray tracing core unit 120 to receive the address information of the current thread bundle sent by the ray tracing core unit 120.

[0022] Optionally, the ray generation shader unit 110 is specifically used to: receive a pointer to the target ray suspension and resumption buffer from the storage unit 140; after the ray emission command of the current shader is executed, store the current ray description information and the payload information of each ray in the current ray suspension and resumption buffer according to the target ray suspension and resumption buffer pointer; wherein, the storage unit 140 sets the ray suspension and resumption start mechanism.

[0023] Optionally, the ray tracing core unit 120 includes a ray buffer; the ray generation shader unit 120 further includes: the ray generation shader unit 110 requests current ray buffer space quota from the ray tracing sub-unit corresponding to the ray tracing core unit 120; when the ray generation shader unit 110 confirms that the current thread bundle enters the ray tracing sub-unit, it stores the context information corresponding to the current thread bundle in the current thread bundle suspension and resumption buffer in the storage unit 140, sets the current thread bundle to suspension, and enters a sleep state.

[0024] In this embodiment, the storage unit 140 is configured with a thread beam suspension and resumption mechanism. For the ray generation shader unit 110, if it can be confirmed that the current thread beam has entered the ray tracing subunit, the context information corresponding to the current thread beam can be stored in the current thread beam suspension and resumption buffer in the storage unit 140. After storage is completed, the current thread beam needs to be suspended and set to a sleep state.

[0025] Optionally, the ray buffer includes at least one ray buffer slot, with one ray occupying one ray buffer slot. Specifically, the thread grouping unit 130 is used to store the target shader table address calculated based on the current ray information and primitive description information, combined with the shader type result; the thread grouping unit 130 requests a ray buffer slot and stores ray information with the same target shader table address in the same slot of the thread grouping unit 130, and records the ray number; wherein, if it is determined that the thread grouping unit 130 does not have a free ray buffer slot, or the residence time in the ray buffer slot reaches a preset residence time threshold, or the number of rays reaches a preset ray number threshold, then the thread grouping unit 130 sends a thread bundle resumption start request to the ray generation shader unit 110; the thread grouping unit 130 is also used to send the target shader table address, the target ray buffer slot, and the target thread bundle suspension and resumption buffer pointer to the ray generation shader unit 110.

[0026] In this embodiment, the storage unit 140 is configured with a thread bundle suspension and resumption mechanism. If monitoring determines that the thread grouping unit 130 has no free ray buffer slots, or that the dwell time in the ray buffer slots reaches a preset dwell time threshold, or that the number of rays reaches a preset ray number threshold, then it can be determined that the thread bundle needs to be resent. Therefore, the thread grouping unit 130 needs to send a thread bundle resumption request to the ray generation shader unit 110.

[0027] Optionally, this includes: the thread grouping unit 130 configuring a thread grouping shader; the thread grouping shader is used to calculate the correlation of primitive description information of the same slot and place rays with high correlation into a thread bundle.

[0028] Among them, the thread grouping shader can be a shader that performs correlation calculations based on primitive description information.

[0029] In the technical solution of this invention embodiment, by enabling the thread group shader to calculate and sort the correlation of primitive description information in the same slot, and placing rays with high correlation in a thread bundle, the correlation of newly generated derived rays can be improved.

[0030] Additionally, the graphics processor includes an intermediate ray data buffer, which is a hardware cache that can be used to receive the target shader table address, target ray buffer slot, or target thread bundle suspension and resumption buffer pointer sent by the ray generation shader unit.

[0031] The technical solution of this invention generates the current thread bundle through the ray generation shader unit and stores it in a pre-allocated current thread bundle suspension and resumption buffer. Combined with the judgment of requesting ray buffer space quota from the ray tracing core unit, and the use of the intersection test shader request generation method for image rendering and shader request processing, this solves the problems of low image rendering efficiency and limited scene use caused by performing ray tracing and graphics rendering in pure software. This technical solution can flexibly meet the effects of different hardware scenarios, help improve the efficiency of hardware ray tracing, and also improve the efficiency, flexibility and comprehensiveness of scene rendering.

[0032] Example 2 Figure 2 The flowchart of a ray tracing method is provided for Embodiment 2 of the present invention. This embodiment is applicable to hardware architecture based on graphics processors, and to rendering different scenes through ray tracing. The method can be executed by a ray tracing device, which can be implemented in hardware and / or software.

[0033] Correspondingly, such as Figure 2 As shown, the method includes: S210. Obtain the scene image to be rendered, instruct the ray generation shader unit to generate the current thread bundle, and store the current thread bundle in the current thread bundle suspension and resumption buffer obtained from the storage unit.

[0034] The ray generation shader unit can generate a ray bundle composed of ray information, and the ray bundle corresponds to the corresponding current ray bundle description information. The current ray bundle includes at least one ray, and each ray corresponds to a ray payload information. The current ray bundle description information may include the ray's starting point, direction, minimum intersection distance, maximum intersection distance, and shader table information.

[0035] The current thread bundle suspension and resumption buffer can be used to manage the suspension and resumption status of thread bundles and store thread bundle description information and the ray payload information corresponding to each ray.

[0036] In this embodiment, ray tracing based on the graphics processor hardware architecture may further include an intermediate ray data buffer (ILD buffer), which is a hardware cache that can receive the target shader table address, target ray buffer slot, or target thread bundle suspension and resumption buffer pointer sent by the ray generation shader unit. Specifically, it may include a ray generation shader unit, a ray tracing core unit, a thread grouping unit, a storage unit, and an intermediate ray data buffer. The storage unit may allocate a thread bundle suspension and resumption buffer to store thread bundle description information and the payload information of each ray.

[0037] Optionally, the current thread bundle corresponds to corresponding current thread bundle description information; the current thread bundle includes at least one ray, and each ray corresponds to a corresponding ray payload information; storing the current thread bundle in the thread bundle suspension and resumption buffer obtained from the storage unit includes: requesting the current thread bundle suspension and resumption buffer from the storage unit; after confirming that the request is completed, storing the current thread bundle description information and the payload information of each ray in the current thread bundle suspension and resumption buffer to realize the suspension and resumption operation of the thread bundle; receiving the storage address of the current thread bundle suspension and resumption buffer and the storage address of the ray payload information returned by the storage unit.

[0038] In this embodiment, the compiler allocates a space in the memory unit, namely the warp suspend and resume buffer (wsrb). After confirming that the allocation is complete, the current warp description information (i.e., the warp description information) and the payload information of each ray are stored in the allocated wsrb. This setting enables convenient warp suspend and resume operations.

[0039] After this, the memory can feed back the corresponding current WSRB storage address and ray payload information storage address to the ray generation shader (RGS) unit.

[0040] The technical solution of this invention uses a thread bundle suspension and resumption buffer allocated in the storage unit to store the current thread bundle description information and the effective load information of each ray. The suspension and resumption of the thread bundle are realized based on the thread bundle suspension and resumption buffer. This can efficiently manage the state of the thread bundle and effectively and accurately store various related information of the thread bundle.

[0041] S220: Instruct the ray generation shader unit to request the current ray buffer space quota from the ray tracing core unit. If the space quota meets the requirements, send the current thread bundle to the ray tracing core unit.

[0042] Optionally, instructing the ray generation shader unit to request current ray buffer space quota from the ray tracing core unit, and if the space quota meets the requirements, sending the current ray bundle to the ray tracing core unit, includes: instructing the ray generation shader unit to request current ray buffer space quota from the ray tracing subunit corresponding to the ray tracing core unit; if the current ray buffer space quota meets the requirements, sending the current ray bundle description information, ray payload information, current ray bundle suspension and resumption buffer storage address, and ray payload information storage address to the ray tracing subunit; wherein, the current ray buffer includes at least one ray buffer slot, and one ray occupies one ray buffer slot; when it is confirmed that the current ray bundle enters the ray tracing subunit, instructing the ray generation shader unit to store the context information corresponding to the current ray bundle in the current ray bundle suspension and resumption buffer in the storage unit, and instructing the current ray bundle to enter a sleep state.

[0043] In this embodiment, RGS is instructed to request the current ray buffer credit from RTU. If the ray buffer has enough space, the ray information in the warp (i.e., the ray's starting point, direction, minimum intersection distance, maximum intersection distance, and shader table information), as well as the current WSRB storage address and the ray payload information storage address, are sent to RTU.

[0044] The WSRB is shared by all rays in this warp, while the ray payload information is unique to each ray. The RTU stores this information in its internal ray buffer. The ray buffer can be configured to contain 1024 or 2048 ray buffer slots, with each ray occupying one slot.

[0045] Furthermore, once the current warp is confirmed to have entered the RTU, the ray generation shader unit RGS is instructed to store the context information corresponding to the current warp in the current warp suspension and resumption buffer (wsrb) in the storage unit, and the current warp is instructed to enter a sleep state, i.e., the warp is in a suspended state. By setting the warp to a suspended state, the buffer in the storage unit can be effectively avoided from being in a constantly active state, thus reducing the waste of hardware resources.

[0046] In the above optional implementation, the ray generation shader unit requests the current ray buffer space quota from the ray tracing core unit, determines whether the space quota meets the requirements, and then performs the operation of sending the current thread bundle to the ray tracing subunit. This allows for accurate and efficient storage of thread bundle-related information based on the space quota, reducing data storage anomalies caused by insufficient space quota. In addition, by setting a sleep state for the current thread bundle, the utilization rate of hardware computing resources in the graphics processor can be improved.

[0047] S230. Using a preset intersection test shader request generation method, instruct the ray tracing subunit in the ray tracing core unit to process the scene image to be rendered using the current thread bundle to obtain the current ray information and primitive description information.

[0048] The intersection test shader request generation method can be a method that determines the current ray information and primitive description information through intersection testing within the RTU, and then initiates the corresponding shader request.

[0049] Optionally, the step of instructing the ray tracing subunit in the ray tracing core unit to process the scene image to be rendered using the current thread bundle through a preset intersection test shader request generation method to obtain current ray information and primitive description information includes: processing the scene image to be rendered to obtain a current level bounding box; the current level bounding box is a tree structure including at least one node; instructing the ray tracing subunit to perform a top-down intersection test with the current level bounding box using the rays in the current thread bundle; and obtaining the current ray information and primitive description information based on the shader type result of the intersection test through the intersection test shader request generation method; wherein, the shader type result includes at least one of the following: if it is determined that the scene image node object corresponding to the target ray is not a triangle, then it is determined to be an intersection shader type, and the target ray information and procedural expression object information are... The target ray is sent to the thread grouping unit. If the scene image node object corresponding to the target ray is determined to be a transparent object, it is determined to be an arbitrary hit shader type, and the target ray information and transparent node primitive information are sent to the thread grouping unit. If all current level bounding boxes are traversed and there is a ray that intersects with a scene image node object, the scene image node object with the smallest distance from the ray is selected and determined to be the most recently clicked shader type, and the target ray information and the most recently clicked node primitive information are sent to the thread grouping unit. If all current level bounding boxes are traversed and there is no ray that intersects with a scene image node object, it is determined to be a missed shader type, and the ray information and the missed shader number information are sent to the thread grouping unit. The primitive description information includes at least one of the following: procedural expression object information, transparent node primitive information, most recently clicked node primitive information, and missed shader number information.

[0050] In this embodiment, the rays inside the RTU begin to perform top-down intersection tests with the nodes in the BVH (the width of the BVH structure tree can be set to 4, 6, or 8) corresponding to the scene image to be rendered. Specifically, this can include a ray-box test or a ray-triangle test; that is, a ray-bounding box intersection test or a ray-triangle intersection test.

[0051] The intersection test shader request generation method obtains current ray information and primitive description information based on the shader type results of the intersection test. The shader type results can include the intersection shader type (IS), any hit shader type (AHS), closest hit shader type (CHS), and miss shader type (MS).

[0052] Specifically, since the RTU can only perform calculations with fixed algorithms such as ray-box tests or ray-triangle tests, if the scene image node object corresponding to the target ray is determined to be non-triangular, i.e., a procedure, it can be identified as IS. Ray tracing will then send the target ray information and procedure information to the thread binning unit (TBU) and the shader unit. If the scene image node object corresponding to the target ray is determined to be transparent, special processing is required, so it can be identified as AHS. The target ray information and the transparent node primitive information are sent to the TBU and the shader unit. If the entire current BVH structure is traversed and there is an intersection between a ray and a scene image node object, the scene image node object with the smallest distance from the ray is selected and identified as CHS. The target ray information and the nearest node primitive information are then sent to the TBU and the shader unit. If the entire structure of the current BVH is traversed and no ray intersects with any scene image node object, it is determined to be MS, and the ray information and the missing shader number information are sent to TBU and shader unit.

[0053] In the technical solution of this invention embodiment, by using the intersection test shader request generation method to process the scene image to be rendered, and then determining the current ray information and primitive description information through the shader type results of different intersection tests, the ray information and primitive description information corresponding to different shader type results can be accurately determined in multiple dimensions, providing a data foundation for the rendering of the scene image.

[0054] Additionally, the number of thread grouping units can be set to half that of the ray tracing subunits. Although multiple parallel RTUs are processing rays in the hardware, the ray results they produce are not independent; they will all send the data to the same TBU. The TBU can group rays from different RTUs that have similar destinations or types together. According to preset settings, rays from different RTUs can be sent to the same TBU for more efficient packet aggregation.

[0055] S240. Based on the current ray information and primitive description information, instruct the thread grouping unit and the ray generation shader unit to process the target scene rendering result corresponding to the scene image to be rendered through a preset shader request.

[0056] In this embodiment, the thread grouping unit calculates the target shader table address based on the received current ray information and primitive description information, and stores the regions corresponding to different types of shaders. Through shader requests, the ray generation shader unit performs corresponding rendering operations based on the results of different shader types, thereby obtaining the target scene rendering result corresponding to the scene image to be rendered.

[0057] The technical solution of this invention uses a thread bundle suspension and resumption buffer allocated in the storage unit to store the current thread bundle description information and the payload information of each ray. Furthermore, the suspension and resumption of the thread bundle are implemented based on the thread bundle suspension and resumption buffer, which can effectively manage the state of the thread bundle and store various related information of the thread bundle effectively and accurately. In addition, by requesting current ray buffer space quota from the ray generation shader unit to the ray tracing core unit and determining whether the space quota meets the requirements, the operation of sending the current thread bundle to the ray tracing subunit can be performed with the available space quota. Based on the degree of accuracy, thread bundle-related information is stored accurately and effectively, reducing data storage anomalies caused by insufficient space. By setting a sleep state for the current thread bundle, the utilization rate of hardware computing resources in the graphics processor can be improved. Furthermore, by using the intersection test shader request generation method to process the scene image to be rendered, and then using the results of different intersection test shader types to determine the current ray information and primitive description information, the ray information and primitive description information corresponding to different shader type results can be accurately determined in multiple dimensions, providing a data foundation for scene image rendering. Finally, by processing the preset shader requests, the target scene rendering result corresponding to the scene image to be rendered is obtained, improving the efficiency of hardware ray tracing, as well as the efficiency, flexibility, and comprehensiveness of scene rendering.

[0058] Example 3 Figure 3 This is a detailed flowchart of a ray tracing method provided in Embodiment 3 of the present invention. This embodiment is a refinement based on the above embodiments. In this embodiment, the step of instructing the thread grouping unit and the ray generation shader unit to process the target scene rendering result corresponding to the scene image to be rendered, based on the current ray information and primitive description information, is further refined.

[0059] S310. Obtain the scene image to be rendered, instruct the ray generation shader unit to generate the current thread bundle, and store the current thread bundle in the current thread bundle suspension and resumption buffer obtained from the storage unit.

[0060] The hardware architecture ray tracing system includes a ray generation shader unit, a ray tracing core unit, a thread grouping unit, and a storage unit.

[0061] S320: Instruct the ray generation shader unit to request the current ray buffer space quota from the ray tracing core unit. If the space quota meets the requirements, send the current thread bundle to the ray tracing core unit.

[0062] S330. Using a preset intersection test shader request generation method, instruct the ray tracing subunit in the ray tracing core unit to process the scene image to be rendered using the current thread bundle to obtain the current ray information and primitive description information.

[0063] S340. Based on the current ray information and primitive description information, instruct the thread grouping unit to calculate the target shader table address and store it in conjunction with the shader type result.

[0064] Specifically, the thread grouping unit is instructed to request a ray buffer slot, and ray information with the same target shader table address is stored in the slot of the same thread grouping unit, and the ray number is recorded.

[0065] In this embodiment, based on the current ray information and primitive description information, parameters such as the hit group record address, the starting address of the hit group table, the contribution value of the instance to the hit group index, the geometry contribution multiplier, the contribution value of the geometry to the hit group index, the contribution value of the ray to the hit group index, and the step size of the hit group table are obtained. The target shader table address is then calculated using corresponding formulas. Each target shader table address is stored in a corresponding slot in IS, AHS, CHS, or MS, depending on the shader type.

[0066] Alternatively, rays with the same shader table address can be placed in the same TBU slot, and the ray number in the current slot can be recorded.

[0067] S350, instruct the thread grouping unit to send the target shader table address, the target ray buffer slot, and the target thread bundle suspension and resumption buffer pointer to the ray generation shader unit.

[0068] If it is determined that the thread grouping unit does not have any idle ray buffer slots, or the dwell time in the ray buffer slots reaches a preset dwell time threshold, or the number of rays reaches a preset ray number threshold, then the thread grouping unit is instructed to send a thread bundle recovery start request to the ray generation shader unit.

[0069] The thread grouping unit is configured with a thread grouping shader. By enabling the thread grouping shader, the relevance of primitive description information in the same slot is calculated and sorted, and rays with high relevance are placed in a thread bundle.

[0070] In this embodiment, information such as the ray's shader table address, raybuffer slot, and thread bundle suspension and resumption buffer pointer are simultaneously sent to the RSC.

[0071] Correspondingly, when the number of rays in a TBU slot reaches 32, or there are no free TBU slots, or the dwell time in a TBU slot reaches a certain time, a warp kick-off request will be sent to RSC.

[0072] The thread binning unit configures a thread binning shader (TBS), which can control the TBS's on / off state. Specifically, the technical solution of this embodiment of the invention uses the thread binning shader to calculate and sort the relevance of primitive description information in the same slot, placing rays with high relevance into a thread bundle, which can improve the relevance of newly generated derived rays.

[0073] S360. After determining that the ray generation shader unit has received the thread beam start request, it processes the preset shader request to obtain the target scene rendering result corresponding to the scene image to be rendered.

[0074] Optionally, the step of processing the preset shader requests to obtain the target scene rendering result corresponding to the scene image to be rendered includes: using the shader request classification processing method, according to the target shader table address, the target ray buffer slot, and the target thread bundle suspension and resumption buffer pointer, to obtain the corresponding program call instruction for the shader type result; if the program call instruction is any one of the intersecting shader type or any hit shader type, then the current ray rendering result obtained from the execution is fed back to the ray tracing subunit; if the program call instruction is any one of the recently clicked shader type or the unhit shader type... After determining that the shader ray tracing operation has been completed, any one of the following steps releases the target ray buffer slot corresponding to the target ray and decrements the ray count information corresponding to the context information in the thread bundle suspension and recovery buffer for each ray by 1 until the ray count information is 0. Then, the target thread bundle suspension and recovery buffer offset address and the target general-purpose register file number are obtained from the context information. Based on the target thread bundle suspension and recovery buffer offset address and the target general-purpose register file number, the execution of the recovery shader program instruction is initiated and executed. After determining that the execution is complete, the target scene rendering result corresponding to the scene image to be rendered is obtained.

[0075] In this embodiment, after determining that the ray generation shader unit has received the thread beam start request, it will perform warp slot allocation processing and execute corresponding instructions according to the shader program corresponding to the shader table address.

[0076] Specifically, the shader request classification processing method uses the target shader table address, target ray buffer slot, and target thread bundle suspension and resumption buffer pointer to obtain the corresponding program call instruction for the shader type result. If the program call instruction is either IS or AHS, the current ray rendering result obtained after the shader processing operation is completed will be fed back to the RTU. If the program call instruction is either CHS or MS, after confirming that the shader ray tracing operation is completed, the ray count information in the wsrb buffer corresponding to each ray in the warp is decremented by 1 after each ray is executed. When the value of the ray count information decreases from 1 to 0, it proves that all rays in the warp have completed the ray tracing operation. Then, based on the resume base and resume pc information stored in the wsrb buffer, the system will jump to the place where the resume shader should be executed. Specifically, the target thread bundle suspension and resumption buffer offset address and target general-purpose register file number are obtained from the context information. Additionally, for CHS or MS, after each ray in the warp is executed, the target ray buffer slot corresponding to the target ray will be released.

[0077] Furthermore, based on the target thread bundle suspension and resumption buffer offset address and the target general-purpose register file number, the execution of the resume shader program instruction can be jumped to and executed. After the execution is completed, the target scene rendering result corresponding to the scene image to be rendered can be obtained.

[0078] This optional implementation can monitor and count the rays in the warp by monitoring the value of the ray count information, thereby enabling efficient and orderly ray tracing and improving the flexibility and reliability of the ray tracing operation.

[0079] Optionally, after the step of "if the program call instruction is either the recently clicked shader type or the unclicked shader type", the method further includes: if the program call instruction of the recently clicked shader type is executed to generate a new derived ray, the target ray buffer slot corresponding to the target ray is released, and the ray payload information corresponding to the new derived ray is stored in a new ray buffer slot obtained from the target module; until all new derived rays have completed the program call instruction of the recently clicked shader type, the shader ray tracing operation of the initial ray is determined to be completed; wherein each initial ray and at least one derived ray corresponding to the initial ray occupy 1 ray buffer slot.

[0080] In this embodiment, if the ray executing CHS generates new derived rays (such as reflected rays or shadow rays), the ray buffer slot space for this ray will be released, and the payload information of this ray will be stored in the slot of the initial ray in memory. New derived rays can request new space from the ray buffer (after a new derived ray completes its execution, the ray count will be decremented by 1). The initial ray will only truly complete its CHS execution once all new derived rays have completed their CHS execution. At this time, the warp executing CHS must also be set to a suspended state to ensure that a ray and its new derived rays can only have one thread bundle at any given time, and that the same ray will only execute one type of shader ray tracing operation at any given time.

[0081] In the technical solution of this invention embodiment, by releasing the memory of the initial ray in a timely manner at the appropriate time, it is possible to avoid the derived rays occupying unnecessary memory, save hardware resources, and thus improve the efficiency of scene rendering.

[0082] The technical solution of this invention, by instructing the thread grouping unit to send a thread bundle recovery start request to the ray generation shader unit when it is determined that there are no idle ray buffer slots in the thread grouping unit, the dwell time in the ray buffer slot reaches a preset dwell time threshold, or the number of rays reaches a preset ray number threshold, can effectively manage the start and recovery timing of the thread bundle, reduce hardware bandwidth usage, and save hardware resources. In addition, by enabling the thread grouping shader to calculate and sort the relevance of primitive description information in the same slot and placing rays with high relevance in a thread bundle, the relevance of newly generated derived rays can be improved. At the same time, by monitoring the value of ray count information, the ray tracing operation of rays in the warp can be monitored and counted, thereby enabling efficient and orderly ray tracing and improving the flexibility and reliability of ray tracing operations. Finally, by releasing the memory of the initial ray in a timely manner at the appropriate time, the derived rays can avoid occupying unnecessary memory, save hardware resources, and thus improve the efficiency of scene rendering.

[0083] Example 4 Figure 4 This is a schematic diagram of a ray tracing device according to Embodiment 4 of the present invention. The ray tracing device provided in this embodiment can be implemented by software and / or hardware, and can be configured in a terminal device or server to implement a ray tracing method according to an embodiment of the present invention. Figure 4As shown, the device includes: a current thread bundle generation and storage unit 410, a current ray buffer space quota application module 420, a current ray information and primitive description information determination module 430, and a target scene rendering result determination module 440.

[0084] The current thread bundle generation and storage unit 410 is used to acquire the scene image to be rendered, instruct the ray generation shader unit to generate the current thread bundle, and store the current thread bundle in the current thread bundle suspension and resumption buffer obtained from the storage unit. The current ray buffer space quota application module 420 is used to instruct the ray generation shader unit to apply for the current ray buffer space quota from the ray tracing core unit. If the space quota meets the requirements, the current thread bundle is sent to the ray tracing core unit. The current ray information and primitive description information determination module 430 is used to instruct the ray tracing subunit in the ray tracing core unit to process the scene image to be rendered using the current thread bundle through a preset intersection test shader request generation method, so as to obtain the current ray information and primitive description information. The target scene rendering result determination module 440 is used to instruct the thread grouping unit and the ray generation shader unit to process the target scene rendering result corresponding to the scene image to be rendered, based on the current ray information and primitive description information.

[0085] The technical solution of this invention generates the current thread bundle through the ray generation shader unit and stores it in a pre-allocated current thread bundle suspension and resumption buffer. Combined with the judgment of requesting ray buffer space quota from the ray tracing core unit and the operation of image rendering processing and shader request processing using the intersection test shader request generation method, it solves the problems of low image rendering efficiency and limited scene use caused by performing ray tracing and graphics rendering in pure software. It can realize ray tracing operation based on hardware architecture, significantly improve the computing performance of hardware ray tracing, and also greatly improve the efficiency, flexibility and comprehensiveness of scene rendering.

[0086] Based on the above embodiments, the current thread bundle corresponds to the corresponding current thread bundle description information; the current thread bundle includes at least one ray, and each ray corresponds to a corresponding ray payload information.

[0087] Based on the above embodiments, the current thread bundle generation and storage unit 410 can be specifically used to: request a current thread bundle suspension and resumption buffer from the storage unit; after confirming that the request is completed, store the current thread bundle description information and the effective load information of each ray in the current thread bundle suspension and resumption buffer to realize the suspension and resumption operation of the thread bundle; and receive the storage address of the current thread bundle suspension and resumption buffer and the storage address of the effective load information of the ray returned by the storage unit.

[0088] Based on the above embodiments, the current ray buffer space quota application module 420 can be specifically used to: instruct the ray generation shader unit to apply for current ray buffer space quota from the ray tracing subunit corresponding to the ray tracing core unit; if the current ray buffer space quota meets the requirements, then send the current thread bundle description information, each ray payload information, the current thread bundle suspension and resumption buffer storage address, and the ray payload information storage address to the ray tracing subunit; wherein, the current ray buffer includes at least one ray buffer slot, and one ray occupies one ray buffer slot; when it is confirmed that the current thread bundle enters the ray tracing subunit, instruct the ray generation shader unit to store the context information corresponding to the current thread bundle in the current thread bundle suspension and resumption buffer in the storage unit, and instruct the current thread bundle to enter a sleep state.

[0089] Based on the above embodiments, the current ray information and primitive description information determination module 430 can be specifically used to: process the scene image to be rendered to obtain the current level bounding box; the current level bounding box is a tree structure, including at least one node; instruct the ray tracing subunit to perform a top-down intersection test with the current level bounding box using the rays in the current thread bundle; obtain the current ray information and primitive description information according to the shader type result of the intersection test through the intersection test shader request generation method; wherein, the shader type result includes at least one of the following: if the scene image node object corresponding to the target ray is determined to be a non-triangular object, then it is determined to be an intersection shader type, and the target ray information and procedural expression object information are sent to the thread grouping unit; ... If an image node object is a transparent object, it is determined to be an arbitrary hit shader type, and the target ray information and transparent node primitive information are sent to the thread grouping unit. If all current level bounding boxes have been traversed and a ray intersects with a scene image node object, the scene image node object with the smallest distance from the ray is selected and determined to be the most recently clicked shader type, and the target ray information and nearest node primitive information are sent to the thread grouping unit. If all current level bounding boxes have been traversed and no ray intersects with a scene image node object, it is determined to be a missed shader type, and the ray information and missed shader number information are sent to the thread grouping unit. The primitive description information includes at least one of the following: procedural expression object information, transparent node primitive information, nearest node primitive information, and missed shader number information.

[0090] Based on the above embodiments, the target scene rendering result determination module 440 can be specifically used to: instruct the thread grouping unit to calculate the target shader table address based on the current ray information and primitive description information, and store it in conjunction with the shader type result; wherein, instructing the thread grouping unit to request a ray buffer slot, and storing ray information with the same target shader table address in the same thread grouping unit's slot, and recording the ray number; instructing the thread grouping unit to send the target shader table address, the target ray buffer slot, and the target thread bundle suspension and resumption buffer pointer to the ray generation shader unit; wherein, if the thread grouping unit determines the target ray buffer address, the target ray buffer slot, and the target thread bundle suspension and resumption buffer pointer, the thread grouping unit can determine the target scene rendering result determination module 440. If a group unit has no available ray buffer slots, or the dwell time in the ray buffer slots reaches a preset dwell time threshold, or the number of rays reaches a preset ray number threshold, then the thread grouping unit is instructed to send a thread bundle start request to the ray generation shader unit. The thread grouping unit configures a thread grouping shader, which calculates and sorts the relevance of primitive description information in the same slot by enabling the thread grouping shader, placing rays with high relevance into a thread bundle. After confirming that the ray generation shader unit has received the thread bundle start request, it processes the request according to a preset shader request to obtain the target scene rendering result corresponding to the scene image to be rendered.

[0091] Based on the above embodiments, the target scene rendering result determination module 440 can also be specifically used to: obtain the corresponding program call instruction for the shader type result according to the target shader table address, the target ray buffer slot, and the target thread bundle suspension and resumption buffer pointer through the shader request classification processing method; if the program call instruction is any one of the intersecting shader type or any hit shader type, then the current ray rendering result obtained from the execution is fed back to the ray tracing subunit; if the program call instruction is any one of the recently clicked shader type or the unhit shader type, then... After confirming the completion of the shader ray tracing operation, the target ray buffer slot corresponding to the target ray is released, and the ray count information corresponding to the context information in the thread bundle suspension and recovery buffer of each ray is decremented by 1 until the value of the ray count information is 0. Then, the target thread bundle suspension and recovery buffer offset address and the target general-purpose register file number are obtained from the context information. Based on the target thread bundle suspension and recovery buffer offset address and the target general-purpose register file number, the execution of the recovery shader program instruction is initiated and executed. After confirming the completion of the execution, the target scene rendering result corresponding to the scene image to be rendered is obtained.

[0092] Based on the above embodiments, the target scene rendering result determination module 440 can also be specifically used to: after the program call instruction is either the recently clicked shader type or the unclicked shader type, if the program call instruction of the recently clicked shader type is executed to generate a new derived ray, release the target ray buffer slot corresponding to the target ray, and store the ray payload information corresponding to the new derived ray in the new ray buffer slot obtained from the target module; until all new derived rays have completed the program call instruction of the recently clicked shader type, the shader ray tracing operation of the initial ray is determined to be completed; wherein, each initial ray and at least one derived ray corresponding to the initial ray occupy 1 ray buffer slot.

[0093] Example 5 Figure 5 A schematic diagram of an electronic device 10, which can be used to implement Embodiment 5 of the present invention, is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0094] like Figure 5 As shown, the electronic device 10 includes at least one graphics processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one graphics processor 11. The memory stores computer programs executable by the at least one graphics processor. The graphics processor 11 can perform various appropriate actions and processes based on the computer programs stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The graphics processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0095] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0096] The graphics processor 11 performs the various methods and processes described above, such as ray tracing methods.

[0097] In some embodiments, the ray tracing method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or mounted on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by graphics processor 11, one or more steps of the ray tracing method described above may be performed. Alternatively, in other embodiments, graphics processor 11 may be configured to perform the ray tracing method by any other suitable means (e.g., by means of firmware).

[0098] The method includes: acquiring a scene image to be rendered, generating a current thread bundle through a ray generation shader unit, and storing the current thread bundle in a current thread bundle suspension and resumption buffer obtained from a storage unit; the ray generation shader unit requests current ray buffer space quota from the ray tracing core unit, and if the space quota meets the requirements, sends the current thread bundle to the ray tracing core unit; through a preset intersection test shader request generation method, the ray tracing subunit in the ray tracing core unit processes the scene image to be rendered using the current thread bundle to obtain current ray information and primitive description information; based on the current ray information and primitive description information, the thread grouping unit and the ray generation shader unit process the target scene rendering result corresponding to the scene image to be rendered through a preset shader request.

[0099] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays, application-specific integrated circuits (ASICs), application-specific standard products (ASICs), systems-on-a-chip (SoCs), payload programmable logic devices, computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable graphics processor, which may be a dedicated or general-purpose programmable graphics processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0100] Computer programs used to implement the methods of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to the graphics processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the graphics processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The computer programs can be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0101] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0102] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0103] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0104] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product within the cloud computing service system. It addresses the shortcomings of traditional physical hosts and virtual private servers, such as high management difficulty and weak business scalability.

[0105] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0106] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

[0107] Example 6 Embodiment 6 of the present invention also provides a computer-readable storage medium, wherein the computer-readable instructions, when executed by a computer processor, are used to execute a ray tracing method. The method includes: acquiring a scene image to be rendered, generating a current thread bundle through a ray generation shader unit, and storing the current thread bundle in a current thread bundle suspension and resumption buffer requested from a storage unit; the ray generation shader unit requesting current ray buffer space quota from the ray tracing core unit, and if the space quota meets the requirements, sending the current thread bundle to the ray tracing core unit; using a preset intersection test shader request generation method, a ray tracing subunit in the ray tracing core unit processes the scene image to be rendered using the current thread bundle to obtain current ray information and primitive description information; based on the current ray information and primitive description information, the thread grouping unit and the ray generation shader unit process the image through a preset shader request to obtain a target scene rendering result corresponding to the scene image to be rendered.

[0108] Of course, the computer-executable instructions provided in the embodiments of the present invention, which include a computer-readable storage medium, are not limited to the method operations described above, but can also perform related operations in ray tracing provided in any embodiment of the present invention.

[0109] Based on the above description of the implementation methods, those skilled in the art can clearly understand that the present invention can be implemented using software and necessary general-purpose hardware, and of course, it can also be implemented using hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk, or optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0110] It is worth noting that in the above-described ray tracing embodiments, the various units and modules included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the scope of protection of the present invention.

[0111] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A graphics processor, characterized in that, The graphics processor includes a ray generation shader unit, a ray tracing core unit, a thread grouping unit, and a storage unit; The ray generation shader unit communicates with the storage unit and the ray tracing core unit; the ray generation shader unit is used to request a thread bundle suspension and resumption buffer of a preset size from the storage unit before the ray emission command of the current shader is executed; The ray generation shader unit is used to store the current thread bundle corresponding to the scene image to be rendered, which is generated by the ray generation shader unit based on the ray emission command, in the current thread bundle suspension and resumption buffer. The ray tracing core unit communicates with the thread grouping unit and sends the received address information of the current thread bundle to the thread grouping unit.

2. The graphics processor according to claim 1, characterized in that, The light-generating shader unit is specifically used for: Receive the pointer to the target thread bundle suspension and resumption buffer that is fed back by the storage unit; After the current shader's ray emission command is executed, the current ray description information and the payload information of each ray are stored in the current ray suspension and resumption buffer according to the target ray suspension and resumption buffer pointer; The storage unit is equipped with a mechanism for suspending and resuming thread bundles.

3. The graphics processor according to claim 2, characterized in that, The ray tracing core unit includes a ray buffer; the ray generation shader unit further includes: The ray generation shader unit requests the current ray buffer space quota from the ray tracing subunit corresponding to the ray tracing core unit; When the ray generation shader unit confirms that the current thread beam has entered the ray tracing subunit, it stores the context information corresponding to the current thread beam in the current thread beam suspension and resumption buffer in the storage unit, sets the current thread beam to suspension, and enters a sleep state.

4. The graphics processor according to claim 3, characterized in that, The light buffer includes at least one light buffer slot, with one light ray occupying one light buffer slot; it also includes: The thread grouping unit is used to store the target shader table address calculated based on the current ray information and primitive description information, combined with the shader type result. The thread grouping unit requests a ray buffer slot and stores ray information with the same target shader table address in the same thread grouping unit slot, and records the ray number; wherein, if it is determined that the thread grouping unit does not have an empty ray buffer slot, or the residence time in the ray buffer slot reaches a preset residence time threshold, or the number of rays reaches a preset ray number threshold, then the thread grouping unit sends a thread bundle recovery start request to the ray generation shader unit. The thread grouping unit is also used to send the target shader table address, the target ray buffer slot, and the target thread bundle suspension and resumption buffer pointer to the ray generation shader unit.

5. The graphics processor according to claim 4, characterized in that, Specifically, it includes: The thread grouping unit is configured with a thread grouping shader; The thread grouping shader is used to calculate the correlation of primitive description information in the same slot and place rays with high correlation into a thread bundle.

6. A ray tracing method, characterized in that, Executed by the graphics processor, including: The scene image to be rendered is obtained, and the current thread bundle is generated through the ray generation shader unit. The current thread bundle is then stored in the current thread bundle suspension and resumption buffer obtained from the storage unit. The ray generation shader unit requests the current ray buffer space quota from the ray tracing core unit. If the space quota meets the requirements, the current thread bundle is sent to the ray tracing core unit. Using a preset intersection test shader request generation method, the ray tracing subunit in the ray tracing core unit processes the scene image to be rendered using the current thread bundle to obtain current ray information and primitive description information; Based on the current ray information and primitive description information, the thread grouping unit and the ray generation shader unit process the ray generation shader request to obtain the target scene rendering result corresponding to the scene image to be rendered.

7. The method according to claim 6, characterized in that, The current thread bundle corresponds to the corresponding current thread bundle description information; the current thread bundle includes at least one ray, and each ray corresponds to a corresponding ray payload information; The step of storing the current thread bundle in the thread bundle suspension and resumption buffer obtained from the storage unit includes: Request the current thread bundle suspension and resumption buffer from the storage unit; After confirming the completion of the application, the current thread bundle description information and the effective payload information of each ray are stored in the current thread bundle suspension and resumption buffer to realize the suspension and resumption operation of the thread bundle; The storage address of the current thread bundle suspension and resumption buffer and the storage address of the optical payload information are returned by the storage unit.

8. The method according to claim 7, characterized in that, The ray generation shader unit requests current ray buffer space from the ray tracing core unit. If the space space meets the requirements, the current thread bundle is sent to the ray tracing core unit, including: The ray generation shader unit requests the current ray buffer space quota from the ray tracing subunit corresponding to the ray tracing core unit; If the current space limit of the ray buffer is sufficient, the current thread bundle description information, the payload information of each ray, the storage address of the current thread bundle suspension and resumption buffer, and the storage address of the ray payload information are sent to the ray tracing subunit. The current ray buffer includes at least one ray buffer slot, with one ray occupying one ray buffer slot; When it is confirmed that the current thread beam enters the ray tracing subunit, the ray generation shader unit stores the context information corresponding to the current thread beam in the current thread beam suspension and resumption buffer in the storage unit, and sets the current thread beam to enter a sleep state.

9. The method according to claim 8, characterized in that, The method of requesting generation via a preset intersection test shader involves the ray tracing subunit within the ray tracing core unit processing the scene image to be rendered using the current thread beam to obtain current ray information and primitive description information, including: The scene image to be rendered is processed to obtain the current level bounding box; the current level bounding box is a tree structure, including at least one node; The ray tracing subunit performs a top-down intersection test between the rays in the current thread bundle and the current level bounding box; The intersection test shader request generation method obtains the current ray information and primitive description information based on the shader type result of the intersection test. The shader type result includes at least one of the following: if the scene image node object corresponding to the target ray is determined to be a non-triangle, then it is determined to be an intersection shader type, and the target ray information and the procedural expression object information are sent to the thread grouping unit; If the scene image node object corresponding to the target ray is determined to be a transparent object, it is determined to be an arbitrary hit shader type, and the target ray information and transparent node primitive information are sent to the thread grouping unit; If all current level bounding boxes have been traversed and there is an intersection between a ray and a scene image node object, then the scene image node object with the smallest distance from the ray is selected and determined as the recently clicked shader type. The target ray information and the nearest node primitive information are then sent to the thread grouping unit. If all current level bounding boxes have been traversed and no ray intersects with scene image node objects, it is determined to be a shader miss type, and the ray information and the shader miss number information are sent to the thread grouping unit; The primitive description information includes at least one of the following: procedural expression object information, transparent node primitive information, nearest node primitive information, and unhit shader number information.

10. The method according to claim 9, characterized in that, Based on the current ray information and primitive description information, the thread grouping unit and the ray generation shader unit process the ray request through a preset shader request to obtain the target scene rendering result corresponding to the scene image to be rendered, including: Based on the current ray information and primitive description information, the thread grouping unit calculates the target shader table address and stores it in conjunction with the shader type result; The thread grouping unit allocates a ray buffer slot, stores ray information with the same target shader table address in the same thread grouping unit slot, and records the ray number. The thread grouping unit sends the target shader table address, the target ray buffer slot, and the target thread bundle suspension and resumption buffer pointer to the ray generation shader unit; If it is determined that the thread grouping unit does not have any idle ray buffer slots, or the dwell time in the ray buffer slots reaches a preset dwell time threshold, or the number of rays reaches a preset ray number threshold, then the thread grouping unit sends a thread bundle recovery start request to the ray generation shader unit. The thread grouping unit is configured with a thread grouping shader. By enabling the thread grouping shader, the relevance of the primitive description information of the same slot is calculated and sorted, and the rays with high relevance are placed in a thread bundle. After the ray generation shader unit receives the thread beam recovery start request, it processes the preset shader request to obtain the target scene rendering result corresponding to the scene image to be rendered.

11. The method according to claim 10, characterized in that, The process of processing a preset shader request to obtain a target scene rendering result corresponding to the scene image to be rendered includes: The shader request processes the target shader table address, target ray buffer slot, and target thread bundle suspension and resumption buffer pointer to obtain the corresponding program call instruction for shader type result; If the program call instruction is either the intersection shader type or the arbitrary hit shader type, the current ray rendering result obtained from the execution will be fed back to the ray tracing subunit. If the program call instruction is either the recently clicked shader type or the unhit shader type, after determining that the shader ray tracing operation has been completed, the target ray buffer slot corresponding to the target ray is released, and the ray count information corresponding to the context information in the thread bundle suspension and recovery buffer of each ray is decremented by 1 until all rays have been traversed. Then, the target thread bundle suspension and recovery buffer offset address and the target general register file number are obtained from the context information. Based on the target thread bundle suspension and resumption buffer offset address and the target general-purpose register file number, jump and execute the resume shader program call instruction, and after confirming that the execution is complete, obtain the target scene rendering result corresponding to the scene image to be rendered.

12. An electronic device comprising a memory, a graphics processor, and a computer program stored in the memory and executable on the graphics processor, characterized in that, When the graphics processor executes the computer program, it implements a ray tracing method as described in any one of claims 6-11.

13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute a ray tracing method as described in any one of claims 6-11.