Graph processing method and apparatus, electronic device, storage medium

By setting up multiple parallel graphics processing modules in the graphics processing device and using topology and initial state information for state transfer, the problem of low processing efficiency of multi-core GPU systems under complex topology is solved, achieving high-efficiency parallelism and correctness in graphics processing.

CN122597154BActive Publication Date: 2026-11-27MOORE THREADS TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202610913227.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-06-24
Publication Date
2026-11-27
Estimated Expiration
2046-06-24

AI Technical Summary

Technical Problem

Multi-core GPU systems require complex preprocessing operations when handling complex topologies, resulting in low geometry processing efficiency and an inability to guarantee the consistency of parallel processing across GPU cores, which may lead to errors such as primitive breakage or duplicate rendering.

Method used

Multiple parallel graphics processing modules are set up in the graphics processing device to form a distributed, decentralized parallel processing pipeline. After receiving the drawing command, each module obtains the vertex sequence from the vertex data stream and performs vertex shading and primitive assembly processing in parallel. The state transmission of primitive assembly is realized through topology and initial state information, eliminating the need for preprocessing operations.

Benefits of technology

Parallel processing between graphics processing modules is achieved under complex topological structures, which improves the processing efficiency of geometric tasks, reduces the complexity of preprocessing, and improves the correctness and scalability of processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122597154B_ABST
    Figure CN122597154B_ABST
Patent Text Reader

Abstract

The present disclosure provides a graphics processing method and device, electronic equipment and storage medium. The method is applied to any one of a plurality of parallel graphics processing modules of a graphics processing device. The method comprises: in the case of receiving a drawing command, obtaining a vertex sequence required to be processed by a current graphics processing module from a vertex data stream, the drawing command indicating whether there is a reset point in the vertex data stream and a topology of the vertex data stream; performing vertex shading processing and primitive assembly processing on the vertex sequence in parallel to obtain vertex shading results and primitive assembly results; in the primitive assembly processing, if there is a reset point in the vertex sequence, performing the primitive assembly processing on the vertex sequence according to the topology and first initial state information sent by a previous graphics processing module to obtain the primitive assembly results; and performing subsequent geometric processing based on the vertex shading results and the primitive assembly results. According to the embodiments of the present disclosure, the geometric processing efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of image processing technology, and in particular to a graphics processing method and apparatus, electronic device, and storage medium. Background Technology

[0002] A Graphics Processing Unit (GPU) uses a series of programmable shaders and fixed-function hardware to process 3D graphics. Multi-core GPU systems can perform geometry processing in parallel, meaning multiple GPU cores execute the same geometry task concurrently. Each GPU core independently calculates the work it needs to perform. For example, during a draw call, each GPU core calculates the portion that needs to be read from and processed in the index buffer. Based on the calculation results, each GPU core reads the corresponding vertices and processes them.

[0003] For simple topologies, each GPU core can execute these tasks independently and in parallel. For complex topologies, preprocessing of the vertex cache is required, which is more complex and leads to lower efficiency in geometry processing. Summary of the Invention

[0004] This disclosure provides a graphics processing method and apparatus, an electronic device, and a storage medium.

[0005] In a first aspect, this disclosure provides a graphics processing method applied to any one of a plurality of parallel graphics processing modules in a graphics processing device. The method includes: upon receiving a drawing command, obtaining a vertex sequence to be processed by the current graphics processing module from a vertex data stream, wherein the drawing command indicates whether a reset point exists in the vertex data stream and the topology of the vertex data stream; performing vertex shading and primitive assembly processing on the vertex sequence in parallel to obtain vertex shading results and primitive assembly results; wherein, during the process of obtaining primitive assembly results by performing primitive assembly processing on the vertex sequence, if a reset point exists in the vertex data stream, performing primitive assembly processing on the vertex sequence according to the topology and a first initial state information sent by the previous graphics processing module to obtain primitive assembly results, wherein the first initial state information is used to indicate the initial state of the current graphics processing module performing primitive assembly processing; and performing subsequent geometric processing based on the vertex shading results and primitive assembly results.

[0006] In some possible implementations, the method further includes: in the case that a reset point exists in the vertex data stream, in response to the completion of primitive assembly processing, sending second initial state information to the next graphics processing module, the second initial state information being used to indicate the initial state of primitive assembly processing in the next graphics processing module.

[0007] In some possible implementations, the drawing command also indicates the number of reset points in the vertex sequence, and the method further includes generating second initial state information based on the end index of the primitives assembled by the current graphics processing module and the number of reset points in the vertex sequence.

[0008] In some possible implementations, second initial state information is generated based on the end index of the primitives assembled by the current graphics processing module and the number of reset points in the vertex sequence. This includes: incrementing the end index of the primitives assembled by the current graphics processing module to obtain the start index of the primitives assembled by the next graphics processing module; determining the primitive orientation when the next graphics processing module performs primitive assembly processing based on the parity of the start index of the primitives assembled by the next graphics processing module; determining the starting vertex offset when the next graphics processing module performs primitive assembly processing based on the number of reset points in the vertex sequence; and determining the second initial state information based on one or more of the start index of the primitives assembled by the next graphics processing module, the primitive orientation when performing primitive assembly processing, and the starting vertex offset when performing primitive assembly processing.

[0009] In some possible implementations, the starting vertex offset is determined based on the number of reset points in the vertex sequence when the next graphics processing module performs primitive assembly processing, including: determining the starting vertex offset to be zero when the number of reset points is zero.

[0010] In some possible implementations, the starting vertex offset for primitive assembly by the next graphics processing module is determined based on the number of reset points in the vertex sequence. This includes: when the number of reset points in the vertex sequence is one, determining the number of suffix vertices based on the topology and using the number of suffix vertices as the starting vertex offset. Suffix vertices represent one or more vertices that follow and are adjacent to the vertex segment.

[0011] In some possible implementations, the starting vertex offset is determined based on the number of reset points in the vertex sequence when the next graphics processing module performs primitive assembly processing. This includes determining the starting vertex offset based on the topology when there are multiple reset points in the vertex sequence.

[0012] In some possible implementations, when there are multiple reset points in the vertex sequence, determining the starting vertex offset based on the topology includes: if there are multiple reset points in the vertex sequence and the topology is a target topology, determining the number of suffix vertices based on the target topology, and setting the number of suffix vertices as the starting vertex offset, where a suffix vertex represents one or more vertices following and adjacent to a vertex segment; if there are multiple reset points in the vertex sequence and the topology is a triangle strip with adjacency information, obtaining the number of suffix vertices used by the last primitive assembled by the current graphics processing module, and if the number of used suffix vertices is odd, then the starting vertex offset is determined by... A first value is determined as the starting vertex offset. If the number of suffix vertices used is even, a second value is determined as the starting vertex offset. When there are multiple reset points in the vertex sequence and the topology is a control packet list including Q points, the remainder obtained by dividing M by Q is determined as the starting vertex offset. Here, M represents the number of vertices between the first target point and the second target point. The first target point represents the last reset point in the vertex sequence, and the second target point represents the last vertex in the vertex sequence excluding suffix vertices. M and Q are positive integers. The target topology represents any topology other than triangle strips with adjacency information and control packet lists including Q points.

[0013] In some possible implementations, the method further includes: in the process of performing primitive assembly processing on the vertex sequence to obtain primitive assembly results, if there is no reset point in the vertex data stream, performing primitive assembly processing on the vertex sequence according to the topology to obtain primitive assembly results.

[0014] In some possible implementations, obtaining the vertex sequence that the current graphics processing module needs to process from the vertex data stream includes: determining the primitive partitioning rule of the current graphics processing module, the primitive partitioning rule being used to indicate the index of the primitives assigned to the current graphics processing module for processing; and reading the vertex sequence from the vertex data stream according to the primitive partitioning rule and the topology.

[0015] In some possible implementations, reading a vertex sequence from the vertex data stream according to primitive partitioning rules and topology includes: reading vertex fragments from the vertex data stream according to primitive partitioning rules and topology; constructing a vertex sequence based on the vertices in the vertex fragments; and, if there are reset points in the vertex sequence, reading suffix vertices according to the topology and adding the suffix vertices to the vertex sequence, where a suffix vertex represents one or more vertices that follow and are adjacent to the vertex fragment.

[0016] In some possible implementations, reading vertex fragments from the vertex data stream according to primitive partitioning rules and topology includes: determining the number of primitives that the current graphics processing module needs to skip and the number of primitives that need to be processed according to primitive partitioning rules; determining the number of vertices that the current graphics processing module needs to skip when reading vertex fragments according to the topology and the number of primitives that need to be skipped; and determining the number of vertices contained in the vertex fragments read by the current graphics processing module according to the topology and the number of primitives that need to be processed; and reading vertex fragments from the vertex data stream according to the number of vertices to be skipped and the number of vertices contained in the vertex fragments.

[0017] In some possible implementations, the drawing command contains one or more instances, each instance containing one or more primitives; reading the vertex sequence from the vertex data stream according to the primitive partitioning rules and topology also includes: in the case where the topology includes shared vertices and the first primitive of any instance is not included in the primitives that the current graphics processing module needs to process, reading the shared vertices according to the topology and adding the shared vertices to the vertex sequence, where the shared vertices represent one or more vertices that precede and are adjacent to the vertex fragment.

[0018] In some possible implementations, the primitive partitioning rules for the current graphics processing module are determined, including:

[0019] The primitive partitioning rules for the current graphics processing module are determined based on the number of enabled graphics processing modules in the graphics processing device, the number of primitives processed by each graphics processing module, and the current graphics processing module number.

[0020] In some possible implementations, the number of primitives processed by the current graphics processing module is set to K. The time for the current graphics processing module to perform vertex shading and primitive assembly processing on K primitives is a first time and a second time, respectively. The difference between the first time and the second time is greater than the information waiting time. The start time of the information waiting time is the start time of the vertex shading process, and the end time of the information waiting time is the time when the first initial state information sent by the previous graphics processing module is received.

[0021] In some possible implementations, the first initial state information includes one or more of the following: starting primitive index, primitive orientation, and starting vertex offset; wherein, the starting primitive index is used to indicate the starting index of the primitive assembled by the current graphics processing module; the primitive orientation is used to indicate the order in which the current graphics processing module assembles the primitives; and the starting vertex offset is used to indicate the position of the starting vertex in the vertex sequence when the current graphics processing module performs primitive assembly processing.

[0022] Secondly, this disclosure provides a graphics processing apparatus, including multiple parallel graphics processing modules. Each of these parallel graphics processing modules includes: a vertex data reading unit, used to obtain the vertex sequence to be processed by the current graphics processing module from the vertex data stream upon receiving a drawing command; the drawing command indicates whether a reset point exists in the vertex data stream and the topology of the vertex data stream; a vertex shading unit, used to perform vertex shading processing on the vertex sequence to obtain vertex shading results; a primitive assembly unit, operating in parallel with the vertex shading unit, used to perform primitive assembly processing on the vertex sequence to obtain primitive assembly results; wherein, during the process of performing primitive assembly processing on the vertex sequence to obtain primitive assembly results, if a reset point exists in the vertex sequence, primitive assembly processing is performed on the vertex sequence according to the topology and the first initial state information sent by the previous graphics processing module to obtain primitive assembly results; the first initial state information is used to indicate the initial state of the current graphics processing module performing primitive assembly processing; and a subsequent geometry processing unit, used to perform subsequent geometry processing based on the vertex shading results and the primitive assembly results.

[0023] Thirdly, this disclosure provides an electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores one or more computer programs executable by the at least one processor, the one or more computer programs being executed by the at least one processor to enable the at least one processor to perform the above-described graphics processing method.

[0024] Fourthly, this disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the above-described graphics processing method.

