Method and device for determining processing starting point of target primitive and chip

By determining the corner position relationships and triangle side sorting of the target primitives, the problem of excessive computational cost of starting point processing for triangle primitives in GPU devices is solved, achieving a more efficient processing flow.

CN121639775AActive Publication Date: 2026-03-10METAX INTEGRATED CIRCUITS (SHANGHAI) CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-02-05
Publication Date
2026-03-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, the triangle sides are sorted, and the processing ends when an intersection is detected, thus avoiding the calculation of all intersections.

Benefits of technology

This reduces the number of times the intersection points of the triangle primitives and the target processing box are calculated, thereby reducing computational power consumption and improving processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121639775A_ABST
    Figure CN121639775A_ABST
Patent Text Reader

Abstract

The invention provides a method and a device for determining a processing starting point of a target primitive and a chip, and the method comprises the following steps: determining an angular point position identifier corresponding to each angular point of the target primitive according to a relative position relation between each angular point of the target primitive and all rectangular edges of a target processing frame; determining a processing sequence of each triangular edge according to a preset rule; obtaining a current processing sequence, and performing first processing on the triangular edge corresponding to the current processing sequence; the first processing comprises the steps of determining at least one target rectangular edge according to a target rectangular edge determination method corresponding to the target angular point position identifier; and if at least one intersection point exists between the target triangular edge and one or two target rectangular edges, 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 primitive. According to the method, the intersection points of each triangular edge of the triangular primitive and all rectangular edges of the target processing frame do not need to be calculated, so that the required calculation power is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of GPUs, and in particular to a method, device, and chip for determining the processing starting point of a target primitive. Background Technology

[0002] One step in the operation of the rasterization module inside the GPU is to process the triangular primitives and target processing bounding boxes (usually called ClipBoxes) determined by the upstream process / module to identify a processing starting point within the area corresponding to the target processing box. This processing starting point is generally used as the scanning starting point in subsequent scanning steps.

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

[0004] If the triangular primitive completely covers the target processing box, one of the four corner points of the target processing box will be determined as the processing start point.

[0005] However, if neither of the above two scenarios applies, it's necessary to calculate the intersection points of each edge of the triangle primitive with all edges of the target processing box, and then determine the processing start point from these intersection points. This process requires at least 12 rounds of computation, consuming significant computing power and increasing GPU power consumption. Therefore, a method that can determine the processing start point with less computational power is urgently needed. Summary of the Invention

[0006] To address the aforementioned technical problem, the technical solution adopted in this application is as follows: In one aspect of this application, a method for determining the processing starting point of a target primitive is provided, the method comprising the following steps: S100, based on the relative positional relationship between each corner point of the target graphic element and all rectangular sides of the target processing box, determine the corner point position identifier corresponding to each corner point of the target graphic element; the target graphic element is a triangular graphic element; the target processing box is a rectangular box; the rectangular sides are the sides of the target processing box; each corner point position identifier has a corresponding target rectangular side determination method; S200, determine the processing order of each triangular edge according to preset rules; the triangular edge is the edge of the target primitive; S300, obtain the current processing order, and perform the first processing on the triangle edge corresponding to the current processing order; The first process includes the following steps: S310, determining at least one target rectangle side according to a target corner position identifier corresponding target rectangle side determination method; the target corner position identifier is an identifier of a corner point corresponding to a starting point of a target triangle side corresponding to a current processing order; for any triangle side, if the longitudinal coordinates of two end points of the triangle 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 triangle side are the same, the starting point is the end point with the smaller horizontal coordinate; S320, if the target triangle side and the one or two target rectangle 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 graphic primitive processing starting point determination method; otherwise, increasing the current processing order by one, and entering step S300.

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

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

[0009] The present application has at least the following beneficial effects: The target graphic primitive processing starting point determination method provided by the embodiments of the present application sorts three triangle sides of a target graphic primitive and processes them in turn, and when a certain triangle side is processed, if the current triangle 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 the intersection points between each triangle side of a triangle graphic primitive and all rectangle sides of the target processing frame do not need to be calculated, thereby reducing the required computing power.

