CN111210526B - GPU geometric primitive initial mark management method in plane clipping - Google Patents
GPU geometric primitive initial mark management method in plane clipping Download PDFInfo
- Publication number
- CN111210526B CN111210526B CN201911421729.5A CN201911421729A CN111210526B CN 111210526 B CN111210526 B CN 111210526B CN 201911421729 A CN201911421729 A CN 201911421729A CN 111210526 B CN111210526 B CN 111210526B
- Authority
- CN
- China
- Prior art keywords
- primitive
- clipping
- mark
- plane
- basic
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T19/00—Manipulating 3D models or images for computer graphics
- G06T19/20—Editing of 3D images, e.g. changing shapes or colours, aligning objects or positioning parts
Landscapes
- Engineering & Computer Science (AREA)
- Architecture (AREA)
- Computer Graphics (AREA)
- Computer Hardware Design (AREA)
- General Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Image Generation (AREA)
Abstract
The invention relates to a GPU geometric primitive initial mark management method in plane clipping, which comprises the following steps: setting a first clipping mark according to a first starting mark of a first primitive vertex in the geometric primitive; judging the relation between basic primitives formed by a plurality of first primitive vertexes and a clipping plane when the plane is clipped; judging the relation between each first line segment in the basic graphic element and the cutting plane according to the intersection relation between the basic graphic element and the cutting plane, updating the first cutting mark into a second cutting mark or reserving the first cutting mark according to the relation between each first line segment and the cutting plane, judging whether all the first line segments in the basic graphic element are processed, if yes, setting the initial mark information of the graphic element vertexes in the geometric graphic element obtained after cutting the basic graphic element according to the second cutting mark, and if no, continuously judging the relation between each first line segment in the basic graphic element and the cutting plane. The initial mark management method solves the problems of loss, change and the like of the initial mark of the vertex of the primitive caused by plane clipping.
Description
Technical Field
The invention belongs to the field of computer graphics processing, and particularly relates to a method for managing a GPU geometric primitive start mark in plane clipping.
Background
The GPU involves ten application level geometric primitives, which are respectively points, lines, line bands, wire loops, triangles, triangle bands, triangle fans, quadrilaterals, quadrilateral bands and polygons. In the geometric processing stage of the ten geometric primitives, the processes of primitive assembly, plane clipping, three-dimensional clipping, window change, back surface blanking, rasterization and the like are required.
When assembling vertices to various primitive types during primitive assembly, the starting vertices in each primitive need to be marked. In planar clipping, clipping is required according to the relationship between the vertex of the primitive and the plane. In the rasterization stage, it is possible to perform a straight line drawing operation on nine primitives other than the dot primitive.
However, in planar clipping, clipping may cause a change in the start label of each primitive, such as a loss, change in the vertex start label of the primitive. The change of the primitive start mark can lead to discontinuous line segments in the primitive and independence of the stippling among different primitives when the linear stippling operation is performed in the rasterization stage.
Disclosure of Invention
In order to solve the above problems in the prior art, the present invention provides a method for managing the initial marks of GPU geometric primitives in plane clipping. The technical problems to be solved by the invention are realized by the following technical scheme:
the embodiment of the invention provides a GPU geometric primitive initial mark management method in plane clipping, which comprises the following steps:
setting a first clipping mark according to a first starting mark of a first primitive vertex in the geometric primitive;
judging the relation between each first line segment in the basic primitive and the clipping plane according to the intersecting relation between the basic primitive formed by a plurality of first primitive vertexes and the clipping plane during plane clipping;
updating the first clipping mark into a second clipping mark or reserving the first clipping mark according to the relation between each first line segment and the clipping plane;
and judging whether all the first line segments in the basic graphic element are processed, if yes, setting initial mark information of graphic element vertexes in the geometric graphic element obtained after cutting the basic graphic element according to the second cutting mark, and if not, continuously judging the relation between each first line segment in the basic graphic element and the cutting plane.
In one embodiment of the present invention, setting a first clipping flag according to a first starting flag of a first primitive vertex in a geometric primitive includes:
acquiring a primitive vertex packet of the first primitive vertex, and recording the number of the first primitive vertex;
detecting the first and second start markers in the primitive vertex package;
and setting the first cutting mark according to the first starting mark.
In one embodiment of the present invention, after setting the first clipping flag according to the first start flag, the method further includes:
judging the relation between the number of the first primitive vertexes and the number of the vertexes of the basic primitive:
if the number of the first primitive vertexes is smaller than that of the basic primitives, continuing to acquire primitive vertex packages of the first primitive vertexes;
if the number of the first primitive vertexes is equal to the number of the vertexes of the basic primitive, judging the relationship between the basic primitive formed by a plurality of the first primitive vertexes and the clipping plane when the plane is clipped.
In one embodiment of the present invention, before determining the relationship between each first line segment in the basic primitive and the clipping plane according to the intersection relationship between the basic primitive formed by the vertices of the first primitives and the clipping plane during plane clipping, the method further includes:
sequentially judging the relation between each first primitive vertex and the clipping plane;
and carrying out combination judgment on the relations between all the first primitive vertexes corresponding to the basic primitive and the clipping plane to obtain the relation between the basic primitive and the clipping plane.
In one embodiment of the present invention, updating the first clipping flag to be the second clipping flag or reserving the first clipping flag according to the relation between each of the first line segments and the clipping plane includes:
if the relation between the first line segment and the clipping plane is reserved, reserving the first clipping mark;
if the relation between the first line segment and the clipping plane is discarding and the first starting mark exists in the primitive vertex packet of the first line segment, updating the first clipping mark into the second clipping mark;
if the relation between the first line segment and the clipping plane is intersecting and the first start mark exists in the primitive vertex packet of the first line segment, updating the first clipping mark to be the second clipping mark, assigning the start point packet header information of the first line segment to the intersection point when the intersection point is the start point of the second line segment after clipping, and assigning the end point packet header information of the first line segment to the intersection point when the intersection point is the end point of the second line segment.
In one embodiment of the present invention, setting start label information of a second primitive vertex in a geometric primitive obtained by clipping the basic primitive according to the second clipping label includes:
and setting the initial mark information of the vertex of the first second primitive in the geometry primitive after clipping as a first initial mark according to the second clipping mark, and updating the second clipping mark as the first clipping mark.
In one embodiment of the present invention, after determining the relationship between the base primitive formed by the vertices of the first primitives and the clipping plane during plane clipping, the method further includes:
updating the first clipping mark into a second clipping mark according to the discarding relation between the basic primitive and the clipping plane and the first starting mark in the primitive vertex packet of the basic primitive, and setting the first clipping mark according to the first starting mark of the first primitive vertex in the geometric primitive according to the second clipping mark returning step.
In one embodiment of the present invention, after determining the relationship between the base primitive formed by the vertices of the first primitives and the clipping plane during plane clipping, the method further includes:
and reserving the first clipping mark according to the reserved relation between the basic primitive and the clipping plane, and outputting the basic primitive according to the first clipping mark.
Compared with the prior art, the invention has the beneficial effects that:
the initial mark management method of the invention updates the cutting mark in real time according to the relation between the basic graphic element and the cutting plane in the plane cutting process by setting the cutting mark, and then updates the initial mark of the graphic element vertex after the plane cutting, thereby solving the problems of losing, changing and the like of the graphic element vertex initial mark caused by the plane cutting, and further ensuring the continuity of the line segment inside the graphic element and the independence of the point drawing among different graphic elements when the linear point drawing operation is carried out in the rasterization stage.
Drawings
FIG. 1 is a flowchart of a method for managing GPU geometric primitive start marks in plane clipping according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating another method for managing the initial markers of GPU geometry primitives in plane clipping according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a relationship between a vertex of a primitive and a clipping plane according to an embodiment of the present invention;
fig. 4 is a schematic diagram of a basic primitive and clipping plane relationship provided in an embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to specific examples, but embodiments of the present invention are not limited thereto.
Example 1
Referring to fig. 1 and fig. 2, fig. 1 is a flowchart of a method for managing a GPU geometric primitive start tag in planar clipping according to an embodiment of the present invention, and fig. 2 is a flowchart of a method for managing a GPU geometric primitive start tag in planar clipping according to another embodiment of the present invention. The GPU geometric primitive initial mark management method in the plane clipping comprises the following steps:
s1, setting a first clipping mark according to a first starting mark of a first primitive vertex in the geometric primitive.
The method specifically comprises the following steps:
s11, initializing variables.
Specifically, currentNum is set to record the number of vertices of the received first primitive, and currentNum is initialized to 0.
S12, acquiring a primitive vertex packet of the first primitive vertex, and recording the number of the first primitive vertices.
Specifically, one primitive vertex corresponds to one primitive vertex packet, and when a first primitive vertex packet is read, the currentNum value is increased by 1, that is, the number of the current first primitive vertices is increased by 1, that is, currentnum++.
S13, detecting a first starting mark and a second starting mark in the primitive vertex packet, namely analyzing starting mark information psFlag in the packet header.
Specifically, each primitive vertex packet includes start mark information, coordinate information, color information, texture coordinate information, boundary mark information and the like of the primitive vertex; the start mark information refers to whether the vertex of the primitive is the starting point of the geometric primitive. In this embodiment, the start marker information includes a first start marker and a second start marker, where the first start marker indicates that the primitive vertex is the start point of the geometric primitive, and the second start marker indicates that the primitive vertex is not the start point of the geometric primitive; for example, the start flag information is denoted by psFlag, the first start flag may be denoted as psflag=1, and the second start flag may be denoted as psflag=0. Taking a line segment as an example, one point of the line segment is the starting point, psflag=1, and the other point of the line segment is the end point, psflag=0.
S14, setting a first cutting mark according to the first starting mark.
The clipping flag information refers to whether or not the starting vertex of the geometric primitive is clipped in plane clipping. If the geometric primitive is completely reserved, the geometric primitive is represented by a first clipping mark; if the geometric primitive is completely clipped or partially clipped, and the geometric primitive comprises a starting vertex (i.e. the primitive vertex packet of the geometric primitive has a first starting label), the geometric primitive is represented by a second clipping label; if the geometric primitive is completely clipped or partially clipped, but the geometric primitive does not contain the initial vertex, no clipping mark information is needed. In this embodiment, the clip flag information is represented by psFlagclipped, the first clip flag is represented by psFlagclipped=0, and the second clip flag is represented by psFlagclipped=1. Taking a line segment as an example, in planar clipping, psFlag clip=0 if the line segment is completely reserved, and psFlag clip=1 if the line segment is partially or completely clipped and psflag=1.
It should be noted that, the clipping flag information psFlagClipped is a variable introduced in the plane clipping process, and indicates whether the initial vertex in the current geometric primitive is clipped.
In a specific embodiment, after a primitive vertex packet corresponding to a first primitive vertex is obtained, the primitive vertex packet is parsed, when psflag=1 in the primitive vertex packet is detected, the primitive vertex is indicated as a starting point, and at this time, psFlag clip=0 is set; when the psflag=0 in the primitive vertex packet is detected, it indicates that the primitive vertex is not a starting point, and the next step is directly performed without setting psFlag.
S15, judging the relation between the number of the vertexes of the first primitive and the number of the vertexes of the basic primitive according to the second initial mark. This step is to determine whether the current primitive is received.
This step may be performed after the first trimming flag is set according to the first start flag, or may be performed after the start flag information is detected as the second start flag. That is, when psflag=1, after psFlag clip=0 is set, the procedure is directly entered; when psflag=0, this step is entered directly.
Specifically, the geometric primitives include ten kinds of primitives of points, lines, line bands, wire loops, triangles, triangle bands, triangle fans, quadrilaterals, quadrilateral bands, and polygons, and the basic primitives include three kinds of geometric primitives of points, lines, and triangles.
Since the geometric primitive is divided into the basic primitives for clipping in the planar clipping, for example, the line band is divided into the line segments for clipping, the triangle band is divided into the triangles for clipping, and the quadrilateral band is divided into the triangles for clipping, when receiving the primitive vertices, all primitive vertices of one basic primitive corresponding to the geometric primitive need to be received to form a complete basic primitive. If the number of the first primitive vertexes is smaller than the number of primitive vertexes corresponding to the basic primitive, the acquired first primitive vertexes cannot form a basic primitive yet, and the first primitive vertexes are continuously acquired; if the number of the first primitive vertices is equal to the number of primitive vertices corresponding to the basic primitive, the acquired first primitive vertices can form a basic primitive, and then the next step is entered.
For example, when the quadrilateral band is divided into a plurality of triangles for clipping, at least three primitive vertices are received when the primitive vertex command is received, so that three primitive vertices can form a complete triangle. If only two primitive vertexes are received, indicating that a triangle cannot be formed, continuing to acquire the next primitive vertex, and if three primitive vertexes capable of forming the triangle are received, entering the next step.
In a specific embodiment, judging the relation between the currentNum value and the number of primitive vertices corresponding to the current processed primitive, if currentNum is smaller than the number of primitive vertices corresponding to the current processed primitive, returning to the step to continue S12, and continuing to acquire the first primitive vertex; if currentNum is equal to the number of primitive vertices corresponding to the currently processed primitive, go to the next step.
S2, judging the relation between the basic primitive formed by the vertexes of the first primitives and the clipping plane when the plane is clipped.
S21, sequentially judging the relation between each first primitive vertex and the clipping plane.
Specifically, vertex coordinates of each first primitive are sequentially substituted into a plane equation of a clipping plane, so that the relation between the first primitive vertices and the clipping plane is obtained. For example, referring to fig. 3, fig. 3 is a schematic diagram illustrating a relationship between a vertex of a primitive and a clipping plane according to an embodiment of the present invention; in fig. 3, the coordinates of the primitive vertex Pt are (x, y, z, w), where x, y, z are three-dimensional coordinates, and w is a perspective factor; if the point is in the plane planA, ax+by+cz+dw=0; if the point is on the plane planA, point P1, ax+By+Cz+Dw > 0; if this point is below the plane planA, i.e. point P2, ax+by+cz+dw < 0.
S22, combining and judging the relations between all the first primitive vertexes corresponding to the basic primitive and the clipping plane to obtain the relation between the basic primitive and the clipping plane.
Specifically, the combination judgment means: in a basic graphic element, firstly combining two first graphic element vertexes, judging the relation between a line segment formed by the two first graphic element vertexes and a clipping plane, then combining line segments corresponding to the basic graphic element, and judging the relation between the basic graphic element and the clipping plane. Further, the relationship between the base primitive and the clipping plane includes three types: discard, reserve, intersect. Wherein discarding refers to completely discarding, which indicates that the basic primitive is completely clipped; reservation refers to complete reservation, indicating that the base primitive is not clipped; intersection means that a portion of the base primitive is cropped and a portion remains.
Referring to fig. 4, fig. 4 is a schematic diagram of a basic primitive and clipping plane relationship provided in an embodiment of the present invention. Taking a basic primitive formed by three first primitive vertexes as a triangle and clipping and reserving primitive vertexes above a clipping plane plaA as an example, if the three vertexes of the triangle are all above the clipping plane, namely T1, or are all in the clipping plane, namely T2, the relation between the triangle and the clipping plane is completely reserved; if all three vertexes of the triangle are below the clipping plane, namely T3, the relationship between the triangle and the clipping plane is completely discarded; if two vertices of a triangle are above the clipping plane, one vertex is below the clipping plane, i.e., T4, or one vertex is above the clipping plane, two vertices are below the clipping plane, then the triangle and clipping plane relationship is intersecting. If the dot pattern element is on the clipping plane or above the clipping plane, the relationship between the dot pattern element and the clipping plane is reserved, and the dot pattern element is directly output at the moment; if the dot pattern element is below the clipping plane, the dot pattern element is discarded in relation to the clipping plane, and the dot pattern element is discarded at this time.
S3, updating the first clipping mark into a second clipping mark according to the discarding relation between the basic primitive and the clipping plane, and setting the first clipping mark according to the first starting mark of the vertex of the first primitive in the geometric primitive according to the second clipping mark returning step.
If the relation between the basic primitive and the clipping plane is discarding, indicating that the basic primitive is completely clipped, at this time, if the primitive vertex packet of the basic primitive contains a first start mark, updating the first clipping mark to a second clipping mark, and then returning to step S1 to continuously acquire the vertex of the next primitive; if the clipping mark of the basic primitive is the second clipping mark, returning to the step S1 according to the second clipping mark, and continuing to acquire the vertex of the next primitive. In a specific embodiment, when the relation between the basic primitive and the clipping plane is discard and psflag=1, if the current psFlag clipping value is 0, the psFlag clipping value is modified to be 1, then the next primitive vertex is directly obtained in step S1, and if the current psFlag clipping value is 1, the next primitive vertex is directly obtained in step S1.
S4, reserving a first clipping mark according to the reserved relation between the basic graphic element and the clipping plane, and outputting the basic graphic element according to the first clipping mark.
The relation between the basic graphic element and the clipping plane is reserved, which indicates that the basic graphic element is completely reserved, the first clipping mark is not changed, and then the basic graphic element is output according to the step of the output control of the first clipping mark. In a specific embodiment, if the relation between the basic primitive and the clipping plane is reserved, the psFlagClipped value is kept to be 0, and then the step of basic primitive output control is entered.
S5, judging the relation between each first line segment in the basic primitive and the clipping plane according to the intersecting relation between the basic primitive and the clipping plane, updating the first clipping mark into a second clipping mark or reserving the first clipping mark according to the relation between each first line segment and the clipping plane, and setting the initial mark information of the vertex of the second primitive in the geometric primitive obtained after clipping the basic primitive according to the second clipping mark.
S51, judging the relation between each first line segment in the basic primitive and the cutting plane according to the intersecting relation between the basic primitive and the cutting plane, and updating the first cutting mark into a second cutting mark or reserving the first cutting mark according to the relation between each first line segment and the cutting plane.
And if the relation between the basic primitive and the clipping plane is intersecting, sequentially judging the relation between each first line segment in the basic primitive and the clipping plane, and updating or reserving the first clipping mark according to the relation between each first line segment and the clipping plane.
Specifically, the relationship between the basic primitive and the clipping plane is that the basic primitive is partially clipped and partially reserved, and in this case, the basic primitive does not contain a dot primitive, and only two primitives, namely a straight line and a triangle are used. Cutting two types of primitives, namely a straight line and a triangle, by taking a line segment as a unit; that is, the relationship between the line segment where the straight line is located and the clipping plane is determined for the straight line, and the relationship between three line segments in the triangle and the clipping plane is determined for the triangle.
Further, if the relation between the first line segment and the clipping plane is reserved, which indicates that the line segment is completely reserved, the first clipping mark is not updated, then whether the current basic primitive is processed (whether all the first line segments in the basic primitive are processed) is judged, if yes, the next step is entered to perform basic primitive output control, the basic primitive is output, if no, the relation between the next first line segment in the basic primitive and the clipping plane is continuously judged, and the next first line segment is clipped, and the first clipping mark is updated or reserved.
In a specific embodiment, if the relation between the first segment and the clipping plane is reserved, the psFlagClipped value is kept to be 0, and then whether the current basic primitive is processed is judged.
If the relation between the first line segment and the clipping plane is discarding, the line segment is completely clipped, at this time, when a first initial mark exists in the primitive vertex packet of the first line segment, the first clipping mark is updated to a second clipping mark, then whether the current basic primitive is processed is judged, if yes, the next step is entered to carry out basic primitive output control, the basic primitive is output, if not, the relation between the next first line segment in the basic primitive and the clipping plane is continuously judged, and the next first line segment is clipped, updated or the first clipping mark is reserved.
In a specific embodiment, when the relation between the first line segment and the clipping plane is discard and psflag=1, psFlag clipped=0 is updated to psFlag clipped=1, and then it is determined whether the current primitive is processed.
If the relation between the first line segment and the clipping plane is intersecting, the line segment is partly clipped and partly reserved, at this time, when a first initial mark exists in the primitive vertex packet of the first line segment, the first clipping mark is updated to be a second clipping mark, the first line segment is clipped according to the intersecting relation to obtain a second line segment, and then the coordinates of the intersecting point are calculated. Specifically, when the intersection point is the start point of the second line segment, assigning the original start point header information (in the start point header information, the start mark information is a first start mark, i.e. psflag=1) of the current first line segment to the intersection point; and when the intersection point is the end point of the second line segment, assigning the original end point packet header information of the current first line segment to the intersection point. And then assembling the intersection points, and assembling the intersection points and the primitive vertexes reserved in the original basic primitive together to form a new geometric primitive, wherein the geometric primitive is the primitive obtained by cutting the basic primitive. And then judging whether the processing of the current basic graphic element is finished, if so, entering a next step to perform basic graphic element output control, outputting the basic graphic element, if not, continuing to judge the relation between the next first line segment in the basic graphic element and the clipping plane, clipping the next first line segment, and updating or retaining the first clipping mark.
In a specific embodiment, when the relationship between the first line segment and the clipping plane is intersecting and psflag=1, then psFlag clip=0 is updated to psFlag clip=1, and then the subsequent steps are performed.
S52, setting initial mark information of a second primitive vertex in the geometric primitive obtained by clipping the basic primitive according to the second clipping mark.
Specifically, when the basic primitive is intersected with the clipping plane, the basic primitive is clipped to obtain a clipped geometric primitive, the clipped geometric primitive is provided with a plurality of second primitive vertexes, and the plurality of second primitive vertexes are sequentially output according to the sequence from the starting point to the end point. And when the second clipping mark is detected, the geometric primitive is obtained after the initial vertex of the basic primitive is clipped, and the first vertex of the second primitive vertex output array of the geometric primitive is used as a starting point, so that the initial mark information of the first and second primitive vertices in the output array is set as the first initial mark, and the second clipping mark is updated as the first clipping mark. And then outputting all second primitive vertices in the current output array.
In one embodiment, when the second primitive vertices are output, the start markers of the second primitive vertices are updated according to whether the start vertices of the primitive are clipped (i.e., according to the psFlagClipped value); if the psFlagclipped value is 1, which indicates that the initial vertex of the basic primitive has been cut, the first initial marker information in the current second primitive vertex output array is set to 1 (i.e. psFlag is 1), other vertex initial markers in the output array are not modified, and at the same time, the cutting marker information of all initial vertices in the geometric primitive is updated to 0, i.e. the psFlagclipped value of all initial vertices in the geometric primitive is set to 0. And then outputting all second primitive vertices in the current output queue. For example, when a triangle is cut to obtain a quadrangle, when the vertices of the quadrangle are output, psFlag of the first vertex of the output is set to 1, the other three vertices are not modified, and the psFlagclipped values of the four vertices are set to 0.
In a specific embodiment, the sequence of the reservation, discarding and intersection of the basic primitive and the clipping plane may be arbitrary, that is, whether the basic primitive is reserved may be determined first, then whether the relationship is discarded may be determined, and finally whether the basic primitive is intersected may be determined; or judging whether the basic graphic elements are discarded, then judging whether the basic graphic elements are reserved or not, and finally judging whether the basic graphic elements are intersected or not; or judging whether the basic graphic elements are reserved or not, judging whether the basic graphic elements are intersected or not, and finally judging whether the basic graphic elements are discarded or not; the present embodiment is not further limited.
Referring to fig. 2, a reasonable judging order of the relation between the basic primitive and the clipping plane is provided in fig. 2. Of course, the sequence of the determination of the reservation, discarding, and intersection of the primitive and clipping planes in the embodiment of the present invention is not limited to the sequence shown in fig. 2.
In fig. 2, it is first determined whether the basic primitive is completely cut, if yes, the relationship between the basic primitive and the cutting plane is discarded, and if the basic primitive includes a start vertex, a psFlagclipped value is set according to the discarded relationship, and a subsequent operation is performed; if not, judging whether the basic graphic element is completely reserved, and if so, entering a step of outputting the current basic graphic element; if the basic primitive is not completely reserved, the basic primitive is partially reserved and partially cut, namely, the relation between the basic primitive and the cutting plane is intersected, and at the moment, the cutting is performed by taking the first line segment in the basic primitive as a unit.
When cutting is carried out by taking a first line segment in the basic graphic element as a unit, firstly judging whether the first line segment is completely reserved, if so, judging whether the current basic graphic element is processed, and if not, judging whether the first line segment is completely discarded; if the first line segment is completely discarded, judging whether the current basic primitive is processed, if the first line segment is not completely discarded, judging whether the intersection point is a new starting point or not if the first line segment is intersected with the clipping plane, if the intersection point is a new starting point (a starting point of a second line segment obtained after clipping), assigning the intersection point to the original starting point header information of the current first line segment, and if the intersection point is not the new starting point, indicating that the intersection point is a new ending point, assigning the intersection point to the original ending point header information of the current first line segment. After the intersection point is assigned, judging whether the current basic primitive is processed, if so, entering a step S3, and if not, continuing to process the next line segment, namely continuing to cut the next first line segment and updating or reserving the first cutting mark.
According to the initial mark management method, the clipping mark is set, the clipping mark is updated in real time according to the relation between the basic primitive and the clipping plane in the plane clipping process, and then the initial mark of the primitive vertex is updated after plane clipping, so that the management of the vertex initial mark in the GPU geometric primitive is realized, the problems of loss, change and the like of the primitive vertex initial mark caused by plane clipping are solved, and the continuity of the internal line segment of the primitive and the independence of point painting among different primitives are further caused when the rasterization stage carries out straight line point painting operation.
The foregoing is a further detailed description of the invention in connection with the preferred embodiments, and it is not intended that the invention be limited to the specific embodiments described. It will be apparent to those skilled in the art that several simple deductions or substitutions may be made without departing from the spirit of the invention, and these should be considered to be within the scope of the invention.
Claims (7)
1. A method for managing the initial mark of a geometric primitive of a GPU in planar clipping, comprising the steps of:
setting a first clipping mark according to a first starting mark of a first primitive vertex in the geometric primitive;
judging the relation between each first line segment in the basic primitive and the clipping plane according to the intersecting relation between the basic primitive formed by a plurality of first primitive vertexes and the clipping plane during plane clipping;
updating the first clipping mark into a second clipping mark or reserving the first clipping mark according to the relation between each first line segment and the clipping plane; comprising the following steps: if the relation between the first line segment and the clipping plane is reserved, reserving the first clipping mark; if the relation between the first line segment and the clipping plane is discarding and the first starting mark exists in the primitive vertex packet of the first line segment, updating the first clipping mark into the second clipping mark; if the relation between the first line segment and the clipping plane is intersecting and the first starting mark exists in the primitive vertex packet of the first line segment, updating the first clipping mark to be the second clipping mark, assigning the starting point packet header information of the first line segment to the intersection point when the intersection point is the starting point of the second line segment after clipping, and assigning the ending point packet header information of the first line segment to the intersection point when the intersection point is the ending point of the second line segment;
and judging whether all the first line segments in the basic graphic element are processed, if yes, setting initial mark information of graphic element vertexes in the geometric graphic element obtained after cutting the basic graphic element according to the second cutting mark, and if not, continuously judging the relation between each first line segment in the basic graphic element and the cutting plane.
2. The method for managing start markers of geometric primitives in a planar clipping GPU as claimed in claim 1, wherein setting a first clipping marker based on a first start marker of a first primitive vertex in the geometric primitives comprises:
acquiring a primitive vertex packet of the first primitive vertex, and recording the number of the first primitive vertex;
detecting the first and second start markers in the primitive vertex package;
and setting the first cutting mark according to the first starting mark.
3. The method for managing the start tag of the GPU geometry primitives in planar clipping as defined in claim 2, further comprising, after setting a first clipping flag according to the first start tag:
judging the relation between the number of the first primitive vertexes and the number of the vertexes of the basic primitive:
if the number of the first primitive vertexes is smaller than that of the basic primitives, continuing to acquire primitive vertex packages of the first primitive vertexes;
if the number of the first primitive vertexes is equal to the number of the vertexes of the basic primitive, judging the relationship between the basic primitive formed by a plurality of the first primitive vertexes and the clipping plane when the plane is clipped.
4. The method for managing the start mark of the GPU geometry primitives in planar clipping as defined in claim 1, further comprising, before determining the relationship between each first line segment in the base primitive and the clipping plane according to the intersection relationship between the base primitive formed by the plurality of first primitive vertices and the clipping plane in planar clipping:
sequentially judging the relation between each first primitive vertex and the clipping plane;
and carrying out combination judgment on the relations between all the first primitive vertexes corresponding to the basic primitive and the clipping plane to obtain the relation between the basic primitive and the clipping plane.
5. The method for managing the start markers of the geometric primitives in the GPU in planar clipping according to claim 1, wherein setting the start marker information of the vertices of the second primitive in the geometric primitives obtained after clipping the basic primitive according to the second clipping marker comprises:
and setting the initial mark information of the vertex of the first second primitive in the geometry primitive after clipping as a first initial mark according to the second clipping mark, and updating the second clipping mark as the first clipping mark.
6. The method for managing the initial marks of the GPU geometric primitives in planar clipping according to claim 1, further comprising, after determining the relationship between the primitive formed by the vertices of the first primitives and the clipping plane during planar clipping:
updating the first clipping mark into a second clipping mark according to the discarding relation between the basic primitive and the clipping plane and when the first starting mark exists in the primitive vertex packet of the basic primitive, and setting the first clipping mark according to the first starting mark of the first primitive vertex in the geometric primitive according to the second clipping mark returning step.
7. The method for managing the initial marks of the GPU geometric primitives in planar clipping according to claim 1, further comprising, after determining the relationship between the primitive formed by the vertices of the first primitives and the clipping plane during planar clipping:
and reserving the first clipping mark according to the reserved relation between the basic primitive and the clipping plane, and outputting the basic primitive according to the first clipping mark.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911421729.5A CN111210526B (en) | 2019-12-31 | 2019-12-31 | GPU geometric primitive initial mark management method in plane clipping |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911421729.5A CN111210526B (en) | 2019-12-31 | 2019-12-31 | GPU geometric primitive initial mark management method in plane clipping |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111210526A CN111210526A (en) | 2020-05-29 |
CN111210526B true CN111210526B (en) | 2023-09-15 |
Family
ID=70786467
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911421729.5A Active CN111210526B (en) | 2019-12-31 | 2019-12-31 | GPU geometric primitive initial mark management method in plane clipping |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111210526B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112634423B (en) * | 2020-12-24 | 2024-09-24 | 西安翔腾微电子科技有限公司 | TLM device of GPU plane clipping module based on SysML view and operation method |
CN115760543B (en) * | 2022-11-10 | 2024-02-13 | 格兰菲智能科技有限公司 | Thread processing method, device, equipment and storage medium for rasterizer ordered view |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109727184A (en) * | 2018-12-12 | 2019-05-07 | 中国航空工业集团公司西安航空计算技术研究所 | A kind of graphics processor three-dimensional cuts out circuit |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8212840B2 (en) * | 2006-10-23 | 2012-07-03 | Qualcomm Incorporated | 3-D clipping in a graphics processing unit |
-
2019
- 2019-12-31 CN CN201911421729.5A patent/CN111210526B/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109727184A (en) * | 2018-12-12 | 2019-05-07 | 中国航空工业集团公司西安航空计算技术研究所 | A kind of graphics processor three-dimensional cuts out circuit |
Non-Patent Citations (1)
Title |
---|
韩俊卿,葛永慧,张东升.多边形窗口的矢量图形裁剪算法.太原理工大学学报.2005,(02),全文. * |
Also Published As
Publication number | Publication date |
---|---|
CN111210526A (en) | 2020-05-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP4769984B2 (en) | Tile-based graphic rendering | |
US6961065B2 (en) | Image processor, components thereof, and rendering method | |
US6046747A (en) | Graphics application programming interface avoiding repetitive transfer of texture mapping data | |
US9818222B2 (en) | Tessellation of patches of surfaces in a tile based rendering system | |
US9019271B2 (en) | Z-culling method, three-dimensional graphics processing method and apparatus threrof | |
US8345059B2 (en) | Methods, systems, and data structures for generating a rasterizer | |
US8194974B1 (en) | Merge and removal in a planar map of an image | |
US6259461B1 (en) | System and method for accelerating the rendering of graphics in a multi-pass rendering environment | |
CN111210526B (en) | GPU geometric primitive initial mark management method in plane clipping | |
CN111241776B (en) | TLM device for GPU geometric primitive start mark management in SystemC-based plane clipping | |
US11164364B2 (en) | Coarse depth test in graphics processing systems | |
US7929755B1 (en) | Planar map to process a raster image | |
US20120218261A1 (en) | Graphic system comprising a fragment graphic module and relative rendering method | |
JP2002352254A (en) | Method for rendering mesh including a plurality of polygons representing graphics models | |
US6518964B1 (en) | Apparatus, system, and method for simplifying annotations on a geometric surface | |
CN114139266A (en) | Wall body node full-page proof automatic design method based on dynamic combination and storage medium | |
US20060061573A1 (en) | Method and apparatus for rendering a quadrangle primitive | |
US20040263534A1 (en) | Clipping and scissoring technique | |
CN113593028B (en) | Three-dimensional digital earth construction method for avionics display control | |
CN113590885B (en) | Vector graphic rasterization method | |
CN118052693A (en) | Graphics processor | |
JP2543425B2 (en) | Figure display method | |
KR20160131457A (en) | Method and apparatus for performing curve rendering | |
JPH07105390A (en) | System for controlling outer circumferential line drawing data | |
Stevenson | PEXlib specification and C language binding |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |