Rendering processing method and apparatus, graphics processing device, and electronic device
Patent Information
- Application Number
- CN202610914883.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-24
- Publication Date
- 2026-08-18
AI Technical Summary
该实现方式不仅会导致数据量剧增,给总线带宽和可编程着色器带来巨大压力,而且会增加可编程着色器的复杂度和指令开销,从而导致图形渲染管线在处理大规模点精灵渲染时存在性能瓶颈
[0030] Thirdly, this disclosure provides a graphics processing device, including at least one processing core, wherein the processing core includes the rendering processing apparatus described above.
Smart Images

Figure CN122597612A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of graphics processing technology, and in particular to a rendering processing method and apparatus, graphics processing equipment, and electronic equipment. Background Technology
[0002] In computer graphics processing systems, points, as a basic primitive type, are widely used in scenarios such as particle systems, star fields, and visualization of sparse point cloud data. To achieve special effects such as flames, explosions, rain, and snow, point primitives are typically rendered using textured point sprite rendering.
[0003] In related technologies, sprite rendering is implemented using programmable shaders. This implementation not only leads to a surge in data volume, putting enormous pressure on bus bandwidth and programmable shaders, but also increases the complexity and instruction overhead of programmable shaders, resulting in performance bottlenecks in the graphics rendering pipeline when handling large-scale sprite rendering. Summary of the Invention
[0004] This disclosure provides a rendering processing method and apparatus, a graphics processing device, and an electronic device.
[0005] In a first aspect, this disclosure provides a rendering processing method, which includes: in a rasterization stage for rendering point primitives, rasterizing the point primitives according to their position coordinates and a preset point primitive size to obtain multiple fragments included in the point primitives; determining the texture coordinates of each fragment in the point primitives when a sprite rendering enable signal is enabled; wherein the sprite rendering enable signal is used to indicate whether sprite rendering is enabled; sampling a preset texture resource according to the texture coordinates of each fragment in the point primitives to obtain texture information of each fragment in the point primitives, and performing shading processing on the point primitives based on the texture information.
[0006] The rendering processing method of this disclosure can perform point sprite rendering of point primitives separately during the rasterization stage of the rendering pipeline, without relying on the programmable shader. Moreover, this method only requires the information of a single point primitive as input, which greatly reduces the total amount of vertex data and the attribute calculation load. This not only greatly alleviates the pressure on the system bus and programmable shader, but also enables point sprite rendering of point primitives in a high-performance and low-power manner, improving the performance of the graphics rendering pipeline when processing large-scale point sprite rendering.
[0007] In some possible implementations, the point primitive is rasterized based on its position coordinates and a preset point primitive size to obtain multiple fragments comprising the point primitive. This includes: determining the boundary information of the point primitive based on its position coordinates and a preset point primitive size; wherein the boundary information includes the side equation of the quadrilateral corresponding to the point primitive and the bounding box of the point primitive; and rasterizing the point primitive based on the side equation of the quadrilateral corresponding to the point primitive and the bounding box of the point primitive to obtain multiple fragments comprising the point primitive.
[0008] In the embodiments of this disclosure, rasterization of point primitives is performed based on the boundary information of the point primitives (the side equations of the quadrilaterals corresponding to the point primitives and the bounding boxes of the point primitives). This not only improves the accuracy of rasterization but also improves the processing efficiency during rasterization.
[0009] In some possible implementations, the boundary information also includes the vertex position coordinates of the quadrilateral. Determining the texture coordinates of each fragment in the point primitive includes: when the point sprite rendering enable signal is enabled, determining the texture surface equation of the point primitive based on the texture mode and the vertex position coordinates of the quadrilateral; wherein the texture mode is used to indicate the position of the texture coordinate origin in the texture coordinate system within the quadrilateral; and determining the texture coordinates of each fragment based on the texture surface equation and the position coordinates of each fragment in the point primitive.
[0010] In the embodiments of this disclosure, when the sprite rendering enable signal is enabled, the texture coordinates of each fragment in the point primitive can be determined based on the texture mode and texture surface equation, so that the calculation of the texture coordinates of each fragment in the point primitive no longer depends on the programmable shader, simplifying the calculation method of texture coordinates and improving the processing efficiency when determining the texture coordinates of fragments.
[0011] In some possible implementations, the texture surface equation of the point primitive is determined based on the texture pattern and the vertex position coordinates of the quadrilateral, including: determining the vertex texture coordinates of the quadrilateral based on the texture pattern; and determining the texture surface equation of the point primitive based on the vertex position coordinates and vertex texture coordinates of the quadrilateral.
[0012] In the embodiments of this disclosure, the texture surface equation of point primitives can be quickly determined based on the vertex position coordinates and vertex texture coordinates of a quadrilateral, thereby improving the processing efficiency when determining the texture surface equation of point primitives.
[0013] In some possible implementations, the texture surface equation of a point primitive is determined based on the vertex position coordinates and vertex texture coordinates of the quadrilateral, including: determining a first triangular primitive from the quadrilateral corresponding to the point primitive; wherein the vertices of the first triangular primitive are the vertices of the quadrilateral; determining the texture surface equation parameters based on the vertex position coordinates and vertex texture coordinates of the first triangular primitive; and determining the texture surface equation of the point primitive based on the texture surface equation parameters.
[0014] In the embodiments of this disclosure, when determining the texture surface equation of a point primitive, the texture surface equation parameters can be quickly determined by splitting the triangular primitives from the quadrilaterals corresponding to the point primitives, thereby determining the texture surface equation of the point primitive, which improves processing efficiency.
[0015] In some possible implementations, the rendering process is applied to a graphics processing device that includes a texture coordinate generation unit. The texture coordinate generation unit is used to determine the texture coordinates of each fragment in the point primitive in hardware when the point sprite rendering enable signal is enabled.
[0016] In embodiments of this disclosure, a dedicated hardware unit (i.e., a texture coordinate generation unit) is added to the rendering pipeline of the graphics processing device to calculate texture coordinates in point sprite rendering. In this way, the texture coordinates of each fragment in a point primitive can be determined in hardware, thereby improving the processing efficiency in determining the texture coordinates of each fragment in a point primitive.
[0017] In some possible implementations, the boundary information of the point primitive is determined based on its position coordinates and a preset point primitive size, including: determining the vertex position coordinates of the quadrilateral corresponding to the point primitive based on its position coordinates and the preset point primitive size; and determining the side equations of the quadrilateral and the bounding box of the point primitive based on the vertex position coordinates of the quadrilateral.
[0018] In the embodiments of this disclosure, point primitives can be quickly and accurately expanded into quadrilaterals based on their position coordinates and size, and their boundary information can be determined, thereby improving the processing efficiency when determining the boundary information of point primitives.
[0019] In some possible implementations, the vertex texture coordinates of the quadrilateral are determined according to the texture mode, including: in the case of the first texture mode where the origin of the texture coordinates is located at the bottom left vertex of the quadrilateral, the texture coordinates of the top left vertex of the quadrilateral are determined to be (0, 1), the texture coordinates of the bottom left vertex of the quadrilateral are determined to be (0, 0), the texture coordinates of the top right vertex of the quadrilateral are determined to be (1, 1), and the texture coordinates of the bottom right vertex of the quadrilateral are determined to be (1, 0); in the case of the second texture mode where the origin of the texture coordinates is located at the top left vertex of the quadrilateral, the texture coordinates of the top left vertex of the quadrilateral are determined to be (0, 0), the texture coordinates of the bottom left vertex of the quadrilateral are determined to be (0, 1), the texture coordinates of the top right vertex of the quadrilateral are determined to be (1, 0), and the texture coordinates of the bottom right vertex of the quadrilateral are determined to be (1, 1).
[0020] In the embodiments of this disclosure, different vertex texture coordinates can be set for quadrilaterals under different texture modes, so that the rendering processing method of the embodiments of this disclosure can support different texture coordinate systems, thereby improving the applicability of the rendering processing method of the embodiments of this disclosure.
[0021] In some possible implementations, the rendering method further includes: during the rendering of the second triangle primitive, if the fill mode of the second triangle primitive is point mode, determining the vertices of the second triangle primitive as point primitives.
[0022] In the embodiments of this disclosure, when the filling mode of the second triangle primitive is point mode, the vertices of the second triangle primitive can be determined as point primitives, and then the three vertices can be processed by the rendering processing method of the embodiments of this disclosure, thereby enabling the point sprite rendering of the three vertices of the second triangle primitive in point mode.
[0023] Secondly, this disclosure provides a rendering processing apparatus, comprising: a rasterization unit, configured to rasterize point primitives according to their position coordinates and a preset point primitive size during the rasterization stage of rendering point primitives, to obtain multiple fragments included in the point primitives; a texture coordinate generation unit, configured to determine the texture coordinates of each fragment in the point primitives when a sprite rendering enable signal is enabled; wherein the sprite rendering enable signal is used to indicate whether sprite rendering is enabled; and a fragment shading unit, configured to sample a preset texture resource according to the texture coordinates of each fragment in the point primitives, to obtain texture information of each fragment in the point primitives, and to perform shading processing on the point primitives based on the texture information.
[0024] In some possible implementations, the rasterization unit is specifically used to: determine the boundary information of the point primitive based on the position coordinates of the point primitive and the preset size of the point primitive; wherein, the boundary information includes the side equation of the quadrilateral corresponding to the point primitive and the bounding box of the point primitive; and rasterize the point primitive based on the side equation of the quadrilateral corresponding to the point primitive and the bounding box of the point primitive to obtain multiple fragments included in the point primitive.
[0025] In some possible implementations, the boundary information also includes the vertex position coordinates of the quadrilateral. Specifically, the texture coordinate generation unit is used to: determine the texture surface equation of the point primitive based on the texture mode and the vertex position coordinates of the quadrilateral when the point sprite rendering enable signal is enabled; wherein the texture mode is used to indicate the position of the texture coordinate origin in the texture coordinate system within the quadrilateral; and determine the texture coordinates of each fragment based on the texture surface equation and the position coordinates of each fragment in the point primitive.
[0026] In some possible implementations, the texture coordinate generation unit is specifically used to: determine the vertex texture coordinates of the quadrilateral based on the texture pattern; and determine the texture surface equation of the point primitive based on the vertex position coordinates and vertex texture coordinates of the quadrilateral.
[0027] In some possible implementations, the texture coordinate generation unit is specifically used to: determine a first triangular primitive from the quadrilateral corresponding to the point primitive; wherein the vertices of the first triangular primitive are the vertices of the quadrilateral; determine the texture surface equation parameters based on the vertex position coordinates and vertex texture coordinates of the first triangular primitive; and determine the texture surface equation of the point primitive based on the texture surface equation parameters.
[0028] In some possible implementations, the device is applied to a graphics processing device, and the rasterization unit, texture coordinate generation unit, and fragment shading unit are all hardware units.
[0029] In some possible implementations, the rasterization unit is specifically used to: determine the vertex coordinates of the quadrilateral corresponding to the point primitive based on the position coordinates of the point primitive and the preset point primitive size; and determine the side equations of the quadrilateral and the bounding box of the point primitive based on the vertex coordinates of the quadrilateral.
[0030] Thirdly, this disclosure provides a graphics processing device, including at least one processing core, wherein the processing core includes the rendering processing apparatus described above.
[0031] Fourthly, this disclosure provides an electronic device including at least one of the above-described graphics processing devices.
[0032] The embodiments provided in this disclosure, when performing sprite rendering on point primitives, can rasterize the point primitives according to their position coordinates and preset point primitive sizes during the rasterization stage of the rendering process, obtaining multiple fragments included in the point primitive. With the sprite rendering enable signal enabled, the texture coordinates of each fragment in the point primitive are determined. Then, based on the texture coordinates of each fragment, the texture resource is sampled to obtain the texture information of each fragment, and the point primitive is shaded based on the texture information, thereby realizing sprite rendering of point primitives. The rendering processing method of the embodiments of this disclosure can perform sprite rendering of point primitives separately during the rasterization stage of the rendering pipeline, without relying on programmable shaders. Furthermore, this method only requires input of the information of a single point primitive, greatly reducing the total amount of vertex data and the attribute calculation load. This not only significantly alleviates the pressure on the system bus and programmable shaders but also enables sprite rendering of point primitives in a high-performance, low-power manner, improving the performance of the graphics rendering pipeline when handling large-scale sprite rendering.
[0033] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0034] The accompanying drawings are provided to further illustrate the present disclosure and form part of the specification. They are used together with the embodiments of the present disclosure to explain the disclosure and do not constitute a limitation thereof. The above and other features and advantages will become more apparent to those skilled in the art from the description of detailed exemplary embodiments with reference to the accompanying drawings, which are described below.
[0035] Figure 1 This is a flowchart of a rendering processing method provided in an embodiment of the present disclosure.
[0036] Figure 2 This is a schematic diagram of the pixels included in a point primitive in a rendering processing method provided in an embodiment of this disclosure.
[0037] Figure 3 This is a schematic diagram of sprite rendering in a rendering processing method provided in an embodiment of the present disclosure.
[0038] Figure 4 This is a schematic diagram of the quadrilateral corresponding to the point primitive in a rendering processing method provided in an embodiment of this disclosure.
[0039] Figure 5 This is a schematic diagram of the texture coordinates of the quadrilateral corresponding to the point primitive in a rendering processing method provided in an embodiment of this disclosure.
[0040] Figure 6 This is a schematic diagram of the texture coordinates of the quadrilateral corresponding to the point primitive in a rendering processing method provided in an embodiment of this disclosure.
[0041] Figure 7 This is a schematic diagram of the first triangular primitive in a rendering processing method provided in an embodiment of the present disclosure.
[0042] Figure 8 This is a schematic diagram of vertex rendering of a triangle primitive provided in an embodiment of the present disclosure.
[0043] Figure 9 This is a schematic diagram of a rendering processing method provided in an embodiment of the present disclosure.
[0044] Figure 10 This is a schematic diagram of a rendering processing method provided in an embodiment of the present disclosure.
[0045] Figure 11 This is a block diagram of a rendering processing apparatus provided in an embodiment of the present disclosure.
[0046] Figure 12 This is a schematic diagram of a graphics processing device provided in an embodiment of the present disclosure. Detailed Implementation
[0047] To enable those skilled in the art to better understand the technical solutions of this disclosure, exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments of this disclosure to aid understanding. These should be considered merely exemplary. Therefore, those skilled in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0048] Where there is no conflict, the various embodiments of this disclosure and the features thereof in the embodiments may be combined with each other.
[0049] As used herein, the term “and / or” includes any and all combinations of one or more related enumerated entries.
[0050] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this disclosure. As used herein, the singular forms “a” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that when the terms “comprising” and / or “made of” are used in this specification, the presence of the stated feature, integral, step, operation, element, and / or component is specified, but the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or groups thereof is not excluded. Words such as “connected” or “linked” are not limited to physical or mechanical connections but can include electrical connections, whether direct or indirect.
[0051] Unless otherwise specified, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and this disclosure, and will not be interpreted as having an idealized or overly formal meaning, unless expressly so defined herein.
[0052] In computer graphics processing systems, points are a basic primitive type, and their rendering includes two methods: normal point rendering and point sprite rendering. In normal point rendering, the graphics processing device (such as a graphics processing unit) renders point primitives as images of fixed colors, meaning that every pixel in the rendered image has the same color. In point sprite rendering, the graphics processing device renders point primitives as textured images, meaning that each pixel in the rendered image has a unique texture.
[0053] In related technologies, sprite rendering is implemented using programmable shaders (such as geometry shaders, tessellation shaders, etc.). This implementation requires generating four additional vertices for each sprite primitive during the application phase or geometry shading phase and calculating the corresponding vertex attributes. This leads to a surge in data volume, putting enormous pressure on bus bandwidth and programmable shaders. Furthermore, it requires manually associating texture information with sprite primitives, increasing the complexity and instruction overhead of programmable shaders. Consequently, the graphics rendering pipeline experiences performance bottlenecks when handling large-scale sprite rendering.
[0054] To address the aforementioned technical problems, embodiments of this disclosure provide a rendering processing method, comprising: in a rasterization stage for rendering point primitives, rasterizing the primitives according to their position coordinates and a preset point primitive size to obtain multiple fragments comprising the point primitives; determining the texture coordinates of each fragment in the point primitives when a sprite rendering enable signal is enabled; wherein the sprite rendering enable signal is used to indicate whether sprite rendering is enabled; sampling a preset texture resource according to the texture coordinates of each fragment in the point primitives to obtain texture information of each fragment in the point primitives, and performing shading processing on the point primitives based on the texture information.
[0055] The rendering method of this disclosure, when rendering sprites from point primitives, can rasterize the point primitives according to their position coordinates and preset size during the rasterization stage of the rendering process, obtaining multiple fragments comprising the point primitive. When the sprite rendering enable signal is enabled, the texture coordinates of each fragment in the point primitive are determined, and the texture resource is sampled according to the texture coordinates of each fragment to obtain the texture information of each fragment. Then, the point primitive is shaded based on the texture information, thereby realizing sprite rendering of the point primitives. The rendering method of this disclosure can process sprite rendering of point primitives separately during the rasterization stage of the rendering pipeline, without relying on a programmable shader. Furthermore, this method only requires input of the information of a single point primitive, greatly reducing the total amount of vertex data and the attribute calculation load. This not only significantly alleviates the pressure on the system bus and programmable shaders but also enables sprite rendering of point primitives in a high-performance, low-power manner, improving the performance of the graphics rendering pipeline when processing large-scale sprite rendering.
[0056] The rendering processing method of this disclosure can be applied to a graphics processing device in an electronic device. When the graphics processor includes multiple processing cores, each processing core can be used to execute the rendering processing method of this disclosure. The graphics processing device can be a graphics processing unit (GPU), a general-purpose graphics processing unit (GPGPU), etc. The electronic device includes servers, terminal devices, etc. The terminal device can be a mobile phone, tablet computer, laptop computer, desktop computer, all-in-one computer, vehicle terminal, graphics workstation, etc. It should be noted that this disclosure does not limit the specific types of graphics processing devices, electronic devices, and terminal devices.
[0057] The rendering processing method of this disclosure can be implemented by a processor calling computer-readable program instructions stored in memory. Alternatively, the rendering processing method can be executed by a server. To improve processing efficiency, the rendering processing method of this disclosure can be implemented in hardware (e.g., hardware circuitry). That is, the processes, steps, details, etc., involved in the following embodiments are all implemented in hardware.
[0058] Figure 1 A flowchart illustrating a rendering process method provided in an embodiment of this disclosure. (Refer to...) Figure 1 The method includes steps S11-S13, which are described in detail below.
[0059] In step S11, during the rasterization stage of rendering point primitives, the point primitives are rasterized according to their position coordinates and preset point primitive sizes to obtain multiple fragments included in the point primitives.
[0060] In step S12, with the point sprite rendering enable signal enabled, the texture coordinates of each fragment in the point primitive are determined.
[0061] The sprite rendering enable signal is used to indicate whether sprite rendering is enabled.
[0062] In step S13, the preset texture resource is sampled according to the texture coordinates of each fragment in the point primitive to obtain the texture information of each fragment in the point primitive, and the point primitive is colored based on the texture information.
[0063] In some possible implementations, scenarios such as particle systems (simulating smoke, flames, and fluids), star fields, and visualization of sparse point cloud data require rendering large-scale points. The application can store the data of the points to be rendered in a preset storage space. Graphics processing devices (such as GPUs and GPGPUs) can read the data from this storage space and process it according to the order of the geometry pipeline, rasterization, and fragment pipeline, ultimately presenting it on the screen. The geometry pipeline is the geometric stage of graphics rendering, used to perform geometric data processing and transformations such as vertex shading, primitive assembly, and screen clipping. The rasterization stage, located between the geometry pipeline and the fragment pipeline, is used to determine the fragments covered by primitives and the attribute values of each fragment. The fragment pipeline is used to perform pixel shading, filtering, and blending on each fragment, ultimately generating the pixels displayed on the screen.
[0064] For point primitives, during geometry pipeline processing, the position coordinates and size of the point primitive can be determined from the input data. The point size indicates the size of the point primitive; it can be the side length of the quadrilateral corresponding to the point primitive, the radius of the point primitive (the distance between the point's position coordinates and the side of the quadrilateral, or point pitch), etc. The point size can be preset by the application. After geometry pipeline processing is complete, the rasterization stage begins. Based on the point primitive's position coordinates and size, rasterization is performed on the point primitive to obtain multiple fragments and their attribute values. These fragments and their attribute values are then input into the fragment pipeline for processing, ultimately generating the pixels corresponding to the point primitive.
[0065] It should be noted that the above embodiments illustrate the point primitive processing by describing the rendering pipeline as consisting of three main stages: geometry pipeline, rasterization, and fragment pipeline. In other words, the above embodiments treat rasterization as an independent stage of the rendering pipeline. However, in some embodiments, the rasterization stage may be considered the first stage of the fragment pipeline, thus dividing the rendering pipeline into two main stages: geometry pipeline and fragment pipeline. The difference between these two stage division methods lies only in whether the rasterization stage is independent; the rendering process (geometry processing, rasterization, and fragment shading processing in sequence) is the same. Therefore, when the rendering pipeline is divided into two main stages—geometry pipeline and fragment pipeline—the point primitive rendering process is similar to the above embodiments and will not be repeated here.
[0066] In some possible implementations, in step S11, during the rasterization stage of rendering the point primitives, the position coordinates and dimensions of the point primitives sent by the geometry pipeline are received, and the point primitives are rasterized based on their position coordinates and dimensions to obtain multiple fragments comprising the point primitive. During rasterization of the point primitives, the quadrilateral corresponding to the point primitive can be determined based on its position coordinates and dimensions, and then the multiple fragments comprising the point primitive can be determined based on the quadrilateral.
[0067] Figure 2 This is a schematic diagram of the fragments included in a point primitive in a rendering processing method provided by an embodiment of this disclosure. (Refer to...) Figure 2 The first point primitive 200 is rasterized to obtain 16 fragments including the first point primitive 200, namely fragment P0, fragment P1, fragment P2, fragment P3, fragment P4, fragment P5, fragment P6, fragment P7, fragment P8, fragment P9, fragment P10, fragment P11, fragment P12, fragment P13, fragment P14 and fragment P15.
[0068] In some possible implementations, after obtaining the multiple fragments comprising the point primitive, the sprite rendering enable signal corresponding to the point primitive can be obtained. For example, it can be obtained from the attribute instruction (used to pass attribute-related information) sent by the GPU driver. The sprite rendering enable signal is used to indicate whether sprite rendering is enabled. Then, it is determined whether the sprite rendering enable signal corresponding to the point primitive is enabled. If the sprite rendering enable signal corresponding to the point primitive is not enabled (i.e., ineffective or invalid), normal point rendering is performed on the point primitive, that is, each pixel of the point primitive is rendered as a fixed color.
[0069] When the sprite rendering enable signal corresponding to the point primitive is enabled (i.e., active or valid), the texture coordinates (UV texture coordinates) of each fragment in the point primitive can be determined in step S12. First, the texture coordinates of each vertex of the quadrilateral corresponding to the point primitive can be determined. Then, based on the texture coordinates of each vertex and the position coordinates of each fragment in the point primitive, the texture coordinates of each fragment in the point primitive can be determined by interpolation or other methods.
[0070] In some possible implementations, after obtaining the texture coordinates of each fragment in the point primitive, in step S13, a preset texture resource can be sampled based on the texture coordinates of each fragment in the point primitive to obtain the texture information of each fragment in the point primitive, and the point primitive can be shading processed based on the texture information. Specifically, for any fragment in the point primitive, the preset texture resource can be sampled based on the texture coordinates of the fragment to obtain the texture information of the fragment. The preset texture resource is the sprite texture used during the rendering of the point primitive. The texture information may include color (e.g., RGB values), normals, depth, grayscale, and custom parameters (e.g., roughness, metallicity, illumination coefficients, etc.). After obtaining the texture information of the fragment, the fragment can be shading processed based on the texture information. After completing the shading processing of all fragments in the point primitive, the sprite rendering result of the point primitive can be obtained.
[0071] Figure 3 This is a schematic diagram of sprite rendering in a rendering method provided in an embodiment of this disclosure. (Refer to...) Figure 3 The rendering method of this embodiment is used to perform sprite rendering on a second point primitive 310 with a point primitive size of w0 and a position coordinate of (x0, y0), and the rendering result is image 320. Each pixel in image 320 has an independent texture, that is, the texture of each pixel is different.
[0072] It should be noted that, in the case that the rendering pipeline of a graphics processing device includes three main stages: geometry pipeline, rasterization, and fragment pipeline, the above steps S11 and S12 are executed in the rasterization stage, and step S13 is executed in the fragment pipeline stage.
[0073] The rendering method of this disclosure, when rendering sprites from point primitives, can rasterize the point primitives according to their position coordinates and preset size during the rasterization stage of the rendering process, obtaining multiple fragments included in the point primitive. With the sprite rendering enable signal enabled, the texture coordinates of each fragment in the point primitive are determined. Then, based on the texture coordinates of each fragment, the texture resource is sampled to obtain the texture information of each fragment, and the point primitive is shaded based on the texture information, thereby realizing sprite rendering of point primitives. The rendering method of this disclosure can process sprite rendering of point primitives separately during the rasterization stage of the rendering pipeline, without relying on a programmable shader. Furthermore, this method only requires input of the information of a single point primitive, greatly reducing the total amount of vertex data and the attribute calculation load. This not only significantly alleviates the pressure on the system bus and programmable shaders but also enables sprite rendering of point primitives in a high-performance, low-power manner, improving the performance of the graphics rendering pipeline when handling large-scale sprite rendering.
[0074] The rendering processing method according to the embodiments of this disclosure will now be described in detail.
[0075] As described above, in step S11, the point primitive is rasterized according to its position coordinates and a preset point primitive size to obtain multiple fragments comprising the point primitive. In some possible implementations, step S11 may include: determining the boundary information of the point primitive according to its position coordinates and a preset point primitive size; wherein the boundary information includes the side equation of the quadrilateral corresponding to the point primitive and the bounding box of the point primitive; and rasterizing the point primitive according to the side equation of the quadrilateral corresponding to the point primitive and the bounding box of the point primitive to obtain multiple fragments comprising the point primitive.
[0076] When rasterizing point primitives, the boundary information of the point primitives can first be determined based on their position coordinates and size. This boundary information can include the side equations of the quadrilateral corresponding to the point primitive and its bounding box. In other words, based on the point primitive's position coordinates and size, the point primitive can be expanded into a quadrilateral (e.g., a square), and the side equations of its four sides can be determined. The bounding box (BBox) of a point primitive can be viewed as the integer pixel bounding box of the quadrilateral corresponding to the point primitive. For example, if the point primitive's position coordinates are (5, 5) and its size is 4 units, then the quadrilateral corresponding to the point primitive is a square with sides of 4 units. The point primitive's position coordinates (5, 5) are located at the center of this square. Then, the side equations of each side of this square and the bounding box of the point primitive can be determined. There are four side equations.
[0077] By using the side equations of the quadrilateral corresponding to the point primitive and the bounding box of the point primitive, the point primitive can be rasterized to obtain the multiple fragments it includes, thus determining the fragments covered by the point primitive. For any fragment within the bounding box of the point primitive, its position coordinates can be substituted into the side equations to determine whether the fragment lies within the quadrilateral defined by the four side equations of the point primitive. If it does, the fragment is determined to be a point primitive; otherwise, it is determined not to be a point primitive, thereby identifying the multiple fragments included by the point primitive.
[0078] In the embodiments of this disclosure, rasterization of point primitives is performed based on the boundary information of the point primitives (the side equations of the quadrilaterals corresponding to the point primitives and the bounding boxes of the point primitives). This not only improves the accuracy of rasterization but also improves the processing efficiency during rasterization.
[0079] In some possible implementations, determining the boundary information of a point primitive based on its position coordinates and a preset point primitive size may include: determining the vertex position coordinates of the quadrilateral corresponding to the point primitive based on its position coordinates and the preset point primitive size; and determining the side equations of the quadrilateral and the bounding box of the point primitive based on the vertex position coordinates of the quadrilateral.
[0080] When determining the boundary information of a point primitive, the vertex coordinates of the quadrilateral corresponding to the point primitive can be determined first based on its position coordinates and size. The vertex coordinates can be the coordinates of two opposite corner vertices or the coordinates of all four vertices of the quadrilateral. For example, assuming the point primitive's position coordinates are (5, 5), its size (indicating side length) is 4 units (e.g., pixels), and the vertex coordinates are based on the screen coordinate system (origin at the top left corner, X-axis to the right, Y-axis downwards, unit: pixels), then the quadrilateral corresponding to this point primitive can be determined to be a square with a side length of 4 units. The vertex coordinates of this square are (3, 3) at the top left corner, (3, 7) at the bottom left corner, (7, 3) at the top right corner, and (7, 7) at the bottom right corner. The vertex coordinates of the quadrilateral can also be used as the boundary information of the point primitive.
[0081] Then, based on the coordinates of the vertices of the quadrilateral, the equation of each side of the quadrilateral can be determined. For example, suppose the side equation can be expressed as Ax + By + C = 0. For any side of the quadrilateral, the coordinates of the two vertices of that side can be substituted into the above side equation to calculate the values of parameters A, B, and C, thus obtaining the side equation. Furthermore, based on the coordinates of the vertices of the quadrilateral, the bounding box of the point primitive can be determined, which can be represented by the coordinates of the corner points (i.e., opposite vertices).
[0082] Figure 4This is a schematic diagram of the quadrilateral corresponding to a point primitive in a rendering processing method provided in an embodiment of this disclosure. (Refer to...) Figure 4 The point primitive has coordinates (x1, y1) and size w1. Expanding this point primitive results in quadrilateral 400. Quadrilateral 400 has a side length of w1 and the coordinates of its top-left vertex are (x1, y1). a , y a The coordinates of the bottom right vertex are (x... b , y b ).
[0083] Based on the coordinates of the two opposite corners (top left and bottom right), the equations of the four sides of the quadrilateral can be calculated. The results are: the parameters for the left side of the quadrilateral are A=1, B=0, and C=-x. a The corresponding edge equation is xx a =0; the parameters of the top side of the quadrilateral are A=0, B=1, C=-y. a The corresponding side equation is yy a =0; the parameters of the right side of the quadrilateral are A=-1, B=0, C=x. b The corresponding side equation is -x + x b =0; the parameters of the bottom side of the quadrilateral are A=0, B=-1, C=y. b The corresponding side equation is -y + y b =0.
[0084] The bounding box of a point primitive can also be determined based on the coordinates of its two diagonal vertices. First, determine BBox_xmin (minimum value of the bounding box along the X-axis), BBox_xmax (maximum value of the bounding box along the X-axis), BBox_ymin (minimum value of the bounding box along the Y-axis), and BBox_ymax (maximum value of the bounding box along the Y-axis). BBox_xmin is determined by min(x... a , x b ) calculate, BBox_xmax is obtained through max(x a , x b ) calculate, BBox_ymin through min(y a , y b ) calculate, BBox_ymax through max(y a , y b The calculation is performed using the function `min()` to find the minimum value and `max()` to find the maximum value. Then, the region defined by `BBox_xmin`, `BBox_xmax`, `BBox_ymin`, and `BBox_ymax` is determined as the bounding box of the point primitive.
[0085] In the embodiments of this disclosure, the vertex coordinates of the quadrilateral corresponding to the point primitive can be determined based on the position coordinates and size of the point primitive. Based on the vertex coordinates of the quadrilateral, the side equation of each side of the quadrilateral and the bounding box of the point primitive can be determined. Thus, based on the position coordinates and size of the point primitive, the point primitive can be quickly and accurately expanded into a quadrilateral, and the boundary information of the point primitive can be determined, improving the processing efficiency when determining the boundary information of the point primitive.
[0086] In some possible implementations, the boundary information of the point primitive may also include the vertex position coordinates of the quadrilateral. Step S12 may include: when the point sprite rendering enable signal is enabled, determining the texture surface equation of the point primitive according to the texture mode and the vertex position coordinates of the quadrilateral; wherein, the texture mode is used to indicate the position of the texture coordinate origin in the texture coordinate system in the quadrilateral; and determining the texture coordinates of each fragment according to the texture surface equation and the position coordinates of each fragment in the point primitive.
[0087] When determining the texture coordinates of each fragment in a point primitive, the texture mode (UVmode) corresponding to the point primitive can be determined first. The texture mode indicates the position of the origin of the texture coordinate system within the quadrilateral corresponding to the point primitive. Texture modes can include a first mode where the origin is located at the bottom-left vertex (i.e., the bottom-left corner vertex) of the quadrilateral, and a second mode where the origin is located at the top-left vertex (i.e., the top-left corner vertex) of the quadrilateral. The texture mode corresponding to the point primitive can be obtained from the attribute instruction (used to pass attribute-related information) sent by the GPU driver.
[0088] After obtaining the texture pattern corresponding to the point primitive, the texture surface equation of the point primitive can be determined based on the texture pattern and the vertex coordinates of the quadrilateral corresponding to the point primitive. For example, a first mapping relationship between the texture coordinate system and the screen coordinate system can be established based on the texture pattern and vertex coordinates, and then the texture surface equation of the point primitive can be determined based on this first mapping relationship. After obtaining the texture surface equation, for any fragment in the point primitive, interpolation calculation can be performed using the texture surface equation based on the position coordinates of the fragment; that is, the position coordinates of the fragment are substituted into the texture surface equation to obtain the texture coordinates of the fragment.
[0089] In the embodiments of this disclosure, when the sprite rendering enable signal is enabled, the texture coordinates of each fragment in the point primitive can be determined based on the texture mode and texture surface equation, so that the calculation of the texture coordinates of each fragment in the point primitive no longer depends on the programmable shader, simplifying the calculation method of texture coordinates and improving the processing efficiency when determining the texture coordinates of fragments.
[0090] In some possible implementations, the texture surface equation of the point primitive is determined based on the texture pattern and the vertex position coordinates of the quadrilateral, including: determining the vertex texture coordinates of the quadrilateral based on the texture pattern; and determining the texture surface equation of the point primitive based on the vertex position coordinates and vertex texture coordinates of the quadrilateral.
[0091] The vertex texture coordinates of a quadrilateral can be determined based on its texture mode. Different texture modes result in different positions of the texture coordinate origin, and consequently, different vertex texture coordinates. After obtaining the vertex texture coordinates, the texture surface equation of the point primitive can be determined based on the vertex position coordinates and vertex texture coordinates. For example, a second mapping relationship can be established between the vertex position coordinates and vertex texture coordinates of the quadrilateral, and then the texture surface equation of the point primitive can be determined based on this second mapping relationship.
[0092] In the embodiments of this disclosure, the vertex texture coordinates of a quadrilateral can be determined according to the texture pattern, and the texture surface equation of a point primitive can be determined according to the vertex position coordinates and vertex texture coordinates of the quadrilateral. Thus, the texture surface equation of a point primitive can be quickly determined based on the vertex position coordinates and vertex texture coordinates of the quadrilateral, improving the processing efficiency when determining the texture surface equation of a point primitive.
[0093] In some possible implementations, the vertex texture coordinates of the quadrilateral are determined according to the texture mode, including: in the case of the first texture mode where the origin of the texture coordinates is located at the bottom left vertex of the quadrilateral, the texture coordinates of the top left vertex of the quadrilateral are determined to be (0, 1), the texture coordinates of the bottom left vertex of the quadrilateral are determined to be (0, 0), the texture coordinates of the top right vertex of the quadrilateral are determined to be (1, 1), and the texture coordinates of the bottom right vertex of the quadrilateral are determined to be (1, 0); in the case of the second texture mode where the origin of the texture coordinates is located at the top left vertex of the quadrilateral, the texture coordinates of the top left vertex of the quadrilateral are determined to be (0, 0), the texture coordinates of the bottom left vertex of the quadrilateral are determined to be (0, 1), the texture coordinates of the top right vertex of the quadrilateral are determined to be (1, 0), and the texture coordinates of the bottom right vertex of the quadrilateral are determined to be (1, 1).
[0094] In the first texture mode, where the texture coordinate origin is located at the bottom-left vertex of the quadrilateral, the U-axis in the texture coordinate system (i.e., the UV coordinate system) points horizontally to the right, the same direction as the X-axis in the screen coordinate system, and the V-axis points vertically upwards, opposite to the Y-axis in the screen coordinate system. In the first texture mode, since the texture coordinate origin is at the bottom-left vertex of the quadrilateral, the texture coordinates of the bottom-left vertex can be determined as (0, 0). With the V-axis pointing vertically upwards, the texture coordinates of the top-left vertex can be determined as (0, 1). With the U-axis pointing horizontally to the right, the texture coordinates of the top-right vertex can be determined as (1, 1), and the texture coordinates of the bottom-right vertex can be determined as (1, 0).
[0095] Figure 5 This is a schematic diagram of the texture coordinates of the quadrilateral corresponding to a point primitive in a rendering processing method provided in an embodiment of this disclosure. (Refer to...) Figure 5 In the first texture mode, where the texture coordinate origin is located at the bottom left vertex of the quadrilateral, the U-axis points horizontally to the right, and the V-axis points vertically upward. The quadrilateral corresponding to the point primitive (refer to...) Figure 4 The texture coordinates of the top left vertex of the quadrilateral are (0, 1), the texture coordinates of the bottom left vertex are (0, 0), the texture coordinates of the top right vertex are (1, 1), the texture coordinates of the bottom right vertex of the quadrilateral are (1, 0), and the texture coordinates of the center of the quadrilateral are (0.5, 0.5). That is, the texture coordinates corresponding to the position coordinates of the point primitive are (0.5, 0.5).
[0096] In the second texture mode, where the texture coordinate origin is located at the top-left vertex of the quadrilateral, the U-axis in the texture coordinate system points horizontally to the right, the same direction as the X-axis in the screen coordinate system, and the V-axis points vertically downwards, the same direction as the Y-axis in the screen coordinate system. In the second texture mode, since the texture coordinate origin is at the top-left vertex of the quadrilateral, the texture coordinates of the top-left vertex can be determined as (0, 0). With the V-axis pointing vertically downwards, the texture coordinates of the bottom-left vertex can be determined as (0, 1). With the U-axis pointing horizontally to the right, the texture coordinates of the top-right vertex can be determined as (1, 0), and the texture coordinates of the bottom-right vertex can be determined as (1, 1).
[0097] Figure 6 This is a schematic diagram of the texture coordinates of the quadrilateral corresponding to a point primitive in a rendering processing method provided in an embodiment of this disclosure. (Refer to...) Figure 6 In the second texture mode, where the texture coordinate origin is located at the top-left vertex of the quadrilateral, the U-axis points horizontally to the right, and the V-axis points vertically downward. The quadrilateral corresponding to the point primitive (refer to...) Figure 4The texture coordinates of the top left vertex of the quadrilateral are (0, 0), the texture coordinates of the bottom left vertex are (0, 1), the texture coordinates of the top right vertex are (1, 0), the texture coordinates of the bottom right vertex of the quadrilateral are (1, 1), and the texture coordinates of the center of the quadrilateral are (0.5, 0.5). That is, the texture coordinates corresponding to the position coordinates of the point primitive are (0.5, 0.5).
[0098] In the embodiments of this disclosure, different vertex texture coordinates can be set for quadrilaterals under different texture modes, so that the rendering processing method of the embodiments of this disclosure can support different texture coordinate systems, thereby improving the applicability of the rendering processing method of the embodiments of this disclosure.
[0099] In some possible implementations, the texture surface equation of a point primitive is determined based on the vertex position coordinates and vertex texture coordinates of the quadrilateral, including: determining a first triangular primitive from the quadrilateral corresponding to the point primitive; wherein the vertices of the first triangular primitive are the vertices of the quadrilateral; determining the texture surface equation parameters based on the vertex position coordinates and vertex texture coordinates of the first triangular primitive; and determining the texture surface equation of the point primitive based on the texture surface equation parameters.
[0100] When determining the texture surface equation (UV surface equation) of a point primitive, a first triangular primitive can be extracted from the quadrilateral corresponding to the point primitive. The three vertices of this first triangular primitive are also vertices of the quadrilateral corresponding to the point primitive. The plane containing the first triangular primitive is the same as the plane containing the quadrilateral corresponding to the point primitive. Then, based on the vertex position coordinates and vertex texture coordinates of the first triangular primitive, the texture surface equation parameters can be calculated. Furthermore, based on these parameters, the texture surface equation of the point primitive can be determined.
[0101] Before calculating the UV surface equation of a point primitive, the quadrilateral corresponding to the point primitive must first be decomposed into triangles for subsequent calculations. See below. Figure 7 The point primitive shown is located at coordinates (xorg, yorg), and its size (PointSize) is W2. The surface of such a point primitive can be decomposed into a triangular surface composed of three vertices (V0, V1, V2).
[0102] Figure 7 This is a schematic diagram of a first triangular primitive in a rendering processing method provided in an embodiment of this disclosure. (Refer to...) Figure 7Let the coordinates of the point primitive be (xorg, yorg), and the side length of the quadrilateral corresponding to the point primitive be w2. The first triangular primitive extracted from the quadrilateral corresponding to the point primitive is a primitive composed of vertices V0, V1, and V2. Therefore, the vertex coordinates of the first triangular primitive can be determined as follows: the vertex coordinates of V0 are (xorg-w2 / 2, yorg-w2 / 2), the vertex coordinates of V1 are (xorg+w2 / 2, yorg-w2 / 2), and the vertex coordinates of V2 are (xorg-w2 / 2, yorg+w2 / 2).
[0103] With the texture mode set to the first mode, the vertex texture coordinates of the first triangular primitive are: V0 (0, 1), V1 (1, 1), and V2 (0, 0). Substituting the vertex position coordinates and vertex texture coordinates of V0, V1, and V2 into the following two surface equations: U(x, y) = A0x + B0y + C0; V(x, y) = A1x + B1y + C1, the texture surface equation parameters can be calculated. The texture surface equation parameters in the U direction are: A0 = 1 / w², B0 = 0, C0 = 1 / 2 - xorg / w², and the texture surface equation parameters in the V direction are: A1 = 0, B1 = -1 / w², C1 = 1 / 2 + yorg / w². Then, based on these texture surface equation parameters, the texture surface equation of the point primitive can be determined.
[0104] With the texture mode set to the second mode, the vertex texture coordinates of the first triangular primitive are: V0 (0, 0), V1 (1, 0), and V2 (0, 1). Substituting the vertex position coordinates and vertex texture coordinates of V0, V1, and V2 into the following two surface equations: U(x, y) = A0x + B0y + C0; V(x, y) = A1x + B1y + C1, the texture surface equation parameters can be calculated. The texture surface equation parameters in the U direction are: A = 1 / w², B = 0, C = 1 / 2 - xorg / w², and the texture surface equation parameters in the V direction are: A = 0, B = 1 / w², C = 1 / 2 - yorg / w². Then, based on these texture surface equation parameters, the texture surface equation of the point primitive can be determined.
[0105] In the embodiments of this disclosure, when determining the texture surface equation of a point primitive, a first triangular primitive can be determined from the quadrilateral corresponding to the point primitive. Based on the vertex position coordinates and vertex texture coordinates of the first triangular primitive, the texture surface equation parameters are determined. Then, based on the texture surface equation parameters, the texture surface equation of the point primitive is determined. This improves processing efficiency by quickly determining the texture surface equation parameters based on the triangular primitives split from the quadrilateral corresponding to the point primitive.
[0106] In some possible implementations, the rendering processing method of this disclosure embodiment further includes: during the rendering of the second triangle primitive, when the fill mode of the second triangle primitive is point mode, determining the vertices of the second triangle primitive as point primitives.
[0107] In the process of rendering the second triangular primitive, when the fill mode is point mode, in order to realize the point sprite rendering of the three vertices of the second triangular primitive, the three vertices of the second triangular primitive can be extracted and determined as point primitives. Then, the point sprite rendering of the three vertices can be performed by the rendering processing method of this embodiment.
[0108] Figure 8 This is a schematic diagram of vertex rendering of a triangular primitive provided in an embodiment of the present disclosure. The position coordinates of the three vertices of the second triangular primitive are (x2, y2), (x3, y3) and (x4, y4) respectively. During the graphics rendering process of the second triangular primitive, when the fill mode is point mode, the three vertices can be processed by the rendering processing method of the embodiment of the present disclosure to obtain the point sprite rendering of the three vertices.
[0109] In the embodiments of this disclosure, when the filling mode of the second triangle primitive is point mode, the vertices of the second triangle primitive can be determined as point primitives, and then the three vertices can be processed by the rendering processing method of the embodiments of this disclosure, thereby enabling the point sprite rendering of the three vertices of the second triangle primitive in point mode.
[0110] In some possible implementations, the rendering processing method of this disclosure embodiment can be applied to a rendering pipeline to implement sprite rendering. Therefore, the rendering processing method of this disclosure embodiment can be executed by a graphics processing device that implements a rendering pipeline, i.e., it is applied to a graphics processing device. When the graphics processing device includes multiple processing cores, each of which can independently implement a rendering pipeline, the rendering processing method of this disclosure embodiment can also be executed by a processing core (i.e., a GPU core) in the graphics processing device.
[0111] When the graphics rendering method of this disclosure is applied to a graphics processing device, the graphics processing device includes a texture coordinate generation unit. This texture coordinate generation unit is used to determine the texture coordinates of each fragment in a point primitive via hardware (e.g., implemented through hardware circuitry) when a sprite rendering enable signal is enabled. In other words, a dedicated hardware unit (i.e., a texture coordinate generation unit) can be added to the rendering pipeline of the graphics processing device to implement sprite rendering. Therefore, the texture coordinate generation unit is a fixed-function hardware unit.
[0112] In cases where the graphics processing device may further include a rasterization unit and a fragment shading unit implemented in hardware, the texture coordinate generation unit is located after the rasterization unit and before the fragment shading unit. The rasterization unit, during the rasterization stage of rendering point primitives, rasterizes the point primitives based on their position coordinates and a preset point primitive size, resulting in multiple fragments comprising the point primitive. The fragment shading unit samples a preset texture resource based on the texture coordinates of each fragment in the point primitive, obtaining texture information for each fragment, and then uses this texture information to shading the point primitives.
[0113] In this way, the texture coordinates of each fragment in a point primitive can be determined in hardware, thereby improving the processing efficiency when determining the texture coordinates of each fragment in a point primitive.
[0114] In some possible implementations, where the graphics processing device's rendering pipeline implements ordinary point rendering in hardware, the rasterization unit and fragment shading unit described above can be used to perform rasterization and fragment shading during ordinary point rendering. This allows ordinary point rendering and sprite rendering to share some hardware units; or, in other words, ordinary point rendering can borrow some hardware units from sprite rendering, or vice versa. This approach saves on the area and power consumption of the graphics processing device and significantly reduces the hardware complexity of sprite rendering.
[0115] Figure 9 This is a schematic diagram illustrating a rendering processing method provided in an embodiment of this disclosure. (Refer to...) Figure 9 The rendering process includes steps S901-S908, which are described in detail below.
[0116] In step S901, during the rasterization stage of rendering point primitives, the boundary information of the point primitives is determined based on their position coordinates and preset point primitive sizes.
[0117] The boundary information includes the side equations of the quadrilateral corresponding to the point primitive, the vertex coordinates, and the bounding box of the point primitive.
[0118] In step S902, the point primitives are rasterized according to the boundary information to determine the multiple fragments included in the point primitives.
[0119] In step S903, when the sprite rendering enable signal is enabled, the vertex texture coordinates of the quadrilateral corresponding to the point primitive are determined according to the texture mode.
[0120] In step S904, a first triangular primitive is determined from the point primitives; wherein the vertices of the first triangular primitive are the vertices of the quadrilateral.
[0121] In step S905, the texture surface equation parameters are determined based on the vertex position coordinates and vertex texture coordinates of the first triangular primitive.
[0122] In step S906, the texture surface equation of the point primitive is determined according to the texture surface equation parameters.
[0123] In step S907, the texture coordinates of each fragment are determined according to the texture surface equation and the position coordinates of each fragment in the point primitive.
[0124] In step S908, the preset texture resource is sampled according to the texture coordinates of each fragment in the point primitive to obtain the texture information of each fragment in the point primitive, and the point primitive is colored based on the texture information.
[0125] The rendering method of this disclosure, when rendering sprites from point primitives, can rasterize the point primitives according to their position coordinates and preset size during the rasterization stage of the rendering process, obtaining multiple fragments included in the point primitive. When the sprite rendering enable signal is enabled, the texture coordinates of each fragment in the point primitive are determined. Then, based on the texture coordinates of each fragment, the texture resource is sampled to obtain the texture information of each fragment, and the point primitive is shaded based on the texture information, thereby realizing sprite rendering of point primitives. The rendering method of this disclosure can process sprite rendering of point primitives separately during the rasterization stage of the rendering pipeline, without relying on programmable shaders. Furthermore, this method only requires input of the information of a single point primitive, greatly reducing the total amount of vertex data and the attribute calculation load. This not only significantly alleviates the pressure on the system bus and programmable shaders but also enables sprite rendering of point primitives in a high-performance, low-power manner, improving the performance of the graphics rendering pipeline when handling large-scale sprite rendering.
[0126] Figure 10 This is a schematic diagram illustrating a rendering processing method provided in an embodiment of this disclosure. (Refer to...) Figure 10The point sprite rendering of point primitives includes five steps: determining boundary information (S101), performing rasterization (S102), determining texture coordinates (S103), performing texture sampling (S104), and performing fragment shading (S105).
[0127] First, step S101 is executed to determine the boundary information. This boundary information determination is performed during the rasterization stage. During boundary information determination, the position coordinates and dimensions of the point primitives sent by the geometry pipeline are received. Then, based on the position coordinates and dimensions of the point primitives, the vertex position coordinates of the quadrilateral corresponding to the point primitives are determined. Finally, based on the vertex position coordinates of the quadrilaterals, the side equations of the quadrilaterals and the bounding box of the point primitives are determined (refer to the above). Figure 4 (As shown in the embodiment), the boundary information of the point primitive is obtained, which includes the side equation of the quadrilateral corresponding to the point primitive, the vertex position coordinates, and the bounding box of the point primitive.
[0128] After obtaining the boundary information of the point primitives, rasterization is performed, i.e., step S102. The point primitives can be rasterized according to the side equations of the quadrilaterals corresponding to the point primitives and the bounding boxes of the point primitives in the boundary information of the point primitives, to obtain multiple fragments included in the point primitives.
[0129] Then, from the attribute instruction 110 corresponding to the point primitive, the sprite rendering enable signal corresponding to the point primitive is obtained, and it is determined whether the sprite rendering enable signal corresponding to the point primitive is enabled. If the sprite rendering enable signal corresponding to the point primitive is enabled (i.e., effective or valid), step S103 of determining texture coordinates is executed.
[0130] When determining texture coordinates, you can first determine the vertex texture coordinates of the quadrilateral corresponding to the point primitive based on the texture mode. Specifically, in the case of the first texture mode where the origin of the texture coordinates is located at the bottom left vertex of the quadrilateral, the texture coordinates of the top left vertex of the quadrilateral are determined as (0, 1), the texture coordinates of the bottom left vertex of the quadrilateral are determined as (0, 0), the texture coordinates of the top right vertex of the quadrilateral are determined as (1, 1), and the texture coordinates of the bottom right vertex of the quadrilateral are determined as (1, 0). For details, please refer to... Figure 5 The illustrated embodiment. In the second mode where the texture coordinate origin is located at the top-left vertex of the quadrilateral, the texture coordinates of the top-left vertex of the quadrilateral are determined to be (0, 0), the texture coordinates of the bottom-left vertex of the quadrilateral are determined to be (0, 1), the texture coordinates of the top-right vertex of the quadrilateral are determined to be (1, 0), and the texture coordinates of the bottom-right vertex of the quadrilateral are determined to be (1, 1). For details, please refer to... Figure 6 The example shown.
[0131] Then, the first triangular primitive is extracted from the quadrilateral corresponding to the point primitive. The vertices of the first triangular primitive are the vertices of the quadrilateral. Thus, the plane containing the first triangular primitive and the plane containing the quadrilateral corresponding to the point primitive are the same plane. The texture surface equation parameters can be determined based on the vertex coordinates and vertex texture coordinates of the first triangular primitive, and the texture surface equation of the point primitive can be determined based on these parameters. The specific method for determining the texture surface equation can be found in [reference needed]. Figure 7 The example shown is an example of this. Then, based on the texture surface equation and the position coordinates of each fragment in the point primitive, the texture coordinates of each fragment in the point primitive are determined through interpolation or other methods.
[0132] After obtaining the texture coordinates of each fragment in the point primitive, texture sampling can be performed, i.e., step S104. For any fragment in the point primitive, the texture resource 111 can be sampled according to the texture coordinates of the fragment to obtain the texture information of the fragment. After obtaining the texture information of each fragment in the point primitive, fragment shading can then be performed, i.e., step S105. The fragments can be shading based on the texture information of each fragment in the point primitive. After completing the shading process of all fragments in the point primitive, the point sprite rendering result of the point primitive can be obtained.
[0133] In point sprite rendering of point primitives, which is implemented in hardware, the rendering processing method of this disclosure includes five steps. Specifically, the hardware execution logic and hardware execution units for four steps—determining boundary information, performing rasterization, performing texture sampling, and performing fragment shading—can be shared with ordinary point rendering, thereby greatly simplifying hardware complexity. Based on this, it can be considered that the embodiments of this disclosure propose a hardware processing method that shares hardware between ordinary point rendering and point sprite rendering, on the basis of ordinary point rendering. That is, point sprite rendering can partially borrow hardware units from point rendering (such as rasterization units, fragment shading units, etc.), thereby not only greatly reducing the total amount of vertex data and attribute calculation load, alleviating the pressure on the system bus and programmable shaders, but also greatly simplifying the complexity of hardware support.
[0134] It is understood that the various method embodiments mentioned above in this disclosure can be combined with each other to form combined embodiments without violating the principle and logic. Due to space limitations, this disclosure will not elaborate further. Those skilled in the art will understand that in the above methods of specific implementation, the specific execution order of each step should be determined by its function and possible internal logic.
[0135] In addition, this disclosure also provides rendering processing apparatus, graphics processing equipment, and electronic equipment, all of which can be used to implement any of the rendering processing methods provided in this disclosure. The corresponding technical solutions and descriptions are described in the corresponding records in the method section and will not be repeated here.
[0136] Figure 11 This is a block diagram of a rendering processing apparatus provided in an embodiment of the present disclosure.
[0137] Reference Figure 11 This disclosure provides a rendering processing apparatus, which includes a rasterization unit 1010, a texture coordinate generation unit 1020, and a fragment shading unit 1030. The rasterization unit 1010 is used to rasterize point primitives according to their position coordinates and a preset point primitive size during the rasterization stage of rendering, obtaining multiple fragments comprising the point primitives. The texture coordinate generation unit 1020 is used to determine the texture coordinates of each fragment in the point primitives when a sprite rendering enable signal is enabled; wherein the sprite rendering enable signal is used to indicate whether sprite rendering is enabled. The fragment shading unit 1030 samples a preset texture resource according to the texture coordinates of each fragment in the point primitives to obtain texture information of each fragment in the point primitives, and performs shading processing on the point primitives based on the texture information.
[0138] In a graphics processing device's rendering pipeline, which comprises three main stages: geometry pipeline, rasterization, and fragment pipeline, the rasterization unit 1010, texture coordinate generation unit 1020, and fragment shading unit 1030 are all dedicated hardware units used to implement the aforementioned fixed functions. Specifically, the rasterization unit 1010 and texture coordinate generation unit 1020 are dedicated hardware units for the rasterization stage, while the fragment shading unit 1030 is a dedicated hardware unit for the fragment pipeline.
[0139] In some possible implementations, the rasterization unit 1010 is specifically used to: determine the boundary information of the point primitive based on the position coordinates of the point primitive and the preset size of the point primitive; wherein, the boundary information includes the side equation of the quadrilateral corresponding to the point primitive and the bounding box of the point primitive; and rasterize the point primitive based on the side equation of the quadrilateral corresponding to the point primitive and the bounding box of the point primitive to obtain multiple fragments included in the point primitive.
[0140] In some possible implementations, the boundary information also includes the vertex position coordinates of the quadrilateral. Specifically, the texture coordinate generation unit 1020 is used to: determine the texture surface equation of the point primitive based on the texture mode and the vertex position coordinates of the quadrilateral when the point sprite rendering enable signal is enabled; wherein the texture mode is used to indicate the position of the texture coordinate origin in the texture coordinate system in the quadrilateral; and determine the texture coordinates of each fragment based on the texture surface equation and the position coordinates of each fragment in the point primitive.
[0141] In some possible implementations, the texture coordinate generation unit 1020 is specifically used to: determine the vertex texture coordinates of the quadrilateral according to the texture pattern; and determine the texture surface equation of the point primitive according to the vertex position coordinates and vertex texture coordinates of the quadrilateral.
[0142] In some possible implementations, the texture coordinate generation unit 1020 is specifically used to: determine a first triangular primitive from the quadrilateral corresponding to the point primitive; wherein the vertices of the first triangular primitive are the vertices of the quadrilateral; determine the texture surface equation parameters based on the vertex position coordinates and vertex texture coordinates of the first triangular primitive; and determine the texture surface equation of the point primitive based on the texture surface equation parameters.
[0143] In some possible implementations, the apparatus is applied to a graphics processing device, and the rasterization unit 1010, texture coordinate generation unit 1020, and fragment shading unit 1030 are all hardware units.
[0144] In some possible implementations, the rasterization unit 1010 is specifically used to: determine the vertex position coordinates of the quadrilateral corresponding to the point primitive based on the position coordinates of the point primitive and the preset point primitive size; and determine the side equation of the quadrilateral and the bounding box of the point primitive based on the vertex position coordinates of the quadrilateral.
[0145] In some possible implementations, the texture coordinate generation unit 1020 is specifically used to: in the case of a first mode where the texture coordinate origin is located at the lower left vertex of the quadrilateral, determine the texture coordinates of the upper left vertex of the quadrilateral as (0, 1), the texture coordinates of the lower left vertex of the quadrilateral as (0, 0), the texture coordinates of the upper right vertex of the quadrilateral as (1, 1), and the texture coordinates of the lower right vertex of the quadrilateral as (1, 0); in the case of a second mode where the texture coordinate origin is located at the upper left vertex of the quadrilateral, determine the texture coordinates of the upper left vertex of the quadrilateral as (0, 0), the texture coordinates of the lower left vertex of the quadrilateral as (0, 1), the texture coordinates of the upper right vertex of the quadrilateral as (1, 0), and the texture coordinates of the lower right vertex of the quadrilateral as (1, 1).
[0146] In some possible implementations, the rendering processing apparatus further includes a point primitive determination unit, used to determine the vertices of the second triangle primitive as point primitives when the fill mode of the second triangle primitive is point mode during the rendering process.
[0147] The rendering processing method or apparatus of this disclosure can add a highly optimized dedicated data path to the rendering pipeline of a graphics processing device (e.g., GPU) to achieve high-performance, low-power rendering of a large number of sprites, providing key hardware acceleration support for applications such as advanced particle effects.
[0148] This disclosure also provides a graphics processing device, which includes at least one processing core, wherein the processing core includes the rendering processing apparatus described above. The graphics processing device is, for example, a GPU, and the processing core is, for example, a CPU core.
[0149] Figure 12 This is a schematic diagram of a graphics processing device provided in an embodiment of the present disclosure. (Refer to...) Figure 12 The graphics processing device 100 includes four processing cores 110. Each processing core 110 includes a rendering processing unit 1110. The rendering processing unit 1110 includes a rasterization unit, a texture coordinate generation unit, and a fragment shading unit connected in sequence.
[0150] It should be noted that this description is based on the example of a graphics processing device 100 including four processing cores 110. The specific number of processing cores 110 in the graphics processing device 100 can be set by those skilled in the art according to actual conditions, and this disclosure does not limit it.
[0151] This disclosure also provides an electronic device that includes at least one of the above-described graphics processing devices.
[0152] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction, which contains one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0153] Example embodiments have been disclosed herein, and while specific terminology has been used, it is for illustrative purposes only and should be construed as such, and is not intended to be limiting. In some instances, it will be apparent to those skilled in the art that features, characteristics, and / or elements described in connection with particular embodiments may be used alone, or in combination with features, characteristics, and / or elements described in connection with other embodiments, unless otherwise expressly indicated. Therefore, those skilled in the art will understand that various changes in form and detail may be made without departing from the scope of this disclosure as set forth by the appended claims.
Claims
1. A rendering processing method, characterized in that, include: In the rasterization stage of rendering point primitives, the point primitives are rasterized according to their position coordinates and preset point primitive sizes to obtain multiple fragments included in the point primitives; When the sprite rendering enable signal is enabled, the texture coordinates of each fragment in the point primitive are determined; wherein, the sprite rendering enable signal is used to indicate whether sprite rendering is enabled. Based on the texture coordinates of each fragment in the point primitive, a preset texture resource is sampled to obtain the texture information of each fragment in the point primitive, and the point primitive is colored based on the texture information.
2. The method according to claim 1, characterized in that, The step involves rasterizing the point primitive based on its position coordinates and a preset point primitive size to obtain multiple fragments comprising the point primitive, including: Based on the position coordinates of the point primitive and the preset size of the point primitive, the boundary information of the point primitive is determined; wherein, the boundary information includes the side equation of the quadrilateral corresponding to the point primitive and the bounding box of the point primitive; Based on the side equations of the quadrilaterals corresponding to the point primitives and the bounding boxes of the point primitives, the point primitives are rasterized to obtain multiple fragments comprising the point primitives.
3. The method according to claim 2, characterized in that, The boundary information also includes the vertex coordinates of the quadrilateral. The step of determining the texture coordinates of each fragment in the point primitive includes: When the sprite rendering enable signal is enabled, the texture surface equation of the point primitive is determined according to the texture mode and the vertex position coordinates of the quadrilateral; wherein, the texture mode is used to indicate the position of the texture coordinate origin in the texture coordinate system in the quadrilateral; Based on the texture surface equation and the position coordinates of each fragment in the point primitive, the texture coordinates of each fragment are determined respectively.
4. The method according to claim 3, characterized in that, Determining the texture surface equation of the point primitive based on the texture pattern and the vertex coordinates of the quadrilateral includes: Based on the texture pattern, determine the vertex texture coordinates of the quadrilateral; The texture surface equation of the point primitive is determined based on the vertex position coordinates and vertex texture coordinates of the quadrilateral.
5. The method according to claim 4, characterized in that, The step of determining the texture surface equation of the point primitive based on the vertex position coordinates and vertex texture coordinates of the quadrilateral includes: A first triangular primitive is determined from the quadrilaterals corresponding to the point primitives; wherein the vertices of the first triangular primitives are the vertices of the quadrilaterals; Based on the vertex position coordinates and vertex texture coordinates of the first triangular primitive, determine the texture surface equation parameters; The texture surface equation of the point primitive is determined based on the texture surface equation parameters.
6. The method according to claim 2, characterized in that, The step of determining the boundary information of the point element based on its position coordinates and a preset point element size includes: Based on the position coordinates of the point primitive and the preset point primitive size, determine the vertex position coordinates of the quadrilateral corresponding to the point primitive; Based on the vertex coordinates of the quadrilateral, determine the side equations of the quadrilateral and the bounding box of the point primitive.
7. The method according to claim 4, characterized in that, Determining the vertex texture coordinates of the quadrilateral based on the texture pattern includes: In the case where the texture mode is the first mode where the origin of the texture coordinates is located at the lower left vertex of the quadrilateral, the texture coordinates of the upper left vertex of the quadrilateral are determined to be (0, 1), the texture coordinates of the lower left vertex of the quadrilateral are determined to be (0, 0), the texture coordinates of the upper right vertex of the quadrilateral are determined to be (1, 1), and the texture coordinates of the lower right vertex of the quadrilateral are determined to be (1, 0). In the case where the texture mode is the second mode where the origin of the texture coordinates is located at the top left vertex of the quadrilateral, the texture coordinates of the top left vertex of the quadrilateral are determined to be (0, 0), the texture coordinates of the bottom left vertex of the quadrilateral are determined to be (0, 1), the texture coordinates of the top right vertex of the quadrilateral are determined to be (1, 0), and the texture coordinates of the bottom right vertex of the quadrilateral are determined to be (1, 1).
8. The method according to any one of claims 1 to 7, characterized in that, The method is applied to a graphics processing device, which includes a texture coordinate generation unit. The texture coordinate generation unit is used to determine the texture coordinates of each fragment in the point primitive by means of hardware when the point sprite rendering enable signal is enabled.
9. The method according to any one of claims 1 to 7, characterized in that, The method further includes: During the rendering of the second triangle primitive, when the fill mode of the second triangle primitive is point mode, the vertices of the second triangle primitive are determined as the point primitives.
10. A rendering processing apparatus, characterized in that, include: A rasterization unit is used to rasterize the point primitives according to their position coordinates and preset point primitive size during the rasterization stage of rendering the point primitives, so as to obtain multiple fragments included in the point primitives. The texture coordinate generation unit is used to determine the texture coordinates of each fragment in the point primitive when the point sprite rendering enable signal is enabled; wherein the point sprite rendering enable signal is used to indicate whether point sprite rendering is enabled. The fragment shading unit samples a preset texture resource based on the texture coordinates of each fragment in the point primitive to obtain the texture information of each fragment in the point primitive, and performs shading processing on the point primitive based on the texture information.
11. The apparatus according to claim 10, characterized in that, The rasterization unit is specifically used for: Based on the position coordinates of the point primitive and the preset size of the point primitive, the boundary information of the point primitive is determined; wherein, the boundary information includes the side equation of the quadrilateral corresponding to the point primitive and the bounding box of the point primitive; Based on the side equations of the quadrilaterals corresponding to the point primitives and the bounding boxes of the point primitives, the point primitives are rasterized to obtain multiple fragments comprising the point primitives.
12. The apparatus according to claim 11, characterized in that, The boundary information also includes the vertex coordinates of the quadrilateral, wherein the texture coordinate generation unit is specifically used for: When the sprite rendering enable signal is enabled, the texture surface equation of the point primitive is determined according to the texture mode and the vertex position coordinates of the quadrilateral; wherein, the texture mode is used to indicate the position of the texture coordinate origin in the texture coordinate system in the quadrilateral; Based on the texture surface equation and the position coordinates of each fragment in the point primitive, the texture coordinates of each fragment are determined respectively.
13. The apparatus according to claim 12, characterized in that, The texture coordinate generation unit is specifically used for: Based on the texture pattern, determine the vertex texture coordinates of the quadrilateral; The texture surface equation of the point primitive is determined based on the vertex position coordinates and vertex texture coordinates of the quadrilateral.
14. The apparatus according to claim 13, characterized in that, The texture coordinate generation unit is specifically used for: A first triangular primitive is determined from the quadrilaterals corresponding to the point primitives; wherein the vertices of the first triangular primitives are the vertices of the quadrilaterals; Based on the vertex position coordinates and vertex texture coordinates of the first triangular primitive, determine the texture surface equation parameters; The texture surface equation of the point primitive is determined based on the texture surface equation parameters.
15. The apparatus according to any one of claims 10 to 14, characterized in that, The rasterization unit is specifically used for: Based on the position coordinates of the point primitive and the preset point primitive size, determine the vertex position coordinates of the quadrilateral corresponding to the point primitive; Based on the vertex coordinates of the quadrilateral, determine the side equations of the quadrilateral and the bounding box of the point primitive.
16. The apparatus according to any one of claims 10 to 14, characterized in that, The device is applied to a graphics processing equipment, and the rasterization unit, the texture coordinate generation unit, and the fragment shading unit are all hardware units.
17. A graphics processing device, characterized in that, It includes at least one processing core, wherein the processing core includes a rendering processing apparatus as described in any one of claims 10-16.
18. An electronic device, characterized in that, It includes at least one graphics processing device as described in claim 17.