Pixel rasterization method and device, electronic equipment and storage medium

By determining the new equation of edges based on the vertex coordinates and rasterization mode of the primitive in the graphics processing unit, the existing conservative rasterization method is solved to increase hardware computing resources and change the GPU architecture, and efficient conservative rasterization is achieved.

CN119919276AActive Publication Date: 2025-05-02MOORE THREADS TECH CO LTD

Patent Information

Application Number
CN202411986913.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-05-02
Estimated Expiration
2044-12-31

AI Technical Summary

Technical Problem

While ensuring the rasterization accuracy, the existing conservative rasterization method increases the demand for hardware computing resources and changes in GPU architecture, resulting in higher costs.

Method used

By determining the equation and type of edges based on the vertex coordinates of the primitive, preset the coefficient adjustment method corresponding to the combination of the rasterization mode and edge type, directly find and apply the coefficient adjustment method to obtain the new edge equation and judge the pixel coverage situation.

Benefits of technology

It realizes the cost of conservative rasterization without increasing hardware computing resources and changing the GPU architecture, and ensures the accuracy and efficiency of rasterization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119919276A_ABST
    Figure CN119919276A_ABST
Patent Text Reader

Abstract

The invention relates to the field of computer vision, and provides a primitive rasterization method and device, electronic equipment and a storage medium. The method comprises the steps of determining an equation and a type of each edge of a primitive according to coordinates of vertexes of the primitive; searching a coefficient adjustment mode of the equation of each edge according to a preset rasterization mode and the type of each edge, and adjusting the coefficient of the equation of each edge according to the coefficient adjustment mode; determining a pixel coverage judgment condition of the primitive according to a preset rasterization mode; according to the coordinate of the angular point of each pixel and the new equation of each edge, whether each pixel meets the pixel coverage judgment condition of the primitive or not is judged, and when any pixel meets the pixel coverage judgment condition of the primitive, it is determined that the pixel is the pixel obtained through primitive rasterization. According to the method, the correctness of conservative rasterization function realization is ensured, and the cost of conservative rasterization is lower, so that conservative rasterization is simply and efficiently completed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer vision, and in particular to a primitive rasterization method, device, electronic device and storage medium. Background Art

[0002] Rasterization is a key step in the graphics processing unit (GPU) rendering pipeline, responsible for converting primitives (such as triangles) into pixels on the screen. Primitives are usually floating-point numbers (such as float32), and the GPU converts them into fixed-point numbers (such as fixed16.8) before processing. This process inevitably leads to a large loss of precision and pixel distortion.

[0003] In order to solve this problem, the prior art proposes a conservative rasterization method, which can compensate for the pixel distortion caused by the loss of precision when converting floating-point numbers to fixed-point numbers. However, the existing conservative rasterization methods are either easy to implement but have poor rasterization accuracy, or have high rasterization accuracy but are expensive to implement, which is specifically reflected in the need to add additional hardware computing resources and change the GPU architecture. How to reduce the cost of conservative rasterization while ensuring the correctness of the conservative rasterization function has become a technical problem that needs to be solved urgently in this field. Summary of the invention

[0004] In view of this, the present disclosure proposes a primitive rasterization method, device, electronic device and storage medium. The method not only ensures the correctness of the conservative rasterization function, but also does not require the addition of additional hardware computing resources, does not change the GPU architecture, and makes the cost of conservative rasterization lower, thereby completing conservative rasterization simply and efficiently.

[0005] According to one aspect of the present disclosure, a primitive rasterization method is provided, the method comprising: determining the equation and type of each edge of a first type of primitive according to the coordinates of the vertices of the first type of primitive, the first type of primitive comprising at least three vertices, and two edges with the same vertex as the endpoint intersecting; finding a coefficient adjustment method for the equation of each edge according to a preset rasterization mode and the type of each edge, adjusting the coefficient of the equation of each edge according to the coefficient adjustment method, and obtaining a new equation for each edge; determining a pixel coverage judgment condition of the first type of primitive according to the preset rasterization mode; judging whether each pixel satisfies the pixel coverage judgment condition of the first type of primitive according to the coordinates of the corner points of each pixel and the new equation of each edge, and when any pixel satisfies the pixel coverage judgment condition of the first type of primitive, determining that the pixel is a pixel obtained by rasterization of the first type of primitive.

[0006] In a possible implementation, the rasterization mode includes an overestimation mode. In the overestimation mode, the method further includes: determining an equation of a bounding box for conservative rasterization of the first type of primitives based on the coordinates of the vertices of the first type of primitives and a degree parameter of conservative rasterization; in the overestimation mode, the pixel coverage judgment condition of the first type of primitives includes a first condition and a second condition, the first condition is used to judge the coverage of the pixels by the first type of primitives, and the second condition is used to judge the coverage of the pixels by the bounding box for conservative rasterization of the first type of primitives.

[0007] In a possible implementation, the rasterization mode includes an underestimation mode. In the underestimation mode, the pixel coverage judgment condition of the first type of primitive includes a third condition, and the third condition is used to judge the coverage of the pixel by the first type of primitive.

[0008] In a possible implementation, determining the equation and type of each edge of the first type of primitive according to the coordinates of the vertices of the first type of primitive includes: determining the equation of the i-th edge of the first type of primitive as A according to the coordinates of the vertices of the first type of primitive. i x+B i y+C i =0, where A i , B i , C i is the coefficient of the equation of the i-th side, x represents the coordinate of the first dimension, and y represents the coordinate of the second dimension; according to A i The relationship between the size of 0 and B i The size relationship with 0 determines the type of the i-th edge.

[0009] In one possible implementation, A i >0,B i >0, it is determined that the i-th edge is of the first type, and the area covered by the first type of primitives is located at the lower right side of the i-th edge; i =0, B i >0, it is determined that the i-th edge is of the second type, and the area covered by the first type of primitives is located below the i-th edge; i >0,B i <0, it is determined that the i-th edge is of the third type, and the area covered by the first type of primitives is located on the upper right side of the i-th edge; i >0,B i =0, it is determined that the i-th edge is of the fourth type, and the area covered by the first type of primitives is located on the right side of the i-th edge; i <0, B i>0, it is determined that the i-th edge is of the fifth type, and the area covered by the first type of primitives is located at the lower left side of the i-th edge; i <0, B i =0, it is determined that the i-th edge is of the sixth type, and the area covered by the first type of primitives is located on the left side of the i-th edge; i <0, B i <0, it is determined that the i-th edge is of the seventh type, and the area covered by the first type of primitive is located on the upper left side of the i-th edge; i =0, B i <0, it is determined that the i-th edge is of the eighth type, and the area covered by the first type of primitives is located on the upper side of the i-th edge.

[0010] In a possible implementation, determining the equation of the bounding box for conservative rasterization of the first type of primitives according to the coordinates of the vertices of the first type of primitives and the degree parameter of conservative rasterization includes: determining the minimum and maximum values ​​of the vertices of the first type of primitives in a first dimension, and the minimum and maximum values ​​in a second dimension according to the coordinates of the vertices of the first type of primitives; determining the equation of the bounding box for conservative rasterization according to the minimum and maximum values ​​of the vertices of the first type of primitives in the first dimension, and the minimum and maximum values ​​in the second dimension, and the degree parameter of conservative rasterization.

[0011] In a possible implementation, the rasterization mode includes an overestimation mode. In the overestimation mode, the coefficient adjustment method of the equation of the ith edge includes: when the ith edge is of the first type or the second type, A i , B i Remain unchanged, C i Increase (A i L+B i L); when the i-th edge is of the third or fourth type, A i , B i Remain unchanged, C i Increase (A i LB i L); when the i-th edge is of the fifth or sixth type, A i , B i Remain unchanged, C i Increase (-A i L+B i L); when the i-th edge is of type 7 or type 8, A i , B i Remain unchanged, C i Increase (-A i LB i L), where L represents the degree parameter of conservative rasterization.

[0012] In a possible implementation, the rasterization mode includes an underestimation mode. In the underestimation mode, the coefficient adjustment method of the equation of the ith edge includes: when the ith edge is of the first type or the second type, A i , B i Remain unchanged, C i Increase (-A i LB i L); when the i-th edge is of the third or fourth type, A i , B i Remain unchanged, C i Increase (-A i L+B i L); when the i-th edge is of the fifth or sixth type, A i , B i Remain unchanged, C i Increase (A i LB i L); when the i-th edge is of type 7 or type 8, A i , B i Remain unchanged, C i Increase (A i L+B i L), where L represents the degree parameter of conservative rasterization.

[0013] In a possible implementation, in the overestimation mode, the first condition is that at least one corner point of the pixel is within the area covered by the first type of primitive, and the second condition is that at least one corner point of the pixel is within the bounding box of the first type of primitive for conservative rasterization; judging whether each pixel satisfies the pixel coverage judgment condition of the first type of primitive based on the coordinates of the corner point of each pixel and the new equation of each edge includes: searching for the target corner point for pixel coverage judgment for the i-th edge based on the rasterization mode and the type of the i-th edge, wherein in the overestimation mode, the target corner point is the corner point farthest from the i-th edge when all corner points of any pixel are within the area covered by the first type of primitive; determining the position of the target corner point for pixel coverage judgment for each edge relative to the edge based on the coordinates of the corner point of each pixel and the new equation of each edge, and when the determined position is the same as the position of the area covered by the first type of primitive relative to the edge, at least one corner point of the pixel is within the area covered by the first type of primitive.

[0014] In a possible implementation, in the underestimation mode, the third condition is that all corner points of the pixel are within the area covered by the first type of primitive; judging whether each pixel satisfies the pixel coverage judgment condition of the first type of primitive based on the coordinates of the corner points of each pixel and the new equation of each edge includes: searching for the target corner point for pixel coverage judgment for the i-th edge based on the rasterization mode and the type of the i-th edge, wherein the target corner point is the corner point closest to the i-th edge when all corner points of any pixel are within the area covered by the first type of primitive in the underestimation mode; determining the position of the target corner point for pixel coverage judgment for each edge relative to the edge based on the coordinates of the corner points of each pixel and the new equation of each edge, and when the determined position is the same as the position of the area covered by the first type of primitive relative to the edge, at least one corner point of the pixel is within the area covered by the first type of primitive.

[0015] In a possible implementation, the method further includes: when the preset rasterization mode is the overestimation mode, determining the equation and type of each edge of the second type of primitive according to the coordinates of the vertices of the second type of primitive, wherein all vertices of the second type of primitive are on the same straight line and at least two vertices do not overlap; finding a coefficient adjustment method for the equation of each edge according to the preset rasterization mode and the type of each edge, adjusting the coefficient of the equation of each edge according to the coefficient adjustment method, and obtaining a new equation for each edge; determining the second type of primitive to be processed according to the coordinates of the vertices of the second type of primitive and the degree parameter of conservative rasterization according to the coordinates of the vertices of the second type of primitive and the degree parameter of conservative rasterization. The equation of the bounding box of conservative rasterization; judging whether each pixel satisfies the pixel coverage judgment condition of the second type of primitive according to the coordinates of the corner points of each pixel, the new equation of each edge and the equation of the bounding box of the second type of primitive for conservative rasterization; when any pixel satisfies the pixel coverage judgment condition of the second type of primitive, determining that the pixel is a pixel obtained by rasterization of the second type of primitive; wherein the pixel coverage judgment condition of the second type of primitive includes: at least one corner point of the pixel is within the area covered by the second type of primitive, and at least one corner point of the pixel is within the bounding box of the second type of primitive for conservative rasterization.

[0016] In a possible implementation, the method further includes: when the preset rasterization mode is the overestimation mode, determining the equation of the bounding box for conservative rasterization of the third type of primitives according to the coordinates of the vertices of the third type of primitives, and all the vertices of the third type of primitives coincide; judging whether each pixel satisfies the pixel coverage condition of the third type of primitive according to the coordinates of the corner points of each pixel and the equation of the bounding box for conservative rasterization of the third type of primitives; when any pixel satisfies the pixel coverage condition of the third type of primitives, determining that the pixel is a pixel obtained by rasterizing the third type of primitive; wherein the pixel coverage condition of the third type of primitives includes: at least one corner point of the pixel is within the bounding box for conservative rasterization of the third type of primitives.