[0025] The embodiments provided in this disclosure enable the configuration of multiple parallel graphics processing modules within a graphics processing device, forming a distributed, decentralized, parallel processing pipeline. Each graphics processing module, upon receiving a drawing command, obtains the vertex sequence it needs to process from the vertex data stream. It then performs vertex shading and primitive assembly processing on the vertex sequence in parallel. During primitive assembly, if the drawing command indicates the presence of a reset point in the vertex data stream, the vertex sequence is assembled based on the topology indicated by the drawing command and the initial state information sent by the previous graphics processing module. Finally, subsequent geometric processing is performed based on the results of the vertex shading and primitive assembly. In this way, for complex topologies with reset points, parallel processing between graphics processing modules is achieved without preprocessing operations, improving the processing efficiency of geometric tasks.

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

[0027] The accompanying drawings are provided to further illustrate the present disclosure and form part of the specification. They are used together with the embodiments of the present disclosure to explain the disclosure and do not constitute a limitation thereof. The above and other features and advantages will become more apparent to those skilled in the art from the detailed example embodiments described below with reference to the accompanying drawings.

[0028] Figure 1 This is a schematic diagram of the structure of a graphics processing device provided in an embodiment of the present disclosure.

[0029] Figure 2 This is a flowchart of a graphics processing method provided in an embodiment of the present disclosure.

[0030] Figure 3 This is a block diagram of a graphics processing apparatus provided in an embodiment of the present disclosure.

[0031] Figure 4 This is a block diagram of a graphics processing apparatus provided in an embodiment of the present disclosure.

[0032] Figure 5 This is a schematic diagram of a vertex sequence provided in an embodiment of the present disclosure.

[0033] Figure 6 This is a schematic diagram of a vertex sequence provided in an embodiment of the present disclosure.

[0034] Figure 7 This is a schematic diagram of a geometric processing flow provided in an embodiment of the present disclosure.

[0035] Figure 8 This is an exemplary schematic diagram of a primitive assembly process provided in an embodiment of the present disclosure.

[0036] Figure 9 This is an exemplary schematic diagram of a primitive assembly process provided in an embodiment of the present disclosure.

[0037] Figure 10 This is a block diagram of an electronic device provided in an embodiment of the present disclosure. Detailed Implementation

[0038] To enable those skilled in the art to better understand the technical solutions of this disclosure, exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments of this disclosure to aid understanding. These should be considered merely exemplary. Therefore, those skilled in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0039] Where there is no conflict, the various embodiments of this disclosure and the features thereof in the embodiments may be combined with each other.

[0040] As used herein, the term “and / or” includes any and all combinations of one or more related enumerated entries.

[0041] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this disclosure. As used herein, the singular forms “a” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that when the terms “comprising” and / or “made of” are used in this specification, the presence of the stated feature, integral, step, operation, element, and / or component is specified, but the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or groups thereof is not excluded. Words such as “connected” or “linked” are not limited to physical or mechanical connections but can include electrical connections, whether direct or indirect.

[0042] Unless otherwise specified, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and this disclosure, and will not be interpreted as having an idealized or overly formal meaning, unless expressly so defined herein.

[0043] In 3D applications (Application Programming Interfaces, APIs), object models are represented by a set of geometric shapes. The basic geometric shapes are points, lines, and triangles, collectively called primitives. The application stores the vertex data stream of the geometry in a storage module (such as memory). The graphics processing unit (GPU) reads the vertex data stream from memory and, according to the topology set by the application, breaks it down into basic geometric shapes (i.e., primitives) such as points, lines, or triangles, processing them in the graphics pipeline to produce displayable pixel values.

[0044] The graphics pipeline, also known as the graphics processing pipeline or graphics rendering pipeline, represents the complete process of rendering an object. The object to be rendered can be a part of a virtual scene, or an image or video frame. The pipeline is generally divided into two parts: the geometry processing section (i.e., the geometry pipeline) and the pixel processing section (also known as the fragment pipeline).

[0045] The geometry processing section includes stages such as vertex input, vertex shading, primitive assembly, set shading, clipping, and screen mapping. It primarily focuses on processing and transforming geometric data. It receives input geometric primitives (such as points, lines, and triangles) and converts them into pixels on the screen after a series of processing steps. The geometry processing section is responsible for performing geometric calculations such as model transformation, view transformation, and projection transformation, as well as generating new geometric primitives and changing their shape, size, and position.

[0046] The pixel processing section includes stages such as rasterization, fragment shading, lighting calculation, texture sampling, depth testing, stencil testing, and transparency blending. This section focuses on pixel-level processing; it receives the pixels on the screen generated during the rasterization stage and processes each pixel through a series of stages to determine the final color and attributes of each pixel.

[0047] In related technologies, multi-core GPU systems can perform geometry processing in parallel, meaning that multiple GPU cores execute the same geometry processing task in parallel. Each GPU core can independently calculate the task to be executed, and each GPU core executes these tasks independently and in parallel.

[0048] While related technologies can effectively handle simple topologies, complex topologies, such as those with reset points, require preprocessing of the vertex cache, such as locating the reset points, to enable parallel processing by multiple GPU cores. Without preprocessing, GPU cores cannot obtain complete reset point information for topologies with reset points, compromising processing consistency and potentially leading to primitive breakage or duplicate rendering errors. However, this preprocessing is complex and reduces the efficiency of geometry tasks.

[0049] According to the graphics processing method of this disclosure, multiple parallel graphics processing modules can be set in a graphics processing device to form a distributed, decentralized, parallel processing pipeline. Each graphics processing module, upon receiving a drawing command, obtains the vertex sequence it needs to process from the vertex data stream, and then performs vertex shading and primitive assembly processing on the vertex sequence in parallel. In the primitive assembly processing, if the drawing command indicates the existence of a reset point in the vertex data stream, the vertex sequence is assembled according to the topology indicated by the drawing command and the initial state information sent by the previous graphics processing module. Finally, subsequent geometric processing is performed based on the results of the vertex shading and primitive assembly processing. In this way, for complex topologies with reset points, parallel processing between graphics processing modules is achieved without preprocessing operations, improving the processing efficiency of geometric tasks.

[0050] Furthermore, embodiments of this disclosure enable the graphics processing device to have better scalability and extensibility, allowing the number of graphics processing modules to be increased or decreased depending on the usage scenario, so that the system can adapt to the performance and power consumption requirements of different scenarios without making too many modifications.

[0051] The graphics processing method according to embodiments of this disclosure can be executed by an electronic device such as a terminal device or a server. The terminal device can be an in-vehicle device, user equipment (UE), mobile device, user terminal, cellular phone, cordless phone, personal digital assistant (PDA), handheld device, computing device, wearable device, etc. The method can be implemented by a processor calling computer-readable program instructions stored in memory. Alternatively, the method can be executed by a server.

[0052] In some possible implementations, the electronic device includes a graphics processing unit (e.g., a GPU), which may comprise multiple parallel graphics processing modules. Each graphics processing module can be a processing core of the GPU (which may be called a GPU core), such as a chip. Each graphics processing module has an independent geometry processing engine and a pixel processing engine. Each graphics processing module can stand alone as a complete GPU design unit.

