Graphics processing unit and graphics drawing method

By introducing an over-drawing culling module in the graphics processor to record and execute the position and sequence information of the fragments in the sub-region, the problem of being unable to execute the culling algorithm in the drawing of two-dimensional user interfaces in the existing technology is solved, and the number of shading processors is reduced. load and power consumption, improving the performance of the graphics processor.

WO2024178961A1PCT designated stage expired Publication Date: 2024-09-06HUAWEI TECH CO LTD

Patent Information

Application Number
PCT/CN2023/120132
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-02-27
Filing Date
2023-09-20
Publication Date
2024-09-06

AI Technical Summary

Technical Problem

Existing graphics processors have over-drawing problems when performing drawing tasks, especially in the inability to perform depth culling algorithms in 2D user interface drawing, resulting in a high workload on the shader processor.

Method used

A graphics processor is designed, including a culling module and a shading processor. The overdraw culling module records and executes the position and order information of fragments in a sub-region, performs overdraw culling operations, and reduces unnecessary fragments sent to shading. Processor, suitable for 2D scenes without depth information.

Benefits of technology

It effectively reduces overdrawing, reduces the load on the shader processor, improves the performance of the graphics processor and reduces power consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023120132_06092024_PF_FP
    Figure CN2023120132_06092024_PF_FP
Patent Text Reader

Abstract

The embodiments of the present application relate to the technical field of chips. Provided are a graphics processing unit and a graphics drawing method, which solve the problem of over-drawing of existing graphics processing units during the execution of a drawing task. The specific solution is as follows: the graphics processing unit comprises an elimination module and a coloring processor, wherein the elimination module comprises a register and an over-drawing elimination module, and an output end of the over-drawing elimination module is coupled to an input end of the coloring processor; the register is used for storing indication information, which is used for indicating a sub-area in a graphics area of a drawing task, which sub-area participates in an over-drawing elimination operation; the over-drawing elimination module is used for recording position information of a plurality of fragments of the drawing task in the graphics area, and sequence information thereof during the participation in drawing, performing the over-drawing elimination operation on the fragments in the sub-area on the basis of the position information and the sequence information, and sending to the coloring processor the fragments that need to be drawn among the plurality of fragments; and the coloring processor is used for coloring the fragments that need to be drawn among the plurality of fragments.
Need to check novelty before this filing date? Find Prior Art

Description

Graphics processor and graphics drawing method

