CN111210526A - GPU geometric primitive initial mark management method in plane clipping - Google Patents

GPU geometric primitive initial mark management method in plane clipping Download PDF

Info

Publication number
CN111210526A
CN111210526A CN201911421729.5A CN201911421729A CN111210526A CN 111210526 A CN111210526 A CN 111210526A CN 201911421729 A CN201911421729 A CN 201911421729A CN 111210526 A CN111210526 A CN 111210526A
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.)
Granted
Application number
CN201911421729.5A
Other languages
Chinese (zh)
Other versions
CN111210526B (en
Inventor
刘莎
李冲
杨洋
周艺璇
范飞虎
张佩
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xian Xiangteng Microelectronics Technology Co Ltd
Original Assignee
Xian Xiangteng Microelectronics Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Xian Xiangteng Microelectronics Technology Co Ltd filed Critical Xian Xiangteng Microelectronics Technology Co Ltd
Priority to CN201911421729.5A priority Critical patent/CN111210526B/en
Publication of CN111210526A publication Critical patent/CN111210526A/en
Application granted granted Critical
Publication of CN111210526B publication Critical patent/CN111210526B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T19/00Manipulating 3D models or images for computer graphics
    • G06T19/20Editing 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 graphic element vertex in the geometric graphic element; judging the relation between a basic primitive formed by the vertexes of a plurality of first primitives and a clipping plane during plane clipping; judging the relation between each first line segment in the basic primitive and the clipping plane according to the intersection relation between the basic primitive and the clipping plane, updating the first clipping mark according to the relation between each first line segment and the clipping plane or reserving the first clipping mark, judging whether all the first line segments in the basic primitive are processed completely, if so, setting initial mark information of a primitive vertex in the geometric primitive obtained after the basic primitive is clipped according to the second clipping mark, and if not, continuously judging the relation between each first line segment in the basic primitive and the clipping 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

GPU geometric primitive initial mark management method in plane clipping
Technical Field
The invention belongs to the field of computer graphic processing, and particularly relates to a GPU geometric primitive initial mark management method in plane clipping.
Background
The GPU relates to ten application-level geometric primitives, namely points, lines, line bands, line rings, triangles, triangle bands, triangle fans, quadrilaterals, quadrilateral bands and polygons. In the geometric processing stage of these ten kinds of geometric primitives, processes such as primitive assembling, plane clipping, three-dimensional clipping, window changing, back blanking and rasterization are required.
When assembling the vertex to various primitive types in the primitive assembling process, the initial vertex in each primitive needs to be marked. When clipping is performed on a plane, clipping needs to be performed according to the relation between the vertex of the primitive and the plane. In the rasterization stage, the other nine primitives except the dot primitive may need to perform the dot drawing operation of the straight line.
However, in planar clipping, the clipping may cause the start mark of each primitive to change, such as the loss and change of the start mark of the primitive vertex. The change of the primitive initial mark can make the internal line segment of the primitive discontinuous when the straight line point painting operation is carried out in the rasterization stage, and the point painting between different primitives is not independent.
Disclosure of Invention
In order to solve the above problems in the prior art, the present invention provides a method for managing GPU geometric primitive start markers in plane clipping. The technical problem to be solved by the invention is realized by the following technical scheme:
the embodiment of the invention provides a GPU geometric primitive starting 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 graphic element vertex in the geometric graphic element;
judging the relation between each first line segment in the basic primitive and the clipping plane according to the intersection relation between the basic primitive and the clipping plane formed by the vertexes of the first primitives during plane clipping;
updating the first cutting mark to be a second cutting mark or reserving the first cutting mark according to the relation between each first line segment and the cutting plane;
and judging whether all the first line segments in the basic primitive are processed completely, if so, setting initial mark information of the primitive vertex in the geometric primitive obtained after the basic primitive is cut according to the second cutting mark, and if not, continuously judging the relation between each first line segment in the basic primitive and the cutting plane.
In one embodiment of the invention, setting a first clipping label based on a first start label for a first primitive vertex in a geometric primitive comprises:
acquiring a primitive vertex packet of the first primitive vertex, and recording the number of the first primitive vertex;
detecting the first start marker and a second start marker in the primitive vertex packet;
and setting the first cutting mark according to the first starting mark.
In an embodiment of the present invention, after setting the first crop mark according to the first start mark, the method further includes:
judging the relation between the number of the first primitive vertexes and the number of the basic primitives:
if the number of the first primitive vertex is smaller than the number of the basic primitive vertices, continuously acquiring a primitive vertex packet of the first primitive vertex;
and if the number of the first primitive vertexes is equal to the number of the vertexes of the basic primitive, judging the relation between the basic primitive and the clipping plane formed by a plurality of first primitive vertexes during plane clipping.
In an embodiment of the present invention, before determining a relationship between each first line segment in a basic primitive and a clipping plane according to an intersection relationship between the basic primitive and the clipping plane formed by vertices of a plurality of first primitives during plane clipping, the method further includes:
sequentially judging the relation between each first primitive vertex and the clipping plane;
and performing combination judgment on the relationship between all the first primitive top points corresponding to the basic primitive and the clipping plane to obtain the relationship between the basic primitive and the clipping plane.
In an embodiment of the present invention, updating the first clipping flag to be the second clipping flag or keeping the first clipping flag according to a relationship between each of the first line segments and the clipping plane includes:
if the relation between the first line segment and the cutting plane is reserved, reserving the first cutting mark;
if the relation between the first line segment and the clipping plane is discarded and the first starting mark exists in the primitive vertex packet of the first line segment, updating the first clipping mark as the second clipping mark;
and if the relation between the first line segment and the clipping plane is intersection and the first starting mark exists in the primitive vertex packet of the first line segment, updating the first clipping mark as 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 clipped second line segment, 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 an embodiment of the present invention, setting, according to the second clipping flag, start flag information of a vertex of a second primitive in a geometric primitive obtained by clipping the basic primitive, includes:
and setting the initial mark information of the vertex of the first second graphic element in the clipped geometric graphic element as a first initial mark according to the second clipping mark, and updating the second clipping mark into the first clipping mark.
In an embodiment of the present invention, after determining a relationship between a basic primitive formed by a plurality of vertices of the first primitive and a clipping plane during plane clipping, the method further includes:
and updating the first clipping mark to 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 an embodiment of the present invention, after determining a relationship between a basic primitive formed by a plurality of vertices of the first primitive and a 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 provided by the invention has the advantages that the cutting mark is set, the cutting mark is updated in real time according to the relation between the basic primitive and the cutting plane in the plane cutting process, and then the initial mark of the primitive vertex is updated after the plane cutting, so that the problems of loss, change and the like of the initial mark of the primitive vertex caused by the plane cutting are solved, and the continuity of line segments inside the primitive and the independence of point drawing among different primitives are realized when the linear point drawing operation is carried out in the rasterization stage.
Drawings
Fig. 1 is a schematic flowchart of a method for managing starting marks of geometric primitives of a GPU in plane clipping according to an embodiment of the present invention;
FIG. 2 is a schematic flowchart of another method for managing starting marks of GPU geometric primitives in plane clipping according to an embodiment of the present invention;
FIG. 3 is a diagram illustrating a relationship between a primitive vertex and a clipping plane according to an embodiment of the present invention;
fig. 4 is a schematic diagram illustrating a relationship between a basic primitive and a clipping plane according to an embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to specific examples, but the embodiments of the present invention are not limited thereto.
Example one
Referring to fig. 1 and fig. 2, fig. 1 is a schematic flowchart of a method for managing GPU geometric primitive start markers in plane clipping according to an embodiment of the present invention, and fig. 2 is a schematic flowchart of another method for managing GPU geometric primitive start markers in plane clipping according to an embodiment of the present invention. The GPU geometric primitive starting mark management method in plane clipping comprises the following steps:
s1, setting a first clipping flag according to the first start flag of the first primitive vertex in the geometric primitive.
The method specifically comprises the following steps:
and S11, initializing variables.
Specifically, currentNum is set to record the number of vertices of the first primitive received, and is initialized to 0.
And S12, acquiring a primitive vertex packet of the first primitive vertex, and recording the number of the first primitive vertex.
Specifically, one primitive vertex corresponds to one primitive vertex packet, and when one first primitive vertex packet is read, the currentNum value is added by 1, that is, the number of the current first primitive vertices is added by 1, that is, currentNum + +.
S13, detecting the first start tag and the second start tag in the primitive vertex packet, i.e. parsing the start tag 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 indicates whether the vertex of the primitive is the start point of the geometric primitive. In this embodiment, the start mark information includes a first start mark and a second start mark, where the first start mark indicates that the vertex of the primitive is a start point of the geometric primitive, and the second start mark indicates that the vertex of the primitive is not a 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, if one point of the line segment is a starting point, the psFlag is 1, and if another point of the line segment is an end point, the psFlag is 0.
And S14, setting a first cutting mark according to the first starting mark.
The clipping marking information indicates whether the starting vertex of the geometric primitive is clipped in planar clipping. If the geometric graphic primitive is completely reserved, a first clipping mark is used for representing the geometric graphic primitive; if the geometric primitive is completely cut or partially cut, and the geometric primitive comprises a starting vertex (namely a primitive vertex packet of the geometric primitive has a first starting mark), representing by using a second cutting mark; if the geometric primitive is completely cut or partially cut, but the geometric primitive does not include the start vertex, no cutting mark information needs to be set. In the present embodiment, the cutting flag information is represented by psFlagClipped, the first cutting flag is represented by psFlagClipped being 0, and the second cutting flag is represented by psFlagClipped being 1. Taking a line segment as an example, in planar cutting, if the line segment is completely reserved, the psFlag clipped is 0, and if the line segment is partially cut or completely cut and the psFlag is 1, the psFlag clipped is 1.
It should be noted that the clipping flag information psFlagClipped is a variable introduced in the planar clipping process, and indicates whether the starting 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 analyzed, when psFlag in the primitive vertex packet is detected to be 1, the primitive vertex is indicated to be a starting point, and at this time, psFlag clipped is set to be 0; when the psFlag in the primitive vertex packet is detected to be 0, the primitive vertex is not the starting point, and the next step is directly carried out without setting the psFlag Clipped.
And 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 starting mark. This step is to determine whether the current primitive is completely received.
This step may be performed after the first cutting 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 is 1, the step is directly entered after setting psFlag clipped to 0; when psFlag is 0, the step is entered directly.
Specifically, the geometric primitives include ten kinds of primitives, i.e., points, lines, line bands, line rings, triangles, triangle bands, triangle fans, quadrilaterals, and polygons, and the basic primitives include three kinds of geometric primitives, i.e., points, lines, and triangles.
When the primitive vertex is received, all primitive vertices of a basic primitive corresponding to the geometric primitive need to be received to form a complete basic primitive. If the number of the first primitive vertex is less than that of the primitive vertices corresponding to the basic primitive, indicating that the obtained first primitive vertex cannot form a basic primitive, continuously obtaining the first primitive vertex; and if the number of the vertices of the first primitive is equal to the number of the vertices of the primitive corresponding to the basic primitive, indicating that the obtained vertices of the first primitive can form a basic primitive, and entering the next step.
For example, when a quadrilateral is divided into a plurality of triangles for clipping, at least three primitive vertices are received when a primitive vertex command is received, so that the three primitive vertices can form a complete triangle. If only two primitive vertexes are received, which indicates that a triangle cannot be formed, the next primitive vertex is continuously acquired, and if three primitive vertexes capable of forming the triangle are received, the next step is carried out.
In a specific embodiment, the relationship between the currentNum value and the primitive vertex number corresponding to the currently processed basic primitive is determined, and if the currentNum value is smaller than the primitive vertex number corresponding to the currently processed basic primitive, the step returns to continue to step S12, and the first primitive vertex is continuously obtained; if currentNum is equal to the number of the vertices of the primitive corresponding to the currently processed basic primitive, the next step is performed.
And S2, judging the relation between the basic primitive formed by the vertexes of the first primitives and the clipping plane during plane clipping.
And S21, sequentially judging the relation between the top point of each first primitive and the clipping plane.
Specifically, the coordinates of each first primitive vertex are sequentially substituted into the plane equation of the clipping plane to obtain the relationship between the first primitive vertex and the clipping plane. For example, referring to fig. 3, fig. 3 is a schematic diagram illustrating a relationship between a primitive vertex and a clipping plane according to an embodiment of the present invention; in fig. 3, the coordinates of the vertex Pt of the primitive are (x, y, z, w), where x, y, z are three-dimensional coordinates, and w is a perspective factor; if the point is within the plane planA, Ax + By + Cz + Dw is 0; if the point is on the plane planA, i.e. point P1, then Ax + By + Cz + Dw > 0; if the point is below the plane planA, point P2, then Ax + By + Cz + Dw < 0.
And S22, performing combination judgment on the relations between all the first primitive vertexes corresponding to the basic primitives and the clipping plane to obtain the relations between the basic primitives and the clipping plane.
Specifically, the combination judgment means: in a basic primitive, firstly, combining two first primitive vertexes, judging the relation between a line segment formed by the two first primitive vertexes and a clipping plane, and then, combining the line segments corresponding to the basic primitive to judge the relation between the basic primitive and the clipping plane. Further, the relationship between the basic primitive and the clipping plane includes three types: discard, retain, intersect. Wherein, discarding means discarding completely, which indicates that the basic primitive is completely cut out; reserving means completely reserving, which indicates that the basic primitive is not clipped; intersecting means that a part of the basic primitive is cut out and a part is remained.
Referring to fig. 4, fig. 4 is a schematic diagram illustrating a relationship between a basic primitive and a clipping plane according to an embodiment of the present invention. Taking the basic primitive formed by the three first primitive vertices as a triangle and clipping and reserving the primitive vertices above the clipping plane planA as an example, if the three vertices of the triangle are all above the clipping plane, i.e. T1, or all within the clipping plane, i.e. T2, the relationship between the triangle and the clipping plane is completely reserved; if all three vertices of the triangle are below the clipping plane, T3, then the relation between the triangle and the clipping plane is completely discarded; the relationship of a triangle to a clipping plane is an intersection if two vertices of the triangle are above the clipping plane, one vertex is below the clipping plane, i.e., T4, or one vertex is above the clipping plane and two vertices are below the clipping plane. For the point primitive, if the point primitive is on the clipping plane or the clipping plane, the relation between the point primitive and the clipping plane is reserved, and at the moment, the point primitive is directly output; and if the point primitive is below the clipping plane, discarding the relation between the point primitive and the clipping plane, and discarding the point primitive at the moment.
And 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 discarded, it indicates that the basic primitive is completely clipped, at this time, if the primitive vertex of the basic primitive contains the first start mark, the first clipping mark is updated to the second clipping mark, and then the step S1 is returned to continue to obtain the next primitive vertex; if the clipping flag of the basic primitive is the second clipping flag, the process returns to step S1 according to the second clipping flag, and continues to obtain the next primitive vertex. In a specific embodiment, when the relationship between the basic primitive and the clipping plane is discarded and the psFlag is equal to 1, if the current psFlag clipped value is 0, the psFlag clipped value is modified to 1, then the step returns to step S1 to directly obtain the next primitive vertex, and if the current psFlag clipped value is 1, the step returns to step S1 to directly obtain the next primitive vertex.
And S4, 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.
And if the relation between the basic primitive and the clipping plane is reserved, indicating that the basic primitive is completely reserved, not changing the first clipping mark, and then performing basic primitive output control according to the first clipping mark to output the basic primitive. In a specific embodiment, if the relationship 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 performed.
S5, judging the relation between each first line segment in the basic primitive and the clipping plane according to the intersection relation between the basic primitive and the clipping plane, updating the first clipping mark as 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 the basic primitive is clipped according to the second clipping mark.
S51, judging the relation between each first line segment in the basic primitive and the clipping plane according to the intersection relation between the basic primitive and the clipping plane, and updating the first clipping mark as a second clipping mark or keeping the first clipping mark according to the relation between each first line segment and the clipping plane.
And if the relationship between the basic primitive and the clipping plane is intersected, sequentially judging the relationship between each first line segment in the basic primitive and the clipping plane, and updating or reserving the first clipping mark according to the relationship between each first line segment and the clipping plane.
Specifically, the intersection of the basic primitive and the clipping plane indicates that part of the basic primitive is clipped and part of the basic primitive is reserved, in which case, the basic primitive does not include a point primitive, and only includes two primitives, namely a straight line and a triangle. Cutting two primitives of a straight line and a triangle by taking a line segment as a unit; that is, for a straight line, the relationship between the line segment where the straight line is located and the clipping plane is determined, and for a triangle, the relationship between three line segments in the triangle and the clipping plane is determined.
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 completely (whether all the first line segments in the basic primitive are processed completely) is judged, if so, the next step is carried out to control the output of the basic primitive, 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 and the first clipping mark is updated or reserved.
In a specific embodiment, if the relationship between the first line 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 discarded, the line segment is completely clipped, at this time, when a first starting mark exists in a 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 so, the next step is carried out 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, the next first line segment is clipped, and the first clipping mark is updated or reserved.
In a specific embodiment, when the relationship between the first line segment and the clipping plane is discarded and the psFlag is equal to 1, updating the psFlag clipping to 0 and then determining whether the processing of the current basic primitive is completed.
If the relation between the first line segment and the clipping plane is intersection, the line segment is partially clipped and partially reserved, at this time, when a first starting mark exists in a 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 intersection relation to obtain a second line segment, and then the coordinate of the intersection point is calculated. Specifically, when the intersection point is the starting point of the second line segment, assigning the original starting point header information of the current first line segment (in the starting point header information, the starting tag information thereof is the first starting tag, that is, psFlag is 1) 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 vertexes of the primitives reserved in the original basic primitives together to form a new geometric primitive, wherein the geometric primitive is a primitive obtained by cutting the basic primitives. And then, judging whether the current basic primitive is processed or not, if so, entering the next step to perform basic primitive output control, outputting the basic primitive, otherwise, continuously judging the relationship between the next first line segment in the basic primitive and the clipping plane, clipping the next first line segment, and updating or reserving the first clipping mark.
In a specific embodiment, when the relationship between the first line segment and the clipping plane is intersection and psFlag is 1, the psFlag is updated to 0 as psFlag 1, and then the subsequent steps are performed.
And S52, setting the start mark information of the vertex of the second primitive in the geometric primitive obtained after the basic primitive is cut according to the second cutting mark.
Specifically, when the basic primitive intersects with the clipping plane, the basic primitive is clipped to obtain a clipped geometric primitive, the clipped geometric primitive has a plurality of second primitive vertices, and the plurality of second primitive vertices are sequentially output according to the sequence from the starting point to the end point. And during output, detecting cutting mark information, and when detecting a second cutting mark, indicating that the geometric primitive is obtained after the initial vertex of the basic primitive is cut, and the first vertex of the second primitive vertex output array of the geometric primitive is 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 cutting mark is updated to be the first cutting mark. All second primitive vertices in the current output array are then output.
In a specific embodiment, when the vertices of the second primitive are output, the start labels of the vertices of the second primitive are updated according to whether the start vertex of the basic primitive is clipped (i.e., according to the value of psFlagClipped); if the psFlagClipped value is 1, which indicates that the initial vertex of the basic primitive has been cut, the first initial mark information in the current second primitive vertex output array is set to 1 (i.e., psFlag is 1), the initial marks of other vertices in the output array are not modified, and meanwhile, the cutting mark information of all initial vertices in the geometric primitive is updated to 0, i.e., the psFlagClipped values of all initial vertices in the geometric primitive are set to 0. And then outputting all second primitive vertices in the current output queue. For example, if a triangle is cut to obtain a quadrangle, when the vertices of the quadrangle are output, the psFlag of the first vertex is set to 1, the other three vertices are not modified, and the psFlag clipped values of the four vertices are set to 0.
In a specific embodiment, the determination sequence of the retention, the discard and the intersection of the basic primitive and the clipping plane can be arbitrary, that is, it can be determined whether the basic primitive is retained first, then the relationship is determined whether to be discarded, and finally the basic primitive is determined whether to be intersected; or judging whether the basic primitive is discarded or not, judging whether the basic primitive is reserved or not, and finally judging whether the basic primitive is intersected or not; or judging whether the basic primitive is reserved or not, judging whether the basic primitive is intersected or not, and finally judging whether the basic primitive is discarded or not; the present embodiment is not further limited.
Referring to fig. 2, fig. 2 provides a reasonable judgment sequence of the relationship between the basic primitive and the clipping plane. Of course, the determination order of the retention, the discard and the intersection of the basic primitive and the clipping plane in the embodiment of the present invention is not limited to the order shown in fig. 2.
In fig. 2, first, it is determined whether a basic primitive is completely cropped, if so, the relationship between the basic primitive and the cropping plane is discarded, and at this time, if the basic primitive includes an initial vertex, a psflag clipped value is set according to the discarded relationship, and subsequent operations are performed; if not, judging whether the basic primitive is completely reserved, and if the basic primitive is completely reserved, entering a step of outputting the current basic primitive; if the basic primitive is not completely reserved, part of the basic primitive is reserved, and part of the basic primitive is cut off, namely the relation between the basic primitive and the cutting plane is intersected, and at the moment, the cutting is carried out by taking a first line segment in the basic primitive as a unit.
When a first line segment in a basic primitive is taken as a unit for cutting, firstly, judging whether the first line segment is completely reserved, if so, judging whether the current basic primitive is processed completely, and if not, judging whether the first line segment is completely discarded; if the first line segment is completely discarded, whether the current basic primitive is processed or not is judged, if the first line segment is not completely discarded, the first line segment is intersected with the cutting plane, whether the intersection point is a new starting point or not is judged, if the intersection point is the new starting point (the starting point of the second line segment obtained after cutting), the original starting point packet header information of the current first line segment is assigned to the intersection point, and if the intersection point is not the new starting point, the intersection point is indicated to be a new end point, the original end point packet header information of the current first line segment is assigned to the intersection point. And after the intersection point is assigned, judging whether the current basic primitive is processed completely, if so, entering step S3, and if not, continuously processing the next line segment, namely, continuously cutting the next first line segment and updating or keeping the first cutting mark.
The initial mark management method of the embodiment updates the cutting mark in real time according to the relation between the basic primitive and the cutting plane in the plane cutting process by setting the cutting mark, and then updates the initial mark of the primitive vertex after the plane cutting, 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 the plane cutting are solved, and the continuity of the internal line segment of the primitive and the independence of the point drawing among different primitives are further realized when the linear point drawing operation is carried out in the rasterization stage.
The foregoing is a more detailed description of the invention in connection with specific preferred embodiments and it is not intended that the invention be limited to these specific details. For those skilled in the art to which the invention pertains, several simple deductions or substitutions can be made without departing from the spirit of the invention, and all shall be considered as belonging to the protection scope of the invention.

Claims (8)

1. A GPU geometric primitive start mark management method in plane clipping is characterized by comprising the following steps:
setting a first clipping mark according to a first starting mark of a first graphic element vertex in the geometric graphic element;
judging the relation between each first line segment in the basic primitive and the clipping plane according to the intersection relation between the basic primitive and the clipping plane formed by the vertexes of the first primitives during plane clipping;
updating the first cutting mark to be a second cutting mark or reserving the first cutting mark according to the relation between each first line segment and the cutting plane;
and judging whether all the first line segments in the basic primitive are processed completely, if so, setting initial mark information of the primitive vertex in the geometric primitive obtained after the basic primitive is cut according to the second cutting mark, and if not, continuously judging the relation between each first line segment in the basic primitive and the cutting plane.
2. The method of claim 1, wherein setting the first clipping flag based on a first start flag for a first primitive vertex in the geometric primitive comprises:
acquiring a primitive vertex packet of the first primitive vertex, and recording the number of the first primitive vertex;
detecting the first start marker and a second start marker in the primitive vertex packet;
and setting the first cutting mark according to the first starting mark.
3. The method of claim 2, wherein after setting the first clipping flag based on the first start flag, the method further comprises:
judging the relation between the number of the first primitive vertexes and the number of the basic primitives:
if the number of the first primitive vertex is smaller than the number of the basic primitive vertices, continuously acquiring a primitive vertex packet of the first primitive vertex;
and if the number of the first primitive vertexes is equal to the number of the vertexes of the basic primitive, judging the relation between the basic primitive and the clipping plane formed by a plurality of first primitive vertexes during plane clipping.
4. The method of claim 1, wherein before determining the relationship between each first line segment of the base primitive and the clipping plane according to the intersection relationship between the base primitive and the clipping plane formed by the vertices of the first primitive during plane clipping, the method further comprises:
sequentially judging the relation between each first primitive vertex and the clipping plane;
and performing combination judgment on the relationship between all the first primitive top points corresponding to the basic primitive and the clipping plane to obtain the relationship between the basic primitive and the clipping plane.
5. A method as recited in claim 1, wherein updating the first clipping label to a second clipping label or retaining the first clipping label based on a relationship between each of the first line segments and the clipping plane comprises:
if the relation between the first line segment and the cutting plane is reserved, reserving the first cutting mark;
if the relation between the first line segment and the clipping plane is discarded and the first starting mark exists in a primitive vertex packet of the first line segment, updating the first clipping mark as the second clipping mark;
and if the relation between the first line segment and the clipping plane is intersection and the first starting mark exists in a primitive vertex packet of the first line segment, updating the first clipping mark as 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 clipped second line segment, 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.
6. The method as claimed in claim 1, wherein the setting of the start mark information of the vertex of the second primitive in the geometric primitive obtained by clipping the basic primitive according to the second clipping mark comprises:
and setting the initial mark information of the vertex of the first second graphic element in the clipped geometric graphic element as a first initial mark according to the second clipping mark, and updating the second clipping mark into the first clipping mark.
7. The method of claim 1, wherein determining a relationship between a primitive formed by a plurality of vertices of the first primitive and the clipping plane during plane clipping further comprises:
and updating the first clipping mark to 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.
8. The method of claim 1, wherein determining a relationship between a primitive formed by a plurality of vertices of the first primitive and the clipping plane during plane clipping further comprises:
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.
CN201911421729.5A 2019-12-31 2019-12-31 GPU geometric primitive initial mark management method in plane clipping Active CN111210526B (en)

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 true CN111210526A (en) 2020-05-29
CN111210526B 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)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115760543A (en) * 2022-11-10 2023-03-07 格兰菲智能科技有限公司 Thread processing method, device, equipment and storage medium for ordered view of rasterizer

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080094412A1 (en) * 2006-10-23 2008-04-24 Guofang Jiao 3-d clipping in a graphics processing unit
CN109727184A (en) * 2018-12-12 2019-05-07 中国航空工业集团公司西安航空计算技术研究所 A kind of graphics processor three-dimensional cuts out circuit

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080094412A1 (en) * 2006-10-23 2008-04-24 Guofang Jiao 3-d clipping in a graphics processing unit
CN109727184A (en) * 2018-12-12 2019-05-07 中国航空工业集团公司西安航空计算技术研究所 A kind of graphics processor three-dimensional cuts out circuit

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
韩俊卿,葛永慧,张东升: "多边形窗口的矢量图形裁剪算法" *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115760543A (en) * 2022-11-10 2023-03-07 格兰菲智能科技有限公司 Thread processing method, device, equipment and storage medium for ordered view of rasterizer
CN115760543B (en) * 2022-11-10 2024-02-13 格兰菲智能科技有限公司 Thread processing method, device, equipment and storage medium for rasterizer ordered view