[0053] In some possible implementations, each graphics processing module can be a sub-frontend module within the GPU frontend module, such as a hardware sub-module within the same chip; each graphics processing module may have an interface to a storage module (e.g., the GPU's memory) to obtain vertex sequences from the storage module.

[0054] In some possible implementations, the number of graphics processing modules can be set according to the actual application scenario. In this embodiment, the specific number of graphics processing modules is not limited.

[0055] Figure 1 This is a schematic diagram of the structure of a graphics processing device provided in an embodiment of this disclosure. (Refer to...) Figure 1 The graphics processing unit (GPU) includes multiple parallel graphics processing modules, namely GPU 0, GPU 1, ..., GPU N-1, where N is an integer greater than 1. The GPU also includes components such as a system bus and a memory module. The system bus can be an on-chip bus or an on-chip bus, used to enable data exchange between the graphics processing modules and the memory module. The memory module can use storage components such as SRAM (Static Random-Access Memory), DRAM (Dynamic Random-Access Memory), HBM (High-Bandwidth Memory), or NVME (Non-Volatile Memory Express) based memory to store data such as commands, vertices, and primitives.

[0056] Reference Figure 1 Each graphics processing module may include a vertex data reading unit, a vertex shading unit, a primitive assembly unit, and a subsequent geometry processing unit. The vertex data reading unit, upon receiving a drawing command, retrieves the vertex sequence to be processed from the vertex data stream. Where a reset point exists in the vertex sequence, the sequence includes not only the vertex segments to be processed but also suffix vertices. Where shared vertices exist in the topology, the sequence also includes shared vertices. The vertex shading unit performs vertex shading processing on the vertex sequence to obtain the vertex shading result. The primitive assembly unit performs primitive assembly processing on the vertex sequence to obtain the primitive assembly result. Where a reset point exists in the vertex data stream, the primitive assembly unit can perform primitive assembly processing on the vertex sequence based on the topology and the initial state information sent by the previous graphics processing module; where no reset point exists, the primitive assembly unit can perform primitive assembly processing on the vertex sequence based on the topology without waiting for the initial state information sent by the previous graphics processing module. The subsequent geometry processing unit can perform subsequent geometry processing based on the vertex shading result and the primitive assembly result.

[0057] In some possible implementations, the primitive assembly units of adjacent graphics processing modules are connected via a specific communication protocol. This protocol includes, but is not limited to, direct connection and the use of shared memory such as SRAM / FlipFlop. In one example, multiple parallel graphics processing modules can be connected in a ring. For instance, with six graphics processing modules, the primitive assembly unit of graphics processing module 0 is connected to the primitive assembly unit of graphics processing module 1 (a unidirectional path from graphics processing module 0 to graphics processing module 1); the primitive assembly unit of graphics processing module 1 is connected to the primitive assembly unit of graphics processing module 2; and so on, with the primitive assembly unit of graphics processing module 4 connected to the primitive assembly unit of graphics processing module 5; and the primitive assembly unit of graphics processing module 5 connected to the primitive assembly unit of graphics processing module 0. Thus, the primitive assembly units of the six graphics processing units have a ring connection structure.

[0058] It should be understood that multiple parallel graphics processing modules can be connected in other ways, such as a star connection, to form a parallel processing pipeline. In a star connection structure, all other graphics processing modules can be connected to graphics processing module 0. This disclosure does not limit the specific connection method between multiple parallel graphics processing modules.

[0059] In this embodiment, multiple graphics processing modules operate in parallel, each with a unique number. These modules are arranged in ascending order of their numbers. If the graphics processing module with number i is the current module, then the preceding module is numbered i-1, and the following module is numbered i+1, where i is an integer. It should be understood that if the graphics processing module with the smallest number is the current module, then the preceding module is the one with the largest number; conversely, if the graphics processing module with the largest number is the current module, then the following module is the one with the smallest number. In one example, the numbering can be determined based on the position of the graphics processing module within the graphics processing device. In another example, the numbering can be determined based on the order in which the graphics processing modules are connected to the system bus. This embodiment does not limit the method for determining the numbering of each graphics processing module.

[0060] Figure 2 This is a flowchart illustrating a graphics processing method provided in an embodiment of the present disclosure. The method can be applied to any one of a plurality of parallel graphics processing modules in a graphics processing device. (Refer to...) Figure 2 The method includes the following steps.

[0061] In step S21, upon receiving a drawing command, the current sequence of vertices that the graphics processing module needs to process is obtained from the vertex data stream. The drawing command indicates whether there is a reset point in the vertex data stream and the topology of the vertex data stream.

[0062] This step corresponds to the vertex input stage in the geometry processing section. This stage passes vertex data from the application to the geometry pipeline. Vertex data includes the vertex's position, color, normals, etc.

[0063] When drawing an object, the Central Processing Unit (CPU) or graphics driver can generate drawing commands and send them to the graphics processing device (GPU), where various graphics processing modules perform geometric processing. Drawing commands can be used to draw a specific area (e.g., a tile) or a specific layer of the object. Multiple drawing commands may be generated during the drawing process to draw the entire object.

[0064] The current graphics processing module can be any one of multiple parallel graphics processing modules. After receiving a drawing command, the current graphics processing module can obtain multiple vertices that need to be geometrically processed from the vertex data stream. These vertices are arranged in the order they were read from the storage module to form a vertex sequence.

[0065] A drawing command corresponds to a vertex data stream, and the drawing command can be used to process its corresponding vertex data stream. The drawing command indicates whether a reset point exists in the vertex data stream and the topology of the vertex data stream. A reset point can represent a special vertex marker used to interrupt the continuous assembly process of primitives and forcibly reset the primitive assembly state. In one example, the marker bit carried in the drawing command can be used to indicate a reset point in the vertex data stream. The topology can be used to define the rules for combining vertices in a vertex sequence to form primitives. In one example, the types of topology include, but are not limited to, points, lines, line bands, triangles, triangle bands, and triangle bands with adjacency information.

[0066] In step S22, vertex shading and primitive assembly are performed in parallel on the vertex sequence to obtain vertex shading results and primitive assembly results. During the primitive assembly process of the vertex sequence to obtain primitive assembly results, if a reset point exists in the vertex data stream, primitive assembly is performed on the vertex sequence according to the topology and the first initial state information sent by the previous graphics processing module to obtain the primitive assembly results. The first initial state information is used to indicate the initial state of the current graphics processing module performing primitive assembly.

[0067] This step corresponds to the vertex shading stage and the primitive assembly stage in the geometry processing section. In the vertex shading stage, the vertex shading unit (i.e., the vertex shader) performs calculations on each input vertex and can perform various transformations and operations, such as model transformations, view transformations, and projection transformations. This stage can also calculate vertex lighting and texture coordinates. In the primitive assembly stage, the primitive assembly unit (i.e., the primitive assembler) converts vertices into complete geometric primitives, such as points, line segments, and triangles.

[0068] The current graphics processing module can perform the aforementioned vertex shading processing on the vertex sequence through its vertex shading unit to obtain the vertex shading result. The vertex shading result includes multiple vertices and the attributes of each vertex. The multiple vertices included in the vertex shading result correspond one-to-one with the vertices included in the vertex sequence. The vertex shading result is essentially an updated vertex sequence, except that the attribute information has been updated. The input of the vertex shading unit is the vertex sequence read from the storage module, and the output is the vertex sequence with updated attribute information.

[0069] It should be noted that the various graphics processing modules in the graphics processing device perform vertex shading processing in parallel. That is, each graphics processing module does not need to wait for the vertex processing results of other graphics processing modules (such as the previous graphics processing module), and can independently perform vertex shading processing on the vertex sequence it needs to process, thus realizing the parallel vertex shading processing among the various graphics processing modules.

[0070] The current graphics processing module can perform primitive assembly processing on the vertex sequence through its primitive assembly unit to obtain the primitive assembly result. The primitive assembly processing result is a set of primitives that meet the rendering requirements.

[0071] The presence of reset points in the vertex data stream indicates a vertex dependency in the primitive assembly process. The current graphics processing module may not need to start primitive assembly from the first vertex of the vertex sequence, and the number of primitives assembled by previous graphics processing modules may differ from the pre-planned number. Therefore, when reset points exist in the vertex data stream, the current graphics processing module needs to perform primitive assembly based on the initial state information sent by the previous graphics processing module.

[0072] The first initial state information represents the initial state information sent by the previous graphics processing module to the current graphics processing module. This first initial state information is sent by the previous graphics processing module after it has completed its own primitive assembly processing. It can be used to indicate the initial state of the current graphics processing module's primitive assembly processing. This first initial state information ensures that the current graphics processing module can continue the primitive assembly state of the previous graphics processing module, reducing gaps or errors that may occur during cross-module assembly.

[0073] In some embodiments, the first initial state information includes one or more of the following: a starting primitive index, a primitive orientation, and a starting vertex offset; wherein the starting primitive index is used to indicate the starting index of the primitive assembled by the current graphics processing module; the primitive orientation is used to indicate the order in which the current graphics processing module assembles the primitives (clockwise or counterclockwise); and the starting vertex offset is used to indicate the position of the starting vertex in the vertex sequence when the current graphics processing module performs primitive assembly processing.

[0074] The starting primitive index in the first initial state information, simply referred to as the first starting primitive index, can be used to indicate the starting index of the primitives assembled by the current graphics processing module. That is, it is the sequence number (or number) of the first primitive assembled by the current graphics processing module within the entire primitive sequence of the geometric task. In one example, after completing primitive assembly, the previous graphics processing module can determine the first starting primitive index based on the ending index of its assembled primitives, i.e., the sequence number of the last primitive assembled by the previous graphics processing module within the entire primitive sequence of the geometric task. In another example, the previous graphics processing module can add 1 to the ending index of its assembled primitives to obtain the starting index of the primitives assembled by the current graphics processing module, i.e., the first starting primitive index. This ensures that the indices of the primitives assembled by the previous graphics processing module and the indices of the primitives assembled by the current graphics processing module are continuous and do not repeat.

[0075] The primitive orientation in the initial state information, referred to simply as the first primitive orientation, can be used to indicate the order in which the current graphics processing module assembles primitives. This order can be clockwise or counterclockwise. In one example, the preceding graphics processing module can determine whether the first primitive orientation indicates clockwise or counterclockwise based on the parity of the first starting primitive index. For example, if the first starting primitive index is even, the first primitive orientation indicates clockwise; if the first starting primitive index is odd, the first primitive orientation indicates counterclockwise. This ensures that primitives assembled across modules have opposite orientations.

[0076] The starting vertex offset in the initial state information, simply referred to as the first starting vertex offset, can be used to indicate the position of the starting vertex in the vertex sequence when the current graphics processing module performs primitive assembly processing. In one example, the previous graphics processing module can determine the first starting vertex offset based on the number of suffix vertices in its vertex sequence, such as using the number of suffix vertices as the first starting vertex offset. For the previous graphics processing module, it has already completed the primitive assembly of suffix vertices, so the current graphics processing module can skip these vertices from its own vertex sequence and complete the primitive assembly of subsequent vertices. In this way, it can avoid repeated primitive assembly and ensure the continuity of primitive assembly.

[0077] In step S23, subsequent geometric processing is performed based on the vertex shading results and the primitive assembly results.

[0078] Subsequent geometric processing can represent downstream processing flows of the graphics geometry processing pipeline, such as surface subdivision, geometry shading, clipping, viewport mapping, backface culling, etc., and finally outputs graphic data that can be used for rasterization processing.

[0079] In some embodiments, the graphics processing method provided in this disclosure further includes the following steps.

[0080] In step S24, if a reset point exists in the vertex data stream, in response to the completion of the primitive assembly process, a second initial state information is sent to the next graphics processing module. The second initial state information is used to indicate the initial state of the primitive assembly process performed by the next graphics processing module.

[0081] The second initial state information is sent by the current graphics processing module to the next graphics processing module. It is sent by the current graphics processing module after completing its own primitive assembly process. This second initial state information can be used to indicate the initial state of the next graphics processing module's primitive assembly process. It ensures that the next graphics processing module can continue the primitive assembly state of the current module, reducing gaps or errors that may occur during cross-module assembly.

[0082] In some embodiments, the second initial state information may include one or more of the following: starting primitive index, primitive orientation, and starting vertex offset.

[0083] The starting primitive index in the second initial state information, or simply the second starting primitive index, can be used to indicate the starting index of the primitives assembled by the subsequent graphics processing module, that is, the sequence number of the first primitive assembled by the subsequent graphics processing module in the entire primitive group sequence of the geometry task. After completing primitive assembly, the current graphics processing module can determine the second starting primitive index based on the ending index of the primitives it assembled, that is, the sequence number of the last primitive assembled by the current graphics processing module in the entire primitive sequence of the geometry task. In one example, the current graphics processing module can obtain the second starting primitive index by adding 1 to the ending index of the primitives it assembled.

[0084] The primitive orientation in the second initial state information, referred to simply as the second primitive orientation, can be used to indicate the order in which the subsequent graphics processing module assembles primitives. The current graphics processing module can determine whether the second primitive orientation indicates clockwise or counterclockwise based on the parity of the second starting primitive index.

[0085] The starting vertex offset in the second initial state information, or simply the second starting vertex offset, can be used to indicate the position of the starting vertex in the vertex sequence when the next graphics processing module performs primitive assembly processing. In one example, the current graphics processing module can determine the second starting vertex offset based on the number of suffix vertices in its vertex sequence.

[0086] As one implementation of this disclosure, seamless state connection between multiple parallel graphics processing modules is achieved by sending initial state information, forming a complete state relay chain. This reduces gaps or errors that occur during cross-module assembly and improves correctness. Simultaneously, state propagation reduces redundant primitive assembly, further enhancing the processing efficiency of geometric tasks.

[0087] The drawing command can indicate whether there are reset points in the vertex data stream. If reset points exist, the drawing command can further indicate the position of each reset point in the vertex data stream. Based on the position of each reset point in the vertex data stream, the number of reset points in the vertex sequence that the current graphics processing module needs to process can be determined. In other words, the drawing command also indicates the number of reset points in the vertex sequence that the current graphics processing module needs to process.

[0088] In some embodiments, the graphics processing method provided in this disclosure further includes the following steps.

[0089] In step S25, the second initial state information is generated based on the end index of the primitives assembled by the current graphics processing module and the number of reset points in the vertex sequence.

[0090] The end index of the primitives assembled by the current graphics processing module (i.e., the index of the last primitive assembled by the current graphics processing module) is the basis for calculating the start index of the primitives assembled by the next graphics processing module (i.e., the index of the first primitive assembled by the next graphics processing module). Therefore, the starting primitive index of the second initial state information can be determined based on the end index of the primitives assembled by the current graphics processing module, and thus the primitive orientation of the second initial state information can be determined.

[0091] The number of reset points in the vertex sequence processed by the current graphics processing module is the basis for calculating the number of suffix vertices used by the current graphics processing module when performing primitive assembly. Since the current graphics processing module has already performed primitive assembly on the suffix vertices, the subsequent graphics processing module does not need to perform primitive assembly on the suffix vertices again. Therefore, based on the number of reset points in the vertex sequence, the starting vertex offset of the second initial state information can be determined.

[0092] In this context, a suffix vertex can represent one or more vertices that follow and are adjacent to a vertex segment. The method for determining the number of suffix vertices will be explained in detail later and will not be repeated here.

[0093] In one possible implementation, step S25 generates the second initial state information based on the end index of the primitives assembled by the current graphics processing module and the number of reset points in the vertex sequence, including the following steps.

[0094] In step S251, the end index of the primitive assembled by the current graphics processing module is incremented by one to obtain the starting index of the primitive assembled by the next graphics processing module.

[0095] In step S252, the orientation of the primitives during primitive assembly by the next graphics processing module is determined based on the parity of the starting index of the primitives assembled by the next graphics processing module.

[0096] In step S253, the starting vertex offset is determined when the next graphics processing module performs primitive assembly processing based on the number of reset points in the vertex sequence.

[0097] In step S254, the second initial state information is determined based on one or more of the following: the starting index of the primitive assembled by the next graphics processing module, the orientation of the primitive during primitive assembly, and the starting vertex offset during primitive assembly.

[0098] The starting index of the primitive assembled by the next graphics processing module is the same as the starting primitive index in the second initial state information. The starting index of the primitive assembled by the next graphics processing module is equal to the ending index of the primitive assembled by the current graphics processing module plus one. This ensures the continuity of indices between the primitives assembled by the current graphics processing module and the primitives assembled by the next graphics processing module.

[0099] The orientation of the primitives during primitive assembly in the next graphics processing module is the same as the orientation in the second initial state information. If the starting index of the primitives assembled by the next graphics processing module is odd, the orientation of the primitives during primitive assembly in the next graphics processing module can be determined to be clockwise; otherwise, the orientation is counterclockwise.

[0100] The starting vertex offset when the next graphics processing module performs primitive assembly is the starting vertex offset in the second initial state information.

[0101] The number of reset points in the vertex sequence of the current graphics processing module may be zero, one, or more. The method for determining the starting vertex offset varies depending on the number of reset points. The process of determining the starting vertex offset under different numbers of reset points is explained below.

[0102] In one possible implementation, step S253 may include: determining that the starting vertex offset is zero when the number of reset points in the vertex sequence is zero.

[0103] The number of reset points in the vertex sequence of the current graphics processing module is zero, indicating that the current graphics processing module does not need to use suffix vertices when assembling primitives, and the next graphics processing module does not need to discard the starting vertex. Therefore, the starting vertex offset can be set to 0.

[0104] In one possible implementation, step S253 may include: if the number of reset points in the vertex sequence is one, determining the number of suffix vertices according to the topology, and determining the number of suffix vertices as the starting vertex offset, wherein the suffix vertex represents one or more vertices that follow and are adjacent to the vertex segment.

[0105] The current graphics processing module has one reset point in its vertex sequence. When assembling primitives, this module needs to use suffix vertices, and the number of suffix vertices can be determined based on the topology. Taking a triangle list as an example, if the current module needs two suffix vertices, the next module needs to discard the first two vertices. The offset of the starting vertex can be set to 2. The number of suffix vertices for different topologies will be explained later; it will not be repeated here.

[0106] In one possible implementation, step S253 may include: if there are multiple reset points in the vertex sequence, determining the starting vertex offset based on the topology.

[0107] When there are multiple reset points, in some topologies, the number of suffix vertices is inconsistent with the offset of the starting vertex. Therefore, as an implementation of this disclosure, the topology is divided into a triangular strip with adjacency information, a control packet list including Q points, and a target topology. The target topology refers to any topology other than the triangular strip with adjacency information and the control packet list including Q points.

[0108] When there are multiple reset points in the vertex sequence, determining the starting vertex offset based on the topology includes: when there are multiple reset points in the vertex sequence and the topology is a target topology, determining the number of suffix vertices based on the target topology, and determining the number of suffix vertices as the starting vertex offset, wherein the suffix vertex represents one or more vertices that follow the vertex segment and are adjacent to the vertex segment.

[0109] Taking the topology of the point list and the number of reset points as an example, if the current graphics processing module needs to use 2 suffix vertices, then the next graphics processing module needs to discard the initial 2 vertices. The initial vertex offset can be set to 2.

[0110] When there are multiple reset points in the vertex sequence, determining the starting vertex offset based on the topology includes: when there are multiple reset points in the vertex sequence and the topology is a triangle strip with adjacency information, obtaining the number of suffix vertices used by the last primitive assembled by the current graphics processing module; if the number of suffix vertices used is odd, then a first value is determined as the starting vertex offset; if the number of suffix vertices used is even, then a second value is determined as the starting vertex offset. Wherein, the first value is even, the second value is odd, and the first value is less than the second value.

[0111] Each time a new vertex is added to a triangle strip, it forms a new triangle with the previous two vertices, and the drawing orientation of the triangles (clockwise / counterclockwise) alternates. Triangle strips with adjacency information not only draw triangles but also carry adjacency primitive information for geometry shaders, wireframe rendering, and shadow calculations. If the orientation is incorrect, the adjacency information becomes completely invalid, and rendering will fail.

[0112] As one embodiment of this disclosure, if the number of suffix vertices used by the last primitive assembled by the current graphics processing module is odd, then the starting vertex offset of the next graphics processing module is set to an even number; if the number of suffix vertices used by the last primitive assembled by the current graphics processing module is even, then the starting vertex offset of the next graphics processing module is set to an odd number. This cancels out the directional flipping left over from the end of the previous segment, ensuring that the two segments are aligned and their adjacent topology is valid after splicing.

[0113] The triangle with adjacency information has 7 corresponding suffix vertices. In one example, when the last primitive uses an odd number of suffix vertices, the starting vertex offset can be set to 6; when the last primitive uses an even number of suffix vertices, the starting vertex offset can be set to 7. Here, 6 is one implementation of the first value, and 7 is another implementation of the second value.

[0114] Determining the starting vertex offset based on the topology when there are multiple reset points in the vertex sequence includes: when there are multiple reset points in the vertex sequence and the topology is a control packet list including Q points, the remainder obtained by dividing M by Q is determined as the starting vertex offset, where M represents the number of vertices between the first target point and the second target point, the first target point represents the last reset point in the vertex sequence, the second target point represents the last vertex in the vertex sequence excluding suffix vertices, and M and Q are positive integers.

[0115] In this embodiment, vertices in the vertex data stream are grouped into control packets of Q vertices each. Multiple consecutive control packets can be referred to as a control packet list containing Q points. In this embodiment, the vertices in the vertex data stream are used as points in the control packet list. The Q points within each control packet are not directly used as spatial vertices during rendering, but rather as constraint control points for the surface shape. The Q points within each control packet can collaboratively define a continuous surface.

[0116] For a control packet list containing Q points, the vertex sequence corresponding to the current graphics processing module includes multiple reset points. First, determine the position of the last reset point (i.e., the first target point), and determine the position of the last vertex (i.e., the second target point) among all vertices in the vertex sequence excluding suffix vertices. Then, count the number of vertices between these two positions and record this number as M. The starting vertex offset = M mod Q, where mod is the modulo operation. For example, if M = 0, the starting vertex offset = 0; if M = Q - 1, the starting vertex offset is Q - 1; if M = 2Q + 2, the starting vertex offset = 2.

[0117] As one implementation of this disclosure, second initial state information is automatically generated without software intervention, reducing driving overhead and state transmission delay. At the same time, the number of reset points is used to correct the starting vertex offset, ensuring that the assembly state of the next graphics processing module is accurate and avoiding cross-module index offset errors and repeated assembly.

[0118] In some embodiments, the graphics processing method provided in this disclosure further includes the following steps.

[0119] In step S26, during the process of performing the primitive assembly process on the vertex sequence to obtain the primitive assembly result, if there is no reset point in the vertex data stream, the vertex sequence is subjected to primitive assembly processing according to the topology to obtain the primitive assembly result.

[0120] When there is no reset point in the vertex data stream, it indicates that the primitives corresponding to the vertex data stream are a continuous topology. There is no need to interrupt the assembly process or reset the assembly state. Therefore, the current graphics processing module can directly perform primitive assembly processing on the vertices in the vertex sequence according to the topology indicated by the drawing command, without relying on the first initial state information sent by the previous graphics processing module.

[0121] As one implementation of this disclosure, for continuous topology scenarios without reset points, the primitive assembly process is simplified, eliminating the need to wait for initial state information, thereby improving the efficiency of primitive assembly and saving communication resources.

[0122] In some embodiments, obtaining the vertex sequence that the current graphics processing module needs to process from the vertex data stream in step S21 includes the following steps.

[0123] In step S211, the primitive partitioning rule of the current graphics processing module is determined. The primitive partitioning rule is used to indicate the index of the primitives assigned to the current graphics processing module for processing.

[0124] The primitive partitioning rules of the current graphics processing module can be used to indicate the index of the primitives that the system assigns to the current graphics processing module for processing.

[0125] The index of a primitive (also known as the primitive sequence number or number) is a sequence number assigned when generating drawing commands. It is used to identify the order of primitives and ensure that the primitive partitioning rules can accurately locate the range of vertices that the current graphics processing module needs to process.

[0126] In one possible implementation, step S211, which determines the primitive partitioning rules of the current graphics processing module, includes the following steps.

[0127] Step S2111: Determine the primitive partitioning rule of the current graphics processing module based on the number of enabled graphics processing modules in the graphics processing device, the number of primitives processed by each graphics processing module, and the number of the current graphics processing module.

[0128] The number of enabled graphics processing modules represents the total number of graphics processing modules currently in operation for geometric processing in the graphics processing device. The graphics processing device can configure the number of enabled graphics processing modules according to the complexity of the current geometric task. This number can be dynamically adjusted.

[0129] The number of primitives processed by each graphics processing module can be determined based on the total number of primitives in the geometry task and the number of enabled graphics processing modules. For example, if the total number of primitives in the geometry task is 100 and the number of enabled graphics processing modules is 10, then each graphics processing module processes 10 primitives. Alternatively, if the total number of primitives in the geometry task is 99 and the number of enabled graphics processing modules is 10, then the first 9 graphics processing modules process 10 primitives each, and the last graphics processing module processes 9 primitives each.

[0130] The current graphics processing module number is a unique identifier for the current graphics processing module in the graphics processing device. It is used to distinguish different graphics processing modules and ensure that the primitive partitioning rules can accurately allocate processing.

[0131] As one embodiment of this disclosure, the index of the graphics processing unit processed by each graphics processing module is determined based on the number of enabled graphics processing modules, the number of graphics processing units processed by each graphics processing module, and the number of the current graphics processing module, thereby achieving load balancing of multiple parallel graphics processing modules and improving the overall resource utilization of the graphics processing device.

[0132] In step S212, the vertex sequence is read from the vertex data stream according to the primitive partitioning rules and the topology.

[0133] Based on the primitive partitioning rules determined in step S211, the number of primitives that the current graphics processing module needs to skip and the number of primitives that need to be processed are determined. Combined with the topology indicated by the drawing command, the corresponding vertices are read from the storage module to construct the vertex sequence that the current graphics processing module needs to process, ensuring that the vertex data read from the vertex data stream can completely cover all the primitives that the current graphics processing module needs to process.

[0134] In one possible implementation, step S212, which involves reading the vertex sequence from the vertex data stream according to the primitive partitioning rules and the topology, includes the following steps.

[0135] In step S2121, vertex fragments are read from the vertex data stream according to the primitive partitioning rules and the topology.

[0136] In step S2122, the vertex sequence is constructed based on the vertices in the vertex fragment.

[0137] Vertex fragments represent the core vertices that the current graphics processing module needs to process. They form the basis for constructing the vertex sequence of the current graphics processing module, and their length is determined by the number of primitives to be processed and the deteriorating topology.

[0138] In one example, step S2121 reads a vertex fragment from the vertex data stream according to the primitive partitioning rules and the topology, including: determining the number of primitives that the current graphics processing module needs to skip and the number of primitives that need to be processed according to the primitive partitioning rules; determining the number of vertices that the current graphics processing module needs to skip when reading the vertex fragment according to the topology and the number of primitives that need to be skipped; and determining the number of vertices contained in the vertex fragment read by the current graphics processing module according to the topology and the number of primitives that need to be processed; and reading the vertex fragment from the vertex data stream according to the number of vertices that need to be skipped and the number of vertices contained in the vertex fragment.

[0139] The vertex fragments read in step S2121 are arranged in their original order in the storage module to form the initial vertex sequence that the current graphics processing module needs to process. This initial vertex sequence contains the basic vertex data required by the current graphics processing module to assemble primitives. The initial vertex sequence can be supplemented and adjusted later according to whether there are reset points or whether there are shared vertices.

[0140] As one implementation of this disclosure, the initial vertex sequence of the current graphics processing module is quickly constructed to ensure that the order of the vertices is consistent with the topological requirements, providing clear basic data for subsequent vertex supplementation and primitive assembly.

[0141] In step S2123, if a reset point exists in the vertex sequence, a suffix vertex is read according to the topology and added to the vertex sequence. The suffix vertex represents one or more vertices that follow and are adjacent to the vertex segment.

[0142] When a reset point exists in the vertex sequence, the current graphics processing module can read suffix vertices. Suffix vertices represent one or more vertices adjacent to a vertex segment after it. The number of suffix vertices can be determined based on the topology. For example, in a triangle strip topology, if a vertex segment contains a reset point, one suffix vertex needs to be read to ensure that the last primitive after the reset point can be fully assembled. The current graphics processing module can place the suffix vertex after the last vertex of the vertex segment, thus adding the suffix vertex to the vertex sequence.

[0143] It should be understood that if there is no reset point in the vertex sequence, the current graphics processing module does not need to read suffix vertices, that is, the vertex sequence does not contain suffix vertices.

[0144] As one implementation of this disclosure, the suffix vertices required when a reset point exists are automatically supplemented, avoiding primitive assembly errors caused by missing vertices, ensuring that the vertex sequence containing the reset point can be correctly assembled into a complete primitive, and improving the correctness of primitive assembly and the reliability of the assembled primitive.

[0145] In some embodiments, the drawing command includes one or more instances, each instance including one or more primitives; the step S212 of reading the vertex sequence from the vertex data stream according to the primitive partitioning rules and the topology further includes the following steps.

[0146] In step S2124, if the topology includes shared vertices and the first primitive of any instance is not included in the primitives that the current graphics processing module needs to process, the shared vertices are read according to the topology and added to the vertex sequence. The shared vertices represent one or more vertices that precede and are adjacent to the vertex segment.

[0147] A collection of primitives with the same topology and rendering attributes contained in a drawing command can be called an instance. Each drawing command can contain one or more instances, and each instance can contain one or more primitives for batch rendering.

[0148] A shared vertex refers to one or more vertices that precede and are adjacent to a vertex segment. Shared vertices are vertices shared by the primitives processed by the current graphics processing module and their preceding primitives. Their function is to ensure correct concatenation of primitive assemblies across modules, avoiding assembly errors caused by missing vertices. In other words, a shared vertex belongs to the vertex sequence of the current graphics processing module, but is required by the previous graphics processing module during primitive assembly. It should be understood that a suffix vertex belongs to the vertex sequence of the next graphics processing module, but is required by the current graphics processing module during primitive assembly. For the current graphics processing module, its shared vertices are those shared with the previous graphics processing module in its vertex sequence; its suffix vertices are those required by the next graphics processing module in its vertex sequence. The same vertex may be both a suffix vertex of the previous graphics processing module and a shared vertex of the current graphics processing module.

[0149] If there are shared vertices in the topology and the first primitive of the instance is not included in the primitives that the current graphics processing module needs to process, it indicates that the primitives that the current graphics processing module needs to process are the middle or last primitives of the instance. In this case, the primitives that the current graphics processing module needs to process depend on the shared vertices of the preceding primitives to complete the primitive assembly. Therefore, it is necessary to read the shared vertices and add them to the vertex sequence.

[0150] The number of shared vertices can be determined based on the topology. For example, in a triangle strip topology, each subsequent primitive needs to share two vertices of the previous primitive. Therefore, if the current graphics processing module is not processing the first primitive of the instance, it needs to read two shared vertices. Similarly, in a line strip topology, each subsequent primitive needs to share one vertex of the previous primitive, thus requiring the reading of one shared vertex.

[0151] The current graphics processing module can place shared vertices before the first vertex of a vertex fragment, thus enabling the addition of shared vertices to the vertex sequence.

[0152] It should be noted that if the topology does not include shared vertices, or if the topology includes shared vertices but the primitives that the current graphics processing module needs to process include the first primitive of the instance, then there is no need to read the shared vertices, and the vertex sequence does not contain vertex fragments.

[0153] As one implementation of this disclosure, the system automatically identifies scenarios where shared vertices need to be added, and reads and adds the shared vertices to the vertex sequence in such scenarios. This ensures that the topology containing shared vertices can be correctly connected across modules, avoids primitive assembly errors caused by shared vertices, and improves the adaptability to complex topologies.

[0154] In this embodiment of the disclosure, the vertices included in the vertex sequence fall into the following categories: the vertex sequence contains only vertices from a vertex segment; the vertex sequence includes vertices from a vertex segment and suffix vertices; the vertex sequence includes vertices from the vertex sequence and shared vertices; the vertex sequence includes vertices from a vertex segment, shared vertices, and suffix vertices. Suffix vertices are located after the last vertex of a vertex segment, and shared vertices are located before the first vertex of a vertex segment. Shared vertices, vertices from vertex segments, and suffix vertices are all stored in the storage module. Shared vertices of the current graphics processing module belong to vertices from the vertex segment of the previous graphics processing module. Suffix vertices of the current graphics processing module belong to vertices from the vertex segment of the next graphics processing module.

[0155] In some embodiments, the number of primitives processed by the graphics processing module is set to K. The time for the current graphics processing module to perform vertex shading processing and primitive assembly processing on K primitives is a first time and a second time, respectively. The difference between the first time and the second time is greater than the information waiting time. The start time of the information waiting time is the start time of the vertex shading processing, and the end time of the information waiting time is the time when the first initial state information sent by the previous graphics processing module is received.

[0156] In this embodiment of the disclosure, the duration of vertex shading processing (i.e., the first duration) is greater than the duration of primitive assembly processing (i.e., the second duration), and the difference between the duration of vertex shading processing and the duration of primitive assembly processing is greater than the information waiting time.

[0157] This avoids the current graphics processing module from getting stuck in a long wait because it hasn't received the first initial state information from the previous graphics processing module after completing vertex shading. It ensures that primitive assembly is completed before vertex shading ends, hides the time spent waiting for the first initial state information, and achieves the parallel effect of vertex shading and primitive assembly.

[0158] The graphics processing method according to the embodiments of this disclosure can be used to perform any of the processing tasks such as image processing tasks and video processing tasks, and the data processed includes any of the images and videos, which is not limited by this disclosure.

[0159] In this embodiment, preprocessing for complex topologies and cases with reset points is unnecessary, thereby reducing system complexity, workload, and improving geometry processing efficiency. Furthermore, the absence of preprocessing eliminates software intervention, reducing driver complexity and making it more software-friendly.

[0160] In this embodiment, the size of the graph data block for the geometric task is used to calculate the vertex fragments that each graphics processing module needs to process. This allows only the vertex data belonging to the current graphics processing module to be read and processed, reducing workload and improving efficiency. Regarding the reset point information set for the drawing command, when no reset point exists, each graphics processing module performs geometric processing operations completely independently and in parallel. When a reset point exists, primitives are assembled using the communication protocol between primitive assemblies, providing initial state information to the next graphics processing module. Each graphics processing module assembles primitives based on the information provided by the previous module, according to the topology and whether it is a reset point. When a reset point exists, pre-fetched suffix vertices ensure that every vertex of the vertex fragment is assembled into a primitive. By setting the size of the graph data block, the length of the vertex fragment is adjusted, enabling parallel processing of vertex shading and primitive assembly.

[0161] In this embodiment, when multiple graphics processing modules process geometric tasks in parallel, each graphics processing module only reads and processes a segment of vertex data. For topologies with reset points, a communication mechanism is added to transmit primitive assembly information, and the communication time is hidden through parallel operations of primitive assembly and vertex shading. Ultimately, this reduces the amount of access to the storage module and improves the performance of geometric processing.

[0162] It is understood that the various method embodiments mentioned above in this disclosure can be combined with each other to form combined embodiments without violating the principle and logic. Due to space limitations, this disclosure will not elaborate further. Those skilled in the art will understand that in the above methods of specific implementation, the specific execution order of each step should be determined by its function and possible internal logic.

[0163] In addition, this disclosure also provides a graphics processing apparatus, an electronic device, and a computer-readable storage medium, all of which can be used to implement any of the graphics processing methods provided in this disclosure. The corresponding technical solutions and descriptions are described in the corresponding section of the method and will not be repeated here.

[0164] Figure 3 This is a block diagram of a graphics processing apparatus provided in an embodiment of the present disclosure.

[0165] Reference Figure 3 This disclosure provides a graphics processing device 30, which includes a plurality of parallel graphics processing modules. Any one of the plurality of parallel graphics processing modules 31 includes the following units.

[0166] The vertex data reading unit 311 is used to obtain the vertex sequence that the current graphics processing module needs to process from the vertex data stream when a drawing command is received. The drawing command indicates whether there is a reset point in the vertex data stream and the topology of the vertex data stream.

[0167] Vertex coloring unit 312 is used to perform vertex coloring processing on the vertex sequence to obtain vertex coloring results.

[0168] Primitive assembly unit 313 operates in parallel with vertex shading unit 312 to perform primitive assembly processing on the vertex sequence to obtain primitive assembly results; wherein, during the process of obtaining primitive assembly results by performing primitive assembly processing on the vertex sequence, if there is a reset point in the vertex sequence, primitive assembly processing is performed on the vertex sequence according to the topology and the first initial state information sent by the previous graphics processing module to obtain primitive assembly results, and the first initial state information is used to indicate the initial state of the current graphics processing module performing primitive assembly processing.

[0169] The subsequent geometry processing unit 314 is used to perform subsequent geometry processing based on the vertex shading result and the primitive assembly result.

[0170] In one possible implementation, the apparatus further includes: an information sending unit, configured to send second initial state information to a subsequent graphics processing module in response to the completion of the primitive assembly process, in the event that a reset point exists in the vertex data stream, the second initial state information being used to indicate the initial state of the primitive assembly process performed by the subsequent graphics processing module.

[0171] In one possible implementation, the apparatus further includes: an information generation unit, configured to generate the second initial state information based on the end index of the primitives assembled by the current graphics processing module and the number of reset points in the vertex sequence.

[0172] In one possible implementation, the drawing command further indicates the number of reset points in the vertex sequence, and the information generation unit is further configured to: increment the end index of the primitive assembled by the current graphics processing module to obtain the start index of the primitive assembled by the next graphics processing module; determine the primitive orientation when the next graphics processing module performs primitive assembly processing based on the parity of the start index of the primitive assembled by the next graphics processing module; determine the starting vertex offset when the next graphics processing module performs primitive assembly processing based on the number of reset points in the vertex sequence; and determine the second initial state information based on one or more of the starting index of the primitive assembled by the next graphics processing module, the primitive orientation when performing primitive assembly processing, and the starting vertex offset when performing primitive assembly processing.

[0173] In one possible implementation, the information generation unit is further configured to: determine that the starting vertex offset is zero when the number of reset points in the vertex sequence is zero.

[0174] In one possible implementation, the information generation unit is further configured to: determine the number of suffix vertices according to the topology when the number of reset points in the vertex sequence is one, and determine the number of suffix vertices as the starting vertex offset, wherein the suffix vertex represents one or more vertices that follow and are adjacent to the vertex segment.

[0175] In one possible implementation, the information generation unit is further configured to: determine the starting vertex offset based on the topology when there are multiple reset points in the vertex sequence.

[0176] In one possible implementation, the information generation unit is further configured to: when the number of reset points in the vertex sequence is multiple and the topology is a target topology, determine the number of suffix vertices according to the target topology, and determine the number of suffix vertices as the starting vertex offset, wherein the suffix vertex represents one or more vertices following and adjacent to the vertex segment; when the number of reset points in the vertex sequence is multiple and the topology is a triangle strip with adjacency information, obtain the number of suffix vertices used by the last primitive assembled by the current graphics processing module, and if the number of suffix vertices used is odd, determine the first value as the starting vertex offset; if the number of suffix vertices used is even, determine the second value as the starting vertex offset. Two numerical values ​​are determined as the starting vertex offset, wherein the first value is an even number, the second value is an odd number, and the first value is less than the second value; when there are multiple reset points in the vertex sequence and the topology is a control packet list including Q points, the remainder obtained by dividing M by Q is determined as the starting vertex offset, wherein M represents the number of vertices between the first target point and the second target point, the first target point represents the last reset point in the vertex sequence, the second target point represents the last vertex in the vertex sequence excluding suffix vertices, and M and Q are positive integers; wherein the target topology represents any topology other than the triangle strip with adjacency information and the control packet list including Q points.

[0177] In one possible implementation, the primitive assembly unit is further configured to: in the process of performing the primitive assembly process on the vertex sequence to obtain the primitive assembly result, if there is no reset point in the vertex data stream, perform primitive assembly process on the vertex sequence according to the topology to obtain the primitive assembly result.

[0178] In one possible implementation, the vertex data reading unit is further configured to: determine the primitive partitioning rule of the current graphics processing module, the primitive partitioning rule being used to indicate the index of the primitives assigned to the current graphics processing module for processing; and read the vertex sequence from the vertex data stream according to the primitive partitioning rule and the topology.

[0179] In one possible implementation, the vertex data reading unit is further configured to: read vertex fragments from the vertex data stream according to the primitive partitioning rules and the topology; construct the vertex sequence based on the vertices in the vertex fragments; and, if there is a reset point in the vertex sequence, read suffix vertices according to the topology and add the suffix vertices to the vertex sequence, wherein the suffix vertices represent one or more vertices that follow the vertex fragment and are adjacent to the vertex fragment.

[0180] In one possible implementation, the vertex data reading unit is further configured to: determine the number of primitives that the current graphics processing module needs to skip and the number of primitives that need to be processed according to the primitive partitioning rules; determine the number of vertices that the current graphics processing module needs to skip when reading a vertex fragment according to the topology and the number of primitives that need to be skipped; and determine the number of vertices contained in the vertex fragment read by the current graphics processing module according to the topology and the number of primitives that need to be processed; and read the vertex fragment from the vertex data stream according to the number of vertices that need to be skipped and the number of vertices contained in the vertex fragment.

[0181] In one possible implementation, the drawing command includes one or more instances, each instance containing one or more primitives; the vertex data reading unit is further configured to: read the shared vertices according to the topology and add the shared vertices to the vertex sequence when the topology includes shared vertices and the primitives to be processed by the current graphics processing module do not include the first primitive of any instance, wherein the shared vertices represent one or more vertices preceding and adjacent to the vertex segment.

[0182] In one possible implementation, the vertex data reading unit is further configured to: determine the primitive partitioning rule of the current graphics processing module based on the number of enabled graphics processing modules in the graphics processing device, the number of primitives processed by each graphics processing module, and the number of the current graphics processing module.

[0183] In one possible implementation, the number of primitives processed by the current graphics processing module is set to K. The time for the current graphics processing module to perform vertex shading and primitive assembly processing on the K primitives is a first time and a second time, respectively. The difference between the first time and the second time is greater than the information waiting time. The start time of the information waiting time is the start time of the vertex shading process, and the end time of the information waiting time is the time when the first initial state information sent by the previous graphics processing module is received.

[0184] In one possible implementation, the first initial state information includes one or more of the following: a starting primitive index, a primitive orientation, and a starting vertex offset; wherein the starting primitive index is used to indicate the starting index of the primitive assembled by the current graphics processing module; the primitive orientation is used to indicate the order in which the current graphics processing module assembles the primitives; and the starting vertex offset is used to indicate the position of the starting vertex in the vertex sequence when the current graphics processing module performs primitive assembly processing.

[0185] Figure 4This is a block diagram of a graphics processing apparatus provided according to an embodiment of the present disclosure. (Refer to...) Figure 4 This disclosure provides a graphics processing device that includes multiple parallel graphics processing modules, namely graphics processing module 0, graphics processing module 1, ..., graphics processing module N-1, where N is an integer greater than 1. The graphics processing device also includes components such as a system bus and a storage module.

[0186] Reference Figure 4 Each graphics processing module may include a configuration unit, a command reading unit, a vertex data reading unit, a command and vertex sending unit, a vertex shading unit, a primitive assembly unit, a subsequent geometry processing unit, and a memory access arbitration unit.

[0187] The configuration unit sets the number of enabled graphics processing modules in the graphics processing device, the ID of the current graphics processing module, and the total number of primitives in the geometric task (i.e., the number of primitives in the primitive data block to be processed by the geometric task, which can be called the primitive data block length). The configuration unit can calculate the primitive partitioning rule of the current graphics processing device based on this information (corresponding to step S2111) and pass the primitive partitioning rule of the current graphics processing device to the command reading unit.

[0188] The command reading unit reads command data from the storage module, mainly control commands and drawing commands (Draw commands). Control commands configure the state information of the GPU geometry processing pipeline, while drawing commands are used to draw graphics. The command reading unit sends the read control and drawing commands to the command and vertex sending unit, and also sends the read drawing commands to the vertex data reading unit.

[0189] The vertex data reading unit receives drawing commands from the command reading unit and primitive partitioning rules from the configuration unit. The drawing commands explicitly define whether a reset point exists in the vertex data stream they point to, and the topology of the vertex data stream. Based on the primitive partitioning rules and the topology, the vertex data reading unit calculates the vertex data to be acquired (i.e., the vertex sequence that the current graphics processing module needs to process).

[0190] The command reading unit and the vertex data reading unit access the storage module through the memory access arbitration unit to ensure that the order of reading commands and the order of reading vertices are consistent with the storage order in the storage module, thereby improving reliability.

[0191] If no reset point exists, the vertex data reading unit reads vertex fragments according to the primitive partitioning rules and topology (corresponding to steps S2121 and S2122). If a reset point exists, the vertex data reading unit needs to read several additional suffix vertices in addition to the vertex sequence (corresponding to step S2123).

[0192] Figure 5 This is a schematic diagram of a vertex sequence provided in an embodiment of this disclosure. (Refer to...) Figure 5 The storage module stores multiple vertices. Based on the primitive partitioning rules and topology of each graphics processing module, the vertices in the storage module are split into multiple vertex fragments, such as vertex fragment 0, vertex fragment 1, vertex fragment 2, ... vertex fragment 5. In the absence of a reset point, these vertex fragments serve as the vertex sequences that each graphics processing module needs to process.

[0193] Figure 6 This is a schematic diagram of a vertex sequence provided in an embodiment of the present disclosure. Figure 6 The vertex fragments in the image can be referenced. Figure 5 This will not be elaborated upon here. (Refer to...) Figure 6 In the presence of a reset point, vertex fragments and suffix vertices together constitute the vertex sequence that each graphics processing module needs to process.

[0194] The command and vertex sending unit receives command data from the command reading unit and vertex sequence from the vertex data reading unit. After receiving a drawing command, the command and vertex sending unit receives the vertex sequence belonging to that drawing command from the vertex data reading unit and sends the drawing command and vertex sequence to the vertex shading unit and primitive assembly unit.

[0195] The vertex shader unit runs the vertex shader program, processes each received vertex, and outputs the processing result for each vertex. In the absence of a reset point, the vertices processed by the vertex shader unit include vertices within a vertex fragment. In the presence of a reset point, the vertices processed by the vertex shader unit include vertices within a vertex fragment as well as suffix vertices.

[0196] The primitive assembly unit assembles the received vertices into primitives according to the topology indicated in the drawing command. In the absence of a reset point, the primitive assembly unit receives vertex fragments and assembles the vertices in the fragments into primitives according to the topology. In the presence of a reset point, the primitive assembly unit receives vertex fragments and suffix vertices, and assembles the vertices of the fragments and suffix vertices into primitives according to the topology and the first initial state information sent by the primitive assembly unit of the previous graphics processing module.

[0197] The subsequent geometry processing unit receives the vertex shading results from the vertex shader unit and the primitive assembly results from the primitive assembly unit. It then performs subsequent operations such as geometry shading, surface subdivision, clipping, and culling primitives on a primitive-by-primitive basis to obtain the geometry processing results.

[0198] The graphics processing apparatus provided in this disclosure can improve the efficiency of parallel geometric processing by multiple graphics processing modules.

[0199] In this embodiment of the present disclosure, each graphics processing module of the graphics processing device processes a segment of vertex data; when the drawing command indicates that there is no reset point, each graphics processing module independently and in parallel performs geometric processing, including vertex shading processing, primitive assembly processing, and subsequent geometric processing; when the drawing command indicates that there is a reset point, communication is required between the graphics processing modules.

[0200] During geometry processing, vertex shading and primitive assembly are executed in parallel, and primitive assembly is typically faster than vertex shading; that is, primitive assembly takes less time than vertex shading. The vertex shading results and primitive assembly results are then combined to execute subsequent geometry processing steps.

[0201] Figure 7 This is a schematic diagram of a geometric processing flow provided in an embodiment of this disclosure. (Refer to...) Figure 7 Graphics processing module 0 performs vertex shading and primitive assembly processing on vertex sequence 0 in parallel. It should be understood that vertex sequence 0 includes the vertices of vertex fragment 0 and suffix vertices. After both vertex shading and primitive assembly are completed, subsequent geometric processing on vertex sequence 0 is performed based on the vertex shading and primitive assembly results. Graphics processing module 1 performs vertex shading and primitive assembly processing on vertex sequence 1 in parallel. After both vertex shading and primitive assembly are completed, subsequent geometric processing on vertex sequence 1 is performed based on the vertex shading and primitive assembly results. Graphics processing module 2 performs vertex shading and primitive assembly processing on vertex sequence 2 in parallel. After both vertex shading and primitive assembly are completed, subsequent geometric processing on vertex sequence 2 is performed based on the vertex shading and primitive assembly results. The processing procedures for vertex sequences 3 to 5 can be referenced from those for vertex sequences 0 to 2, and will not be elaborated here.

[0202] When a reset point exists, drawing commands and vertex sequences are simultaneously sent to both the vertex shading unit and the primitive assembly unit. (See reference...) Figure 7For graphics processing module 0, when the vertex shading unit performs vertex shading processing on vertex sequence 0, the primitive assembly unit simultaneously performs primitive assembly processing on vertex sequence 0. Similarly, the vertex shading unit of graphics processing module 1 can simultaneously perform vertex shading processing on vertex sequence 1, and the vertex shading unit of graphics processing module 2 can simultaneously perform vertex shading processing on vertex sequence 2. However, the primitive assembly unit of graphics processing module 1 must wait until graphics processing module 0 has completed its primitive assembly processing on vertex sequence 0 before it can perform primitive assembly processing on vertex sequence 1. Likewise, the primitive assembly unit of graphics processing module 2 must wait until graphics processing module 1 has completed its primitive assembly processing on vertex sequence 1 before it can perform primitive assembly processing on vertex sequence 2. For any graphics processing module, after completing the vertex shading processing and primitive assembly processing on the vertex sequence, the vertex shading results and primitive assembly results can be sent to the subsequent geometry processing unit, which will then perform subsequent geometric processing on the vertex sequence before starting to process the next vertex sequence. For example, for graphics processing module 0, after performing subsequent geometric processing on vertex sequence 0, it can perform vertex shading processing on vertex sequence 3. However, it needs to wait for graphics processing module 2 to complete the primitive assembly processing on vertex sequence 2 before performing primitive assembly processing on vertex sequence 3. For graphics processing module 1, after performing subsequent geometric processing on vertex sequence 1, it can perform vertex shading processing on vertex sequence 4. However, it needs to wait for graphics processing module 0 to complete the primitive assembly processing on vertex sequence 3 before performing primitive assembly processing on vertex sequence 4. The processing procedure for vertex sequence 5 by graphics processing module 2 is similar and will not be elaborated here.

[0203] Since primitive assembly only needs to determine whether each vertex is a reset point and assemble primitives according to the topology, primitive assembly is faster than vertex shading. Therefore, when a reset point exists, although the primitive assembly units of each graphics processing module need to communicate with each other and are processed serially, this processing time is covered by vertex shading. By adjusting the length of the vertex fragments, fully parallel geometric processing can be achieved.

[0204] The following describes the graphic processing method provided in the embodiments of this disclosure. Figure 4 The workflow of each component in the illustrated graphics processing device is described.

[0205] The configuration module sets the number of enabled graphics processing modules in the graphics processing device, the current module number, and the length of the metadata blocks processed by each module (i.e., the number of primitives processed). Based on this information, the configuration module calculates the indices (i.e., primitive partitioning rules) of the primitives that the current graphics processing module needs to process. For example, for a graphics processing device with four enabled modules, numbered 0, 1, 2, and 3, and processing K0, K1, K2, and K3 primitives respectively, then module 0 needs to perform geometric processing on primitives with indices from 0 to K0-1; and module 1 needs to perform geometric processing on primitives with indices from K0 to K0+K1-1.

[0206] The command reading unit reads control commands and drawing commands from the storage module. Both control commands and drawing commands are sent to the command and vertex sending unit, and drawing commands are also sent to the vertex data reading unit.

[0207] The vertex data reading unit receives drawing commands from the command reading unit and primitive partitioning rules calculated by the configuration module. It then reads vertices from the vertex data stream in the storage module to form a vertex sequence. Each drawing command contains one or more instances, each containing a number of vertices. The vertex sequence read by the vertex data reading unit is determined according to the primitive partitioning rules sent by the configuration module. For example, for graphics processing module number 1, it needs to read vertices of primitives with indices K0 to K0+K1-1. In this case, it first needs to skip the vertices of K0 primitives. The vertex data reading unit traverses the instances of the drawing commands, calculating the number of vertices to be skipped and the number of vertices that the current graphics processing module needs to process, based on the primitive topology type.

[0208] Table 1 shows the number of vertices corresponding to K primitives under different topologies in the embodiments of this disclosure.

[0209] Table 1

[0210]

[0211] Referring to Table 1, the first column of Table 1 represents the topology; the second column of Table 1 represents the number of vertices corresponding to the K primitives under various topologies when the primitives to be processed by the graphics processing module include the first primitive of the instance; the third column of Table 1 represents the number of vertices corresponding to the K primitives under various topologies when the primitives to be processed by the graphics processing module do not include the first primitive of the instance.

[0212] Taking the second row of Table 1 as an example, when the primitives to be processed by the graphics processing module include the first primitive of the instance, for a point list type topology, K primitives correspond to K vertices; when the primitives to be processed by the graphics processing module do not include the first primitive of the instance, for a point list type topology, K primitives correspond to K vertices. Other types of topologies are shown in Table 1 and will not be elaborated here.

[0213] The vertex data reading unit maintains a counter to count the primitives and, according to the correspondence in Table 1, skips or reads the vertices corresponding to several primitives.

[0214] Furthermore, for topologies with shared vertices (shared indices), if the vertex data reading unit does not start reading vertices from the first primitive of an instance (i.e., skips the first primitive), then shared vertices need to be read before reading vertex fragments. Shared vertices are one or more vertices adjacent to the vertex fragment before it is read. The number of shared vertices is determined based on the topology.

[0215] Table 2 shows the number of shared vertices under different topologies provided in the embodiments of this disclosure.

[0216] Table 2

[0217]

[0218] Referring to Table 2, the second row of Table 2 represents the topology of the line strip type. If the first primitive of the instance is skipped, one shared vertex needs to be read. Other types of topologies can be found in Table 2, and will not be elaborated here.

[0219] It should be noted that for cyclic lines and triangular fan-type topologies, if the first primitive of an instance is skipped, the first vertex of the instance must be read before reading the vertex data. In other words, the vertex sequence may include the first vertex of the instance in addition to shared vertices, vertex fragments, and suffix vertices.

[0220] The drawing command explicitly defines whether a reset point exists in the vertex sequence. If no reset point exists, the vertex data reading unit only needs to read vertex fragments. If a reset point exists, the vertex data reading unit needs to read suffix vertices in addition to vertex fragments. Suffix vertices are one or more vertices adjacent to and following a vertex fragment. The number of suffix vertices is determined by the topology.

[0221] Table 3 shows the number of suffix vertices under different topologies provided in the embodiments of this disclosure.

[0222] Table 3

[0223]

[0224] Referring to Table 3, the second row of Table 3 represents the topology of the point list type. In the case of a reset point, the number of suffix vertices is 0. The number of suffix vertices for other topology types can be found in Table 3, and will not be repeated here. Here, K represents the number of primitives.

[0225] The command and vertex sending unit receives commands from the command reading unit and vertex sequences from the vertex reading unit, and then sends them to the vertex shading unit and the primitive assembly unit. The command and vertex sending unit sequentially sends commands to the vertex shading unit and the primitive assembly unit. After sending a drawing command, it receives the vertex sequence belonging to that drawing command from the vertex data reading unit and sends it down. Then it continues to receive commands from the command reading module.

[0226] The vertex shader unit receives commands and vertex sequences from the vertex sending unit. Based on the commands, it performs configuration tasks and vertex shader processing on the received vertex sequences. The vertex shader unit does not distinguish between vertices in a vertex fragment and suffix vertices.

[0227] The primitive assembly unit receives commands and vertex sequences sent by the vertex sending module, and assembles the vertices in the vertex sequence into primitives. If the drawing command indicates that there is no reset point, then the vertices received by the primitive assembly unit are all vertices in the vertex fragment. The primitive processing unit immediately performs primitive assembly on the vertices and sends the assembled primitives to the subsequent geometry processing module. If the drawing command indicates that there is a reset point, then the primitive assemblers of each graphics processing module need to communicate. Except for the initial vertex fragment of graphics processing module 0, each graphics processing module needs to wait for the primitive assembly of the previous graphics processing module to complete and send the following information: initial state information. This initial state information includes one or more of the following: starting primitive index, primitive orientation, and starting vertex offset. In this embodiment, the initial state information sent by the previous graphics processing module to the current graphics processing module is called the first initial state information, and the initial state information sent by the current graphics processing module to the next graphics processing module is called the second initial state information.

[0228] The initial state information is explained below with examples.

[0229] In one example, the graphics processing device includes three graphics processing modules: graphics processing module 0, graphics processing module 1, and graphics processing module 2. Each graphics processing module processes a data block of K primitives. Assuming the topology is a triangular band, each graphics processing module reads a vertex sequence including two shared vertices (obtained from table 2), a vertex fragment, and two suffix vertices (obtained from table 3). The vertex fragment includes S vertices (obtained from table 1). Graphics processing module 0 first performs primitive assembly processing.

[0230] If there is no reset point in the vertex fragment, the vertex fragment can be assembled into K primitives, whose indices are from 0 to K-1. At this time, the initial state information sent by the graphics processing module 0 to the graphics processing module 1 has a starting primitive index of K (that is, the index of the primitives assembled by the graphics processing module 1 starts from K), the primitive orientation is clockwise (K is an even number) or counterclockwise (K is an odd number), and the starting vertex offset is 0 (that is, the graphics processing module 1 does not need to discard the starting vertex when assembling primitives).

[0231] If a reset point exists in a vertex fragment, the vertex fragment and suffix vertices together can be assembled into K-1 primitives, with indices from 0 to K-2. At this time, the initial state information sent by graphics processing module 1 to graphics processing module 2 indicates that the starting primitive index is K-1 (i.e., the index of the primitives assembled by graphics processing module 1 starts from K-1), the primitive orientation is counterclockwise (K is even) or clockwise (K is odd), and the starting vertex offset is 2 (i.e., the number of suffix vertices in graphics processing module 0, indicating that graphics processing module 1 needs to discard the first 2 vertices when assembling primitives).

[0232] If multiple reset points exist within a vertex fragment, the actual number of primitives that can be assembled from the vertex fragment and suffix vertices can be determined according to the primitive assembly rules of the topology. Assuming that A primitives can be assembled (indices from 0 to A-1), the initial state information sent from graphics processing module 0 to graphics processing module 1 uses the starting primitive index A, with the primitive orientation being clockwise (A is even) or counterclockwise (A is odd), and the starting vertex offset being the number of suffix vertices. It should be noted that in topologies with triangle strips and control packet lists containing adjacency information, the starting vertex offset is not the number of suffix vertices.

[0233] Figure 8 This is an exemplary schematic diagram of a primitive assembly process provided in an embodiment of the present disclosure. Assume that for vertex sequence 0, graphics processing module 0 performs primitive assembly processing to obtain primitive assembly result 0; for vertex sequence 1, graphics processing module 1 performs primitive assembly processing to obtain primitive assembly result 1.

[0234] Reference Figure 8When the drawing command indicates that there is no reset point, the graphics processing module 0 and the graphics processing module 1 execute the primitive assembly process in parallel and independently. The primitive assembly process of the graphics processing module 0 and the graphics processing module 1 does not need to rely on the initial state information.

[0235] Vertex sequence 0 includes shared vertices S0 and S1, and vertices V0, V1, ..., V7 in the vertex segment; vertex sequence 1 includes shared vertices S2 and S3, and vertices V8, V9, ..., V15 in the vertex segment. It should be understood that vertices V6 and V7 in the vertex segment of vertex sequence 0 coincide with shared vertices S2 and S3 in vertex sequence 1, respectively.

[0236] Reference Figure 8 In the case of a triangular band topology, graphics processing module 0 can assemble 8 primitives, such as... Figure 8 The triangles formed by S0, S1, and V0, and the triangles formed by S1, V0, and V1, are shown, with indices from 0 to 7; the graphics processing module 1 can assemble 8 primitives, such as... Figure 8 The triangles formed by S2, S3, and V8, and the triangles formed by S3, V8, and V9, etc., have indices from 8 to 15. Therefore, in the initial state information sent from graphics processing module 0 to graphics processing module 1, the starting primitive index is 8, the primitive orientation is clockwise, and the starting vertex offset is 0.

[0237] Figure 9 This is an exemplary schematic diagram of a primitive assembly process provided in an embodiment of the present disclosure. Assume that for vertex sequence 0, graphics processing module 0 performs primitive assembly processing to obtain primitive assembly result 0; for vertex sequence 1, graphics processing module 1 performs primitive assembly processing to obtain primitive assembly result 1.

[0238] Reference Figure 9 When a drawing command indicates the existence of a reset point, the primitive processing module 0 and the graphics processing module 1 communicate with each other, and the graphics processing module 0 sends initial state information to the graphics processing module 1.

[0239] Vertex sequence 0 includes shared vertices S0 and S1, vertices V0, V1, ..., V7 in the vertex segment, and suffix vertices V8 and V9, where vertex V4 in the vertex segment is the reset point; Vertex sequence 1 includes shared vertices S2 and S3, and vertices V8, V9, ..., V15 in the vertex segment.

[0240] Reference Figure 9 In the case of a triangular zone topology, graphics processing module 0 can assemble 7 primitives, such as... Figure 9The triangles formed by S0, S1, and V0, S1, V0, and V1, and V5, V6, and V7, etc., are indexed from 0 to 6. Therefore, in the initial state information sent from graphics processing module 0 to graphics processing module 1, the starting primitive index is 7, the primitive orientation is counterclockwise, and the starting vertex offset is 2.

[0241] After receiving the initial state information from the graphics processing module 1, it performs primitive assembly processing, discarding the first two vertices V8 and V9 in the vertex segment. At this point, the starting vertices for primitive assembly are actually the shared vertices S2 and S3. It should be understood that the shared vertices S2 and S3 here coincide with vertices V8 and V9. Since there are no reset points in vertex sequence 1 of the graphics processing module 1, it does not use suffix vertices, and a total of 6 primitives can be assembled, such as... Figure 9 The triangles formed by V8, V9, and V10, and the triangles formed by V9, V10, and V11, etc., have indices from 7 to 12. Therefore, in the initial state information sent by graphics processing module 1 to the next graphics processing module, the starting primitive index is 13 and the starting vertex offset is 0.

[0242] Graphics processing module 1 can assemble 8 primitives, such as Figure 9 The triangles formed by S2, S3, and V8, and the triangles formed by S3, V8, and V9, etc., have indices from 8 to 15. Therefore, in the initial state information sent from graphics processing module 0 to graphics processing module 1, the starting primitive index is 8, the primitive orientation is clockwise, and the starting vertex offset is 0.

[0243] Figure 10 This is a block diagram of an electronic device provided in an embodiment of the present disclosure.

[0244] Reference Figure 10 This disclosure provides an electronic device, which includes: at least one processor 701; at least one memory 702; and one or more I / O interfaces 703 connected between the processor 701 and the memory 702; wherein the memory 702 stores one or more computer programs that can be executed by the at least one processor 701, and the one or more computer programs are executed by the at least one processor 701 to enable the at least one processor 701 to perform the above-described graphics processing method.

[0245] This disclosure also provides a computer-readable storage medium storing a computer program thereon, wherein the computer program, when executed by a processor, implements the above-described graphics processing method. The computer-readable storage medium may be volatile or non-volatile.

[0246] Those skilled in the art will understand that all or some of the steps, systems, and apparatuses disclosed above, and their functional modules / units, can be implemented as software, firmware, hardware, or suitable combinations thereof. In hardware implementations, the division between functional modules / units mentioned above does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed collaboratively by several physical components. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit (ASIC). Such software can be distributed on a computer-readable storage medium, which may include computer storage media (or non-transitory media) and communication media (or transient media).

[0247] As is known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information, such as computer-readable program instructions, data structures, program modules, or other data. Computer storage media includes, but is not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), static random access memory (SRAM), flash memory or other memory technologies, portable compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, it is known to those skilled in the art that communication media typically contain computer-readable program instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.