[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on February 27, 2023, with application number 202310231313.7 and application name “Graphics Processor and Graphics Drawing Method”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The embodiments of the present application relate to the field of chip technology, and in particular to a graphics processor and a graphics drawing method. Background Art

[0003] Currently, the three-dimensional scenes processed by the graphics processing unit (GPU) are composed of multiple objects, each of which is composed of multiple basic primitives (such as triangles, lines, and points). When processing drawing tasks, objects are sent to the GPU in the order specified by the application, that is, the basic primitives of each object are sent to the GPU in the order in which they appear in the object, and the GPU performs a series of processing to obtain the final pixel color. Among them, the fragment shading program usually performs the most workload. In order to reduce the workload of the fragment shading program, the GPU will perform a variety of algorithm processing, such as using the depth information of the object to perform depth culling to reduce the number of fragment shading program tasks.

[0004] As the application scenarios of graphics processors continue to expand, in addition to 3D applications, 2D user interface (UI) applications also make extensive use of GPUs for rendering. In 2D UI rendering, depth information may be unavailable, and culling algorithms cannot be executed for scenes with special operations. As a result, GPUs still suffer from overdrawing, resulting in a high workload for the shader processor.

[0005] Summary of the Invention

[0006] The embodiments of the present application provide a graphics processor and a graphics drawing method, which solve the problem of over-drawing when the existing graphics processor performs a drawing task.

[0007] To achieve the above objectives, the embodiments of the present application adopt the following technical solutions.

[0008] In a first aspect, an embodiment of the present application provides a graphics processor, which includes a culling module and a shading processor, the culling module including a register and an overdrawing culling module, wherein the output of the overdrawing culling module is coupled to the input of the shading processor; the register is used to store indication information, the indication information is used to indicate a sub-region in the graphics area of ​​a drawing task that participates in an overdrawing culling operation; the overdrawing culling module is used to record the position information of multiple fragments of the drawing task in the graphics area and the order information when participating in the drawing, and based on the position information and the order information, perform an overdrawing culling operation on the fragments in the sub-region, and send the fragments that need to be drawn among the multiple fragments to the shading processor; the shading processor is used to perform shading processing on the fragments that need to be drawn among the multiple fragments. Among them, the sub-region participating in the overdrawing culling operation can be an area for performing a blending operation, a template comparison operation, and an instruction discarding operation.

[0009] Compared with the prior art, the problem that the shading processor in the graphics processor cannot execute the culling algorithm for scenes with blending operations, template comparison operations, and instruction discarding operations, the graphics processor in the embodiment of the present application first determines the sub-area involved in the over-drawing culling operation through the indication information stored in the register, and then before the shading processor performs shading processing on the fragments, the over-drawing culling operation is performed on the sub-area involved in the over-drawing culling operation by the over-drawing culling module outside the shading processor. Even if there are fragments in the two-dimensional scene without depth information in the sub-area involved in the over-drawing culling operation, the over-drawing culling operation can also be performed on the fragments in the two-dimensional scene without depth information. In this way, not only can the problem that the shading processor cannot execute the culling algorithm for scenes with blending operations, template comparison operations, and instruction discarding operations be avoided, but also the fragments that need to be drawn can be sent to the shading processor on the basis of culling the fragments that do not need to be drawn in the sub-area, which can effectively reduce over-drawing, reduce the load of the shading processor, improve the performance of the graphics processor, and reduce power consumption.

[0010] In a possible design, the over-drawing culling operation is to cull fragments having the same position information and a preceding order among multiple fragments.

[0011] In this design, when the position information is the same, the fragments in the later order can cover the fragments in the earlier order, and the fragments in the earlier order will be eliminated, which can reduce the instruction overhead of the fragments and achieve the purpose of reducing over-drawing.

[0012] In one possible design, the overdraw culling module is further configured to send fragments outside the sub-region to the shading processor based on the position information and the order information.

[0013] In this design, for fragments outside the sub-region, the overdraw culling module does not process the fragments and only passes the fragments to the shading processor. This can reduce the fragment processing process and improve the efficiency of the graphics processor.

[0014] In a possible design, the indication information includes an area range of the sub-area and a first identifier, where the first identifier is used to indicate that the area inside the area range of the sub-area is an area range participating in the overdrawing culling operation.

[0015] In this design, the sub-region range can be a closed curve described by a mathematical formula, or specified by an input image or texture. Through the first identifier, the range of the area involved in the overdraw culling operation can be flexibly set, which is applicable to various drawing scenarios.

[0016] In a possible design, the indication information includes an area range of the sub-area and a second identifier, where the second identifier is used to indicate that an area outside the area range of the sub-area is an area range participating in an overdrawing culling operation.

[0017] In this design, the sub-region's range can be a closed curve described by a mathematical formula, or specified by an input image or texture. The second identifier allows for flexible setting of the region involved in overdraw culling, making it applicable to a variety of drawing scenarios.

[0018] In one possible design, the culling module further includes a template testing module; the template testing module is configured to receive a plurality of fragments and determine whether to cull a fragment based on a comparison result of template values ​​of the plurality of fragments with a template reference value.

[0019] In this design, the template test module can perform preliminary culling on the fragments, eliminating the fragments that do not need to be drawn, effectively reducing over-drawing, reducing the load on the shading processor, improving the performance of the graphics processor, and reducing power consumption.

[0020] In one possible design, the culling module also includes a depth testing module, and the multiple fragments include a depth fragment; the depth testing module is used to determine whether to cull the fragment based on the comparison result of the depth value of the depth fragment among the multiple fragments and the value of the depth buffer.

[0021] In this design, the depth test module can perform preliminary culling on the fragments, eliminating the fragments that do not need to be drawn, effectively reducing over-drawing, reducing the load on the shading processor, improving the performance of the graphics processor, and reducing power consumption.

[0022] In a second aspect, an embodiment of the present application provides a graphics drawing method, which is applied to a graphics processor, the graphics processor including a culling module and a shading processor, the culling module including a register and an over-drawing culling module, the output end of the over-drawing culling module and the input end of the shading processor being coupled, the method including: storing indication information, the indication information being used to indicate a sub-area in the graphics area of ​​the drawing task that participates in the over-drawing culling operation; recording position information of multiple fragments of the drawing task in the graphics area and the order information when participating in the drawing, and performing an over-drawing culling operation on the fragments in the sub-area based on the position information and the order information, and sending the fragments that need to be drawn among the multiple fragments to the shading processor; and performing shading processing on the fragments that need to be drawn among the multiple fragments.

[0023] For the beneficial effects of the second aspect, please refer to the beneficial effects of the first aspect.

[0024] In a possible design, the over-drawing culling operation is to cull fragments having the same position information and a preceding order among multiple fragments.

[0025] In one possible design, before shading the fragments to be drawn among the multiple fragments, the method further includes: sending the fragments outside the sub-region to the shading processor based on the position information and the order information.

[0026] In a possible design, the indication information includes an area range of the sub-area and a first identifier, where the first identifier is used to indicate that the area inside the area range of the sub-area is an area range participating in the overdrawing culling operation.

[0027] In a possible design, the indication information includes an area range of the sub-area and a second identifier, where the second identifier is used to indicate that an area outside the area range of the sub-area is an area range participating in an overdrawing culling operation.

[0028] In one possible design, the culling module also includes a template testing module, which records the position information of multiple fragments of the drawing task in the graphics area and the order information when participating in the drawing. The method also includes: receiving multiple fragments and determining whether to cull the fragments based on the comparison results of the template values ​​of the multiple fragments and the template reference values.

[0029] In one possible design, the culling module also includes a depth testing module, the multiple fragments include depth fragments, and the method also includes: determining whether to cull the fragment based on a comparison result between the depth value of the depth fragment among the multiple fragments and the value of the depth buffer.

[0030] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, including computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the graphics drawing method in any of the above aspects and any possible implementation methods.

[0031] In a fourth aspect, an embodiment of the present application provides a computer program product, which, when executed on a computer or a processor, enables the computer or the processor to execute the graphics drawing method in any of the above aspects and any possible implementation methods.

[0032] In a fifth aspect, embodiments of the present application provide a chip system, which may include a wireless access device according to any possible implementation of any of the above aspects and at least one electronic device. The electronic device and the wireless access device may execute the graphics drawing method according to any of the above aspects and any possible implementation.

[0033] It is understandable that any of the graphics processors, chip systems, computer-readable storage media, or computer program products provided above can be applied to the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods and will not be repeated here.

[0034] These and other aspects of the present application will become more readily apparent from the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] FIG1 is a schematic diagram of the structure of an execution device provided in an embodiment of the present application;