[0017] According to another aspect of the present disclosure, a primitive conservative rasterization device is provided, the device comprising: a first determination module, for determining the equation and type of each edge of a first type of primitive according to the coordinates of the vertices of the first type of primitive, the first type of primitive comprising at least three vertices, and two edges with the same vertex as the endpoint intersecting; a first search module, for searching the coefficient adjustment method of the equation of each edge according to a preset rasterization mode and the type of each edge, adjusting the coefficient of the equation of each edge according to the coefficient adjustment method, and obtaining a new equation of each edge; a second determination module, for determining the pixel coverage judgment condition of the first type of primitive according to the preset rasterization mode; a third determination module, for determining whether each pixel satisfies the pixel coverage judgment condition of the first type of primitive according to the coordinates of the corner points of each pixel and the new equation of each edge, and when any pixel satisfies the pixel coverage judgment condition of the first type of primitive, the pixel is determined to be a pixel obtained by rasterization of the first type of primitive.

[0018] In a possible implementation, the rasterization mode includes an overestimation mode, and the device also includes: a fourth determination module, used to determine, in the overestimation mode, the equation of the bounding box of the first type of primitive for conservative rasterization based on the coordinates of the vertices of the first type of primitive and the degree parameter of conservative rasterization; in the overestimation mode, the pixel coverage judgment condition of the first type of primitive includes a first condition and a second condition, the first condition is used to judge the coverage of the first type of primitive on the pixel, and the second condition is used to judge the coverage of the bounding box of the first type of primitive for conservative rasterization on the pixel.

[0019] In a possible implementation, the rasterization mode includes an underestimation mode. In the underestimation mode, the pixel coverage judgment condition of the first type of primitive includes a third condition, and the third condition is used to judge the coverage of the pixel by the first type of primitive.

[0020] In a possible implementation, determining the equation and type of each edge of the first type of primitive according to the coordinates of the vertices of the first type of primitive includes: determining the equation of the i-th edge of the first type of primitive as A according to the coordinates of the vertices of the first type of primitive. i x+B i y+C i =0, where A i , B i , C i is the coefficient of the equation of the i-th side, x represents the coordinate of the first dimension, and y represents the coordinate of the second dimension; according to A i The relationship between the size of 0 and B i The size relationship with 0 determines the type of the i-th edge.

[0021] In one possible implementation, A i >0,B i >0, it is determined that the i-th edge is of the first type, and the area covered by the first type of primitives is located at the lower right side of the i-th edge; i =0, B i >0, it is determined that the i-th edge is of the second type, and the area covered by the first type of primitives is located below the i-th edge; i >0,B i <0, it is determined that the i-th edge is of the third type, and the area covered by the first type of primitives is located on the upper right side of the i-th edge; i >0,B i =0, it is determined that the i-th edge is of the fourth type, and the area covered by the first type of primitives is located on the right side of the i-th edge; i <0, B i >0, it is determined that the i-th edge is of the fifth type, and the area covered by the first type of primitives is located at the lower left side of the i-th edge; i <0, B i =0, it is determined that the i-th edge is of the sixth type, and the area covered by the first type of primitives is located on the left side of the i-th edge; i <0, B i <0, it is determined that the i-th edge is of the seventh type, and the area covered by the first type of primitive is located on the upper left side of the i-th edge; i =0, B i <0, it is determined that the i-th edge is of the eighth type, and the area covered by the first type of primitives is located on the upper side of the i-th edge.

[0022] In a possible implementation, determining the equation of the bounding box for conservative rasterization of the first type of primitives according to the coordinates of the vertices of the first type of primitives and the degree parameter of conservative rasterization includes: determining the minimum and maximum values ​​of the vertices of the first type of primitives in a first dimension, and the minimum and maximum values ​​in a second dimension according to the coordinates of the vertices of the first type of primitives; determining the equation of the bounding box for conservative rasterization according to the minimum and maximum values ​​of the vertices of the first type of primitives in the first dimension, and the minimum and maximum values ​​in the second dimension, and the degree parameter of conservative rasterization.

[0023] In a possible implementation, the rasterization mode includes an overestimation mode. In the overestimation mode, the coefficient adjustment method of the equation of the ith edge includes: when the ith edge is of the first type or the second type, A i , B i Remain unchanged, C i Increase (A i L+B i L); when the i-th edge is of the third or fourth type, A i , B i Remain unchanged, C i Increase (A i LB i L); when the i-th edge is of the fifth or sixth type, A i , B i Remain unchanged, C i Increase (-A i L+B i L); when the i-th edge is of type 7 or type 8, A i , B i Remain unchanged, C i Increase (-A i LB i L), where L represents the degree parameter of conservative rasterization.

[0024] In a possible implementation, the rasterization mode includes an underestimation mode. In the underestimation mode, the coefficient adjustment method of the equation of the ith edge includes: when the ith edge is of the first type or the second type, A i , B i Remain unchanged, C i Increase (-A i LB i L); when the i-th edge is of the third or fourth type, A i , B i Remain unchanged, C i Increase (-A i L+B i L); when the i-th edge is of the fifth or sixth type, Ai , B i Remain unchanged, C i Increase (A i LB i L); when the i-th edge is of type 7 or type 8, A i , B i Remain unchanged, C i Increase (A i L+B i L), where L represents the degree parameter of conservative rasterization.

[0025] In a possible implementation, in the overestimation mode, the first condition is that at least one corner point of the pixel is within the area covered by the first type of primitive, and the second condition is that at least one corner point of the pixel is within the bounding box of the first type of primitive for conservative rasterization; judging whether each pixel satisfies the pixel coverage judgment condition of the first type of primitive based on the coordinates of the corner point of each pixel and the new equation of each edge includes: searching for the target corner point for pixel coverage judgment for the i-th edge based on the rasterization mode and the type of the i-th edge, wherein in the overestimation mode, the target corner point is the corner point farthest from the i-th edge when all corner points of any pixel are within the area covered by the first type of primitive; determining the position of the target corner point for pixel coverage judgment for each edge relative to the edge based on the coordinates of the corner point of each pixel and the new equation of each edge, and when the determined position is the same as the position of the area covered by the first type of primitive relative to the edge, at least one corner point of the pixel is within the area covered by the first type of primitive.

[0026] In a possible implementation, in the underestimation mode, the third condition is that all corner points of the pixel are within the area covered by the first type of primitive; judging whether each pixel satisfies the pixel coverage judgment condition of the first type of primitive based on the coordinates of the corner points of each pixel and the new equation of each edge includes: searching for the target corner point for pixel coverage judgment for the i-th edge based on the rasterization mode and the type of the i-th edge, wherein the target corner point is the corner point closest to the i-th edge when all corner points of any pixel are within the area covered by the first type of primitive in the underestimation mode; determining the position of the target corner point for pixel coverage judgment for each edge relative to the edge based on the coordinates of the corner points of each pixel and the new equation of each edge, and when the determined position is the same as the position of the area covered by the first type of primitive relative to the edge, at least one corner point of the pixel is within the area covered by the first type of primitive.

[0027] In a possible implementation, the device further includes: a fifth determination module, which is used to determine the equation and type of each edge of the second type of primitive according to the coordinates of the vertices of the second type of primitive when the preset rasterization mode is the overestimation mode, wherein all vertices of the second type of primitive are on the same straight line and at least two vertices do not overlap; a third search module, which is used to search for a coefficient adjustment method of the equation of each edge according to the preset rasterization mode and the type of each edge, and adjust the coefficient of the equation of each edge according to the coefficient adjustment method to obtain a new equation of each edge; a sixth determination module, which is used to determine the second type of primitive according to the coordinates of the vertices of the second type of primitive and the degree parameter of conservative rasterization. The invention relates to an embodiment of the present invention, wherein the first judgment module is used to judge whether each pixel satisfies the pixel coverage judgment condition of the second type of primitive according to the coordinates of the corner points of each pixel, the new equation of each edge and the equation of the bounding box for conservative rasterization of the second type of primitive; the seventh determination module is used to determine that the pixel is a pixel obtained by rasterization of the second type of primitive when any pixel satisfies the pixel coverage judgment condition of the second type of primitive; wherein the pixel coverage judgment condition of the second type of primitive includes: at least one corner point of the pixel is within the area covered by the second type of primitive, and at least one corner point of the pixel is within the bounding box for conservative rasterization of the second type of primitive.

[0028] In a possible implementation, the device also includes: an eighth determination module, which is used to determine the equation of the bounding box for conservative rasterization of the third type of primitive according to the coordinates of the vertices of the third type of primitive when the preset rasterization mode is the overestimation mode, and all the vertices of the third type of primitive coincide with each other; a second judgment module, which is used to judge whether each pixel satisfies the pixel coverage condition of the third type of primitive according to the coordinates of the corner points of each pixel and the equation of the bounding box for conservative rasterization of the third type of primitive; a ninth determination module, which is used to determine that when any pixel satisfies the pixel coverage condition of the third type of primitive, the pixel is a pixel obtained by rasterization of the third type of primitive; wherein the pixel coverage condition of the third type of primitive includes: at least one corner point of the pixel is within the bounding box for conservative rasterization of the third type of primitive.

[0029] According to another aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to implement the above method when executing the instructions stored in the memory.

[0030] According to another aspect of the present disclosure, a non-volatile computer-readable storage medium is provided, on which computer program instructions are stored, wherein the computer program instructions implement the above method when executed by a processor.

[0031] According to another aspect of the present disclosure, a computer program product is provided, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the above method.

[0032] According to the primitive rasterization method of the embodiment of the present disclosure, according to the coordinates of the vertices of the first type of primitive, the equation and type of each edge of the first type of primitive are determined, the first type of primitive includes at least three vertices, and two edges with the same vertex as the endpoint intersect; according to the preset rasterization mode and the type of each edge, the coefficient adjustment method of the equation of each edge is found, and the coefficient of the equation of each edge is adjusted according to the coefficient adjustment method to obtain a new equation of each edge; according to the preset rasterization mode, the pixel coverage judgment condition of the first type of primitive is determined; according to the coordinates of the corner point of each pixel and the new equation of each edge, whether each pixel meets the pixel coverage judgment condition of the first type of primitive is judged, and when any pixel meets the pixel coverage judgment condition of the first type of primitive, the pixel is determined to be a pixel obtained by rasterization of the first type of primitive. By presetting the coefficient adjustment method of the equation of the edge according to the type of edge and the rasterization mode, the coefficient adjustment method can be directly found and the new equation of the edge can be directly obtained based on the coefficient adjustment method found, without the need to calculate the new equation of the edge separately, without adding additional hardware computing resources, without changing the GPU architecture, and reducing the cost of conservative rasterization. And the coverage of the pixel is determined according to the new equation of the edge, so when determining the coverage of the pixel, the area covered by the primitive has been adjusted, ensuring the correctness of the rasterization. In this case, the method disclosed in the present invention not only ensures the correctness of the conservative rasterization function, but also does not require the addition of additional hardware computing resources, does not change the GPU architecture, and makes the cost of conservative rasterization lower, thereby completing conservative rasterization simply and efficiently.

[0033] Further features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate exemplary embodiments, features, and aspects of the disclosure and, together with the description, serve to explain the principles of the disclosure.

[0035] Figure 1 Schematic diagram showing the effects of ordinary rasterization and conservative rasterization of prior art 1 and prior art 2.

[0036] Figure 2 An exemplary application scenario of the primitive rasterization method according to an embodiment of the present disclosure is shown.

[0037] Figure 3A schematic diagram showing the flow of a primitive rasterization method according to an embodiment of the present disclosure.

[0038] Figure 4 Examples of first-category primitives, second-category primitives, and third-category primitives according to an embodiment of the present disclosure are shown.

[0039] Figure 5 A schematic diagram showing primitive expansion according to an embodiment of the present disclosure is shown.

[0040] Figure 6 A schematic diagram showing the indentation of graphic elements according to an embodiment of the present disclosure.

[0041] Figure 7 An example of the relationship between the type of edge and the coefficient of the edge according to an embodiment of the present disclosure is shown.

[0042] Figure 8 An example of pixel coverage by the first type of primitive according to an embodiment of the present disclosure is shown.

[0043] Fig. 9 An example of the expansion method of the second type of primitives according to an embodiment of the present disclosure is shown.

[0044] Fig.10 An example of the expansion method of the third type of primitives according to an embodiment of the present disclosure is shown.

[0045] Fig.11 A schematic diagram showing the structure of a primitive conservation device according to an embodiment of the present disclosure.

[0046] Fig.12 A block diagram of an electronic device 1900 according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0047] Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.

[0048] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.

[0049] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present disclosure.

