A method, device and chip for determining a starting point of processing of a target primitive

CN121639775BActive Publication Date: 2026-04-10METAX INTEGRATED CIRCUITS (SHANGHAI) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-02-05
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

Existing technologies require multiple calculations to determine the starting point for processing triangle primitives in GPU devices, resulting in significant computational power consumption and increased power consumption.

Method used

By determining the relative positional relationship between each corner point of the target primitive and the target processing box, sorting the triangle sides, and ending the processing when an intersection point is detected, the number of intersection point calculations is reduced.

Benefits of technology

This reduces the number of times the intersection of each edge of the triangle primitive with the target processing box is calculated, thus reducing computational power consumption and improving processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121639775B_ABST
    Figure CN121639775B_ABST
Patent Text Reader

Abstract

The application provides a target primitive processing starting point determination method, device and chip. The method comprises the following steps: determining a corner point position identifier corresponding to each corner point of a target primitive according to the relative position relationship between each corner point of the target primitive and all rectangular sides of a target processing frame; determining a processing order of each triangular side according to a preset rule; obtaining a current processing order and performing first processing on the triangular side corresponding to the current processing order; the first processing comprises: determining at least one target rectangular side according to a target rectangular side determination method corresponding to the target corner point position identifier; if the target triangular side and one or two target rectangular sides have at least one intersection point, one of the at least one intersection point is determined as a processing starting point, and the target primitive processing starting point determination method is ended. The application does not need to calculate the intersection points of each triangular side of a triangular primitive and all rectangular sides of a target processing frame, so that the required computing power is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of GPU, in particular to a method for determining a processing starting point of a target primitive, a device and a chip. BACKGROUND

[0002] In the process of rasterization module in GPU, a processing starting point is determined in the region corresponding to a target processing frame (generally referred to as ClipBox) according to a triangle primitive and the target processing frame determined by an upstream process / module.

[0003] In the prior art, if at least one corner point of the triangle primitive is inside the target processing frame, a position of any corner point inside the target processing frame or a corner point selected according to certain rules is determined as the processing starting point.

[0004] If the triangle primitive completely covers the target processing frame, one of the four corner points of the target processing frame is determined as the processing starting point.

[0005] However, if it does not belong to the above two cases, the intersection points of each edge of the triangle primitive and all edges of the target processing frame need to be calculated, and then the processing starting point is determined from these intersection points. In this process, at least 12 rounds of calculation are required to calculate the intersection points of each edge of the triangle primitive and all edges of the target processing frame, which consumes a large amount of computing power and increases the power consumption of the GPU device. Therefore, there is an urgent need for a method that can determine the processing starting point with less computing power consumption. SUMMARY

[0006] To solve the above technical problems, the technical scheme adopted by the present application is as follows:

[0007] In one aspect of the present application, a method for determining a processing starting point of a target primitive is provided, which comprises the following steps:

[0008] S100, determining a corner point position identifier corresponding to each corner point of the target primitive according to the relative position relationship between each corner point of the target primitive and all rectangular edges of the target processing frame; the target primitive is a triangle primitive; the target processing frame is a rectangular frame; the rectangular edge is an edge of the target processing frame; each corner point position identifier has a corresponding target rectangular edge determination method;

[0009] S200, determining the processing order of each triangle edge according to a preset rule; the triangle edge is an edge of the target primitive;

[0010] S300, obtaining the current processing order and performing first processing on the triangle edge corresponding to the current processing order.

[0011] The first processing includes the following steps:

[0012] S310, determining at least one target rectangular side according to a target corner position identifier corresponding to a target rectangular side determination method; the target corner position identifier is an identifier of a corner position corresponding to a starting point of a target triangular side; the target triangular side is a triangular side corresponding to a current processing order; for any triangular side, if the longitudinal coordinates of two end points of the triangular side are different, the starting point is the end point with the larger longitudinal coordinate; if the longitudinal coordinates of two end points of the triangular side are the same, the starting point is the end point with the smaller horizontal coordinate;