[0036] FIG2 is a diagram of the internal architecture of an execution device provided in an embodiment of the present application;

[0037] FIG3 is a diagram of the internal architecture of a graphics processor provided in an embodiment of the present application;

[0038] FIG4 is a schematic diagram of the structure of a graphics processor provided in an embodiment of the present application;

[0039] FIG5 is a schematic diagram of the area range of a sub-area provided in an embodiment of the present application;

[0040] FIG6 is a schematic diagram of the area range of another sub-area provided in an embodiment of the present application;

[0041] FIG7 is a schematic structural diagram of a rejection module provided in an embodiment of the present application;

[0042] FIG8 is a processing flow chart of a graphics processor provided in an embodiment of the present application;

[0043] FIG9 is a flowchart of a graphics drawing method provided in an embodiment of the present application;

[0044] FIG10 is a flowchart of another graphics drawing method provided in an embodiment of the present application;

[0045] FIG11 is a processing flow chart of a graphics processor provided in an embodiment of the present application. DETAILED DESCRIPTION

[0046] For ease of understanding, some examples of concepts related to the embodiments of this application are provided for reference as follows:

[0047] A graphics processing unit (GPU), also known as a display core, visual processor, or display chip, is a microprocessor specialized for image processing in personal computers, workstations, game consoles, and some mobile devices (such as tablets and smartphones). The GPU converts and drives the display information required by the computer system and provides scanning signals to the monitor to control the correct display.

[0048] Blending is an operation that generates many special paths between two original paths. Blending can gradually transform one shape into another, creating a three-dimensional effect.

[0049] The technical solutions in the embodiments of the present application will be described below in conjunction with the accompanying drawings in the embodiments of the present application. In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is merely a description of the association relationship of associated objects, indicating that three relationships can exist, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.

[0050] In the following, the terms "first" and "second" are used for descriptive purposes only and should not be understood to indicate or imply relative importance or implicitly specify the number of the technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this embodiment, unless otherwise specified, "plurality" means two or more.

[0051] At present, in order to reduce the workload of the fragment shader, the prior art provides a Mali GPU.

[0052] The GPU can solve the overdrawing problem through forward pixel kill (FPK) technology. Among them, in Mali GPU, the fragments that have passed the depth test and template test are first queued in a shader processor's first-in-first-out queue (FIFO) before entering the shader processor to execute instructions. Among them, after the new fragment enters the queue, the queue will check the fragment in front of the queue. If the fragment that enters the queue later coincides with the previous fragment in screen position and can cover the previous fragment in depth or order, the new fragment will replace the previous fragment. In this way, the instruction overhead of the previous fragment is reduced, achieving the purpose of reducing overdrawing.

[0053] However, FPK technology has strict requirements on the application scenarios. In scenarios where operations such as blending, template comparison, and shader discard exist, FPK technology cannot be applied, otherwise the graphics processor will have functional errors.

[0054] Therefore, considering the over-drawing problem existing in the prior art, that is, the problem that culling cannot be performed when the drawn objects include special operations such as blending operations, template comparison operations and instruction discarding, the workload of the fragment shader is high.

[0055] Therefore, the embodiment of the present application improves the graphics processor and adds an over-drawing culling module. The over-drawing culling module performs over-drawing culling operations in sub-areas where special operations such as blending operations, template comparison operations, and instruction discarding exist. It also performs over-drawing culling operations on fragments without depth information, thereby reducing the load on the shading processor, improving the performance of the graphics processor, and reducing power consumption.

[0056] The graphics processor provided in the embodiments of the present application can be applied to various devices, such as the execution device 10 shown in FIG1 , which is a schematic structural diagram of an execution device provided in the embodiments of the present application. The execution device 10 can be a terminal, such as a server 11, a mobile terminal 12, a tablet computer 13, a laptop computer 14, an augmented reality (AR) device (not shown in FIG1 ), a virtual reality (VR) device (not shown in FIG1 ), or an in-vehicle terminal (not shown in FIG1 ).

