CN111241776B - TLM device for GPU geometric primitive start mark management in SystemC-based plane clipping - Google Patents

TLM device for GPU geometric primitive start mark management in SystemC-based plane clipping Download PDF

Info

Publication number
CN111241776B
CN111241776B CN201911414654.8A CN201911414654A CN111241776B CN 111241776 B CN111241776 B CN 111241776B CN 201911414654 A CN201911414654 A CN 201911414654A CN 111241776 B CN111241776 B CN 111241776B
Authority
CN
China
Prior art keywords
primitive
clipping
mark
unit
vertex
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
Application number
CN201911414654.8A
Other languages
Chinese (zh)
Other versions
CN111241776A (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 CN201911414654.8A priority Critical patent/CN111241776B/en
Publication of CN111241776A publication Critical patent/CN111241776A/en
Application granted granted Critical
Publication of CN111241776B publication Critical patent/CN111241776B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/20Processor architectures; Processor configuration, e.g. pipelining

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Generation (AREA)

Abstract

The invention relates to a TLM device for managing GPU geometric primitive initial marks in plane clipping based on SystemC, which comprises: a geometric primitive storage unit, configured to store a primitive vertex packet of a first primitive vertex in a geometric primitive; the primitive command analysis unit is used for setting a first clipping mark according to a first starting mark in the primitive vertex packet; the first primitive clipping unit is used for 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 the vertexes of a plurality of first primitives and the clipping plane during plane clipping, and 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 the primitive output control unit is used for setting the initial mark information of the vertex of the second primitive in the cut geometric primitive according to the second cutting mark when judging that all the first line segments in the basic primitive are processed. The TLM device greatly reduces the design cycle of the GPU through transaction-level modeling.

Description

TLM device for GPU geometric primitive start mark management in SystemC-based plane clipping
Technical Field
The invention belongs to the technical field of computer hardware modeling, and particularly relates to a TLM device for managing GPU geometric primitive initial marks in plane clipping based on SystemC.
Background
The object level modeling method (Transaction Level Modeling, TLM) is an advanced digital system modeling method that enables a system model to be quickly built at an early stage of a project, separating details of communication between models from details of functional units or communication architecture. The communication mechanism is modeled as channels, transaction requests typically occur when interface functions of these channel models are invoked, which encapsulate the underlying details of the information exchange. At the transaction level, TLM emphasizes the function of data transfer itself—the content of the data and the start and stop of the transfer, and as little as possible involves a specific implementation.
Domestic graphics processor chips (Graphic Processing Unit, GPU) are currently being independently developed in China, but since foreign imported commercial or military GPU chips are adopted in China until now, design experience is lacking in the aspect of independent development of the GPU chips, and core technologies of the GPU chips need to be explored and developed.
The large scale of GPU chip hardware logic, from system architecture document writing to register conversion stage circuit (Register Transfer Level, rtl) design realization, is a long project; and even if the rtl design is finished, a great deal of time is required for verifying the functional performance and the like, so that the whole design period and the design process of the auxiliary graphics processor are greatly increased, and the progress and reliability of independently developing the graphics processor project are reduced.
Disclosure of Invention
In order to solve the above-mentioned problems in the prior art, the present invention provides a TLM device for GPU geometry primitive start marker management in SystemC-based planar clipping. The technical problems to be solved by the invention are realized by the following technical scheme:
the embodiment of the invention provides a TLM device for managing the initial marks of GPU geometric primitives in plane clipping based on SystemC, which comprises: a geometric primitive storage unit, a primitive command analysis unit, a first primitive clipping unit and a primitive output control unit, wherein,
the geometric primitive storage unit is used for storing primitive vertex packets of first primitive vertices in the geometric primitives;
the primitive command analysis unit is used for setting a first clipping mark according to a first starting mark in the primitive vertex packet;
the first primitive clipping unit is used for 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 formed by a plurality of first primitive vertexes and the clipping plane when the plane clipping is performed, 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 continuously judging the relation between the first line segment and the clipping plane when judging that all the first line segments in the basic primitive are not processed uniformly;
and the primitive output control unit is used for setting the initial mark information of the second primitive vertex in the geometric primitive obtained after cutting the basic primitive according to the second cutting mark when judging that all the first line segments in the basic primitive are processed.
In one embodiment of the present invention, the primitive command parsing unit includes:
the primitive command acquisition unit is used for reading primitive vertex packages of the first primitive vertices and recording the number of the first primitive vertices;
a primitive command detecting unit configured to detect the first start marker and the second start marker in the primitive vertex packet;
and the cutting mark setting unit is used for setting the first cutting mark according to the first starting mark.
In one embodiment of the present invention, the primitive command parsing unit further includes:
the vertex number judging unit is used for continuously acquiring a primitive vertex packet of the first primitive vertex when judging that the number of the first primitive vertices is smaller than the number of the basic primitives; or when the number of the first primitive vertexes is judged to be 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, the method further includes a primitive position determining unit, where the primitive position determining unit includes:
the vertex position judging unit is used for judging the relation between each first primitive vertex and the clipping plane in sequence;
and the combination judging unit is used for 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, the first primitive clipping unit includes:
the line segment reserving unit is used for reserving the first cutting mark when judging that the relation between the first line segment and the cutting plane is reserved;
a line segment discarding unit, configured to update the first clipping mark to the second clipping mark when it is determined that 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;
and the line segment intersection unit is used for updating the first clipping mark to be the second clipping mark when judging that the relation between the first line segment and the clipping plane is intersection and the first initial mark exists in the primitive vertex packet of the first line segment, and 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 or 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, the primitive output control unit is configured to set start label information of a vertex of a first second primitive in the geometry primitive after clipping as a first start label according to the second clipping label, and update the second clipping label as the first clipping label.
In one embodiment of the present invention, further comprising:
and the second primitive clipping unit is used for updating the first clipping mark into a second clipping mark when the relation between the basic primitive and the clipping plane is discarding and the first starting mark exists in the primitive vertex packet of the basic primitive, and continuously acquiring the primitive vertex packet of the first primitive vertex according to the second clipping mark.
In one embodiment of the present invention, further comprising:
and the third primitive clipping unit is used for 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:
1. the TLM device can verify the geometric primitive initial mark management algorithm and the architecture in the plane clipping in the early stage of chip design through transaction-level modeling, provides comparison of simulation results in the later stage of rtl design, can find defects in algorithm, architecture and function in time, and provides accurate data analysis for system architecture personnel and rtl designer; meanwhile, the simulation hardware processing is faster than the hardware rtl development, the simulation speed is fast, the realization period is short, and the design period of the GPU is greatly shortened.
2. The TLM device solves the problems of losing and changing the initial mark of the vertex of the primitive caused by plane clipping, and ensures the continuity of the internal line segment of the primitive and the independence of the stippling among different primitives when the linear stippling operation is carried out in the rasterization stage.
Drawings
FIG. 1 is a schematic structural diagram of a TLM device for GPU geometry primitive start marker management in System-C-based planar clipping according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a primitive command parsing unit according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a TLM device for GPU geometry primitive start marker management in SystemC-based planar clipping according to an embodiment of the present invention;
FIG. 4 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. 5 is a schematic diagram of a basic primitive and clipping plane relationship provided in an embodiment of the present invention;
FIG. 6 is a schematic structural diagram of a TLM device for GPU geometry primitive start marker management in SystemC-based planar clipping according to an embodiment of the present invention;
fig. 7 is a flowchart of a method for managing a GPU geometry primitive start tag in SystemC-based planar clipping 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 embodiments of the present invention are not limited thereto.
Example 1
Referring to fig. 1, fig. 1 is a schematic structural diagram of a TLM device for GPU geometric primitive start marker management in system c-based planar clipping according to an embodiment of the present invention.
The TLM device (TLM microstructure) comprises a geometric primitive storage unit, a primitive command analysis unit, a first primitive clipping unit and a primitive output control unit. The geometric primitive storage unit receives and stores a first primitive vertex command output in the previous stage through the TLM port, wherein the first primitive vertex command comprises a primitive vertex packet of a first primitive vertex in the geometric primitive. The primitive command parsing unit is configured to set a first clipping flag according to a first start flag in the primitive vertex packet. The first primitive clipping unit is used for 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 when the plane clipping is performed, 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 continuously judging the relation between the first line segment and the clipping plane when judging that all the first line segments in the basic primitive are not processed uniformly. And the primitive output control unit is used for setting the starting mark information of the vertex of the second primitive in the geometric primitive obtained after cutting the basic primitive according to the second cutting mark when judging that all the first line segments in the basic primitive are processed.
Further, the geometric primitive storage unit, the primitive command parsing unit, the first primitive clipping unit and the primitive output control unit are connected through TLM ports, please refer to table 1, and table 1 illustrates TLM ports appearing in fig. 1. Specifically, taking a TLM port between a geometric primitive storage unit and a primitive command analysis unit as an example, the geometric primitive storage unit is connected with the primitive command analysis unit through the TLM port and is mainly used for storing the received application-level primitive vertex information and carrying out data transmission with the primitive command analysis unit through the TLM port; the primitive command analysis unit initiates an instruction for acquiring data to the geometric primitive storage unit, and the geometric primitive storage unit receives the instruction and sends the data to the primitive command analysis unit.
Table 1 transaction level interface specification presented in fig. 1
The embodiment of the invention adopts the transaction-level interface to connect the units, and can clearly show the behavior initiator, the behavior receiver and the data flow direction, thereby showing the connection relationship and the behavior relationship among the units.
In a specific embodiment, please refer to fig. 2, fig. 2 is a schematic diagram of a primitive command parsing unit according to an embodiment of the present invention. The primitive command analysis unit comprises a primitive command acquisition unit, a primitive command detection unit, a clipping mark setting unit and a vertex number judgment unit.
The primitive command acquisition unit is connected with the geometric primitive storage unit and is used for reading primitive vertex packets and recording the number of first primitive vertices. Specifically, currentNum is set to record the number of vertices of the first primitive received, and currentNum is initialized to 0. One primitive vertex corresponds to one primitive vertex packet, and whenever one 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++.
The primitive command detection unit is connected with the primitive command acquisition unit and is used for detecting a first starting mark and a second starting mark in the primitive vertex packet. 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.
The clipping mark setting unit is connected with the primitive command detection unit and is used for setting a first clipping mark according to a first starting mark. Specifically, the clipping flag information refers to whether the initial vertex of the geometric primitive is clipped in the planar 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.
Further, after obtaining a primitive vertex packet corresponding to the first primitive vertex, analyzing the primitive vertex packet, and when psflag=1 in the primitive vertex packet is detected, indicating that the primitive vertex is a starting point, and setting psFlag clipped=0 at this time; 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.
The vertex number judging unit is connected with the clipping mark setting unit and the primitive command detecting unit and is used for continuously acquiring primitive vertex packages of the first primitive vertices when judging that the number of the first primitive vertices, namely the currentNum value, is smaller than the number of the vertices of the basic primitives; or when the number of the vertexes of the first primitive, namely the currentNum value, is judged to be equal to the number of the vertexes of the basic primitive, updating or reserving the first clipping mark according to the relation between the basic primitive and the clipping plane.
Specifically, the vertex number determination unit may determine the vertex number after the clipping flag setting unit sets the first clipping flag, that is, sets psFlag clip=0, or may determine the vertex number after the primitive command detection unit detects the second start flag, that is, psflag=0.
Specifically, the geometric primitives include ten kinds of primitives including 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 including points, lines and triangles. Since the clipping is performed by dividing the geometric primitive into the basic primitives during the planar clipping, for example, the clipping is performed by dividing the line band into the line segments, the clipping is performed by dividing the triangle band into the triangles, and the clipping is performed by dividing the quadrilateral band into the triangles, when receiving the primitive vertices, all primitive vertices of one basic primitive divided by the geometric primitive need to be received to form one 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 vertexes is equal to the number of primitive vertexes corresponding to the basic primitive, the acquired first primitive vertexes can form a basic primitive, and then the primitive clipping unit is entered to clip the primitive. 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, 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 acquired first primitive vertex is output to a primitive clipping unit for primitive clipping.
In one embodiment, please refer to fig. 3, fig. 3 is a schematic structural diagram of another TLM device for GPU geometric primitive start marker management in SystemC-based planar clipping according to an embodiment of the present invention. The TLM device also comprises a primitive position judging unit, wherein the primitive position judging unit comprises a vertex position judging unit and a combination judging unit.
The vertex position judging unit is connected with the primitive command analyzing unit and is used for judging the relation between each first primitive vertex and the clipping plane in sequence. 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. 4, fig. 4 is a schematic diagram illustrating a relationship between a vertex and a clipping plane according to an embodiment of the present invention;
in fig. 4, 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.
The combination judging unit is connected with the vertex position judging unit and is used for carrying out combination judgment on the relations between all the first primitive vertices corresponding to the basic primitive and the clipping plane to obtain the relations 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. The relationship of the base primitive to 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. 5, fig. 5 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.
The TLM device further includes a second primitive clipping unit and a third primitive clipping unit. The first primitive clipping unit, the second primitive clipping unit and the third primitive clipping unit can be in parallel relation and are respectively connected with the primitive position judging unit; the second primitive clipping unit may be connected to the primitive position determining unit, and the third primitive clipping unit and the first primitive clipping unit may be sequentially connected, as shown in fig. 6, where fig. 6 is a schematic structural diagram of a TLM device for managing GPU geometric primitive start marks in planar clipping based on SystemC according to another embodiment of the present invention; however, the order among the first primitive clipping unit, the second primitive clipping unit, and the third primitive clipping unit is not limited thereto, and the present embodiment is not further limited thereto.
In fig. 6, the second primitive clipping unit is connected to the primitive position judging unit through the TLM port, and is configured to update the first clipping flag to the second clipping flag when the relationship between the primitive and the clipping plane is discarding and the primitive vertex packet of the primitive includes the first start flag, and continuously obtain the primitive vertex packet of the first primitive vertex according to the second clipping flag. The third primitive clipping unit is connected with the second primitive clipping unit through a TLM port and is used for 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. The first primitive clipping unit is connected with the third primitive clipping unit through the TLM port.
Specifically, if the relation between the basic primitive and the clipping plane is discarding, the basic primitive is completely clipped, at this time, if the primitive vertex packet of the basic primitive includes a first start flag (psflag=1), the first clipping flag is updated to be a second clipping flag, i.e. psFlag clip=0 modifies psFlag clip=1, and then the next primitive vertex is continuously acquired; if the clipping mark of the basic primitive is the second clipping mark, that is, the psFlagClipped value is 1, the vertex of the next primitive is directly acquired.
If the relation between the basic graphic element and the clipping plane is reserved, the basic graphic element is completely reserved, the first clipping mark is not changed, namely, the psFlagClipped value is kept to be 0, and then the basic graphic element is output according to the first clipping mark.
If the relation between the basic graphic element and the clipping plane is that the basic graphic element is partly clipped and partly reserved, the basic graphic element does not contain the graphic element and only has two graphic elements of straight line and triangle. 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. Accordingly, the first primitive clipping unit may further include a line segment retaining unit, a line segment discarding unit, and a line segment intersecting unit.
And the line segment retaining unit is used for retaining the first clipping mark when the relation between the first line segment and the clipping plane is retaining. Specifically, if the relation between the first line segment and the clipping plane is reserved, the line segment is completely reserved, the first clipping mark is not updated, that is, the psFlagClipped value is kept to be 0, and then whether all the first line segments in the basic primitive are processed is judged to be completed.
And the line segment discarding unit is used for updating the first clipping mark into the second clipping mark when the relation between the first line segment and the clipping plane is discarding and the first initial mark exists in the primitive vertex packet of the first line segment. Specifically, if the relation between the first line segment and the clipping plane is discard and psflag=1, the line segment is completely clipped, the first clipping flag is updated to be the second clipping flag, that is, psFlag clipping=0 is updated to psFlag clipping=1, and then it is determined whether all the first line segments in the basic primitive are processed.
And the line segment intersection unit is used for updating the first clipping mark into the second clipping mark when the relation between the first line segment and the clipping plane is the intersection and the first initial mark exists in the primitive vertex packet of the first line segment, assigning the header information of the initial point of the first line segment to the intersection when the intersection is the starting point of the second line segment after clipping, and assigning the header information of the end point of the first line segment to the intersection when the intersection is the end point of the second line segment. Specifically, if the relation between the first line segment and the clipping plane is intersecting, the line segment is partially clipped and partially remains, if psflag=1 is simultaneously obtained, the first clipping flag is updated to be the second clipping flag, that is, psFlag clip=0 is updated to be psFlag clip=1, the first line segment is clipped according to the intersecting relation to obtain the second line segment, and then the coordinates of the intersecting point are calculated. 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 together with the primitive vertexes reserved in the original basic primitive to form a new geometric primitive, wherein the geometric primitive is the primitive obtained by cutting the basic primitive.
After judging the relation between each first line segment and the clipping plane, judging whether all the first line segments in the basic graphic primitive are processed. When all the first line segments in the basic primitive are judged to be processed, setting initial mark information of primitive vertexes in the trimmed geometric primitive according to the second trimming mark; or when judging that all the first line segments in the basic graphic element are not processed uniformly, continuing to judge the relation between each first line segment in the basic graphic element and the clipping plane. Specifically, whether the processing of the current basic primitive is finished is judged, if yes, a primitive output control unit is entered, initial mark information of primitive vertexes in the cut geometric primitive is set according to the second cutting mark, the basic primitive is output, if not, the relation between the next first line segment in the basic primitive and the cutting plane is continuously judged, and the next first line segment is cut, updated or kept.
And the primitive output control unit is used for setting the initial mark information of the vertex of the second primitive in the geometric primitive obtained after cutting the basic primitive according to the second cutting mark when judging that all the first line segments in the basic primitive are processed. Specifically, after clipping, a clipped geometric primitive is obtained, 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 vertex mark 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 vertex initial mark in the vertex output array of the current second primitive is set to 1 (i.e. psFlag is 1), other vertex initial marks 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 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.
The TLM device of the embodiment can verify the geometric primitive initial mark management algorithm and the architecture in the plane clipping in the early stage of chip design through transaction-level modeling, provide comparison of simulation results in the later stage of rtl design, can find defects in algorithm, architecture and function in time, and provide accurate data analysis for system architecture personnel and rtl designer; meanwhile, the simulation hardware processing is faster than the hardware rtl development, the simulation speed is fast, the realization period is short, and the design period of the GPU is greatly shortened.
The TLM device of the present embodiment solves the problems of loss and change of the primitive vertex start marks caused by plane clipping, so that the continuity of the internal line segments of the primitives and the independence of the stippling among different primitives are achieved during the linear stippling operation in the rasterization stage.
Example two
On the basis of the first embodiment, please refer to fig. 6, fig. 6 is a flowchart of a GPU geometric primitive start mark management method in system c-based planar clipping according to an embodiment of the present invention, the management method includes the steps of:
s1, setting currentNum to record the number of the received first primitive vertexes, and initializing currentNum to 0.
S2, obtaining a first primitive vertex packet, and adding 1 to the number of the current first primitive vertices, namely currentNum++.
And S3, analyzing the start mark information psFlag in the first primitive vertex packet, judging whether the psFlag is 1, setting psFlagClipped=0 if the psFlag is 1, and setting psFlagClipped if the psFlag is 0.
S4, judging whether the current basic primitive is received completely: judging the relation between the currentNum value and the number of vertexes corresponding to the basic primitive processed currently; if the currentNum value is smaller than the number of the vertexes corresponding to the basic primitive processed currently, returning to the step S2 to continuously acquire a first primitive vertex packet; if the currentNum value is larger than the number of vertexes corresponding to the basic primitive processed currently, the next step is carried out.
S5, basic graphic primitive clipping and clipping mark setting.
S51, judging the relation between the basic graphic primitive and the clipping plane.
Specifically, the 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; and then, 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. The relationship of the base primitive to the clipping plane includes three types: discard, reserve, intersect.
S52, basic graphic primitive clipping and clipping mark setting.
First, judging whether the basic graphic element is completely cut off:
if the basic primitive is completely cut and psflag=1, judging whether psFlag is 0, if psFlag is 0, setting psFlag to be 1, returning to step S2 to continuously acquire the first primitive vertex packet, and if psFlag is not 0, directly returning to step S2 to continuously acquire the first primitive vertex packet.
If the basic graphic element is not completely cut off, judging whether the basic graphic element is completely reserved: if the basic primitive is completely reserved, the psFlagClipped value is kept to be 0, and the current basic primitive is output; if the basic primitive is not completely reserved, the basic primitive is intersected with the clipping plane, clipping is performed by taking the first line segment as a unit, and the relation between the first line segment and the clipping plane is judged.
When judging the relation between the first line segment and the clipping plane, judging whether the first line segment is completely reserved, if so, keeping the psFlagClipped value to be 0, then judging whether the current basic graphic element is processed, and if not, continuing to take the next first line segment for clipping; if the current basic primitive is processed, entering the next primitive output control;
if the current first line segment is not completely reserved, judging whether the current first line segment is completely discarded, if the current first line segment is completely discarded and psflag=1, updating a psFlagClipped value to be 1, then judging whether the current basic graphic element is processed, and if the current basic graphic element is not processed, continuing to take the next first line segment for cutting; if the current basic primitive is processed, entering the next primitive output control;
if the current first line segment is not completely discarded, an intersection point exists between the current first line segment and the clipping plane, at this time, if psflag=1, the psFlagClipped value is updated to be 1, the intersection point is judged to be the starting point or the ending point of the second line segment after clipping, and if the intersection point is about to become a new starting point, the header information of the original starting point of the current first line segment is assigned to the intersection point; if the intersection point is about to become a new end point, the header information of the original end point of the current first line segment is assigned to the intersection point.
After the intersection point is assembled, if the current basic primitive is not processed, continuing to take down a first line segment for cutting; if the current basic primitive is processed, entering the next primitive output control, and sequentially outputting a plurality of second primitive vertexes from the starting point to the end point.
S6, graphic primitive output control.
And when the second primitive vertexes are output, updating the starting marks of the second primitive vertexes according to the value of the psFlagClipped, if the value of the psFlagClipped is 1, setting the starting mark of the first vertex in the current second primitive vertex output array to be 1, and clearing the psFlagClipped to be 0. And then outputting all second primitive vertices in the current output queue.
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 TLM device for GPU geometry primitive start marker management in SystemC-based planar clipping, comprising: a geometric primitive storage unit, a primitive command analysis unit, a first primitive clipping unit and a primitive output control unit, wherein,
the geometric primitive storage unit is used for storing primitive vertex packets of first primitive vertices in the geometric primitives;
the primitive command analysis unit is used for setting a first clipping mark according to a first starting mark in the primitive vertex packet;
the first primitive clipping unit is used for 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 formed by a plurality of first primitive vertexes and the clipping plane when the plane clipping is performed, 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 continuously judging the relation between the first line segment and the clipping plane when judging that all the first line segments in the basic primitive are not processed uniformly; the first primitive clipping unit includes: the line segment reserving unit is used for reserving the first cutting mark when judging that the relation between the first line segment and the cutting plane is reserved; a line segment discarding unit, configured to update the first clipping mark to the second clipping mark when it is determined that 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; a line segment intersecting unit, configured to update the first clipping mark to be the second clipping mark when it is determined that 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, and assign the start 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, or assign the end header information of the first line segment to the intersection point when the intersection point is the end point of the second line segment;
and the primitive output control unit is used for setting the initial mark information of the second primitive vertex in the geometric primitive obtained after cutting the basic primitive according to the second cutting mark when judging that all the first line segments in the basic primitive are processed.
2. The TLM apparatus of GPU geometry primitive start tag management in SystemC-based planar clipping of claim 1, wherein said primitive command parsing unit comprises:
the primitive command acquisition unit is used for reading primitive vertex packages of the first primitive vertices and recording the number of the first primitive vertices;
a primitive command detecting unit configured to detect the first start marker and the second start marker in the primitive vertex packet;
and the cutting mark setting unit is used for setting the first cutting mark according to the first starting mark.
3. The TLM apparatus for GPU geometry primitive start tag management in SystemC-based planar clipping of claim 2, wherein said primitive command resolution unit further comprises:
the vertex number judging unit is used for continuously acquiring a primitive vertex packet of the first primitive vertex when judging that the number of the first primitive vertices is smaller than the number of the basic primitives; or when the number of the first primitive vertexes is judged to be 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 TLM apparatus for GPU geometry primitive start tag management in SystemC-based planar clipping of claim 1, further comprising a primitive location determination unit, wherein said primitive location determination unit comprises:
the vertex position judging unit is used for judging the relation between each first primitive vertex and the clipping plane in sequence;
and the combination judging unit is used for 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 TLM device of claim 1, wherein said primitive output control unit is configured to set start tag information of a vertex of a first second primitive in the trimmed geometric primitive as a first start tag according to the second clipping tag, and update the second clipping tag as the first clipping tag.
6. The TLM apparatus for GPU geometry primitive start tag management in SystemC-based planar clipping of claim 1, further comprising:
and the second primitive clipping unit is used for updating the first clipping mark into a second clipping mark when the relation between the basic primitive and the clipping plane is discarding and the first starting mark exists in the primitive vertex packet of the basic primitive, and continuously acquiring the primitive vertex packet of the first primitive vertex according to the second clipping mark.
7. The TLM apparatus for GPU geometry primitive start tag management in SystemC-based planar clipping of claim 1, further comprising:
and the third primitive clipping unit is used for 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.
CN201911414654.8A 2019-12-31 2019-12-31 TLM device for GPU geometric primitive start mark management in SystemC-based plane clipping Active CN111241776B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911414654.8A CN111241776B (en) 2019-12-31 2019-12-31 TLM device for GPU geometric primitive start mark management in SystemC-based plane clipping

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911414654.8A CN111241776B (en) 2019-12-31 2019-12-31 TLM device for GPU geometric primitive start mark management in SystemC-based plane clipping

Publications (2)

Publication Number Publication Date
CN111241776A CN111241776A (en) 2020-06-05
CN111241776B true CN111241776B (en) 2023-10-20

Family

ID=70869012

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911414654.8A Active CN111241776B (en) 2019-12-31 2019-12-31 TLM device for GPU geometric primitive start mark management in SystemC-based plane clipping

Country Status (1)

Country Link
CN (1) CN111241776B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5877773A (en) * 1997-05-30 1999-03-02 Hewlett-Packard Company Multi-pass clipping in a geometry accelerator
CN108022202A (en) * 2017-11-24 2018-05-11 中国航空工业集团公司西安航空计算技术研究所 A kind of advanced blanking geometry engines structure
CN108447015A (en) * 2018-03-27 2018-08-24 长沙景嘉微电子股份有限公司 A kind of device and method for realizing User Defined clipping function in GPU
CN109712063A (en) * 2018-12-12 2019-05-03 中国航空工业集团公司西安航空计算技术研究所 A kind of graphics processor Plane Crop circuit
CN109727184A (en) * 2018-12-12 2019-05-07 中国航空工业集团公司西安航空计算技术研究所 A kind of graphics processor three-dimensional cuts out circuit

Family Cites Families (1)

* Cited by examiner, † Cited by third party
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

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5877773A (en) * 1997-05-30 1999-03-02 Hewlett-Packard Company Multi-pass clipping in a geometry accelerator
CN108022202A (en) * 2017-11-24 2018-05-11 中国航空工业集团公司西安航空计算技术研究所 A kind of advanced blanking geometry engines structure
CN108447015A (en) * 2018-03-27 2018-08-24 长沙景嘉微电子股份有限公司 A kind of device and method for realizing User Defined clipping function in GPU
CN109712063A (en) * 2018-12-12 2019-05-03 中国航空工业集团公司西安航空计算技术研究所 A kind of graphics processor Plane Crop circuit
CN109727184A (en) * 2018-12-12 2019-05-07 中国航空工业集团公司西安航空计算技术研究所 A kind of graphics processor three-dimensional cuts out circuit

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
田泽 ; 邓惠子 ; 张骏 ; 许宏杰 ; 黎小玉 ; .图形处理器剪裁加速器的设计与实现.微电子学与计算机.2015,(09),全文. *
邓惠子 ; 韩俊刚 ; 马超 ; 杨婷 ; 查理 ; .改进的三维剪裁算法及其硬件设计.电子科技.2013,(07),全文. *
韩俊卿,葛永慧,张东升.多边形窗口的矢量图形裁剪算法.太原理工大学学报.2005,(02),全文. *

Also Published As

Publication number Publication date
CN111241776A (en) 2020-06-05

Similar Documents

Publication Publication Date Title
US20230186546A1 (en) 3-d graphics rendering with implicit geometry
JP4769984B2 (en) Tile-based graphic rendering
US7463261B1 (en) Three-dimensional image compositing on a GPU utilizing multiple transformations
US7765500B2 (en) Automated generation of theoretical performance analysis based upon workload and design configuration
CN108519094A (en) Local paths planning method and cloud processing end
JP4035978B2 (en) Three-dimensional shape model evaluation method, generation method, and apparatus
CN110036375B (en) Out-of-order cache return
US8379019B2 (en) Fast triangle reordering for vertex locality and reduced overdraw
CN108830385A (en) deep learning model training method and device and computer readable storage medium
CN116883569A (en) Graphics processing system, graphics processing method, and computer-readable storage medium
US20190228574A1 (en) Identifying primitives in input index stream
CN112017262B (en) Pavement marker generation method and device, storage medium and electronic equipment
GB2617182A (en) Reducing redundant rendering in a graphics system
CN111241776B (en) TLM device for GPU geometric primitive start mark management in SystemC-based plane clipping
CN110192225B (en) Out-of-order pixel shader derivation
CN115272549B (en) Storage and rendering scheduling method and device for oversized digital scene
CN111028128A (en) GPU (graphics processing Unit) -oriented vertex output control method and unit based on SystemC
US20220414986A1 (en) Segmenting three-dimensional meshes in graphical applications based on detection of elongated shapes
CN114936610A (en) Electronic fence splitting method and device
CN111783180B (en) Drawing splitting method and related device
CN111210526A (en) GPU geometric primitive initial mark management method in plane clipping
JP2006277672A (en) Three-dimensional model processing method
CN107103642B (en) Three-dimensional model voxelization entity filling method
CN117541461B (en) Arc scaling drawing method, device, equipment and medium
CN116820580B (en) Instruction execution method, system and device, graphics processor 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