[0013] S320, if the target triangular side and the one or two target rectangular sides have at least one intersection point, determining one of the at least one intersection point as a processing starting point, and ending the processing starting point determination method of the target graphic primitive; otherwise, increasing the current processing order by one, and entering step S300.

[0014] In another aspect of the present application, a chip is provided, which is internally provided with a target circuit; the target circuit is used to implement the method according to any one of the above.

[0015] In another aspect of the present application, a graphic processing device is provided, which comprises the chip described above.

[0016] The present application has at least the following beneficial effects:

[0017] The target graphic primitive processing starting point determination method provided by the embodiments of the present application sorts three triangular sides of a target graphic primitive and processes them in turn, and when a certain triangular side is processed, if the current triangular side has an intersection point with a target processing frame, the intersection point can be determined as a starting processing point, and then the whole process is directly ended without determining whether other sides have intersection points, so that it is not necessary to calculate the intersection points of each triangular side of a triangular graphic primitive and all rectangular sides of a target processing frame, thereby reducing the required computing power.

[0018] Further, the embodiments of the present application only need to determine whether a certain triangular side has an intersection point with at most two target rectangular sides corresponding to a target corner position identifier, without calculating whether the triangular side has an intersection point with four rectangular sides, thereby further reducing the required computing power.

[0019] Furthermore, in this embodiment, for any triangular side, if the ordinates of the two endpoints of the triangular side are different, then its starting point is the endpoint with the larger ordinate; if the ordinates of the two endpoints of the triangular side are the same, then its starting point is the endpoint with the smaller abscissa. This ensures that the starting point used to determine the target rectangle side is basically a lower point on the triangular side, thereby limiting the extension direction of the triangular side. This makes the target rectangle side determined based on the target corner point position marker corresponding to the starting point more reasonable.

[0020] For example, such as Figure 2 As shown, if the target corner position is marked as "1000", then the corner corresponding to the target corner position is directly below the target processing box. In this case, only edge B3B4 will be determined as the target rectangle edge. This is because if the starting point of the triangle edge is directly below the target processing box, then if the triangle edge intersects with any one of the rectangle edges B1B2, B2B3, or B1B4, it will necessarily intersect with edge B3B4; if the triangle edge does not intersect with edge B3B4, it will necessarily not intersect with any one of the rectangle edges B1B2, B2B3, or B1B4. Therefore, at this time, only whether the current triangle edge intersects with edge B3B4 is calculated. Attached Figure Description

[0021] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0022] Figure 1 This is a flowchart of a method for determining the starting point of processing target primitives, provided in an embodiment of this application.

[0023] Figure 2 This is an exemplary reference diagram of the target graphic element and the target processing box in a method for determining the processing starting point of a target graphic element provided in an embodiment of this application.

[0024] Figure 3 This is another exemplary reference diagram of the target graphic element and the target processing box in a method for determining the processing starting point of a target graphic element provided in an embodiment of this application. Detailed Implementation

[0025] The technical solutions in the embodiments of this application will be clearly and completely described below. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0026] It is to be noted that, in the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular architectures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application can be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known methods, devices, circuits, and

[0027] It is to be understood that the terms "including", "comprising", "consisting" and "consisting essentially of", if used in the specification and / or claims, do not exclude additional, unrecited elements or steps. For the purposes of the present application, the terms "including" and "comprising" should be interpreted as specifying the presence of the stated features, integers, steps or components as referred to in the description rather than the absence thereof.

[0028] It is to be understood that the terms "including", "comprising", "consisting" and "consisting essentially of", if used in the specification and / or claims, do not exclude additional, unrecited elements or steps. For the purposes of the present application, the terms "including" and "comprising" should be interpreted as specifying the presence of the stated features, integers, steps or components as referred to in the description rather than the absence thereof.

[0029] It is to be understood that the terms "including", "comprising", "consisting" and "consisting essentially of", if used in the specification and / or claims, do not exclude additional, unrecited elements or steps. For the purposes of the present application, the terms "including" and "comprising" should be interpreted as specifying the presence of the stated features, integers, steps or components as referred to in the description rather than the absence thereof.