[0057] As shown in Figure 2, Figure 2 is an internal architecture diagram of an execution device provided in an embodiment of the present application. The execution device 10 may include a graphics processor, a central processing unit (CPU) and a memory, etc. Among them, the memory may include: a read-only memory (ROM) and a random access memory (RAM). The execution device 10 may also be configured with an input / output (I / O) interface (not shown in Figure 2) for data interaction with an external device. For example, a user may input data to the I / O interface through an external device. The input data may include: an image to be drawn, which may be an image collected by the execution device 10 through a data acquisition device, an image in the database of the execution device 10, an image from a client device, etc.

[0058] As shown in Figure 3, Figure 3 is a block diagram of the structure of a graphics processor provided by an embodiment of the present application. The graphics processor may include: a task parser and scheduler, multiple shading task creators (Task Creator 0 to Task Creator N in the example of Figure 3, where N is a positive integer), a graphics processing cluster, a bus, and a cache (such as an L2 cache).

[0059] In some embodiments, the graphics driver is in the chip corresponding to the CPU, and the CPU can send the drawing task to the GPU. The task parser and scheduler of the GPU parses the task and schedules it according to the task priority. Generally, graphics includes multiple types of shaders, such as vertex shaders, geometry shaders, and fragment shaders. When the task is sent to the task creator through the task parser and scheduler, the task creator can be used to create the task and send the task to the graphics processing cluster. Among them, the graphics processing cluster includes M graphics processing core units, where M is a positive integer. For example, the number of graphics processing core units is 4, 8, or 16. The M graphics processing core units can execute different shader program instructions in parallel.

[0060] In some embodiments, a graphics processing cluster may also include a shader unit, a texture unit, a loader store unit, and a special function unit. Conventional instructions can be executed by the graphics processing core unit. More complex texture instructions, memory load and store instructions, and special function instructions are executed by independent coprocessors (including texture units, loader store units, and special function units). A graphics processing cluster may include N texture units, loader store units, and special function units.

[0061] For example, the shader unit is used to execute shading programs. Texture-related instructions are sent to the texture unit for processing, memory load and store instructions are sent to the load and store unit for processing, and special functions are sent to the special function unit for processing. Conventional arithmetic instructions, jump instructions, and logical operations are processed by the arithmetic and logic unit (ALU) within the shader unit. The texture unit obtains texels, performs filtering, and sends the filtered results back to the shader unit, which then completes the remaining instruction operations.

[0062] In some embodiments, a GPU may include S graphics processing clusters (GPUs), for example, 8, 16, or other numbers. Both the texture unit and the load / store unit can load or store data into or out of memory. When a GPU access request is sent via the bus to the L2 cache, if the request does not find a match in the L2 cache, the request is then sent via the memory interface to the memory (DDR) for data reading or storage. If the access request is a read request, the read result is returned to the corresponding module in the GPU.

[0063] The embodiment of the present application improves the graphics processor and adds an over-drawing culling module in the graphics processing cluster. Before shading the fragments, the over-drawing culling module culls the fragments that do not need to be drawn and only sends the fragments that need to be drawn to the shading processor for processing.

[0064] The graphics processor provided in the embodiment of the present application receives the drawing task of the application (APP) and performs calculation operations. The graphics processor and the application cooperate to complete various real-time drawing tasks, such as games and application user interfaces. Among them, the application sets the sub-area participating in the over-drawing culling operation in the graphics area of ​​the drawing task through the application program interface (API), that is, the area for performing operations such as blending operations, template comparison operations and instruction discarding operations. The application sends the indication information of the sub-area to the graphics processor through the API, and the graphics processor processes the drawing task based on the indication information. Among them, on devices such as mobile phones or tablets, the application uses the API to enable the function of the graphics processor, which can improve performance, reduce load and power consumption, and increase battery life.

[0065] The following is an introduction to the graphics processor provided in the embodiments of the present application.

[0066] An embodiment of the present application provides a graphics processor 40, as shown in FIG4 , which is a schematic diagram of the structure of a graphics processor provided by an embodiment of the present application. Graphics processor 40 includes a culling module 41 and a shading processor 42. Culling module 41 includes a register 411 and an overdrawing culling module 412. An output of overdrawing culling module 412 (e.g., output a in FIG4 ) is coupled to an input of shading processor 42 (e.g., input b in FIG4 ).

[0067] The register 411 is used to store indication information, where the indication information is used to indicate a sub-region in the graphics region of the drawing task that participates in the over-drawing culling operation.

[0068] Exemplarily, the register 411 may be an interface register, and the register 411 may be accessed by both the internal circuit and the external circuit or the application. In one example, the register 411 may temporarily store indication information sent by the application.

[0069] For example, the indication information is generated by an application based on a drawing task. For display interfaces of common UI applications on devices such as in-vehicle screens, mobile phones, tablets, or computers, such as product display pages or photo browsing pages on shopping platforms, the application calls an API to set areas for special operations, such as blending operations, template comparison operations, and instruction discard operations, and generates indication information and sends it to register 411.