[0010] Further, the embodiments of the present application only need to determine whether there is an intersection point between a certain triangle side and at most two target rectangle sides corresponding to a target corner position identifier, without calculating whether there is an intersection point with four rectangle sides, thereby further reducing the required computing power.

[0011] Further, for any triangle side, if the longitudinal coordinates of two end points of the triangle 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 triangle side 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 rectangle side is basically the lower point in the triangle side, thereby limiting the extension direction of the triangle side, so that the target rectangle side determined according to the target corner position identifier corresponding to the starting point is more reasonable.

[0012] For example, as shown in FIG. 4, a target graphic primitive is a triangle graphic primitive, and a target processing frame is a rectangle frame. The target graphic primitive has three triangle sides, and the target processing frame has four rectangle sides. The target graphic primitive and the target processing frame are processed in the order of triangle side 1, triangle side 2 and triangle side 3. Figure 2As shown, if the target corner point position identifier is "1000", the target corner point position identifier corresponds to a corner point directly below the target processing frame. At this time, only the B3B4 side is determined as the target rectangular side, because if the starting point of the triangular side is directly below the target processing frame, the triangular side will intersect with the B3B4 side if it intersects with any one of the B1B2 side, the B2B3 side, and the B1B4 side, and the triangular side will not intersect with any one of the B1B2 side, the B2B3 side, and the B1B4 side if it does not intersect with the B3B4 side. Therefore, at this time, only whether the current triangular side intersects with the B3B4 side needs to be calculated. BRIEF DESCRIPTION OF DRAWINGS

[0013] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0014] Figure 1 A flowchart of a target graphic primitive processing starting point determination method provided by an embodiment of the present application.

[0015] Figure 2 An exemplary reference diagram of a target graphic primitive and a target processing frame in a target graphic primitive processing starting point determination method provided by an embodiment of the present application.

[0016] Figure 3 Another exemplary reference diagram of a target graphic primitive and a target processing frame in a target graphic primitive processing starting point determination method provided by an embodiment of the present application. DETAILED DESCRIPTION

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

[0018] It is worth noting that, in the following description, specific details such as specific system structures, techniques, etc. are presented in order to thoroughly understand the embodiments of the present application, but those skilled in the art should understand that the present application can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid unnecessary details that hinder the description of the present application.

[0019] It should be understood that in this application specification and the appended claims, the terms "comprising," "including," "including but not limited to," "including but not limited to," "mainly composed of," or "mainly made of" all indicate the presence of the described features, integrals, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or collections thereof.

[0020] It should be understood that in this application specification and the appended claims, the use of the terms "consisting of" or "component of" indicates the presence of the described feature, integral, step, operation, element and / or component, but excludes the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.

[0021] It should be understood that, in this specification and the appended claims, the term "and" indicates a combination in which multiple of the associated listed items exist simultaneously. For example, "A, B, C, and D" means a combination in which "A and B and C and D exist simultaneously".

[0022] It should be understood that in this application specification and the appended claims, the use of the term "or" indicates a combination in which one of the associated listed items exists alone. For example, "A, B, C or D" refers to the four combinations of "A alone", "B alone", "C alone", and "D alone".

[0023] It should be understood that, in this application specification and the appended claims, the term "and / or" indicates any combination of one or more of the associated listed items, as well as all possible combinations, and includes such combinations. For example, "A and / or B" refers to the three combinations of "A alone," "B alone," or "A and B simultaneously." For example, "A, B, and / or C" refers to the seven combinations of "A alone," "B alone," "C alone," "A and B simultaneously," "A and C simultaneously," "B and C simultaneously," and "A, B, and C simultaneously."

[0024] It should be understood that, in this specification and the appended claims, the term "if" is used to indicate, depending on the context, "in the case of," "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if [the described condition or event] is detected" can be interpreted, depending on the context, as "once determined," "in response to determination," "once [the described condition or event] is detected," or "in response to detection of [the described condition or event]."

[0025] It should be understood that in this application specification and the appended claims, the terms "the," "the," "the," "the," "the," "the described," "the mentioned," etc., may be understood, depending on the context, to refer to the content mentioned above.

[0026] It should be understood that in this application specification and the appended claims, the terms "first," "second," "third," etc., are used only for distinguishing descriptions and should not be construed as indicating or implying relative importance, nor are they used to describe a specific order or sequence.

