Primitive rasterization method, device, electronic device and storage medium

By combining preset rasterization mode and edge type, we directly find the edge equation coefficient adjustment method and adjust the bounding box, which solves the problem of hardware computing resources and GPU architecture changes in the existing technology, realizes efficient conservative rasterization and supports degenerate primitive processing.

CN119919276BActive Publication Date: 2025-07-04MOORE THREADS TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

While ensuring rasterization accuracy, existing conservative rasterization methods usually require additional hardware computing resources or changing the GPU architecture, resulting in excessive cost and inability to effectively deal with primitives degenerating to lines or points.

Method used

By combining the preset rasterization mode and the type of edge, we can directly find the equation coefficient adjustment method of edges, reduce the calculation of new equations of edges, combine the conservative rasterization degree parameters, adjust the bounding box to achieve conservative rasterization, and support the primitive processing of degradation into lines and points.

Benefits of technology

Without increasing hardware computing resources and changing the GPU architecture, efficient conservative rasterization is achieved, reducing computing costs, and supporting the processing of degraded primitives, improving rasterization accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119919276B_ABST
    Figure CN119919276B_ABST
Patent Text Reader

Abstract

The present disclosure relates to the field of computer vision, and provides a primitive rasterization method, apparatus, electronic device, and storage medium. The method includes: determining equations and types of each edge of a primitive according to coordinates of vertices of the primitive; finding a coefficient adjustment method for the equation of each edge according to a preset rasterization mode and the type of each edge, and adjusting coefficients of the equation of each edge according to the coefficient adjustment method; determining a pixel coverage judgment condition of the primitive according to the preset rasterization mode; judging whether each pixel satisfies the pixel coverage judgment condition of the primitive according to coordinates of corner points of each pixel and the new equation of each edge, and when any one pixel satisfies the pixel coverage judgment condition of the primitive, determining that the pixel is a pixel obtained by rasterizing the primitive. This method not only ensures the correctness of implementing the conservative rasterization function, but also makes the cost of conservative rasterization smaller, thus completing conservative rasterization simply and efficiently.
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 primitive according to coordinates of vertices of the first type of primitive and a degree parameter of conservative rasterization; in the overestimation mode, the pixel coverage determination condition for the first type of primitive includes a first condition and a second condition, where the first condition is used to determine the coverage of the first type of primitive on a pixel, and the second condition is used to determine the coverage of the bounding box for conservative rasterization of the first type of primitive on a pixel.

[0007] In a possible implementation, the rasterization mode includes an underestimation mode. In the underestimation mode, the pixel coverage determination condition for the first type of primitive includes a third condition, where the third condition is used to determine the coverage of the first type of primitive on a pixel.

[0008] In a possible implementation, determining an equation and a type of each edge of the first type of primitive according to coordinates of vertices of the first type of primitive includes: determining that an equation of the i-th edge of the first type of primitive is A i x + B i y + C i = 0, where A i 、B i 、C i are coefficients of the equation of the i-th edge, x represents a coordinate in the first dimension, and y represents a coordinate in the second dimension; determining the type of the i-th edge according to the magnitude relationship between A i and 0, and the magnitude relationship between B i and 0.

[0009] In a possible implementation, when A i > 0 and B i > 0, it is determined that the i-th edge is of a first type, and the area covered by the first type of primitive is located at the lower right side of the i-th edge; when A i = 0 and B i > 0, it is determined that the i-th edge is of a second type, and the area covered by the first type of primitive is located below the i-th edge; when A i > 0 and B i < 0, it is determined that the i-th edge is of a third type, and the area covered by the first type of primitive is located at the upper right side of the i-th edge; when A i > 0 and B i = 0, it is determined that the i-th edge is of a fourth type, and the area covered by the first type of primitive is located on the right side of the i-th edge; when A i < 0 and B iWhen it is >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; A i <0, B i When it is =0, it is determined that the i-th edge is of the sixth type, and the area covered by the first type of primitive is located on the left side of the i-th edge; A i <0, B i When it is <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 at the upper left side of the i-th edge; A i =0, B i When it is <0, it is determined that the i-th edge is of the eighth type, and the area covered by the first type of primitive is located on the upper side of the i-th edge.