Also Published As

Publication number Publication date
CN111210526B (en) 2023-09-15

Similar Documents

Publication Publication Date Title
JP4769984B2 (en) Tile-based graphic rendering
CN1270278C (en) Z-buffer technology for figure heightening
US8194974B1 (en) Merge and removal in a planar map of an image
US9019271B2 (en) Z-culling method, three-dimensional graphics processing method and apparatus threrof
US20030117589A1 (en) Image processor, components thereof, and rendering method
CN109785417B (en) Method and device for realizing OpenGL cumulative operation
US6271848B1 (en) Image processing device, image processing method and storage medium for storing image processing programs
US8525843B2 (en) Graphic system comprising a fragment graphic module and relative rendering method
CN106297536B (en) Method and device for determining labeling position of planar graphic element name in electronic map
CN111210526A (en) GPU geometric primitive initial mark management method in plane clipping
KR20180038793A (en) Method and apparatus for processing image data
US20030095137A1 (en) Apparatus and method for clipping primitives in a computer graphics system
CN109389548B (en) Computer system and drawing processing method thereof
EP1197922A2 (en) Apparatus, system, and method for simplifying annotations on a geometric surface
US6580429B1 (en) Method of generating data for three-dimensional graphic recording medium and three-dimensional graphic system
JP2002183741A (en) Figure processing method
CN111241776B (en) TLM device for GPU geometric primitive start mark management in SystemC-based plane clipping
CN113342236A (en) Data processing method and device, electronic equipment and storage medium
JP7471512B2 (en) Drawing processing device, drawing processing system, drawing processing method, and drawing processing program
CN113807315B (en) Method, device, equipment and medium for constructing object recognition model to be recognized
CN113590885B (en) Vector graphic rasterization method
US7587086B2 (en) Identifying selected pixels in a digital image
CN118135076A (en) Rendering optimization method based on rasterization difference measurement
CN114387367A (en) Radar track display method and device
CN114581739A (en) Point cloud marking method and device based on feature recognition and electronic equipment

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