[0248] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.

[0249] Computer program instructions used to perform the operations of this disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, status setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Smalltalk, C++, etc., and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing the status information of the computer-readable program instructions to implement various aspects of this disclosure.

[0250] The computer program product described herein can be implemented specifically through hardware, software, or a combination thereof. In one alternative embodiment, the computer program product is specifically embodied in a computer storage medium; in another alternative embodiment, the computer program product is specifically embodied in a software product, such as a software development kit (SDK), etc.

[0251] Various aspects of this disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.

[0252] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.

[0253] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.

[0254] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0255] Example embodiments have been disclosed herein, and while specific terminology has been used, it is for illustrative purposes only and should be construed as such, and is not intended to be limiting. In some instances, it will be apparent to those skilled in the art that features, characteristics, and / or elements described in connection with particular embodiments may be used alone, or in combination with features, characteristics, and / or elements described in connection with other embodiments, unless otherwise expressly indicated. Therefore, those skilled in the art will understand that various changes in form and detail may be made without departing from the scope of this disclosure as set forth by the appended claims.

Claims

1. A graphics processing method, characterized in that, The method applies to any one of a plurality of parallel graphics processing modules in a graphics processing device, the method comprising: Upon receiving a drawing command, the current graphics processing module obtains the vertex sequence to be processed from the vertex data stream. The drawing command indicates whether there are reset points in the vertex data stream and the topology of the vertex data stream. The drawing command also indicates the number of reset points in the vertex sequence to be processed by the current graphics processing module. Vertex shading and primitive assembly are performed in parallel on the vertex sequence to obtain vertex shading results and primitive assembly results. During the primitive assembly process, if a reset point exists in the vertex data stream, primitive assembly is performed on the vertex sequence based on the topology and first initial state information sent by the previous graphics processing module to obtain the primitive assembly result. The first initial state information indicates the initial state of the current graphics processing module's primitive assembly process. The first initial state information includes a starting vertex offset, which is determined by the previous graphics processing module based on the number of reset points in its vertex sequence. If no reset point exists in the vertex data stream, primitive assembly is performed on the vertex sequence based on the topology to obtain the primitive assembly result. Subsequent geometric processing is performed based on the vertex coloring results and the primitive assembly results.