[0027] It should be understood that in this application specification and appended claims, the designations such as "S100," "S200," and "S300" are used only for distinguishing descriptions and / or convenience of reference, and should not be construed as indicating or implying a specific order or sequence of execution of steps or processes. For example, "S100, obtain data A; S200, obtain data B; S300, obtain C based on A and B;" is merely an example providing a feasible execution order, not a necessary one. Those skilled in the art can determine the actual and feasible execution order based on the function and internal logic of each step. For example, "Step S100 is executed before step S200, then step S300 is executed," "Step S200 is executed before step S100, then step S300 is executed," or "Steps S100 and S200 are executed in parallel, then step S300 is executed."

[0028] Please refer to Figure 1 As shown in the figure, this application embodiment provides a method for determining the processing starting point of a target primitive, the method including the following steps: S001, obtain the corner information of the target element: S = (S1, S2, S3); S1 = (SX1, SY1); S2 = (SX2, SY2); S3 = (SX3, SY3); where Si is the coordinate information of the i-th corner of the target element, SXi is the x-coordinate of the i-th corner of the target element, and SYi is the y-coordinate of the i-th corner of the target element; i takes the value of 1, 2 or 3.

[0029] S002, obtain the corner information of the target processing box B = (BXmax, BXmin, BYmax, BYmin); where BXmax is the maximum horizontal coordinate of the target processing box, BXmin is the minimum horizontal coordinate of the target processing box, BYmax is the maximum vertical coordinate of the target processing box, and BYmin is the minimum vertical coordinate of the target processing box.

[0030] S003, based on S and B, if it is determined that all corner points of the target element are located outside the target processing frame, and at least one corner point of the target processing frame is located outside the target element, then proceed to step S100.

[0031] Based on the above steps, it can be understood that the method for determining the processing starting point of a target graphic element provided in this application mainly targets the case where 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. Determining whether the target graphic element and the target processing frame conform to the above relationship can be done using any existing technology. Alternatively, a corresponding processing method can be added at a certain stage in subsequent processing steps; this application does not impose any limitations. For example, if BXmin < SXi < BXmax, and BYmin < SYi < BYmax, then the i-th corner point of the target graphic element is located inside the target processing frame.

[0032] In actual implementation, step S003 can be performed after step S325. That is, it is not necessary to first determine whether at least one corner of the target processing box is located outside the target primitive. The process can also be as follows: First, determine whether there is a corner of the primitive within the target processing box based on BXmin < SXi < BXmax, BYmin and < SYi < BYmax. If there is no corner within the target processing box, then determine whether there is an intersection between the edge of the primitive (triangle) and the edge of the target processing box through steps S100-S325; if there is no corner, then determine whether at least one corner of the target processing box is located outside the target primitive (i.e., whether the target processing box is entirely contained within the primitive).

[0033] Furthermore, if there are corner points within the target processing frame, the corresponding scheme can be selected to determine the processing starting point based on the number of corner points within the target processing frame.

[0034] Furthermore, the method for determining whether at least one corner of the target processing box is located outside the target primitive (i.e., whether the target processing box is entirely contained within the primitive) can specifically be to determine the minimum bounding rectangle of the primitive. If the target processing box is contained within the minimum bounding rectangle, then it can be determined that the target processing box is entirely contained within the primitive.

[0035] S100, based on the relative positional relationship between each corner point of the target graphic element and all rectangular sides of the target processing box, determine the corner point position identifier corresponding to each corner point of the target graphic element. The target graphic element is a triangular graphic element; the target processing box is a rectangular box; the rectangular sides are the sides of the target processing box; the corner point position identifier includes a flag bit corresponding to each rectangular side.

[0036] The value of each flag bit must meet the following conditions: If the target corner point is located on the side of the straight line containing the rectangle corresponding to the flag position that is close to the center point of the target processing box, then the value of the flag position of the target corner point is the first preset value.

[0037] If the target corner point is located on the side of the rectangle corresponding to the marker that is furthest from the center of the target processing frame, then the value of the marker for the target corner point is the second preset value. The target corner point can be any corner point of the target graphic element.