[0010] In a possible implementation, the determining the equation of the bounding box for conservative rasterization of the first type of primitive according to the coordinates of the vertices of the first type of primitive and the degree parameter of conservative rasterization includes: determining the minimum value, maximum value of the vertices of the first type of primitive in the first dimension, and the minimum value, maximum value in the second dimension according to the coordinates of the vertices of the first type of primitive; determining the equation of the bounding box for conservative rasterization according to the minimum value, maximum value of the vertices of the first type of primitive in the first dimension, the minimum value, maximum value 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 i-th edge includes: when the i-th edge is of the first type or the second type, A i 、B i remain unchanged, C i is increased by (A i L + B i L); when the i-th edge is of the third type or the fourth type, A i 、B i remain unchanged, C i is increased by (A i L - B i L); when the i-th edge is of the fifth type or the sixth type, A i 、B i remain unchanged, C i is increased by (-A i L + B i L); when the i-th edge is of the seventh type or the eighth type, A i 、B i remain unchanged, C i is increased by (-A i L - B 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 i-th edge includes: when the i-th edge is of the first type or the second type, A i , B i remains unchanged, and C i is increased by (-A i L - B i L); when the i-th edge is of the third type or the fourth type, A i , B i remains unchanged, and C i is increased by (-A i L + B i L); when the i-th edge is of the fifth type or the sixth type, A i , B i remains unchanged, and C i is increased by (A i L - B i L); when the i-th edge is of the seventh type or the eighth type, A i , B i remains unchanged, and C i is increased by (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 conservative rasterization of the first type of primitive; determining whether each pixel satisfies the pixel coverage determination 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 includes: according to the rasterization mode and the type of the i-th edge, finding the target corner point for pixel coverage determination for the i-th edge. In the overestimation mode, when all corner points of any pixel are within the area covered by the first type of primitive, the target corner point is the corner point that is farthest from the i-th edge; according to the coordinates of the corner points of each pixel and the new equation of each edge, determining the position of the target corner point for pixel coverage determination of this pixel relative to this edge. When the determined position is the same as the position of the area covered by the first type of primitive relative to this edge, at least one corner point of this 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; the step of determining whether each pixel meets the pixel coverage determination 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 includes: according to the rasterization mode and the type of the i-th edge, finding the target corner point for pixel coverage determination for 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 within the area covered by the first type of primitive; according to the coordinates of the corner points of each pixel and the new equation of each edge, determining the position of the target corner point for pixel coverage determination of each pixel relative to each edge. When the determined position is the same as the position of the area covered by the first type of primitive relative to each 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, where all vertices of the second type of primitive are on the same straight line and at least two vertices do not coincide; according to the preset rasterization mode and the type of each edge, finding the coefficient adjustment method for the equation of each edge, and adjusting the coefficients of the equation of each edge according to the coefficient adjustment method to obtain the new equation of each edge; according to the coordinates of the vertices of the second type of primitive and the degree parameter of conservative rasterization, determining the equation of the bounding box for conservative rasterization 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, determining whether each pixel meets the pixel coverage determination condition of the second type of primitive; when any pixel meets the pixel coverage determination condition of the second type of primitive, determining that the pixel is the pixel rasterized from the second type of primitive; where the pixel coverage determination 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.

[0016] In a possible implementation, the method further includes: when the preset rasterization mode is the overestimation mode, determining, according to the coordinates of the vertices of the third type of primitive, the equation of the bounding box for conservative rasterization of the third type of primitive, where all vertices of the third type of primitive coincide; judging whether each pixel meets 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; when any one pixel meets the pixel coverage condition of the third type of primitive, determining that the pixel is the pixel obtained by rasterizing the third type of primitive; where 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.

[0017] According to another aspect of the present disclosure, there is provided a primitive conservative rasterization device, the device includes: a first determination module, configured to determine 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, where the first type of primitive includes at least three vertices, and two edges with the same vertex as an end point intersect; a first search module, configured to search for the coefficient adjustment method of the equation of each edge according to the preset rasterization mode and the type of each edge, and adjust the coefficients of the equation of each edge according to the coefficient adjustment method to obtain the new equation of each edge; a second determination module, configured to determine the pixel coverage judgment condition of the first type of primitive according to the preset rasterization mode; a third determination module, configured to judge whether each pixel meets 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 one pixel meets the pixel coverage judgment condition of the first type of primitive, determining that the pixel is the pixel obtained by rasterizing the first type of primitive.

[0018] In a possible implementation, the rasterization mode includes the overestimation mode, and the device further includes: a fourth determination module, configured to determine the equation of the bounding box for conservative rasterization of the first type of primitive according to the coordinates of the vertices of the first type of primitive and the degree parameter of conservative rasterization in the overestimation mode; 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 to the pixel, and the second condition is used to judge the coverage of the bounding box for conservative rasterization of the first type of primitive to the pixel.

[0019] In a possible implementation, the rasterization mode includes the underestimation mode, and 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 first type of primitive to the pixel.

[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 that the equation of the i-th edge of the first type of primitive is 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 edge, x represents the coordinate in the first dimension, and y represents the coordinate in the second dimension; determining the type of the i-th edge according to the magnitude relationship between A i and 0, and the magnitude relationship between B i and 0.

[0021] In a possible implementation, when A i > 0 and 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 primitive is located on the lower right side of the i-th edge; when A i = 0 and 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 primitive is located on the lower side of the i-th edge; when A i > 0 and 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 primitive is located on the upper right side of the i-th edge; when A i > 0 and 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 primitive is located on the right side of the i-th edge; when A i < 0 and 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 on the lower left side of the i-th edge; when A i < 0 and 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 primitive is located on the left side of the i-th edge; when A i < 0 and 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; when A i = 0 and 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 primitive 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 primitive according to the coordinates of the vertices of the first type of primitive and the degree parameter of conservative rasterization includes: determining the minimum and maximum values of the vertices of the first type of primitive in the first dimension and the minimum and maximum values in the second dimension according to the coordinates of the vertices of the first type of primitive; 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 primitive in the first dimension, 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 for the equation of the i-th edge includes: when the i-th edge is of the first type or the second type, A i , B i remains unchanged, and C i is increased by (A i L + B i L); when the i-th edge is of the third type or the fourth type, A i , B i remains unchanged, and C i is increased by (A i L - B i L); when the i-th edge is of the fifth type or the sixth type, A i , B i remains unchanged, and C i is increased by (-A i L + B i L); when the i-th edge is of the seventh type or the eighth type, A i , B i remains unchanged, and C i is increased by (-A i L - B 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 for the equation of the i-th edge includes: when the i-th edge is of the first type or the second type, A i , B i remains unchanged, and C i is increased by (-A i L - B i L); when the i-th edge is of the third type or the fourth type, A i , B i remains unchanged, and C i is increased by (-A i L + B i L); when the i-th edge is of the fifth type or the sixth type, Ai , B i remains unchanged, C i increases (A i L - B i L); when the i-th edge is of the seventh type or the eighth type, A i , B i remains unchanged, C i increases (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 conservative rasterization of the first type of primitive; the determining whether each pixel meets the pixel coverage determination 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 includes: according to the rasterization mode and the type of the i-th edge, finding the target corner point for pixel coverage determination for the i-th edge. In the overestimation mode, the target corner point is the corner point that is farthest from the i-th edge when all corner points of any pixel are within the area covered by the first type of primitive; according to the coordinates of the corner points of each pixel and the new equation of each edge, determining the position of the target corner point for pixel coverage determination of each pixel with respect to each edge. When the determined position is the same as the position of the area covered by the first type of primitive with respect to each 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; the determining whether each pixel meets the pixel coverage determination 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 includes: according to the rasterization mode and the type of the i-th edge, finding the target corner point for pixel coverage determination for the i-th edge. In the underestimation mode, the target corner point is the corner point that is closest to the i-th edge when all corner points of any pixel are within the area covered by the first type of primitive; according to the coordinates of the corner points of each pixel and the new equation of each edge, determining the position of the target corner point for pixel coverage determination of each pixel with respect to each edge. When the determined position is the same as the position of the area covered by the first type of primitive with respect to each 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 apparatus further includes: a fifth determination module, configured to determine equations and types of each side of the second type of primitive according to coordinates of vertices of the second type of primitive when a preset rasterization mode is an overestimation mode, all vertices of the second type of primitive being on the same straight line and at least two vertices not coinciding; a third lookup module, configured to look up a coefficient adjustment method for an equation of each side according to the preset rasterization mode and the type of each side, and adjust coefficients of the equation of each side according to the coefficient adjustment method to obtain a new equation of each side; a sixth determination module, configured to determine an equation of a bounding box for conservative rasterization of the second type of primitive according to coordinates of vertices of the second type of primitive and a degree parameter of conservative rasterization; a first determination module, configured to determine whether each pixel satisfies a pixel coverage determination condition of the second type of primitive according to coordinates of corner points of each pixel, the new equation of each side, and the equation of the bounding box for conservative rasterization of the second type of primitive; a seventh determination module, configured to determine, when any one pixel satisfies the pixel coverage determination condition of the second type of primitive, that the pixel is a pixel obtained by rasterizing the second type of primitive; wherein the pixel coverage determination condition of the second type of primitive includes: at least one corner point of the pixel is within an 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 apparatus further includes: an eighth determination module, configured to determine an equation of a bounding box for conservative rasterization of the third type of primitive according to coordinates of vertices of the third type of primitive when a preset rasterization mode is an overestimation mode, all vertices of the third type of primitive coinciding; a second determination module, configured to determine whether each pixel satisfies a pixel coverage condition of the third type of primitive according to coordinates of 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, configured to determine, when any one pixel satisfies the pixel coverage condition of the third type of primitive, that the pixel is a pixel obtained by rasterizing 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, there is provided an electronic device, including: a processor; 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.

[0030] According to another aspect of the present disclosure, there is provided a non-volatile computer-readable storage medium, 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, there is provided a computer program product including 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] For the primitive rasterization method according to an embodiment of the present disclosure, based on the coordinates of vertices of a first type of primitive, equations and types of each edge of the first type of primitive are determined. The first type of primitive includes at least three vertices, and two edges sharing the same vertex intersect. According to a preset rasterization mode and the type of each edge, a coefficient adjustment method for the equation of each edge is found. The coefficients of the equation of each edge are adjusted according to the coefficient adjustment method to obtain a new equation for each edge. A pixel coverage determination condition for the first type of primitive is determined according to the preset rasterization mode. According to the coordinates of corner points of each pixel and the new equation of each edge, it is determined whether each pixel satisfies the pixel coverage determination condition for the first type of primitive. When any one pixel satisfies the pixel coverage determination condition for the first type of primitive, it is determined that the pixel is a pixel obtained by rasterizing the first type of primitive. By presetting the coefficient adjustment method for the equation of an edge according to the type of the 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 found coefficient adjustment method, without calculating the new equation of the edge additionally, without adding extra hardware computing resources, without changing the GPU architecture, and reducing the cost of conservative rasterization. And the coverage of pixels is determined according to the new equation of the edge. Therefore, when determining the coverage of pixels, the area covered by the primitive is already adjusted, ensuring the correctness of rasterization. In this case, the method of the present disclosure not only ensures the correctness of implementing the conservative rasterization function, but also does not require adding extra hardware computing resources, does not change the GPU architecture, makes the cost of conservative rasterization smaller, and thus completes conservative rasterization simply and efficiently.

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

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

[0035] Figure 1 A schematic diagram showing the effects of normal 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 process of a primitive rasterization method according to an embodiment of the present disclosure.

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

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

[0040] Figure 6 A schematic diagram showing the contraction of a primitive according to an embodiment of the present disclosure.

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

[0042] Figure 8 Examples of the coverage of pixels by the first type of primitive according to an embodiment of the present disclosure are shown.

[0043] Figure 9 Examples of the expansion method of the second type of primitive according to an embodiment of the present disclosure are shown.

[0044] Figure 10 Examples of the expansion method of the third type of primitive according to an embodiment of the present disclosure are shown.

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

[0046] Figure 12 A block diagram showing an electronic device 1900 according to an embodiment of the present disclosure. Detailed implementation manners

[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 drawings denote elements having the same or similar functions. Although various aspects of the embodiments are shown in the drawings, the drawings are not necessarily drawn to scale unless otherwise specified.

[0048] The term "exemplary" used herein means "serving as an example, embodiment, or illustration". Any embodiment described herein as "exemplary" is not necessarily to be construed as superior to or better than other embodiments.

[0049] In addition, for a better description of the present disclosure, numerous specific details are given in the following detailed implementation manners. Those skilled in the art should understand that the present disclosure can be implemented without some specific details. In some instances, methods, means, elements, and circuits well known to those skilled in the art are not described in detail so as to highlight the gist of the present disclosure.

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

[0051] The principle of the ordinary 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 or mostly covered by the primitive, the pixel is considered to need to be rendered. If a small part of the center point of the pixel is covered or not covered by the primitive, the pixel is considered not to need to be rendered. The information of the pixels that need to be rendered can be sent to the pixel shader. Under ordinary rasterization processing, not all the pixels covered by the original triangle primitive will be rendered, so the precision loss is large.

[0052] To solve this problem, the prior art has proposed a Conservative Rasterization method, which can compensate for the pixel distortion caused by the precision loss of converting floating-point numbers to fixed-point numbers.

[0053] The principle of the conservative rasterization method proposed by the first prior art is to determine whether any area (including the corner points of the pixel) of each pixel is covered by the primitive. If any area of the pixel is covered by the primitive, the pixel is considered to need to be rendered. If all areas of the pixel are not covered by the primitive, the pixel is considered not to need to be rendered. The rendered pixels can be sent to the pixel shader. In this case, all the 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 precision is still poor and it cannot be used in scenarios with high requirements for conservative rasterization precision.

[0054] The principle of the conservative rasterization method proposed by the second prior art is that at each vertex of the original triangle primitive, an uncertainty region in the shape of a square is set with the vertex as the center. The perpendicular distance from the vertex to each side of the uncertainty region is the same, and the value of this perpendicular distance is also the size of the uncertainty region, which is called the degree parameter of conservative rasterization in the following text and is used to adjust the range of the primitive coverage area. Its value can be set according to the requirements of the application scenario. And two rasterization modes are set, namely the over estimate mode and the under estimate mode.

[0055] Next, in each rasterization mode, according to the corner coordinates of the uncertainty region, the equations of the sides of the triangle primitive are re-determined, and the region covered by the triangle primitive is adjusted accordingly. That is to say, the second prior art needs to determine two sets of side equations. And it is also necessary to determine the equation of the minimum bounding box that accommodates the uncertainty region according to the corner coordinates of the uncertainty region.

[0056] In the overestimation mode, it is necessary to determine whether any region of the pixel is covered by the triangle primitive and within the bounding box. If any region of the pixel is covered by the triangle primitive and within the bounding box, the pixel is considered to need to be rendered. If all regions of the pixel are not covered by the triangle primitive or not within the bounding box, the pixel is considered not to need to be rendered. The rendered pixels can be sent to the pixel shader.

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

[0058] Although the solution of the second prior art has a relatively high conservative rasterization accuracy, it is too complex. The reason is that two sets of side equations need to be calculated, and the two sets of side 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 A schematic diagram showing the effects of ordinary rasterization and the conservative rasterization of the first prior art and the second prior art.

[0060] As Figure 1 shown, the pixels in the shaded part are the pixels rendered during rasterization. In ordinary rasterization, not all the pixels covered by the original triangle primitive will be rendered. In the conservative rasterization of the first prior art, any pixel covered by the original triangle primitive will be rendered. In the conservative rasterization of the second prior art, taking the overestimation mode as an example, the closed region formed by the dotted line and the uncertainty region is the common region of the expanded triangle primitive and the bounding box, and the pixels covered by this common region 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 costly to implement. How to reduce the hardware impact on the rendering pipeline while ensuring the correctness of the implementation of the conservative rasterization function has become an urgent technical problem in this field. In addition, the existing conservative rasterization methods do not support conservative rasterization of primitives degenerated into lines or points.

[0062] In view of this, the present disclosure provides a primitive rasterization method, apparatus, electronic device, and storage medium. This method not only ensures the correctness of the implementation of conservative rasterization functions, but also does not require additional hardware computing resources, does not change the GPU architecture, making the cost of conservative rasterization smaller, and thus completing conservative rasterization simply and efficiently.

[0063] Furthermore, the primitive rasterization method of the present disclosure can also perform conservative rasterization on primitives that degenerate into lines and points, improving the capabilities 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] As Figure 2 shown, the primitive rasterization method of the embodiments of the present disclosure can be used in scenarios 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] Information used in conservative rasterization can be preset, such as the coefficient adjustment method of the edge equation corresponding to each combination of rasterization mode and edge type, target corner points, etc. Examples can be seen 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 parameter of conservative rasterization.

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

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

[0070] As Figure 3 shown, in one 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, where the first type of primitive includes at least three vertices, and two edges with the same vertex as an endpoint intersect;

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

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

[0074] Step S34: According to the coordinates of the corner points of each pixel and the new equation of each edge, determine whether each pixel meets the pixel coverage judgment condition for the first type of primitive. When any one pixel meets the pixel coverage judgment condition for the first type of primitive, determine that this pixel is the pixel obtained by rasterizing the first type of primitive.

[0075] For example, the present disclosure classifies primitives into three categories according to the degree of degeneration of the primitives. Figure 4 Show examples of the first type of primitive, the second type of primitive, and the third type of primitive according to embodiments of the present disclosure.

[0076] As Figure 4 shown, the first type of primitive can be a primitive whose covered area shape is a closed figure (there is no limit on whether it is degenerate), including at least three vertices, and two edges with the same vertex as an endpoint intersect.

[0077] The second type of primitive can be a primitive that degenerates into a line. All vertices of the second type of primitive are on the same straight line and at least two vertices do not coincide.

[0078] The third type of primitive can be a primitive that degenerates into a point. All vertices of the third type of primitive coincide.

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

[0080] Next, taking the first type of primitive (i.e., a triangular primitive) including three vertices as an example, an exemplary conservative rasterization method for the first type of primitive will be introduced.

[0081] First, in step S31, according to the vertex coordinates of the first type of primitive, the equation and type of each edge of the first type of primitive can be determined first. The equation of the edge can be obtained by substituting the coordinates of the endpoints of the edge into the two-point form equation of a straight line. The specific calculation method can be implemented based on existing technologies and will not be elaborated here. The equation of the i-th edge finally obtained can be represented by 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 edge, x represents the coordinate in the first dimension, and y represents the coordinate in the second dimension.

[0082] In the embodiments of the present disclosure, the edges of the graphic elements have multiple types. During conservative rasterization, when the types of the edges are different, the adjustment methods of the coefficients of the edge equations may be different. For examples of the types of the edges and the differences between different types of edges, refer to the relevant descriptions in Table 1 below. The embodiments of the present disclosure do not limit the classification method of the edges.

[0083] When the rasterization mode and the type of the edge are known, during the conservative rasterization process, the adjustment method of the coefficients of the edge equation is fixed. Therefore, the adjustment method of the coefficients of the edge equation for each combination of the rasterization mode and the type of the edge can be preset. When performing step S32, directly find out the adjustment method of the coefficients of the equation of each edge. The coefficients of the equation of each edge can be adjusted according to the found adjustment method to obtain a new equation for each edge. For examples of the adjustment method of the coefficients of the edge equation for each combination of the rasterization mode and the type of the edge, refer to the relevant descriptions in Tables 2 and 3.

[0084] In the prior art, since the equation of the edge is recalculated according to the preset rasterization mode and the equation of each edge is calculated twice, the calculation cost is greatly increased. However, in the embodiments of the present disclosure, by presetting the adjustment method of the coefficients of the edge equation for each combination of the rasterization mode and the type of the edge, when needed, the new equation of the edge can be obtained by finding the adjustment method according to the rasterization mode. Compared with the prior art, the equation calculation process of each edge is reduced by one time, and the calculation cost is greatly reduced.

[0085] After the coefficients of the edge equation are adjusted, the coverage of the pixels can be judged. For different rasterization modes, the pixel coverage judgment conditions of the first type of graphic elements are different. The pixel coverage judgment conditions of the first type of graphic elements for each rasterization mode can be preset. When performing step S33, directly determine the pixel coverage judgment conditions of the first type of graphic elements corresponding to the current rasterization mode according to the rasterization mode. Examples of the pixel coverage judgment conditions and examples of the corresponding relationship between the pixel coverage judgment conditions, the graphic elements, and the rasterization mode are given below.

[0086] Then, step S34 can be executed. According to the coordinates of the corner points of each pixel and the new equation of each edge, judge whether each pixel meets the pixel coverage judgment conditions found in step S33. When any one pixel meets the pixel coverage judgment conditions, determine that the pixel is a pixel rasterized from the first type of graphic elements. By analogy, after judging whether each pixel meets the pixel coverage judgment conditions found in step S33, the conservative rasterization of the current first type of graphic elements ends.

[0087] According to the primitive rasterization method of the present disclosure, based on 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 an 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. According to the coefficient adjustment method, the coefficients of the equation of each edge are adjusted to obtain the 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 points of each pixel and the new equation of each edge, it is judged whether each pixel meets the pixel coverage judgment condition of the first type of primitive. When any pixel meets 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. By presetting the coefficient adjustment method of the equation of the edge according to the type of the 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 found coefficient adjustment method, without additionally calculating the new equation of the edge, without increasing additional hardware computing resources, without changing the GPU architecture, and reducing the cost of conservative rasterization. And according to the new equation of the edge, the coverage of the pixel is judged. Therefore, when judging the coverage of the pixel, the area covered by the primitive is already adjusted, ensuring the correctness of rasterization. In this case, the method of the present disclosure not only ensures the correctness of the implementation of the conservative rasterization function, but also does not require additional hardware computing resources, does not change the GPU architecture, makes the cost of conservative rasterization smaller, and thus completes the conservative rasterization simply and efficiently.

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

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

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

[0091] Assume that the degree parameter of conservative rasterization is L. Then as Figure 5 shown, a square indeterminate area with a side length of 2L centered on the vertex is obtained at each vertex. Assume that the rasterization mode is the overestimation mode. Then after adjusting the equation of the edge, the original triangular primitive can expand to obtain a larger triangular primitive. An example of the adjustment method of the equation of the edge in the overestimation mode is given later.

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

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

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

[0095] In the overestimation mode, the pixel coverage judgment conditions for the first type of primitive include 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 through the coordinates of the three vertices of the first type of primitive. The original bounding box is the smallest 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 the uncertainty areas. The expanded bounding box can be used as the bounding box for conservative rasterization of the first type of primitive. An exemplary way of expanding the bounding box is given later.

[0097] Correspondingly, in the overestimation mode, the pixel coverage judgment conditions for the first type of primitive may include 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. 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 bounding box for conservative rasterization of the first type of primitive on the pixel. When the pixel satisfies both the first condition and the second condition, it satisfies the pixel coverage judgment condition of the first type of primitive. The specific setting methods of the first condition and the second condition in the embodiments of the present disclosure are not limited. 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 not to use the bounding box but to use other methods to exclude the pixels covered by the invalid area. The embodiments of the present disclosure do not limit whether the bounding box must be used in the overestimation mode.

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

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

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

[0102] According to the minimum value, maximum value of the vertices of the first type of primitive in the first dimension, the minimum value, maximum value in the second dimension, and the degree parameter of conservative rasterization, determining the equation of the bounding box for conservative rasterization.

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

[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 side moves L unit distances outward from 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, only need to preset the degree parameter of conservative rasterization in advance. 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 additional setting of hardware computing resources, reducing the cost required for conservative rasterization.

[0120] In one 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 first type of primitive on the pixel.

[0121] In the underestimation mode, the primitive will shrink inwards, Figure 6 Show a schematic diagram of the inward shrinkage of the primitive according to an embodiment of the present disclosure.

[0122] Such as Figure 6 shown, assuming that the primitive includes three vertices and three edges, and the coordinates of each vertex are: V0(x0, y0), V1(x1, y1), V2(x2, y2), and the three edges are edge V0V1, edge V1V2, and edge V0V2 respectively.

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

[0124] There is no invalid region after the primitive is shrunk. Therefore, there is no need to use a bounding box in the underestimation mode. Correspondingly, in the underestimation mode, the pixel coverage determination condition of the first type of primitive may include a third condition, and the third condition is used to determine the coverage of the first type of primitive on the pixel. At this time, the first type of primitive refers to the shrunk first type of primitive. When the pixel satisfies the third condition, it satisfies the pixel coverage determination condition of the first type of primitive. The specific setting method of the third condition in the embodiments of the present disclosure is not limited. Examples of the third condition are given later.

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

[0126] The following introduces an exemplary determination method for the type of each edge of the first type of primitive.

[0127] In a possible implementation manner, according to the coordinates of the vertices of the first type of primitive, determine the equation and type of each edge of the first type of primitive, including:

[0128] According to the coordinates of the vertices of the first type of primitive, determine the equation of the i-th edge of the first type of primitive as 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 edge, x represents the coordinate of the first dimension, and y represents the coordinate of the second dimension;

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

[0130] For example, in the Figure 5 and Figure 6 example, assume that the primitive includes three vertices and three edges, and the coordinates of each vertex are: V0(x0, y0), V1(x1, y1), V2(x2, y2), and the three edges are edge V0V1, edge V1V2, and edge V0V2 respectively. Then, according to the coordinates of vertex V0 and vertex 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 vertex V1 and vertex 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 equation can be transmitted in a pipelined manner to the backstage in the form of an array. Table 1 shows an example of the array formed by the coefficients of the edge equation.

[0134] Table 1

[0135] Edge <![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] The following introduces an exemplary determination method for the type of edge.

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

[0138] Among them, when the equation of the i-th edge is A i x + B i y + C i = 0, A i , B i , C i are the coefficients of the equation of the i-th edge. The relative position of the area covered by the first type of primitive with respect to the i-th edge can be determined according to the magnitude relationship between A i , B i and a preset value, and the type corresponding to this relative position is determined as the type of the i-th edge.

[0139] There are eight possible cases for the relative position of the area covered by the first type of primitive with respect to the i-th edge, which are respectively that the area covered by the first type of primitive is located on 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, the edges can also be set to include eight types. Each type of edge corresponds to a relative position.

[0140] In the embodiments of the present disclosure, no specific limitation is imposed on the specific value of the preset value, as long as the relative position of the area covered by the first type of primitive with respect to the i-th edge can be determined according to the magnitude relationship between A i , B i and the preset value. The following takes the preset value being 0 as an example to introduce the corresponding relationship between different types of edges and the relative position of the area covered by the first type of primitive.

[0141] In a possible implementation, A i > 0, B iWhen it is >0, it is determined that the i-th edge is of the first type, and the area covered by the first type of graphic element is located at the lower right side of the i-th edge;

[0142] A i =0, B i When it is >0, it is determined that the i-th edge is of the second type, and the area covered by the first type of graphic element is located at the lower side of the i-th edge;

[0143] A i >0, B i When it is <0, it is determined that the i-th edge is of the third type, and the area covered by the first type of graphic element is located at the upper right side of the i-th edge;

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

[0145] A i <0, B i When it is >0, it is determined that the i-th edge is of the fifth type, and the area covered by the first type of graphic element is located at the lower left side of the i-th edge;

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

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

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

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

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

[0151] Among them, when 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 graphic element is located at the lower right side of the i-th edge, and the i-th edge is the leftmost and uppermost edge in the graphic element.

[0152] When A i = 0 and 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 uppermost edge among the primitives.

[0153] When A i > 0 and 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 at the upper right side of the i-th edge, and the i-th edge is the leftmost and lowermost edge among the primitives.

[0154] When A i > 0 and 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 among the primitives.

[0155] When A i < 0 and B i > 0, the type of the i-th edge is the fifth type, the area covered by the first type of primitive is located at the lower left side of the i-th edge, and the i-th edge is the rightmost and uppermost edge among the primitives.

[0156] When A i < 0 and B i = 0, the type of the i-th edge is the sixth type, the area covered by the first type of primitive is located on the left side of the i-th edge, and the i-th edge is the rightmost edge among the primitives.

[0157] When A i < 0 and B i < 0, the type of the i-th edge is the seventh type, the area covered by the first type of primitive is located at the upper left side of the i-th edge; the i-th edge is the rightmost and lowermost edge among the primitives.

[0158] When A i = 0 and B i < 0, the type of the i-th edge is the eighth type, the area covered by the first type of primitive is located above the i-th edge, and the i-th edge is the lowermost edge among the primitives.

[0159] Those skilled in the art should understand that Figure 7 the method for determining the type of the edge described in the relevant description of

[0160] Further, a look-up table for the coefficient adjustment method of the equation under two rasterization modes can be preset. The look-up table can record at least the rasterization mode, various types of edges, the coefficients to be adjusted for each type under the rasterization mode, and their adjustment methods. The embodiments of the present disclosure do not limit whether the coefficients that do not need to be adjusted are reflected in the look-up table.

[0161] In this case, in a possible implementation manner, according to the preset rasterization mode and the type of each edge, to find the coefficient adjustment method of the equation of each edge, it can be to find the coefficient adjustment method corresponding to the type of the i-th edge in the look-up table corresponding to the preset rasterization mode.

[0162] Further, the coefficient adjustment method of the equation of the i-th edge includes: keeping A i , B i unchanged, and increasing C i by a first value. The first value can be determined according to the type of the i-th edge, the degree parameter L of conservative rasterization, and the values of A i , B i . It should be understood that increasing C i by a first value means adding the first value to C i , rather than meaning that C i will definitely increase after the coefficient adjustment. The first value may be positive or negative. When the first value is positive, after increasing C i by the first value, the value of C i increases; when the first value is negative, after increasing C i by the first value, the value of C i decreases.

[0163] Next, the increase degree of the coefficient C i of the equation of different types of edges in the overestimation mode and the underestimation mode is introduced.

[0164] In a possible implementation manner, 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 the first type or the second type, A i , B i remain unchanged, and C i increases by (A i L + B i L);

[0166] When the i-th edge is of the third type or the fourth type, A i , B i remain unchanged, and C i increases by (A i L - B i L);

[0167] When the $i$-th edge is of the fifth or sixth type, $A$ i and $B$ i remain unchanged, and $C$ i increases by $(-A$ i $L + B$ i $L)$;

[0168] When the $i$-th edge is of the seventh or eighth type, $A$ i and $B$ i remain unchanged, and $C$ i increases by $(-A$ i $L - B$ i $L)$;

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

[0170] For example, in the overestimation mode, as Figure 5 shown, the edges of the primitive move away from the center of the primitive. Taking the edge $V_0V_1$ of the first type as an example, point $V_0$ needs to move to $V_0'$, and point $V_1$ moves to $V_1'$. That is to say, both point $V_0$ and point $V_1$ need to move $L$ to the left and $L$ upward.

[0171] Since the positive direction of the first dimension $x$ is to the right and the positive direction of the second dimension $y$ is downward, the coordinates of $V_0'$ can be $(x_0 - L, y_0 - L)$, and the coordinates of $V_1'$ can be $(x_1 - L, y_1 - L)$.

[0172] At this time, the equation of $V_0'V_1'$ is:

[0173] $A$ i $x + B$ i $y - A$ i $(x_0 - L) - B$ i $(y_0 - L) = A$ i $x + B$ i $y + (-A$ i $x_0 - B$ i $y_0) + A$ i $L + B$ i $L = A$ i $x + B$ i $y + C$ i $ = 0$;

[0174] The equation of the edge $V_0V_1$ is:

[0175] $(y_0 - y_1)x + (x_1 - x_0)y + (x_0×y_1 - x_1×y_0) = (y_0 - y_1)x + (x_1 - x_0)y - x_0(y_0 - y_1) - y_0(x_1 - x_0) = A$ i $x + B$ i $y - A$ i $x_0 - B$i y0 = A i x + B i y + C i = 0;

[0176] Comparing the coefficients of the equation of V0’V1’ and the coefficients of the equation of side V0V1, it can be seen that only the coefficient C i is different. As long as, based on the equation of side V0V1, the coefficient C i is increased by (A i L + B i L), the equation of side V0’V1’ can be obtained.

[0177] Similarly, in the overestimation mode, when the i-th side is of the second type, A i , B i remains unchanged, and C i is increased by (A i L + B i L); when the i-th side is of the third or fourth type, A i , B i remains unchanged, and C i is increased by (A i L - B i L); when the i-th side is of the fifth or sixth type, A i , B i remains unchanged, and C i is increased by (-A i L + B i L); when the i-th side is of the seventh or eighth type, A i , B i remains unchanged, and C i is increased by (-A i L - B i L). Here, the specific calculation methods of the equations of the sides corresponding to each type before and after outward expansion will not be elaborated.

[0178] In the overestimation mode, after the coefficient adjustment methods of the equations of the sides of each type are determined, a coefficient adjustment method lookup table as shown in Table 2 can be pre-generated.

[0179] Table 2

[0180]

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

[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 side includes:

[0183] When the i-th edge is of the first type or the second type, A i and B i remain unchanged, and C i increases by (-A i L - B i L);

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

[0185] When the i-th edge is of the fifth type or the sixth type, A i and B i remain unchanged, and C i increases by (A i L - B i L);

[0186] When the i-th edge is of the seventh type or the eighth type, A i and B i remain unchanged, and C i increases by (A i L + B i L);

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

[0188] For example, in the underestimation mode, as Figure 6 shown, the edges of the primitive move towards the center of the primitive. Taking the edge V0V1 of the first type as an example, point V0 needs to move to V0”, and point V1 moves to V1”. That is to say, both point V0 and point V1 need to move L to the right and L downwards.

[0189] Since the first dimension x is positive to the right and the second dimension y is positive downwards, the coordinates of V0’ can be (x0 + L, y0 + L), and the coordinates of V1’ can be (x1 + L, y1 + L).

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

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

[0192] The equation of side 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 - A 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 those of the equation of side V0V1, it can be seen that only the coefficient C i needs to be adjusted. As long as, based on the equation of side V0V1, the coefficient C i is increased by (-A i L - B i L), the equation of side V0”V1” can be obtained.

[0195] Similarly, in the underestimation mode, when the i-th side is of the second type, A i , B i remains unchanged, and C i is increased by (-A i L - B i L); when the i-th side is of the third or fourth type, A i , B i remains unchanged, and C i is increased by (-A i L + B i L); when the i-th side is of the fifth or sixth type, A i , B i remains unchanged, and C i is increased by (A i L - B i L); when the i-th side is of the seventh or eighth type, A i , B i remains unchanged, and C i is increased by (A i L + B i L). Here, the specific calculation methods of the equations of the sides corresponding to each type before and after inner contraction will not be elaborated further.

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

[0197] Table 3

[0198]

[0199] In this case, when the preset rasterization mode is the underestimation mode, the coefficient adjustment method for the equation of the edge 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 can also be used to store the correspondence between the type of the edge and the coefficient adjustment method for the equation of the edge, and the embodiments of the present disclosure do not limit how to store the correspondence between the type of the edge and the coefficient adjustment method for the equation of the edge.

[0201] Next, an exemplary implementation method for determining whether each pixel satisfies the pixel coverage determination condition of the first type of primitive in the overestimation mode and the underestimation mode will be introduced.

[0202] In a possible implementation method, 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 conservative rasterization of the first type of primitive;

[0203] Determining whether each pixel satisfies the pixel coverage determination 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 includes:

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

[0205] According to the coordinates of the corner points of each pixel and the new equation of each edge, determine the position of the target corner point for pixel coverage determination of the pixel with respect to each edge. When the determined position is the same as the position of the area covered by the first type of primitive with respect 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 (including corner points) of a pixel is covered by the expanded primitive and within the expanded bounding box (i.e., 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 first type of primitive on a pixel can be set as: at least one corner point of the pixel is within the area covered by the first type of primitive; the condition for determining the coverage of the bounding box for conservative rasterization of the first type of primitive on a pixel can be set as: 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, based on the coordinates of the corner points of each pixel and the new equations of each edge, to determine whether each pixel meets the pixel coverage determination condition of the first type of primitive, it 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 determination for the i-th edge. In the overestimation mode, the target corner point is the corner point that is farthest from the i-th edge when all corner points of any pixel are within the area covered by the first type of primitive.

[0209] Figure 8 An example showing the coverage of the first type of primitive on a pixel according to an embodiment of the present disclosure.

[0210] As Figure 8 shown, the edge V3V4 is of the first type, the edge V4V5 is of the seventh type, and the edge V3V5 is of the third type. At this time, the area covered by the first type of primitive is located on the lower right side of the edge V3V4, the upper left side of the edge V4V5, and the upper right side of the edge V3V5. That is to say, as long as the lower right corner point of the pixel is on the lower right side of the edge V3V4, and the upper left corner point is on the upper left side of the edge V4V5, and the upper right corner point is on the upper right side of the 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 summarized that in the overestimation mode, the target corner point is the corner point that is farthest from the edge when all corner points of any pixel are within the area covered by the first type of primitive. Here, the specific selection method of the target corner points of other types of edges in the overestimation mode will not be elaborated further.

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

[0213] The selection of the target corner point is only related to the type of the edge and the rasterization mode. Therefore, a target corner point lookup table in the overestimation mode can be pre-generated, 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 the edge.

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

[0218] The implementation method for determining whether at least one corner point of a pixel is within the bounding box of the first type of primitive for conservative rasterization is similar to the method for 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 elaborated here.

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

[0220] In a possible implementation manner, 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, determining whether each pixel meets the pixel coverage judgment condition of the first type of primitive includes:

[0222] According to the rasterization mode and the type of the i-th edge, find the target corner point for pixel coverage judgment for 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 within the area covered by the first type of primitive;

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

[0224] For example, in the underestimation mode, if the entire area of the pixel is covered by the shrunken primitive, the pixel can be rendered. Therefore, the third condition for determining the coverage of the first type of primitive on the pixel can be set as: 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, determining whether each pixel meets the pixel coverage judgment condition of the first type of primitive can be implemented 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 for 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 within the area covered by the first type of primitive.

[0227] Taking the Figure 8 primitive in it 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 on the lower right side of edge V3V4, on the upper left side of edge V4V5, and on the upper right side of edge V3V5. That is to say, as long as the lower left corner point of the pixel is on the lower right side of edge V3V4, and the lower right corner point is on the upper left side of edge V4V5, and the lower left corner point is on the upper right side of edge V3V5, this pixel will be covered by the first type of primitive.

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

[0229] Similarly, in the underestimation mode, the top - right point is the target corner point of the fifth - type edge. It should be noted that for the second - type, fourth - type, eighth - type, and sixth - type edges, there are two corner points that can both be used as the target corner point, and one of them can be selected as the target corner point. For example, for the second - type edge, one of the top - right point or the top - left point can be used as the target corner point. For the fourth - type edge, one of the bottom - left point and the top - left point can be used as the target corner point. For the sixth - type edge, one of the bottom - right point and the top - right point can be used as the target corner point. For the eighth - type edge, one of the bottom - right point and the bottom - left point can be used as the target corner point.

[0230] The selection of the target corner point is only related to the type of the edge and the rasterization mode. Therefore, a target - corner - point lookup table in the underestimation mode can be pre - generated, 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 the edge.

[0234] Those skilled in the art should understand that other methods can also be used to store the correspondence between the type of the edge and the target corner point. The embodiments of the present disclosure do not limit how to store the correspondence between the type of the edge and the target corner point.

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

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

[0237] The conservative rasterization methods for the second type of primitive and the third type of primitive are introduced below. Since the second type of primitive degenerates into a line and the third type of primitive degenerates into a point, only the conservative rasterization after the expansion of the second type of primitive and the third type of primitive is considered, that is, the conservative rasterization of the second type of primitive and the third type of primitive is only performed in the overestimation mode.

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

[0239] 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 coefficients of the equation of each edge are adjusted according to the coefficient adjustment method to obtain the new equation of each edge.

[0240] 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 for the conservative rasterization of the second type of primitive is determined.

[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 for the conservative rasterization of the second type of primitive, it is determined whether each pixel meets the pixel coverage judgment condition of the second type of primitive.

[0242] When any one pixel meets the pixel coverage judgment condition of the second type of primitive, it is determined that the pixel is the pixel obtained by rasterizing the second type of primitive.

[0243] Among them, 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 the conservative rasterization of the second type of primitive.

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

[0245] As Figure 9 shown, the primitive may include two vertices: W0(a0, b0) and W1(a1, b1), and the edge W0W1. This primitive is the second type of primitive. Assuming that the degree parameter of conservative rasterization is L, as Figure 9 shown, a square indeterminate region with a side length of 2L centered on the vertex is obtained at each vertex of the primitive.

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

[0247] Those skilled in the art should understand that multiple edges of the second type of graphic primitive actually coincide. Therefore, the equations of each edge of the second type of graphic primitive are actually the same. The equation determined according to the coordinates of any two vertices is the equation of each edge of the second type of graphic primitive.

[0248] After that, 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 graphic primitive is shown in Table 6.

[0249] Table 6

[0250]

[0251] For example, since the graphic primitive has degenerated into a line, the expansion of the graphic primitive is manifested as the movement of the line in the direction perpendicular to the line. Taking Figure 9 as an example, the edge W0W1 of the graphic primitive is of the first type. After the graphic primitive is expanded, adjusting the coefficients of the equation of the edge W0W1 can obtain two equations. Among them, the edge W0’W1’ corresponding to Equation 1 is located on the upper left side of the edge W0W1, and the edge W0”W1” corresponding to Equation 2 is located on the lower right side of the edge W0W1. On the basis of the equation of the edge W0W1, making the coefficient C i increase by (A i L + B i L) can obtain Equation 1, and making the coefficient C i increase by (-A i L - B i L) can obtain Equation 2. In this case, the area covered by the graphic primitive expands to the area between Equation 1 and Equation 2. The coefficient adjustment methods of the equations of other types of edges of the second type of graphic primitive will not be elaborated here.

[0252] Next, according to the coordinates of the vertices of the second type of graphic primitive and the degree parameter of conservative rasterization, the equation of the bounding box for conservative rasterization of the second type of graphic primitive can be determined. Similar to the method for determining the equation of the bounding box for conservative rasterization of the first type of graphic primitive, a primitive bounding box can be determined according to the coordinate lines of the vertices of the second type of graphic primitive, so that the primitive bounding box is the smallest bounding box that can accommodate all the vertices of the second type of graphic primitive. Then expand the primitive bounding box to accommodate all the uncertainty regions, and the expanded bounding box can be used as the bounding box for conservative rasterization of the second type of graphic primitive.

[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 condition of the second type of primitive. Among them, the pixel coverage determination 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. The exemplary determination method is the same as the determination method for whether each pixel meets the pixel coverage determination condition of the first type of primitive in the overestimation mode described above, and will not be elaborated here.

[0254] When any one pixel meets the pixel coverage determination condition of the second type of primitive, it can be determined that this pixel is a pixel obtained by rasterizing the second type of primitive. By analogy, after determining whether each pixel meets the pixel coverage determination 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 embodiments of the present disclosure also supports conservative rasterization of primitives that degenerate into lines, improving the capabilities of the primitive rasterization method.

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

[0257] When the preset rasterization mode is the overestimation mode, according to the coordinates of the vertices of the third type of primitive, determine the equation of the bounding box for conservative rasterization of the third type of primitive, and all vertices of the third type of primitive coincide;

[0258] 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, determine whether each pixel meets the pixel coverage condition of the third type of primitive;

[0259] When any one pixel meets the pixel coverage condition of the third type of primitive, determine that this pixel is a pixel obtained by rasterizing the third type of primitive;

[0260] 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.

[0261] Figure 10 Show an example of the expansion method of the third type of primitive according to the embodiments of the present disclosure.

[0262] As Figure 10 shown, the primitive may include one vertex: U0(s0, t0). This primitive is the third type of primitive. Assume that the degree parameter of conservative rasterization is L, then as Figure 10 shown, at vertex U0, a square indeterminate region with a side length of 2L centered at vertex U0 is obtained.

[0263] Since the third type of primitive has no edges, when the preset rasterization mode is the overestimation mode, the equation of the bounding box for conservative rasterization of the third type of primitive can be directly determined based on the coordinates of the vertices of the third type of primitive and the degree parameter of conservative rasterization. The equation of the bounding box for conservative rasterization of the third type of primitive 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] Based on 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. The exemplary judgment method is the same as the method for judging 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 described above, and will not be elaborated 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 rasterizing the third type of primitive. By analogy, after judging 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 present disclosure embodiment also supports conservative rasterization of primitives degenerated into points, improving the ability of the primitive rasterization method.

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

[0272] As Figure 11 shown, in a possible implementation manner, the device includes:

[0273] A first determination module 110, configured to determine 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, where the first type of primitive includes at least three vertices, and two edges with the same vertex as an end point intersect;

[0274] The first lookup module 111 is configured to, according to a preset rasterization mode and the type of each edge, look up a coefficient adjustment method for the equation of each edge, adjust the coefficients of the equation of each edge according to the coefficient adjustment method, and obtain a new equation for each edge;

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

[0276] The third determination module 113 is configured to, according to the coordinates of the corner points of each pixel and the new equation of each edge, determine whether each pixel meets the pixel coverage judgment condition for the first type of primitive. When any one pixel meets the pixel coverage judgment condition for 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 manner, the rasterization mode includes an overestimation mode, and the apparatus further includes: a fourth determination module, configured to, in the overestimation mode, determine an equation of a bounding box for conservative rasterization of the first type of primitive according to the coordinates of the vertices of the first type of primitive and a degree parameter of conservative rasterization; in the overestimation mode, the pixel coverage judgment condition for 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 a pixel, and the second condition is used to judge the coverage of the bounding box for conservative rasterization of the first type of primitive on a pixel.

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

[0279] In a possible implementation manner, 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 that the equation of the i-th edge of the first type of primitive is 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 edge, x represents the coordinate of the first dimension, and y represents the coordinate of the second dimension; according to the magnitude relationship between A i and 0, and the magnitude relationship between B i and 0, determine the type of the i-th edge.

[0280] In a possible implementation manner, A i > 0, B iWhen it is >0, it is determined that the i-th edge is of the first type, and the area covered by the first type of primitive is located on the lower right side of the i-th edge; A i =0, B i When it is >0, it is determined that the i-th edge is of the second type, and the area covered by the first type of primitive is located on the lower side of the i-th edge; A i >0, B i When it is <0, it is determined that the i-th edge is of the third type, and the area covered by the first type of primitive is located on the upper right side of the i-th edge; A i >0, B i When it is =0, it is determined that the i-th edge is of the fourth type, and the area covered by the first type of primitive is located on the right side of the i-th edge; A i <0, B i When it is >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 on the lower left side of the i-th edge; A i <0, B i When it is =0, it is determined that the i-th edge is of the sixth type, and the area covered by the first type of primitive is located on the left side of the i-th edge; A i <0, B i When it is <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; A i =0, B i When it is <0, it is determined that the i-th edge is of the eighth type, and the area covered by the first type of primitive is located on the upper side of the i-th edge.

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

[0282] In a possible implementation manner, 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 the first type or the second type, A i 、B i remain unchanged, C i increases by (A i L + B i L); when the i-th edge is of the third type or the fourth type, A i 、Bi Remain unchanged, C i Increase (A i L - B i L); when the i-th edge is of the fifth type or the sixth type, A i and B i Remain unchanged, C i Increase (-A i L + B i L); when the i-th edge is of the seventh type or the eighth type, A i and B i Remain unchanged, C i Increase (-A i L - B 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 i-th edge includes: when the i-th edge is of the first type or the second type, A i and B i Remain unchanged, C i Increase (-A i L - B i L); when the i-th edge is of the third type or the fourth type, A i and B i Remain unchanged, C i Increase (-A i L + B i L); when the i-th edge is of the fifth type or the sixth type, A i and B i Remain unchanged, C i Increase (A i L - B i L); when the i-th edge is of the seventh type or the eighth type, A i and 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 conservative rasterization of the first type of primitive; determining whether each pixel meets the pixel coverage determination 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 includes: according to the rasterization mode and the type of the i-th edge, finding the target corner point for pixel coverage determination for the i-th edge. In the overestimation mode, the target corner point is the corner point that is farthest from the i-th edge when all corner points of any pixel are within the area covered by the first type of primitive; according to the coordinates of the corner points of each pixel and the new equation of each edge, determining the position of the target corner point for pixel coverage determination for each edge of the pixel 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.

[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; determining whether each pixel meets the pixel coverage determination 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 includes: according to the rasterization mode and the type of the i-th edge, finding the target corner point for pixel coverage determination for the i-th edge. In the underestimation mode, the target corner point is the corner point that is closest to the i-th edge when all corner points of any pixel are within the area covered by the first type of primitive; according to the coordinates of the corner points of each pixel and the new equation of each edge, determining the position of the target corner point for pixel coverage determination for each edge of the pixel 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.

[0286] In a possible implementation, the apparatus further includes: a fifth determination module, configured to determine equations and types of each side of the second type of primitive according to coordinates of vertices of the second type of primitive when a preset rasterization mode is an overestimation mode, where all vertices of the second type of primitive are on the same straight line and at least two vertices do not coincide; a third search module, configured to search for a coefficient adjustment method of the equation of each side according to the preset rasterization mode and the type of each side, and adjust coefficients of the equation of each side according to the coefficient adjustment method to obtain a new equation of each side; a sixth determination module, configured to determine an equation of a bounding box for conservative rasterization of the second type of primitive according to coordinates of vertices of the second type of primitive and a degree parameter of conservative rasterization; a first determination module, configured to determine whether each pixel meets a pixel coverage determination condition of the second type of primitive according to coordinates of corner points of each pixel, the new equation of each side, and the equation of the bounding box for conservative rasterization of the second type of primitive; a seventh determination module, configured to determine, when any one pixel meets the pixel coverage determination condition of the second type of primitive, that the pixel is a pixel obtained by rasterizing the second type of primitive; where the pixel coverage determination condition of the second type of primitive includes: at least one corner point of the pixel is within an 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 apparatus further includes: an eighth determination module, configured to determine an equation of a bounding box for conservative rasterization of the third type of primitive according to coordinates of vertices of the third type of primitive when a preset rasterization mode is an overestimation mode, where all vertices of the third type of primitive coincide; a second determination module, configured to determine whether each pixel meets a pixel coverage condition of the third type of primitive according to coordinates of 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, configured to determine, when any one pixel meets the pixel coverage condition of the third type of primitive, that the pixel is a pixel obtained by rasterizing the third type of primitive; where 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, functions or modules included in the apparatus provided in the embodiments of the present disclosure can be used to execute the methods described in the method embodiments above. Its specific implementation can refer to the description of the method embodiments above. For the sake of brevity, it will not be repeated here.

[0289] The embodiments of the present disclosure further propose a computer-readable storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the above methods are implemented. The computer-readable storage medium can be a volatile or non-volatile computer-readable storage medium.

[0290] Embodiments of the present disclosure also propose an electronic device, including: a processor; 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] Embodiments of the present disclosure also provide a computer program product, including computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in the processor of the electronic device, the processor in the electronic device executes the above method.

[0292] Figure 12 The block diagram of the electronic device 1900 according to an embodiment of the present disclosure is shown. For example, the electronic device 1900 may be provided as a server or a terminal device. Referring to Figure 12 , the electronic device 1900 includes a processing component 1922, which further includes one or more processors, and memory resources represented by a memory 1932 for storing instructions executable by the processing component 1922, such as application programs. The application programs 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 further 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 TM , Mac OS X TM , Unix TM , Linux TM , FreeBSD TM or the like.

[0294] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as the memory 1932 including computer program instructions. The above computer program instructions can be executed by the processing component 1922 of the electronic device 1900 to complete 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 having thereon computer-readable program instructions for causing a processor to implement various aspects of the present disclosure.

[0296] A computer-readable storage medium can be a tangible device that can retain and store instructions for use 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 (a non-exhaustive list) of the computer-readable storage medium 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 disc read-only memory (CD-ROM), a digital versatile disc (DVD), a memory stick, a floppy disk, a mechanically encoded device such as a punched card or raised structures in grooves having instructions stored thereon, and any suitable combination of the foregoing. The computer-readable storage medium as used herein is not construed as being a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagated through a waveguide or other transmission medium (e.g., an optical pulse through an optical fiber 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 various computing / processing devices, or can be downloaded to an external computer or an external storage device through a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network may include a copper transmission cable, an optical fiber transmission, a wireless transmission, a router, a firewall, a switch, a gateway computer, and / or an edge server. A 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 a computer-readable storage medium in each computing / processing device.

[0298] The computer program instructions for performing the operations of this 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 the "C" language or similar programming languages. The computer - readable program instructions may be executed entirely on the user's computer, partially on the user's computer, executed as a stand - alone software package, partially on the user's computer and partially on a remote computer, or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or, alternatively, may be connected to an external computer (e.g., through the Internet using an Internet service provider). In some embodiments, by using the state information of the computer - readable program instructions to customize an electronic circuit, such as a programmable logic circuit, a field - programmable gate array (FPGA), or a programmable logic array (PLA), the electronic circuit can execute the computer - readable program instructions to implement various aspects of this disclosure.

[0299] Aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present disclosure. It should be understood that each block of the flowcharts and / or block diagrams, and combinations of blocks in the flowcharts and / or block diagrams, 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 apparatus to produce a machine such that the instructions, when executed by the processor of the computer or other programmable data - processing apparatus, create a means for implementing the functions / acts specified in one or more blocks of the flowchart and / or block diagram. These computer - readable program instructions can also be stored in a computer - readable storage medium, which causes a computer, a programmable data - processing apparatus, and / or other devices to operate in a particular manner, so that the computer - readable medium storing the instructions includes a manufacture, which includes instructions for implementing various aspects of the functions / acts specified in one or more blocks of 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, causing a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process such that the instructions executed on the computer, other programmable data processing apparatus, or other device implement the functions / acts specified in one or more boxes of the flowchart and / or block diagram.

[0302] The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram may represent a module, a segment of code, or a portion of an instruction, which contains one or more executable instructions for implementing the specified logical function. In some alternative implementations, the functions noted in the blocks may occur out of the order noted in the figures. For example, two consecutive blocks may in fact be executed substantially in parallel, or they may sometimes be executed in the reverse order, depending upon the functionality involved. It should also be noted that each block of the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented by a dedicated hardware-based system that performs the specified function or act, or by a combination of dedicated hardware and computer instructions.

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

Claims

1. A method for rasterizing graphic primitives, characterized in that, The method includes: Determining equations and types of each edge of the first type of primitive according to coordinates of vertices of the first type of primitive, where the first type of primitive includes at least three vertices and two edges sharing the same vertex intersect; Finding a coefficient adjustment method for the equation of each edge according to a preset rasterization mode and the type of each edge, and adjusting coefficients of the equation of each edge according to the coefficient adjustment method to obtain a new equation for each edge; Determining a pixel coverage judgment condition for the first type of primitive according to the preset rasterization mode; Judging whether each pixel meets the pixel coverage judgment condition for the first type of primitive according to coordinates of corner points of each pixel and the new equation of each edge, and when any one pixel meets the pixel coverage judgment condition for the first type of primitive, determining that pixel as a 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, and in the overestimation mode, the method further includes: Determining an equation of a bounding box for conservative rasterization of the first type of primitive according to coordinates of vertices of the first type of primitive and a degree parameter for conservative rasterization; In the overestimation mode, the pixel coverage judgment condition for the first type of primitive includes a first condition and a second condition, where the first condition is used to judge the coverage of the first type of primitive on a pixel, and the second condition is used to judge the coverage of the bounding box for conservative rasterization of the first type of primitive on a pixel.

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

4. The method according to claim 1, wherein the determining equations and types of each edge of the first type of primitive according to coordinates of vertices of the first type of primitive includes: According to the coordinates of the vertices of the first type of graphic elements, determine that the equation of the \(i\)-th edge of the first type of graphic elements is \(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 edge, \(x\) represents the coordinate in the first dimension, and \(y\) represents the coordinate in the second dimension; According to A i and the magnitude relationship with 0, as well as B i and the magnitude relationship with 0, determine the type of the i-th side.

5. The method according to claim 4, wherein A i > 0, B i When > 0, it is determined that the i-th side is of the first type, and the area covered by the first type of graphic primitive is located at the lower right side of the i-th side; A i = 0, B i > 0, determine that the i-th side is of the second type, and the area covered by the first type of primitive is located below the i-th side; A i > 0, B i When < 0, it is determined that the i-th side is of the third type, and the area covered by the first type of primitive is located on the upper right side of the i-th side; A i > 0, B i When it is 0, it is determined that the i-th side is of the fourth type, and the area covered by the first type of graphic element is located on the right side of the i-th side; A i <0, B i When it is >0, it is determined that the i-th side is of the fifth type, and the area covered by the first type of graphic primitive is located at the lower left side of the i-th side; A i <0, B i When it is 0, it is determined that the ith side is of the sixth type, and the area covered by the first type of primitive is located on the left side of the ith side; A i <0, B i When <0, it is determined that the i-th side 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 side; A i = 0, B i When < 0, it is determined that the i-th side is of the eighth type, and the area covered by the first type of primitive is located above the i-th side.

6. The method according to claim 2, wherein the determining an equation of a bounding box for conservative rasterization of the first type of primitive according to coordinates of vertices of the first type of primitive and a degree parameter for conservative rasterization includes: Determining a minimum value, a maximum value of the vertices of the first type of primitive in a first dimension, and a minimum value, a maximum value of the vertices of the first type of primitive in a second dimension according to coordinates of vertices of the first type of primitive; Determining an equation of the bounding box for conservative rasterization according to the minimum value, the maximum value of the vertices of the first type of primitive in the first dimension, the minimum value, the maximum value of the vertices of the first type of primitive in the second dimension, and the degree parameter for conservative rasterization.

7. The method according to claim 4, characterized in that The rasterization mode includes an overestimation mode, and in the overestimation mode, the coefficient adjustment method for the equation of the i-th edge includes: When the i-th side is of the first type or the second type, A i , B i remains unchanged, and C i increases by (A i L + B i L); When the i-th side is of the third type or the fourth type, A i , B i remains unchanged, and C i increases by (A i L - B i L); When the i-th side is of the fifth or sixth type, A i , B i remains unchanged, and C i increases by (-A i L + B i L); When the i-th side is of the seventh type or the eighth type, A i and B i remain unchanged, and C i is increased by (-A i L - B i L); where L represents the degree parameter for conservative rasterization.

8. The method according to claim 4, wherein The rasterization mode includes an underestimation mode, and in the underestimation mode, the coefficient adjustment method for the equation of the i-th edge includes: When the i-th side is of the first type or the second type, A i , B i remains unchanged, and C i increases by (-A i L - B i L); When the i-th side is of the third type or the fourth type, A i , B i remains unchanged, and C i is increased by (-A i L + B i L); When the i-th side is of the fifth or sixth type, A i , B i remains unchanged, and C i increases by (A i L - B i L); When the i-th side is of the seventh type or the eighth type, A i , B i remains unchanged, and C i increases by (A i L + B i L); where L represents the degree parameter for conservative rasterization.

9. The method according to claim 2, wherein 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 for conservative rasterization of the first type of primitive; Determining whether each pixel meets the pixel coverage determination 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 includes: According to the rasterization mode and the type of the i-th edge, finding the target corner point for pixel coverage determination for the i-th edge. In the overestimation mode, when all the corner points of any pixel are in the area covered by the first type of primitive, the target corner point is the corner point farthest from the i-th edge; According to the coordinates of the corner points of each pixel and the new equation of each edge, determining the position of the target corner point for pixel coverage determination for each edge with respect to each edge of the pixel. When the determined position is the same as the position of the area covered by the first type of primitive with respect to each 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, wherein In the underestimation mode, the third condition is that all the corner points of the pixel are within the area covered by the first type of primitive; Determining whether each pixel meets the pixel coverage determination 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 includes: According to the rasterization mode and the type of the i-th edge, finding the target corner point for pixel coverage determination for the i-th edge. In the underestimation mode, when all the corner points of any pixel are in the area covered by the first type of primitive, the target corner point is the corner point closest to the i-th edge; According to the coordinates of the corner points of each pixel and the new equation of each edge, determining the position of the target corner point for pixel coverage determination for each edge with respect to each edge of the pixel. When the determined position is the same as the position of the area covered by the first type of primitive with respect to each 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, wherein 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. All the vertices of the second type of primitive are on the same straight line and at least two vertices do not coincide; According to the preset rasterization mode and the type of each edge, finding the coefficient adjustment method of the equation of each edge, and adjusting the coefficients of the equation of each edge according to the coefficient adjustment method to obtain the new equation of each edge; According to the coordinates of the vertices of the second type of primitive and the degree parameter of conservative rasterization, determining the equation of the bounding box for conservative rasterization 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, determining whether each pixel meets the pixel coverage determination condition of the second type of primitive; When any pixel meets the pixel coverage determination condition of the second type of primitive, determining that the pixel is a pixel obtained by rasterizing the second type of primitive; Wherein, the pixel coverage determination 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.

12. The method according to claim 1, wherein The method further includes: When the preset rasterization mode is the overestimation mode, according to the coordinates of the vertices of the third type of primitive, determine the equation of the bounding box for conservative rasterization of the third type of primitive, and all vertices of the third type of primitive coincide; 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, determine whether each pixel meets the pixel coverage condition of the third type of primitive; When any pixel meets the pixel coverage condition of the third type of primitive, determine that pixel as the pixel obtained by rasterizing 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.

13. A primitive rasterization device, characterized in that, The apparatus includes: A first determination module, configured to determine 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, where the first type of primitive includes at least three vertices, and two edges with the same vertex as an end point intersect; A first search module, configured to search for the coefficient adjustment method of the equation of each edge according to the preset rasterization mode and the type of each edge, and adjust the coefficients of the equation of each edge according to the coefficient adjustment method to obtain the new equation of each edge; A second determination module, configured to determine the pixel coverage judgment condition of the first type of primitive according to the preset rasterization mode; A third determination module, configured to determine whether each pixel meets 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 meets the pixel coverage judgment condition of the first type of primitive, determine that pixel as the pixel obtained by rasterizing the first type of primitive.

14. An electronic device, characterized in that, Includes: A processor; A memory for storing instructions executable by the processor; Wherein, the processor is configured to implement the method according to 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 the processor, the method according to any one of claims 1 to 12 is implemented.

Citation Information

Patent Citations

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

    CN115841433A

  • Rasterization method, processor, system and electronic equipment

    CN118037931A