[0050] Rasterization is a key step in the graphics processing unit (GPU) rendering pipeline, responsible for converting primitives (such as triangle primitives) into pixels on the screen. Primitives are usually floating-point numbers (such as float32), and the GPU converts them into fixed-point numbers (such as fixed16.8) before processing. This process inevitably brings about a large loss of precision, resulting in pixel distortion.

[0051] The principle of the common rasterization method is to determine whether the center point of each pixel is covered by the primitive. If the center point of the pixel is completely covered by the primitive or mostly covered by the primitive, the pixel is considered to be rendered. If a small part of the center point of the pixel is covered by the primitive or not covered by the primitive, the pixel is considered not to be rendered. The information of the pixel to be rendered can be sent to the pixel shader. Under the common rasterization process, not all pixels covered by the original triangle primitive will be rendered, so the precision loss is large.

[0052] In order to solve this problem, the prior art proposes a conservative rasterization method, which can compensate for the pixel distortion caused by the precision loss when converting floating-point numbers to fixed-point numbers.

[0053] The principle of the conservative rasterization method proposed in the prior art is to determine whether any area of ​​each pixel (including the corner points of the pixel) is covered by the primitive. If any area of ​​the pixel is covered by the primitive, it is considered that the pixel needs to be rendered. If all areas of the pixel are not covered by the primitive, it is considered that the pixel does not need to be rendered. The rendered pixels can be sent to the pixel shader. In this case, all pixels covered by the original triangle primitive will be rendered. This method is relatively simple to implement, but the compensation for precision loss is limited, so the rasterization accuracy is still poor, and it cannot be used in scenarios with high requirements for conservative rasterization accuracy.

[0054] The principle of the conservative rasterization method proposed in the second prior art is to set an uncertainty region (uncertainty region) with the vertex as the center and in the shape of a regular quadrilateral at each vertex of the original triangle primitive. The vertical distance between the vertex and each side of the uncertainty region is the same, and the value of the vertical distance is also the size of the uncertainty region, which is referred to as the degree parameter of conservative rasterization hereinafter, and is used to adjust the range of the primitive coverage area, and its value can be set according to the application scenario requirements. Two rasterization modes are set, namely, over estimate mode and under estimate mode.

[0055] Next, in each rasterization mode, the equations of the edges of the triangle primitives are re-determined according to the coordinates of the corner points of the uncertainty region, and the area covered by the triangle primitives is adjusted accordingly. In other words, the second prior art requires determining two sets of edge equations. In addition, the equation of the minimum bounding box that accommodates the uncertainty region must be determined according to the coordinates of the corner points of the uncertainty region.

[0056] In overestimation mode, it is necessary to determine whether any area of ​​the pixel is covered by a triangle primitive and is within the bounding box. If any area of ​​the pixel is covered by a triangle primitive and is within the bounding box, the pixel is considered to be rendered. If the entire area of ​​the pixel is not covered by a triangle primitive or is not within the bounding box, the pixel is considered not to be rendered. The rendered pixel can be sent to the pixel shader.

[0057] In the underestimation mode, it is necessary to determine whether the entire area of ​​the pixel is covered by the triangle primitive and is within the bounding box. If the entire area of ​​the pixel is covered by the triangle primitive and is within the bounding box, the pixel is considered to be rendered. If any area of ​​the pixel is not covered by the triangle primitive or any area is not within the bounding box, the pixel is considered not to be rendered. The rendered pixel can be sent to the pixel shader as an inner mask.

[0058] Although the solution of the second existing technology has a conservative rasterization accuracy and is high, it is too complicated because it needs to calculate two sets of edge equations. The two sets of edge equations require additional hardware resources to complete the calculation and transmission, which has a great impact on the GPU architecture and is too costly to implement.

[0059] Figure 1 Schematic diagram showing the effects of ordinary rasterization and conservative rasterization of prior art 1 and prior art 2.

[0060] like Figure 1 As shown, the pixels in the shaded part are the pixels rendered during the rasterization process. Under ordinary rasterization, not all pixels covered by the original triangle primitive will be rendered. Under the conservative rasterization of the prior art one, any pixel covered by the original triangle primitive will be rendered. Under the conservative rasterization of the prior art two, taking the overestimation mode as an example, the closed area formed by the dotted line and the uncertainty area is the common area of ​​the expanded triangle primitive and the bounding box, and the pixels covered by the common area will be rendered.

[0061] In summary, the existing conservative rasterization methods are either easy to implement but have poor rasterization accuracy, or have high rasterization accuracy but are expensive to implement. How to reduce the hardware impact on the rendering pipeline while ensuring the correctness of the conservative rasterization function has become a technical problem that needs to be solved in this field. In addition, the existing conservative rasterization methods do not support conservative rasterization of primitives that degenerate into lines or points.

[0062] In view of this, the present disclosure proposes a primitive rasterization method, device, electronic device and storage medium. The method not only ensures the correctness of the conservative rasterization function, but also does not require the addition of additional hardware computing resources, does not change the GPU architecture, and makes the cost of conservative rasterization lower, thereby completing conservative rasterization simply and efficiently.

[0063] Furthermore, the primitive rasterization method disclosed in the present invention can also perform conservative rasterization on primitives that degenerate into lines and points, thereby improving the capability of the conservative rasterization method.

[0064] Figure 2 An exemplary application scenario of the primitive rasterization method according to an embodiment of the present disclosure is shown.

[0065] like Figure 2 As shown, the primitive rasterization method of the embodiment of the present disclosure can be used in scenes with conservative rasterization requirements such as voxel rendering and collision detection, and is executed by the pipeline responsible for rasterization in the graphics processor rendering pipeline.

[0066] The information used in conservative rasterization can be pre-set, such as the coefficient adjustment method of the edge equation corresponding to each combination of rasterization mode and edge type, the target corner point, etc., and examples thereof are shown in Tables 2 to 5 below. And the pixel coverage judgment conditions corresponding to each rasterization mode, such as the first condition, the second condition, the third condition, etc. described below.

[0067] and the degree of conservative rasterization parameter.

[0068] After the image rendering enters the rasterization stage, the primitive rasterization method disclosed in the present invention is executed to perform conservative rasterization processing on the primitive data. The pixels obtained by conservative rasterization can be sent to a pixel shader (not shown) for shading.

[0069] Figure 3 A schematic diagram showing the flow of a primitive rasterization method according to an embodiment of the present disclosure.

[0070] like Figure 3 As shown, in a possible implementation, the method includes:

[0071] Step S31, determining the equation and type of each edge of the first type of primitive according to the coordinates of the vertices of the first type of primitive, the first type of primitive including at least three vertices, and two edges with the same vertex as the endpoint intersect;

[0072] Step S32, searching for a coefficient adjustment method for the equation of each edge according to a preset rasterization mode and the type of each edge, adjusting the coefficient of the equation of each edge according to the coefficient adjustment method, and obtaining a new equation for each edge;

[0073] Step S33, determining the pixel coverage judgment condition of the first type of primitive according to the preset rasterization mode;

[0074] Step S34, based on the coordinates of the corner points of each pixel and the new equation of each edge, determine whether each pixel satisfies the pixel coverage judgment condition of the first category of primitives. When any pixel satisfies the pixel coverage judgment condition of the first category of primitives, determine that the pixel is a pixel obtained by rasterizing the first category of primitives.

[0075] For example, the present disclosure divides the primitives into three categories according to the degradation degree of the primitives. Figure 4 Examples of first-category primitives, second-category primitives, and third-category primitives according to an embodiment of the present disclosure are shown.

[0076] like Figure 4 As shown, the first type of primitive may be a primitive whose coverage area is a closed figure (without restriction on whether it is degenerate), including at least three vertices, and two edges with the same vertex as the endpoint intersect.

[0077] The second type of primitives may be primitives that degenerate into lines, and all vertices of the second type of primitives are on the same straight line and at least two vertices do not overlap.

[0078] The third type of primitives may be primitives that degenerate into points, and all vertices of the third type of primitives coincide.

[0079] The present disclosure supports conservative rasterization of the above three types of primitives, and the conservative rasterization methods of different types of primitives may be different.

[0080] The following takes the first type of primitives (ie, triangle primitives) including three vertices as an example to introduce an exemplary conservative rasterization method for the first type of primitives.

[0081] First, in step S31, the equation and type of each edge of the first type of primitive can be determined based on the vertex coordinates of the first type of primitive. The equation of the edge can be obtained by substituting the coordinates of the endpoints of the edge into the two-point equation of the line. The specific calculation method can be implemented based on the existing technology and will not be repeated here. The equation of the ith edge can be obtained by A i x+B i y+C i =0, where A i , B i , C i is the coefficient of the equation of the i-th side, x represents the coordinate of the first dimension, and y represents the coordinate of the second dimension.

[0082] In the embodiments of the present disclosure, there are multiple types of edges of primitives. When conservatively rasterizing, the coefficients of the edge equations may be adjusted differently depending on the edge type. Examples of edge types and the differences between different types of edges can be found in the relevant description of Table 1 below. The embodiments of the present disclosure do not limit the classification method of edges.

[0083] When the rasterization mode and the edge type are known, the coefficient adjustment method of the edge equation is fixed in the conservative rasterization process. Therefore, the coefficient adjustment method of the edge equation under each combination of rasterization mode and edge type can be preset, and when executing step S32, the coefficient adjustment method of the equation of each edge can be directly found. The coefficient of the equation of each edge can be adjusted according to the coefficient adjustment method found to obtain a new equation for each edge. Examples of the coefficient adjustment method of the edge equation under each combination of rasterization mode and edge type can be found in the relevant descriptions of Tables 2 and 3.

[0084] Since the prior art recalculates the edge equation according to the preset rasterization mode, the equation of each edge is calculated twice, which greatly increases the calculation cost. However, the disclosed embodiment pre-sets the coefficient adjustment method of the edge equation under each combination of rasterization mode and edge type, and when needed, the new edge equation can be obtained by searching the coefficient adjustment method according to the rasterization mode. Compared with the prior art, each edge reduces the equation calculation process once, which greatly reduces the calculation cost.

[0085] After completing the adjustment of the coefficients of the edge equation, the pixel coverage can be judged. For different rasterization modes, the pixel coverage judgment conditions of the first type of primitives are different. The pixel coverage judgment conditions of the first type of primitives in each rasterization mode can be preset. When executing step S33, according to the rasterization mode, the pixel coverage judgment conditions of the first type of primitives corresponding to the current rasterization mode can be directly determined. Examples of pixel coverage judgment conditions and examples of the corresponding relationship between pixel coverage judgment conditions and primitives and rasterization modes are given later.

[0086] Then, step S34 can be executed to determine whether each pixel satisfies the pixel coverage determination condition found in step S33 according to the coordinates of the corner points of each pixel and the new equation of each edge. When any pixel satisfies the pixel coverage determination condition, the pixel is determined to be a pixel obtained by rasterization of the first type of primitive. Similarly, after determining whether each pixel satisfies the pixel coverage determination condition found in step S33, the conservative rasterization of the current first type of primitive ends.

[0087] According to the primitive rasterization method of the embodiment of the present disclosure, according to the coordinates of the vertices of the first type of primitive, the equation and type of each edge of the first type of primitive are determined, the first type of primitive includes at least three vertices, and two edges with the same vertex as the endpoint intersect; according to the preset rasterization mode and the type of each edge, the coefficient adjustment method of the equation of each edge is found, and the coefficient of the equation of each edge is adjusted according to the coefficient adjustment method to obtain a new equation of each edge; according to the preset rasterization mode, the pixel coverage judgment condition of the first type of primitive is determined; according to the coordinates of the corner point of each pixel and the new equation of each edge, whether each pixel meets the pixel coverage judgment condition of the first type of primitive is judged, and when any pixel meets the pixel coverage judgment condition of the first type of primitive, the pixel is determined to be a pixel obtained by rasterization of the first type of primitive. By presetting the coefficient adjustment method of the equation of the edge according to the type of edge and the rasterization mode, the coefficient adjustment method can be directly found and the new equation of the edge can be directly obtained based on the coefficient adjustment method found, without the need to calculate the new equation of the edge separately, without adding additional hardware computing resources, without changing the GPU architecture, and reducing the cost of conservative rasterization. And the coverage of the pixel is determined according to the new equation of the edge, so when determining the coverage of the pixel, the area covered by the primitive has been adjusted, ensuring the correctness of the rasterization. In this case, the method disclosed in the present invention not only ensures the correctness of the conservative rasterization function, but also does not require the addition of additional hardware computing resources, does not change the GPU architecture, and makes the cost of conservative rasterization lower, thereby completing conservative rasterization simply and efficiently.