[0070] In addition, the graphics area of ​​the drawing task can be understood as an area of ​​a display interface, for example, it can be a display subsystem of a mobile phone or a monitor.

[0071] Among them, the over-drawing culling module 412 is used to record the position information of multiple fragments of the drawing task in the graphics area and the order information when participating in the drawing, and perform over-drawing culling operations on the fragments in the sub-area based on the position information and order information, and send the fragments that need to be drawn among the multiple fragments to the shading processor 42.

[0072] For example, a fragment is a point in a two-dimensional image that includes color, depth information, and texture data. The multiple fragments may include depth-enabled fragments and non-depth-enabled fragments. Depth-enabled fragments are fragments with depth information, while non-depth-enabled fragments are fragments without depth information. Depth information may be the distance of each point in space relative to the camera.

[0073] Among them, the overdrawing removal module 412 can execute two processes, namely, a fragment interrelationship generation process and an overdrawing test process. The fragment interrelationship generation process may include: the overdrawing removal module 412 records the position information of depth fragments and non-depth fragments in the graphics area and the order information when participating in the drawing, and compares whether the position information of the fragments in the graphics area is located in the sub-area participating in the overdrawing removal operation. The overdrawing test process may include: the overdrawing removal module 412 performs an overdrawing removal operation, removes the fragments that do not need to be drawn in the sub-area, and sends the fragments that need to be drawn to the shading processor 42, wherein the fragments that do not need to be drawn can be understood as fragments that do not contribute to the pixel color in the final display interface. For example, the overdrawing removal module 412 can remove the fragments corresponding to the background UI elements or the intermediate invalid layers in the layer overlay process, remove the fragments that do not contribute to the final pixel color, and only send the contributing fragments to the shading processor 42 for processing. In this way, overdrawing can be effectively reduced, the load on the shading processor can be reduced, the performance of the graphics processor can be improved, and the power consumption can be reduced.

[0074] The shading processor 42 is used to perform shading processing on the fragments that need to be drawn among the multiple fragments.

[0075] For example, the shading processor 42 executes shading instruction operations to shade the fragments to be drawn among the multiple fragments. The shading processor 42 writes the final calculation result into the frame buffer after processing, and finally displays the result of the frame buffer on the display interface.

[0076] Therefore, compared to the FPK technique, in which the culling operation is performed in the FIFO queue of the shader processor, the graphics processor 40 provided in the embodiment of the present application performs the overdraw culling operation in the overdraw culling module 412 before the shader processor 42. The overdraw culling module 412 can be understood as a buffer. The overdraw culling module 412 can process more fragments than the FIFO queue, which can effectively reduce overdraw and reduce the load on the shader processor 42.

[0077] Optionally, the over-drawing culling operation is to cull fragments having the same position information and a preceding order among multiple fragments.

[0078] For example, for background UI elements and intermediate invalid layers during layer overlay, suppose there are fragments 1 and 2, where fragments 1 and 2 have the same position information in the graphics area, fragment 1 has the order information of the first order, and fragment 2 has the order information of the last order. Therefore, fragment 2 can be understood as being able to cover fragment 1, so fragment 1 is a fragment that does not need to be drawn. Removing fragment 1 can reduce the instruction overhead of fragment 1 and achieve the purpose of reducing overdrawing.

[0079] It is understandable that only two fragments are shown in this example, but the number of superimposed layers can be two or more, and the number of fragments with the same position information can also be two or more.

[0080] Optionally, the overdrawing elimination module 412 is further configured to send fragments outside the sub-region to the shading processor 42 based on the position information and the order information.

[0081] For example, the area outside the sub-region can be understood as an area within the graphics area where no special operations are performed. That is, operations such as blending, template comparison, and instruction discarding are not performed outside the sub-region. In this case, the overdraw culling module 412 directly sends the fragments to the shading processor 42. That is, the overdraw culling module 412 does not process the fragments and only transparently transmits the fragments to the shading processor 42. This can reduce the fragment processing process and improve the efficiency of the graphics processor 40.

[0082] Optionally, the indication information includes an area range of the sub-area and a first identifier, where the first identifier is used to indicate that the area inside the area range of the sub-area is an area range participating in the over-drawing culling operation.

[0083] As shown in Figure 5, Figure 5 is a schematic diagram of the area range of a sub-region provided in an embodiment of the present application. The area range of the sub-region can be a closed curve that can be described by a mathematical formula, such as a rectangle, triangle, circle, or ellipse. Multiple sub-regions can be set simultaneously in the graphics area of ​​a drawing task.