2. The method according to claim 1, characterized in that, The method further includes: If a reset point exists in the vertex data stream, in response to the completion of the primitive assembly process, a second initial state information is sent to the next graphics processing module. The second initial state information is used to indicate the initial state of the primitive assembly process performed by the next graphics processing module.

3. The method according to claim 2, characterized in that, The drawing command also indicates the number of reset points in the vertex sequence, and the method further includes: The second initial state information is generated based on the end index of the primitives assembled by the current graphics processing module and the number of reset points in the vertex sequence.

4. The method according to claim 3, characterized in that, The step of generating the second initial state information based on the end index of the primitives assembled by the current graphics processing module and the number of reset points in the vertex sequence includes: Increment the end index of the primitive assembled by the current graphics processing module by one to obtain the start index of the primitive assembled by the next graphics processing module. Based on the parity of the starting index of the primitive assembled by the next graphics processing module, the orientation of the primitive when the next graphics processing module performs primitive assembly processing is determined. The starting vertex offset when the next graphics processing module performs primitive assembly processing is determined based on the number of reset points in the vertex sequence. The second initial state information is determined based on one or more of the following: the starting index of the primitive assembled by the next graphics processing module, the orientation of the primitive during primitive assembly, and the starting vertex offset during primitive assembly.

5. The method according to claim 4, characterized in that, The step of determining the starting vertex offset for primitive assembly processing in the next graphics processing module based on the number of reset points in the vertex sequence includes: If the number of reset points in the vertex sequence is zero, the offset of the starting vertex is determined to be zero.