[0088] In the present disclosure, there are two preset rasterization modes, namely, an overestimation mode and an underestimation mode. In the overestimation mode, after the coefficients of the edge equations are adjusted, the primitives will expand outward to cover a larger area, and in the underestimation mode, the primitives will shrink inward to cover a smaller area.

[0089] Figure 5 A schematic diagram showing primitive expansion according to an embodiment of the present disclosure is shown.

[0090] like Figure 5 As shown, the triangle primitive includes three vertices: V0 (x0, y0), V1 (x1, y1), V2 (x2, y2), and edges V0V1, V1V2, and V0V2.

[0091] Assuming the degree parameter of conservative rasterization is L, then Figure 5 As shown, a regular quadrilateral uncertainty region with a vertex as the center and a side length of 2L is obtained at each vertex. Assuming that the rasterization mode is the overestimation mode, the original triangle primitive can be expanded to obtain a larger triangle primitive after adjusting the edge equation. An example of adjusting the edge equation in the overestimation mode is given later.

[0092] according to Figure 5It can be seen that the uncertainty area at each vertex forms a triangular closed area with the corresponding vertex after the vertex is expanded. The closed area is an invalid area. The pixels covered by the area should be excluded during conservative rasterization. The pixel exclusion can be achieved by combining the bounding box (bbox) of conservative rasterization.

[0093] In a possible implementation, the rasterization mode includes an overestimation mode, and in the overestimation mode, the method further includes:

[0094] Determine an equation of a bounding box for conservative rasterization of the first type of primitives according to the coordinates of the vertices of the first type of primitives and a degree parameter of conservative rasterization;

[0095] In the overestimation mode, the pixel coverage judgment condition of the first type of primitive includes a first condition and a second condition, the first condition is used to judge the coverage of the first type of primitive on the pixel, and the second condition is used to judge the coverage of the bounding box on the pixel.

[0096] For example, see Figure 5 , the original bounding box can be calculated by the coordinates of the three vertices of the first type of primitive, and the original bounding box is the minimum bounding box that can accommodate all the vertices of the primitive. During conservative rasterization, the bounding box also needs to be expanded to accommodate all uncertainty areas, and the expanded bounding box can be used as the bounding box for conservative rasterization of the first type of primitive. An exemplary method of expanding the bounding box is given later.

[0097] Accordingly, in the overestimation mode, the pixel coverage judgment condition of the first type of primitive may include a first condition and a second condition, wherein the first condition is used to judge the coverage of the pixel by the first type of primitive, and at this time, the first type of primitive refers to the first type of primitive after expansion. The second condition is used to judge the coverage of the pixel by the bounding box of the first type of primitive subjected to conservative rasterization. When a pixel satisfies the first condition and the second condition at the same time, the pixel coverage judgment condition of the first type of primitive is met. The embodiments of the present disclosure do not limit the specific setting method of the first condition and the second condition. Examples of the first condition and the second condition are given later.

[0098] Those skilled in the art should understand that in the overestimation mode, it is also possible to use other methods instead of using a bounding box to exclude pixels covered by invalid areas. The embodiments of the present disclosure do not limit whether a bounding box must be used in the overestimation mode.

[0099] In this way, the primitive conservative method of the embodiment of the present disclosure supports conservative rasterization in the overestimation mode.

[0100] In a possible implementation, determining an equation of a bounding box for conservative rasterization of the first type of primitives according to the coordinates of the vertices of the first type of primitives and a conservative rasterization degree parameter includes:

[0101] According to the coordinates of the vertices of the first type of primitives, determine the minimum value and the maximum value of the vertices of the first type of primitives in the first dimension, and the minimum value and the maximum value in the second dimension;

[0102] An equation of a conservative rasterization bounding box is determined according to a minimum value and a maximum value of the first dimension and a minimum value and a maximum value of the second dimension of the vertices of the first type of primitives, and a conservative rasterization degree parameter.