[0084] Among them, the first identifier can indicate that the interior of the closed curve is the area range participating in the over-drawing culling operation. In one example, the first identifier can be true. In the application, the definition for the blending operation is: *SetBlendRegions(Region*regions,bool exclusive), where *regions is the area range of the sub-region. When exclusive is the first identifier, it means that the over-drawing culling operation is effective within the area range of the sub-region. In addition, the definition for the template comparison operation is: *SetStencilRegions(Region*regions,bool exclusive). The definition for the instruction discard operation is: *SetShaderDiscardRegions(Region*regions,bool exclusive). The definition for the special operation is: *SetSpecialOpRegions(Region*regions,bool exclusive).

[0085] It is understandable that the description of the area range of the sub-area can also be specified using an input image or texture. In this way, areas that cannot be described by general book sequence formulas can be expressed. As shown in Figure 6, Figure 6 is a schematic diagram of the area range of another sub-area provided in an embodiment of the present application. Among them, the pixels of the image correspond to an area on the screen, such as 1x2, 2x1, 2x2, 2x4 and 4x4, so as to more flexibly control the area range of the sub-area.

[0086] Optionally, the indication information includes an area range of the sub-area and a second identifier, and the second identifier is used to indicate that the area outside the area range of the sub-area is an area range participating in the over-drawing culling operation.

[0087] For example, the second flag may indicate that the area outside the closed curve is the area range participating in the overdrawing culling operation. Continuing with the definition of the operation in the application as an example, when exclusive is the second flag, it means that the overdrawing culling operation is effective outside the area range of the sub-area.

[0088] Therefore, by setting the first identifier and the second identifier, the area range of the sub-area can be flexibly set, which is applicable to various drawing scenarios.

[0089] Optionally, the culling module 41 further includes a template testing module 413, which is configured to receive a plurality of fragments and determine whether to cull a fragment based on a comparison result between the template values ​​of the plurality of fragments and a template reference value.

[0090] For example, the stencil test module 413 can perform a stencil test on the fragment. The stencil test process is as follows: the graphics processor 40 first reads the stencil value of the screen coordinate position of the fragment in the stencil buffer, and then compares the stencil value with the stencil reference value of the fragment. The comparison function can be specified by a technician, for example, if the stencil value is greater than or equal to the stencil reference value, the fragment is discarded, or if the stencil value is less than or equal to the stencil reference value, the fragment is discarded.

[0091] Thus, the template test module 413 can perform preliminary culling processing on the fragments, culling the fragments that do not need to be drawn, effectively reducing over-drawing, reducing the load of the shader processor 42, improving the performance of the graphics processor 40, and reducing power consumption.

[0092] Optionally, the culling module 41 further includes a depth testing module 414 , and the multiple fragments include a depth fragment. The depth testing module 414 is used to determine whether to cull the fragment based on a comparison result between a depth value of the depth fragment among the multiple fragments and a value of the depth buffer.

[0093] Exemplarily, the depth test module 414 can perform a depth test on the fragment, wherein the depth test process is as follows: the graphics processor 40 compares the depth value of the fragment with the depth value already in the depth buffer, wherein the comparison function can be specified by a technician, for example, discarding the fragment when the depth value is greater than or equal to the depth value in the depth buffer, or discarding the fragment when the depth value is less than or equal to the depth value in the depth buffer.

[0094] Thus, the depth test module 414 can perform preliminary culling on the fragments, eliminating the fragments that do not need to be drawn, effectively reducing overdraw, reducing the load on the shader processor 42, improving the performance of the graphics processor 40, and reducing power consumption. Specifically, for fragment processing, the module test can be performed first, and then the depth test. Specifically, for fragments without depth, the depth test module 414 does not perform culling processing, and passes the fragments without depth to the overdraw culling module 412.

[0095] Therefore, the structural diagram of the culling module 41 is shown in FIG7 . The culling module 41 includes a register 411, an overdraw culling module 412, a stencil test module 413, and a depth test module 414. The processing flow of the culling module 41 is as follows: fragments first undergo a stencil test in the stencil test module 413, then undergo a depth test in the depth test module 414, and finally, the overdraw culling module 412 performs an overdraw culling operation based on the culling results of the stencil test module 413 and the depth test module 414, thereby culling fragments that do not need to be drawn and sending only fragments that need to be drawn to the shading processor 42.

[0096] In addition, the graphics processor 40 may also include a rasterization module 43, which is used to convert vertex data of a rendering task into multiple fragments. Each element in a fragment corresponds to a pixel in the frame buffer. Rasterization is essentially the process of converting the mathematical description of an object and its associated color information into pixels at corresponding locations on the screen and the colors used to fill those pixels.

[0097] In general, as shown in Figure 8, Figure 8 is a processing flow chart of a graphics processor provided by an embodiment of the present application. The flow chart of the graphics processor is as follows: the vertex data in the drawing task is converted into multiple fragments by the rasterization module 43, the template test module 413 and the depth test module 414 in the culling module 41 perform preliminary culling processing, the over-drawing culling module 412 integrates the culling results of the template test module 413 and the depth test module 414, records the position information of all fragments in the graphics area and the order information when participating in the drawing, culls the fragments that do not contribute to the pixel color, identifies the fragments that ultimately affect the pixel color and sends them to the shading processor 42 for shading processing.