[0030] It is to be understood that the terms "including", "comprising", "consisting" and "consisting essentially of", if used in the specification and / or claims, do not exclude additional, unrecited elements or steps. For the purposes of the present application, the terms "including" and "comprising" should be interpreted as specifying the presence of the stated features, integers, steps or components as referred to in the description rather than the absence thereof.

[0031] It is to be understood that the terms "including", "comprising", "consisting" and "consisting essentially of", if used in the specification and / or claims, do not exclude additional, unrecited elements or steps. For the purposes of the present application, the terms "including" and "comprising" should be interpreted as specifying the presence of the stated features, integers, steps or components as referred to in the description rather than the absence thereof.

[0032] It will be understood that, in this specification and the accompanying claims, the term "if' is used in the sense of "if when, "if upon, "if in response to a determination," or "if in response to a detection" according to the context in which it is used. Similarly, the phrases "if determined" or "if [the recited condition or event] is detected" can be interpreted according to the context as "upon being determined," "in response to the determination," "upon detecting [the recited condition or event]," or "in response to the detection [of the recited condition or event]."

[0033] It will be understood that, in this specification and the accompanying claims, the terms "said," "above-described," "that," "the," "said," "described," "referred to," and the like can be interpreted according to the context as referring to the content previously mentioned.

[0034] It will be understood that, in this specification and the accompanying claims, the terms "first," "second," "third," and the like are used only to distinguish descriptions, and cannot be understood as indicating or implying relative importance, nor are they used to describe a specific order or sequence.

[0035] It will be understood that, in this specification and the accompanying claims, the terms "S100," "S200," "S300," and the like are only used to distinguish descriptions and / or references for convenience, and cannot be understood as indicating or implying a specific order or sequence of step or process execution. For example, "S100, obtaining data A; S200, obtaining data B; S300, obtaining C according to A and B;" is only provided as an example of a possible execution order, not a necessary execution order, and a person skilled in the art can determine an actual and possible execution order according to the functions and internal logic of each step. For example, "step S100 is executed before step S200, and then step S300 is executed," "step S200 is executed before step S100, and then step S300 is executed," "step S100 and step S200 are executed in parallel, and then step S300 is executed."

[0036] Please refer to Figure 1 The embodiment of the present application provides a method for determining the starting point of processing a target graphic element, which comprises the following steps:

[0037] S001, obtaining the corner point information S= (S1, S2, S3) of the target graphic element; S1= (SX1, SY1); S2= (SX2, SY2); S3= (SX3, SY3); wherein Si is the coordinate information of the i-th corner point of the target graphic element, SXi is the horizontal coordinate of the i-th corner point of the target graphic element, and SYi is the vertical coordinate of the i-th corner point of the target graphic element; the value of i is 1, 2 or 3.

[0038] S002, obtaining corner point information B=(BXmax, BXmin, BYmax, BYmin) of the target processing frame; wherein, BXmax is the maximum horizontal coordinate of the target processing frame, BXmin is the minimum horizontal coordinate of the target processing frame, BYmax is the maximum vertical coordinate of the target processing frame, and BYmin is the minimum vertical coordinate of the target processing frame.

[0039] S003, according to S and B, determining that all corner points of the target graphic element are located outside the target processing frame, and at least one corner point of the target processing frame is located outside the target graphic element, and then entering step S100.

[0040] From the above steps, it can be understood that the method for determining the processing starting point of the target graphic element provided by the embodiments of the present application is mainly aimed at the case that all corner points of the target graphic element are located outside the target processing frame, and at least one corner point of the target processing frame is located outside the target graphic element. Whether the target graphic element and the target processing frame meet the above relationship can be determined by using any existing technology. Alternatively, a corresponding processing method can be added at a certain link in a subsequent processing step, which is not limited in the embodiments of the present application. For example, if BXmin

[0041] In actual implementation process, step S003 can be after step S325. That is, it is not necessary to first determine whether at least one corner point of the target processing frame is located outside the target graphic element. The flow can also be: first determine whether there is a corner point of the graphic element in the target processing frame according to BXmin