[0038] S110, process each triangle edge sequentially according to the processing order. If the corner position markers of the two endpoints of the current triangle edge have the same value as the second preset value, then ignore the current triangle edge and process the next triangle edge; otherwise, determine whether there is a processing start point between the current triangle edge and the target processing box; the triangle marker is the edge of the target primitive.

[0039] Specifically, the corner position identifier consists of a four-bit binary number. The first preset value is 0. The second preset value is 1.

[0040] In this embodiment of the application, the first marker from right to left in the corner position identifier corresponds to the leftmost side of the rectangle among the two vertical sides of the target processing frame, i.e. Figure 2 Edge B1B4 in the diagram.

[0041] The second marker from right to left in the corner position markers corresponds to the uppermost of the two horizontal edges in the target processing frame. Figure 2 Edge B1B2 in the middle.

[0042] The third marker from right to left in the corner position markers corresponds to the rightmost of the two vertical sides in the target processing frame. Figure 2 Edge B2B3 in the middle.

[0043] The fourth marker from right to left in the corner position identifier corresponds to the lower edge of the two horizontal edges in the target processing frame. Figure 2 Edge B4B4 in the diagram.

[0044] In some other embodiments, the correspondence may be adjusted to other ways, and this application does not limit the embodiments.

[0045] For easier understanding, please refer to Figure 2 To understand the plan, Figure 2The area enclosed by the four corner points B1, B2, B3, and B4 is the target processing box, and the triangular area enclosed by the three corner points A1, A2, and A3 is the target graphic element. If a corner point of a target graphic element is within the target processing box, then that corner point is on the side closer to the center of the target processing box relative to any of the rectangular sides of the target processing box. This can also be understood as being on the side facing inwards from the target processing box. Therefore, if a corner point of a target graphic element is within the target processing box, its position should be marked as "0000". It should be noted that this is only an example; if a corner point of a target graphic element is within the target processing box, then that corner point can be directly determined as the processing starting point.

[0046] Similarly, if the target primitive and the target processing box meet the requirements... Figure 2 The situation shown is as follows, Figure 2 The corner point A1 should be labeled "1000", the corner point A2 should be labeled "0001", and the corner point A3 should be labeled "0110".

[0047] However, if the target primitive and the target processing box meet the requirements Figure 3 The situation shown is as follows, Figure 3 The area enclosed by the four corner points B1, B2, B3, and B4 is the target processing box, and the triangular area enclosed by the three corner points C1, C2, and C3 is the target primitive.

[0048] We can determine that corner point C1 should have a position identifier of "1001", corner point C2 should have a position identifier of "0001", and corner point C3 should have a position identifier of "0110". At this point, the first flag bit from right to left in the position identifiers of corner points C1 and C2 should both have a value of 1. Figure 3 In the diagram, it is clear that edge C1C2 and the target processing box do not intersect at all, so there is no need to calculate the intersection between edge C1C2 and the target processing box.

[0049] In the embodiments of this application, Figure 2 and Figure 3 The origin of the coordinate system in the image is located at the upper left of the target processing box; therefore, in Figure 2 and Figure 3 In the diagram, the vertical coordinate gradually increases from top to bottom, while the horizontal coordinate gradually increases from left to right.

[0050] Furthermore, in this embodiment, if a corner point of the target graphic element is located on a straight line containing the edge of a rectangle, a preset processing method can be used to determine the value of the flag position corresponding to the straight line. For example, it can be set to a first preset value or a second preset value by default. Alternatively, if the corner point is on the straight line containing the left vertical rectangle edge or the upper horizontal rectangle edge, the corresponding flag position value is the first preset value; if the corner point is on the straight line containing the right vertical rectangle edge or the lower horizontal rectangle edge, the corresponding flag position value is the second preset value.

[0051] Alternatively, if a corner point of the target graphic element is located on the straight line of a rectangle, then any other existing method can be used to determine the starting processing point; this application does not impose any limitations on this method.

[0052] The method for determining the starting point of processing a target graphic element provided in this application determines the corner position identifier corresponding to each corner point of the target graphic element based on the relative positional relationship between each corner point of the target graphic element and all rectangular sides of the target processing box.