[0098] Applied to the graphics processor shown in FIG4 , an embodiment of the present application provides a graphics drawing method, as shown in FIG9 , which is a flow chart of a graphics drawing method provided by an embodiment of the present application. The method includes the following process.

[0099] Step 901: The graphics processor stores indication information, where the indication information is used to indicate a sub-region in a graphics region of a drawing task that participates in an overdrawing culling operation.

[0100] Step 902: The graphics processor records the position information of the multiple fragments of the drawing task in the graphics area and the order information when participating in the drawing, and performs the over-drawing culling operation on the fragments in the sub-area based on the position information and the order information, and sends the fragments that need to be drawn among the multiple fragments to the shading processor.

[0101] Step 903: The graphics processor performs shading processing on the fragments that need to be drawn among the multiple fragments.

[0102] For scenarios with blending operations, template comparison operations, and instruction discarding operations, the problem that the shading processor in the graphics processor cannot execute the culling algorithm, the graphics processor in the embodiment of the present application first determines the sub-area involved in the over-drawing culling operation through the indication information stored in the register, and then before the shading processor performs shading processing on the fragments, the over-drawing culling module outside the shading processor performs the over-drawing culling operation on the sub-area involved in the over-drawing culling operation. Even if there are fragments in the two-dimensional scene without depth information in the sub-area involved in the over-drawing culling operation, the over-drawing culling operation can also be performed on the fragments in the two-dimensional scene without depth information. In this way, not only can the problem that the shading processor cannot execute the culling algorithm for scenarios with blending operations, template comparison operations, and instruction discarding operations be avoided, but also the fragments that need to be drawn can be sent to the shading processor on the basis of culling the fragments that do not need to be drawn in the sub-area, which can effectively reduce over-drawing, reduce the load of the shading processor, improve the performance of the graphics processor, and reduce power consumption.

[0103] Optionally, as shown in FIG10 , FIG10 is a flowchart of another graphics drawing method provided by an embodiment of the present application. Before step 903 , the method may further include:

[0104] Step 904: The graphics processor sends the fragments outside the sub-region to the shader processor based on the position information and the order information.

[0105] For example, for fragments outside the sub-region, the overdraw culling module does not process the fragments and only passes the fragments to the shader processor. This can reduce the fragment processing process and improve the efficiency of the graphics processor. The implementation of step 904 can refer to the introduction of the graphics processor in the above embodiment.

[0106] Optionally, before step 902, the method may further include:

[0107] Step 905: The graphics processor receives a plurality of fragments and determines whether to cull a fragment based on a comparison result between the template values ​​of the plurality of fragments and a template reference value.

[0108] For example, the template test module can perform preliminary culling on the fragments, eliminating fragments that do not need to be drawn, effectively reducing overdraw, reducing the load on the shader processor, improving the performance of the graphics processor, and reducing power consumption. The implementation of step 905 can refer to the introduction of the graphics processor in the above embodiment.

[0109] Optionally, after step 905 and before step 902, the method may further include:

[0110] Step 906: The graphics processor determines whether to cull a fragment based on a comparison result between the depth value of a depth fragment among the multiple fragments and the value of the depth buffer.

[0111] For example, the depth test module can perform preliminary culling on the fragments, eliminating fragments that do not need to be drawn, effectively reducing overdraw, reducing the load on the shader processor, improving the performance of the graphics processor, and reducing power consumption. The implementation of step 906 can refer to the introduction of the graphics processor in the above embodiment.

[0112] In general, as shown in FIG11 , FIG11 is a processing flow chart of a graphics processor provided in an embodiment of the present application, which includes the following processes.

[0113] (a) register storage indication information;

[0114] (b) The application sends a drawing task to the graphics processor;

[0115] (c) Graphics processor processes graphics primitives;

[0116] (d) The rasterization module processes the primitives to obtain fragments;

[0117] (e) Elimination module processes fragments;

[0118] (f) The shader processor executes shader instruction operations.

[0119] An embodiment of the present application further provides a computer storage medium storing computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the above-mentioned related method steps to implement the graphics drawing method in the above-mentioned embodiment.

[0120] An embodiment of the present application further provides a computer program product. When the computer program product is run on a computer, the computer is caused to execute the above-mentioned related steps to implement the graphics drawing method executed by the electronic device in the above-mentioned embodiment.

[0121] In addition, an embodiment of the present application also provides a device, which can specifically be a chip, component or module, and the device may include a connected processor and memory; wherein the memory is used to store computer execution instructions, and when the device is running, the processor can execute the computer execution instructions stored in the memory to enable the chip to execute the graphics drawing method performed by the electronic device in the above-mentioned method embodiments.

[0122] Among them, the graphics processor, computer storage medium, computer program product or chip provided in this embodiment is used to execute the corresponding method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects of the corresponding method provided above and will not be repeated here.

[0123] Through the description of the above implementation methods, technical personnel in the relevant field can understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0124] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the modules or units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0125] The units described as separate components may or may not be physically separate, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple places. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0126] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0127] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0128] The above content is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.