[0042] Further, if there is a corner point in the target processing frame, the processing starting point can be determined according to the number of the corner points in the target processing frame.

[0043] Further, the method for determining whether at least one corner point of the target processing frame is located outside the target graphic element (i.e., whether the target processing frame is entirely contained in the graphic element) can be specifically to determine the minimum circumscribed rectangle of the graphic element, and if the target processing frame is contained in the minimum circumscribed rectangle, it can be determined that the target processing frame is entirely contained in the graphic element.

[0044] S100, determining, according to a relative position relationship between each corner point of the target graph element and all rectangular edges of the target processing frame, a corresponding corner point position identifier of each corner point of the target graph element. The target graph element is a triangular graph element; the target processing frame is a rectangular frame; the rectangular edge is an edge of the target processing frame; and the corner point position identifier comprises a flag bit corresponding to each rectangular edge.

[0045] A value of each flag bit satisfies the following condition:

[0046] If the target corner point is located on a side of a straight line of the flag bit corresponding rectangular edge close to a center point of the target processing frame, the value of the flag bit of the target corner point is a first preset value.

[0047] If the target corner point is located on a side of a straight line of the flag bit corresponding rectangular edge away from the center point of the target processing frame, the value of the flag bit of the target corner point is a second preset value. The target corner point is any corner point of the target graph element.

[0048] S110, sequentially processing each triangular edge according to a processing order, if there is a case that values of flag bits corresponding to a same rectangular edge in corner point position identifiers of two end points of a current triangular edge are both the second preset value, ignoring the current triangular edge and processing a next triangular edge; otherwise, determining whether there is a processing starting point between the current triangular edge and the target processing frame. The triangular edge is an edge of the target graph element.

[0049] Specifically, the corner point position identifier is composed of four binary digits. The first preset value is 0. The second preset value is 1.

[0050] In the embodiment, a first flag bit from right to left in the corner point position identifier corresponds to a left side edge of two vertical edges in the target processing frame, that is, a B1B4 edge in the following figure. Figure 2

[0051] A second flag bit from right to left in the corner point position identifier corresponds to an upper side edge of two horizontal edges in the target processing frame, that is, a B1B2 edge in the following figure. Figure 2

[0052] A third flag bit from right to left in the corner point position identifier corresponds to a right side edge of two vertical edges in the target processing frame, that is, a B2B3 edge in the following figure. Figure 2

[0053] A fourth flag bit from right to left in the corner point position identifier corresponds to a lower side edge of two horizontal edges in the target processing frame, that is, a B4B4 edge in the following figure. Figure 2

[0054] In some other embodiments, other corresponding relationships can also be adjusted, and the embodiment is not limited.​​​​

[0055] For the convenience of understanding, please refer to Figure 2 To understand the scheme, Figure 2 The region surrounded by the four corner points B1, B2, B3 and B4 in the figure is the target processing frame, and the triangular region surrounded by the three corner points A1, A2 and A3 is the target primitive. If the corner point of the target primitive is within the range of the target processing frame, the corner point is on the side close to the center point of the target processing frame compared to any one rectangular side of the target processing frame, which can also be understood as being on the side towards the inside of the target processing frame. Therefore, if the corner point of the target primitive is within the range of the target processing frame, the corner point position identifier of the corner point should be "0000". It should be noted that this is only an example. If the corner point of the target primitive is within the range of the target processing frame, the corner point within the range of the target processing frame can be directly determined as the processing starting point.

[0056] Similarly, if the target primitive and the target processing frame meet the conditions shown in Figure 2 , Figure 2 The corner point position identifier of the A1 corner point in the figure should be "1000", the corner point position identifier of the A2 corner point should be "0001", and the corner point position identifier of the A3 corner point should be "0110".

[0057] If the target primitive and the target processing frame meet the conditions shown in Figure 3 , Figure 3 The region surrounded by the four corner points B1, B2, B3 and B4 in the figure is the target processing frame, and the triangular region surrounded by the three corner points C1, C2 and C3 is the target primitive.