[0053] Meanwhile, the corner point location identifier includes a flag corresponding to each rectangle side. The value of each flag meets the following conditions: if the target corner point is located on the side of the rectangle corresponding to the flag point that is closer to the center point of the target processing frame, then the value of that flag point is a first preset value; if the target corner point is located on the side of the rectangle corresponding to the flag point that is farther from the center point of the target processing frame, then the value of that flag point is a second preset value; the target corner point can be any corner point of the target graphic element.

[0054] Thus, if the corner position markers of the two endpoints of the current triangle have the same value for the corresponding marker of the same rectangle, it means that the two endpoints of the current triangle are on the side of one of the rectangles of the target processing box away from the center point of the target processing box. Therefore, it can be determined that the current triangle does not intersect with any rectangle of the target processing box. At this time, the current triangle can be ignored without calculating whether it intersects with a rectangle of the target processing box.

[0055] Therefore, the method for determining the starting point of target primitive processing provided in this application can quickly determine whether the current triangle edge intersects with any rectangle edge in the target processing frame based on the position markers of the two corner points corresponding to the current triangle edge in the target primitive. Furthermore, if the corner point position markers indicate that no intersection exists, the intersection point calculation for that triangle edge is not performed, thus saving the number of calculations required.

[0056] It should be noted that since the values ​​of the corner point position identifier and the flag corresponding to the same rectangular side are both second preset values, they can be completed by simple numerical comparison. The computing power required is much less than that required to calculate whether two line segments have an intersection. Therefore, although the embodiments of this application have added the steps of determining the corner point position identifier and comparing the corner point position identifier, the overall computing power required is significantly smaller.

[0057] In one exemplary embodiment of this application, step S110 includes the following steps: S200 determines the processing order of each triangle edge according to preset rules.

[0058] S201, initialize the current processing order to 1.

[0059] S300: Obtain the current processing order and perform the first processing on the triangle edge corresponding to the current processing order.

[0060] The first process includes the following steps: S301, if the corner position identifiers of the two endpoints of the target triangle have the same value for the corresponding flag of the same rectangle, then increment the current processing order by one and proceed to step S300; otherwise, proceed to step S310; the target triangle is the triangle corresponding to the current processing order.

[0061] S310, determine at least one target rectangle edge according to the target rectangle edge determination method corresponding to the target corner point position identifier; the target corner point position identifier is the corner point position identifier corresponding to the starting point of the target triangle edge; for any triangle edge, if the ordinates of the two endpoints of the triangle edge are different, then its starting point is the endpoint with the larger ordinate; if the ordinates of the two endpoints of the triangle edge are the same, then its starting point is the endpoint with the smaller abscissa.

[0062] S320: If the target triangle has at least one intersection with one or two target rectangles, then one of the at least one intersection is determined as the processing start point, and the method for determining the processing start point of the target primitive ends; otherwise, the current processing order is incremented by one, and the process proceeds to step S300.

[0063] Specifically, step S200 includes the following steps: S210, among the three corner points of the target element, the corner point with the largest corresponding ordinate is determined as the first corner point, the corner point with the middle corresponding ordinate is determined as the second corner point, and the corner point with the smallest corresponding ordinate is determined as the third corner point; wherein, if two corner points of the target element have the same ordinate, the corner point with the smaller corresponding abscissa is considered to have a larger ordinate.

[0064] S220, the processing order of the triangle sides corresponding to the first and second corner points is determined as 1.

[0065] S230, the processing order of the triangle sides corresponding to the first and third corner points is determined to be 2.

[0066] S240, the processing order of the triangle sides corresponding to the second and third corner points is determined to be 3.

[0067] Specifically, the method for determining the target rectangle edge corresponding to the target corner position identifier can be to pre-define the target rectangle edge corresponding to each corner position identifier. For example, if the corner position identifier is "0011", then the corresponding target rectangle edge is the horizontal edge on the top side and the vertical edge on the left side of the target processing box.

[0068] It is worth noting that, based on the method for determining the target rectangle edges corresponding to the target corner position markers, the maximum number of target rectangle edges determined is 2. At the same time, if the number of target rectangle edges determined based on the method for determining the target rectangle edges corresponding to the target corner position markers is 2, then one of the two target rectangle edges is the horizontal edge of the target processing box, and the other is the vertical edge of the target processing box.

