Rendering processing methods, apparatus, equipment, storage media and program products
By initializing the primitive set's storage space with data at the vertex stage of the geometry pipeline in the rendering process, the problem of frequent pauses in screen mapping processing is solved, thus improving rendering efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- MOORE THREADS TECH CO LTD
- Filing Date
- 2025-10-21
- Publication Date
- 2026-05-26
AI Technical Summary
In existing technologies, frequent pauses in screen mapping of primitive sets result in low processing efficiency.
In the vertex stage of the geometry pipeline for rendering, the primitive set and its layer identifier are determined based on the vertex data of the rendering object, and data initialization processing is performed on the corresponding storage space to ensure that the storage space is ready in the screen mapping stage.
By initializing the storage space before screen mapping, the processing efficiency is improved by reducing or avoiding pauses in the screen mapping process.
Smart Images

Figure CN121392104B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a rendering processing method, apparatus, device, storage medium, and program product. Background Technology
[0002] Screen mapping is performed on a primitive set to map primitives in the primitive set from clipping space to screen coordinate space.
[0003] In related technologies, performing screen mapping processing on multiple primitive sets may include the following steps: obtaining any one primitive set from the multiple primitive sets; determining whether the storage space corresponding to the primitive set has completed data initialization processing; if the storage space has completed data initialization processing, performing screen mapping processing on the primitive set and storing the data generated during the screen mapping process into the storage space; if the storage space has not completed data initialization processing, pausing the screen mapping processing on the primitive set is necessary, performing data initialization processing on the storage space first, before continuing to perform screen mapping processing on the primitive set, and storing the data generated during the screen mapping process into the storage space that has completed data initialization. Performing the above operations on each primitive set in the multiple primitive sets achieves the screen mapping processing for multiple primitive sets.
[0004] The above method requires frequent pausing of the primitive set screen mapping process, which leads to low screen mapping efficiency. Summary of the Invention
[0005] This application provides a rendering processing method, apparatus, device, storage medium, and program product. The technical solutions provided by this application are as follows.
[0006] According to one aspect of the embodiments of this application, a rendering processing method is provided, the method comprising:
[0007] In the vertex stage of the geometry pipeline during rendering, the primitive set of the rendering object and the layer identifier of the primitive set are determined based on the vertex data of the rendering object.
[0008] Based on the layer identifier of the primitive set, data initialization processing is performed on M of the N storage spaces corresponding to the layer of the rendering object to obtain M initialized storage spaces, where N is a positive integer and M is a positive integer less than or equal to N; the initialized storage spaces are used to store data in the screen mapping stage of the geometry pipeline;
[0009] During the screen mapping phase, screen mapping processing is performed on the primitive set, and the data of the screen mapping phase is stored in the initialized storage space.
[0010] According to one aspect of the embodiments of this application, a rendering processing apparatus is provided, the apparatus comprising:
[0011] The determination module is used to determine the primitive set of the rendering object and the layer identifier of the primitive set based on the vertex data of the rendering object during the vertex stage of the geometry pipeline in the rendering process.
[0012] The module is configured to perform data initialization processing on M of the N storage spaces corresponding to the layer of the rendering object based on the layer identifier of the primitive set, to obtain M initialized storage spaces, where N is a positive integer and M is a positive integer less than or equal to N; the initialized storage spaces are used to store data of the screen mapping stage in the geometry pipeline;
[0013] A storage module is used to perform screen mapping processing on the primitive set during the screen mapping phase and to store the data of the screen mapping phase into the initialized storage space.
[0014] According to one aspect of the embodiments of this application, a computer device is provided, the computer device including a processor and a memory, the memory storing a computer program, the computer program being loaded and executed by the processor to implement the above-described rendering processing method.
[0015] According to one aspect of the embodiments of this application, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, the computer program being loaded and executed by a processor to implement the above-described rendering processing method.
[0016] According to one aspect of the embodiments of this application, a computer program product is provided, the computer program product including a computer program stored in a computer-readable storage medium, and a processor reading from the computer-readable storage medium and executing the computer program to implement the above-described rendering processing method.
[0017] The technical solution provided in this application can bring the following beneficial effects:
[0018] By performing data initialization processing on all or part of the primitive set's storage space before the screen mapping process, the number of times the screen mapping process needs to be paused or reduced during subsequent screen mapping operations, thereby improving the efficiency of the screen mapping process. Attached Figure Description
[0019] Figure 1 This is a flowchart of a possible implementation of the rendering process in this application;
[0020] Figure 2This is a flowchart of a rendering process in another possible implementation of this application;
[0021] Figure 3 This is a block diagram of a rendering processing apparatus in one possible implementation of this application;
[0022] Figure 4 This is a structural block diagram of a computer device in one possible implementation of this application. Detailed Implementation
[0023] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0024] Please refer to Figure 1 The diagram illustrates a flowchart of a rendering process method in one possible implementation of this application. The execution entity for each step of the method can be a computer device. The method may include at least one of the following steps (110-130).
[0025] Step 110: In the vertex stage of the geometry pipeline in the rendering process, the primitive set of the rendering object and the layer identifier of the primitive set are determined based on the vertex data of the rendering object.
[0026] In some embodiments, rendering processing refers to the process of converting a digital model (e.g., a 3D model) in a computer into a 2D image through a series of calculations and processing steps. Rendering processing may include an application stage, a geometry stage (also known as a geometry pipeline), and a rasterization stage. Embodiments of this application are used to optimize the geometry pipeline by performing data initialization processing of all or part of the primitive set's storage space before the screen mapping process in the geometry pipeline. This reduces or eliminates the need to pause the screen mapping process during subsequent screen mapping, thereby improving the efficiency of the screen mapping process.
[0027] A rendering model refers to a 3D model that needs to be rendered and ultimately displayed on the screen, including but not limited to at least one of the following: game models, film and animation models, industrial design models, and architectural design models. Among them, game models include but are not limited to virtual characters, virtual props, and virtual buildings; film and animation models include but are not limited to character models and scene models; industrial design models include but are not limited to product models and mechanical models; architectural design models include but are not limited to building exterior models and interior design models. This application does not limit the rendering model.
[0028] Vertex data is used to characterize the attribute information of the model to be rendered. The attribute information includes at least one of the following: position information, color information, and geometric structure information. Position information indicates the specific coordinates of the model to be rendered in three-dimensional space. These vertex coordinates precisely describe the size and position of the model in three-dimensional space. Color information indicates the color information of the model to be rendered. Each vertex can have its own independent color. During rendering, a smooth color transition can be achieved by interpolating the vertex colors. For example, in a gradient sphere model, different vertices have different colors, and interpolation allows the color of the sphere's surface to gradually transition from one color to another. Geometric structure information indicates the spatial structure of the model to be rendered and may include normal information, etc., which is not limited in this application.
[0029] In some embodiments, the vertex stage of the geometry pipeline includes a vertex process and a primitive block (PB) packing process. Vertex processing refers to a series of mathematical transformations and computational operations performed on vertex data to transform the vertices from the model space coordinate system to the clipping space coordinate system for subsequent screen mapping. Vertex processing may include at least one of the following: vertex shading, projection, and clipping.
[0030] Vertex shading may include view transformation and the addition, deletion, and modification of vertex data. Specifically, view transformation is used to convert vertex data from model space to view space. Adding, deleting, and modifying vertex data may include at least one of the following: adding color attributes, adding texture coordinates, adding normal information, deleting redundant vertex attributes, and modifying color attributes; this application does not limit the scope of these modifications.
[0031] Projection transformations can be divided into two main types: perspective projection and orthographic projection. Perspective projection simulates the visual effect of the human eye, making objects closer to the camera appear larger and objects farther away appear smaller, creating a perspective effect where objects appear larger when closer and smaller when farther away. It is commonly used in most 3D games and film scenes to enhance the realism and depth of the scene. Orthographic projection, on the other hand, does not produce a perspective effect; the size of objects does not change with their distance from the camera. It is often used in scenes where maintaining the true proportions of objects is important, such as CAD (Computer-Aided Design) drawings and 2D games. Projection transformations are achieved by multiplying by a projection transformation matrix, which is set according to the type and parameters of the projection.
[0032] Clipping is a step performed after projection transformation to remove primitives or portions of primitives located outside the clipping space. The clipping space is a standardized 3D space, typically defined as a cube. At this stage, it is checked whether the vertices of each primitive are within the clipping space. If a primitive is completely outside the clipping space, it is discarded; if a primitive is partially within the clipping space, it is clipped, retaining only the portion within the clipping space. The purpose of clipping is to reduce the computational load of subsequent processing and improve rendering efficiency. For example, in a large 3D scene, many objects may be outside the camera's field of view. Clipping can avoid unnecessary processing of these objects, thus saving GPU computing resources. Clipping algorithms are usually based on geometric calculations and judgment rules, such as the Cohen-Sutherland algorithm and the Liang-Barsky algorithm, which are not limited in this application.
[0033] In some embodiments, K primitive sets are determined based on the vertex data of the rendered object, each primitive set including at least one primitive, where K is a positive integer. Layer identifiers for primitive sets are used to distinguish different layers. Layer identifiers can be denoted as RT_ID. Layer identifiers can include at least one of the following: layer name, layer index, which is not limited in this application. For example, the layer name can be a string consisting of one or more characters, used to intuitively describe the purpose of the layer, such as a character layer, terrain layer, or background layer. The layer index can be, for example, an integer value, such as 0, 1, 2, etc.
[0034] Primitive set packing refers to combining vertices located in clipping space after projection transformation into a primitive set according to certain rules. A primitive, in computer graphics, refers to the basic element that constitutes a graphic. It is the smallest logical unit of graphic data, and a primitive can include at least one of the following: point, line (straight line segment, curve, etc.), polygon (triangle, quadrilateral, etc.), and circle; this application does not limit this. A primitive set is a collection formed by combining multiple related primitives. For example, in a game scene, the primitives corresponding to the various parts of a character's body (head, limbs, torso, etc.) can form a primitive set to describe the character's overall graphic information.
[0035] Step 120: Based on the layer identifier of the primitive set, perform data initialization processing on M of the N storage spaces corresponding to the layer of the rendering object to obtain M initialized storage spaces, where N is a positive integer and M is a positive integer less than or equal to N; the initialized storage spaces are used to store data in the screen mapping stage of the geometry pipeline.
[0036] When storage space is uninitialized, the data within it may be chaotic. Directly storing data generated from primitive screen mapping processing into uninitialized storage space can lead to issues such as data overwriting and storage format mismatches, making the stored data unreadable and unusable by subsequent processing modules. By performing data initialization processing on the storage space first, we can ensure that the storage space receives data in the correct state, guaranteeing the accuracy of data storage.
[0037] Performing data initialization on storage space refers to assigning specific initial values to the storage space to ensure that it can correctly store data generated during screen mapping. Setting these initial values can include setting default values. For example, default values can be set for storage spaces based on the specific needs of screen mapping. For instance, storage spaces storing color data might be initialized to pure black (e.g., RGB values of (0, 0, 0)), so that if no new color data is written during subsequent screen mapping, the storage space remains in its initial black state. Storage spaces storing depth values are typically initialized to a maximum depth value (e.g., 1.0), indicating that the location is at its farthest point in the initial state. Subsequent depth tests using new graphics will compare this initial depth value. Setting these initial values can also include zeroing out the storage space. For example, clearing all contents of the storage space to zero is a common initialization method. For instance, initializing storage spaces storing vertex index data to zero means that before screen mapping begins, the storage space does not point to any valid vertex indices, awaiting subsequent updates based on primitive information.
[0038] In some embodiments, the geometry pipeline can also be referred to as the geometry conduit, which may include a vertex stage and a screen mapping stage. The screen mapping stage, also known as the screen mapping processing stage, follows the vertex stage. Screen mapping processing refers to the process of mapping primitives in a primitive set from clipping space to screen coordinate space. Real-world display devices, such as computer monitors and mobile phone screens, are essentially two-dimensional display planes. They display images through individual pixels, each with its corresponding two-dimensional coordinates. However, when constructing a three-dimensional scene, the primitives of objects reside in three-dimensional space. To correctly render a three-dimensional scene on a two-dimensional display device, it is necessary to map the primitives in the three-dimensional clipping space to the two-dimensional screen coordinate space, so that the display device can subsequently illuminate the corresponding pixels according to the screen coordinates, thereby displaying the three-dimensional scene.
[0039] The data generated during screen mapping refers to various intermediate and final data generated during the calculation process of mapping primitives from clip space to screen coordinate space. Intermediate data refers to transitional data generated during the screen mapping process, in the transformation from clip space to screen coordinate space, in order to obtain the final data. This transitional data needs to be temporarily stored in the initialized storage space. The final data may include a set of primitives in screen coordinate space, but this application does not limit this.
[0040] In some embodiments, such as Figure 2 As shown, the processing of vertex data and the data initialization process are executed in parallel.
[0041] In some embodiments, the rendering processing method provided in this application is applied to a GPU (Graphics Processing Unit). The GPU may include a first computing unit and a second computing unit, which are different computing units. The first computing unit is used to perform vertex data processing; the second computing unit is used to perform data initialization processing. The first and second computing units execute their respective processing operations in parallel.
[0042] The above method, by processing vertex data and data initialization in parallel, can hide the delay of data initialization by delaying vertex data processing, thereby improving the processing efficiency of the geometry pipeline.
[0043] In some embodiments, the vertex data processing and data initialization processes are executed sequentially. In some embodiments, the data initialization process can be executed after the vertex data processing, or vice versa. In some embodiments, the start times of the vertex data processing and the data initialization process can be different, and this application does not limit the order in which these two processes begin execution.
[0044] In some embodiments, K primitive sets are determined based on the vertex data of the rendered object, each primitive set including at least one primitive, where K is a positive integer. In some embodiments, the layers to which the K primitive sets belong are determined, resulting in N layers. Here, N is a positive integer less than or equal to K. Each layer can independently hold different primitive sets, and these layers are stacked in a certain order. Layers allow for the categorization and management of primitive sets, facilitating the implementation of various complex graphic effects. Specifically, assigning K primitive sets to N layers allows for the categorization of primitive sets according to different logics or functions. For example, in a map-making software, there might be a background layer containing primitive sets of natural landscapes such as mountains and rivers; a road layer containing primitive sets of various roads; and a building layer containing primitive sets of city buildings. This categorization helps in the centralized management and operation of different types of graphic elements.
[0045] In some embodiments, each layer includes one or more primitive sets, which is not limited in this application. For example, when N=1, all K primitive sets are on the same layer, and these primitive sets are treated as a whole for management and rendering. When N>1, the K primitive sets are distributed across multiple layers; some layers may contain multiple primitive sets, while others may contain only one. For instance, in a simple graphic design, there are 5 primitive sets (K = 5), assigned to 3 layers (N = 3). One layer contains 2 primitive sets to represent the main graphic, and the other two layers each contain 1 primitive set for adding decorative elements.
[0046] In some embodiments, there is a one-to-one correspondence between the N layers and the N storage spaces. That is, one layer corresponds to one storage space, and different layers correspond to different storage spaces. In some embodiments, the storage size of the storage spaces corresponding to different layers can be the same or the same, and this application does not limit this.
[0047] In some embodiments, data initialization operations are performed on M of the N storage spaces, where M is a positive integer less than or equal to N.
[0048] In some embodiments, when M equals N, it represents performing data initialization processing on all N storage spaces of all N layers. In some embodiments, when M is less than N, it represents performing data initialization processing on a portion of the N storage spaces.
[0049] In some embodiments, the processing of vertex data can be for a first duration; within this first duration, data initialization operations can be performed on M storage spaces. The M storage spaces can be all or a portion of the N storage spaces. It is understood that if data initialization is performed on all N storage spaces, the subsequent screen mapping process for the K primitive sets does not need to be paused; however, if data initialization is performed on a portion of the N storage spaces, the subsequent screen mapping process for the K primitive sets needs to be paused.
[0050] In some embodiments, assuming that data initialization is only performed on a portion of the N storage spaces within the first time period, subsequent screen mapping can be skipped. Instead, data initialization can be performed on each of the N storage spaces before proceeding with the subsequent screen mapping for the K primitive sets. This effectively completes the data initialization for all N storage spaces at the vertex stage, allowing the screen mapping process to continue without interruption. Furthermore, screen mapping can be performed on each of the K primitive sets without requiring an additional step to check if the corresponding storage space for each primitive set has completed data initialization, as all storage spaces corresponding to the K primitive sets have already undergone data initialization in this case.
[0051] In some embodiments, during the vertex phase, when the data load is small but the number of layers is large, the processing time for vertex data may be short, i.e., the aforementioned first duration is a small value. In this case, it may only be possible to initialize the data for a portion of the N storage spaces. In some embodiments, during the vertex phase, when the data load is large but the number of layers is small, the processing time for vertex data may be long, i.e., the aforementioned first duration is a large value. In this case, it is possible to initialize the data for all of the N storage spaces.
[0052] The above method performs data initialization processing on M storage spaces out of N storage spaces (i.e., all layers or some layers), which enables the subsequent screen mapping process to avoid or reduce the number of pauses in the subsequent screen mapping process, thereby improving the efficiency of screen mapping processing.
[0053] In some embodiments, based on the layer identifier of the primitive set, data initialization processing is performed on M of the N storage spaces corresponding to the layer of the rendering object to obtain M initialized storage spaces, including: for any layer, detecting whether the initialization flag of the first storage space corresponding to the layer is valid; wherein, the first storage space is any one of the M storage spaces, and the initialization flag being valid is used to indicate that the storage space has completed data initialization; if the initialization flag of the first storage space is invalid, data initialization processing is performed on the first storage space to obtain the initialized first storage space; and the initialization flag of the first storage space is updated to be valid.
[0054] In some embodiments, an initialization flag indicating that the storage space has completed data initialization is used to indicate that the storage space has not completed data initialization is used to indicate that the storage space has not completed data initialization. The initialization flag may include at least one of the following: a Boolean value flag and a bit flag. For the Boolean value flag, it can be represented by a Boolean variable. For example, "TRUE" indicates that the storage space has completed data initialization (i.e., the initialization flag is valid), and "FALSE" indicates that the data initialization process has not been completed (i.e., the initialization flag is invalid).
[0055] For bit flags, one bit can be used to indicate whether the storage space has completed data initialization. For example, bit 1 indicates that the storage space has completed data initialization (that is, the initialization flag is valid), while bit 0 indicates that the storage space has not completed data initialization (that is, the initialization flag is invalid); or, bit 0 can indicate that the storage space has completed data initialization (that is, the initialization flag is valid), while bit 1 indicates that the storage space has not completed data initialization (that is, the initialization flag is invalid). This application does not limit this.
[0056] In some embodiments, if the initialization flag of the first storage space is invalid, data initialization processing is performed on the first storage space to obtain an initialized first storage space; the initialization flag of the first storage space is then updated to be valid.
[0057] Updating the initialization flag of the first storage space to valid means that after the first storage space has successfully completed data initialization, a write operation is performed to change its corresponding initialization flag from an invalid state to a new state that explicitly indicates validity. For example, when the first storage space has not completed data initialization, its corresponding initialization flag can be bit 0. After the first storage space completes data initialization, the initialization flag is updated from bit 0 to bit 1, so that the initialization flag of the first storage space indicates that the first storage space has completed data initialization.
[0058] The above method can accurately determine whether the storage space corresponding to each layer has completed data initialization processing by initialization markers, and only perform corresponding operations on the storage space that has not completed data initialization processing, thus avoiding unnecessary processing operations.
[0059] Furthermore, by updating the initialization flag, when performing screen mapping processing on the K primitive sets, the updated initialization flag can be used to promptly determine whether the storage space corresponding to the primitive set has completed data initialization processing, thereby accurately determining whether the screen mapping process needs to be paused, ensuring the reliability of the screen mapping process.
[0060] In some embodiments, when the number of storage spaces is greater than 1, at least two storage spaces perform data initialization processing in parallel.
[0061] In some embodiments, during the data initialization process of M out of N storage spaces, at least two of the M storage spaces perform the data initialization process in parallel.
[0062] In some embodiments, the GPU may include a second computing unit, which is configured to perform data initialization processing on M of the N storage spaces. In some embodiments, the second computing subunit may include at least one computing subunit, each computing subunit being configured to perform data initialization processing on one storage space, and different computing subunits being configured to perform data initialization processing on different storage spaces.
[0063] In some embodiments, the at least two storage spaces that perform data initialization processing in parallel can be any two of the M storage spaces. For example, the M storage spaces may include storage space 1, storage space 2, and storage space 3. The at least two storage spaces that perform data initialization processing in parallel can be any two of storage space 1, storage space 2, and storage space 3. For example, storage space 1 and storage space 3; this application does not limit this choice.
[0064] The above method achieves parallel processing by initializing data in at least two of the M storage spaces, which can save the time of initializing data in the M storage spaces and improve the efficiency of data initialization.
[0065] Step 130: In the screen mapping stage, perform screen mapping processing on the primitive set and store the data of the screen mapping stage into the initialized storage space.
[0066] In some embodiments, the stage of performing screen mapping processing on the primitive set is the stage following the vertex stage described above.
[0067] In some embodiments, screen mapping is performed on K primitive sets to obtain K screen-mapped primitive sets. Each of the K screen-mapped primitive sets includes primitives in screen coordinates. The screen-mapped primitive sets are used to convert into pixels in the subsequent rasterization stage. Specifically, the screen-mapped primitive set (e.g., a triangle composed of three screen coordinate vertices) is the input to the rasterization stage. The rasterizer calculates which pixel centers on the screen this geometry covers based on the precise positions of these vertices in screen coordinates. This process is also known as scan conversion. The output is a series of fragments, each corresponding to a pixel to be rendered and carrying attributes interpolated from the vertex data (such as color, texture coordinates, normals, etc.).
[0068] In some embodiments, priority information is determined for each of the K primitive sets, which indicates the priority of performing screen mapping processing on the primitive sets; based on the priority information, screen mapping processing is performed on the K primitive sets to obtain screen-mapped K primitive sets. Optionally, at least one of the following can be determined as high priority: opaque primitive sets, primitive sets closer to the camera. Opaque primitive sets indicate that the surface of the object formed by the primitive set is optically impenetrable to light. In computer graphics, this typically means that its material transparency value is 1, completely covering the object behind it during rendering. Primitive sets closer to the camera indicate that in the view space of the 3D scene, the Z-axis depth value of the representative coordinates (such as the geometric center point coordinates) of the primitive set is smaller. Optionally, at least one of the following can be determined as low priority: semi-transparent or transparent primitive sets, primitive sets farther from the camera. The semi-transparent or transparent primitive sets indicate that the surface of the object formed by the primitive set allows some or all of the light to pass through optically, producing a transparent or semi-transparent visual effect during rendering. Primitive sets farther from the camera indicate that, in the view space of the 3D scene, the Z-axis depth value of the representative coordinates (such as the geometric center point coordinates) of the primitive set is larger; this application does not limit this. The above method, by using the priority information of each of the K primitive sets to perform screen mapping processing, ensures that primitive sets with higher priority are sent to the rasterization stage first after screen mapping is completed. For example, by prioritizing the rasterization of opaque primitive sets that are closer to the camera, the depth buffer can be filled earlier, effectively reducing the rendering of invalid pixels (i.e., overdrawing) of subsequently occluded primitive sets, thereby accelerating the rasterization process.
[0069] In summary, the technical solution provided by the embodiments of this application, by performing data initialization processing of all or part of the storage space of the primitive set before the screen mapping process, can reduce or eliminate the need to pause the screen mapping process in subsequent screen mapping processes, thereby improving the efficiency of the screen mapping process.
[0070] The following describes the specific implementation method for performing screen mapping processing on primitive sets.
[0071] In some embodiments, during the screen mapping phase, screen mapping processing is performed on the primitive set, and the data of the screen mapping phase is stored in the initialized storage space, including: for any primitive set, based on the layer identifier of the primitive set, detecting whether the initialization flag of the second storage space corresponding to the layer to which the primitive set belongs is valid; if the initialization flag of the second storage space is valid, screen mapping processing is performed on the primitive set, and the processed result data is stored in the second storage space; wherein, the initialization flag being valid is used to indicate that the storage space has completed data initialization.
[0072] An initialization flag indicating that the second storage space has completed data initialization is valid. An invalid initialization flag indicating that the second storage space has not completed data initialization is invalid.
[0073] In some embodiments, primitive sets of the same layer are stored in the same initialized storage space during screen mapping, while primitive sets of different layers are stored in different storage spaces. This approach facilitates independent management and processing of primitive sets of different layers, improving system maintainability and scalability.
[0074] The above method ensures that data generated during screen mapping processing is only stored in the second storage space if the second storage space is the initialized storage space. This avoids errors caused by inconsistent data in the storage space during the screen mapping processing calculation.
[0075] In some embodiments, the method further includes: if the initialization flag of the second storage space is invalid, performing data initialization processing on the second storage space to obtain an initialized second storage space; and updating the initialization flag of the second storage space to be valid.
[0076] In some embodiments, such as Figure 2As shown, if the initialization flag of the second storage space is invalid (that is, if the data initialization process of the second storage space has not been completed), the screen mapping process for the primitive set is paused, the data initialization process for the second storage space is performed first to obtain the initialized second storage space, and then the screen mapping process for the primitive set is performed.
[0077] In some embodiments, since multiple primitive sets may belong to the same layer, that is, the data of the screen mapping stage of multiple primitive sets may be stored in the same storage space, after the data initialization process is performed on the second storage space for the first time, it is necessary to update its corresponding initialization flag, that is, the second storage space, in order to avoid repeated data initialization operations on the same storage space in the future.
[0078] The above method, by performing data initialization processing on the second storage space first, can ensure that the second storage space stores data in the correct state, thus guaranteeing the accuracy of data storage.
[0079] Furthermore, by updating the initialization flag of the second storage space to be valid, it is possible to avoid performing data initialization processing on the second storage space repeatedly in the future.
[0080] In some embodiments, the screen mapping processing of K primitive sets is performed serially, that is, screen mapping processing is performed on each primitive set in a certain order, and the processing of the next primitive set only begins after the screen mapping processing of the previous primitive set is completed. For example, K can be 5, which can include 5 primitive sets: primitive set 1, primitive set 2, primitive set 3, primitive set 4, and primitive set 5. The screen mapping processing of the K primitive sets can then be as follows: First, screen mapping processing is performed on primitive set 1. During this process, primitive set 1 is transformed from clipping space to screen coordinate space, and the data generated during the screen mapping process is stored in its corresponding storage space (it should be noted that if the storage space is not initialized, it should be initialized first). After the screen mapping processing and data storage of primitive set 1 are completed, screen mapping processing is then performed on primitive set 2, and the generated data is stored in its corresponding storage space (again, it is necessary to confirm whether the storage space has been initialized before storage). Following this pattern, the screen mapping and data storage for each primitive set are completed sequentially, in the order of primitive set 3, primitive set 4, and primitive set 5, until all primitive sets have been processed.
[0081] In some embodiments, when K is greater than 1, screen mapping processing for at least two primitive sets out of the K primitive sets is executed in parallel. That is, the system can perform screen mapping processing on multiple primitive sets simultaneously, fully utilizing the parallel computing capabilities of multi-core processors, GPUs, and other hardware to improve overall processing efficiency. During parallel processing, the processing of each primitive set is independent and does not interfere with each other, but it is necessary to ensure that the storage space corresponding to each primitive set has been initialized, or that the initialization operation of the storage space can be correctly handled during processing. For example, assuming K is 4, and these four primitive sets are primitive set 1, primitive set 2, primitive set 3, and primitive set 4, the system can perform screen mapping processing on primitive set 1 and primitive set 2 simultaneously. In this parallel processing, different computing units will be responsible for the screen mapping processing tasks of primitive set 1 and primitive set 2 respectively. For primitive set 1, the computing unit will convert it from clipping space to screen coordinate space, and simultaneously check whether its corresponding storage space has been initialized. If it has not been initialized, initialization processing will be performed first, and then the data generated during processing will be stored in that storage space. Meanwhile, another computing core or thread will perform the same screen mapping process on primitive set 2. Once the screen mapping processing for primitive set 1 and primitive set 2 is complete, the system can choose whether to continue processing primitive set 3 and primitive set 4 in parallel, or choose to process the remaining primitive sets serially. This parallel processing method can significantly shorten the overall processing time for K primitive sets, making it particularly suitable for applications with high real-time requirements, such as games and real-time video rendering. However, parallel processing also needs to consider limitations in hardware computing resources, data synchronization, and consistency to ensure the correctness and stability of the processing results.
[0082] In some embodiments, the method further includes: obtaining a layer identifier of a primitive set, the layer identifier of the primitive set being used to indicate the layer to which the primitive set belongs; and obtaining an initialization flag corresponding to the second storage space based on the layer flag of the primitive set, the initialization flag corresponding to the second storage space being used to indicate whether the second storage space has completed data initialization processing.
[0083] Layer identifiers are used to distinguish different layers. Layer identifiers for different primitive sets can be the same or different; this application does not impose any limitations on this. Initialization flags are used to indicate whether the storage space corresponding to a layer has completed data initialization processing. Table 1 below shows the initialization flags corresponding to the storage spaces of each of the N layers.
[0084] Table 1
[0085]
[0086] As shown in Table 1 above, for the initialization flag, 1 can represent that the storage space has completed data initialization processing, and 0 can represent that the storage space has not completed data initialization processing. For example, layer identifier 1 can be used to indicate layer 1, and its corresponding initialization flag is 1, which means that the storage space corresponding to layer 1 has completed data initialization processing.
[0087] The method described above can determine the layer to which a primitive set belongs by obtaining its layer identifier. Furthermore, it can further obtain the initialization flag corresponding to the second storage space based on the layer identifier, thereby accurately determining whether the second storage space has completed data initialization processing.
[0088] The following are embodiments of the apparatus described in this application, which can be used to execute the embodiments of the method described in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method described in this application.
[0089] Please refer to Figure 3 This diagram illustrates a block diagram of a rendering processing apparatus provided in one possible implementation of this application. The apparatus has the function of implementing the above-described rendering processing method; this function can be implemented in hardware or by hardware executing corresponding software. The apparatus 300 can be a computer device or can be installed within a computer device. The apparatus 300 may include: a determining module 310, an obtaining module 320, and a storage module 330.
[0090] The determining module 310 is used to determine the primitive set of the rendering object and the layer identifier of the primitive set based on the vertex data of the rendering object in the vertex stage of the geometric pipeline in the rendering process.
[0091] The obtaining module 320 is used to perform data initialization processing on M of the N storage spaces corresponding to the layer of the rendering object according to the layer identifier of the primitive set, so as to obtain M initialized storage spaces, where N is a positive integer and M is a positive integer less than or equal to N; the initialized storage spaces are used to store the data of the screen mapping stage in the geometry pipeline.
[0092] The storage module 330 is used to perform screen mapping processing on the primitive set during the screen mapping stage, and to store the data of the screen mapping stage into the initialized storage space.
[0093] In some embodiments, the obtaining module 320 is used to detect whether the initialization flag of the first storage space corresponding to any layer is valid for any layer; wherein, the first storage space is any one of the M storage spaces, and the initialization flag being valid is used to indicate that the storage space has completed data initialization; if the initialization flag of the first storage space is invalid, data initialization processing is performed on the first storage space to obtain the initialized first storage space; and the initialization flag of the first storage space is updated to be valid.
[0094] In some embodiments, for any primitive set, the storage module 330 detects whether the initialization flag of the second storage space corresponding to the layer to which the primitive set belongs is valid based on the layer identifier of the primitive set; if the initialization flag of the second storage space is valid, screen mapping processing is performed on the primitive set, and the processed result data is stored in the second storage space; wherein, the initialization flag being valid is used to indicate that the storage space has completed data initialization.
[0095] In some embodiments, the storage module 330 is further configured to perform data initialization processing on the second storage space when the initialization flag of the second storage space is invalid, to obtain an initialized second storage space; and update the initialization flag of the second storage space to be valid.
[0096] In some embodiments, the processing of the vertex data and the data initialization process are executed in parallel.
[0097] In some embodiments, when the number of storage spaces is greater than 1, at least two of the storage spaces perform data initialization processing in parallel.
[0098] Please refer to Figure 4 It shows a structural block diagram of a computer device 400 in one possible implementation of this application.
[0099] Typically, computer device 400 includes a processor 410 and a memory 420.
[0100] Processor 410 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. Processor 410 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field Programmable Gate Array), and PLA (Programmable Logic Array). Processor 410 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 410 may integrate a GPU as described above, which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, processor 410 may also include an AI processor for handling computational operations related to machine learning.
[0101] The memory 420 may include one or more computer-readable storage media, which may be non-transitory. The memory 420 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in the memory 420 are used to store a computer program configured to be executed by one or more processors to implement the rendering processing method described above.
[0102] Those skilled in the art will understand that Figure 4 The structure shown does not constitute a limitation on computer device 400, and may include more or fewer components than shown, or combine certain components, or use different component arrangements.
[0103] In some embodiments, a computer-readable storage medium is also provided, wherein a computer program is stored therein, the computer program being loaded and executed by a processor to implement the above-described rendering processing method.
[0104] Optionally, the computer-readable storage medium may include: ROM (Read-Only Memory), RAM (Random-Access Memory), SSD (Solid State Drives), or optical disc, etc. The random access memory may include ReRAM (Resistance Random Access Memory) and DRAM (Dynamic Random Access Memory).
[0105] In some embodiments, a computer program product is also provided, the computer program product including a computer program stored in a computer-readable storage medium, and a processor reading from the computer-readable storage medium and executing the computer program to implement the above-described rendering processing method.
[0106] It should be understood that "multiple" as used herein refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. Furthermore, the step numbers described herein are merely illustrative of one possible execution order. In some other embodiments, the steps may not be executed in numerical order, such as two steps with different numbers being executed simultaneously, or two steps with different numbers being executed in the reverse order of the illustration. This application does not limit this.
[0107] The above description is merely an exemplary embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A rendering processing method, characterized in that, The method includes: In the vertex stage of the geometry pipeline during rendering, the primitive set of the rendering object and the layer identifier of the primitive set are determined based on the vertex data of the rendering object. Based on the layer identifier of the primitive set, data initialization processing is performed on M of the N storage spaces corresponding to the layer of the rendering object to obtain M initialized storage spaces, where N is a positive integer and M is a positive integer less than or equal to N; the initialized storage spaces are used to store data in the screen mapping stage of the geometry pipeline; During the screen mapping phase, screen mapping processing is performed on the primitive set, and the data of the screen mapping phase is stored in the initialized storage space.
2. The method according to claim 1, characterized in that, The step of performing data initialization processing on M of the N storage spaces corresponding to the layer of the rendering object based on the layer identifier of the primitive set to obtain M initialized storage spaces includes: For any layer, check whether the initialization flag of the first storage space corresponding to the layer is valid; wherein, the first storage space is any one of the M storage spaces, and the validity of the initialization flag is used to indicate that the storage space has completed data initialization; If the initialization flag of the first storage space is invalid, perform data initialization processing on the first storage space to obtain the initialized first storage space; Update the initialization flag of the first storage space to be valid.
3. The method according to claim 1, characterized in that, The step of performing screen mapping processing on the primitive set during the screen mapping phase and storing the data of the screen mapping phase into the initialized storage space includes: For any primitive set, based on the layer identifier of the primitive set, check whether the initialization flag of the second storage space corresponding to the layer to which the primitive set belongs is valid; If the initialization flag of the second storage space is valid, screen mapping processing is performed on the primitive set, and the processed result data is stored in the second storage space; wherein, the initialization flag being valid is used to indicate that the storage space has completed data initialization.
4. The method according to claim 3, characterized in that, The method further includes: If the initialization flag of the second storage space is invalid, data initialization processing is performed on the second storage space to obtain the initialized second storage space. The invalid initialization flag is used to indicate that the storage space has not completed data initialization. Update the initialization flag of the second storage space to be valid.
5. The method according to claim 1, characterized in that, The processing of the vertex data and the data initialization process are executed in parallel.
6. The method according to claim 1, characterized in that, When the number of said storage spaces is greater than 1, at least two of said storage spaces perform data initialization processing in parallel.
7. A rendering processing apparatus, characterized in that, The device includes: The determination module is used to determine the primitive set of the rendering object and the layer identifier of the primitive set based on the vertex data of the rendering object during the vertex stage of the geometry pipeline in the rendering process. The module is configured to perform data initialization processing on M of the N storage spaces corresponding to the layer of the rendering object based on the layer identifier of the primitive set, to obtain M initialized storage spaces, where N is a positive integer and M is a positive integer less than or equal to N; the initialized storage spaces are used to store data of the screen mapping stage in the geometry pipeline; A storage module is used to perform screen mapping processing on the primitive set during the screen mapping phase and to store the data of the screen mapping phase into the initialized storage space.
8. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing a computer program that is loaded and executed by the processor to implement the method as claimed in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which is loaded and executed by a processor to implement the method as described in any one of claims 1 to 6.
10. A computer program product, characterized in that, The computer program product includes a computer program stored in a computer-readable storage medium, which a processor reads from and executes to implement the method as described in any one of claims 1 to 6.