[0058] It can be determined that the corner point position identifier of the C1 corner point should be "1001", the corner point position identifier of the C2 corner point should be "0001", and the corner point position identifier of the C3 corner point should be "0110". At this time, the value of the first flag bit from right to left in the corner point position identifiers of the C1 corner point and the C2 corner point is 1, and the value of the second flag bit from right to left in the corner point position identifiers of the C1 corner point and the C2 corner point is 0. Figure 3 From the figure, it can also be clearly seen that the C1C2 side and the target processing frame do not have any intersection point, so it is not necessary to calculate the intersection point between the C1C2 side and the target processing frame.

[0059] The origin of the coordinate system in the embodiments of the present application, Figure 2 and Figure 3 is located at the upper left of the target processing frame. Therefore, in Figure 2 and Figure 3 , the vertical coordinate gradually increases from top to bottom, and the horizontal coordinate gradually increases from left to right.

[0060] Further, in the embodiments of the present application, if a certain corner point of the target graphic element is located on a straight line where a certain rectangular edge is located, a preset processing method can be used to determine the value of the flag bit corresponding to the straight line, for example, the value can be set as a first preset value or a second preset value by default. Or if the corner point is located on a straight line where a left vertical rectangular edge or an upper horizontal rectangular edge is located, the value of the corresponding flag bit is the first preset value, and if the corner point is located on a straight line where a right vertical rectangular edge or a lower horizontal rectangular edge is located, the value of the corresponding flag bit is the second preset value.

[0061] Or if a certain corner point of the target graphic element is located on a straight line where a certain rectangular edge is located, a preset processing method can be used to determine the value of the flag bit corresponding to the straight line, for example, the value can be set as a first preset value or a second preset value by default. Or if the corner point is located on a straight line where a left vertical rectangular edge or an upper horizontal rectangular edge is located, the value of the corresponding flag bit is the first preset value, and if the corner point is located on a straight line where a right vertical rectangular edge or a lower horizontal rectangular edge is located, the value of the corresponding flag bit is the second preset value.

[0062] The method for determining a processing starting point of a target graphic element provided in the embodiments of the present application determines a corner point position identifier corresponding to each corner point of the target graphic element according to the relative positional relationship between each corner point of the target graphic element and all rectangular edges of the target processing frame.

[0063] Meanwhile, the corner point position identifier includes a flag bit corresponding to each rectangular edge. The value of each flag bit meets the following conditions: if the target corner point is located on one side of a straight line where the rectangular edge corresponding to the flag bit is located and the side is close to the center point of the target processing frame, the value of the flag bit of the target corner point is a first preset value; if the target corner point is located on one side of a straight line where the rectangular edge corresponding to the flag bit is located and the side is far from the center point of the target processing frame, the value of the flag bit of the target corner point is a second preset value; and the target corner point is any corner point of the target graphic element.

[0064] In this way, if the values of the flag bits corresponding to the same rectangular edge in the corner point position identifiers of the two end points of the current triangular edge are both the second preset value, it indicates that the two end points of the current triangular edge are both located on one side of a rectangular edge of the target processing frame far from the center point of the target processing frame, so it can be determined that the current triangular edge does not exist with any rectangular edge of the target processing frame, and at this time, the current triangular edge can be ignored without calculating whether it exists with a certain rectangular edge of the target processing frame.

[0065] Therefore, the method for determining a processing starting point of a target graphic element provided in the embodiments of the present application can quickly determine whether the current triangular edge in the target graphic element exists with any rectangular edge in the target processing frame according to the two corner point position identifiers corresponding to the current triangular edge. And when it is determined that the two corner point position identifiers do not exist, the triangular edge does not need to be calculated for intersection points, thereby saving the number of calculations.

[0066] It should be noted that since the values of the corner point position identifier and the flag bit corresponding to the same rectangular edge are both the second preset value, both can be completed through simple numerical comparison, and the required computing power is far less than the computing power required for calculating whether two line segments intersect, so although the embodiment of the application adds the steps of determining the corner point position identifier and comparing the corner point position identifier, the overall required computing power is significantly less.