6. The method according to claim 4, characterized in that, The step of determining the starting vertex offset for primitive assembly processing in the next graphics processing module based on the number of reset points in the vertex sequence includes: When the number of reset points in the vertex sequence is one, the number of suffix vertices is determined according to the topology, and the number of suffix vertices is determined as the offset of the starting vertex. The suffix vertex represents one or more vertices that are after the vertex segment and adjacent to the vertex segment.

7. The method according to claim 4, characterized in that, The step of determining the starting vertex offset for primitive assembly processing in the next graphics processing module based on the number of reset points in the vertex sequence includes: When there are multiple reset points in the vertex sequence, the offset of the starting vertex is determined according to the topology.

8. The method according to claim 7, characterized in that, When there are multiple reset points in the vertex sequence, determining the starting vertex offset based on the topology includes: When there are multiple reset points in the vertex sequence and the topology is the target topology, the number of suffix vertices is determined according to the target topology, and the number of suffix vertices is determined as the starting vertex offset. The suffix vertex represents one or more vertices that are after the vertex segment and adjacent to the vertex segment. When there are multiple reset points in the vertex sequence and the topology is a triangle strip with adjacency information, the number of suffix vertices used by the last primitive assembled by the current graphics processing module is obtained; if the number of suffix vertices used is odd, the first value is determined as the starting vertex offset; if the number of suffix vertices used is even, the second value is determined as the starting vertex offset, wherein the first value is even, the second value is odd, and the first value is less than the second value. When there are multiple reset points in the vertex sequence and the topology is a control packet list including Q points, the remainder obtained by dividing M by Q is determined as the starting vertex offset, where M represents the number of vertices between the first target point and the second target point, the first target point represents the last reset point of the vertex sequence, the second target point represents the last vertex in the vertex sequence excluding suffix vertices, and M and Q are positive integers; The target topology refers to the topology other than the triangular strip with adjacency information and the control packet list including Q points.