Claims

1. A graphics processor, characterized in that: The graphics processor comprises a culling module and a shading processor, the culling module comprises a register and an over-drawing culling module, and an output end of the over-drawing culling module is coupled to an input end of the shading processor; The register is used to store indication information, where the indication information is used to indicate a sub-area in a graphics area of ​​a drawing task that participates in an over-drawing culling operation; The over-drawing culling module is used to record the position information of the multiple fragments of the drawing task in the graphics area and the sequence information when participating in the drawing, and perform the over-drawing culling operation on the fragments in the sub-area based on the position information and the sequence information, and send the fragments that need to be drawn among the multiple fragments to the shading processor; The shading processor is used to perform shading processing on the fragments that need to be drawn among the multiple fragments.

2. The graphics processor according to claim 1, wherein: The over-drawing elimination operation is to eliminate the fragments whose position information is the same and whose order information is the previous order among the multiple fragments.

3. The graphics processor according to claim 1 or 2, characterized in that: The over-drawing elimination module is further used to send the fragments outside the sub-area to the shading processor based on the position information and the sequence information.

4. The graphics processor according to claim 1, wherein: The indication information includes an area range of the sub-area and a first identifier, where the first identifier is used to indicate that the area inside the area range of the sub-area is an area range participating in the over-drawing culling operation.

5. The graphics processor according to claim 1, characterized in that: The indication information includes an area range of the sub-area and a second identifier, where the second identifier is used to indicate that the area outside the area range of the sub-area is an area range participating in the over-drawing culling operation.

6. The graphics processor according to claim 1, characterized in that: The rejection module also includes a template testing module; The template testing module is used to receive a plurality of fragments and determine whether to remove the fragments based on the comparison results of the template values ​​of the plurality of fragments and the template reference value.

7. The graphics processor according to claim 6, characterized in that: The culling module further includes a depth testing module, and the plurality of fragments include depth fragments; The depth test module is used to determine whether to discard the fragment based on a comparison result between a depth value of a depth fragment among the multiple fragments and a value of a depth buffer.

8. A graphics drawing method, characterized in that: The method is applied to a graphics processor, the graphics processor includes a culling module and a shading processor, the culling module includes a register and an over-drawing culling module, the output end of the over-drawing culling module is coupled to the input end of the shading processor, and the method includes: storing indication information, where the indication information is used to indicate a sub-region in a graphics region of a drawing task that participates in an over-drawing culling operation; Recording position information of multiple fragments of the drawing task in the graphics area and sequence information of the fragments when participating in the drawing, and performing the over-drawing culling operation on the fragments in the sub-area based on the position information and the sequence information, and sending the fragments that need to be drawn among the multiple fragments to the shading processor; The fragments that need to be drawn among the multiple fragments are shaded.

9. The method according to claim 8, characterized in that The over-drawing elimination operation is to eliminate the fragments whose position information is the same and whose order information is the previous order among the multiple fragments.

10. The method according to claim 8 or 9, characterized in that: Before the shading process is performed on the fragments to be drawn among the multiple fragments, the method further includes: The fragments outside the sub-region are sent to the shading processor based on the position information and the order information.

11. The method according to claim 8, characterized in that The indication information includes an area range of the sub-area and a first identifier, where the first identifier is used to indicate that the area inside the area range of the sub-area is an area range participating in the over-drawing culling operation.

12. The method according to claim 8, characterized in that The indication information includes an area range of the sub-area and a second identifier, where the second identifier is used to indicate that the area outside the area range of the sub-area is an area range participating in the over-drawing culling operation.

13. The method according to claim 8, characterized in that The culling module further includes a template testing module. Before recording the position information of the plurality of fragments of the drawing task in the graphics area and the sequence information of the plurality of fragments participating in the drawing, the method further includes: A plurality of fragments are received, and based on a comparison result of the template values ​​of the plurality of fragments with a template reference value, it is determined whether to discard the fragments.

14. The method according to claim 9, characterized in that The culling module further includes a depth testing module, the plurality of fragments include depth fragments, and the method further includes: Whether to discard the fragment is determined based on a comparison result between a depth value of a depth fragment among the multiple fragments and a value of the depth buffer.

15. A computer-readable storage medium, characterized in that: The method comprises computer instructions, which, when executed on an electronic device, cause the electronic device to execute the method according to any one of claims 8 to 14.

Citation Information

Patent Citations

  • Occlusion culling and acceleration method for drawing outdoor ground surface in real time based on depth map

    CN104331918A

  • Merging unit, method for selecting coverage area merging scheme and depth test system

    CN112116518A

  • Invisible pixel elimination method and device and storage medium

    CN114037795A

  • Shadow drawing method and device, equipment and storage medium

    CN115100347A

  • Apparatus and method for an efficient 3D graphics pipeline

    WO2018052610A1

Cited By

  • Rendering processing method and device, electronic equipment and storage medium

    CN120823303A