[0067] In an exemplary embodiment of the present application, step S110 comprises the following steps:

[0068] S200, determining the processing order of each triangular edge according to a preset rule.

[0069] S201, initializing the current processing order to 1.

[0070] S300, obtaining the current processing order and performing first processing on the triangular edge corresponding to the current processing order.

[0071] The first processing comprises the following steps:

[0072] S301, if the values of the flag bits corresponding to the same rectangular edge in the corner point position identifiers of the two endpoints of the target triangular edge are both the second preset value, then the current processing order is incremented by one, and step S300 is entered; otherwise, step S310 is entered; the target triangular edge is the triangular edge corresponding to the current processing order.

[0073] S310, determining at least one target rectangular edge according to the target corner point position identifier corresponding to the target rectangular edge determination method; the target corner point position identifier is the corner point position identifier corresponding to the starting point of the target triangular edge; for any triangular edge, if the vertical coordinates of the two endpoints of the triangular edge are different, then the starting point is the endpoint with the larger vertical coordinate; if the vertical coordinates of the two endpoints of the triangular edge are the same, then the starting point is the endpoint with the smaller horizontal coordinate.

[0074] S320, if the target triangular edge and the one or two target rectangular edges have at least one intersection point, then one of the at least one intersection points is determined as the processing starting point, and the processing starting point determination method of the target graphic primitive is ended; otherwise, the current processing order is incremented by one, and step S300 is entered.

[0075] Specifically, step S200 comprises the following steps:

[0076] S210, determine the first corner point as the corner point with the largest corresponding vertical coordinate among the three corner points of the target graph element, determine the second corner point as the corner point with the intermediate corresponding vertical coordinate among the three corner points of the target graph element, and determine the third corner point as the corner point with the smallest corresponding vertical coordinate among the three corner points of the target graph element; wherein if the vertical coordinates of two corner points of the target graph element are the same, the vertical coordinate of the corner point with the smaller corresponding horizontal coordinate is considered to be larger.

[0077] S220, determine the processing order of the triangular edge corresponding to the first corner point and the second corner point as 1.

[0078] S230, determine the processing order of the triangular edge corresponding to the first corner point and the third corner point as 2.

[0079] S240, determine the processing order of the triangular edge corresponding to the second corner point and the third corner point as 3.

[0080] Specifically, the determination method of the target rectangular edge corresponding to the target corner point position identifier can be that each target rectangular edge corresponding to the target corner point position identifier is preset, for example, the target corner point position identifier is "0011", and the corresponding target rectangular edge is the horizontal edge on the upper side and the vertical edge on the left side of the target processing frame.

[0081] It is worth noting that the number of target rectangular edges determined according to the determination method of the target rectangular edge corresponding to the target corner point position identifier is at most 2; at the same time, if the number of target rectangular edges determined according to the determination method of the target rectangular edge corresponding to the target corner point position identifier is 2, one of the two target rectangular edges is the horizontal edge of the target processing frame, and the other is the vertical edge of the target processing frame.

[0082] In an exemplary embodiment of the present application, the determination method of the target rectangular edge corresponding to the target corner point position identifier is to determine the rectangular edge corresponding to the flag bit with the second preset value in the target corner point position identifier as the target rectangular edge.

[0083] In the present application, if the target corner point is located on the side of the straight line of the flag bit corresponding rectangular edge close to the center point of the target processing frame, the value of the flag bit of the target corner point is the first preset value. If the target corner point is located on the side of the straight line of the flag bit corresponding rectangular edge away from the center point of the target processing frame, the value of the flag bit of the target corner point is the second preset value. Therefore, for any corner point position identifier, it can contain at most 2 flag bits with the second preset value.

[0084] In the embodiments of the present application, three triangular edges of a target primitive are sorted and processed in turn. When a certain triangular edge is processed, if the current triangular edge has an intersection point with the target processing frame, the intersection point is determined as the starting processing point, and then the whole process is directly ended without determining whether other edges have intersection points, so that the intersection points between each triangular edge of the triangular primitive and all rectangular edges of the target processing frame do not need to be calculated, thereby reducing the required computing power.