9. The method according to claim 1, characterized in that, The step of obtaining the vertex sequence that the current graphics processing module needs to process from the vertex data stream includes: Determine the primitive partitioning rules of the current graphics processing module, wherein the primitive partitioning rules are used to indicate the index of the primitives assigned to the current graphics processing module for processing; The vertex sequence is read from the vertex data stream according to the primitive partitioning rules and the topology.

10. The method according to claim 9, characterized in that, The step of reading the vertex sequence from the vertex data stream according to the primitive partitioning rules and the topology includes: Vertex fragments are read from the vertex data stream according to the primitive partitioning rules and the topology; The vertex sequence is constructed based on the vertices in the vertex fragment; If a reset point exists in the vertex sequence, a suffix vertex is read according to the topology and added to the vertex sequence. The suffix vertex represents one or more vertices that follow and are adjacent to the vertex segment.

11. The method according to claim 10, characterized in that, The step of reading vertex fragments from the vertex data stream according to the primitive partitioning rules and the topology includes: The number of graphics elements that the current graphics processing module needs to skip and the number of graphics elements that need to be processed are determined according to the graphics element partitioning rules. Based on the topology and the number of primitives to be skipped, determine the number of vertices that the current graphics processing module needs to skip when reading a vertex fragment, and based on the topology and the number of primitives to be processed, determine the number of vertices contained in the vertex fragment read by the current graphics processing module. The vertex fragment is read from the vertex data stream based on the number of vertices to be skipped and the number of vertices contained in the vertex fragment.