[0069] In one exemplary embodiment of this application, the method for determining the target rectangle edge corresponding to the target corner position identifier is to determine the rectangle edge corresponding to the flag bit with a value of a second preset value in the target corner position identifier as the target rectangle edge.

[0070] In this application, if the target corner point is located on the side of the rectangle corresponding to the marker that is closer to the center point of the target processing frame, the value of the marker at the target corner point is a first preset value. If the target corner point is located on the side of the rectangle corresponding to the marker that is farther from the center point of the target processing frame, the value of the marker at the target corner point is a second preset value. Therefore, for any corner point position marker, it can contain at most two markers with values ​​of the second preset value.

[0071] In this embodiment, the three triangular sides of the target primitive are sorted and processed sequentially. When processing a certain triangular side, if the current triangular side has an intersection with the target processing box, the intersection can be determined as the starting processing point, and the overall process is directly terminated. No other side is processed to determine whether there is an intersection. Therefore, it is not necessary to calculate the intersection of each triangular side of the triangular primitive with all rectangular sides of the target processing box, thereby reducing the required computing power.

[0072] Furthermore, in this embodiment of the application, for a certain triangular side, it is only necessary to determine whether there is an intersection point between it and at most two target rectangular sides corresponding to the target corner point position identifier, rather than calculating whether there is an intersection point with all four rectangular sides, thereby further reducing the required computing power.

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

[0074] For example, if the target corner position is marked as "1000", then the corner corresponding to this position is directly below the target processing frame. 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 frame, then if this 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 not intersect with any one of the rectangle edges B1B2, B2B3, or B1B4. Therefore, in this case, only whether the current triangle edge intersects with edge B3B4 is calculated.

[0075] In one exemplary embodiment of this application, the number of target rectangle edges determined according to the target corner position identifier corresponding to the target rectangle edge determination method is at most 2. Furthermore, if the number of target rectangle edges determined according to the target corner position identifier corresponding to the target rectangle edge determination method is 2, then one of the two target rectangle edges is the horizontal edge of the target processing frame, and the other is the vertical edge of the target processing frame.

[0076] Step S320 includes the following steps: S321, if the number of sides of the target rectangle is 1, then determine whether the side of the target triangle intersects with the side of the target rectangle.

[0077] S322, if it exists, then the intersection point is determined as the processing start point, and the method for determining the processing start point of the target graphic element ends; otherwise, the current processing order is incremented by one, and the process proceeds to step S300.

[0078] S323, if the number of sides of the target rectangle is 2, then determine whether the side of the target triangle intersects with the horizontal side of the two sides of the target rectangle.

[0079] S324, if the intersection point exists, then the intersection point is determined as the processing start point, and the method for determining the processing start point of the target primitive ends; otherwise, determine whether the target triangle side intersects with the vertical side of one of the two target rectangle sides.

[0080] S325, if it exists, then the intersection point is determined as the processing start point, and the method for determining the processing start point of the target graphic element ends; otherwise, the current processing order is incremented by one, and the process proceeds to step S300.

[0081] In this embodiment, if the number of sides of the target rectangle is two, it is prioritized to determine whether the side of the target triangle intersects with the horizontal side of one of the two target rectangle sides. This ensures that in batch processing, the determined processing starting point is mostly located on the upper or lower horizontal rectangle side. Having the processing starting point on either the upper or lower horizontal rectangle side allows subsequent scanning processes to perform line-by-line scanning only in one direction (up or down), thereby reducing the computational cost of subsequent scanning processes.

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

[0083] In this embodiment of the application, a chip is also provided, wherein a target circuit is disposed inside the chip; the target circuit is used to implement the method described in any of the above embodiments.

[0084] In this embodiment of the application, a graphics processing device is also provided, which includes the chip described above. For example, the graphics processing device may be a graphics card.

[0085] While specific embodiments of this application have been described in detail by way of examples, those skilled in the art should understand that the examples are for illustrative purposes only and not intended to limit the scope of this application. Those skilled in the art should also understand that various modifications can be made to the embodiments without departing from the scope and spirit of this application. The scope of this 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

  • Pixel rasterization method and device, electronic equipment and storage medium

    CN119919276A

  • Rasterization method, and processor, system and electronic device

    WO2025152263A1