[0085] Further, in the embodiments of the present application, for a certain triangular edge, only the intersection points between the edge and at most two target rectangular edges corresponding to the target corner position identifier need to be determined, without calculating the intersection points with all four rectangular edges, thereby further reducing the required computing power.

[0086] Further, in the embodiments of the present application, for any triangular edge, if the longitudinal coordinates of the two end points of the triangular edge are different, the starting point is the end point with the larger longitudinal coordinate; if the longitudinal coordinates of the two end points of the triangular edge are the same, the starting point is the end point with the smaller horizontal coordinate. In this way, the starting point for determining the target rectangular edge is basically the lower point in the triangular edge, thereby limiting the extension direction of the triangular edge, so that the target rectangular edge determined according to the target corner position identifier corresponding to the starting point is more reasonable.

[0087] For example, if the target corner position identifier is "1000", the corner point corresponding to the target corner position identifier is directly below the target processing frame. At this time, only the B3B4 edge is determined as the target rectangular edge, because if the starting point of the triangular edge is directly below the target processing frame, the triangular edge will have an intersection point with the B3B4 edge if it has an intersection point with any one of the B1B2 edge, the B2B3 edge and the B1B4 edge, and will not have an intersection point with any one of the B1B2 edge, the B2B3 edge and the B1B4 edge if it does not have an intersection point with the B3B4 edge. Therefore, at this time, only whether the current triangular edge has an intersection point with the B3B4 edge needs to be calculated.

[0088] In an exemplary embodiment of the present application, the number of target rectangular edges determined according to the target corner position identifier corresponding target rectangular edge determination method is at most 2. If the number of target rectangular edges determined according to the target corner position identifier corresponding target rectangular edge determination method is 2, one of the two target rectangular edges is a horizontal edge of the target processing frame, and the other is a vertical edge of the target processing frame.

[0089] Step S320 includes the following steps:

[0090] S321, if the number of target rectangular edges is 1, determining whether the target triangular edge has an intersection point with the target rectangular edge.

[0091] S322, if the intersection exists, determining the intersection as the processing starting point and ending the processing starting point determination method of the target graphic primitive; otherwise, increasing the current processing order by one and entering step S300.

[0092] S323, if the number of the target rectangular edge is 2, determining whether the target triangle edge intersects with a horizontal edge of the two target rectangular edges.

[0093] S324, if the intersection exists, determining the intersection as the processing starting point and ending the processing starting point determination method of the target graphic primitive; otherwise, determining whether the target triangle edge intersects with a vertical edge of the two target rectangular edges.

[0094] S325, if the intersection exists, determining the intersection as the processing starting point and ending the processing starting point determination method of the target graphic primitive; otherwise, increasing the current processing order by one and entering step S300.

[0095] In the embodiment, if the number of the target rectangular edge is 2, the target triangle edge is determined to intersect with a horizontal edge of the two target rectangular edges first. In this way, in a large batch processing, the determined processing starting point is mostly located on the upper horizontal rectangular edge or the lower horizontal rectangular edge. In this way, in the subsequent scanning process, when performing line-by-line scanning, only one direction of upward or downward is needed, thereby reducing the calculation power consumption of the subsequent scanning process.

[0096] It should be noted that in the embodiment, steps S323, S324 and S325 are sequentially executed, and therefore those skilled in the art should understand that the meaning expressed by "if exists" in steps S324 and S325 is different and should be understood according to the meaning expressed by the previous step.

[0097] In the embodiment, a chip is also provided, which is internally provided with a target circuit; the target circuit is used to implement the method according to any one of the above.

[0098] In the embodiment, a graphic processing device is also provided, which includes the chip described above. For example, the graphic processing device can be a graphics card.

[0099] While certain embodiments of the application have been described herein in detail, those skilled in the art will appreciate that modifications can be made without departing from the scope and spirit of the application. The scope of the application is defined by the appended claims.

Claims