[0103] For example, Figure 5 Taking the primitive shown as an example, x represents the coordinate of the first dimension, and y represents the coordinate of the second dimension. We can first determine the minimum value min(min(x0, x1), x2) and maximum value max(max(x0, x1), x2) of the primitive in the first dimension x, as well as the minimum value min(min(y0, y1) and maximum value min(min(y0, y1) of the primitive in the second dimension y according to the coordinates of the vertices of the primitive.

[0104] The original bounding box can be a rectangular bounding box. Then the equation of the original bounding box can be:

[0105] x=bbox_minx=min(min(x0,x1),x2);

[0106] x=bbox_maxx=max(max(x0,x1),x2);

[0107] y=bbox_miny=min(min(y0, y1), y2);

[0108] y=bbox_maxy=max(max(y0, y1), y2);

[0109] Among them, bbox_minx represents the minimum value of the vertices of the first type of primitive in the first dimension, bbox_maxx represents the maximum value of the vertices of the first type of primitive in the first dimension, bbox_miny represents the minimum value of the vertices of the first type of primitive in the second dimension, and bbox_maxy represents the maximum value of the vertices of the first type of primitive in the second dimension.

[0110] The degree parameter L of conservative rasterization can be a number greater than 0. In this case, the expanded bounding box can also be a rectangular bounding box, and each edge is moved L unit distances outside the original bounding box. The equation of the expanded bounding box can be:

[0111] x = bbox_minx - L;

[0112] x = bbox_maxx + L;

[0113] y = bbox_miny - L;

[0114] y = bbox_maxy + L;

[0115] That is, the minimum value of the bounding box in the first dimension is equal to the difference between the minimum value of the vertices of the first type of primitive in the first dimension and the degree parameter of conservative rasterization;

[0116] The maximum value of the bounding box in the first dimension is equal to the sum of the maximum value of the vertices of the first type of primitive in the first dimension and the degree parameter of conservative rasterization;

[0117] The minimum value of the bounding box in the second dimension is equal to the difference between the minimum value of the vertices of the first type of primitive in the second dimension and the degree parameter of conservative rasterization;

[0118] The maximum value of the bounding box in the second dimension is equal to the sum of the maximum value of the vertices of the first type of primitive in the second dimension and the degree parameter of conservative rasterization.

[0119] In this way, the equation of the bounding box for conservative rasterization of the first type of primitive can be obtained. In practical applications, it is only necessary to pre-set the degree parameter of conservative rasterization, and after determining the equation of the original bounding box according to the coordinates of the vertices of the first type of primitive, the equation of the bounding box for conservative rasterization of the first type of primitive can be directly obtained in combination with the degree parameter of conservative rasterization, without the need to set up additional hardware computing resources, thereby reducing the cost required for conservative rasterization.

[0120] In a possible implementation, the rasterization mode includes an underestimation mode. In the underestimation mode, the pixel coverage judgment condition of the first type of primitive includes a third condition. The third condition is used to judge the coverage of the pixel by the first type of primitive.

[0121] In the underestimation mode, the primitives will shrink inwards. Figure 6 A schematic diagram showing the indentation of graphic elements according to an embodiment of the present disclosure.

[0122] like Figure 6 As shown, it is assumed that the primitive includes three vertices and three edges. The coordinates of the vertices are: V0(x0, y0), V1(x1, y1), V2(x2, y2), and the three edges are edge V0V1, edge V1V2, and edge V0V2.

[0123] Assuming the degree parameter of conservative rasterization is L, then Figure 6As shown, a regular quadrilateral uncertainty region with a vertex as the center and a side length of 2L is obtained at each vertex of the primitive. Assuming that the rasterization mode is the underestimation mode, the original triangle primitive can be indented to obtain a smaller triangle primitive after adjusting the edge equation. An example of how to adjust the edge equation in the underestimation mode is given later.

[0124] There is no invalid area after the primitive is retracted, so there is no need to use a bounding box in the underestimation mode. Accordingly, in the underestimation mode, the pixel coverage judgment condition of the first type of primitive may include a third condition, and the third condition is used to judge the coverage of the pixel by the first type of primitive. At this time, the first type of primitive refers to the first type of primitive after retraction. When the pixel meets the third condition, the pixel coverage judgment condition of the first type of primitive is met. The specific setting method of the third condition is not limited in the embodiment of the present disclosure. An example of the third condition is given later.

[0125] In this way, the primitive conservative method of the embodiment of the present disclosure supports conservative rasterization in the underestimation mode.

[0126] An exemplary method for determining the type of each edge of the first type of primitives is described below.

[0127] In a possible implementation, determining the equation and type of each edge of the first-type primitive according to the coordinates of the vertices of the first-type primitive includes:

[0128] According to the coordinates of the vertices of the first type of primitive, the equation of the i-th edge of the first type of primitive is determined to be A i x+B i y+C i =0, where A i , B i , C i is the coefficient of the equation of the i-th side, x represents the coordinate of the first dimension, and y represents the coordinate of the second dimension;

[0129] According to A i The relationship between the size of 0 and B i The size relationship with 0 determines the type of the i-th edge.

[0130] For example, in Figure 5 and Figure 6 In the example, assume that the primitive includes three vertices and three edges. The coordinates of the vertices are V0(x0, y0), V1(x1, y1), and V2(x2, y2). The three edges are V0V1, V1V2, and V0V2. Based on the coordinates of vertices V0 and V1, the equation of edge V0V1 can be calculated as (y0-y1)×x+(x1-x0)×y+(x0×y1-x1×y0)=0.

[0131] According to the coordinates of vertices V1 and V2, the equation of edge V1V2 can be calculated as (y1-y2)×x+(x2-x1)×y+(x1×y2-x2×y1)=0;

[0132] According to the coordinates of vertex V0 and vertex V2, the equation of edge V0V2 can be calculated as (y2-y0)×x+(x0-x2)×y+(x2×y0-x0×y2)=0.

[0133] The coefficients of the determined edge equations can be transmitted to the subsequent pipeline in an array form. Table 1 shows an example of an array formed by the coefficients of the edge equations.

[0134] Table 1

[0135] side <![CDATA[A i ]]> <![CDATA[B i ]]> <![CDATA[C i ]]> V0V1 y0-y1 x1-x0 x0×y1-x1×y0 V1V2 y1-y2 x2-x1 x1×y2-x2×y1 V0V2 y2-y0 x0-x2 x2×y0-x0×y2

[0136] An exemplary method for determining the type of an edge is described below.

[0137] In one possible implementation, the type of the edge is determined according to the coefficients of the equation of the edge.

[0138] The equation of the i-th side is A i x+B i y+C i = 0, A i , B i , C i is the coefficient of the equation of the ith side. i , B i The relative position between the area covered by the first type of primitive and the ith edge is determined based on the size relationship with the preset value, and the type of the ith edge is determined based on the type corresponding to the relative position.

[0139] The relative position of the area covered by the first type of primitive and the i-th edge includes eight possible situations, namely, the area covered by the first type of primitive is located at the lower right side, lower side, upper right side, right side, lower left side, left side, upper left side, and upper side of the i-th edge. Based on this, it can be set that the edge also includes eight types. Each type of edge corresponds to a relative position.

[0140] The present disclosure does not limit the specific value of the preset value, as long as the value of A i , B i The relative position between the area covered by the first type of primitive and the i-th edge can be determined by the size relationship with the preset value. The following takes the preset value of 0 as an example to introduce the corresponding relationship between the relative positions of different types of edges and the area covered by the first type of primitive.

[0141] In one possible implementation, A i >0,B i>0, the i-th edge is determined to be of the first type, and the area covered by the first type of primitives is located at the lower right side of the i-th edge;

[0142] A i =0, B i >0, it is determined that the i-th edge is of the second type, and the area covered by the first type of primitives is located below the i-th edge;

[0143] A i >0,B i <0, the i-th edge is determined to be of the third type, and the area covered by the first type of primitives is located on the upper right side of the i-th edge;

[0144] A i >0,B i = 0, it is determined that the i-th edge is of the fourth type, and the area covered by the first type of primitives is located on the right side of the i-th edge;

[0145] A i <0, B i >0, the i-th edge is determined to be of the fifth type, and the area covered by the first type of primitives is located at the lower left side of the i-th edge;

[0146] A i <0, B i =0, it is determined that the i-th edge is of the sixth type, and the area covered by the first type of primitives is located on the left side of the i-th edge;

[0147] A i <0, B i <0, it is determined that the i-th edge is of the seventh type, and the area covered by the first type of primitives is located on the upper left side of the i-th edge;

[0148] A i =0, B i <0, it is determined that the i-th edge is of the eighth type, and the area covered by the first type of primitives is located on the upper side of the i-th edge.

[0149] Figure 7 An example of the relationship between the type of edge and the coefficient of the edge according to an embodiment of the present disclosure is shown.

[0150] like Figure 7 As shown, first, the first dimension x can be a horizontal dimension, and the right side is the positive direction. The second dimension y can be a vertical dimension, and the lower side is the positive direction. Figure 7 Bold edges are used to indicate edges of corresponding types.

[0151] Among them, in A i >0,B i >0, the type of the i-th edge is the first type. At this time, the area covered by the first type of primitive is located at the lower right side of the i-th edge, and the i-th edge is the leftmost and topmost edge of the primitive.

[0152] In A i =0, B i >0, the type of the i-th edge is the second type, the area covered by the first type of primitive is located below the i-th edge, and the i-th edge is the topmost edge in the primitive.

[0153] In A i >0,B i <0, the type of the i-th edge is the third type, the area covered by the first type of primitive is located on the upper right side of the i-th edge, and the i-th edge is the leftmost and bottommost edge in the primitive.

[0154] In A i >0,B i =0, the type of the i-th edge is the fourth type, the area covered by the first type of primitive is located on the right side of the i-th edge, and the i-th edge is the leftmost edge in the primitive.

[0155] In A i <0, B i >0, the type of the ith edge is the fifth type, the area covered by the first type of primitive is located at the lower left side of the ith edge, and the ith edge is the rightmost and topmost edge of the primitive.

[0156] In A i <0, B i =0, the type of the ith edge is the sixth type, the area covered by the first type of primitive is located on the left side of the ith edge, and the ith edge is the rightmost edge in the primitive.

[0157] In A i <0, B i <0, the type of the ith edge is the seventh type, and the area covered by the first type of primitive is located on the upper left side of the ith edge; the ith edge is the rightmost and bottommost edge of the primitive.

[0158] In A i =0, B i <0, the type of the ith edge is the eighth type, the area covered by the first type of primitive is located on the upper side of the ith edge, and the ith edge is the lowermost edge in the primitive.

[0159] Those skilled in the art will understand that Figure 7 The method for determining the type of edge recorded in the relevant description is applicable to the scenario where the first dimension x is a horizontal dimension with the right side as the positive direction and the second dimension y is a vertical dimension with the lower side as the positive direction. In other scenarios (for example, the first dimension x is a horizontal dimension with the left side as the positive direction and the second dimension y is a vertical dimension with the lower side as the positive direction, etc.), the method for determining the type of edge can be adaptively modified according to the information of the coordinate system in the scene, which will not be repeated here.

[0160] Furthermore, a lookup table of coefficient adjustment methods for edge equations in two rasterization modes may be preset. The lookup table may at least record the rasterization mode, various edge types, coefficients that need to be adjusted for each type in the rasterization mode, and the adjustment methods thereof. The disclosed embodiment does not limit whether coefficients that do not need to be adjusted are reflected in the lookup table.

[0161] In this case, in one possible implementation method, the coefficient adjustment method of the equation of each edge is searched according to the preset rasterization mode and the type of each edge. The coefficient adjustment method corresponding to the type of the i-th edge can be searched in the lookup table corresponding to the preset rasterization mode.

[0162] Furthermore, the coefficient adjustment method of the equation of the i-th side includes: keeping A i , B i unchanged, making C i The first value may be increased according to the type of the i-th edge, the conservative rasterization degree parameter L and A i , B i It should be understood that, i Increasing the first value means making C i Added to the first value, not the coefficient adjusted C i The first value may be positive or negative. When the first value is positive, C i After increasing the first value, C i When the first value is negative, C i After increasing the first value, C i The value decreases.

[0163] The following introduces the coefficients C of the equations of different types of edges in the overestimation mode and the underestimation mode. i the degree of increase.

[0164] In a possible implementation, the rasterization mode includes an overestimation mode. In the overestimation mode, the coefficient adjustment method of the equation of the i-th edge includes:

[0165] When the i-th edge is of type 1 or type 2, A i , B i Remain unchanged, C i Increase (A i L+B i L);

[0166] When the i-th edge is of the third or fourth type, A i , B i Remain unchanged, C i Increase (A i LB i L);

[0167] When the i-th edge is of type 5 or type 6, A i , B i Remain unchanged, C i Increase (-A i L+B i L);

[0168] When the i-th edge is of type 7 or type 8, A i , B i Remain unchanged, C i Increase (-A i LB i L);

[0169] Where L represents the degree parameter of conservative rasterization.

[0170] For example, in the overestimation mode, if Figure 5 As shown, the edge of the primitive moves away from the center of the primitive. Taking the first type of edge V0V1 as an example, point V0 needs to move to V0' and point V1 moves to V1', that is, both point V0 and point V1 need to move L to the left and L upward.

[0171] Since the first dimension x has the right side as the positive direction and the second dimension y has the lower side as the positive direction, the coordinates of V0' may be (x0-L, y0-L) and the coordinates of V1' may be (x1-L, y1-L).

[0172] At this time, the equation of V0'V1' is:

[0173] A i x+B i y i (x0-L)-B i (y0-L)=A i x+B i y+(-A i x0-B i y0)+A i L+B i L=A i x+B i y+C i =0;

[0174] The equation of edge V0V1 is:

[0175] (y0-y1)x+(x1-x0)y+(x0×y1-x1×y0)=(y0-y1)x+(x1-x0)y-x0(y0-y1)-y0(x1-x0)=A i x+B i y i x0-Bi y0=A i x+B i y+C i =0;

[0176] Comparing the coefficients of the equation of V0'V1' with the coefficients of the equation of edge V0V1, we can see that only the coefficient C i Different, as long as the coefficient C is i Increase (A i L+B i L), we can get the equation of the edge V0'V1'.

[0177] Similarly, in the overestimation mode, when the i-th edge is of the second type, A i , B i Remain unchanged, C i Increase (A i L+B i L) is sufficient; when the i-th edge is of the third or fourth type, A i , B i Remain unchanged, C i Increase (A i LB i L) is sufficient; when the i-th edge is of the fifth or sixth type, A i , B i Remain unchanged, C i Increase (-A i L+B i L) is sufficient; when the i-th edge is of the seventh or eighth type, A i , B i Remain unchanged, C i Increase (-A i LB i The specific calculation method of the equation of each type of edge corresponding to the expansion before and after the expansion will not be described here.

[0178] In the overestimation mode, after the coefficient adjustment method of the equation of each type of edge is determined, a coefficient adjustment method lookup table as shown in Table 2 can be generated in advance.

[0179] Table 2

[0180]

[0181] In this case, when the preset rasterization mode is the overestimation mode, the coefficient adjustment method of the edge equation can be determined by directly looking up Table 2 according to the type of the edge.

[0182] In a possible implementation, the rasterization mode includes an underestimation mode. In the underestimation mode, the coefficient adjustment method of the equation of the i-th edge includes:

[0183] When the i-th edge is of type 1 or type 2, A i , B i Remain unchanged, C i Increase (-A i LB i L);

[0184] When the i-th edge is of the third or fourth type, A i , B i Remain unchanged, C i Increase (-A i L+B i L);

[0185] When the i-th edge is of type 5 or type 6, A i , B i Remain unchanged, C i Increase (A i LB i L);

[0186] When the i-th edge is of type 7 or type 8, A i , B i Remain unchanged, C i Increase (A i L+B i L);

[0187] Where L represents the degree parameter of conservative rasterization.

[0188] For example, in the underestimation mode, if Figure 6 As shown, the edge of the primitive moves toward the center of the primitive. Taking the first type of edge V0V1 as an example, point V0 needs to move to V0'' and point V1 needs to move to V1'', that is, both point V0 and point V1 need to move L to the right and L downward.

[0189] Since the first dimension x has the right side as the positive direction and the second dimension y has the lower side as the positive direction, the coordinates of V0' may be (x0+L, y0+L) and the coordinates of V1' may be (x1+L, y1+L).

[0190] At this time, the equation of V0"V1" is:

[0191] A i x+B i y i (x0+L)-B i (y0+L)=A i x+B i y+(-A i x0-B i y0)-A i LBi L=A i x+B i y+C i =0;

[0192] The equation of edge V0V1 is:

[0193] (y0-y1)x+(x1-x0)y+(x0×y1-x1×y0)=(y0-y1)x+(x1-x0)y-x0(y0-y1)-y0(x1-x0)=A i x+B i y i x0-B i y0=A i x+B i y+C i =0;

[0194] Comparing the coefficients of the equation of V0'V1' with the coefficients of the equation of edge V0V1, we can see that only the coefficient C i If adjustment is needed, just make the coefficient C i Increase (-A i LB i L), we can get the equation of the edge V0"V1".

[0195] Similarly, in the underestimation mode, when the i-th edge is of the second type, A i , B i Remain unchanged, C i Increase (-A i LB i L) is sufficient; when the i-th edge is of the third or fourth type, A i , B i Remain unchanged, C i Increase (-A i L+B i L) is sufficient; when the i-th edge is of the fifth or sixth type, A i , B i Remain unchanged, C i Increase (A i LB i L) is sufficient; when the i-th edge is of the seventh or eighth type, A i , B i Remain unchanged, C i Increase (A i L+B i The specific calculation method of the equation of the edge corresponding to each type before and after the retraction will not be described in detail here.

[0196] In the underestimation mode, after the coefficient adjustment method of the equation of each type of edge is determined, a coefficient adjustment method lookup table as shown in Table 3 can be generated in advance.

[0197] Table 3

[0198]

[0199] In this case, when the preset rasterization mode is the underestimation mode, the coefficient adjustment method of the edge equation can be determined by directly looking up Table 3 according to the type of the edge.

[0200] Those skilled in the art should understand that other methods may be used to store the correspondence between the edge type and the coefficient adjustment method of the edge equation, and the embodiments of the present disclosure do not limit how to store the correspondence between the edge type and the coefficient adjustment method of the edge equation.

[0201] The following describes an exemplary implementation of determining whether each pixel satisfies the pixel coverage determination condition of the first type of primitive in the overestimation mode and the underestimation mode.

[0202] In a possible implementation, in the overestimation mode, the first condition is that at least one corner point of the pixel is within the area covered by the first type of primitive, and the second condition is that at least one corner point of the pixel is within the bounding box of the first type of primitive for conservative rasterization;

[0203] According to the coordinates of the corner points of each pixel and the new equation of each edge, it is determined whether each pixel meets the pixel coverage judgment conditions of the first type of primitives, including:

[0204] According to the rasterization mode and the type of the i-th edge, find the target corner point for pixel coverage judgment on the i-th edge. In the overestimation mode, the target corner point is the corner point farthest from the i-th edge when all corner points of any pixel are in the area covered by the first type of primitives;

[0205] Based on the coordinates of the corner points of each pixel and the new equation of each edge, the position of the target corner point of the pixel for pixel coverage judgment for each edge is determined relative to the edge. When the determined position is the same as the position of the area covered by the first type of primitive relative to the edge, at least one corner point of the pixel is within the area covered by the first type of primitive.

[0206] For example, in the overestimation mode, as long as any area of ​​the pixel (including the corner point) is covered by the expanded primitive and is within the expanded bounding box (that is, the bounding box for conservative rasterization of the first type of primitive), the pixel can be rendered. Therefore, the first condition for determining the coverage of the pixel by the first type of primitive can be set to: at least one corner point of the pixel is within the area covered by the first type of primitive; the coverage of the pixel by the bounding box for conservative rasterization of the first type of primitive can be set to: at least one corner point of the pixel is within the bounding box for conservative rasterization of the first type of primitive.

[0207] In this case, according to the coordinates of the corner points of each pixel and the new equation of each edge, it is determined whether each pixel meets the pixel coverage judgment condition of the first type of primitive, which can be achieved in the following way:

[0208] First, according to the rasterization mode and the type of the i-th edge, find the target corner point for pixel coverage judgment on the i-th edge. In the overestimation mode, the target corner point is the corner point farthest from the i-th edge when all corner points of any pixel are in the area covered by the first type of primitives.

[0209] Figure 8 An example of pixel coverage by the first type of primitive according to an embodiment of the present disclosure is shown.

[0210] like Figure 8 As shown, edge V3V4 is of the first type, edge V4V5 is of the seventh type, and edge V3V5 is of the third type. At this time, the area covered by the first type of primitive is located at the lower right side of edge V3V4, the upper left side of edge V4V5, and the upper right side of edge V3V5. In other words, as long as the lower right corner of the pixel is at the lower right side of edge V3V4, the upper left corner is at the upper left side of edge V4V5, and the upper right corner is at the upper right side of edge V3V5, the pixel will be covered by the primitive.

[0211] Therefore, the upper right corner point is the target corner point of the first type of edge in the overestimation mode, the upper left corner point is the target corner point of the seventh type of edge in the overestimation mode, and the upper right corner point is the target corner point of the third type of edge in the overestimation mode. It can be concluded that in the overestimation mode, the target corner point is the corner point farthest from the edge when all corner points of any pixel are in the area covered by the first type of primitive. The specific selection method of the target corner points of other types of edges in the overestimation mode will not be repeated here.

[0212] Similarly, in the overestimation mode, the lower left corner is the target corner for the fifth type of edge. It should be noted that for the second, fourth, eighth, and sixth types of edges, two corners can be used as target corners, and one of them can be selected as the target corner. For example, for the second type of edge, one of the lower left corner or the lower right corner can be used as the target corner. For the fourth type of edge, one of the upper right corner and the lower right corner can be used as the target corner. For the sixth type of edge, one of the upper left corner and the lower left corner can be used as the target corner. For the eighth type of edge, one of the upper left corner and the upper right corner can be used as the target corner.

[0213] The selection of the target corner point is only related to the edge type and the rasterization mode, so the target corner point lookup table in the overestimation mode can be generated in advance, as shown in Table 4.

[0214] Table 4

[0215]

[0216] In this case, when the preset rasterization mode is the overestimation mode, the target corner point can be determined by directly looking up Table 4 according to the type of edge.

[0217] After finding the target corner point for pixel coverage judgment for each edge, the position of the target corner point for pixel coverage judgment for each edge relative to the edge can be determined based on the coordinates of the corner point of each pixel and the new equation of each edge. When the determined position is the same as the position of the area covered by the first type of primitive relative to the edge, at least one corner point of the pixel is within the area covered by the first type of primitive. Figure 8 Take the primitive in as an example, edge V3V4 is of the first type, edge V4V5 is of the seventh type, and edge V3V5 is of the third type. At this time, the area covered by the first type of primitive is located at the lower right side of edge V3V4, the upper left side of edge V4V5, and the upper right side of edge V3V5. As long as the lower right corner of the pixel is located at the lower right side of edge V3V4 relative to the position of edge V3V4, the upper left corner of the pixel is located at the upper left side of edge V4V5 relative to the position of edge V4V5, and the upper right corner of the pixel is located at the upper right side of edge V3V5 relative to the position of edge V3V5, the pixel has at least one corner point in the area covered by the primitive, such as pixel P0 and pixel P2. Similarly, all corner points of pixel P1 are not in the area covered by the primitive.

[0218] The implementation method of determining whether at least one corner point of a pixel is within the bounding box of conservative rasterization of the first type of primitive is similar to the method of determining whether at least one corner point of a pixel is within the area covered by the first type of primitive, and will not be repeated here.

[0219] In this way, the time cost and data processing cost of determining whether each pixel meets the pixel coverage determination condition of the first type of primitive in the overestimation mode can be reduced, thereby improving the efficiency of conservative rasterization.

[0220] In a possible implementation, in the underestimation mode, the third condition is that all corner points of the pixel are within the area covered by the first type of primitive;

[0221] According to the coordinates of the corner points of each pixel and the new equation of each edge, it is determined whether each pixel meets the pixel coverage judgment conditions of the first type of primitives, including:

[0222] According to the rasterization mode and the type of the i-th edge, find the target corner point for pixel coverage judgment on the i-th edge. In the underestimation mode, the target corner point is the corner point closest to the i-th edge when all corner points of any pixel are in the area covered by the first type of primitives;

[0223] Based on the coordinates of the corner points of each pixel and the new equation of each edge, the position of the target corner point of the pixel for pixel coverage judgment on each edge is determined relative to the edge. When the determined position is the same as the position of the area covered by the first type of primitive relative to the edge, at least one corner point of the pixel is within the area covered by the first type of primitive.

[0224] For example, in the underestimation mode, the entire area of ​​the pixel is covered by the indented primitive and the pixel can be rendered. Therefore, the third condition for determining the coverage of the pixel by the first type of primitive can be set to: all corner points of the pixel are within the area covered by the first type of primitive.

[0225] In this case, according to the coordinates of the corner points of each pixel and the new equation of each edge, it is determined whether each pixel meets the pixel coverage judgment condition of the first type of primitive, which can be achieved in the following way:

[0226] First, according to the rasterization mode and the type of the i-th edge, find the target corner point for pixel coverage judgment on the i-th edge. In the underestimation mode, the target corner point is the corner point closest to the i-th edge when all corner points of any pixel are in the area covered by the first type of primitive.

[0227] by Figure 8 For example, edge V3V4 is of the first type, edge V4V5 is of the seventh type, and edge V3V5 is of the third type. At this time, the area covered by the first type of primitive is located at the lower right side of edge V3V4, the upper left side of edge V4V5, and the upper right side of edge V3V5. In other words, as long as the lower left corner of the pixel is at the lower right side of edge V3V4, the lower right corner is at the upper left side of edge V4V5, and the lower left corner is at the upper right side of edge V3V5, the pixel will be covered by the first type of primitive.

[0228] Therefore, the lower left corner is the target corner of the first type of edge in the underestimation mode, the lower right corner is the target corner of the seventh type of edge in the underestimation mode, and the lower left corner is the target corner of the third type of edge in the underestimation mode. It can be concluded that in the underestimation mode, the target corner is the corner closest to the edge when all corners of any pixel are in the area covered by the first type of primitive.

[0229] Similarly, in the underestimation mode, the upper right corner is the target corner for the fifth type of edge. It should be noted that for the second, fourth, eighth, and sixth types of edges, two corners can be used as target corners, and one of them can be selected as the target corner. For example, for the second type of edge, one of the upper right corner or the upper left corner can be used as the target corner. For the fourth type of edge, one of the lower left corner and the upper left corner can be used as the target corner. For the sixth type of edge, one of the lower right corner and the upper right corner can be used as the target corner. For the eighth type of edge, one of the lower right corner and the lower left corner can be used as the target corner.

[0230] The selection of the target corner point is only related to the edge type and the rasterization mode, so the target corner point lookup table in the underestimation mode can be generated in advance, as shown in Table 5.

[0231] Table 5

[0232]

[0233] In this case, when the preset rasterization mode is the underestimation mode, the target corner point can be determined by directly looking up Table 5 according to the type of edge.

[0234] Those skilled in the art should understand that other methods may be used to store the correspondence between edge types and target corner points, and the embodiments of the present disclosure do not limit how to store the correspondence between edge types and target corner points.

[0235] After finding the target corner point for pixel coverage judgment for each edge, the position of the target corner point for pixel coverage judgment for each edge relative to the edge can be determined based on the coordinates of the corner point of each pixel and the new equation of each edge. When the determined position is the same as the position of the area covered by the first type of primitive relative to the edge, at least one corner point of the pixel is within the area covered by the first type of primitive. The specific judgment method can be found in the example of the overestimation mode above, which will not be repeated here.

[0236] In this way, the time cost and data processing cost of determining whether each pixel meets the pixel coverage determination condition of the first type of primitive in the underestimation mode can be reduced, thereby improving the efficiency of conservative rasterization.

[0237] The following introduces the conservative rasterization method of the second and third types of primitives. Since the second type of primitives degenerates into lines and the third type of primitives degenerates into points, only the conservative rasterization of the second and third types of primitives after expansion is considered, that is, the second and third types of primitives are conservatively rasterized only in the overestimation mode.

[0238] In a possible implementation, when the preset rasterization mode is the overestimation mode, the equation and type of each edge of the second type of primitive are determined according to the coordinates of the vertices of the second type of primitive, and all vertices of the second type of primitive are on the same straight line and at least two vertices do not overlap;

[0239] According to the preset rasterization mode and the type of each edge, find the coefficient adjustment method of the equation of each edge, adjust the coefficient of the equation of each edge according to the coefficient adjustment method, and obtain a new equation of each edge;

[0240] Determine an equation of a bounding box for conservative rasterization of the second type of primitives according to the coordinates of the vertices of the second type of primitives and a degree parameter of conservative rasterization;

[0241] According to the coordinates of the corner points of each pixel, the new equation of each edge, and the equation of the bounding box of the second type of primitive for conservative rasterization, determine whether each pixel satisfies the pixel coverage determination condition of the second type of primitive;

[0242] When any pixel satisfies the pixel coverage judgment condition of the second type of primitive, the pixel is determined to be a pixel obtained by rasterizing the second type of primitive;

[0243] The pixel coverage judgment conditions of the second type of primitives include: at least one corner point of the pixel is within the area covered by the second type of primitives, and at least one corner point of the pixel is within the bounding box of the second type of primitives for conservative rasterization.

[0244] Fig. 9 An example of the expansion method of the second type of primitives according to an embodiment of the present disclosure is shown.

[0245] like Fig. 9 As shown in , the primitive may include two vertices: W0(a0, b0) and W1(a1, b1), and an edge W0W1. This primitive is a second type of primitive. Assuming that the degree parameter of conservative rasterization is L, then Fig. 9 As shown, at each vertex of the primitive, a regular quadrilateral uncertainty region with the vertex as the center and a side length of 2L is obtained.

[0246] When the preset rasterization mode is the overestimation mode, the equation and type of each edge of the second type of primitive are determined according to the coordinates of the vertices of the second type of primitive. Fig. 9In the example of , the equation and type of edge W0W1 may be determined. The exemplary determination method may be the same as the determination method of the equation and type of the edge of the first type of primitive, which will not be repeated here. The format of the equation of the edge of the second type of primitive may be the same as the format of the equation of the edge of the first type of primitive.

[0247] Those skilled in the art should understand that multiple edges of the second type of primitives actually overlap, therefore, the equation of each edge of the second type of primitives is actually the same, and the equation determined based on the coordinates of any two vertices is the equation of each edge of the second type of primitives.

[0248] Afterwards, according to the preset rasterization mode and the type of each edge, the coefficient adjustment method of the equation of each edge can be found. The coefficient adjustment method of the equation of the edge of the second type of primitive is shown in Table 6.

[0249] Table 6

[0250]

[0251] For example, since the primitive has degenerated into a line, the expansion of the primitive is reflected as the movement of the line in a direction perpendicular to the line. Fig. 9 For example, the edge W0W1 of the primitive is of the first type. After the primitive is expanded, the coefficients of the equation of edge W0W1 are adjusted to obtain two equations, where the edge W0'W1' corresponding to equation 1 is located on the upper left side of edge W0W1, and the edge W0"W1" corresponding to equation 2 is located on the lower right side of edge W0W1. Based on the equation of edge W0W1, let the coefficient C i Increase (A i L+B i L) to get equation 1, so that the coefficient C i Increase (-A i LB i L) to obtain Equation 2. In this case, the area covered by the primitive is expanded to the area between Equation 1 and Equation 2. The coefficient adjustment method of the equations of other types of edges of the second type of primitives will not be described in detail here.

[0252] Next, the equation of the bounding box for conservative rasterization of the second type of primitives can be determined based on the coordinates of the vertices of the second type of primitives and the degree parameter of conservative rasterization. Similar to the determination method of the equation of the bounding box for conservative rasterization of the first type of primitives, an original bounding box can be determined based on the coordinate lines of the vertices of the second type of primitives, so that the original bounding box is the minimum bounding box that can accommodate all the vertices of the second type of primitives. The original bounding box is then expanded to accommodate all the uncertainty areas, and the expanded bounding box can be used as the bounding box for conservative rasterization of the second type of primitives.

[0253] According to the coordinates of the corner points of each pixel, the new equation of each edge, and the equation of the bounding box for conservative rasterization of the second type of primitive, it can be determined whether each pixel meets the pixel coverage determination conditions of the second type of primitive. Among them, the pixel coverage determination conditions of the second type of primitive include: at least one corner point of the pixel is within the area covered by the second type of primitive, and at least one corner point of the pixel is within the bounding box for conservative rasterization of the second type of primitive. Its exemplary determination method can be the same as the determination method of whether each pixel meets the pixel coverage determination conditions of the first type of primitive in the overestimation mode mentioned above, and will not be repeated here.

[0254] When any pixel meets the pixel coverage judgment condition of the second type of primitive, it can be determined that the pixel is a pixel obtained by rasterization of the second type of primitive. Similarly, after determining whether each pixel meets the pixel coverage judgment condition of the second type of primitive, the conservative rasterization of the current second type of primitive ends.

[0255] In this way, the primitive rasterization method of the embodiment of the present disclosure also supports conservative rasterization of primitives that degenerate into lines, thereby improving the capability of the primitive rasterization method.

[0256] In a possible implementation, the method further includes:

[0257] When the preset rasterization mode is the overestimation mode, determining the equation of the bounding box for conservative rasterization of the third type of primitives according to the coordinates of the vertices of the third type of primitives, and all vertices of the third type of primitives coincide with each other;

[0258] According to the coordinates of the corner points of each pixel and the equation of the bounding box of the third type of primitive for conservative rasterization, determine whether each pixel meets the pixel coverage condition of the third type of primitive;

[0259] When any pixel satisfies the pixel coverage condition of the third type of primitive, the pixel is determined to be a pixel obtained by rasterizing the third type of primitive;

[0260] The pixel coverage condition of the third type of primitive includes: at least one corner point of the pixel is within a bounding box for conservative rasterization of the third type of primitive.

[0261] Fig.10 An example of the expansion method of the third type of primitives according to an embodiment of the present disclosure is shown.

[0262] like Fig.10 As shown in , the primitive may include a vertex: U0(s0, t0). This primitive is a third type of primitive. Assuming that the degree parameter of conservative rasterization is L, then Fig.10 As shown, at vertex U0, a regular quadrilateral uncertainty region with vertex U0 as the center and a side length of 2L is obtained.

[0263] Since the third type of primitives do not have edges, when the preset rasterization mode is the overestimation mode, the equation of the bounding box for conservative rasterization of the third type of primitives can be directly determined based on the coordinates of the vertices of the third type of primitives and the degree parameter of conservative rasterization. The equation of the bounding box for conservative rasterization of the third type of primitives is the equation of the edge of the uncertainty region, that is:

[0264] x = s0-L;

[0265] x=s0+L;

[0266] y = t0-L;

[0267] y=t0+L;

[0268] According to the coordinates of the corner points of each pixel and the equation of the bounding box for conservative rasterization of the third type of primitive, it can be determined whether each pixel meets the pixel coverage judgment condition of the third type of primitive. Among them, the pixel coverage condition of the third type of primitive includes: at least one corner point of the pixel is within the bounding box for conservative rasterization of the third type of primitive. Its exemplary judgment method can be the same as the judgment method of whether at least one corner point of the pixel is within the bounding box for conservative rasterization of the first type of primitive / second type of primitive in the overestimation mode in the above text, and will not be repeated here.

[0269] When any pixel meets the pixel coverage judgment condition of the third type of primitive, it can be determined that the pixel is a pixel obtained by rasterization of the third type of primitive. Similarly, after determining whether each pixel meets the pixel coverage judgment condition of the third type of primitive, the conservative rasterization of the current third type of primitive ends.

[0270] In this way, the primitive rasterization method of the embodiment of the present disclosure also supports conservative rasterization of primitives that degenerate into points, thereby improving the capability of the primitive rasterization method.

[0271] The present disclosure also provides a primitive conservative rasterization device, Fig.11 A schematic diagram showing the structure of a primitive conservation device according to an embodiment of the present disclosure.

[0272] like Fig.11 As shown, in a possible implementation, the device includes:

[0273] A first determination module 110, configured to determine the equation and type of each edge of a first-category primitive according to the coordinates of the vertices of the first-category primitive, wherein the first-category primitive includes at least three vertices and two edges with the same vertex as an endpoint intersect;

[0274] A first search module 111 is used to search for a coefficient adjustment method of the equation of each edge according to a preset rasterization mode and the type of each edge, and adjust the coefficient of the equation of each edge according to the coefficient adjustment method to obtain a new equation of each edge;

[0275] A second determination module 112, configured to determine a pixel coverage judgment condition of the first type of primitive according to a preset rasterization mode;

[0276] The third determination module 113 is used to determine whether each pixel satisfies the pixel coverage judgment condition of the first type of primitive based on the coordinates of the corner points of each pixel and the new equation of each edge. When any pixel satisfies the pixel coverage judgment condition of the first type of primitive, it is determined that the pixel is a pixel obtained by rasterizing the first type of primitive.

[0277] In a possible implementation, the rasterization mode includes an overestimation mode, and the device also includes: a fourth determination module, used to determine, in the overestimation mode, the equation of the bounding box of the first type of primitive for conservative rasterization based on the coordinates of the vertices of the first type of primitive and the degree parameter of conservative rasterization; in the overestimation mode, the pixel coverage judgment condition of the first type of primitive includes a first condition and a second condition, the first condition is used to judge the coverage of the first type of primitive on the pixel, and the second condition is used to judge the coverage of the bounding box of the first type of primitive for conservative rasterization on the pixel.

[0278] In a possible implementation, the rasterization mode includes an underestimation mode. In the underestimation mode, the pixel coverage judgment condition of the first type of primitive includes a third condition, and the third condition is used to judge the coverage of the pixel by the first type of primitive.

[0279] In a possible implementation, determining the equation and type of each edge of the first type of primitive according to the coordinates of the vertices of the first type of primitive includes: determining the equation of the i-th edge of the first type of primitive as A according to the coordinates of the vertices of the first type of primitive. i x+B i y+C i =0, where A i , B i , C i is the coefficient of the equation of the i-th side, x represents the coordinate of the first dimension, and y represents the coordinate of the second dimension; according to A i The relationship between the size of 0 and B i The size relationship with 0 determines the type of the i-th edge.

[0280] In one possible implementation, A i >0,B i>0, it is determined that the i-th edge is of the first type, and the area covered by the first type of primitives is located at the lower right side of the i-th edge; i =0, B i >0, it is determined that the i-th edge is of the second type, and the area covered by the first type of primitives is located below the i-th edge; i >0,B i <0, it is determined that the i-th edge is of the third type, and the area covered by the first type of primitives is located on the upper right side of the i-th edge; i >0,B i =0, it is determined that the i-th edge is of the fourth type, and the area covered by the first type of primitives is located on the right side of the i-th edge; i <0, B i >0, it is determined that the i-th edge is of the fifth type, and the area covered by the first type of primitive is located at the lower left side of the i-th edge; i <0, B i =0, it is determined that the i-th edge is of the sixth type, and the area covered by the first type of primitives is located on the left side of the i-th edge; i <0, B i <0, it is determined that the i-th edge is of the seventh type, and the area covered by the first type of primitives is located on the upper left side of the i-th edge; i =0, B i <0, it is determined that the i-th edge is of the eighth type, and the area covered by the first type of primitives is located on the upper side of the i-th edge.

[0281] In a possible implementation, determining the equation of the bounding box for conservative rasterization of the first type of primitives according to the coordinates of the vertices of the first type of primitives and the degree parameter of conservative rasterization includes: determining the minimum and maximum values ​​of the vertices of the first type of primitives in a first dimension, and the minimum and maximum values ​​in a second dimension according to the coordinates of the vertices of the first type of primitives; determining the equation of the bounding box for conservative rasterization according to the minimum and maximum values ​​of the vertices of the first type of primitives in the first dimension, and the minimum and maximum values ​​in the second dimension, and the degree parameter of conservative rasterization.

[0282] In a possible implementation, the rasterization mode includes an overestimation mode. In the overestimation mode, the coefficient adjustment method of the equation of the ith edge includes: when the ith edge is of the first type or the second type, A i , B i Remain unchanged, C i Increase (A i L+B i L); when the i-th edge is of the third or fourth type, A i , Bi Remain unchanged, C i Increase (A i LB i L); when the i-th edge is of the fifth or sixth type, A i , B i Remain unchanged, C i Increase (-A i L+B i L); when the i-th edge is of type 7 or type 8, A i , B i Remain unchanged, C i Increase (-A i LB i L), where L represents the degree parameter of conservative rasterization.

[0283] In a possible implementation, the rasterization mode includes an underestimation mode. In the underestimation mode, the coefficient adjustment method of the equation of the ith edge includes: when the ith edge is of the first type or the second type, A i , B i Remain unchanged, C i Increase (-A i LB i L); when the i-th edge is of the third or fourth type, A i , B i Remain unchanged, C i Increase (-A i L+B i L); when the i-th edge is of the fifth or sixth type, A i , B i Remain unchanged, C i Increase (A i LB i L); when the i-th edge is of type 7 or type 8, A i , B i Remain unchanged, C i Increase (A i L+B i L), where L represents the degree parameter of conservative rasterization.

[0284] In a possible implementation, in the overestimation mode, the first condition is that at least one corner point of the pixel is within the area covered by the first type of primitive, and the second condition is that at least one corner point of the pixel is within the bounding box of the first type of primitive for conservative rasterization; judging whether each pixel satisfies the pixel coverage judgment condition of the first type of primitive based on the coordinates of the corner point of each pixel and the new equation of each edge includes: searching for the target corner point for pixel coverage judgment for the i-th edge based on the rasterization mode and the type of the i-th edge, wherein in the overestimation mode, the target corner point is the corner point farthest from the i-th edge when all corner points of any pixel are within the area covered by the first type of primitive; determining the position of the target corner point for pixel coverage judgment for each edge relative to the edge based on the coordinates of the corner point of each pixel and the new equation of each edge, and when the determined position is the same as the position of the area covered by the first type of primitive relative to the edge, at least one corner point of the pixel is within the area covered by the first type of primitive.

[0285] In a possible implementation, in the underestimation mode, the third condition is that all corner points of the pixel are within the area covered by the first type of primitive; judging whether each pixel satisfies the pixel coverage judgment condition of the first type of primitive based on the coordinates of the corner points of each pixel and the new equation of each edge includes: searching for the target corner point for pixel coverage judgment for the i-th edge based on the rasterization mode and the type of the i-th edge, wherein the target corner point is the corner point closest to the i-th edge when all corner points of any pixel are within the area covered by the first type of primitive in the underestimation mode; determining the position of the target corner point for pixel coverage judgment for each edge relative to the edge based on the coordinates of the corner points of each pixel and the new equation of each edge, and when the determined position is the same as the position of the area covered by the first type of primitive relative to the edge, at least one corner point of the pixel is within the area covered by the first type of primitive.

[0286] In a possible implementation, the device further includes: a fifth determination module, which is used to determine the equation and type of each edge of the second type of primitive according to the coordinates of the vertices of the second type of primitive when the preset rasterization mode is the overestimation mode, wherein all vertices of the second type of primitive are on the same straight line and at least two vertices do not overlap; a third search module, which is used to search for a coefficient adjustment method of the equation of each edge according to the preset rasterization mode and the type of each edge, and adjust the coefficient of the equation of each edge according to the coefficient adjustment method to obtain a new equation of each edge; a sixth determination module, which is used to determine the second type of primitive according to the coordinates of the vertices of the second type of primitive and the degree parameter of conservative rasterization. The invention relates to an embodiment of the present invention, wherein the first judgment module is used to judge whether each pixel satisfies the pixel coverage judgment condition of the second type of primitive according to the coordinates of the corner points of each pixel, the new equation of each edge and the equation of the bounding box for conservative rasterization of the second type of primitive; the seventh determination module is used to determine that the pixel is a pixel obtained by rasterization of the second type of primitive when any pixel satisfies the pixel coverage judgment condition of the second type of primitive; wherein the pixel coverage judgment condition of the second type of primitive includes: at least one corner point of the pixel is within the area covered by the second type of primitive, and at least one corner point of the pixel is within the bounding box for conservative rasterization of the second type of primitive.

[0287] In a possible implementation, the device also includes: an eighth determination module, which is used to determine the equation of the bounding box for conservative rasterization of the third type of primitive according to the coordinates of the vertices of the third type of primitive when the preset rasterization mode is the overestimation mode, and all the vertices of the third type of primitive coincide with each other; a second judgment module, which is used to judge whether each pixel satisfies the pixel coverage condition of the third type of primitive according to the coordinates of the corner points of each pixel and the equation of the bounding box for conservative rasterization of the third type of primitive; a ninth determination module, which is used to determine that when any pixel satisfies the pixel coverage condition of the third type of primitive, the pixel is a pixel obtained by rasterization of the third type of primitive; wherein the pixel coverage condition of the third type of primitive includes: at least one corner point of the pixel is within the bounding box for conservative rasterization of the third type of primitive.

[0288] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.

[0289] The embodiment of the present disclosure also provides a computer-readable storage medium on which computer program instructions are stored, and the computer program instructions implement the above method when executed by a processor. The computer-readable storage medium can be a volatile or non-volatile computer-readable storage medium.

[0290] An embodiment of the present disclosure further proposes an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to implement the above method when executing the instructions stored in the memory.

[0291] The embodiments of the present disclosure also provide a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the above method.

[0292] Fig.12 1 is a block diagram of an electronic device 1900 according to an embodiment of the present disclosure. For example, the electronic device 1900 may be provided as a server or a terminal device. Fig.12 , the electronic device 1900 includes a processing component 1922, which further includes one or more processors, and a memory resource represented by a memory 1932 for storing instructions executable by the processing component 1922, such as an application. The application stored in the memory 1932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 1922 is configured to execute instructions to perform the above method.

[0293] The electronic device 1900 may also include a power supply component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input / output interface 1958 (I / O interface). The electronic device 1900 may operate based on an operating system stored in the memory 1932, such as Windows Server 2003. TM , Mac OS X TM , Unix TM ,Linux TM , FreeBSD TM or similar.

[0294] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as a memory 1932 including computer program instructions, which can be executed by the processing component 1922 of the electronic device 1900 to perform the above method.

[0295] The present disclosure may be a system, a method and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present disclosure.

[0296] A computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples of computer-readable storage media (a non-exhaustive list) include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination of the foregoing. As used herein, a computer-readable storage medium is not to be interpreted as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through a wire.

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

[0298] The computer program instructions for performing the operation of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions may be executed completely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be customized by utilizing the state information of the computer-readable program instructions, and the electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present disclosure.

[0299] Various aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.

[0300] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

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

[0302] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the specified logical function. In some alternative implementations, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or action, or can be implemented with a combination of special hardware and computer instructions.

[0303] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.

Claims

1. A primitive rasterization method, characterized in that: The method comprises: Determining, according to the coordinates of the vertices of the first type of primitive, the equation and type of each edge of the first type of primitive, wherein the first type of primitive includes at least three vertices, and two edges with the same vertex as an endpoint intersect; According to a preset rasterization mode and the type of each edge, finding a coefficient adjustment method for the equation of each edge, adjusting the coefficient of the equation of each edge according to the coefficient adjustment method, and obtaining a new equation for each edge; Determining a pixel coverage judgment condition of the first type of primitive according to a preset rasterization mode; Based on the coordinates of the corner points of each pixel and the new equation of each edge, it is determined whether each pixel satisfies the pixel coverage judgment condition of the first type of primitive. When any pixel satisfies the pixel coverage judgment condition of the first type of primitive, it is determined that the pixel is the pixel obtained by rasterizing the first type of primitive.

2. The method according to claim 1, characterized in that The rasterization mode includes an overestimation mode. In the overestimation mode, the method further includes: Determining an equation of a bounding box for conservatively rasterizing the first type of primitives according to coordinates of vertices of the first type of primitives and a degree parameter of conservative rasterization; In the overestimation mode, the pixel coverage judgment condition of the first type of primitive includes a first condition and a second condition, the first condition is used to judge the coverage of the pixels by the first type of primitive, and the second condition is used to judge the coverage of the pixels by the bounding box of the first type of primitive for conservative rasterization.

3. The method according to claim 1, characterized in that The rasterization mode includes an underestimation mode. In the underestimation mode, the pixel coverage judgment condition of the first type of primitive includes a third condition. The third condition is used to judge the coverage of the first type of primitive on the pixel.

4. The method according to claim 1, characterized in that: Determining the equation and type of each edge of the first-type primitive according to the coordinates of the vertices of the first-type primitive comprises: According to the coordinates of the vertices of the first type of primitive, the equation of the i-th edge of the first type of primitive is determined to be A i x+B i y+C i =0, where A i , B i , C i are the coefficients of the equation of the i-th side, x represents the coordinate of the first dimension, and y represents the coordinate of the second dimension; According to A i The relationship between the size of 0 and B i The size relationship with 0 determines the type of the i-th edge.

5. The method according to claim 4, characterized in that A i >0,B i >0, it is determined that the i-th edge is of the first type, and the area covered by the first type of primitives is located at the lower right side of the i-th edge; A i =0, B i >0, it is determined that the i-th edge is of the second type, and the area covered by the first type of primitives is located below the i-th edge; A i >0,B i <0, it is determined that the i-th edge is of the third type, and the area covered by the first type of primitives is located on the upper right side of the i-th edge; A i >0,B i =0, it is determined that the i-th edge is of the fourth type, and the area covered by the first type of primitives is located on the right side of the i-th edge; A i <0, B i >0, it is determined that the i-th edge is of the fifth type, and the area covered by the first type of primitives is located at the lower left side of the i-th edge; A i <0, B i =0, it is determined that the i-th edge is of the sixth type, and the area covered by the first type of primitives is located on the left side of the i-th edge; A i <0, B i <0, it is determined that the i-th edge is of the seventh type, and the area covered by the first type of primitives is located on the upper left side of the i-th edge; A i =0, B i <0, it is determined that the i-th edge is of the eighth type, and the area covered by the first type of primitives is located on the upper side of the i-th edge.

6. The method according to claim 2, characterized in that The step of determining an equation of a bounding box for conservatively rasterizing the first type of primitives according to the coordinates of the vertices of the first type of primitives and the degree parameter of conservative rasterization comprises: Determine, according to the coordinates of the vertices of the first type of primitives, the minimum value and the maximum value of the vertices of the first type of primitives in the first dimension, and the minimum value and the maximum value in the second dimension; The equation of the conservative rasterization bounding box is determined according to the minimum value and the maximum value of the first dimension and the minimum value and the maximum value of the second dimension of the vertices of the first type of primitives, and a conservative rasterization degree parameter.

7. The method according to claim 4, characterized in that The rasterization mode includes an overestimation mode. In the overestimation mode, the coefficient adjustment method of the equation of the i-th edge includes: When the i-th edge is of type 1 or type 2, A i , B i Remain unchanged, C i Increase (A i L+B i L); When the i-th edge is of the third or fourth type, A i , B i Remain unchanged, C i Increase (A i LB i L); When the i-th edge is of type 5 or type 6, A i , B i Remain unchanged, C i Increase (-A i L+B i L); When the i-th edge is of type 7 or type 8, A i , B i Remain unchanged, C i Increase (-A i LB i L); Where L represents the degree parameter of conservative rasterization.

8. The method according to claim 4, characterized in that The rasterization mode includes an underestimation mode. In the underestimation mode, the coefficient adjustment method of the equation of the i-th edge includes: When the i-th edge is of type 1 or type 2, A i , B i Remain unchanged, C i Increase (-A i LB i L); When the i-th edge is of the third or fourth type, A i , B i Remain unchanged, C i Increase (-A i L+B i L); When the i-th edge is of type 5 or type 6, A i , B i Remain unchanged, C i Increase (A i LB i L); When the i-th edge is of type 7 or type 8, A i , B i Remain unchanged, C i Increase (A i L+B i L); Where L represents the degree parameter of conservative rasterization.

9. The method according to claim 2, characterized in that: In the overestimation mode, the first condition is that at least one corner point of a pixel is within the area covered by the first type of primitive, and the second condition is that at least one corner point of a pixel is within a bounding box of the first type of primitive for conservative rasterization; The step of judging whether each pixel satisfies the pixel coverage judgment condition of the first type of primitive according to the coordinates of the corner point of each pixel and the new equation of each edge includes: According to the rasterization mode and the type of the i-th edge, searching for a target corner point for pixel coverage judgment on the i-th edge, wherein in the overestimation mode, the target corner point is a corner point that is farthest from the i-th edge when all corner points of any pixel are in an area covered by the first type of primitive; Based on the coordinates of the corner points of each pixel and the new equation of each edge, the position of the target corner point of the pixel for pixel coverage judgment for each edge is determined relative to the edge. When the determined position is the same as the position of the area covered by the first type of primitive relative to the edge, at least one corner point of the pixel is within the area covered by the first type of primitive.

10. The method according to claim 3, characterized in that In the underestimation mode, the third condition is that all corner points of the pixel are within the area covered by the first type of primitive; The step of judging whether each pixel satisfies the pixel coverage judgment condition of the first type of primitive according to the coordinates of the corner point of each pixel and the new equation of each edge includes: According to the rasterization mode and the type of the i-th edge, searching for a target corner point for pixel coverage judgment on the i-th edge, wherein in the underestimation mode, the target corner point is a corner point that is closest to the i-th edge when all corner points of any pixel are in an area covered by the first type of primitives; Based on the coordinates of the corner points of each pixel and the new equation of each edge, the position of the target corner point of the pixel for pixel coverage judgment for each edge is determined relative to the edge. When the determined position is the same as the position of the area covered by the first type of primitive relative to the edge, at least one corner point of the pixel is within the area covered by the first type of primitive.

11. The method according to claim 1, characterized in that: The method further comprises: When the preset rasterization mode is the overestimation mode, determining the equation and type of each edge of the second type of primitive according to the coordinates of the vertices of the second type of primitive, wherein all vertices of the second type of primitive are on the same straight line and at least two vertices do not overlap; According to a preset rasterization mode and the type of each edge, finding a coefficient adjustment method for the equation of each edge, adjusting the coefficient of the equation of each edge according to the coefficient adjustment method, and obtaining a new equation for each edge; Determining an equation of a bounding box for conservatively rasterizing the second type of primitives according to the coordinates of the vertices of the second type of primitives and a degree parameter of conservative rasterization; Determine whether each pixel satisfies the pixel coverage determination condition of the second type of primitive according to the coordinates of the corner point of each pixel, the new equation of each edge, and the equation of the bounding box of the second type of primitive subjected to conservative rasterization; When any pixel satisfies the pixel coverage judgment condition of the second type of primitive, the pixel is determined to be a pixel obtained by rasterizing the second type of primitive; Among them, the pixel coverage judgment conditions of the second type of primitives include: at least one corner point of the pixel is within the area covered by the second type of primitives, and at least one corner point of the pixel is within the bounding box of the second type of primitives for conservative rasterization.

12. The method according to claim 1, characterized in that The method further comprises: When the preset rasterization mode is an overestimation mode, determining an equation of a bounding box for conservative rasterization of the third type of primitives according to coordinates of vertices of the third type of primitives, and all vertices of the third type of primitives overlap; Determine whether each pixel satisfies the pixel coverage condition of the third type of primitive according to the coordinates of the corner points of each pixel and the equation of the bounding box of the third type of primitive for conservative rasterization; When any pixel satisfies the pixel coverage condition of the third type of primitive, the pixel is determined to be a pixel obtained by rasterizing the third type of primitive; The pixel coverage condition of the third type of primitive includes: at least one corner point of the pixel is within a bounding box where the third type of primitive is conservatively rasterized.

13. A primitive rasterization device, characterized in that: The device comprises: A first determination module, configured to determine the equation and type of each edge of a first type of primitive according to the coordinates of the vertices of the first type of primitive, wherein the first type of primitive includes at least three vertices and two edges with the same vertex as an endpoint intersect; A first search module is used to search for a coefficient adjustment method of the equation of each edge according to a preset rasterization mode and a type of each edge, and adjust the coefficient of the equation of each edge according to the coefficient adjustment method to obtain a new equation of each edge; A second determination module, used to determine a pixel coverage judgment condition of the first type of primitive according to a preset rasterization mode; The third determination module is used to determine whether each pixel satisfies the pixel coverage judgment condition of the first type of primitive based on the coordinates of the corner points of each pixel and the new equation of each edge. When any pixel satisfies the pixel coverage judgment condition of the first type of primitive, it is determined that the pixel is the pixel obtained by rasterizing the first type of primitive.

14. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; Wherein, the processor is configured to implement the method described in any one of claims 1 to 12 when executing the instructions stored in the memory.

15. A non-volatile computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 12 is implemented.

Citation Information

Patent Citations

  • Conservative rasterization of primitives using an error term

    CN104050626A

  • Non-blocking parallel triangle rasterization unit structure

    CN108009978A

  • Conservative Rasterization Using Gradients

    CN110728734A

  • Block-based rasterization method and device, and image rendering method and device

    CN115841433A

  • Graph rendering method and device

    CN117501312A

Cited By

  • Method and device for determining processing starting point of target primitive and chip

    CN121639775A