12. The method according to claim 10, characterized in that, The drawing command includes one or more instances, each instance containing one or more primitives; the step of reading the vertex sequence from the vertex data stream according to the primitive partitioning rules and the topology further includes: In the case where the topology includes shared vertices and the primitives to be processed by the current graphics processing module do not include the first primitive of any instance, the shared vertices are read according to the topology and added to the vertex sequence. The shared vertices represent one or more vertices that precede and are adjacent to the vertex segment.

13. The method according to claim 9, characterized in that, The step of determining the primitive partitioning rules of the current graphics processing module includes: The primitive partitioning rule of the current graphics processing module is determined based on the number of enabled graphics processing modules in the graphics processing device, the number of primitives processed by each graphics processing module, and the number of the current graphics processing module.

14. The method according to claim 13, characterized in that, The number of primitives processed by the graphics processing module is set to K. The time taken by the current graphics processing module to perform vertex shading and primitive assembly processing on K primitives is a first time and a second time, respectively. The difference between the first time and the second time is greater than the information waiting time. The start time of the information waiting period is the start time of the vertex shading process, and the end time of the information waiting period is the time when the first initial state information sent by the previous graphics processing module is received.

15. The method according to claim 4, characterized in that, The first initial state information further includes a starting primitive index and / or primitive orientation; wherein, the starting primitive index is used to indicate the starting index of the primitive assembled by the current graphics processing module; the primitive orientation is used to indicate the order in which the current graphics processing module assembles the primitives; and the starting vertex offset is used to indicate the position of the starting vertex in the vertex sequence when the current graphics processing module performs primitive assembly processing.

16. A graphics processing apparatus, characterized in that, It includes multiple parallel graphics processing modules, and any one of the multiple parallel graphics processing modules includes: A vertex data reading unit is used to obtain the vertex sequence that the current graphics processing module needs to process from the vertex data stream when a drawing command is received. The drawing command indicates whether there are reset points in the vertex data stream and the topology of the vertex data stream. The drawing command also indicates the number of reset points in the vertex sequence that the current graphics processing module needs to process. A vertex coloring unit is used to perform vertex coloring processing on the vertex sequence to obtain vertex coloring results; The primitive assembly unit, operating in parallel with the vertex shading unit, performs primitive assembly processing on the vertex sequence to obtain a primitive assembly result. During the process of obtaining the primitive assembly result from the vertex sequence, if reset points exist in the vertex sequence, primitive assembly processing is performed on the vertex sequence based on the topology and first initial state information sent by the previous graphics processing module to obtain the primitive assembly result. The first initial state information indicates the initial state of the current graphics processing module's primitive assembly processing. The first initial state information includes a starting vertex offset, which is determined by the previous graphics processing module based on the number of reset points in its vertex sequence. If no reset points exist in the vertex data stream, primitive assembly processing is performed on the vertex sequence based on the topology to obtain the primitive assembly result. The subsequent geometry processing unit is used to perform subsequent geometry processing based on the vertex shading results and the primitive assembly results.

17. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores one or more computer programs that can be executed by the at least one processor, the one or more computer programs being executed by the at least one processor to enable the at least one processor to perform the graphics processing method as described in any one of claims 1-15.

18. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the graphics processing method as described in any one of claims 1-15.

Citation Information

Patent Citations

  • Graph processing method and system, computing device and storage medium

    CN122265016A