1. A method for determining a processing start point of a target primitive, characterized in that, The method comprises the following steps: S100, determining a corresponding corner point position identifier of each corner point of a target graph element according to a relative position relationship between each corner point of the target graph element and all rectangular sides of a target processing frame; the target graph element is a triangular graph element; the target processing frame is a rectangular frame; the rectangular side is a side of the target processing frame; each corner point position identifier has a corresponding target rectangular side determination method; S200, determining a processing order of each triangular side according to a preset rule; the triangular side is a side of the target graph element; S300, obtaining a current processing order and performing first processing on a triangular side corresponding to the current processing order; The first processing comprises the following steps: S310, determining at least one target rectangular side according to a target rectangular side determination method corresponding to a target corner point position identifier; the target corner point position identifier is a corner point position identifier corresponding to a starting point of a target triangular side; the target triangular side is a triangular side corresponding to a current processing order; for any triangular side, if the vertical coordinates of two end points of the triangular side are different, the starting point is the end point with the larger vertical coordinate; if the vertical coordinates of two end points of the triangular side are the same, the starting point is the end point with the smaller horizontal coordinate; S320, if the target triangular side and the one or two target rectangular sides have at least one intersection point, determining one of the at least one intersection point as a processing starting point and ending the target graph element processing starting point determination method; otherwise, increasing the current processing order by one and entering step S300.

2. The method according to claim 1, wherein Each corner point of the target graph element is outside the target processing frame; At least one corner point of the target processing frame is outside the target graph element.

3. The method of claim 1, wherein Step S200 comprises the following steps: S210, determining a first corner point as a corner point with the largest vertical coordinate among three corner points of the target graph element, determining a second corner point as a corner point with an intermediate vertical coordinate among the three corner points of the target graph element, and determining a third corner point as a corner point with the smallest vertical coordinate among the three corner points of the target graph element; if the vertical coordinates of two corner points of the target graph element are the same, the corner point with the smaller horizontal coordinate is considered to have the larger vertical coordinate; S220, determining a processing order of a triangular side corresponding to the first corner point and the second corner point as 1; S230, determining a processing order of a triangular side corresponding to the first corner point and the third corner point as 2; S240, determining a processing order of a triangular side corresponding to the second corner point and the third corner point as 3.

4. The method of claim 1, wherein Between step S200 and step S300, the method further comprises the following steps: S201, initializing the current processing order as 1.

5. The method of claim 1, wherein Step S320 comprises the following steps: S321, if the number of target rectangular sides is 1, determining whether the target triangular side and the target rectangular side have an intersection point; S322, if there is, determining the intersection point as a processing starting point and ending the target graph element processing starting point determination method; otherwise, increasing the current processing order by one and entering step S300.

6. The method of claim 5, wherein According to the target corner point position identifier corresponding to the target rectangular side determination method, the number of determined target rectangular sides is maximally 2.

7. The method of claim 6, wherein If the number of the target rectangular edges determined according to the target corner position identification corresponding target rectangular edge determination method is 2, one of the two target rectangular edges is the horizontal edge of the target processing frame, and the other is the vertical edge of the target processing frame.

8. The method of claim 7, wherein Step S320 further includes the following steps: S323, if the number of the target rectangular edges is 2, determining whether the target triangular edge intersects with the horizontal edge of the two target rectangular edges; S324, if yes, determining the intersection point as the processing starting point, and ending the target graphic primitive processing starting point determination method; otherwise, determining whether the target triangular edge intersects with the vertical edge of the two target rectangular edges; S325, if yes, determining the intersection point as the processing starting point, and ending the target graphic primitive processing starting point determination method; otherwise, increasing the current processing order by 1, and entering step S300.

9. A chip, characterized by The chip is internally provided with a target circuit; the target circuit is used for implementing the method according to any one of claims 1-8.

10. A graphics processing device, comprising: The chip according to claim 9 is included.

Citation Information

Patent Citations

  • Rasterization method, processor, system and electronic equipment

    CN118037931A

  • Rasterization method and device, processor, equipment, storage medium and program product

    CN119784872A