Geometry processing method, processor, equipment, device, storage medium and product
By merging and selecting a load-balanced second pipeline to process primitives through the primitive distribution module, the problem of unbalanced load in the traditional geometry processing pipeline is solved, thus improving the geometry processing performance of the GPU.
Patent Information
- Application Number
- CN202511468913.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-14
- Publication Date
- 2026-01-30
AI Technical Summary
Traditional geometry processing pipelines do not consider the uneven load between the temporal shader and geometry shader when the surface subdivision unit processes the subdivided graph data, which affects the overall performance of the GPU.
The primitive distribution module obtains the primitives to be processed and the historical working parameters of each second pipeline, selects the target second pipeline that meets the preset load balancing conditions for processing, and realizes the merging and distribution of geometric data streams.
It improves the processing efficiency of the geometry processing stage and enhances the geometry processing performance of the graphics processor.
Smart Images

Figure CN121437243A_ABST
Abstract
Description
Technical Field
[0001] This application relates to, but is not limited to, the field of image processing technology, and in particular to a geometric processing method, processor, device, apparatus, storage medium, and product. Background Technology
[0002] A Graphics Processing Unit (GPU) is a dedicated graphics rendering device used to process and display computerized graphics. A GPU typically consists of a front-end geometry processing pipeline and a back-end pixel processing pipeline. Traditional geometry processing pipeline implementations only perform load balancing based on vertex shaders (VS), failing to consider the uneven load distribution among stream processing units (SPUs) when processing subdivided primitive data by the domain shader (DS) and geometry shader (GS). This imbalance can negatively impact the overall performance of the GPU. Summary of the Invention
[0003] In view of this, embodiments of this application provide at least one geometry processing method, processor, device, apparatus, storage medium, and product.
[0004] The technical solution of this application embodiment is implemented as follows: On one hand, embodiments of this application provide a geometry processing method applied in a graphics processor. The graphics processor includes a first pipeline, a primitive distribution module, and at least two second pipelines. The geometry processing method includes: obtaining the primitives to be processed output by the first pipeline and the historical operating parameters of each second pipeline through the primitive distribution module; determining a target second pipeline from at least two second pipelines based on the historical operating parameters of each second pipeline through the primitive distribution module; distributing the primitives to be processed to the target second pipeline through the primitive distribution module; and processing the primitives to be processed through the target second pipeline.
[0005] On the other hand, embodiments of this application provide a graphics processor, which includes a first pipeline, a primitive distribution module, and at least two second pipelines; wherein, the primitive distribution module is used to acquire the primitives to be processed output by the first pipeline and the historical operating parameters of each second pipeline; the primitive distribution module is also used to determine a target second pipeline from the at least two second pipelines based on the historical operating parameters of each second pipeline; the primitive distribution module is also used to distribute the primitives to be processed to the target second pipeline; the target second pipeline is used to process the primitives to be processed.
[0006] In another aspect, embodiments of this application provide a computer device including a memory and a processor. The memory stores a computer program that can run on the processor, and when the processor executes the program, it implements some or all of the steps in the above-described geometric processing method.
[0007] In another aspect, embodiments of this application provide a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements some or all of the steps in the above-described geometric processing method.
[0008] In another aspect, embodiments of this application provide a computer program product, including a computer program or instructions, which, when executed by a processor, implement some or all of the steps in the above-described geometric processing method.
[0009] In this embodiment, the primitives to be processed output by the first pipeline are obtained through the primitive distribution module, thereby merging the geometric data stream. Based on the historical working parameters of at least two second pipelines, a target second pipeline for processing the primitives to be processed is selected from at least two second pipelines, thereby merging and redistributing the geometric data stream. This enables the distribution and processing of the primitives to be processed while taking into account the load balancing of each second pipeline, which can significantly improve the processing efficiency of the geometric processing stage and thus improve the geometric processing performance of the graphics processor.
[0010] It should be understood that the above general description and the following detailed description are merely exemplary and explanatory, and are not intended to limit the technical solutions of this application. Attached Figure Description
[0011] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with this application and, together with the specification, serve to explain the technical solutions of this application.
[0012] Figure 1 This application provides a schematic diagram of the composition structure of a conventional geometric pipeline. Figure 2 A schematic diagram of the implementation process of a geometric processing method provided in this application embodiment. Figure 1 ; Figure 3 A schematic diagram of the composition structure of a geometric pipeline provided in this application embodiment. Figure 1 ; Figure 4 A schematic diagram of the composition structure of a geometric pipeline provided in this application embodiment. Figure 2 ; Figure 5 A schematic diagram of the implementation process of a geometric processing method provided in this application embodiment. Figure 2 ; Figure 6 A schematic diagram of the implementation process of a geometric processing method provided in this application embodiment. Figure 3 ; Figure 7 A schematic diagram of the implementation process of a geometric processing method provided in this application embodiment. Figure 4 ; Figure 8 This application provides a schematic diagram of the implementation process for finding the minimum cumulative number of vertices to be processed, as illustrated in an embodiment of the present application. Figure 9 A schematic diagram of the composition structure of a graphics processor provided in an embodiment of this application; Figure 10 This is a schematic diagram of the composition structure of a geometric processing device provided in an embodiment of this application; Figure 11 This is a schematic diagram of the hardware entity of a computer device provided in an embodiment of this application. Detailed Implementation
[0013] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application are further described in detail below with reference to the accompanying drawings and embodiments. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0014] In the following description, references to "some embodiments" refer to a subset of all possible embodiments. It is understood that "some embodiments" may be the same or different subsets of all possible embodiments and may be combined with each other without conflict. The terms "first / second / third" are used merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first / second / third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0015] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains. The terminology used herein is for descriptive purposes only and is not intended to limit the scope of this application.
[0016] In traditional implementations of geometry pipelines, only load balancing based on the VS shader is typically performed, such as... Figure 1As shown, a graphics processor typically includes a load balancing module 100 and at least two geometry processing pipelines 110. Each conventional geometry processing pipeline 110 includes at least a vertex shader 1101, a hull shader (HS) 1102, a tessellation unit 1103, a domain shader 1104, and a geometry shader 1105.
[0017] exist Figure 1 In the process, the load balancing module 100 can distribute different primitives to be processed in the input geometric data stream to at least two geometric processing pipelines 110 through the first load balancing. For example, after the load balancing module 100 obtains a primitive to be processed from the geometric data stream, it first selects one geometric processing pipeline from the at least two geometric processing pipelines 110 and inputs the primitive to be processed into that geometric processing pipeline. Then, after obtaining the next primitive to be processed, the load balancing module 100 may consider inputting the primitive to be processed into another geometric processing pipeline 110 from the at least two geometric processing pipelines 110.
[0018] Furthermore, after receiving the primitive to be processed, the geometry processing pipeline 110 first processes the vertex data in the primitive to be processed through the vertex shader 1101, and then inputs the processed vertex data into the shell shader 1102.
[0019] Furthermore, the shell shader 1102 calculates the tessellation factors of the primitives to be processed as needed, and inputs the tessellation factors and the processed vertex data into the surface tessellation unit 1103; wherein, the tessellation factors determine how to subdivide the input primitive data into smaller primitives, and the tessellation factors can be determined based on a variety of factors, such as the complexity of the model, the distance from the observer, etc.
[0020] Furthermore, the tessellation unit 1103 inserts new vertices into the processed vertex data according to the tessellation factor, thereby generating a denser mesh. These newly generated vertices will be used in subsequent rendering processes to provide finer geometric details, and the tessellated vertex data will be input into the domain shader 1104.
[0021] Furthermore, the domain shader 1104 receives the subdivided vertex data, calculates the final positions of these subdivided vertices, and can input the vertex positions of the subdivided points into the geometry shader 1105; at the same time, the domain shader 1104 can also perform other calculations, such as lighting and texture coordinate generation, to further enrich the rendering effect.
[0022] Furthermore, the geometry shader 1105 can further process and transform the vertex positions of the subdivision points to generate more complex geometric shapes and effects. Finally, the output data is sent to the rasterization stage for pixelation and rendered onto the screen.
[0023] However, the above-mentioned traditional geometry processing pipeline implementation only performs load balancing based on vertex shaders, and does not consider the problem of unbalanced load between SPUs when the domain shader 1104 and geometry shader 1105 process the subdivided primitive data after the surface tessellation unit subdivides the primitives to be processed, which will affect the overall performance of the GPU.
[0024] To address the aforementioned technical problems, embodiments of this application provide a geometric processing method that can be executed by the graphics processor of a computer device. The computer device refers to any device with data processing capabilities, such as a server, laptop, tablet, desktop computer, smart TV, set-top box, or mobile device (e.g., mobile phone, portable video player, personal digital assistant, dedicated messaging device, portable gaming device).
[0025] Figure 2 A schematic diagram of the implementation process of a geometric processing method provided in this application embodiment. Figure 1 This is applied to the primitive distribution module in a graphics processing unit (GPU). The GPU also includes a first pipeline and at least two second pipelines, such as... Figure 2 As shown, the geometric processing method includes the following steps S101 to S103: Step S101: Obtain the primitive to be processed output by the first pipeline and the cumulative number of vertices processed by the shader in each second pipeline; each second pipeline includes a tessellation unit and a shader, the shader being used to process the vertices of the primitive to be processed after the tessellation unit performs tessellation.
[0026] In some embodiments, the first pipeline and the second pipeline constitute a geometry processing pipeline, which is used to implement a geometry processing flow for primitives to be processed.
[0027] In some embodiments, in the current graphics processor, the primitive distribution module is located between a first pipeline and at least two second pipelines. The primitive distribution module is connected to both each first pipeline and each second pipeline. Based on this, the primitive distribution module can acquire the primitives to be processed output after processing by the first pipeline and send them sequentially to subsequent second pipelines in a round-robin manner. To select the appropriate second pipeline for processing different primitives from the at least two second pipelines, the primitive distribution module also needs to acquire the cumulative number of vertices processed by the shaders in each second pipeline. Here, the cumulative number of vertices processed by the shaders in each second pipeline can be read from each second pipeline or passively received; the current embodiment does not limit this.
[0028] In some embodiments, the number of primitives to be processed may be the same as or different from the number of first pipelines. For example, when the number of primitives to be processed is the same as the number of first pipelines, each first pipeline will output one primitive to be processed after being processed by the first pipeline. When the number of primitives to be processed is different from the number of first pipelines, some first pipelines may output multiple primitives to be processed after being processed by the first pipeline, while some first pipelines may only output one or zero primitives to be processed. The current embodiment does not limit this.
[0029] In some embodiments, after the primitive distribution module obtains one or more primitives to be processed after being processed by the first pipeline, it distributes the primitives to be processed to the corresponding target second pipeline in turn based on the cumulative number of vertices processed by the shaders in each second pipeline.
[0030] It should also be noted that the primitive distribution module can also distribute the primitives to be processed to the corresponding second pipeline in turn based on one or more of the following: the SPU usage of each second pipeline when processing the corresponding primitive, the cumulative time of each second pipeline in the working state, the average processing time of each second pipeline when processing the corresponding primitive, the cumulative number of primitives processed by each second pipeline, and the cumulative number of vertices processed by each second pipeline. The current embodiment does not limit this.
[0031] In step S101 above, the primitive distribution module of the graphics processor obtains the primitive data to be processed after being processed by the first pipeline. In fact, it merges the primitive data and obtains the cumulative number of vertices processed by the shader in each second pipeline to prepare for the subsequent distribution of primitives to be processed.
[0032] Step S102: Based on the cumulative number of vertices processed by the shaders in each second pipeline, determine the second pipeline that satisfies the preset load balancing condition from at least two second pipelines as the target second pipeline.
[0033] In some embodiments, after the primitive distribution module obtains a primitive to be processed from the output of a first pipeline, it selects a second pipeline that meets a preset load balancing condition from at least two second pipelines as the target second pipeline for processing the primitive to be processed, based on the cumulative number of vertices processed by the shaders in each second pipeline. Here, the number of target second pipelines can be one or at least two.
[0034] It should be noted that the preset load balancing conditions are used to specify the standards that the determined second pipelines need to meet. These standards are meant to make the load of each second pipeline more balanced and avoid the problem of some pipelines having high loads and some pipelines having low loads.
[0035] In some embodiments, the preset load balancing condition includes the cumulative number of vertices processed by the shader being less than a first threshold. Thus, the primitive distribution module can determine the cumulative number of vertices processed that is less than the first threshold among at least two cumulative number of vertices processed, and then determine one or more second pipelines corresponding to the cumulative number of vertices processed that is less than the first threshold as target second pipelines.
[0036] The cumulative number of vertices processed can be understood as how many vertices the shader in each second pipeline has processed in the past. It can be the total number of vertices processed in the past, or the number of vertices processed within a fixed time period. The specific historical working parameters can be determined according to the actual situation, and the current embodiment does not limit this.
[0037] In some embodiments, after the primitive distribution module obtains the primitives to be processed output by the first pipeline and the cumulative number of processed vertices of the shaders in each second pipeline, it can determine the second pipeline corresponding to the cumulative number of processed vertices that is less than the first threshold value among at least two cumulative number of processed vertices as the target second pipeline. At this time, the number of target second pipelines can be one or at least two. The specific method of determining the target second pipeline can be selected according to the actual situation, and the current embodiment does not limit this.
[0038] It should be noted that each second pipeline includes a subdivision unit and a shader. The shader can be a domain shader or a geometry shader, and the current embodiment does not limit this.
[0039] Based on the above embodiments, it should also be noted that, in addition to selecting a target second pipeline from at least two second pipelines based on the cumulative number of vertices processed by the shaders in each second pipeline, the primitive distribution module can also select a target second pipeline from at least two second pipelines based on the SPU occupancy of each second pipeline when processing the corresponding primitive to be processed most recently. For example, the primitive distribution module can determine the smallest one or more SPU occupancy among the at least two SPU occupancy conditions corresponding to at least two second pipelines, and then determine the one or more second pipelines corresponding to the smallest one or more SPU occupancy conditions as the target second pipelines.
[0040] It should also be noted that the primitive distribution module can select a target second pipeline from at least two second pipelines based on the cumulative time of each second pipeline in the working state. For example, the primitive distribution module can determine the smallest one or more cumulative times among the at least two cumulative times corresponding to at least two second pipelines, and then determine one or more second pipelines corresponding to the smallest one or more cumulative times as the target second pipelines.
[0041] It should also be noted that the primitive distribution module can select a target second pipeline from at least two second pipelines based on the average processing time of each second pipeline when processing the corresponding primitive. For example, the primitive distribution module can determine the minimum average processing time among the at least two average processing times corresponding to at least two second pipelines, and then determine one or more second pipelines corresponding to the minimum one or more average processing times as the target second pipelines.
[0042] It should also be noted that the primitive distribution module can select a target second pipeline from at least two second pipelines based on the cumulative number of primitives processed for each second pipeline. For example, the primitive distribution module can determine the smallest cumulative number of primitives processed among the at least two cumulative number of primitives processed corresponding to at least two second pipelines, and then determine one or more second pipelines corresponding to the smallest one or more cumulative number of primitives processed as the target second pipeline.
[0043] Step S103: Distribute the graphic elements to be processed to the target second pipeline to instruct the target second pipeline to process the graphic elements to be processed.
[0044] In some embodiments, the number of target second pipelines can be one or at least two. When there is only one target second pipeline, after obtaining the graphic element to be processed from the first pipeline, the graphic element distribution module can directly send the graphic element to be processed to the target second pipeline. When there are at least two target second pipelines, after obtaining the graphic element to be processed from the first pipeline, the graphic element distribution module can simultaneously send the graphic element to be processed to at least two target second pipelines, so that at least two target second pipelines can process the graphic element to be processed in parallel. The specific number of target second pipelines can be determined according to the actual situation, and the current embodiment does not limit this.
[0045] In some embodiments, reference Figure 3 ,exist Figure 1 Based on this, the geometry processing pipeline 110 can be divided into a first pipeline 120 and a second pipeline 130. The primitive distribution module 140 is disposed between the first pipeline 120 and the second pipeline 130. The first pipeline 120 may include a vertex shader 1101 and a shell shader 1102, and the second pipeline 130 may include a tessellation unit 1103, a domain shader 1104, and a geometry shader 1105. Therefore, the primitive distribution module 140 is positioned within the geometry processing pipeline 110 as the shell shader 1102 and the tessellation unit 1105. Between units 1103, the primitive distribution module 140 receives the primitives to be processed output by the shell shader 1102, and selects one or more second pipelines 130 (target second pipelines in the above embodiments) from the at least two second pipelines 130 according to the historical working parameters of the at least two second pipelines 130, and distributes the primitives to be processed to one or more second pipelines 130. The primitives to be processed are processed by the surface subdivision unit 1103, the domain shader 1104 and the geometry shader 1105 in the one or more second pipelines 130, and finally outputs the data.
[0046] In some embodiments, reference Figure 4 ,exist Figure 1Based on this, the geometry processing pipeline 110 can be divided into a first pipeline 120 and a second pipeline 130. The primitive distribution module 140 is located between the first pipeline 120 and the second pipeline 130. The first pipeline 120 may include a vertex shader 1101, and the second pipeline 130 may include a shell shader 1102, a tessellation unit 1103, a domain shader 1104, and a geometry shader 1105. Therefore, the primitive distribution module 140 is positioned within the geometry processing pipeline 110 between the vertex shader 1101 and the shell shader 1102. In between, the primitive distribution module 140 receives the primitives to be processed output by the vertex shader 1101, and selects one or more second pipelines 130 (target second pipelines in the above embodiments) from the at least two second pipelines 130 according to the historical working parameters of the at least two second pipelines 130, and distributes the primitives to be processed to the one or more second pipelines 130. The primitives to be processed are processed by the shell shader 1102, the tessellation unit 1103, the domain shader 1104 and the geometry shader 1105 in the one or more second pipelines 130, and finally outputs the data.
[0047] In this embodiment, the primitives to be processed output by the first pipeline are obtained through the primitive distribution module, thereby merging the geometric data stream. Based on the historical working parameters of at least two second pipelines, a target second pipeline for processing the primitives to be processed is selected from at least two second pipelines, thereby merging and redistributing the geometric data stream. This enables the distribution and processing of the primitives to be processed while taking into account the load balancing of each second pipeline, which can significantly improve the processing efficiency of the geometric processing stage and thus improve the geometric processing performance of the graphics processor.
[0048] Figure 5 A schematic diagram of the implementation process of a geometric processing method provided in this application embodiment. Figure 2 This method can be executed by the processor of a computer device. Based on Figure 2 , Figure 2 S103 in the middle can be updated to S501 to S502, which will combine Figure 5 The steps shown are explained.
[0049] Step S501: Obtain the subdivision factor corresponding to the graphic element to be processed; the subdivision factor represents the degree of subdivision when performing surface subdivision on the graphic element to be processed.
[0050] In some embodiments, after the primitive distribution module determines the target second pipeline from at least two second pipelines, it can obtain the subdivision factor corresponding to the primitive to be processed, wherein the subdivision factor represents the degree of subdivision when performing surface subdivision on the primitive to be processed.
[0051] It should be noted that the subdivision factor can be understood as the degree to which the primitive to be processed is subdivided when passing through the surface subdivision unit. The larger the subdivision factor, the stronger the degree to which the primitive to be processed is subdivided by the surface, thereby creating a more detailed picture. The specific subdivision factor can be determined according to the actual situation, and the current embodiment does not limit it.
[0052] Step S502: Distribute the subdivision factors and primitives to be processed to the target second pipeline.
[0053] In some embodiments, after obtaining the subdivision factor corresponding to the primitive to be processed, the primitive distribution module can simultaneously send the primitive to be processed and its subdivision factor to the determined target second pipeline. The surface subdivision unit in the target second pipeline can perform surface subdivision on the primitive to be processed based on the subdivision factor and output the subdivided vertices. Then, the shader can further process the subdivided vertices.
[0054] In some embodiments, with Figure 3 For example, the primitive distribution module 140 is located between the shell shader 1102 and the surface subdivision unit 1103. At this time, the primitive to be processed obtained by the primitive distribution module 140 is the primitive after being processed by the vertex shader 1101 and the shell shader 1102. Since the shell shader 1102 needs to calculate its corresponding subdivision factor when processing the primitive to be processed, when the shell shader 1102 outputs the primitive to be processed to the primitive distribution module 140, it will also output its corresponding subdivision factor along with the primitive to be processed to the primitive distribution module 140.
[0055] Figure 6 A schematic diagram of the implementation process of a geometric processing method provided in this application embodiment. Figure 3 This method can be executed by the processor of a computer device. The target second pipeline has multiple lines, based on... Figure 2 , Figure 2 S103 in the middle can be updated to S601 to S602, which will combine Figure 6 The steps shown are explained.
[0056] Step S601: After obtaining the subdivision factor corresponding to the primitive to be processed, assign a surface subdivision task to each second target pipeline; the surface subdivision task is used to instruct the surface subdivision unit in each target second pipeline to output the target vertex; the target vertex is a part of the vertices of the primitive to be processed after surface subdivision.
[0057] In some embodiments, when the number of target second pipelines determined from at least two second pipelines is multiple, the primitive distribution module can obtain the subdivision factor corresponding to the primitive to be processed and assign a surface subdivision task to each second target pipeline. The surface subdivision task is used to instruct the surface subdivision unit in the target second pipeline to output target vertices. The target vertices are a portion of the vertices of the primitive to be processed after surface subdivision.
[0058] In some embodiments, when there are multiple target second pipelines, the primitives to be processed can be processed in parallel through multiple target second pipelines.
[0059] In some embodiments, in order to enable at least two target second pipelines to process primitives in parallel, the primitive distribution module needs to assign a corresponding surface subdivision task to each target second pipeline. The surface subdivision task indicates to each target second pipeline which part of the primitives to be processed needs to be surface subdivided, and then each target second pipeline outputs a portion of the vertices of the primitives after surface subdivision, which are the target vertices.
[0060] Step S602: Send the primitive to be processed, subdivision factor, and corresponding assigned surface subdivision task to each target second pipeline, so as to instruct each target second pipeline to process the primitive to be processed based on the subdivision factor and the corresponding surface subdivision task.
[0061] In some embodiments, the surface subdivision task for each target pipeline is different, and each is a surface subdivision task for a portion of the primitive to be processed. Combining the surface subdivision tasks of at least two target pipelines is equivalent to a surface subdivision task for the entire primitive to be processed.
[0062] It should be noted that the primitive distribution module can send the primitive to be processed, the subdivision factor, and the surface subdivision task for each target pipeline to each target pipeline. Then, the surface subdivision unit in each target pipeline can perform surface subdivision on a part of the primitive to be processed according to the received surface subdivision task, and then input the subdivided part of the vertices into the shader for further processing.
[0063] Figure 7 This embodiment provides a schematic diagram of the implementation process of a geometric processing method. Figure 4 This method can be executed by the processor of a computer device. Based on Figure 6 , Figure 6 The S601 in the middle can be updated to S701 to S703, which will combine Figure 7 The steps shown are explained.
[0064] Step S701: Based on the subdivision factor, predict the number of vertices to be processed generated after the primitive to be processed is subdivided into surfaces by the surface subdivision unit.
[0065] In some embodiments, when the primitive distribution module predicts the number of vertices to be processed after the primitive to be processed is subdivided by the surface based on the subdivision factor, it needs to consider at least one or more of the subdivision algorithm of the surface subdivision unit, the initial shape of the primitive to be processed, and the subdivision mode of the surface subdivision unit.
[0066] It should be noted that the subdivision algorithms for surface subdivision units can include at least the Catmull-Clark Subdivision (Catmull-Clark) algorithm, the Loop subdivision algorithm, and the Doo-Sabin subdivision algorithm. The Catmull-Clark subdivision algorithm is suitable for arbitrarily polygonal mesh models, capable of creating higher-quality surfaces. It can gradually transform polygonal mesh models into quadrilateral mesh models through iterative calculations, achieving a transition from coarse to smooth. The Catmull-Clark subdivision algorithm is typically suitable for sphere models, task models, etc. The Loop subdivision algorithm is suitable for triangular networks. It can divide each triangle into multiple parts during the subdivision process, updating newly generated vertices and old vertices using different rules. The Doo-Sabin subdivision algorithm is suitable for quadrilateral networks. Compared to the Loop subdivision algorithm, the Doo-Sabin subdivision algorithm can handle more complex mesh structures, generating smoother and more uniform surfaces while maintaining the mesh's topology. It is suitable for applications requiring high-precision surface representation; based on this, the appropriate subdivision algorithm can be chosen based on the initial shape of the primitive to be processed.
[0067] It should be noted that the initial shape of the primitive to be processed can usually be a triangle, a quadrilateral, or a polygon. For a triangular mesh, each initial triangle will generate a new vertex during the surface subdivision process. For a quadrilateral mesh, each quadrilateral generates a new vertex. For a polygonal mesh, each polygon generates a new vertex. Therefore, the initial shape of the primitive to be processed, which reflects the initial number of vertices, is an important factor in predicting the number of vertices after surface subdivision.
[0068] It should be noted that the subdivision mode of a surface tessellation unit can be understood as the specific rules for surface tessellation. Different subdivision modes determine how a large primitive to be processed (such as a quadrilateral, triangle, or line segment) is subdivided into smaller primitives to increase the detail and realism of the rendered image. The subdivision modes of a surface tessellation unit can include at least the Quads mode, the Triangles mode, and the Isolines mode. Among them, the Quads mode is a subdivision model for quadrilaterals. In the Quads mode, each quadrilateral primitive is subdivided into multiple smaller quadrilaterals to increase the smoothness and detail of the surface. The Triangles mode is a subdivision model for... In the Triangles mode, each triangle primitive is subdivided into multiple smaller triangles to achieve a smooth surface transition. The Isolines mode is a special subdivision mode. Unlike the Quads and Triangles modes, which generate planar primitives (such as quadrilaterals or triangles), the Isolines mode generates line primitives (line segments). Therefore, the Isolines mode is a subdivision model for line segments. In the Isolines mode, multiple smaller line segments are generated along the direction of the line segment to increase the smoothness and detail of the curve. Based on this, the appropriate subdivision mode can be considered based on the initial shape of the primitive to be processed.
[0069] In some embodiments, when the primitive distribution module predicts the number of vertices to be processed after the primitive to be processed is subdivided by the surface based on the subdivision factor, it first determines the initial number of vertices of the primitive to be processed, then analyzes the subdivision rules according to the subdivision algorithm and subdivision mode set in the surface subdivision unit, calculates how many vertices will be added in each subdivision based on the subdivision factor, and obtains the predicted number of vertices to be processed.
[0070] For example, assuming that a mesh initially composed of N quadrilaterals is subdivided using the Quads pattern, and the subdivision factor is k, then, as shown in formula (1), the number of vertices M after subdivision can be roughly estimated as follows: (1); It should be noted that the number of vertices here is only an estimate, used as a reference for subsequent surface subdivision tasks.
[0071] Step S702: Generate the surface subdivision task for each target's second pipeline according to the number of vertices to be processed and the cumulative number of vertices processed for each target's second pipeline.
[0072] In some embodiments, after predicting the number of vertices to be processed corresponding to the primitive to be processed and obtaining the cumulative number of vertices processed by the shaders in each second pipeline, the primitive distribution module can divide the primitive to be processed according to at least two cumulative number of vertices processed by at least two second pipelines to obtain at least one primitive region included in the primitive to be processed, thereby generating subdivision information for each target second pipeline based on the region information of at least one primitive region.
[0073] For example, suppose the primitive distribution module predicts that the number of vertices to be processed for the primitive to be processed is 1000. Simultaneously, the number of target second pipelines is 3: pipeline 1, pipeline 2, and pipeline 3. Furthermore, pipeline 1 has a cumulative processed vertex count of 600, pipeline 2 has a cumulative processed vertex count of 700, and pipeline 3 has a cumulative processed vertex count of 1000. In this case, the primitive to be processed can be divided into 3 primitive regions: primitive region 1, primitive region 2, and primitive region 3. The number of vertices to be processed corresponding to primitive region 1 is approximately 500, primitive region 2 has approximately 400, and primitive region 3 has approximately 100. Therefore, in order to maintain the pipeline... Load balancing during the processing can be achieved by assigning pipeline 1, which has processed a cumulative total of 600 vertices, to primitive region 1, which has approximately 500 vertices to be processed; pipeline 2, which has processed a cumulative total of 700 vertices, to primitive region 2, which has approximately 400 vertices to be processed; and pipeline 3, which has processed a cumulative total of 1000 vertices, to primitive region 3, which has approximately 100 vertices to be processed. The sum of the cumulative number of vertices processed and the number of vertices to be processed for pipelines 1, 2, and 3 is approximately 1100. The partitioning is not limited to the above method and other partitioning methods are also possible. The overall idea is that as long as the cumulative number of vertices processed by each pipeline is approximately the same as the total number of vertices to be processed in the primitive region to be processed in this allocation, it is acceptable.
[0074] In other embodiments, the primitive distribution module may first randomly divide the primitives to be processed according to the number of target second pipelines to obtain at least two primitive regions. Then, based on the subdivision factor, it predicts the number of at least two unprocessed vertices generated after each primitive region is subdivided by the surface subdivision unit. Finally, it generates corresponding subdivision information for each target second pipeline according to the cumulative number of processed vertices of each target second pipeline and the predicted number of at least two unprocessed vertices.
[0075] For example, assuming the target second pipeline has three components: pipeline 1, pipeline 2, and pipeline 3, the primitive distribution module randomly divides the primitives to be processed into three primitive regions: primitive region 4, primitive region 5, and primitive region 6 based on the number of target second pipelines. Then, the primitive distribution module predicts the number of unprocessed vertices that primitive regions 4, 5, and 6 may generate after being subdivided by the surface subdivision unit based on the subdivision factor of the primitives to be processed. It can be seen that the number of unprocessed vertices corresponding to primitive region 4 is 700, the number of unprocessed vertices corresponding to primitive region 5 is 800, and the number of unprocessed vertices corresponding to primitive region 6 is 900. At the same time, the primitive distribution module obtains the cumulative number of processed vertices of pipeline 1 as 600 and the cumulative number of processed vertices of pipeline 2 as 700. The cumulative number of vertices processed in pipeline 3 is 1000. Therefore, to maintain load balance during pipeline processing, a primitive region 6 with 900 vertices to be processed can be allocated to pipeline 1 (cumulative number of vertices processed: 600), a primitive region 5 with 800 vertices to be processed can be allocated to pipeline 2 (cumulative number of vertices processed: 700), and a primitive region 4 with 700 vertices to be processed can be allocated to pipeline 3 (cumulative number of vertices processed: 1000). This will reduce the difference in the cumulative number of vertices processed between each target second pipeline after processing its primitive region. The division is not limited to the above method; other division methods are also possible. The overall idea is that the cumulative number of vertices processed by each pipeline should not differ too much from the total number of vertices to be processed in the allocated primitive region.
[0076] Step S703: Assign the surface subdivision task of each target second pipeline to the corresponding target second pipeline.
[0077] In some embodiments, after the primitive distribution module divides the primitives to be processed into primitive regions, it can generate the surface subdivision task based on the coordinate information of the edge lines of the divided primitive regions (region information in the above embodiments). Thus, when the primitive distribution module sends the surface subdivision task to each target second pipeline, each target second pipeline can determine the primitive region to be processed from the primitives to be processed, i.e. a part of the primitives to be subdivided, based on the surface subdivision task, and then process the part of the primitives to be subdivided. Thus, the purpose of parallel processing of the primitives to be processed by multiple target second pipelines can be achieved.
[0078] It should be noted that for certain specific rendering scenarios, due to different requirements for fineness, different regions within the same primitive need to be subdivided into surfaces based on different subdivision factors. Therefore, for each target second pipeline, the primitive to be processed, the surface subdivision task corresponding to each target second pipeline, and the corresponding required subdivision factor can be input. This allows different target second pipelines to perform surface subdivision on a portion of the primitives to be subdivided based on the subdivision factor corresponding to the fineness required for the portion of primitives to be subdivided, thereby achieving a more refined rendering purpose.
[0079] In some embodiments, the process by which each target second pipeline processes the primitives to be processed based on the subdivision factor and the corresponding surface subdivision task includes: each target second pipeline determining a portion of the primitives to be subdivided in the primitives to be processed according to the corresponding surface subdivision task, and processing the portion of primitives to be subdivided determined by each pipeline.
[0080] It should be noted that after the primitive distribution module sends the primitives to be processed, the subdivision factor, and the corresponding surface subdivision task to each target second pipeline, each target second pipeline determines the portion of primitives to be subdivided from the primitives to be processed based on its assigned surface subdivision task, and processes the portion of primitives to be subdivided based on the subdivision factor. Thus, multiple target second pipelines process the portion of primitives to be subdivided assigned to them simultaneously, achieving the goal of multiple target second pipelines processing the primitives to be subdivided in parallel.
[0081] In some embodiments, the process by which each target second pipeline processes a portion of the primitives to be subdivided includes: the surface subdivision unit in each target second pipeline performs surface subdivision on the portion of the primitives to be subdivided based on the subdivision factor, obtains a set of vertex counts, and outputs the set of vertex counts to the shader in the target second pipeline for processing.
[0082] It should be noted that after each target second pipeline receives the primitive to be processed, the subdivision factor, and the corresponding surface subdivision task, it determines a portion of the primitives to be subdivided based on the surface subdivision task. Then, through its own surface subdivision unit, it performs surface subdivision on the determined portion of the primitives to be subdivided based on the subdivision factor to obtain a set of vertices corresponding to the subdivided portion of the primitives to be subdivided. It can be seen that the set of vertices here may deviate from the number of vertices to be processed predicted in the above embodiment.
[0083] It should also be noted that after the tessellation unit of each target's second pipeline performs tessellation on a portion of the primitives to be subdivided and outputs a set of vertex counts, the shader of each target's second pipeline can further process the set of vertex counts.
[0084] For example, assuming the shader is a domain shader, after receiving a set of vertex counts output by the tessellation unit, the domain shader can calculate the final position of the subdivided vertices based on the set of vertex counts. Alternatively, assuming the shader includes both a domain shader and a geometry shader, after receiving a set of vertex counts output by the tessellation unit, the domain shader can calculate the final position of the subdivided vertices based on the set of vertex counts, and then input the final position into the geometry shader for further transformation. The specific shader and corresponding processing method can be determined according to the actual situation; this embodiment does not limit this.
[0085] It is understandable that by distributing the primitives to be processed to multiple second pipelines for parallel processing through the primitive distribution module, the parallelism of the geometry processing stage can be greatly improved, thereby improving the geometry processing performance of the graphics processor.
[0086] The foregoing described the geometric processing method provided in the embodiments of this application. To facilitate understanding of the embodiments of this application, the following describes possible implementation schemes of the geometric processing method applicable to the embodiments of this application in practical application scenarios.
[0087] refer to Figure 3 First, the geometric data stream is input to the load balancing module 100. The load balancing module 100 first considers load balancing and performs a first distribution of the primitives to be processed obtained from the geometric data stream. The primitives to be processed are input into the selected first pipeline 120. The vertex shader 1101 and the shell shader 1102 in the first pipeline 120 process the primitives to be processed and output the primitives to be processed to the primitive distribution module 140. At this time, the primitive distribution module 140 will consider a second load balancing. Based on the cumulative number of vertices processed (also known as the DS number) of the domain shader 1104 in each second pipeline 130, the second pipeline 130 is selected for the primitives to be processed. The primitives to be processed are input into the second pipeline 130 (the second pipeline 130 here is the target second pipeline in the above embodiment). The tessellation unit 1103, the domain shader 1104 and the geometry shader 1105 in the second pipeline 130 process the primitives to be processed and output data.
[0088] Further, refer to Figure 8An exemplary graphics processor is provided, comprising four second pipelines: pipeline A, pipeline B, pipeline C, and pipeline D. Four statistical modules are also provided: a first statistical module 801, a second statistical module 802, a third statistical module 803, and a fourth statistical module 804. The first statistical module 801 counts the cumulative number of vertices processed by the domain shader in pipeline A; the second statistical module 802 counts the cumulative number of vertices processed by the domain shader in pipeline B; the third statistical module 803 counts the cumulative number of vertices processed by the domain shader in pipeline C; and the fourth statistical module 804 counts the cumulative number of vertices processed by the domain shader in pipeline D. Thus, after each domain shader processes a vertex of a primitive, the number of processed vertices can be input to a refresh module 806 via an input module 805. The refresh module 806 refreshes the cumulative number of processed vertices in the statistical module of the corresponding pipeline. Based on this, the minimum statistical module 807 will always display the pipeline with the smallest current cumulative number of processed vertices.
[0089] For example, continue to refer to Figure 8 If the cumulative number of vertices processed in the first statistics module 801 is 800, the cumulative number of vertices processed in the second statistics module 802 is 800, the cumulative number of vertices processed in the third statistics module 803 is 600, and the cumulative number of vertices processed in the fourth statistics module 804 is 1200, then the cumulative number of vertices processed in the third statistics module 803 is the smallest. Furthermore, since the third statistics module 803 corresponds to the cumulative number of vertices processed by the domain shader in pipeline C, the minimum number of vertices processed in the fourth statistics module 804 is... 7 shows pipeline C; based on this, after the domain shader of pipeline C finishes processing the vertices of a primitive to be processed, the vertex count of the primitive to be processed, 500, is input to the refresh module 806 through the input module 805. Then, the cumulative number of processed vertices counted in the third statistics module 803 is updated to 180. At this time, the second statistics module 802 becomes the one with the smallest cumulative number of processed vertices. Since the third statistics module 802 corresponds to the cumulative number of processed vertices of the domain shader in pipeline B, the smallest statistics module 807 shows pipeline B.
[0090] It is understandable that by finding the pipeline corresponding to the minimum cumulative number of vertices processed, the primitives to be processed can be distributed and processed while taking into account the load balancing of each second pipeline. This can significantly improve the processing efficiency of the geometry processing stage, thereby improving the geometry processing performance of the graphics processor.
[0091] Based on the foregoing embodiments, this application provides a graphics processor. Figure 9 This is a schematic diagram of the composition structure of a graphics processor provided in an embodiment of this application, such as... Figure 9As shown, the graphics processor 900 includes: a first pipeline 9001, a primitive distribution module 9002, and at least two second pipelines 9003, wherein: the output of the first pipeline 9001 is connected to the input of the primitive distribution module 9002, and the output of the primitive distribution module 9002 is connected to the input of at least two second pipelines 9003, each second pipeline 9003 includes a tessellation unit and a shader; the shader is used to process the vertices of the primitive to be processed after the tessellation unit performs tessellation on the primitive to be processed; Primitive distribution module 9002 is used to obtain the primitives to be processed output by the first pipeline 9001 and the cumulative number of vertices processed by the shaders in each second pipeline 9003; each second pipeline 9003 includes a tessellation unit and a shader, the shader is used to process the vertices of the primitives to be processed after the tessellation unit performs tessellation; based on the cumulative number of vertices processed by the shaders in each second pipeline 9003, a second pipeline 9003 that meets the preset load balancing condition is determined from at least two second pipelines 9003 as the target second pipeline 9003; the primitives to be processed are distributed to the target second pipeline 9003 to instruct the target second pipeline 9003 to process the primitives to be processed.
[0092] Based on the foregoing embodiments, this application provides a geometry processing apparatus applied to a primitive distribution module in a graphics processor. The graphics processor further includes a first pipeline and at least two second pipelines. Figure 10 This is a schematic diagram of the composition structure of a geometric processing device provided in an embodiment of this application, as shown below. Figure 10 As shown, the geometry processing device 1000 includes: The acquisition unit 1001 is used to acquire the primitive to be processed output by the first pipeline and the cumulative number of vertices processed by the shader in each second pipeline; each second pipeline includes a tessellation unit and a shader, the shader being used to process the vertices of the primitive to be processed after the tessellation unit performs tessellation on the primitive to be processed; The determining unit 1002 is configured to determine, based on the cumulative number of vertices processed by the shaders in each second pipeline, a second pipeline that satisfies a preset load balancing condition as a target second pipeline from the at least two second pipelines; The distribution unit 1003 is used to distribute the graphic element to be processed to the target second pipeline, so as to instruct the target second pipeline to process the graphic element to be processed.
[0093] In some embodiments, the determining unit 1002 is further configured to determine, based on the cumulative number of vertices processed by the shaders in each second pipeline, a second pipeline whose cumulative number of vertices processed is less than a first threshold value from the at least two second pipelines as the target second pipeline.
[0094] In some embodiments, the acquisition unit 1001 is further configured to acquire the subdivision factor corresponding to the primitive to be processed; the subdivision factor represents the degree of subdivision when performing surface subdivision on the primitive to be processed. The distribution unit 1003 is further configured to distribute the subdivision factor and the primitive to be processed to the target second pipeline.
[0095] In some embodiments, the distribution unit 1003 is further configured to, upon obtaining the subdivision factor corresponding to the primitive to be processed, allocate a surface subdivision task to each of the target second pipelines; the surface subdivision task is configured to instruct the surface subdivision unit in each of the target second pipelines to output a target vertex; the target vertex is a portion of the vertices of the primitive to be processed after surface subdivision; the primitive to be processed, the subdivision factor, and the corresponding allocated surface subdivision task are sent to each of the target second pipelines to instruct each of the target second pipelines to process the primitive to be processed based on the subdivision factor and the corresponding surface subdivision task.
[0096] In some embodiments, the geometry processing apparatus 1000 further includes: The prediction unit is used to predict the number of vertices to be processed after the primitive to be processed is subdivided by the surface subdivision unit based on the subdivision factor. A generation unit is configured to generate a surface subdivision task for each of the target second pipelines according to the number of vertices to be processed and the cumulative number of vertices processed for each of the target second pipelines. The distribution unit 1003 is further configured to assign the surface subdivision task of each of the target second pipelines to the corresponding target second pipelines.
[0097] The descriptions of the apparatus embodiments above are similar to those of the method embodiments above, and have similar beneficial effects. In some embodiments, the functions or modules included in the apparatus provided in this application can be used to perform the methods described in the method embodiments above. For technical details not disclosed in the apparatus embodiments of this application, please refer to the descriptions of the method embodiments of this application for understanding.
[0098] It should be noted that, in the embodiments of this application, if the above-described geometric processing method is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiments of this application, or the part that contributes to the related technology, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, mobile hard drives, read-only memory (ROM), magnetic disks, or optical disks. Thus, the embodiments of this application are not limited to any specific hardware, software, or firmware, or any combination of hardware, software, and firmware.
[0099] This application provides a computer device including a memory and a processor. The memory stores a computer program that can run on the processor. When the processor executes the program, it implements some or all of the steps in the above-described method.
[0100] This application provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements some or all of the steps in the above-described method. The computer-readable storage medium can be transient or non-transient.
[0101] This application provides a computer program including computer-readable code, wherein when the computer-readable code is executed in a computer device, a processor in the computer device performs some or all of the steps in the above-described method.
[0102] This application provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program. When the computer program is read and executed by a computer, it implements some or all of the steps in the above-described method. This computer program product can be implemented specifically through hardware, software, or a combination thereof. In some embodiments, the computer program product is specifically embodied as a computer storage medium; in other embodiments, the computer program product is specifically embodied as a software product, such as a software development kit (SDK), etc.
[0103] It should be noted that the descriptions of the various embodiments above tend to emphasize the differences between them, while their similarities or commonalities can be referred to interchangeably. The descriptions of the above embodiments of the device, storage medium, computer program, and computer program product are similar to the descriptions of the above method embodiments and have similar beneficial effects. For technical details not disclosed in the embodiments of the device, storage medium, computer program, and computer program product of this application, please refer to the descriptions of the method embodiments of this application for understanding.
[0104] Figure 11 This application provides a hardware entity diagram of a computer device as an embodiment of the present application, such as... Figure 11 As shown, the hardware entity of the computer device 1100 includes a processor 1110 and a memory 1120, wherein the memory 1120 stores a computer program that can run on the processor 1110, and the processor 1110 executes the program to implement the steps in the method of any of the above embodiments.
[0105] The memory 1120 stores computer programs that can run on the processor. The memory 1120 is configured to store instructions and applications that can be executed by the processor 1110. It can also cache data to be processed or already processed (e.g., image data, audio data, voice communication data, and video communication data) in the processor 1110 and various modules in the computer device 1100. It can be implemented by flash memory or random access memory (RAM).
[0106] The processor 1110 executes the steps of any of the above-mentioned geometric processing methods when executing a program. The processor 1110 typically controls the overall operation of the computer device 1100.
[0107] This application provides a computer storage medium storing one or more programs that can be executed by one or more processors to implement the steps of the geometric processing method as described in any of the above embodiments.
[0108] This application provides a computer program product, including a computer program or instructions, which, when executed by a processor, implement some or all of the steps in the above-described geometric processing method.
[0109] It should be noted that the descriptions of the storage medium and device embodiments above are similar to the descriptions of the method embodiments above, and have similar beneficial effects. For technical details not disclosed in the storage medium and device embodiments of this application, please refer to the descriptions of the method embodiments of this application for understanding.
[0110] The aforementioned processor can be at least one of the following: Application Specific Integrated Circuit (ASIC), Digital Signal Processor (DSP), Digital Signal Processing Device (DSPD), Programmable Logic Device (PLD), Field Programmable Gate Array (FPGA), Central Processing Unit (CPU), Controller, Microcontroller, and Microprocessor. It is understood that other electronic devices can also implement the functions of the aforementioned processor, and this application does not specifically limit the specific implementation.
[0111] The aforementioned computer storage media / memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), magnetic random access memory (FRAM), flash memory, magnetic surface memory, optical disc, or compact disc read-only memory (CD-ROM), etc.; or it can be various terminals that include one or any combination of the above-mentioned memories, such as mobile phones, computers, tablet devices, personal digital assistants, etc.
[0112] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It should be understood that in the various embodiments of this application, the sequence numbers of the above steps / processes do not imply a sequential order of execution; the execution order of each step / process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application. The sequence numbers of the above embodiments of this application are merely descriptive and do not represent the superiority or inferiority of the embodiments.
[0113] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0114] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be through some interfaces, and the indirect coupling or communication connection between devices or units can be electrical, mechanical, or other forms.
[0115] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units. They may be located in one place or distributed across multiple network units. Some or all of the units may be selected to achieve the purpose of this embodiment according to actual needs.
[0116] In addition, each functional unit in the various embodiments of this application can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the integrated unit can be implemented in hardware or in the form of hardware plus software functional units.
[0117] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media that can store program code, such as mobile storage devices, read-only memory (ROM), magnetic disks, or optical disks.
[0118] Alternatively, if the integrated units described above are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, or the part that contributes to related technologies, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROM, magnetic disks, or optical disks.
[0119] The above description is merely an embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.
Claims
1. A method of geometry processing, the method comprising: A primitive distribution module applied to a graphics processor, the graphics processor further comprising a first pipeline and at least two second pipelines; the method comprising: obtaining a to-be-processed primitive output by the first pipeline and a cumulative number of processed vertices of a shader in each of the second pipelines; each of the second pipelines comprises a tessellation unit and a shader, and the shader is configured to process vertices of the to-be-processed primitive after the to-be-processed primitive is tessellated by the tessellation unit; determining, according to the cumulative number of processed vertices of the shader in each of the second pipelines, a second pipeline satisfying a preset load balancing condition from the at least two second pipelines as a target second pipeline; distributing the to-be-processed primitive to the target second pipeline to instruct the target second pipeline to process the to-be-processed primitive.
2. The method of claim 1, wherein, The preset load balancing condition comprises that the cumulative number of processed vertices of the shader is less than a first threshold value; and the determining, according to the cumulative number of processed vertices of the shader in each of the second pipelines, a second pipeline satisfying a preset load balancing condition from the at least two second pipelines as a target second pipeline comprises: determining, according to the cumulative number of processed vertices of the shader in each of the second pipelines, a second pipeline with a cumulative number of processed vertices less than a first threshold value from the at least two second pipelines as the target second pipeline.
3. The method according to claim 1 or 2, characterized in that, The distributing the to-be-processed primitive to the target second pipeline comprises: obtaining a tessellation factor corresponding to the to-be-processed primitive; the tessellation factor represents a tessellation degree when the to-be-processed primitive is tessellated; distributing the tessellation factor and the to-be-processed primitive to the target second pipeline.
4. The method of claim 3, wherein, The number of the target second pipelines is a plurality, and the method further comprises: in a case where the tessellation factor corresponding to the to-be-processed primitive is obtained, assigning a tessellation task to each of the target second pipelines; the tessellation task is configured to instruct the tessellation unit in each of the target second pipelines to output a target vertex; the target vertex is a part of vertices of the to-be-processed primitive after the to-be-processed primitive is tessellated; issuing the to-be-processed primitive, the tessellation factor and the corresponding assigned tessellation task to each of the target second pipelines to instruct each of the target second pipelines to process the to-be-processed primitive based on the tessellation factor and the corresponding tessellation task.
5. The method of claim 4, wherein, The assigning the tessellation task to each of the target second pipelines comprises: predicting a number of to-be-processed vertices generated after the to-be-processed primitive is tessellated by the tessellation unit based on the tessellation factor; generating a tessellation task of each of the target second pipelines according to the number of to-be-processed vertices and the cumulative number of processed vertices of each of the target second pipelines; assigning the tessellation task of each of the target second pipelines to the corresponding target second pipeline.
6. The method of claim 4, wherein, The process of each of the target second pipelines processing the to-be-processed primitive based on the tessellation factor and the corresponding tessellation task comprises: each of the target second pipelines determines a part of to-be-tessellated primitives in the to-be-processed primitive according to the corresponding tessellation task, and processes the part of to-be-tessellated primitives determined by each of the target second pipelines.
7. The method of claim 6, wherein, The process of each target second pipeline processing the part of the to-be-subdivided primitives determined by the target second pipeline includes: a surface subdivision unit in each target second pipeline performing surface subdivision on the part of the to-be-subdivided primitives determined by the target second pipeline based on the subdivision factor to obtain a set of vertex numbers, and outputting the set of vertex numbers to a shader in the target second pipeline for processing.
8. A graphics processor, comprising: The graphics processor comprises a primitive distribution module, a first pipeline, and at least two second pipelines; an output end of the first pipeline is connected to an input end of the primitive distribution module, an output end of the primitive distribution module is connected to input ends of the at least two second pipelines, each second pipeline comprises a surface subdivision unit and a shader; and the shader is used to process vertices after the surface subdivision unit performs surface subdivision on the to-be-processed primitives. The primitive distribution module is used to acquire the to-be-processed primitives output by the first pipeline and cumulative processing vertex numbers of the shader in each second pipeline; each second pipeline comprises a surface subdivision unit and a shader, the shader is used to process vertices after the surface subdivision unit performs surface subdivision on the to-be-processed primitives; a second pipeline satisfying a preset load balancing condition is determined as a target second pipeline from the at least two second pipelines according to the cumulative processing vertex numbers of the shader in each second pipeline; and the to-be-processed primitives are distributed to the target second pipeline to instruct the target second pipeline to process the to-be-processed primitives.
9. A geometry processing device, characterized by, The primitive distribution module applied to a graphics processor further comprises a first pipeline and at least two second pipelines; and the geometry processing device comprises: An acquisition unit is configured to acquire to-be-processed primitives output by the first pipeline and cumulative processing vertex numbers of a shader in each second pipeline; each second pipeline comprises a surface subdivision unit and a shader, and the shader is configured to process vertices after the surface subdivision unit performs surface subdivision on the to-be-processed primitives. A determination unit is configured to determine a second pipeline satisfying a preset load balancing condition as a target second pipeline from the at least two second pipelines according to the cumulative processing vertex numbers of the shader in each second pipeline. A distribution unit is configured to distribute the to-be-processed primitives to the target second pipeline to instruct the target second pipeline to process the to-be-processed primitives.
10. A computer device comprising a memory and a processor, the memory storing a computer program capable of running on the processor, characterized in that, The processor executes the program to implement the steps in the method of any one of claims 1 to 7.
11. A computer readable storage medium characterized by, A computer program is stored thereon, and the computer program is executed by a processor to implement the method of any one of claims 1 to 7.
12. A computer program product comprising computer programs or instructions, characterized in that, The computer program or instructions are executed by a processor to implement the method of any one of claims 1 to 7.