Tile-based rasterization method and device, and image rendering method and device
Through the tile-based rasterization method, the problem of limited image rendering performance and image quality of mobile GPUs under small bandwidth is solved, achieving efficient GPU performance improvement and image quality improvement, and reducing memory bandwidth pressure.
Patent Information
- Application Number
- PCT/CN2024/076052
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-02-20
- Filing Date
- 2024-02-05
- Publication Date
- 2024-08-29
AI Technical Summary
Due to the limited memory bandwidth of mobile-level GPUs during the image rendering process, performance and image quality are limited. Existing technologies are difficult to improve GPU performance and image quality under small bandwidth.
Using a tile-based rasterization method, the image is divided into multiple sub-tiles, and vertex processing is used to determine whether each sub-tile is covered by a primitive, and the covered sub-tiles are rasterized to generate pixel quadruple data. , flexibly adjust tile size and sampling rate to reduce the impact of on-chip cache.
It effectively reduces the frequent interaction between the GPU and system memory, reduces power consumption and bandwidth, improves GPU performance and image quality, enables flexible tile size and sampling rate settings, and relieves memory read and write bandwidth pressure.
Smart Images

Figure CN2024076052_29082024_PF_FP_ABST
Abstract
Description
Tile-based rasterization method and device, image rendering method and device
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This disclosure is based on and claims the priority of Chinese patent application No. 2023101360268, filed on February 20, 2023. The entire contents of this Chinese patent application are incorporated herein by reference. Technical Field
[0003] The present disclosure relates to a tile-based rasterization method and device, and an image rendering method and device. Background Art
[0004] Image rendering consumes a significant amount of memory bandwidth. Compared to desktop graphics processing units (GPUs), mobile GPUs not only have limited available memory bandwidth but also generally utilize low-power, narrow-bandwidth memory. Therefore, the bandwidth of mobile GPUs can limit image rendering. Improving GPU performance and image quality while minimizing bandwidth requirements is a pressing issue in this field.
[0005] Summary of the Invention
[0006] The present disclosure provides a tile-based rasterization method and device, and an image rendering method and device.
[0007] According to one aspect of the present disclosure, a tile-based rasterization method is provided. The method includes: dividing a tile into a plurality of first sub-tiles, wherein the tile is obtained by dividing the screen space for displaying an image of a scene to be rendered; determining whether each first sub-tile is covered by a primitive, wherein the primitive is obtained by performing vertex processing on the scene to be rendered; in response to the first sub-tile being covered by the primitive, rasterizing the primitive with the pixels in the first sub-tile covered by the primitive as mapping objects to determine the first mask value of each sampling point of each pixel of the first sub-tile covered by the primitive; combining the first sub-tiles whose sampling points have determined the first mask value to form a rasterized tile; and determining pixel quad data based on the rasterized tile, wherein the pixel quad data includes the first mask value.
[0008] In some embodiments, based on the rasterized tile, determining the pixel quad data includes: determining the amount of color data stored in the pixel and the number of sampling points of the pixel; in response to the amount of color data stored in the pixel being less than the number of sampling points of the pixel, dividing the rasterized tile into a plurality of second sub-tiles based on the capacity of the on-chip color cache of the graphics processor; and extracting the pixel quad data from the data information of the second sub-tile.
[0009] In some embodiments, determining the pixel quad data based on the rasterized tile further comprises: extracting the pixel quad data from the data information of the first sub-tile in response to the number of color data stored in the pixel being equal to the number of sampling points of the pixel.
[0010] In some embodiments, dividing the rasterized tile into multiple second sub-tiles based on the capacity of the on-chip color cache of the graphics processor includes: determining a preset size of the second sub-tiles based on the capacity of the on-chip color cache of the graphics processor; and acquiring the second sub-tiles along the row and column directions on the rasterized tile according to the preset size of the second sub-tiles.
[0011] In some embodiments, the on-chip color cache includes multiple storage blocks, and based on the capacity of the on-chip color cache of the graphics processor, dividing the rasterized tile into multiple second sub-tiles also includes: determining whether the actual size of the edge second sub-tiles of the row and / or the column is less than or equal to half of the preset size; in response to the actual size of the edge second sub-tiles being less than or equal to half of the preset size, storing at least two edge second sub-tiles in a single storage block.
[0012] In some embodiments, determining whether each first sub-block is covered by the primitive includes: determining the vertical coordinate range of the minimum outer rectangular frame surrounding the primitive; determining row by row whether the vertical coordinate range of the first sub-blocks in each row at least partially overlaps with the vertical coordinate range of the minimum outer rectangular frame; in response to the vertical coordinate range of the first sub-blocks in a row not at least partially overlapping with the vertical coordinate range of the minimum outer rectangular frame, determining that the first sub-blocks in the first sub-blocks in the row are not covered by the primitive.
[0013] In some embodiments, determining whether each first sub-block is covered by the graphic element further includes: determining the horizontal coordinate range of the minimum outer rectangular frame surrounding the graphic element; in response to the vertical coordinate range of a row of first sub-blocks at least partially overlapping with the vertical coordinate range of the minimum outer rectangular frame, determining one by one whether the horizontal coordinate range of each first sub-block in the row of first sub-blocks at least partially overlaps with the horizontal coordinate range of the minimum outer rectangular frame; in response to the horizontal coordinate range of the first sub-block in the row of first sub-blocks not at least partially overlapping with the horizontal coordinate range of the minimum outer rectangular frame, determining that the first sub-block is not covered by the graphic element.
[0014] In some embodiments, determining whether each first sub-tile is covered by a primitive includes: determining whether an area defined by the vertex coordinates of the primitive at least partially overlaps with an area defined by the horizontal coordinate range and the vertical coordinate range of the first sub-tile; and determining that the first sub-tile is covered by the primitive in response to the area defined by the vertex coordinates of the primitive at least partially overlapping with an area defined by the horizontal coordinate range and the vertical coordinate range of the first sub-tile.
[0015] In some embodiments, determining whether each first sub-image block is covered by the primitive includes: sampling the sub-image block sampling points of the first sub-image block to determine a second mask value of the first sub-image block; and determining whether the first sub-image block is covered by the primitive based on the second mask value of the first sub-image block.
[0016] In some embodiments, the method further includes, in response to the first sub-block not being covered by a primitive, assigning a preset first mask value to a sampling point of a pixel of the first sub-block.
[0017] According to another aspect of the present disclosure, an image rendering method is provided. The image rendering method includes: performing vertex processing on a scene to be rendered to obtain primitive data of the scene to be rendered; dividing a screen space for displaying an image of the scene to be rendered to obtain tile data; determining a primitive list for each tile based on the primitive data and the tile data; performing a tile-based rasterization method according to any embodiment of the present disclosure on each tile based on the primitive list to obtain the pixel quad data; determining a sampling point coverage of a pixel based on the pixel quad data; storing a first amount of color data for a pixel based on the sampling point coverage, wherein the number of sampling points of the pixel is a second amount, and the first amount and the second amount are set independently of each other; storing the color data of the pixels of each tile to a system memory; merging the color data of each tile in the system memory to obtain a rendered image.
[0018] In some embodiments, performing vertex processing on a scene to be rendered to obtain graphic metadata of the scene to be rendered includes: determining vertex coordinates of objects in the scene to be rendered; transforming the vertex coordinates from an object-based coordinate system to a coordinate system based on world space or normalized device coordinate space to obtain vertex transformation coordinates; and determining the graphic metadata based on the vertex transformation coordinates.
[0019] According to another aspect of the present disclosure, a tile-based rasterization device is provided. The rasterization device includes: a tile parser configured to divide a tile into a plurality of first sub-tiles, wherein the tile is obtained by dividing a screen space for displaying an image of a scene to be rendered; a sub-tile rasterizer configured to determine whether each first sub-tile is covered by a primitive, wherein the primitive is obtained by performing vertex processing on the scene to be rendered; a sampling point rasterizer configured to, in response to the first sub-tile being covered by the primitive, rasterize the primitive using pixels in the first sub-tile covered by the primitive as mapping objects to determine a first mask value for each sampling point of each pixel of the first sub-tile covered by the primitive; a tile reassembler configured to combine the first sub-tiles whose sampling points have determined the first mask values to form a rasterized tile; and a pixel quad generator configured to determine pixel quad data based on the rasterized tile, wherein the pixel quad data includes the first mask value.
[0020] In some embodiments, the pixel quad generator includes a tile re-decomposer and a pixel quad packer, wherein the tile re-decomposer is configured to determine the amount of color data stored in the pixel and the number of sampling points of the pixel, and in response to the amount of color data stored in the pixel being less than the number of sampling points of the pixel, divide the rasterized tile into multiple second sub-tiles based on the capacity of the on-chip color cache of the graphics processor; the pixel quad packer is configured to extract pixel quad data from the data information of the second sub-tile.
[0021] In some embodiments, the tile re-decomposer is further configured to extract pixel quad data from the data information of the first sub-tile in response to the number of color data stored in the pixel being equal to the number of sampling points of the pixel.
[0022] In some embodiments, the tile re-decomposer configured to divide the rasterized tile into multiple second sub-tiles based on the capacity of the on-chip color cache of the graphics processor is further configured to: determine a preset size of the second sub-tile based on the capacity of the on-chip color cache of the graphics processor; and obtain the second sub-tiles along the row and column directions on the rasterized tile according to the preset size of the second sub-tile.
[0023] In some embodiments, the on-chip color cache includes multiple storage blocks, and the tile re-decomposer configured to divide the rasterized tile into multiple second sub-tiles based on the capacity of the on-chip color cache of the graphics processor is further configured to: determine whether the actual size of the edge second sub-tiles of the row and / or the column is less than or equal to half of the preset size; and in response to the actual size of the edge second sub-tiles being less than or equal to half of the preset size, store at least two edge second sub-tiles in a single storage block.
[0024] In some embodiments, a sub-tile rasterizer configured to determine whether each first sub-tile is covered by a primitive is further configured to: determine a vertical coordinate range of a minimum outer rectangular box surrounding the primitive; determine row by row whether the vertical coordinate range of each row of first sub-tiles at least partially overlaps with the vertical coordinate range of the minimum outer rectangular box; and determine, in response to the vertical coordinate range of a row of first sub-tiles not at least partially overlapping with the vertical coordinate range of the minimum outer rectangular box, that the first sub-tiles in the row of first sub-tiles are not covered by the primitive.
[0025] In some embodiments, the sub-tile rasterizer configured to determine whether each first sub-tile is covered by the primitive is further configured to: determine the horizontal coordinate range of the minimum outer rectangular box surrounding the primitive; in response to the vertical coordinate range of a row of first sub-tiles at least partially overlapping with the vertical coordinate range of the minimum outer rectangular box, determine one by one whether the horizontal coordinate range of each first sub-tile in the row of first sub-tiles at least partially overlaps with the horizontal coordinate range of the minimum outer rectangular box; in response to the horizontal coordinate range of the first sub-tile in the row of first sub-tiles not at least partially overlapping with the horizontal coordinate range of the minimum outer rectangular box, determine that the first sub-tile is not covered by the primitive.
[0026] In some embodiments, a sub-tile rasterizer configured to determine whether each first sub-tile is covered by a primitive is further configured to: determine whether an area defined by the vertex coordinates of the primitive at least partially overlaps with an area defined by the horizontal coordinate range and the vertical coordinate range of the first sub-tile; and determine that the first sub-tile is covered by the primitive in response to the area defined by the vertex coordinates of the primitive at least partially overlapping with an area defined by the horizontal coordinate range and the vertical coordinate range of the first sub-tile.
[0027] In some embodiments, the sub-tile rasterizer configured to determine whether each first sub-tile is covered by a primitive is further configured to: sample sub-tile sampling points of the first sub-tile to determine a second mask value for the first sub-tile; and determine whether the first sub-tile is covered by the primitive based on the second mask value for the first sub-tile.
[0028] In some embodiments, the sub-tile rasterizer is further configured to, in response to the first sub-tile being not covered by primitives, assign a preset first mask value to sampling points of pixels of the first sub-tile.
[0029] According to another aspect of the present disclosure, an image rendering device is provided. The image rendering device includes: a vertex processor configured to perform vertex processing on a scene to be rendered to obtain primitive data of the scene to be rendered; a tile divider configured to divide the screen space for displaying the image of the scene to be rendered to obtain tile data; and, based on the primitive data and the tile data, determining a primitive list for each tile; a tile-based rasterization device according to any embodiment of the present disclosure, the rasterization device determines pixel quad data based on the primitive list; a pixel processor configured to determine a sampling point coverage of a pixel based on the pixel quad data; based on the sampling point coverage, storing a first amount of color data for the pixel, and storing the color data of each tile to a system memory, wherein the number of sampling points of the pixel is a second amount, and the first amount and the second amount are set independently of each other; an output merger configured to merge the color data of each tile in the system memory to obtain a rendered image.
[0030] In some embodiments, the vertex processor is further configured to: determine the vertex coordinates of an object in a scene to be rendered; transform the vertex coordinates from an object-based coordinate system to a coordinate system based on world space or normalized device coordinate space to obtain vertex transformation coordinates; and determine the graphic metadata based on the vertex transformation coordinates. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The above and other aspects, objects and features of the present disclosure will become clear from the following detailed description of exemplary embodiments of the present disclosure with reference to the accompanying drawings.
[0032] FIG1 schematically shows a block diagram of a related tile-based rendering pipeline;
[0033] FIG2 schematically shows the screen space after being divided into tiles;
[0034] FIG3 schematically illustrates the process of composing a display image from the results of block-by-block rendering;
[0035] FIG4 shows the architecture of a system on a chip in which the method of an embodiment of the present disclosure may be implemented;
[0036] FIG5 schematically shows a flowchart of a tile-based rasterization method according to an embodiment of the present disclosure;
[0037] FIG6 schematically shows a pipeline block diagram of a tile-based rasterization method according to an embodiment of the present disclosure;
[0038] FIG7 schematically illustrates a process of converting image tiles to pixel quads according to an embodiment of the present disclosure;
[0039] FIG8 schematically shows a flowchart of a tile-based rasterization method according to an embodiment of the present disclosure;
[0040] FIG9 schematically illustrates a process of converting a tile to a pixel quad according to an embodiment of the present disclosure;
[0041] FIG10 schematically illustrates a process of dividing a rasterized tile into second sub-tiles and storing them in an on-chip cache;
[0042] FIG11 schematically shows a flow chart of an image rendering method according to an embodiment of the present disclosure;
[0043] FIG12 schematically shows a block diagram of a tile-based rasterization device according to an embodiment of the present disclosure;
[0044] FIG13 schematically shows a block diagram of an image rendering device according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0045] In order to make the above-mentioned objects, features and advantages of the present disclosure more obvious and easy to understand, the specific embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
[0046] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure. However, the present disclosure may also be implemented in other ways different from those described herein. Therefore, the present disclosure is not limited to the specific embodiments disclosed below.
[0047] The following specific embodiments are provided to assist in understanding the methods and apparatus described herein. However, after understanding the present disclosure, various changes, modifications, and substitutions of the methods and apparatus described herein will be apparent to those of ordinary skill in the art. The order of operations described in this disclosure is for example only, and except for operations that must occur in a specific order, the order of other operations is not limited to the order set forth herein. It will be clear to those of ordinary skill in the art that reasonable changes to these orders are made. In addition, the features described herein may be implemented in different forms and should not be construed as being limited to the examples described herein. In addition, for greater clarity and simplicity, descriptions of functions and structures that are well known to those of ordinary skill in the art may be omitted.
[0048] The accompanying drawings and the detailed description only illustrate parts of the described embodiments. However, it should be understood that the embodiments of the present disclosure should not be interpreted as being limited to the forms shown. Furthermore, the scope of the present disclosure also includes all changes, equivalents, or alternatives to the described embodiments. Flowcharts are used in the present disclosure to illustrate the operations performed by the systems according to the embodiments of the present disclosure. It should be understood that the preceding or following operations are not necessarily performed precisely in order. On the contrary, various steps may be processed in reverse order or simultaneously. At the same time, other operations may be added to these processes, or one or more operations may be removed from these processes.
[0049] As mentioned earlier, mobile GPUs strive to improve GPU performance and image quality while maintaining low bandwidth. One feasible approach is to improve the rendering method. Among related technologies, tile-based rendering (TBR) can be used. Its main feature is that the screen space to be rendered is divided into tiles. The coordinates of each tile are stored in a list format in system memory via an intermediate buffer. During rendering, each tile is loaded into the GPU's on-chip memory one by one. The data required for rendering can be retrieved from the on-chip memory, thus avoiding slow round-trips with system memory. After each tile is rendered, the result is output to the corresponding area in the frame buffer in system memory. Once all tiles are rendered, the data in the frame buffer contains the data for the entire screen to be displayed. The advantage of this rendering method is that it processes in smaller tiles, utilizing the smaller but faster on-chip memory, reducing frequent round-trips between the GPU and system memory, and lowering power consumption and bandwidth. However, this rendering method requires on-chip memory as an intermediate buffer.
[0050] Figure 1 schematically illustrates a block diagram of a related tile-based rendering pipeline. The tile-based rendering pipeline includes a front-end and a back-end. As shown in Figure 1, the front-end primarily includes, in vertex processing, performing transformations on vertices and primitives. The term "primitive" refers to a polygon formed by points, lines, or vertices. For example, a primitive can be a triangle formed by connecting vertices. However, primitives are not limited to being formed as triangles. Graphics processing is then performed, including clipping and culling. Next, during the tile partitioning process, the screen space is partitioned and the tile to which each primitive belongs is recorded to form a primitive list. Figure 2 schematically illustrates the screen space after tile partitioning. Primitives P0, P2, and P3 should be displayed in the screen space. It should be understood that although Figure 2 shows the screen space divided into 4 rows and 4 columns, totaling 16 tiles (T0-T15), this division format and number are merely exemplary. Furthermore, the shape of the tiles is not limited to the rectangle shown. Then, the above primitive list is written to the system memory.
[0051] The backend primarily involves rasterizing primitives on a tile-by-tile basis. Rasterization is the process of assigning colors to each pixel in an image based on primitive metadata. The rasterization process can perform multiple sampling for each pixel to improve the accuracy of the color assigned to each pixel. In multi-sampling, a pixel consists of multiple sampling points, each of which is assigned a color. Subsequent steps use these assigned colors to calculate a single overall color for the pixel. Multi-sampling can smooth non-vertical and non-horizontal lines in the displayed image. This smoothing process is also known as antialiasing. However, this multi-sampling approach can require additional processing time and resources, increasing rendering costs. Furthermore, in related technologies, the sampling accuracy of rasterization is strictly tied to the pixel shading accuracy. For example, the number of sampling points within a single pixel during rasterization is the same as the number of times the pixel is shaded during the shading phase. This causes the amount of output color data to increase with increasing rasterization sampling rates, placing increased pressure on the output merge phase. For 2D images that do not require high anti-aliasing effects, such a design will have an adverse impact on the overall performance of the GPU rendering pipeline.
[0052] After rasterization, the backend also includes calling the depth data in the on-chip depth buffer (such as the GPU's static random access memory (SRAM)) for depth testing. Next, texturing and pixel shading operations are performed to complete the rendering of the tile, where pixel shading requires calling the color data in the on-chip color buffer. The rendering results of each primitive are saved in the depth buffer and the color buffer. After all the primitives in the tile are rendered, the results are output to the frame buffer located in the system memory so that the entire picture can be displayed when all tiles are rendered. Figure 3 schematically shows the process of composing the display screen with the results of block-by-block rendering. Through a tile-based rendering pipeline, frequent reading and writing of depth data and color data in system memory (such as dynamic random access memory (DRAM)) can be avoided.
[0053] In the various pipeline processes described above, after the primitive list is generated during the tiling process, it is transferred from the GPU to system memory. During rasterization, the primitive list needs to be transferred from system memory to the GPU. GPU access to system memory consumes significant bandwidth. This bandwidth consumption is positively correlated with the number of tiles generated during the tiling process. The number of tiles also significantly affects the resources bound to the GPU pipeline and the hardware's execution capabilities.
[0054] The number of tiles is determined by the size of the screen space and the size of the tiles, and the size of the tiles is limited by the storage space of the on-chip memory (such as the depth buffer and the color buffer). The size of the storage space of the on-chip memory is generally fixed. If the tile size is larger and / or the rasterization sampling rate of the tile is higher, the data of a single tile may not be able to fit into the cache. In some related image rendering methods, the size of the tile is reduced to meet the requirements of the on-chip memory. However, this will bring some disadvantages. For example, for the rendering of the same image, the smaller the tile size, the more tiles are split out, which will increase the load of modules such as tile division and may cause blocking of the rendering pipeline. Moreover, the more tiles there are, the larger the amount of data in the primitive list. Since the primitive list needs to be stored in the system memory for front-end and back-end interaction, this affects the bandwidth of memory write and read.
[0055] To at least address the aforementioned issues, the present disclosure proposes a tile-based rasterization method that can at least reduce the impact of on-chip cache on tile size and rasterization sampling rate. FIG4 illustrates the architecture of a system on chip (SoC) 100 in which the method of an embodiment of the present disclosure can be implemented.
[0056] 4 , the system on chip 100 includes at least a graphics processing unit (GPU) 110, a system memory 130, and a bus 140. In addition to the components shown in FIG4 , those skilled in the art will appreciate that the system on chip 100 may include other general components.
[0057] GPU 110 can perform tile-based graphics rendering. The term "tile-based" as used herein means that the screen space displaying an image of a scene to be rendered (e.g., each frame of a video) is divided into multiple tiles, and rendering is performed on a per-tile basis. Tile-based rendering architectures can reduce computational complexity compared to pixel-based rendering. Therefore, tile-based rendering architectures are suitable for implementing graphics rendering methods on devices with relatively low processing power, such as mobile-class GPUs.
[0058] As shown in FIG4 , GPU 110 can execute a rendering pipeline 115. Rendering pipeline 115 includes a front-end pipeline 116 and a back-end pipeline 117. In this example, front-end pipeline 116 generates a primitive list containing vertex data and primitive data for objects in the scene to be rendered, on a tile-by-tile basis. Back-end pipeline 117 performs rendering processing on a per-tile basis based on the primitive list generated by front-end pipeline 116. When back-end pipeline 117 completes rendering, it determines the pixel representation of the scene to be rendered on the screen.
[0059] System memory 130 may be a hardware element that stores various data processed by system-on-chip 100. For example, system memory 130 may store data processed by GPU 110. In addition, system memory 130 may store applications, drivers, etc. to be driven by GPU 110. In some embodiments, system memory 130 may include read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), random access memory (RAM), dynamic random access memory (DRAM), static random access memory (SRAM), flash memory, non-volatile memory, and other devices deemed suitable by one of ordinary skill in the art, capable of storing and providing instructions or software and any associated data, data files, and data structures to the processor in a non-transitory manner.
[0060] The bus 140 may be, for example, a hardware element that connects hardware elements in the system-on-chip 100 to transmit and receive data between the hardware elements. The bus 140 may include various suitable types of buses and is not limited unless otherwise specified.
[0061] Through the above-mentioned rendering pipeline 115, especially the back-end pipeline 117, the tile-based rasterization method of the embodiment of the present disclosure can be implemented. The method is described below. Figure 5 schematically shows a flowchart of the tile-based rasterization method according to the embodiment of the present disclosure. Figure 6 schematically shows a pipeline block diagram of the tile-based rasterization method according to the embodiment of the present disclosure. As shown in Figure 5, the method includes the following steps:
[0062] At step S505 , the image block is divided into a plurality of first sub-image blocks, wherein the image blocks are obtained by dividing a screen space for displaying an image of a scene to be rendered;
[0063] At step S510 , determining whether each first sub-tile is covered by a primitive, wherein the primitive is obtained by performing vertex processing on the scene to be rendered;
[0064] At step S515, in response to the first sub-block being covered by the primitive, rasterizing the primitive using pixels in the first sub-block covered by the primitive as mapping objects to determine a first mask value for each sampling point of each pixel in the first sub-block covered by the primitive.
[0065] In step S519 , the first sub-blocks whose first mask values of the sampling points of the pixels have been determined are combined to form a rasterized block.
[0066] In step S520 , pixel quad data is determined based on the rasterized tile, wherein the pixel quad data includes the first mask value.
[0067] Before executing the tile-based rasterization method according to an embodiment of the present disclosure, the front-end operations of the graphics pipeline have been completed, for example, through the front-end pipeline 116, including the transformation of vertices and primitives, graphics processing, and tile partitioning. As mentioned above, tile partitioning is the process of dividing the screen space used to display the image of the scene to be rendered to obtain tiles. After obtaining the tiles, the tile-based rasterization method according to an embodiment of the present disclosure is divided into a plurality of first sub-tiles (step S505). The vertex coordinates of each first sub-tile can be obtained in this process. As shown in Figure 6, in this step, the tile data (such as the coordinates, size, and image information of the tile) are input into the tile parser 605. After receiving the tile data, the tile parser 605 outputs the data of the first sub-tile, such as the vertex coordinates of each first sub-tile. The size of the obtained first sub-tile can be determined based on the performance of the GPU 110, such as data throughput.
[0068] Then, it is determined whether each first sub-tile is covered by the primitive (step S510). In the front-end operation, the primitive has been obtained by performing vertex processing on the scene to be rendered. In this step, the data of the first sub-tile output by the tile parser is input into the sub-tile rasterizer 610. The sub-tile rasterizer 610 judges whether the sub-tile is covered by the primitive. This judgment can be understood as rasterizing the primitive with the sub-tile as the mapping object. Each first sub-tile will be rasterized one by one, and the rasterized first sub-tile, that is, the first sub-tile containing the sub-tile mask value, will be output until all the first sub-tiles are rasterized and the next step is entered.
[0069] Determining whether each first sub-tile is covered by a primitive can be accomplished in the following manner. For example, in some embodiments, determining whether the first sub-tile is covered by a primitive can be performed based on whether the range of the area occupied by the first sub-tile overlaps with the range of the area occupied by the primitive. For example, the area occupied by the first sub-tile is first defined based on the horizontal and vertical coordinate ranges of the first sub-tile, and the area occupied by the primitive is defined based on the vertex coordinates of the primitive. Then, a determination is made as to whether these two areas at least partially overlap. In response to the area defined by the vertex coordinates of the primitive at least partially overlapping with the area defined by the horizontal and vertical coordinate ranges of the first sub-tile, the first sub-tile is determined to be covered by the primitive. Alternatively, in response to the area defined by the vertex coordinates of the primitive not at least partially overlapping with the area defined by the horizontal and vertical coordinate ranges of the first sub-tile, the first sub-tile is determined to be not covered by the primitive. The vertex coordinates of the primitive are determined during vertex processing in the front-end pipeline, and the horizontal and vertical coordinate ranges of the first sub-tile can be determined by the tile parser 605 in the aforementioned steps.
[0070] In other embodiments, sampling can be used to determine whether the first sub-block is covered by the primitive. For example, the sampling points of the sub-block are sampled to determine the mask value of the first sub-block, and then based on the mask value of the first sub-block, it is determined whether the first sub-block is covered by the primitive. In the present disclosure, the mask value obtained by sampling the sampling points of the pixels can be referred to as the first mask value; the mask value obtained by sampling the sampling points of the first sub-block can be referred to as the second mask value. In some embodiments, the sampling point of the sub-block can be one of the sampling points of the pixels contained in the sub-block. At this time, although the sampling is performed with the sampling points of the pixels, the second mask value of the sub-block is obtained, not the first mask value of the sampling points of the pixels. In other embodiments, the sampling points of the sub-block can also be independent sampling points that are independent of the pixel sampling points.
[0071] In other embodiments, whether each first sub-block is covered by the primitive can be determined by comparing the horizontal and vertical coordinate ranges of the first sub-blocks with the horizontal and vertical coordinate ranges of the minimum outer rectangular frame of the primitive. First, the vertical coordinate range of the minimum outer rectangular frame surrounding the primitive is determined. Then, the vertical coordinate range of each row of first sub-blocks is determined row by row to determine whether the vertical coordinate range of the first sub-blocks at least partially overlaps with the vertical coordinate range of the primitive. For example, the maximum value of the vertical coordinate of each row of first sub-blocks is determined row by row to determine whether it is less than the minimum value of the vertical coordinate of the minimum outer rectangular frame, and whether the minimum value is greater than the maximum value of the vertical coordinate of the minimum outer rectangular frame. If the maximum value of the vertical coordinate of the first sub-blocks in a row is less than the minimum value of the vertical coordinate of the minimum outer rectangular frame of the primitive, or if the minimum value of the vertical coordinate of the first sub-blocks in a row is greater than the maximum value of the vertical coordinate of the minimum outer rectangular frame of the primitive, it indicates that there is no overlap between the first sub-blocks in that row and the primitive. In this case, it can be directly determined that each first sub-block in the row is not covered by the primitive, without having to compare the vertical coordinate ranges of each first sub-block in the row one by one. Therefore, in response to the fact that the vertical coordinate range of the first sub-image blocks in a row does not at least partially overlap with the vertical coordinate range of the minimum outer rectangular frame, it is determined that the first sub-image blocks in the first sub-image blocks in the row are not covered by the image primitive. If the vertical coordinate range of the first sub-image blocks in a row at least partially overlaps with the vertical coordinate range of the minimum outer rectangular frame, it indicates that the first sub-image blocks in the first sub-image blocks in the row may overlap with the image primitive. In this case, the positional relationship between each first sub-image block in the first sub-image blocks in the row and the minimum outer rectangular frame of the image primitive can be continuously compared in the horizontal direction to continue to detect whether each first sub-image block in the first sub-image blocks in the row is covered by the image primitive. For example, the horizontal coordinate range of the minimum outer rectangular frame surrounding the primitive is determined, and if the maximum value of the vertical coordinate of a row of first sub-picture blocks is greater than or equal to the minimum value of the vertical coordinate of the minimum outer rectangular frame and the minimum value is less than or equal to the maximum value of the vertical coordinate of the minimum outer rectangular frame, then the horizontal coordinate range of each first sub-picture block in the row of first sub-picture blocks is determined one by one to determine whether the horizontal coordinate range of each first sub-picture block in the row at least partially overlaps with the horizontal coordinate range of the minimum outer rectangular frame, for example, determining whether the maximum value of the horizontal coordinate of each first sub-picture block in the row is less than the minimum value of the horizontal coordinate of the minimum outer rectangular frame and whether the minimum value is greater than the maximum value of the horizontal coordinate of the minimum outer rectangular frame. If the maximum value of the horizontal coordinate of a first sub-picture block in the row of first sub-picture blocks is less than the minimum value of the horizontal coordinate of the minimum outer rectangular frame of the primitive, or the minimum value of the horizontal coordinate of a first sub-picture block is greater than the maximum value of the horizontal coordinate of the minimum outer rectangular frame of the primitive, then it means that the first sub-picture block is located outside the minimum outer rectangular frame of the primitive in the horizontal direction. In this case, it can be directly determined that the first sub-picture blocks are not covered by the primitive.If the maximum value of the horizontal coordinate of a first sub-block is greater than or equal to the minimum value of the horizontal coordinate of the minimum surrounding rectangle of the primitive, and the minimum value of the horizontal coordinate of the first sub-block is less than or equal to the maximum value of the horizontal coordinate of the minimum surrounding rectangle of the primitive, then in some embodiments, the first sub-block can be directly determined to be covered by the primitive. This method can very quickly eliminate first sub-blocks that are clearly not covered by the primitive.
[0072] In other embodiments, in the first sub-block whose horizontal and vertical coordinate ranges at least partially overlap with the horizontal and vertical coordinate ranges of the minimum outer rectangular frame of the primitive, a more detailed detection of whether the first sub-block is covered by the primitive can be continued. This method of continuing to detect whether the first sub-block is covered by the primitive can be implemented by determining whether the range of the area occupied by the first sub-block overlaps with the range of the area occupied by the primitive, or by sampling the first sub-block. The specific operations of these two methods have been mentioned above and will not be repeated here.
[0073] In the context of this disclosure, the terms "row" and "column," as well as "horizontal" and "vertical," are used solely to denote the relative arrangement directions of tiles or sub-tiles. For example, "row" and "column" are two angled directions, and "horizontal" and "vertical" are also angled directions. However, these terms are not used to define the specific or absolute arrangement directions of tiles or sub-tiles. "Row" and "column" are a pair of relative arrangements that can be transposed, and "horizontal" and "vertical" are a pair of relative directions that can be transposed.
[0074] The first sub-block covered by the primitive is a valid first sub-block, and the data of the valid first sub-block can be input to the sampling point rasterizer 615 for pixel-level rasterization operations. For example, the pixels in the first sub-block are used as mapping objects, and the primitives are rasterized to determine the first mask value of each sampling point in each pixel in the first sub-block covered by the primitive (step S515). In this step, the sampling point rasterizer 615 performs rasterization processing on each primitive in the valid first sub-block in sequence, determines the first mask value of each sampling point of each pixel in the first sub-block, and then transmits the first sub-block whose sampling points have been determined to the pixel quad generator for subsequent operations. For the first sub-block not covered by the primitive, in some embodiments, a preset mask value can be assigned to the sampling point of each pixel of such a first sub-block. With such a configuration, pixel-level rasterization operations are essentially performed only on the valid first sub-tiles, while pixel-level rasterization operations are not performed on the first sub-tiles not covered by primitives, which can save a lot of computing resources and avoid invalid processing.
[0075] In the tile reassembler, the first sub-tile for which the first mask value of the sampling point of the pixel has been determined is combined to form a rasterized tile (step S519). Then, in the pixel quad generator, pixel quad data is determined based on the rasterized tile (step S520). The pixel quad data generated by the above steps contains the first mask value of the sampling point of the pixel. The pixel quad containing the first mask value can be transmitted to the shader in the subsequent pipeline to complete the rendering of the tile. A pixel quad refers to a 2x2 pixel, which is the smallest unit of pixel shading, that is, even if only one pixel in a pixel quad is covered by a primitive, all four pixels in the pixel quad need to perform pixel shading.
[0076] In the rasterization method of the embodiment of the present disclosure, the tile is further divided into a first sub-tile, and the size is reduced, so that the on-chip cache will be able to accommodate the data used and generated by the first sub-tile in the back-end pipeline. In this way, the size and sampling rate of the tile will not be limited by the capacity of the on-chip cache. Compared with the conventional tile-based image rendering method, the embodiment of the present disclosure allows the size of the tile to be flexibly adjusted according to the actual application requirements. For example, it can be significantly larger, so that the number of tiles divided from the screen space is smaller, reducing the burden of the tile division operation, and reducing the amount of data in the primitive list, thereby alleviating the read and write bandwidth pressure of the memory.
[0077] In the related art, the rasterization sampling rate and the target sampling rate during shading are bound, that is, the number of sampling points in a pixel during pixel rasterization is the same as the number of times the pixel is shaded during pixel shading. In the present disclosure, the embodiments of the present disclosure allow for a higher sampling rate during pixel rasterization, and the subsequent pixel shading is completed at a lower target sampling rate, so the rasterization sampling rate and the target sampling rate during shading of the present disclosure can be set separately. In particular, the rasterization sampling rate can be set higher to improve the anti-aliasing effect, and for tiles of unchanged size, even if the number of sampling points increases, it will not affect the storage in the on-chip cache. Moreover, the target sampling rate can be set lower to reduce the amount of computation and data blocking rate in the shading stage.
[0078] In some embodiments, the process of extracting pixel quads may be to extract pixel quads directly from the first sub-tile on which pixel rasterization is completed. FIG7 schematically illustrates a process from a tile to a pixel quad according to an embodiment of the present disclosure. As shown in FIG7 , after being processed by the tile parser, the tile 705 is divided into a plurality of first sub-tiles 710. The first sub-tile 710 then undergoes the operations of the sub-tile rasterizer and the sampling point rasterizer to complete rasterization of its pixels, and can then be directly input into the pixel quad packer 630 to extract pixel quads 715 from the first sub-tile on which pixel rasterization is completed.
[0079] In other embodiments, the process of extracting pixel quads may include reorganizing and decomposing the first sub-tile based on the capacity of the on-chip color buffer. For example, first, the number of color data stored in the pixel and the number of sampling points of the pixel are determined. Then, in response to the number of color data stored in the pixel being less than the number of sampling points of the pixel, the rasterized tile is divided into a plurality of second sub-tiles based on the capacity of the on-chip color buffer of the graphics processor. For example, if the pixel shader is set to execute under MSAA1X conditions, that is, the pixel stores one color (shaded once), and the sampling rate of the pixel is executed under MSAA2X or higher standards (that is, the number of sampling points of the pixel is 2 or more), the rasterized tile is divided into a plurality of second sub-tiles. Next, the pixel quad packer 630 is used to extract pixel quads from the second sub-tile. Figure 8 schematically shows a flowchart of a tile-based rasterization method according to an embodiment of the present disclosure. Figure 9 schematically shows a process of converting tiles to pixel quads according to an embodiment of the present disclosure. As shown in Figures 8 and 9, tile 705 is first divided into first sub-tiles 710. A determination is then made as to whether each first sub-tile 710 is covered by a primitive, and this process is checked to see if it has been completed for each first sub-tile. If the determination of whether each first sub-tile is covered by a primitive has not been completed, this process continues. If the determination of whether each first sub-tile is covered by a primitive has been completed, the mask value of each sampling point of each pixel in the first sub-tile covered by the primitive is determined, i.e., the pixel sampling points are rasterized, and a check is made to see if this process has been completed for each first sub-tile covered by the primitive. If this process has not been completed for each first sub-tile covered by the primitive, the process continues. If this process is completed for each first sub-tile covered by the primitive, after rasterizing the pixel samples, the first sub-tile is reassembled by the tile reassembler 620. The resulting reassembled rasterized tile 720 has the same size as the original unrasterized tile, but also contains the first mask value of the pixel sample obtained by rasterizing the sample points. Then, the rasterized tile 720 is divided into second sub-tiles 725 by the tile re-decomposer 625. The process of dividing the rasterized tile 720 into second sub-tiles 725 can be based on the capacity of the on-chip color buffer 730, for example, so that a single storage block (Bank) 735 of the on-chip color buffer 730 can accommodate at least one second sub-tile. Figure 10 schematically illustrates the process of dividing a rasterized tile 720 into second sub-tiles 725 and storing them in a storage block 735 of an on-chip color buffer 730. As shown in Figure 10, the rasterized tile 720 is divided into a plurality of second sub-tiles 725 according to the capacity of the on-chip buffer, and the size of the second sub-tiles 725 is adapted to the capacity of the storage block 735 of the on-chip color buffer 730.For example, although the size of the rasterized tile 720 may exceed the capacity limit of the storage block 735 of the on-chip color buffer 730, the second sub-tile 725 will not. Therefore, the size of the tile 705 and the number of pixel sampling points may not be limited by the capacity of the on-chip color buffer, but may have a larger size (e.g., larger than the capacity of the color buffer) to meet the rasterization data throughput requirements. This allows the rasterization stage to consume high-sampling rate tiles without affecting the storage of color data in the output merging stage. In other embodiments, if the number of color data stored in a pixel is equal to the number of sampling points of the pixel, for example, the pixel shader is executed under MSAA1X conditions, and the pixel sampling rate is also executed under MSAA1X conditions, then the rasterized tile may not be divided into the second sub-tile, but the pixel quad 715 data may be directly extracted from the data information of the first sub-tile.
[0080] During the division of a rasterized tile into second sub-tiles, misalignment may occur. For example, the dimensions (including length and width) of the rasterized tile may not be an integer multiple of the preset dimensions (including preset length and preset width) of the second sub-tile. Consequently, during the division, the actual dimensions of the second sub-tiles at the ends of rows and / or columns may be smaller than those of other second sub-tiles with preset dimensions. In some embodiments, if a second sub-tile is less than or equal to half the preset dimensions, a single storage block can store two or more such second sub-tiles. This improves storage block utilization. In a specific example, to divide the rasterized tile into multiple second sub-tiles, a preset dimension of the second sub-tile is first determined based on the capacity of the on-chip color buffer of the graphics processor. The preset dimension ensures that a single storage block of the on-chip color buffer can store data for at least one second sub-tile. When dividing the rasterized tile into multiple second sub-tiles, the second sub-tiles are first retrieved along the rows and columns according to the preset dimensions of the second sub-tiles. Then, determining whether the actual size of the second sub-image block located at the edge of the row and / or column is less than or equal to half of the preset size of the second sub-image block. If the actual size of the second sub-image block located at the edge of the row and / or column is less than or equal to half of the preset size of the second sub-image block, storing at least two edge second sub-image blocks in the same storage block.
[0081] According to another aspect of the present disclosure, an image rendering method is also provided. Figure 11 schematically shows a flowchart of the image rendering method according to an embodiment of the present disclosure. The method includes a front-end and a back-end. In the front-end, after obtaining the geometric data of the scene to be rendered, the vertex processing of the scene to be rendered is performed using a vertex shader to obtain primitive data of the scene to be rendered. The vertices are generated based on the objects in the scene to be rendered, and the primitive data is obtained by converting the vertices by the vertex shader. The vertex shader can be programmed to transform the vertex data from an object-based coordinate system (object space) to a coordinate system based on world space or normalized device coordinate space to obtain vertex transformed coordinates. Through the coordinate system conversion, the object space coordinate system used to indicate the position of the object vertices when the scene is split into objects can be converted to display the position of the rendered object in the real world or on the display device screen. The primitive data can then be determined based on the vertex transformed coordinates. Then, a tile divider divides the screen space used to display the image of the scene to be rendered to obtain tile data, where the tile data includes the vertex coordinates of each tile. Next, the tile divider determines a metadata list of the tile based on the metadata and the tile data, and stores the metadata list in a system memory.
[0082] In the back-end of the method, the primitive data list is first extracted from the system memory, and then the tile-based rasterization method according to any embodiment of the present disclosure is executed on each tile based on the primitive data list to obtain pixel quad data. Then, based on the pixel quad, the pixel is shaded to obtain the color data of each tile. First, based on the pixel quad, the sampling point coverage of the pixel is determined. The sampling point coverage refers to the proportion of the sampling points covered by the primitive to the total number of sampling points in the pixel. Then, the color data of the pixel is stored based on the sampling point coverage. For example, the color data of the pixel is determined by outputting the primitive color in levels based on the color of the primitive and the sampling point coverage. This reduces the number of pixel shading operations. When the number of sampling points of the pixel is a first number and the number of color data stored for the pixel during rendering is a second number, the first number and the second number can be set independently of each other. In particular, in some embodiments, the first number can be greater than the second number, i.e., the pixel rasterization sampling rate is high while the target sampling rate is low during shading. This can improve anti-aliasing effects, reduce the computational complexity and data blocking rate during the shading stage, and increase rendering speed. Based on the color data of each pixel, the color data of the tile can be determined. The color data of each tile is then stored in the system memory. The color data of each tile in the system memory is then merged to obtain a rendered image.
[0083] The image rendering method of the embodiment of the present disclosure includes the tile-based rasterization method of the embodiment of the present disclosure. In the tile-based rasterization method, since the tile is divided into a first sub-tile, and in some embodiments, the rasterized first sub-tile is reassembled into a rasterized tile and then divided into a second sub-tile, the size of the on-chip cache is no longer a determining factor in the setting of the tile size and the sampling rate. Moreover, as shown in FIG11 , the image rendering method of the embodiment of the present disclosure does not include a depth cache. This is because the tile-based rasterization method of the present disclosure allows high-precision rasterization, which can, to a certain extent, solve the problem of depth processing. Since the depth cache is no longer used, the tile division stage will not be limited by the on-chip depth cache, and even if the number of sampling points increases, it will not cause difficulties in tile storage. From another perspective, the present disclosure is particularly suitable for 2D scenes, in which it can achieve excellent anti-aliasing effects and have a low amount of computation. The image rendering method of the disclosed embodiments can flexibly adjust the tile size and number of tiles according to actual application requirements when the tile divider divides the screen space. This reduces the size of the primitive list, lowers the required read and write memory bandwidth, improves pipeline utilization, and alleviates the problem of pipeline overload caused by multisampling. This image rendering method can achieve a high rasterization sampling rate and a low shading sampling rate, thereby enabling simple and efficient anti-aliasing.
[0084] According to another aspect of the present disclosure, a tile-based rasterization device is also provided. FIG12 schematically illustrates a block diagram of a tile-based rasterization device according to an embodiment of the present disclosure. As shown in FIG12 , the rasterization device 1200 includes a tile parser 1205, a sub-tile rasterizer 1210, a sampling point rasterizer 1215, and a pixel quad generator 1220. The tile parser 1205 is configured to divide a tile into a plurality of first sub-tiles, wherein the tiles are obtained by dividing the screen space used to display an image of a scene to be rendered. The sub-tile rasterizer 1210 is configured to determine whether each first sub-tile is covered by a primitive, wherein the primitive is obtained by performing vertex processing on the scene to be rendered. The sampling point rasterizer 1215 is configured to, in response to a first sub-tile being covered by a primitive, rasterize the primitive using pixels in the first sub-tile covered by the primitive as mapping objects to determine a first mask value for each sampling point of each pixel in the first sub-tile covered by the primitive. The pixel quad generator 1220 is configured to extract pixel quad data from a first sub-tile for which a mask value for a pixel sample point has been determined, wherein the pixel quad data includes the first mask value. In some embodiments, the sub-tile rasterizer is further configured to, in response to the first sub-tile being uncovered by a primitive, assign a preset first mask value to a sample point of each pixel in the first sub-tile.
[0085] In some embodiments, the pixel quad generator includes a tile reassembler, a tile decomposer, and a pixel quad packer. The tile reassembler is configured to combine a first sub-tile for which first mask values of pixel sampling points have been determined to form a rasterized tile. The tile decomposer is configured to divide the rasterized tile into a plurality of second sub-tiles based on the capacity of an on-chip color buffer of a graphics processor. The pixel quad packer is configured to extract pixel quad data from the second sub-tile.
[0086] In some embodiments, the sub-tile rasterizer configured to determine whether each first sub-tile is covered by a primitive is further configured to: determine, based on the vertex coordinates of the first sub-tile and the vertex coordinates of the primitive, whether at least one vertex line connecting the primitive passes through an area defined by the vertex coordinates of the first sub-tile; and determine that the first sub-tile is covered by the primitive in response to at least one vertex line connecting the primitive passing through an area defined by the vertex coordinates of the first sub-tile. In other embodiments, the sub-tile rasterizer configured to determine whether each first sub-tile is covered by a primitive is further configured to sample the sub-tile sampling points of the first sub-tile to determine a second mask value for the first sub-tile; and determine whether the first sub-tile is covered by the primitive based on the second mask value for the first sub-tile.
[0087] According to another aspect of the present disclosure, an image rendering device is also provided. Figure 13 schematically shows a block diagram of an image rendering device 1300 according to an embodiment of the present disclosure. The image rendering device 1300 includes a vertex processor 1305, a tile divider 1310, a tile-based rasterization device 1200 according to any embodiment of the present disclosure, a pixel processor 1320, and an output merger 1325. The vertex processor 1305 is configured to perform vertex processing on the scene to be rendered to obtain metadata of the scene to be rendered. The tile divider 1310 is configured to divide the screen space for displaying the image of the scene to be rendered to obtain tile data; based on the metadata and the tile data, determine a primitive list for each tile. The rasterization device 1200 generates a pixel quad based on the primitive list. The pixel processor 1320 is configured to determine a sampling point coverage of the pixel based on the pixel quad; store a first amount of color data for the pixel based on the sampling point coverage; and store the color data for each tile in the system memory, wherein the number of sampling points for the pixel is a second number, and the first number and the second number are set independently of each other. The output merger 1325 is configured to merge the color data for each tile in the system memory to obtain a rendered image.
[0088] The tile-based rasterization device and image rendering device according to the embodiments of the present disclosure can implement the tile-based rasterization method and image rendering method according to the present disclosure, and obtain the effects that can be achieved by the method described above, which will not be repeated here.
[0089] The various devices, apparatuses and other components involved in this disclosure can be implemented by hardware components. Examples of hardware components include controllers, memories, drivers, comparators, arithmetic logic units, adders, subtractors, multipliers, dividers, integrators and any other electronic components known to those of ordinary skill in the art. In one example, the hardware components are implemented by one or more processing devices or processors. The processing device or processor may include one or more processing elements, such as a logic gate array, a controller and an arithmetic logic unit, a digital signal processor, a microcomputer, a programmable logic controller, a field programmable gate array, a programmable logic array, a microprocessor, or any other device or device combination known to those of ordinary skill in the art. These devices or combinations of devices can respond to and execute instructions in a defined manner to obtain desired results. The processing device or processor includes or is connected to one or more memories for storing code, instructions or software executed by the processing device or processor.
[0090] The specific embodiments shown and described herein are illustrative examples and do not limit the scope of the present disclosure in any way. In addition, the connecting lines or connectors shown in the various figures are intended to represent exemplary functional relationships and / or physical or logical connections between the various elements. It should be noted that many optional or additional functional relationships, physical connections or logical connections may exist in actual devices.
[0091] The terms used herein are only used to explain specific embodiments and are therefore not meant to be limiting. Except that two expressions are different from each other in context, singular expressions include plural expressions. For example, as used herein, unless the context clearly indicates otherwise, the singular form is intended to also include the plural form. The term "comprise" or "include" should be understood as not excluding in advance the existence or other possibilities of one or more other characteristics, shapes, operations, components, elements or combinations thereof. In addition, terms including ordinal numbers such as "first", "second", etc. are used to describe various elements or to distinguish between various elements for convenience of description, but these elements should not be limited by these terms, and are not intended to represent the order or sequence of requirements unless they have different meanings in context. Unless otherwise indicated, the steps of all methods described herein can be performed in any appropriate order. Industrial Applicability
[0092] The technical solutions of the disclosed embodiments can be applied to rasterization methods and devices, as well as image rendering methods and devices, for mobile-class GPUs. The technical solutions provided by the disclosed embodiments allow for flexible configuration of tile size and pixel rasterization sampling rates, independent of on-chip memory capacity. This reduces the number of tiles, thereby reducing the load on tile partitioning operations and alleviating pipeline congestion, while achieving excellent anti-aliasing effects in a simple and efficient manner.
Claims
1. A tile-based rasterization method, the rasterization method comprising: Dividing a tile into a plurality of first sub-tiles, wherein the tile is obtained by dividing a screen space for displaying an image of a scene to be rendered; Determining whether each first sub-tile is covered by a primitive, wherein the primitive is obtained by performing vertex processing on the scene to be rendered; In response to the first sub-image block being covered by a primitive, taking pixels in the first sub-image block covered by the primitive as mapping objects, rasterizing the primitive to determine a first mask value for each sampling point of each pixel of the first sub-image block covered by the primitive; Combining the first sub-blocks for which the first mask values of the sampling points of the pixels have been determined to form a rasterized block; Based on the rasterized tile, pixel quad data is determined, wherein the pixel quad data includes the first mask value.
2. The rasterization method according to claim 1, wherein: Based on the rasterized tile, determining pixel quad data comprises: Determine the amount of color data stored in a pixel and the number of sampling points of the pixel; In response to the number of color data stored in the pixel being less than the number of sampling points of the pixel, dividing the rasterized tile into a plurality of second sub-tiles based on a capacity of an on-chip color buffer of a graphics processor; Pixel quad data is extracted from the data information of the second sub-image block.
3. The rasterization method according to claim 2, wherein: Based on the rasterized tile, determining pixel quad data further comprises: In response to the number of color data stored in the pixel being equal to the number of sampling points of the pixel, pixel quad data is extracted from the data information of the first sub-block.
4. The rasterization method according to claim 2, wherein: Based on the capacity of the on-chip color buffer of the graphics processor, dividing the rasterized image tile into a plurality of second sub-image tiles comprises: Determining a preset size of the second sub-image block based on a capacity of an on-chip color buffer of the graphics processor; The second sub-image block is acquired along the row and column directions on the rasterized image block according to a preset size of the second sub-image block.
5. The rasterization method according to claim 4, wherein: The on-chip color buffer includes a plurality of storage blocks, and based on the capacity of the on-chip color buffer of the graphics processor, dividing the rasterized image tile into a plurality of second sub-image tiles further includes: Determine whether the actual size of the second sub-image block at the edge of the row and / or the column is less than or equal to half of the preset size; In response to the actual size of the edge second sub-block being less than or equal to half of the preset size, in a single At least two edge second sub-blocks are stored in the storage block.
6. The rasterization method according to claim 1, wherein: Determining whether each first sub-tile is covered by a primitive includes: Determine the ordinate range of the minimum outer rectangular frame surrounding the primitive; Determining row by row whether the vertical coordinate range of the first sub-image block in each row at least partially overlaps with the vertical coordinate range of the minimum outer rectangular frame; In response to the fact that the vertical coordinate range of a row of first sub-image blocks does not at least partially overlap with the vertical coordinate range of the minimum peripheral rectangular frame, it is determined that the first sub-image blocks in the row of first sub-image blocks are not covered by the image primitive.
7. The rasterization method according to claim 6, wherein: Determining whether each first sub-tile is covered by the primitive further includes: Determine the horizontal coordinate range of the minimum outer rectangular frame surrounding the primitive; In response to the vertical coordinate range of a row of first sub-image blocks at least partially overlapping with the vertical coordinate range of the minimum peripheral rectangular frame, determining one by one whether the horizontal coordinate range of each first sub-image block in the row of first sub-image blocks at least partially overlaps with the horizontal coordinate range of the minimum peripheral rectangular frame; In response to the abscissa range of the first sub-image block in the row of first sub-image blocks not at least partially overlapping the abscissa range of the minimum peripheral rectangular frame, it is determined that the first sub-image block is not covered by the image primitive.
8. The rasterization method according to claim 1, wherein: Determining whether each first sub-tile is covered by a primitive includes: Determining whether an area defined by vertex coordinates of the primitive at least partially overlaps with an area defined by a horizontal coordinate range and a vertical coordinate range of the first sub-tile; In response to an area defined by vertex coordinates of the primitive at least partially coinciding with an area defined by a horizontal coordinate range and a vertical coordinate range of the first sub-tile, it is determined that the first sub-tile is covered by the primitive.
9. The rasterization method according to claim 1, wherein: Determining whether each first sub-tile is covered by a primitive includes: Sampling the sub-image block sampling points of the first sub-image block to determine a second mask value of the first sub-image block; Based on the second mask value of the first sub-tile, it is determined whether the first sub-tile is covered by a primitive.
10. The rasterization method according to claim 1, wherein: The method further includes, in response to the first sub-image block not being covered by a primitive, assigning a preset first mask value to a sampling point of a pixel of the first sub-image block.
11. An image rendering method, the image rendering method comprising: Perform vertex processing on the scene to be rendered to obtain the graphic element data of the scene to be rendered; Dividing a screen space for displaying an image of the scene to be rendered to obtain tile data; Determine a primitive list for each tile based on the primitive data and the tile data; Based on the primitive list, perform the tile-based rasterization method according to any one of claims 1 to 10 on each tile to obtain the pixel quad data; Determine the sampling point coverage of the pixel based on the pixel quadruple data; Based on the sampling point coverage, storing a first quantity of color data for a pixel, wherein the number of sampling points of the pixel is a second quantity, and the first quantity and the second quantity are set independently of each other; Store the color data of each tile's pixels into system memory; The color data for each tile in the system memory is merged to obtain a rendered image.
12. The image rendering method according to claim 11, wherein: Vertex processing of the scene to be rendered is performed to obtain the metadata of the scene to be rendered, including: Determine the vertex coordinates of objects in the scene to be rendered; Transforming the vertex coordinates from an object-based coordinate system to a coordinate system based on a world space or a normalized device coordinate space to obtain vertex transformed coordinates; The primitive data is determined based on the vertex transformation coordinates.
13. A tile-based rasterization device, the rasterization device comprising: A tile parser configured to divide a tile into a plurality of first sub-tiles, wherein the tile is obtained by dividing a screen space for displaying an image of a scene to be rendered; a sub-tile rasterizer configured to determine whether each first sub-tile is covered by a primitive, wherein the primitive is obtained by vertex processing of a scene to be rendered; a sampling point rasterizer configured to, in response to the first sub-tile being covered by a primitive, take pixels in the first sub-tile covered by the primitive as mapping objects, and rasterize the primitive to determine a first mask value for each sampling point of each pixel of the first sub-tile covered by the primitive; A tile reassembler configured to combine first sub-tiles for which first mask values of sampling points of pixels have been determined to form a rasterized tile; A pixel quad generator is configured to determine pixel quad data based on the rasterized tile, wherein the pixel quad data includes the first mask value.
14. The rasterization device according to claim 13, wherein: The pixel quad generator includes a tile re-decomposer and a pixel quad packer, wherein: The tile re-decomposer is configured to determine the amount of color data stored in the pixel and the number of sampling points of the pixel, and in response to the amount of color data stored in the pixel being less than the number of sampling points of the pixel, divide the rasterized tile into a plurality of second sub-tiles based on a capacity of an on-chip color buffer of a graphics processor; The pixel quad packer is configured to extract pixel quad data from the data information of the second sub-block.
15. The rasterization device according to claim 14, wherein: The image block re-decomposer is further configured to extract pixel quad data from the data information of the first sub-image block in response to the number of color data stored in the pixel being equal to the number of sampling points of the pixel.
16. The rasterization device according to claim 14, wherein: The tile re-decomposer configured to divide the rasterized tile into a plurality of second sub-tiles based on a capacity of an on-chip color buffer of a graphics processor is further configured to: Determining a preset size of the second sub-image block based on a capacity of an on-chip color buffer of the graphics processor; The second sub-image block is acquired along the row and column directions on the rasterized image block according to a preset size of the second sub-image block.
17. The rasterization device according to claim 16, wherein: The on-chip color buffer includes a plurality of storage blocks and is configured to divide the rasterized tile into a plurality of second sub-tiles based on the capacity of the on-chip color buffer of the graphics processor. The tile re-decomposer is further configured to: Determine whether the actual size of the second sub-image block at the edge of the row and / or the column is less than or equal to half of the preset size; In response to the actual size of the edge second sub-image block being less than or equal to half of the preset size, at least two edge second sub-image blocks are stored in a single storage block.
18. The rasterization device according to claim 13, wherein: The sub-tile rasterizer configured to determine whether each first sub-tile is covered by a primitive is further configured to: Determine the ordinate range of the minimum outer rectangular frame surrounding the primitive; Determining row by row whether the vertical coordinate range of the first sub-image block in each row at least partially overlaps with the vertical coordinate range of the minimum outer rectangular frame; In response to the fact that the vertical coordinate range of a row of first sub-image blocks does not at least partially overlap with the vertical coordinate range of the minimum peripheral rectangular frame, it is determined that the first sub-image blocks in the row of first sub-image blocks are not covered by the image primitive.
19. The rasterization device according to claim 18, wherein: The sub-tile rasterizer configured to determine whether each first sub-tile is covered by a primitive is further configured to: Determine the horizontal coordinate range of the minimum outer rectangular frame surrounding the primitive; In response to the vertical coordinate range of a row of first sub-image blocks at least partially overlapping with the vertical coordinate range of the minimum peripheral rectangular frame, determining one by one whether the horizontal coordinate range of each first sub-image block in the row of first sub-image blocks at least partially overlaps with the horizontal coordinate range of the minimum peripheral rectangular frame; In response to the abscissa range of the first sub-image block in the row of first sub-image blocks not at least partially overlapping the abscissa range of the minimum peripheral rectangular frame, it is determined that the first sub-image block is not covered by the image primitive.
20. The rasterization device according to claim 13, wherein: The sub-tile rasterizer configured to determine whether each first sub-tile is covered by a primitive is further configured to: Determining whether an area defined by vertex coordinates of the primitive at least partially overlaps with an area defined by a horizontal coordinate range and a vertical coordinate range of the first sub-tile; In response to an area defined by vertex coordinates of the primitive at least partially coinciding with an area defined by a horizontal coordinate range and a vertical coordinate range of the first sub-tile, it is determined that the first sub-tile is covered by the primitive.
21. The rasterization device according to claim 13, wherein: The sub-tile rasterizer configured to determine whether each first sub-tile is covered by a primitive is further configured to: Sampling the sub-image block sampling points of the first sub-image block to determine a second mask value of the first sub-image block; Based on the second mask value of the first sub-tile, it is determined whether the first sub-tile is covered by a primitive.
22. The rasterization device according to claim 13, wherein: The sub-tile rasterizer is further configured to, in response to the first sub-tile being not covered by a primitive, assign a preset first mask value to sampling points of pixels of the first sub-tile.
23. An image rendering device, the image rendering device comprising: A vertex processor configured to perform vertex processing on a scene to be rendered to obtain graphic element data of the scene to be rendered; A tile divider configured to divide a screen space for displaying an image of the scene to be rendered to obtain tile data; and, determining a primitive list for each tile based on the primitive data and the tile data; A tile-based rasterizer according to any one of claims 13 to 22, the rasterizer determining pixel quad data based on the primitive list; A pixel processor configured to determine a sampling point coverage of a pixel based on the pixel quad data; Based on the sampling point coverage, storing a first amount of color data for the pixel, and storing the color data of each block in the system memory, wherein the number of sampling points of the pixel is a second number, and the first number and the second number are set independently of each other; An output merger is configured to merge the color data of each tile in the system memory to obtain a rendered image.
24. The image rendering device according to claim 23, wherein: The vertex processor is further configured to: Determine the vertex coordinates of objects in the scene to be rendered; Transforming the vertex coordinates from an object-based coordinate system to a coordinate system based on a world space or a normalized device coordinate space to obtain vertex transformed coordinates; The primitive data is determined based on the vertex transformation coordinates.
Citation Information
Patent Citations
Graphics processing units and methods for subdividing set of one or more tiles of rendering space for rendering
CN108305313A
Efficient advanced rendering method and device and computer storage medium
CN111062858A
Block-based rasterization method and device, and image rendering method and device
CN115841433A
Method of and apparatus for processing graphics
US20140354682A1
Multi-rate shading using replayed screen space tiles
US20200020153A1
Cited By
Image rendering method and device, electronic equipment and storage medium
CN119784913A
Rasterization triangle coverage point judgment method, electronic equipment and storage medium
CN122065769A
