WO2022089512A1 - Load control method and apparatus, and device - Google Patents
Load control method and apparatus, and device Download PDFInfo
- Publication number
- WO2022089512A1 WO2022089512A1 PCT/CN2021/126924 CN2021126924W WO2022089512A1 WO 2022089512 A1 WO2022089512 A1 WO 2022089512A1 CN 2021126924 W CN2021126924 W CN 2021126924W WO 2022089512 A1 WO2022089512 A1 WO 2022089512A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- load
- gpu
- rendering operation
- instruction
- load data
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 235
- 238000009877 rendering Methods 0.000 claims abstract description 312
- 230000008569 process Effects 0.000 claims abstract description 172
- 238000012545 processing Methods 0.000 claims abstract description 25
- 239000000872 buffer Substances 0.000 claims description 56
- 238000004422 calculation algorithm Methods 0.000 claims description 13
- 238000004364 calculation method Methods 0.000 claims description 11
- 238000004590 computer program Methods 0.000 claims description 7
- 238000004891 communication Methods 0.000 description 19
- 238000010586 diagram Methods 0.000 description 13
- 230000006870 function Effects 0.000 description 13
- 238000005516 engineering process Methods 0.000 description 5
- 238000004458 analytical method Methods 0.000 description 4
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 238000001514 detection method Methods 0.000 description 3
- 238000011161 development Methods 0.000 description 3
- 230000000694 effects Effects 0.000 description 3
- 230000009467 reduction Effects 0.000 description 3
- 238000013528 artificial neural network Methods 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 2
- 239000004973 liquid crystal related substance Substances 0.000 description 2
- 230000007774 longterm Effects 0.000 description 2
- 238000010295 mobile communication Methods 0.000 description 2
- 238000003062 neural network model Methods 0.000 description 2
- 230000009466 transformation Effects 0.000 description 2
- 241000699670 Mus sp. Species 0.000 description 1
- 230000001133 acceleration Effects 0.000 description 1
- 239000008186 active pharmaceutical agent Substances 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000007599 discharging Methods 0.000 description 1
- 239000012634 fragment Substances 0.000 description 1
- 230000005484 gravity Effects 0.000 description 1
- 238000012905 input function Methods 0.000 description 1
- 238000002955 isolation Methods 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000012805 post-processing Methods 0.000 description 1
- 238000010079 rubber tapping Methods 0.000 description 1
- 238000004088 simulation Methods 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 230000005236 sound signal Effects 0.000 description 1
- 238000010897 surface acoustic wave method Methods 0.000 description 1
- 230000001360 synchronised effect Effects 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
- 238000000844 transformation Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T1/00—General purpose image data processing
- G06T1/20—Processor architectures; Processor configuration, e.g. pipelining
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5011—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
- G06F9/505—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T1/00—General purpose image data processing
- G06T1/60—Memory management
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—3D [Three Dimensional] image rendering
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—3D [Three Dimensional] image rendering
- G06T15/005—General purpose rendering architectures
Definitions
- the embodiments of the present application relate to the field of computer technologies, and in particular, to a method, an apparatus, and a device for controlling a load.
- the load of game programs is mainly reduced by the following methods: load analysis is performed for a specific game program in an offline state, and then a load reduction scheme is determined, and the load reduction scheme is solidified into the mobile terminal.
- Embodiments of the present application provide a method, apparatus, and device for controlling load, which are used to control the load in an image rendering process.
- the method has good applicability and wide application range.
- a first aspect of the embodiments of the present application provides a method for controlling a load, including:
- At least one first instruction is used to call an application program interface API, so that the graphics processor GPU performs a first rendering operation;
- the first rendering operation can be used for one or more objects in a frame of image Rendering can also be used to render objects in multi-frame images;
- the load data of the process in which the GPU performs the first rendering operation is determined based on at least one first instruction, wherein the embodiment of the present application does not limit the type and specific load data.
- Determine the target scheme for controlling the load based on the load data and the embodiment of the present application does not limit the specific method of determining the target scheme; obtain at least one second instruction, and at least one second instruction is used to call the API, so that the GPU When executing the second rendering operation, the second instruction is essentially the same as the first instruction, and both belong to the instructions for calling the API; the load in the process of executing the second rendering operation on the GPU is controlled based on the target scheme.
- the process of controlling the load based on the target scheme is related to the specific content of the target scheme. If the target scheme instructs to process the second instruction, after obtaining the at least one second instruction, the obtained at least one second instruction is first processed according to the target scheme, and then the processed at least one second instruction is passed on. If the target solution does not instruct to process the second instruction, after obtaining the at least one second instruction, the at least first second instruction is not processed, but is passed before the second instruction is passed according to the specific content of the target solution. During the process of the second instruction or after the second instruction is transmitted, other forms of control means are adopted for the load.
- the method provided by the embodiment of the present application can be applied to any game application, not limited to one or several game applications.
- the latter game application program and the newly added game application program are also applicable, so the applicability is strong and the application range is wide; in addition, the method provided by the embodiment of the present application does not need to be executed offline, and can realize dynamic control of the load.
- determining the load data of the process in which the GPU performs the first rendering operation based on the at least one first instruction includes: acquiring the load data of the GPU performing the first rendering operation based on the at least one first instruction and at least one preset load characteristic factor.
- At least one kind of load data of the process, and each load characteristic factor corresponds to one kind of load data.
- the load characteristic factor can be defined according to actual needs.
- the load characteristic factor can be understood as the characteristic parameter of the load data.
- Each load characteristic factor indicates a load, and the value of each load characteristic factor can be regarded as a specific load. data.
- the load characteristic factor may indicate a kind of information of computer hardware resources, and the value of the load characteristic factor may be used as a kind of load data; for example, the load characteristic factor indicates the frequency of the CPU, and correspondingly, the actual The frequency point can be used as a kind of load data.
- the load characteristic factor may also indicate the quantity of the first instructions, and correspondingly, the specific quantity of the first instructions may be used as a kind of load data.
- At least one load characteristic factor can be preset as required, and one kind of load data can be obtained corresponding to each load characteristic factor, it can be ensured that the load data is comprehensive and representative.
- the at least one load characteristic factor includes at least one of the following three types of load characteristic factors: a first type of load characteristic factor, a second type of load characteristic factor, and a third type of load characteristic factor; the first type of load characteristic factor
- the factor is used to represent the consumption of computer hardware resources in the process of the GPU performing the first rendering operation.
- Information of the rendered mesh Mesh model, the information of the mesh Mesh model may include the number of vertices of the mesh Mesh model and the number of mesh Mesh models and other information; the third type of load characteristic factor is used to represent at least one first.
- the information of the instruction, the information of the first instruction may include various information such as the quantity of the first instruction and the relationship between the instructions.
- At least one load characteristic factor includes at least one of the above three types of load characteristic factors; when at least one load characteristic factor includes the above two types or the above three types of load characteristic factors, it is guaranteed to obtain a variety of load data from multiple dimensions, thereby It is convenient to determine a more suitable target scheme for reducing the load.
- the load data includes at least one of the first type of load data, the second type of load data, and the third type of load data; the first type of load data indicates that the process of the GPU performing the first rendering operation affects the computer hardware resources
- the second type of load data represents the information of the mesh model rendered by the GPU performing the first rendering operation; the third type of load data represents the information of at least one first instruction.
- the load data may include at least one of the above three types of load data, which ensures the diversification of the load data.
- the first type of load characteristic factor includes at least one of the following: calculation time in the process of the GPU performing the first rendering operation, operating parameters of the central processing unit CPU, operating parameters of the GPU, and operation of the internal memory parameter;
- the second type of load characteristic factor includes at least one of the following: the number of vertices of each Mesh model rendered in the process of the GPU performing the first rendering operation, the number of vertices in each frame of the image rendered in the process of the GPU performing the first rendering operation.
- the number of vertices, the number of Mesh models in each frame of images rendered by the GPU in the process of performing the first rendering operation, the number of repetitions of Mesh models in each frame of images rendered by the GPU in the process of performing the first rendering operation, and the first rendering by the GPU The distance of each Mesh model rendered by the operation process relative to the screen; the third type of load characteristic factor includes at least one of the following: the number of drawing commands DC formed by at least one first instruction, the rendering corresponding to at least one first instruction The number of channel Render Passes, the frame buffer Frame Buffer size, the reference relationship between rendering channels and frame buffers, and the reference relationship between DC and frame buffers.
- This implementation provides multiple choices for each type of load characteristic factor, thereby ensuring the diversification of load data.
- the first type of load data may include at least one of the following: calculation time, CPU load data, GPU load data, and DDR memory load data;
- the second type of load data may include the following At least one of: the number of vertices of each Mesh model rendered by the process of the GPU performing the first rendering operation, the number of vertices in each frame of the image rendered by the process of the GPU performing the first rendering operation, the number of vertices of the GPU performing the first rendering operation.
- the number of Mesh models in each frame of image rendered by the process, the number of repetitions of Mesh models in each frame of image rendered by the GPU in the process of performing the first rendering operation, and the number of Mesh models rendered in the process of the GPU performing the first rendering operation The distance relative to the screen; the third type of load data can include at least one of the following: the number of drawing commands (Draw Call, DC) formed by at least one first instruction, the number of rendering channels Render Pass corresponding to at least one first instruction , Frame Buffer Frame Buffer size, the reference relationship between the rendering channel and the frame buffer, and the reference relationship between the DC and the frame buffer.
- the number of drawing commands Draw Call, DC
- DC drawing commands
- Render Pass corresponding to at least one first instruction
- Frame Buffer Frame Buffer size the reference relationship between the rendering channel and the frame buffer
- the reference relationship between the DC and the frame buffer the reference relationship between the DC and the frame buffer.
- the at least one load characteristic factor includes a second type of load characteristic factor; and acquiring at least one load data of a process in which the GPU performs the first rendering operation based on the at least one first instruction and the at least one load characteristic factor includes: based on at least one of the first instructions and the at least one load characteristic factor.
- the parameters carried by a first instruction respectively determine the data of the mesh Mesh model rendered by the GPU executing the first rendering operation; based on the data of the mesh Mesh model rendered by the GPU executing the first rendering operation, obtain the data of the mesh model that the GPU executes the first rendering operation.
- the process corresponds to the load data of the second type of load characteristic factor.
- the parameter carried by the first instruction indicates the data of the mesh model to be rendered, and according to the data of the mesh model to be rendered, load data corresponding to the second type of load characteristic factor can be determined.
- determining the target solution for controlling the load based on the load data includes: determining a load control label based on the load data, where the load control label indicates the content of the load control, wherein, for the same load data, one or more loads may be determined A control label; based on the load control label, a load control scheme is selected from at least one preset load control scheme as a target scheme for controlling the load. For example, if the load data is the frequency of the CPU, the first load tag can indicate the frequency of the CPU to be controlled; if the load data is the number of the first instructions, the first load tag can indicate the frequency of the first instruction. quantity is controlled.
- the setting of the load control tag enables the developer to flexibly expand the load control scheme, that is, preset more load control schemes associated with the load control tag for selection.
- the load data includes the first type of load data, and the first type of load data represents the consumption of computer hardware resources in the process of the GPU performing the first rendering operation; determining the load control label based on the load data includes: based on the first type of load data
- the load data indicates that the consumption of computer hardware resources in the process of performing the first rendering operation on the GPU satisfies the first condition, and a first load control tag is determined, and the first load control tag indicates the operation of the computer hardware in the process of performing the second rendering operation on the GPU parameters are adjusted.
- the first load control label instructs to adjust the operating parameters of the computer hardware, so that the purpose of reducing the load can be achieved by adjusting the operating parameters of the computer hardware.
- the first load control tag instructs to adjust the frequency point of the CPU, the GPU or the internal memory in the process of performing the second rendering operation on the GPU.
- This implementation provides a specific content of the first load control label, that is, instructs to adjust the frequency point of the CPU, GPU or internal memory.
- the load data includes a second type of load data
- the second type of load data represents information of a mesh model rendered by the GPU performing the first rendering operation
- determining the load control label based on the load data includes: based on the first type of load data
- the load data indicates that the information of the mesh model rendered by the GPU performing the first rendering operation satisfies the second condition, and a second load control label is determined, and the second load control label indicates the Mesh rendered in the process of performing the second rendering operation on the GPU
- the model is simplified.
- the second load control tag instructs to simplify the rendered Mesh model, so as to reduce the load by adjusting the operating parameters of the computer hardware.
- the second load control tag indicates the characteristics of the Mesh model to be simplified during the GPU performing the second rendering operation, the simplified algorithm applicable to the Mesh model to be simplified, and the parameters of the simplified algorithm.
- This implementation provides a specific content of the second load control label, ie, indicates the characteristics of the Mesh model to be simplified, the simplified algorithm applicable to the Mesh model to be simplified, and the parameters of the simplified algorithm.
- the second type of load data includes the number of vertices and the number of Mesh models in each frame of image rendered by the first rendering operation; the second condition includes the number of vertices in each frame of image rendered by the first rendering operation is greater than the first threshold, or the number of Mesh models in each frame of image rendered by the first rendering operation is greater than the second threshold.
- the second condition is defined from two dimensions, the number of vertices in each frame of image and the number of Mesh models.
- the second load control tag indicates that among the Mesh models rendered by the first rendering operation, the number of vertices is greater than the third threshold, the number of repetitions is greater than the fourth threshold, or the distance from the screen is greater than The Mesh model of the fifth threshold is simplified.
- the Mesh model to be simplified is defined from the number of vertices, the number of repetitions, and the distance from the screen.
- the load data includes a third type of load data, and the third type of load data represents information of at least one first instruction; determining the load control tag based on the load data includes: indicating at least one first instruction based on the third type of load data The instruction information of the satisfies the third condition, and the third load control tag is determined, and the third load control tag instructs to process at least one second instruction.
- the third load control tag instructs to process the at least one second instruction, so that the purpose of reducing the load can be achieved by processing the at least one second instruction.
- the number of second instructions is multiple;
- the third load control label indicates at least one of the following content: combining multiple DCs formed by multiple second instructions, and combining multiple DCs corresponding to multiple second instructions Combine multiple render passes.
- This implementation provides a specific content of the third load control tag, that is, indicating that multiple DCs are merged or multiple rendering channels are merged.
- a second aspect of the embodiments of the present application provides a device for controlling a load, including:
- an instruction acquisition module configured to acquire at least one first instruction, where the at least one first instruction is used to call an application programming interface API, so that the graphics processor GPU performs the first rendering operation;
- a load data determination module configured to determine load data of a process in which the GPU performs the first rendering operation based on the at least one first instruction
- a target scheme determination module for determining a target scheme for controlling the load based on the load data
- the instruction acquisition module is further configured to acquire at least one second instruction, and the at least one second instruction is used to call the API, so that the GPU performs the second rendering operation;
- the control module is configured to control the load of the GPU in the process of performing the second rendering operation based on the target scheme.
- a load data determination module configured to acquire at least one kind of load data of a process in which the GPU performs the first rendering operation based on at least one first instruction and at least one load characteristic factor, where each load characteristic factor corresponds to one kind of load data.
- the at least one load characteristic factor includes at least one of the following three types of load characteristic factors: a first type of load characteristic factor, a second type of load characteristic factor, and a third type of load characteristic factor; the first type of load characteristic factor The factor is used to represent the consumption of computer hardware resources in the process of the GPU performing the first rendering operation; the second type of load characteristic factor is used to represent the information of the mesh model rendered by the GPU in the process of performing the first rendering operation; the third type The load characteristic factor is used to represent information of at least one first instruction.
- the first type of load characteristic factor includes at least one of the following: calculation time in the process of the GPU performing the first rendering operation, operating parameters of the central processing unit CPU, operating parameters of the GPU, and operation of the internal memory parameter;
- the second type of load characteristic factor includes at least one of the following: the number of vertices of each Mesh model rendered in the process of the GPU performing the first rendering operation, the number of vertices in each frame of the image rendered in the process of the GPU performing the first rendering operation.
- the number of vertices, the number of Mesh models in each frame of images rendered by the GPU in the process of performing the first rendering operation, the number of repetitions of Mesh models in each frame of images rendered by the GPU in the process of performing the first rendering operation, and the first rendering by the GPU The distance of each Mesh model rendered by the operation process relative to the screen; the third type of load characteristic factor includes at least one of the following: the number of drawing commands DC formed by at least one first instruction, the rendering corresponding to at least one first instruction The number of channel Render Passes, the frame buffer Frame Buffer size, the reference relationship between rendering channels and frame buffers, and the reference relationship between DC and frame buffers.
- the at least one load characteristic factor includes the second type of load characteristic factor;
- the load data determination module is configured to determine, based on the parameters carried by the at least one first instruction, the mesh model rendered by the GPU by performing the first rendering operation Based on the data of the mesh Mesh model rendered by the GPU performing the first rendering operation, obtain the load data of the second type of load characteristic factor corresponding to the process of the GPU performing the first rendering operation.
- the target solution determination module is configured to determine a load control label based on the load data, where the load control label indicates the content of the load control; and determine the target solution for controlling the load based on the load control label.
- the load data includes the first type of load data
- the first type of load data represents the consumption of computer hardware resources in the process of the GPU performing the first rendering operation
- the target solution determination module is configured to be based on the first type of load data.
- the consumption of computer hardware resources in the process of instructing the GPU to perform the first rendering operation satisfies the first condition, and a first load control label is determined. adjust.
- the first load control tag instructs to adjust the frequency point of the CPU, the GPU or the internal memory in the process of performing the second rendering operation on the GPU.
- the load data includes the second type of load data
- the second type of load data represents the information of the mesh model rendered by the GPU performing the first rendering operation
- the target solution determination module is configured to be based on the first type of load data. Instructing the GPU to perform the information of the mesh model rendered by the first rendering operation satisfies the second condition, and determining a second load control label, the second load control label instructs the GPU to perform the second rendering operation on the rendered Mesh model. simplify.
- the second load control tag indicates the characteristics of the Mesh model to be simplified during the GPU performing the second rendering operation, the simplified algorithm applicable to the Mesh model to be simplified, and the parameters of the simplified algorithm.
- the second type of load data includes the number of vertices and the number of Mesh models in each frame of image rendered by the first rendering operation; the second condition includes the number of vertices in each frame of image rendered by the first rendering operation is greater than the first threshold, or the number of Mesh models in each frame of image rendered by the first rendering operation is greater than the second threshold.
- the second load control tag indicates that among the Mesh models rendered by the first rendering operation, the number of vertices is greater than the third threshold, the number of repetitions is greater than the fourth threshold, or the distance from the screen is greater than The Mesh model of the fifth threshold is simplified.
- the load data includes a third type of load data, and the third type of load data represents information of at least one first instruction; the target solution determination module is configured to indicate at least one instruction of the first instruction based on the third type of load data When the information satisfies the third condition, a third load control tag is determined, and the third load control tag instructs to process at least one second instruction.
- the number of second instructions is multiple;
- the third load control label indicates at least one of the following content: combining multiple DCs formed by multiple second instructions, and combining multiple DCs corresponding to multiple second instructions Combine multiple Render Passes.
- a third aspect of the embodiments of the present application provides a terminal device, including: one or more processors and a memory; wherein, the memory stores computer-readable instructions; the one or more processors read the Computer readable instructions to cause the computer device to implement the method according to any implementation of the first aspect.
- a fourth aspect of the embodiments of the present application provides a computer-readable storage medium, including computer-readable instructions, when the computer-readable instructions are executed on a computer, the computer is made to execute any implementation manner of the first aspect. method described.
- a fifth aspect of the embodiments of the present application provides a chip, including one or more processors. Part or all of the processor is used to read and execute the computer program stored in the memory, so as to execute the method in any possible implementation manner of the first aspect.
- the chip includes a memory, and the memory and the processor are connected to the memory through a circuit or a wire. Further optionally, the chip further includes a communication interface, and the processor is connected to the communication interface.
- the communication interface is used to receive data and/or information to be processed, and the processor obtains the data and/or information from the communication interface, processes the data and/or information, and outputs the processing result through the communication interface.
- the communication interface may be an input-output interface.
- some of the one or more processors may also implement some steps in the above method by means of dedicated hardware, for example, the processing involving the neural network model may be performed by a dedicated neural network processor or graphics processor.
- the methods provided in the embodiments of the present application may be implemented by one chip, or may be implemented collaboratively by multiple chips.
- a sixth aspect of the embodiments of the present application provides a computer program product, where the computer program product includes computer software instructions, and the computer software instructions can be loaded by a processor to implement the method described in any one of the implementation manners of the first aspect above .
- the embodiments of the present application have the following advantages:
- the embodiment of the present application provides The method can be applied to any game application, not limited to one or several game applications. It is also applicable to upgraded game applications and newly added game applications, so it has strong applicability and wide application range. .
- FIG. 1 is a schematic diagram of a system architecture in an embodiment of the present application.
- FIG. 2 is a schematic diagram of an embodiment of a method for controlling a load in an embodiment of the present application
- FIG. 3 is a schematic flowchart of an embodiment of the control load in the implementation of the present application.
- FIG. 4 is a schematic diagram of an embodiment of a first load control label in an embodiment of the present application.
- Fig. 5 is the characteristic schematic diagram of the Mesh model to be simplified in the embodiment of the application.
- FIG. 6 is a schematic structural diagram of an umbrella body in an embodiment of the present application.
- FIG. 7 is a schematic structural diagram of a closure body in an embodiment of the present application.
- FIG. 8 is a schematic structural diagram of an extension body in an embodiment of the present application.
- FIG. 9 is a schematic process diagram of step 103 in an embodiment of the present application.
- FIG. 10 is a schematic diagram of a process of determining a third load control label in an embodiment of the present application.
- FIG. 11 is a schematic diagram of an embodiment of a third load control label in an embodiment of the application.
- FIG. 12 is a schematic flowchart of another embodiment of load control in the implementation of the present application.
- FIG. 13 is a schematic diagram of a device for controlling a load in an embodiment of the present application.
- FIG. 14 is a schematic structural diagram of a terminal device in an embodiment of the present application.
- the embodiments of the present application may be applied to the system architecture shown in FIG. 1 .
- the system architecture includes an application program layer, a graphics application program interface (API) layer, a kernel layer and a hardware layer.
- API graphics application program interface
- system framework can be applied to any terminal device that needs to reduce the load during image rendering, especially some terminal devices with limited image rendering performance.
- the system framework can be applied to mobile terminals with limited image rendering performance such as mobile phones, tablet computers, and notebook computers, and the system framework can also be applied to terminal devices with limited image rendering performance due to special scenarios such as car computers.
- the application layer includes three game applications.
- the application program in the application program layer mainly refers to the game application program, that is, the embodiment of the present application is mainly applied to the scene of game rendering.
- the applications in the application layer may also be other applicable applications, which are not specifically limited in this application; in addition, the number of game applications is not limited to three, less or less. More is possible.
- the graphics API layer includes but is not limited to three graphics APIs, Open Graphics Library (OpenGL), OpenGL ES (OpenGL for Embedded Systems) and Vulkan.
- OpenGL Open Graphics Library
- OpenGL ES OpenGL for Embedded Systems
- Vulkan Vulkan
- the graphics API layer can be used to render 2D or 3D scenes to the screen of the terminal device; for example, OpenGL is used to render 2D scenes, and OpenGL ES and Vulkan are used to render 3D scenes.
- the kernel layer includes the system kernel and drivers.
- the hardware layer includes but is not limited to the central processing unit CPU, graphics processing unit GPU, and internal memory, among which the internal memory can be double-rate SDRAM (Double Data Rate Synchronous Dynamic Random-access Memory, DDR SDRAM), or other types of internal memory.
- the internal memory can be double-rate SDRAM (Double Data Rate Synchronous Dynamic Random-access Memory, DDR SDRAM), or other types of internal memory.
- the rendering process Pipe Line includes:
- the game engine in the game application traverses the game scene and cuts out invisible objects.
- the game engine prepares data resources and sends an instruction to call the graphics API, and the instruction to call the graphics API will reach the kernel layer.
- the driver of the kernel layer will transfer the data resource to the internal memory of the GPU, and send a rendering instruction to the GPU to instruct the GPU to render.
- the GPU will read the data resources from the internal memory, and execute operations such as vertex shader Vertex shader, pixel shader Fragment shader or Compute shader.
- a vertex shader is a program fragment that processes vertex transformations on the GPU.
- the vertex shader is executed once for each vertex of the mesh Mesh model. Therefore, the more vertices in the scene to be rendered, the heavier the computational load of the vertex shader.
- a pixel shader is a program fragment that handles pixel shading on the GPU. After the model has undergone vertex transformation, the pixel shader is executed once for each pixel on the screen that is covered by the Mesh model. Therefore, the higher the screen resolution, the more computationally loaded the pixel shader is.
- Compute shader refers to a program fragment executed on the GPU, which can be used for calculations other than graphics rendering. Specifically, the Compute shader can be transferred to the GPU through OpenGL ES or Vulkan API to be executed by the GPU.
- Game applications based on high image quality and high frame rate bring a high load to image rendering, so in order to reduce the load during image rendering, as shown in FIG. 1 , a load control layer is added in this embodiment of the present application.
- the control layer can intercept the instruction for calling the graphics API from the graphics API layer, and then obtain the required information from the intercepted instruction for calling the graphics API, or process the instruction for calling the graphics API. Finally, the instruction for calling the graphics API is returned to the graphics API layer, so that the instruction for calling the graphics API continues to be passed to the kernel layer.
- the load control layer will dynamically analyze the load in the image rendering process based on the obtained instruction to call the graphics API, and then select the corresponding load reducing method based on the analysis result. Program. Ultimately, the load in subsequent image rendering processes is reduced using the scheme for load reduction.
- the method for controlling load provided by the embodiment of the present application will be specifically introduced below with reference to FIG. 2 . As shown in FIG. 2 , an embodiment of the present application provides an embodiment of a method for controlling a load, which can be applied to a CPU, including:
- Step 101 Acquire at least one first instruction, where the at least one first instruction is used to call an application program interface API, so that the graphics processor GPU performs a first rendering operation.
- the number of the first instruction may be one or multiple.
- the multiple first instructions may constitute one or more instruction streams, and each instruction stream is used to call an API to make the GPU render a frame of image.
- the first rendering operation may be used to render one or more objects (person, background, etc.) in one frame of image, and may also be used to render objects in multiple frames of images.
- the API refers to the graphics API; correspondingly, in the system architecture shown in FIG. 1 , the first instruction is an instruction issued by the game application to call the graphics API.
- acquiring at least one first instruction may be understood as sensing and recording at least one first instruction, and will not prevent the downward transmission of the first instruction.
- the driver will send a rendering instruction to the GPU, so that the GPU performs the first rendering operation.
- the graphics processing process mainly includes multiple links such as modeling, physical simulation, rendering, and post-processing, and the first rendering operation in the embodiment of the present application mainly refers to the rendering link in the above process.
- Step 102 Determine load data of a process in which the GPU performs a first rendering operation based on at least one first instruction.
- the determination of the load data is based on the acquired GPU of the at least one first instruction, and does not depend on the actual process of the GPU performing the first rendering operation, and can also be understood as the process of determining the load data and the GPU.
- the actual process of performing the first rendering operation may be parallel.
- the load data can be determined according to the quantity, specific type, function, etc. of the at least one first instruction; it is also possible to acquire computer hardware that may be used by the GPU in the process of performing the first rendering operation after acquiring the at least one first instruction.
- Some information of the resource is used to determine load data; the object of the first rendering operation may also be determined according to at least one first instruction, and then the load data may be determined according to the information of the object of the first rendering operation.
- a load characteristic factor is pre-defined, and the load characteristic factor can be understood as a characteristic parameter of the load data, each load characteristic factor indicates a type of load, and the value of each load characteristic factor can be used as a type of load. specific load data. In this way, the load data can be determined from the load characteristic factor.
- the load characteristic factor may indicate a kind of information of computer hardware resources, and the value of the load characteristic factor may be used as a kind of load data; for example, the characteristic factor indicates the frequency point of the CPU, and correspondingly, the actual frequency of the CPU. Points can be used as a kind of payload data.
- the characteristic factor may also indicate the number of the first instructions, and correspondingly, the specific number of the first instructions may be used as a kind of load data.
- determining load data of a process in which the GPU performs the first rendering operation based on the at least one first instruction includes:
- At least one type of load data of a process in which the GPU performs the first rendering operation is acquired based on at least one first instruction and at least one load characteristic factor, and each load characteristic factor corresponds to one type of load data.
- one type of load data may be acquired.
- the load characteristic factor can be defined according to actual needs, and there can be many dimensions for defining the load characteristic factor.
- the load characteristic factor will be introduced from multiple dimensions below.
- Step 103 determining a target solution for controlling the load based on the load data.
- the load data can be analyzed, and then a target scheme for controlling the load can be determined. It can be understood that this target scheme is usually used to reduce the load during image rendering.
- a load control scheme library can be established in advance, and the load control scheme library contains a variety of load control schemes. According to the analysis result of the load data, a load control scheme can be selected from a variety of load control schemes as the target scheme for controlling load.
- determining the target solution for controlling the load based on the load data includes:
- a load control tag is determined based on the load data, the load control tag indicates the content of the load control; then, a load control scheme is selected from at least one load control scheme based on the load control tag as a target scheme for controlling the load.
- the load control label indicates the content of the load control and is used to associate with a specific load control scheme. Wherein, for the same load data, one or more load control tags can be determined.
- the embodiments of the present application do not specifically limit the form and content of the load control label; for different load data, the form and content of the obtained load control label may be different.
- the possible forms and contents of the control label will be described in detail below with reference to FIG. 4 , FIG. 11 , and Tables 1 to 3.
- At least one load control scheme is preset.
- the setting of the load control label enables the developer to flexibly expand the load control scheme, that is, preset more load control schemes associated with the load control label for selection.
- Step 104 Acquire at least one second instruction, where the at least one second instruction is used to call an API, so that the GPU performs a second rendering operation.
- the second instruction is essentially the same as the first instruction, and both belong to the instruction to call the API; in step 104, for any second instruction in the at least one second instruction, it may be the first instruction
- the instruction for calling the API issued later may also be the first instruction, or when the second instruction and the first instruction respectively contain multiple instructions, the two have the same instruction.
- step 104 can be understood by referring to the relevant description of step 101 for details.
- Step 105 controlling the load in the process of performing the second rendering operation on the GPU based on the target scheme.
- the second rendering operation in this embodiment of the present application mainly refers to the rendering link in the above process.
- the process of controlling the load based on the target solution is related to the specific content of the target solution, which is not specifically limited in this embodiment of the present application.
- step 104 the at least one second instruction obtained in step 104 is processed according to the target scheme, and then the processed at least one second instruction is sent to the graphic API pass.
- step 104 at least one second command can be transferred to the graphics API, and the process of transferring the second command before transferring the second command according to the specific content of the target solution During or after passing the second command, the load is controlled.
- the load control method provided by the embodiment of the present application can be summarized as the solution shown in FIG. 3 .
- the first instruction is issued by the application, and is transmitted to the Driver Development Kit (DDK) through the graphics API, and is acquired by the instruction acquisition module in the process of transmitting to the driver, and then based on the acquisition
- the received first instruction collects data related to the first instruction.
- load data is identified based on the load characteristic factor in the characteristic database, and scheme matching is performed according to the load data, that is, the target scheme is determined from all load control schemes in the load control scheme library.
- the target scheme can be used to control the load in the process of the GPU performing the second rendering operation.
- the load data of the process in which the GPU performs the first rendering operation is determined based on the first instruction, then the target scheme is determined according to the load data, and finally the load in the process of the GPU performing the second rendering operation is controlled according to the target scheme.
- the method provided by the embodiment of the present application can be applied to any game application, without Limited to one or several game applications, it is also applicable to upgraded game applications and newly added game applications, so it has strong applicability and wide application range; in addition, the methods provided in the embodiments of the present application also No offline execution is required, and dynamic control of the load can be achieved.
- the load characteristic factor can be defined from multiple dimensions.
- the following describes the load characteristic factors from three dimensions, each of which corresponds to a type of load characteristic factor.
- the load characteristic factor includes at least one of the following three types of load characteristic factors: a first type of load characteristic factor, a second type of load characteristic factor, and a third type of load characteristic factor.
- the first type of load characteristic factor is used to represent the consumption of computer hardware resources in the process of performing the first rendering operation by the GPU, wherein the hardware resources may be CPU, GPU, internal memory, etc., and the internal memory may be DDR SDRAM.
- the first type of load characteristic factor includes at least one of the following: calculation time in the process of the GPU performing the first rendering operation, operating parameters of the central processing unit CPU, operating parameters of the GPU, and operating parameters of the internal memory.
- the calculation time may specifically include logic operation time and GPU call time; CPU operating parameters may specifically include CPU frequency and CPU usage; GPU operating parameters may specifically include GPU frequency and GPU usage.
- the second type of load characteristic factor is used to represent the information of the mesh model rendered by the GPU in the process of performing the first rendering operation.
- the 3D model is generally represented by a triangular mesh, so the 3D model can also be called a Mesh model.
- each triangle is composed of three vertices, and the vertex data includes position, normal, UV coordinates, etc.; a vertex can be shared by multiple adjacent triangles.
- the information of the Mesh model can be used as the second type of load characteristic factor to indicate how much the load is.
- the information of the mesh model may include various information such as the number of vertices of the mesh model and the number of mesh models.
- the second type of load characteristic factor includes at least one of the following: the number of vertices of each Mesh model rendered by the GPU in the process of performing the first rendering operation, the number of vertices in each frame rendered by the GPU in the process of performing the first rendering operation The number of vertices in the image, the number of Mesh models in each frame of images rendered by the GPU in the process of performing the first rendering operation, the number of repetitions of the Mesh models in each frame of images rendered by the GPU in the process of performing the first rendering operation, and the number of Mesh models in each frame of images rendered by the GPU in the process of performing the first rendering operation. The distance of each Mesh model rendered relative to the screen during a rendering operation.
- the number of vertices of the Mesh model indicates the complexity of the geometric structure of the Mesh model.
- the number of vertices in each frame of image is the total number of vertices that need to be traversed in the process of rendering each frame of image.
- the number of Mesh models in each frame of image means how many Mesh models need to be rendered in the process of rendering each frame of image. In the process of rendering a frame of image, the more mesh models that need to be rendered, the greater the load. Therefore, the number of mesh models in each frame of image can be used as the second type of feature factor.
- the number of repetitions of a Mesh model when the number of repetitions of a Mesh model is large, it means that the total number of vertices of the Mesh model is large, so the number of repetitions of the Mesh model in each frame of image can be used as the second type of feature factor.
- the tree mesh model in one frame of image contains a small number of vertices, but the number of repetitions of the tree mesh model in the frame image is large, which means the load brought by rendering the tree mesh model in the frame image. larger.
- the number of repetitions of the Mesh model in each frame of image can also be referred to as the number of instances of the Mesh model.
- the Mesh model When a Mesh model is relatively close to the screen, theoretically, the Mesh model needs to be rendered more clearly to ensure the quality of the picture; when a Mesh model is relatively far from the screen, the rendering of the Mesh model can be reduced. Require. That is, the distance of the Mesh model relative to the screen is different and can represent different loads. Therefore, the distance of each Mesh model relative to the screen can be used as the second type of feature factor.
- the third type of load characteristic factor is used to represent the information of at least one first instruction, where the information of the first instruction may include various information such as the number of the first instructions and the relationship between the instructions.
- the third type of load characteristic factor includes at least one of the following: the number of drawing commands (Draw Call, DC) formed by at least one first instruction, the number of rendering channels Render Pass corresponding to at least one first instruction, the number of frames Buffer Frame Buffer size, reference relationship between rendering channel and frame buffer, reference relationship between DC and frame buffer.
- the number of drawing commands Draw Call, DC
- the number of rendering channels Render Pass corresponding to at least one first instruction
- the number of frames Buffer Frame Buffer size reference relationship between rendering channel and frame buffer
- reference relationship between DC and frame buffer reference relationship between DC and frame buffer.
- the following describes the first instruction, the DC, the rendering channel, the reference relationship between the rendering channel and the frame buffer, and the reference relationship between the DC and the frame buffer.
- rendering a frame of image may include multiple rendering channels, each rendering channel may correspond to multiple DCs, and each DC may include multiple API calling instructions. Therefore, the number of drawing commands DC formed by at least one first instruction and the number of rendering channels Render Pass corresponding to at least one first instruction can be used as the third type of characteristic factor.
- the rendering result of each rendering channel will be output to a corresponding frame buffer, so the corresponding relationship between the rendering channel and the frame buffer can also be called the reference relationship between the rendering channel and the frame buffer.
- the rendering result corresponding to each DC will be output to a corresponding frame buffer, so the corresponding relationship between DC and frame buffer can also be called the reference relationship between DC and frame buffer.
- the first type of load characteristic factor is used to represent the consumption of computer hardware resources in the process of GPU performing the first rendering operation
- the load characteristic factor when it includes the first type of load characteristic factor, it can be calculated according to the computer hardware.
- the running parameters of the GPU obtain the load data corresponding to the first type of load characteristic factor in the process of the GPU performing the first rendering operation.
- the third type of load characteristic factor is used to represent the information of at least one first instruction. Therefore, when the load characteristic factor includes the third type of load characteristic factor, the corresponding process of the GPU performing the first rendering operation can be obtained according to at least one first instruction. Load data for the third type of load characteristic factor.
- the second type of load characteristic factor is used to represent the information of the mesh model rendered by the GPU in the process of performing the first rendering operation. Therefore, when the load characteristic factor includes the second type of load characteristic factor, it is necessary to first determine that the GPU performs the first rendering. Only the information of the mesh model rendered during the operation process can determine the load data.
- the at least one load characteristic factor includes the second type of load characteristic factor.
- the load data of the second type of load characteristic factor corresponding to the process of the GPU performing the first rendering operation is acquired.
- the first instruction carries corresponding parameters
- the parameters carried in the first instruction can determine the mesh Mesh model rendered by the GPU performing the first rendering operation, and then obtain the rendering of the GPU performing the first rendering operation.
- the mesh data for the mesh model can be understood that the first instruction carries corresponding parameters, and the parameters carried in the first instruction can determine the mesh Mesh model rendered by the GPU performing the first rendering operation, and then obtain the rendering of the GPU performing the first rendering operation.
- the mesh data for the mesh model can be understood that the first instruction carries corresponding parameters, and the parameters carried in the first instruction can determine the mesh Mesh model rendered by the GPU performing the first rendering operation, and then obtain the rendering of the GPU performing the first rendering operation.
- the mesh data for the mesh model can be understood that the first instruction carries corresponding parameters, and the parameters carried in the first instruction can determine the mesh Mesh model rendered by the GPU performing the first rendering operation, and then obtain the rendering of the GPU performing the first rendering operation.
- the mesh data for the mesh model can be understood that the mesh Mesh model rendered by the GPU performing
- the acquired load data may also include at least one of the first type of load data, the second type of load data, and the third type of load data.
- the first type of load data represents the consumption of computer hardware resources in the process of the GPU performing the first rendering operation;
- the second type of load data represents the information of the mesh model rendered by the GPU performing the first rendering operation;
- the third type of load The data represents information of at least one first instruction.
- the first type of load data may include at least one of the following: calculation time consumption, load data of central processing unit CPU, load data of GPU, and load data of DDR memory.
- the second type of load data may include at least one of the following: the number of vertices of each Mesh model rendered by the GPU in the process of performing the first rendering operation, the number of vertices in each frame of the image rendered by the GPU in the process of performing the first rendering operation , the number of Mesh models in each frame of images rendered by the process of performing the first rendering operation by the GPU, the number of repetitions of the Mesh models in each frame of images rendered by the process of performing the first rendering operation by the GPU, and the number of repetitions of the Mesh models in each frame of images rendered by the GPU in the process of performing the first rendering operation.
- the third type of load data may include at least one of the following: the number of drawing commands (Draw Call, DC) formed by at least one first instruction, the number of rendering passes corresponding to at least one first instruction, and the size of the frame buffer. , the reference relationship between the rendering channel and the frame buffer, and the reference relationship between the DC and the frame buffer.
- DC drawing commands
- the load data includes the first type of load data
- the first type of load data represents the consumption of computer hardware resources in the process of the GPU performing the first rendering operation.
- step 103 may include:
- the consumption of computer hardware resources satisfies the first condition, and determining the first load control tag corresponding to the first load data, and the first load control tag instructs the GPU to perform the first rendering operation on the GPU. 2.
- the operating parameters of the computer hardware are adjusted during the rendering operation.
- the process of determining the first load control tag corresponding to the first load data may be to select one load control tag as the first load control tag from one or more known load control tags.
- the target solution is used to adjust the operating parameters of the computer hardware.
- the embodiments of the present application do not specifically limit the content of the target solution.
- the first condition and the first load control label may be different.
- the first condition may be that the CPU frequency is greater than the preset frequency; correspondingly, if the CPU frequency is greater than the preset frequency, a first load control label is generated.
- the first load control label may include "CPU Bound", where "CPU Bound” indicates that the currently running game application is computationally intensive; the first load control label may also include "Bound intensity", where "Bound intensity” indicates that the calculation is intensive degree.
- the first load control label indicates to adjust the frequency point of the CPU, the GPU or the internal memory in the process of performing the second rendering operation on the GPU.
- the form of the first load control label can be as shown in Table 1 below, which specifically includes two fields of frequency modulation object and frequency point, that is, it indicates that the frequency point of the frequency modulation object is adjusted; wherein, the frequency modulation object can be CPU, GPU or internal frequency modulation object. memory.
- the load data includes a second type of load data
- the second type of load data represents information of a mesh model rendered by the GPU by performing the first rendering operation
- step 103 may include:
- a second load control label corresponding to the second load data is determined, and the second load control label instructs the GPU to perform the first rendering operation on the GPU.
- the Mesh model rendered during the second rendering operation is simplified.
- the process of determining the second load control tag corresponding to the second load data may be to select one load control tag as the second load control tag from one or more known load control tags.
- model simplification can be understood as reducing the detail accuracy of the Mesh model; specifically, based on the foregoing description, it can be seen that the Mesh model is composed of triangular meshes, so fewer triangular meshes can be used to represent the Mesh model to simplify the Mesh model and The purpose of reducing the load.
- the target solution is used to simplify the Mesh model rendered during the GPU performing the second rendering operation.
- the embodiments of the present application do not specifically limit the content of the target solution.
- the second condition and the second load control label may be different.
- the second type of load data includes the number of vertices and the number of Mesh models in each frame of image rendered by the first rendering operation, and correspondingly, the second condition includes the number of vertices in each frame of image rendered by the first rendering operation.
- the number is greater than the first threshold, or the number of Mesh models in each frame of image rendered by the first rendering operation is greater than the second threshold.
- the number of vertices in each frame of image is less than or equal to 500K is the first level
- the number of vertices in each frame of image is greater than 500K and less than 2000K is the second level
- the number of vertices in each frame image is greater than or equal to 2000K is the third level .
- the first threshold can be set to 500K or 2000K. Among them, K represents thousands.
- the form of the second load control label can be as shown in Table 2, that is, the characteristics of the Mesh model to be simplified in the process of instructing the GPU to perform the second rendering operation, the simplified algorithm applicable to the Mesh model to be simplified, and the characteristics of the simplified algorithm. parameter.
- the second load control label in the embodiment of the present application indicates the characteristics of the Mesh model to be simplified.
- the features of the Mesh model to be simplified may include various features, which are not specifically limited in this embodiment of the present application.
- the features of the Mesh model to be simplified may include shape features, the scale of the number of vertices, the rendering frequency, and the distance relative to the screen.
- the shape feature can include umbrella body, closure body and extension body; the structure of the umbrella body is shown in Figure 6, in the game scene, the shape feature of the Mesh model of the tree is usually the umbrella body; The structure is shown in Figure 7. In the game scene, the shape features of Mesh models such as cars and characters are usually closed bodies; the structure of the extended body is shown in Figure 8. In the game scene, the shape features of Mesh models such as mountains and rivers are Usually an extension.
- the scale of the number of vertices can include large-scale, medium-scale and small-scale; for example, a mesh model with a number of vertices greater than or equal to 50K can be called large-scale, and a mesh model with a number of vertices greater than 5K and less than 50K can be called medium-scale, and the number of vertices can be called medium-scale. Mesh models smaller than 5K can be called small scale. It should be noted that the representation of the scale of the number of vertices is not limited to the above.
- Rendering frequency can include low frequency, mid frequency and high frequency.
- the rendering frequency of the Mesh model can be classified according to the number of times the same Mesh model is rendered in 1000 frames of images. It should be noted that the representation of the rendering frequency is not limited to the above-mentioned manner.
- the distance relative to the screen may include a short distance and a long distance; specifically, it may be specifically determined according to the distance of the Mesh model relative to the screen, which is not repeated in this embodiment of the present application.
- the second load label indicates the Mesh model that needs to be simplified.
- the second load control tag indicates that among the Mesh models rendered by the first rendering operation, the number of vertices is greater than the third threshold, the number of repetitions is greater than the fourth threshold, or the distance from the screen is greater than the fifth threshold.
- the threshold mesh model is simplified.
- the second load label may indicate a Mesh model whose number of vertices is greater than the third threshold.
- the second load label may indicate that the Mesh model whose repetition number is greater than the fourth threshold is to be simplified.
- the same level of detail (LOD) is usually selected for rendering; while for Mesh models farther from the screen, there are usually different levels of detail in the image. It is important, so it is wasteful to choose a higher LOD for rendering, that is, the Mesh model that is far away from the screen can be simplified. Therefore, the second load label may indicate that the Mesh model whose distance relative to the screen is greater than the fifth threshold is simplified.
- the specific process of step 103 may be as shown in FIG. 9 .
- the necessity of simplifying the Mesh model is determined by the number of vertices in each frame of the image rendered by the first rendering operation and the number of Mesh models, and the image rendered by the GPU in the process of performing the first rendering operation is determined.
- the number of vertices of each Mesh model, the number of repetitions of the Mesh model in each frame of image rendered by the GPU performing the first rendering operation, and the distance of each Mesh model rendered by the GPU during the first rendering operation relative to the screen are determined
- the list of mesh models to be simplified can be understood as the second load control label, which specifically indicates the characteristics of the mesh model to be simplified, the simplified algorithm applicable to the mesh model to be simplified, and the parameters of the simplified algorithm.
- the load data includes a third type of load data
- the third type of load data represents information of at least one first instruction
- step 103 includes:
- a third load control tag corresponding to the third load data is determined, and the third load control tag instructs to process the at least one second instruction.
- the process of determining the third load control tag corresponding to the third load data may be to select one load control tag as the third load control tag from one or more known load control tags.
- the target solution is used to process the at least one second instruction.
- the embodiments of the present application do not specifically limit the content of the target solution.
- the third condition and the third load control label may be different.
- the third condition may be that the number of DCs is multiple, and two or more DCs are used to render the same object.
- the third load data includes 100 DCs that render the same character. Since the DCs in the third load data satisfy the third condition, the 100 DCs that render the same character can be combined into one DC.
- the third condition may be that the number of rendering channels is multiple, two or more.
- the reference relationship between the rendering pass pair and the frame buffer is adjacent, and the frame buffers corresponding to two or more rendering passes have the same size.
- the third load data includes three rendering channels, the size of the frame buffer, and the reference relationship between the three rendering channels and the frame buffer.
- the first rendering pass is used to render Mesh models such as mountains and trees, and the rendering results of the first rendering pass are output to the first frame buffer;
- the second rendering pass is used to render houses based on the rendering results of the first rendering pass. Waiting for the Mesh model of the building, the rendering result of the second rendering pass is output to the second frame buffer;
- the third rendering pass is used to render the Mesh model of the character on the basis of the rendering result of the second rendering pass, and the second rendering pass The rendering result is output to the third framebuffer.
- the reference relationship between the second rendering pass and the second frame buffer is close to the reference relationship between the first rendering pass and the first frame buffer; the same Ground, the reference relationship between the third rendering pass and the third frame buffer is adjacent to the reference relationship between the second rendering pass and the second frame buffer.
- the first rendering pass, the second rendering pass and the third rendering pass can be merged, and only one frame buffer is required for the merged rendering pass.
- the third condition can be understood with reference to the third condition in the foregoing example.
- the process of determining the third load control tag is shown in Figure 10, that is, according to the API load (including the number of DCs, the size of the frame buffer, the number of rendering channels) and the relationship (including the reference relationship between the DC and the frame buffer, The reference relationship between the rendering pass and the frame buffer) determines the third load control label.
- the API and scene changes in adjacent frame images can also be analyzed to obtain a third load control tag indicating that the image is rendered every other frame.
- the scene becomes more and more complex, and the number of Mesh models in the image is more and more, it can be considered that the load is getting bigger and bigger; based on this, the corresponding load control label can be determined, and then the The corresponding target scheme to reduce the load.
- step 104 if the third load control tag instructs to process multiple second instructions, after step 104, at least one second instruction acquired in step 104 is first processed according to the target scheme, and then the processed of at least one second instruction passed to the graphics API.
- step 104 8 second instructions are obtained, and these 8 second instructions constitute 2 DCs, after the 2 DCs constituted by these 8 second instructions are merged, the merged DCs are sent to pass down.
- the number of second instructions is multiple; as shown in FIG. 11 , the third load control label indicates at least one of the following contents: combining multiple DCs formed by multiple second instructions, Combine multiple rendering passes corresponding to multiple second instructions.
- the third load control tag may also instruct to merge multiple instances; for example, multiple second instructions are used to render 50 trees, and each 5 trees are rendered as a group (that is, one instance Instance), Then multiple second instructions for rendering 50 trees can be combined.
- the third load control tag may also indicate a vibration isolation rendered image.
- the form of the third load control tag may be as shown in Table 3 below, where the third load tag indicates the name of the second instruction to be processed, the characteristics of the second instruction, and the scheme encoding and processing for processing the second instruction Scheme parameters of the second command.
- the flow of the load control shown in FIG. 3 may be shown in FIG. 12 .
- the acquired data related to the first instruction includes at least one first instruction, time-consuming management, running data and resource data.
- the time-consuming management is used to determine the calculation time in the first type of load data
- the operation data is used to determine the CPU's operating parameters (such as frequency points), the GPU's operating parameters (such as frequency points) in the first type of load data, and Operating parameters of the internal memory (eg frequency points).
- the load data determined according to the signature database includes the first type of load data, the second type of load data and the third type of load data.
- a load control label can be determined, and according to the load control label, a target solution can be matched from the load control solution library, and the target solution can be used to adjust the operating parameters, simplify the mesh model, and process at least one second instruction.
- an embodiment of the present application further provides an embodiment of an apparatus for controlling a load, which can be applied to a CPU, including:
- an instruction acquisition module 201 configured to acquire at least one first instruction, where the at least one first instruction is used to call an application program interface API, so that the graphics processor GPU performs the first rendering operation;
- a load data determination module 202 configured to determine load data of a process in which the GPU performs the first rendering operation based on at least one first instruction
- a target solution determination module 203 configured to determine a target solution for controlling the load based on the load data
- the instruction acquisition module 201 is further configured to acquire at least one second instruction, and the at least one second instruction is used to call the API, so that the GPU performs the second rendering operation;
- the control module 204 is configured to control the load in the process of performing the second rendering operation on the GPU based on the target scheme.
- the load data determination module 202 is configured to obtain at least one kind of load data of a process in which the GPU performs the first rendering operation based on at least one first instruction and at least one load characteristic factor, and each load characteristic factor corresponds to one type of load data. load data.
- the at least one load characteristic factor includes at least one of the following three types of load characteristic factors: a first type of load characteristic factor, a second type of load characteristic factor, and a third type of load characteristic factor; the first type of load characteristic factor The factor is used to represent the consumption of computer hardware resources in the process of the GPU performing the first rendering operation; the second type of load characteristic factor is used to represent the information of the mesh model rendered by the GPU in the process of performing the first rendering operation; the third type The load characteristic factor is used to represent information of at least one first instruction.
- the first type of load characteristic factor includes at least one of the following: calculation time in the process of the GPU performing the first rendering operation, operating parameters of the central processing unit CPU, operating parameters of the GPU, and operation of the internal memory parameter;
- the second type of load characteristic factor includes at least one of the following: the number of vertices of each Mesh model rendered in the process of the GPU performing the first rendering operation, the number of vertices in each frame of the image rendered in the process of the GPU performing the first rendering operation.
- the number of vertices, the number of Mesh models in each frame of images rendered by the GPU in the process of performing the first rendering operation, the number of repetitions of Mesh models in each frame of images rendered by the GPU in the process of performing the first rendering operation, and the first rendering by the GPU The distance of each Mesh model rendered by the operation process relative to the screen; the third type of load characteristic factor includes at least one of the following: the number of drawing commands DC formed by at least one first instruction, the rendering corresponding to at least one first instruction The number of channel Render Passes, the frame buffer Frame Buffer size, the reference relationship between rendering channels and frame buffers, and the reference relationship between DC and frame buffers.
- the at least one load characteristic factor includes a second type of load characteristic factor
- the load data determination module 202 is configured to determine, based on the parameters carried by the at least one first instruction, the mesh rendered by the GPU by performing the first rendering operation Data of the model; based on the data of the mesh model rendered by the GPU performing the first rendering operation, obtain the load data corresponding to the second type of load characteristic factor in the process of the GPU performing the first rendering operation.
- the target solution determination module 203 is configured to determine a load control label based on the load data, where the load control label indicates the content of the load control; and determine the target solution for controlling the load based on the load control label.
- the load data includes the first type of load data, and the first type of load data represents the consumption of computer hardware resources in the process of the GPU performing the first rendering operation;
- the target solution determination module 203 is configured to, based on the first type of load, The data indicates that the consumption of computer hardware resources in the process of executing the first rendering operation on the GPU satisfies the first condition, and a first load control label is determined, and the first load control label indicates the running parameters of the computer hardware in the process of executing the second rendering operation on the GPU Make adjustments.
- the first load control tag instructs to adjust the frequency point of the CPU, the GPU or the internal memory in the process of performing the second rendering operation on the GPU.
- the load data includes the second type of load data, and the second type of load data represents the information of the mesh model rendered by the GPU performing the first rendering operation;
- the target solution determination module 203 is configured to, based on the first type of load, The data indicates that the information of the mesh model rendered by the GPU performing the first rendering operation satisfies the second condition, and a second load control label is determined, and the second load control label indicates the Mesh model rendered in the process of performing the second rendering operation on the GPU to simplify.
- the second load control tag indicates the characteristics of the Mesh model to be simplified during the GPU performing the second rendering operation, the simplified algorithm applicable to the Mesh model to be simplified, and the parameters of the simplified algorithm.
- the second type of load data includes the number of vertices and the number of Mesh models in each frame of image rendered by the first rendering operation; the second condition includes the number of vertices in each frame of image rendered by the first rendering operation is greater than the first threshold, or the number of Mesh models in each frame of image rendered by the first rendering operation is greater than the second threshold.
- the second load control tag indicates that among the Mesh models rendered by the first rendering operation, the number of vertices is greater than the third threshold, the number of repetitions is greater than the fourth threshold, or the distance from the screen is greater than The Mesh model of the fifth threshold is simplified.
- the load data includes a third type of load data, and the third type of load data represents information of at least one first instruction; the target solution determination module 203 is configured to indicate the at least one first instruction based on the third type of load data.
- the instruction information satisfies the third condition, a third load control tag is determined, and the third load control tag instructs to process at least one second instruction.
- the number of second instructions is multiple;
- the third load control label indicates at least one of the following contents: combining multiple DCs formed by multiple second instructions, and combining multiple DCs corresponding to multiple second instructions Combine multiple Render Passes.
- the terminal can be any terminal device including mobile phone, tablet computer, personal digital assistant (full name in English: Personal Digital Assistant, English abbreviation: PDA), sales terminal (full name in English: Point of Sales, English abbreviation: POS), vehicle computer, etc. Take the terminal as a mobile phone as an example:
- FIG. 14 is a block diagram showing a partial structure of a mobile phone related to a terminal provided by an embodiment of the present application.
- the mobile phone includes: a radio frequency (full name in English: Radio Frequency, English abbreviation: RF) circuit 1010, a memory 1020, an input unit 1030, a display unit 1040, a sensor 1050, an audio circuit 1060, a wireless fidelity (full name in English: wireless fidelity) , English abbreviation: WiFi) module 1070, central processing unit CPU1080, graphics processing unit GPU1090, power supply and other components.
- RF radio frequency
- the RF circuit 1010 can be used for receiving and sending signals during sending and receiving of information or during a call. In particular, after receiving the downlink information of the base station, it is processed by the CPU 1080; in addition, it sends the designed uplink data to the base station.
- the RF circuit 1010 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (full name in English: Low Noise Amplifier, English abbreviation: LNA), a duplexer, and the like.
- the RF circuit 1010 can also communicate with networks and other devices via wireless communication.
- the above wireless communication can use any communication standard or protocol, including but not limited to Global System for Mobile Communication (English full name: Global System of Mobile communication, English abbreviation: GSM), General Packet Radio Service (English full name: General Packet Radio Service, GPRS ), Code Division Multiple Access (English full name: Code Division Multiple Access, English abbreviation: CDMA), Wideband Code Division Multiple Access (English full name: Wideband Code Division Multiple Access, English abbreviation: WCDMA), Long Term Evolution (English full name: Long Term Evolution, English abbreviation: LTE), e-mail, short message service (full name in English: Short Messaging Service, SMS) and so on.
- GSM Global System for Mobile Communication
- GSM Global System of Mobile communication
- GPRS General Packet Radio Service
- CDMA Code Division Multiple Access
- WCDMA Wideband Code Division Multiple Access
- LTE Long Term Evolution
- SMS short message service
- the memory 1020 can be used to store software programs and modules, and the CPU 1080 executes various functional applications and data processing of the mobile phone by running the software programs and modules stored in the memory 1020 .
- the memory 1020 may mainly include a stored program area and a stored data area, wherein the stored program area may store an operating system, an application program required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; Data created by the use of the mobile phone (such as audio data, phone book, etc.), etc. Additionally, memory 1020 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
- the input unit 1030 can be used for receiving inputted number or character information, and generating key signal input related to user setting and function control of the mobile phone.
- the input unit 1030 may include a touch panel 1031 and other input devices 1032 .
- the touch panel 1031 also referred to as a touch screen, can collect the user's touch operations on or near it (such as the user's finger, stylus, etc., any suitable object or accessory on or near the touch panel 1031). operation), and drive the corresponding connection device according to the preset program.
- the touch panel 1031 may include two parts, a touch detection device and a touch controller.
- the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it to the touch controller.
- the touch panel 1031 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves.
- the input unit 1030 may also include other input devices 1032 .
- other input devices 1032 may include, but are not limited to, one or more of physical keyboards, function keys (such as volume control keys, switch keys, etc.), trackballs, mice, joysticks, and the like.
- the display unit 1040 may be used to display information input by the user or information provided to the user and various menus of the mobile phone.
- the display unit 1040 may include a display panel 1041.
- a liquid crystal display (English full name: Liquid Crystal Display, English abbreviation: LCD), an organic light-emitting diode (English full name: Organic Light-Emitting Diode, English abbreviation: OLED), etc. form to configure the display panel 1041.
- the touch panel 1031 can cover the display panel 1041. When the touch panel 1031 detects a touch operation on or near it, it transmits it to the CPU 1080 to determine the type of the touch event, and then the CPU 1080 displays the touch event on the display panel according to the type of the touch event.
- the corresponding visual output is provided on 1041.
- the touch panel 1031 and the display panel 1041 are used as two independent components to realize the input and input functions of the mobile phone, in some embodiments, the touch panel 1031 and the display panel 1041 can be integrated to form Realize the input and output functions of the mobile phone.
- the cell phone may also include at least one sensor 1050, such as a light sensor, a motion sensor, and other sensors.
- the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 1041 according to the brightness of the ambient light, and the proximity sensor may turn off the display panel 1041 and/or when the mobile phone is moved to the ear. or backlight.
- the accelerometer sensor can detect the magnitude of acceleration in all directions (usually three axes), and can detect the magnitude and direction of gravity when it is stationary. games, magnetometer attitude calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors such as gyroscope, barometer, hygrometer, thermometer, infrared sensor, etc. Repeat.
- the audio circuit 1060, the speaker 1061, and the microphone 1062 can provide an audio interface between the user and the mobile phone.
- the audio circuit 1060 can convert the received audio data into an electrical signal, and transmit it to the speaker 1061, and the speaker 1061 converts it into a sound signal and outputs it; After receiving, it is converted into audio data, and then the audio data is output to the CPU 1080 for processing, and then sent to, for example, another mobile phone via the RF circuit 1010, or the audio data is output to the memory 1020 for further processing.
- WiFi is a short-distance wireless transmission technology.
- the mobile phone can help users to send and receive emails, browse web pages, and access streaming media through the WiFi module 1070, which provides users with wireless broadband Internet access.
- FIG. 14 shows the WiFi module 1070, it can be understood that it is not a necessary component of the mobile phone, and can be completely omitted as required within the scope of not changing the essence of the invention.
- the CPU 1080 is the control center of the mobile phone, and uses various interfaces and lines to connect various parts of the entire mobile phone. Various functions and processing data for overall monitoring of the mobile phone.
- the CPU 1080 may include one or more processing units; preferably, the CPU 1080 may integrate an application processor and a modulation and demodulation processor, wherein the application processor mainly processes the operating system, user interface, and application programs, etc.
- the processor mainly handles wireless communication. It can be understood that, the above-mentioned modulation and demodulation processor may not be integrated into the CPU 1080.
- the GPU 1090 is mainly used to render the data in the memory 1020 into images, which are displayed in the display unit 1040 .
- the mobile phone also includes a power source (such as a battery) for supplying power to various components.
- a power source such as a battery
- the power source can be logically connected to the CPU 1080 through a power management system, so as to manage charging, discharging, and power consumption management functions through the power management system.
- the mobile phone may also include a camera, a Bluetooth module, and the like, which will not be repeated here.
- the CPU 1080 included in the terminal also has the following functions:
- At least one first instruction is used to call an application program interface API, so that the graphics processor GPU performs the first rendering operation
- the load during the execution of the second rendering operation by the GPU is controlled based on the target scheme.
- the GPU 1090 included in the terminal also has the following functions:
- a first rendering operation is performed based on at least one first instruction, and a second rendering operation is performed based on at least one second instruction.
- Embodiments of the present application further provide a chip including one or more processors. Part or all of the processor is used to read and execute the computer program stored in the memory, so as to execute the method of each embodiment corresponding to FIG. 2 .
- the chip includes a memory, and the memory and the processor are connected to the memory through a circuit or a wire. Further optionally, the chip further includes a communication interface, and the processor is connected to the communication interface.
- the communication interface is used for receiving data and/or information to be processed, the processor obtains the data and/or information from the communication interface, processes the data and/or information, and outputs the processing result through the communication interface.
- the communication interface may be an input-output interface.
- some of the one or more processors may also implement some steps in the above method by means of dedicated hardware, for example, the processing involving the neural network model may be performed by a dedicated neural network processor or graphics processor.
- the methods provided in the embodiments of the present application may be implemented by one chip, or may be implemented collaboratively by multiple chips.
- Embodiments of the present application also provide a computer storage medium, where the computer storage medium is used for storing computer software instructions used by the above-mentioned computer device, which includes a program for executing a program designed for the computer device.
- the computer device can be an apparatus for running an application program as described in the aforementioned FIG. 13 .
- Embodiments of the present application further provide a computer program product, where the computer program product includes computer software instructions, and the computer software instructions can be loaded by a processor to implement the process in the method shown in FIG. 2 .
- the disclosed system, apparatus and method may be implemented in other manners.
- the apparatus embodiments described above are only illustrative.
- the division of the units is only a logical function division. In actual implementation, there may be other division methods.
- multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not implemented.
- the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.
- the units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
- each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
- the above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.
- the integrated unit if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer-readable storage medium.
- the technical solutions of the present application can be embodied in the form of software products in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, and the computer software products are stored in a storage medium , including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.
- the aforementioned storage medium includes: U disk, mobile hard disk, Read-Only Memory (ROM, Read-Only Memory), Random Access Memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program codes .
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Computer Graphics (AREA)
- Image Generation (AREA)
Abstract
Disclosed in embodiments of the present application are a load control method and apparatus, and a device, used for controlling the load during an image rendering process. The method has good applicability and a wide application range. The method in the embodiments of the present application comprises: determining load data according to an instruction for performing a rendering operation; dynamically selecting, from among multiple load control schemes according to the load data, a load control scheme matching a current load condition; and applying the scheme to the subsequent image processing process, thereby achieving load control.
Description
本申请要求于2020年10月29日提交的、中国申请号为202011186852.6、发明名称为“一种控制负载的方法、装置及设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed on October 29, 2020 with the Chinese application number 202011186852.6 and the invention titled "A method, device and device for controlling load", the entire contents of which are incorporated herein by reference Applying.
本申请实施例涉及计算机技术领域,尤其涉及一种控制负载的方法、装置及设备。The embodiments of the present application relate to the field of computer technologies, and in particular, to a method, an apparatus, and a device for controlling a load.
随着通信技术和芯片技术的快速发展,移动终端成为应用程序最重要的部署平台。以游戏类的应用程序为例,越来越多的高画质且高帧率的大型游戏程序部署在移动终端上,这无疑对移动终端的图像渲染性能提出了更高的要求。而移动终端的图像渲染性能有限,所以当图像渲染性能无法满足游戏程序的负载需求时,便会影响用户的游戏体验。With the rapid development of communication technology and chip technology, mobile terminals have become the most important deployment platform for applications. Taking game applications as an example, more and more large-scale game programs with high image quality and high frame rate are deployed on mobile terminals, which undoubtedly puts forward higher requirements on the image rendering performance of mobile terminals. However, the image rendering performance of the mobile terminal is limited, so when the image rendering performance cannot meet the load requirements of the game program, the user's game experience will be affected.
为了避免上述情况发生,目前主要通过以下方法降低游戏程序的负载:在离线状态下针对特定游戏程序进行负载分析,然后确定降低负载的方案,并将降低负载的方案固化到移动终端中。In order to avoid the above situation, currently the load of game programs is mainly reduced by the following methods: load analysis is performed for a specific game program in an offline state, and then a load reduction scheme is determined, and the load reduction scheme is solidified into the mobile terminal.
由于固化在移动终端中的方案无法跟随游戏程序的升级而升级,因此,这种降低负载的方法的适用性较差,应用范围受限。Since the solution fixed in the mobile terminal cannot be upgraded with the upgrade of the game program, this method of reducing the load has poor applicability and limited application scope.
发明内容SUMMARY OF THE INVENTION
本申请实施例提供了一种控制负载的方法、装置及设备,用于控制图像渲染过程中的负载,该方法的适用性较好,应用范围广。Embodiments of the present application provide a method, apparatus, and device for controlling load, which are used to control the load in an image rendering process. The method has good applicability and wide application range.
本申请实施例第一方面提供了一种控制负载的方法,包括:A first aspect of the embodiments of the present application provides a method for controlling a load, including:
获取至少一个第一指令,至少一个第一指令用于调用应用程序接口API,以使得图形处理器GPU执行第一渲染操作;第一渲染操作可以用于对一帧图像中的一个或多个物体进行渲染,也可以用于对多帧图像中的物体进行渲染;基于至少一个第一指令确定GPU执行第一渲染操作的过程的负载数据,其中,本申请实施例不限定负载数据的种类和具体的确定方式;基于负载数据确定用于控制负载的目标方案,本申请实施例也不限定确定目标方案的具体方式;获取至少一个第二指令,至少一个第二指令用于调用API,以使得GPU执行第二渲染操作,第二指令与第一指令本质上相同,都属于调用API的指令;基于目标方案控制GPU执行第二渲染操作的过程中的负载。Acquiring at least one first instruction, where the at least one first instruction is used to call an application program interface API, so that the graphics processor GPU performs a first rendering operation; the first rendering operation can be used for one or more objects in a frame of image Rendering can also be used to render objects in multi-frame images; the load data of the process in which the GPU performs the first rendering operation is determined based on at least one first instruction, wherein the embodiment of the present application does not limit the type and specific load data. Determine the target scheme for controlling the load based on the load data, and the embodiment of the present application does not limit the specific method of determining the target scheme; obtain at least one second instruction, and at least one second instruction is used to call the API, so that the GPU When executing the second rendering operation, the second instruction is essentially the same as the first instruction, and both belong to the instructions for calling the API; the load in the process of executing the second rendering operation on the GPU is controlled based on the target scheme.
基于目标方案控制负载的过程与目标方案的具体内容相关。若目标方案指示对第二指令进行处理,则在获取至少一个第二指令后,先根据目标方案对获取到的至少一个第二指令进行处理,然后将处理后的至少一个第二指令传递下去。若目标方案不指示对第二指令处理,则在获取至少一个第二指令后,不对所述至少第一个第二指令进行处理,而是根据目标方案的具体内容在传递第二指令之前、传递第二指令的过程中或传递第二指令之后, 对负载采取其它形式的调控手段。The process of controlling the load based on the target scheme is related to the specific content of the target scheme. If the target scheme instructs to process the second instruction, after obtaining the at least one second instruction, the obtained at least one second instruction is first processed according to the target scheme, and then the processed at least one second instruction is passed on. If the target solution does not instruct to process the second instruction, after obtaining the at least one second instruction, the at least first second instruction is not processed, but is passed before the second instruction is passed according to the specific content of the target solution. During the process of the second instruction or after the second instruction is transmitted, other forms of control means are adopted for the load.
由于负载数据是基于图像渲染过程中实际获取的第一指令确定的,所以本申请实施例提供的方法可以应用于任意游戏应用程序,不局限于某一款或某几款游戏应用程序,对于升级后的游戏应用程序以及新增加的游戏应用程序也同样适用,所以适用性强,应用范围广;并且,本申请实施例提供的方法也不需要离线执行,可以实现对负载的动态控制。Since the load data is determined based on the first instruction actually obtained in the image rendering process, the method provided by the embodiment of the present application can be applied to any game application, not limited to one or several game applications. The latter game application program and the newly added game application program are also applicable, so the applicability is strong and the application range is wide; in addition, the method provided by the embodiment of the present application does not need to be executed offline, and can realize dynamic control of the load.
作为一种实现方式,基于至少一个第一指令确定GPU执行第一渲染操作的过程的负载数据包括:基于至少一个第一指令和预先设定的至少一个负载特征因子获取GPU执行第一渲染操作的过程的至少一种负载数据,每个负载特征因子对应一种负载数据。其中,负载特征因子可以根据实际需要进行定义,负载特征因子可以理解为负载数据的特征参数,每个负载特征因子指示一种负载,每个负载特征因子的取值则可以作为一种具体的负载数据。示例性地,负载特征因子可以指示计算机硬件资源的一种信息,该负载特征因子的取值则可以作为一种负载数据;例如,负载特征因子指示CPU的频点,对应地,该CPU的实际频点则可以作为一种负载数据。示例性地,负载特征因子还可以指示第一指令的数量,对应地,第一指令的具体数量则可以作为一种负载数据。As an implementation manner, determining the load data of the process in which the GPU performs the first rendering operation based on the at least one first instruction includes: acquiring the load data of the GPU performing the first rendering operation based on the at least one first instruction and at least one preset load characteristic factor. At least one kind of load data of the process, and each load characteristic factor corresponds to one kind of load data. Among them, the load characteristic factor can be defined according to actual needs. The load characteristic factor can be understood as the characteristic parameter of the load data. Each load characteristic factor indicates a load, and the value of each load characteristic factor can be regarded as a specific load. data. Exemplarily, the load characteristic factor may indicate a kind of information of computer hardware resources, and the value of the load characteristic factor may be used as a kind of load data; for example, the load characteristic factor indicates the frequency of the CPU, and correspondingly, the actual The frequency point can be used as a kind of load data. Exemplarily, the load characteristic factor may also indicate the quantity of the first instructions, and correspondingly, the specific quantity of the first instructions may be used as a kind of load data.
由于可以根据需要预先设定至少一个负载特征因子,对应每个负载特征因子可以得到一种负载数据,所以可以保证负载数据比较全面且具有代表性。Since at least one load characteristic factor can be preset as required, and one kind of load data can be obtained corresponding to each load characteristic factor, it can be ensured that the load data is comprehensive and representative.
作为一种实现方式,至少一个负载特征因子包括以下三类负载特征因子中的至少一类:第一类负载特征因子、第二类负载特征因子和第三类负载特征因子;第一类负载特征因子用于表示GPU执行第一渲染操作的过程对计算机硬件资源的消耗情况,该硬件资源可以是CPU、GPU以及内部存储器等;第二类负载特征因子用于表示GPU执行第一渲染操作的过程所渲染的网格Mesh模型的信息,网格Mesh模型的信息可以包括网格Mesh模型的顶点数量以及网格Mesh模型的数量等多种信息;第三类负载特征因子用于表示至少一个第一指令的信息,第一指令的信息可以包括第一指令的数量和指令间的关系等多种信息。As an implementation manner, the at least one load characteristic factor includes at least one of the following three types of load characteristic factors: a first type of load characteristic factor, a second type of load characteristic factor, and a third type of load characteristic factor; the first type of load characteristic factor The factor is used to represent the consumption of computer hardware resources in the process of the GPU performing the first rendering operation. Information of the rendered mesh Mesh model, the information of the mesh Mesh model may include the number of vertices of the mesh Mesh model and the number of mesh Mesh models and other information; the third type of load characteristic factor is used to represent at least one first. The information of the instruction, the information of the first instruction may include various information such as the quantity of the first instruction and the relationship between the instructions.
至少一个负载特征因子包括上述三类负载特征因子中的至少一类;当至少一个负载特征因子包括上述两类或上述三类负载特征因子时,保证从多个维度获取到多种负载数据,从而便于确定更加适合的用于降低负载的目标方案。At least one load characteristic factor includes at least one of the above three types of load characteristic factors; when at least one load characteristic factor includes the above two types or the above three types of load characteristic factors, it is guaranteed to obtain a variety of load data from multiple dimensions, thereby It is convenient to determine a more suitable target scheme for reducing the load.
作为一种实现方式,负载数据包括第一类负载数据、第二类负载数据和第三类负载数据中的至少一种;第一类负载数据表示GPU执行第一渲染操作的过程对计算机硬件资源的消耗情况;第二类负载数据表示GPU执行第一渲染操作所渲染的网格Mesh模型的信息;第三类负载数据表示至少一个第一指令的信息。As an implementation manner, the load data includes at least one of the first type of load data, the second type of load data, and the third type of load data; the first type of load data indicates that the process of the GPU performing the first rendering operation affects the computer hardware resources The second type of load data represents the information of the mesh model rendered by the GPU performing the first rendering operation; the third type of load data represents the information of at least one first instruction.
在该实现方式中,负载数据可以包括上述三类负载数据中的至少一类,保证了负载数据的多样化。In this implementation manner, the load data may include at least one of the above three types of load data, which ensures the diversification of the load data.
作为一种实现方式,第一类负载特征因子包括以下的至少一种:GPU执行第一渲染操作的过程中的计算耗时、中央处理器CPU的运行参数、GPU的运行参数以及内部存储器的运行参数;第二类负载特征因子包括以下的至少一种:GPU执行第一渲染操作的过程所渲染的每个Mesh模型的顶点数量、GPU执行第一渲染操作的过程所渲染的每帧图像中的顶点数量、GPU执行第一渲染操作的过程所渲染的每帧图像中的Mesh模型的数量、GPU执行第 一渲染操作的过程所渲染的每帧图像中Mesh模型的重复数量和GPU执行第一渲染操作的过程所渲染的每个Mesh模型相对于屏幕的距离;第三类负载特征因子包括以下的至少一种:至少一个第一指令构成的绘制命令DC的数量、至少一个第一指令对应的渲染通道Render Pass的数量、帧缓冲Frame Buffer尺寸、渲染通道与帧缓冲的引用关系、DC与帧缓冲的引用关系。As an implementation manner, the first type of load characteristic factor includes at least one of the following: calculation time in the process of the GPU performing the first rendering operation, operating parameters of the central processing unit CPU, operating parameters of the GPU, and operation of the internal memory parameter; the second type of load characteristic factor includes at least one of the following: the number of vertices of each Mesh model rendered in the process of the GPU performing the first rendering operation, the number of vertices in each frame of the image rendered in the process of the GPU performing the first rendering operation. The number of vertices, the number of Mesh models in each frame of images rendered by the GPU in the process of performing the first rendering operation, the number of repetitions of Mesh models in each frame of images rendered by the GPU in the process of performing the first rendering operation, and the first rendering by the GPU The distance of each Mesh model rendered by the operation process relative to the screen; the third type of load characteristic factor includes at least one of the following: the number of drawing commands DC formed by at least one first instruction, the rendering corresponding to at least one first instruction The number of channel Render Passes, the frame buffer Frame Buffer size, the reference relationship between rendering channels and frame buffers, and the reference relationship between DC and frame buffers.
该实现方式提供了每类负载特征因子的多种选择,从而保证了负载数据的多样化。This implementation provides multiple choices for each type of load characteristic factor, thereby ensuring the diversification of load data.
作为一种实现方式,第一类负载数据可以包括以下的至少一种:计算耗时、中央处理器CPU的负载数据、GPU的负载数据以及DDR内存的负载数据;第二类负载数据可以包括以下的至少一种:GPU执行第一渲染操作的过程所渲染的每个Mesh模型的顶点数量、GPU执行第一渲染操作的过程所渲染的每帧图像中的顶点数量、GPU执行第一渲染操作的过程所渲染的每帧图像中的Mesh模型的数量、GPU执行第一渲染操作的过程所渲染的每帧图像中Mesh模型的重复数量和GPU执行第一渲染操作的过程所渲染的每个Mesh模型相对于屏幕的距离;第三类负载数据可以包括以下的至少一种:至少一个第一指令构成的绘制命令(Draw Call,DC)的数量、至少一个第一指令对应的渲染通道Render Pass的数量、帧缓冲Frame Buffer尺寸、渲染通道与帧缓冲的引用关系、DC与帧缓冲的引用关系。As an implementation manner, the first type of load data may include at least one of the following: calculation time, CPU load data, GPU load data, and DDR memory load data; the second type of load data may include the following At least one of: the number of vertices of each Mesh model rendered by the process of the GPU performing the first rendering operation, the number of vertices in each frame of the image rendered by the process of the GPU performing the first rendering operation, the number of vertices of the GPU performing the first rendering operation. The number of Mesh models in each frame of image rendered by the process, the number of repetitions of Mesh models in each frame of image rendered by the GPU in the process of performing the first rendering operation, and the number of Mesh models rendered in the process of the GPU performing the first rendering operation The distance relative to the screen; the third type of load data can include at least one of the following: the number of drawing commands (Draw Call, DC) formed by at least one first instruction, the number of rendering channels Render Pass corresponding to at least one first instruction , Frame Buffer Frame Buffer size, the reference relationship between the rendering channel and the frame buffer, and the reference relationship between the DC and the frame buffer.
对于每类负载数据也可以有多种选择,从而保证了负载数据的多样化。There can also be multiple choices for each type of load data, thereby ensuring the diversification of load data.
作为一种实现方式,至少一个负载特征因子包括第二类负载特征因子;基于至少一个第一指令和至少一个负载特征因子获取GPU执行第一渲染操作的过程的至少一种负载数据包括:基于至少一个第一指令各自携带的参数确定GPU执行第一渲染操作所渲染的网格Mesh模型的数据;基于GPU执行第一渲染操作所渲染的网格Mesh模型的数据,获取GPU执行第一渲染操作的过程对应第二类负载特征因子的负载数据。As an implementation manner, the at least one load characteristic factor includes a second type of load characteristic factor; and acquiring at least one load data of a process in which the GPU performs the first rendering operation based on the at least one first instruction and the at least one load characteristic factor includes: based on at least one of the first instructions and the at least one load characteristic factor. The parameters carried by a first instruction respectively determine the data of the mesh Mesh model rendered by the GPU executing the first rendering operation; based on the data of the mesh Mesh model rendered by the GPU executing the first rendering operation, obtain the data of the mesh model that the GPU executes the first rendering operation. The process corresponds to the load data of the second type of load characteristic factor.
在该实现方式中,第一指令携带的参数指示待渲染的Mesh模型的数据,根据该待渲染的Mesh模型的数据则可以确定对应第二类负载特征因子的负载数据。In this implementation manner, the parameter carried by the first instruction indicates the data of the mesh model to be rendered, and according to the data of the mesh model to be rendered, load data corresponding to the second type of load characteristic factor can be determined.
作为一种实现方式,基于负载数据确定用于控制负载的目标方案包括:基于负载数据确定负载控制标签,负载控制标签指示负载控制的内容,其中,对于同一负载数据,可以确定一个或多个负载控制标签;基于负载控制标签从预设的至少一种负载控制方案中选择一种负载控制方案,作为用于控制负载的目标方案。例如,若负载数据为CPU的频点,则第一负载标签则可以指示对CPU的频点进行控制;若负载数据为第一指令的数量,则第一负载标签则可以指示对第一指令的数量进行控制。As an implementation manner, determining the target solution for controlling the load based on the load data includes: determining a load control label based on the load data, where the load control label indicates the content of the load control, wherein, for the same load data, one or more loads may be determined A control label; based on the load control label, a load control scheme is selected from at least one preset load control scheme as a target scheme for controlling the load. For example, if the load data is the frequency of the CPU, the first load tag can indicate the frequency of the CPU to be controlled; if the load data is the number of the first instructions, the first load tag can indicate the frequency of the first instruction. quantity is controlled.
在该实现方式中,负载控制标签的设定,使得开发者可以灵活扩展负载控制方案,即预先设定与负载控制标签关联的更多的负载控制方案以供选择。In this implementation manner, the setting of the load control tag enables the developer to flexibly expand the load control scheme, that is, preset more load control schemes associated with the load control tag for selection.
作为一种实现方式,负载数据包括第一类负载数据,第一类负载数据表示GPU执行第一渲染操作的过程对计算机硬件资源的消耗情况;基于负载数据确定负载控制标签包括:基于第一类负载数据指示GPU执行第一渲染操作的过程对计算机硬件资源的消耗情况满足第一条件,确定第一负载控制标签,第一负载控制标签指示对GPU执行第二渲染操作的过程中计算机硬件的运行参数进行调节。As an implementation manner, the load data includes the first type of load data, and the first type of load data represents the consumption of computer hardware resources in the process of the GPU performing the first rendering operation; determining the load control label based on the load data includes: based on the first type of load data The load data indicates that the consumption of computer hardware resources in the process of performing the first rendering operation on the GPU satisfies the first condition, and a first load control tag is determined, and the first load control tag indicates the operation of the computer hardware in the process of performing the second rendering operation on the GPU parameters are adjusted.
在该实现方式中,当负载数据包括第一类负载数据,第一负载控制标签指示对计算机 硬件的运行参数进行调节,从而可以通过调节计算机硬件的运行参数以达到降低负载的目的。In this implementation, when the load data includes the first type of load data, the first load control label instructs to adjust the operating parameters of the computer hardware, so that the purpose of reducing the load can be achieved by adjusting the operating parameters of the computer hardware.
作为一种实现方式,第一负载控制标签指示对GPU执行第二渲染操作的过程中CPU、GPU或内部存储器的频点进行调节。As an implementation manner, the first load control tag instructs to adjust the frequency point of the CPU, the GPU or the internal memory in the process of performing the second rendering operation on the GPU.
该实现方式提供了第一负载控制标签的一种具体内容,即指示对CPU、GPU或内部存储器的频点进行调节。This implementation provides a specific content of the first load control label, that is, instructs to adjust the frequency point of the CPU, GPU or internal memory.
作为一种实现方式,负载数据包括第二类负载数据,第二类负载数据表示GPU执行第一渲染操作所渲染的网格Mesh模型的信息;基于负载数据确定负载控制标签包括:基于第一类负载数据指示GPU执行第一渲染操作所渲染的网格Mesh模型的信息满足第二条件,确定第二负载控制标签,第二负载控制标签指示对GPU执行第二渲染操作的过程中所渲染的Mesh模型进行简化。As an implementation manner, the load data includes a second type of load data, and the second type of load data represents information of a mesh model rendered by the GPU performing the first rendering operation; determining the load control label based on the load data includes: based on the first type of load data The load data indicates that the information of the mesh model rendered by the GPU performing the first rendering operation satisfies the second condition, and a second load control label is determined, and the second load control label indicates the Mesh rendered in the process of performing the second rendering operation on the GPU The model is simplified.
在该实现方式中,当负载数据包括第二类负载数据,第二负载控制标签指示对所渲染的Mesh模型进行简化,从而可以通过调节计算机硬件的运行参数以达到降低负载的目的。In this implementation manner, when the load data includes the second type of load data, the second load control tag instructs to simplify the rendered Mesh model, so as to reduce the load by adjusting the operating parameters of the computer hardware.
作为一种实现方式,第二负载控制标签指示GPU执行第二渲染操作的过程中待简化的Mesh模型的特征、待简化的Mesh模型适用的简化算法以及简化算法的参数。As an implementation manner, the second load control tag indicates the characteristics of the Mesh model to be simplified during the GPU performing the second rendering operation, the simplified algorithm applicable to the Mesh model to be simplified, and the parameters of the simplified algorithm.
该实现方式提供了第二负载控制标签的一种具体内容,即指示待简化的Mesh模型的特征、待简化的Mesh模型适用的简化算法以及简化算法的参数。This implementation provides a specific content of the second load control label, ie, indicates the characteristics of the Mesh model to be simplified, the simplified algorithm applicable to the Mesh model to be simplified, and the parameters of the simplified algorithm.
作为一种实现方式,第二类负载数据包括第一渲染操作所渲染的每帧图像中的顶点数量和Mesh模型的数量;第二条件包括第一渲染操作所渲染的每帧图像中的顶点数量大于第一阈值,或第一渲染操作所渲染的每帧图像中的Mesh模型的数量大于第二阈值。As an implementation manner, the second type of load data includes the number of vertices and the number of Mesh models in each frame of image rendered by the first rendering operation; the second condition includes the number of vertices in each frame of image rendered by the first rendering operation is greater than the first threshold, or the number of Mesh models in each frame of image rendered by the first rendering operation is greater than the second threshold.
在该实现方式中,从每帧图像中的顶点数量和Mesh模型的数量两个维度定义了第二条件。In this implementation, the second condition is defined from two dimensions, the number of vertices in each frame of image and the number of Mesh models.
作为一种实现方式,第二负载控制标签指示对第一渲染操作所渲染的Mesh模型中,顶点数量大于第三阈值的Mesh模型、重复数量大于第四阈值的Mesh模型或相对于屏幕的距离大于第五阈值的Mesh模型进行简化。As an implementation manner, the second load control tag indicates that among the Mesh models rendered by the first rendering operation, the number of vertices is greater than the third threshold, the number of repetitions is greater than the fourth threshold, or the distance from the screen is greater than The Mesh model of the fifth threshold is simplified.
在该实现方式中,从顶点数量、重复数量以及相对于屏幕的距离定义了待简化的Mesh模型。In this implementation, the Mesh model to be simplified is defined from the number of vertices, the number of repetitions, and the distance from the screen.
作为一种实现方式,负载数据包括第三类负载数据,第三类负载数据表示至少一个第一指令的信息;基于负载数据确定负载控制标签包括:基于第三类负载数据指示至少一个第一指令的指令信息满足第三条件,确定第三负载控制标签,第三负载控制标签指示对至少一个第二指令进行处理。As an implementation manner, the load data includes a third type of load data, and the third type of load data represents information of at least one first instruction; determining the load control tag based on the load data includes: indicating at least one first instruction based on the third type of load data The instruction information of the satisfies the third condition, and the third load control tag is determined, and the third load control tag instructs to process at least one second instruction.
在该实现方式中,当负载数据包括第三类负载数据,第三负载控制标签指示对至少一个第二指令进行处理,从而可以通过对至少一个第二指令的处理达到降低负载的目的。In this implementation manner, when the load data includes the third type of load data, the third load control tag instructs to process the at least one second instruction, so that the purpose of reducing the load can be achieved by processing the at least one second instruction.
作为一种实现方式,第二指令的数量为多个;第三负载控制标签指示以下的至少一种内容:对多个第二指令构成的多个DC进行合并、对多个第二指令对应的多个渲染通道进行合并。As an implementation manner, the number of second instructions is multiple; the third load control label indicates at least one of the following content: combining multiple DCs formed by multiple second instructions, and combining multiple DCs corresponding to multiple second instructions Combine multiple render passes.
该实现方式提供了第三负载控制标签的一种具体内容,即指示对多个DC进行合并或对 多个渲染通道进行合并。This implementation provides a specific content of the third load control tag, that is, indicating that multiple DCs are merged or multiple rendering channels are merged.
本申请实施例第二方面提供了一种控制负载的装置,包括:A second aspect of the embodiments of the present application provides a device for controlling a load, including:
指令获取模块,用于获取至少一个第一指令,至少一个第一指令用于调用应用程序接口API,以使得图形处理器GPU执行第一渲染操作;an instruction acquisition module, configured to acquire at least one first instruction, where the at least one first instruction is used to call an application programming interface API, so that the graphics processor GPU performs the first rendering operation;
负载数据确定模块,用于基于至少一个第一指令确定GPU执行第一渲染操作的过程的负载数据;a load data determination module, configured to determine load data of a process in which the GPU performs the first rendering operation based on the at least one first instruction;
目标方案确定模块,用于基于负载数据确定用于控制负载的目标方案;a target scheme determination module for determining a target scheme for controlling the load based on the load data;
指令获取模块,还用于获取至少一个第二指令,至少一个第二指令用于调用API,以使得GPU执行第二渲染操作;The instruction acquisition module is further configured to acquire at least one second instruction, and the at least one second instruction is used to call the API, so that the GPU performs the second rendering operation;
控制模块,用于基于目标方案控制GPU执行第二渲染操作的过程中的负载。The control module is configured to control the load of the GPU in the process of performing the second rendering operation based on the target scheme.
作为一种实现方式,负载数据确定模块,用于基于至少一个第一指令和至少一个负载特征因子获取GPU执行第一渲染操作的过程的至少一种负载数据,每个负载特征因子对应一种负载数据。As an implementation manner, a load data determination module, configured to acquire at least one kind of load data of a process in which the GPU performs the first rendering operation based on at least one first instruction and at least one load characteristic factor, where each load characteristic factor corresponds to one kind of load data.
作为一种实现方式,至少一个负载特征因子包括以下三类负载特征因子中的至少一类:第一类负载特征因子、第二类负载特征因子和第三类负载特征因子;第一类负载特征因子用于表示GPU执行第一渲染操作的过程对计算机硬件资源的消耗情况;第二类负载特征因子用于表示GPU执行第一渲染操作的过程所渲染的网格Mesh模型的信息;第三类负载特征因子用于表示至少一个第一指令的信息。As an implementation manner, the at least one load characteristic factor includes at least one of the following three types of load characteristic factors: a first type of load characteristic factor, a second type of load characteristic factor, and a third type of load characteristic factor; the first type of load characteristic factor The factor is used to represent the consumption of computer hardware resources in the process of the GPU performing the first rendering operation; the second type of load characteristic factor is used to represent the information of the mesh model rendered by the GPU in the process of performing the first rendering operation; the third type The load characteristic factor is used to represent information of at least one first instruction.
作为一种实现方式,第一类负载特征因子包括以下的至少一种:GPU执行第一渲染操作的过程中的计算耗时、中央处理器CPU的运行参数、GPU的运行参数以及内部存储器的运行参数;第二类负载特征因子包括以下的至少一种:GPU执行第一渲染操作的过程所渲染的每个Mesh模型的顶点数量、GPU执行第一渲染操作的过程所渲染的每帧图像中的顶点数量、GPU执行第一渲染操作的过程所渲染的每帧图像中的Mesh模型的数量、GPU执行第一渲染操作的过程所渲染的每帧图像中Mesh模型的重复数量和GPU执行第一渲染操作的过程所渲染的每个Mesh模型相对于屏幕的距离;第三类负载特征因子包括以下的至少一种:至少一个第一指令构成的绘制命令DC的数量、至少一个第一指令对应的渲染通道Render Pass的数量、帧缓冲Frame Buffer尺寸、渲染通道与帧缓冲的引用关系、DC与帧缓冲的引用关系。As an implementation manner, the first type of load characteristic factor includes at least one of the following: calculation time in the process of the GPU performing the first rendering operation, operating parameters of the central processing unit CPU, operating parameters of the GPU, and operation of the internal memory parameter; the second type of load characteristic factor includes at least one of the following: the number of vertices of each Mesh model rendered in the process of the GPU performing the first rendering operation, the number of vertices in each frame of the image rendered in the process of the GPU performing the first rendering operation. The number of vertices, the number of Mesh models in each frame of images rendered by the GPU in the process of performing the first rendering operation, the number of repetitions of Mesh models in each frame of images rendered by the GPU in the process of performing the first rendering operation, and the first rendering by the GPU The distance of each Mesh model rendered by the operation process relative to the screen; the third type of load characteristic factor includes at least one of the following: the number of drawing commands DC formed by at least one first instruction, the rendering corresponding to at least one first instruction The number of channel Render Passes, the frame buffer Frame Buffer size, the reference relationship between rendering channels and frame buffers, and the reference relationship between DC and frame buffers.
作为一种实现方式,至少一个负载特征因子包括第二类负载特征因子;负载数据确定模块,用于基于至少一个第一指令各自携带的参数确定GPU执行第一渲染操作所渲染的网格Mesh模型的数据;基于GPU执行第一渲染操作所渲染的网格Mesh模型的数据,获取GPU执行第一渲染操作的过程对应第二类负载特征因子的负载数据。As an implementation manner, the at least one load characteristic factor includes the second type of load characteristic factor; the load data determination module is configured to determine, based on the parameters carried by the at least one first instruction, the mesh model rendered by the GPU by performing the first rendering operation Based on the data of the mesh Mesh model rendered by the GPU performing the first rendering operation, obtain the load data of the second type of load characteristic factor corresponding to the process of the GPU performing the first rendering operation.
作为一种实现方式,目标方案确定模块,用于基于负载数据确定负载控制标签,负载控制标签指示负载控制的内容;基于负载控制标签确定用于控制负载的目标方案。As an implementation manner, the target solution determination module is configured to determine a load control label based on the load data, where the load control label indicates the content of the load control; and determine the target solution for controlling the load based on the load control label.
作为一种实现方式,负载数据包括第一类负载数据,第一类负载数据表示GPU执行第一渲染操作的过程对计算机硬件资源的消耗情况;目标方案确定模块,用于基于第一类负载数据指示GPU执行第一渲染操作的过程对计算机硬件资源的消耗情况满足第一条件,确 定第一负载控制标签,第一负载控制标签指示对GPU执行第二渲染操作的过程中计算机硬件的运行参数进行调节。As an implementation manner, the load data includes the first type of load data, and the first type of load data represents the consumption of computer hardware resources in the process of the GPU performing the first rendering operation; the target solution determination module is configured to be based on the first type of load data. The consumption of computer hardware resources in the process of instructing the GPU to perform the first rendering operation satisfies the first condition, and a first load control label is determined. adjust.
作为一种实现方式,第一负载控制标签指示对GPU执行第二渲染操作的过程中CPU、GPU或内部存储器的频点进行调节。As an implementation manner, the first load control tag instructs to adjust the frequency point of the CPU, the GPU or the internal memory in the process of performing the second rendering operation on the GPU.
作为一种实现方式,负载数据包括第二类负载数据,第二类负载数据表示GPU执行第一渲染操作所渲染的网格Mesh模型的信息;目标方案确定模块,用于基于第一类负载数据指示GPU执行第一渲染操作所渲染的网格Mesh模型的信息满足第二条件,确定第二负载控制标签,第二负载控制标签指示对GPU执行第二渲染操作的过程中所渲染的Mesh模型进行简化。As an implementation manner, the load data includes the second type of load data, and the second type of load data represents the information of the mesh model rendered by the GPU performing the first rendering operation; the target solution determination module is configured to be based on the first type of load data. Instructing the GPU to perform the information of the mesh model rendered by the first rendering operation satisfies the second condition, and determining a second load control label, the second load control label instructs the GPU to perform the second rendering operation on the rendered Mesh model. simplify.
作为一种实现方式,第二负载控制标签指示GPU执行第二渲染操作的过程中待简化的Mesh模型的特征、待简化的Mesh模型适用的简化算法以及简化算法的参数。As an implementation manner, the second load control tag indicates the characteristics of the Mesh model to be simplified during the GPU performing the second rendering operation, the simplified algorithm applicable to the Mesh model to be simplified, and the parameters of the simplified algorithm.
作为一种实现方式,第二类负载数据包括第一渲染操作所渲染的每帧图像中的顶点数量和Mesh模型的数量;第二条件包括第一渲染操作所渲染的每帧图像中的顶点数量大于第一阈值,或第一渲染操作所渲染的每帧图像中的Mesh模型的数量大于第二阈值。As an implementation manner, the second type of load data includes the number of vertices and the number of Mesh models in each frame of image rendered by the first rendering operation; the second condition includes the number of vertices in each frame of image rendered by the first rendering operation is greater than the first threshold, or the number of Mesh models in each frame of image rendered by the first rendering operation is greater than the second threshold.
作为一种实现方式,第二负载控制标签指示对第一渲染操作所渲染的Mesh模型中,顶点数量大于第三阈值的Mesh模型、重复数量大于第四阈值的Mesh模型或相对于屏幕的距离大于第五阈值的Mesh模型进行简化。As an implementation manner, the second load control tag indicates that among the Mesh models rendered by the first rendering operation, the number of vertices is greater than the third threshold, the number of repetitions is greater than the fourth threshold, or the distance from the screen is greater than The Mesh model of the fifth threshold is simplified.
作为一种实现方式,负载数据包括第三类负载数据,第三类负载数据表示至少一个第一指令的信息;目标方案确定模块,用于基于第三类负载数据指示至少一个第一指令的指令信息满足第三条件,确定第三负载控制标签,第三负载控制标签指示对至少一个第二指令进行处理。As an implementation manner, the load data includes a third type of load data, and the third type of load data represents information of at least one first instruction; the target solution determination module is configured to indicate at least one instruction of the first instruction based on the third type of load data When the information satisfies the third condition, a third load control tag is determined, and the third load control tag instructs to process at least one second instruction.
作为一种实现方式,第二指令的数量为多个;第三负载控制标签指示以下的至少一种内容:对多个第二指令构成的多个DC进行合并、对多个第二指令对应的多个Render Pass进行合并。As an implementation manner, the number of second instructions is multiple; the third load control label indicates at least one of the following content: combining multiple DCs formed by multiple second instructions, and combining multiple DCs corresponding to multiple second instructions Combine multiple Render Passes.
其中,以上各单元的具体实现、相关说明以及技术效果请参考本申请实施例第一方面的描述。For the specific implementation, related descriptions and technical effects of the above units, please refer to the description of the first aspect of the embodiment of the present application.
本申请实施例第三方面提供了一种终端设备,包括:一个或多个处理器和存储器;其中,所述存储器中存储有计算机可读指令;所述一个或多个处理器读取所述计算机可读指令,以使所述计算机设备实现如第一方面任一实现方式所述的方法。A third aspect of the embodiments of the present application provides a terminal device, including: one or more processors and a memory; wherein, the memory stores computer-readable instructions; the one or more processors read the Computer readable instructions to cause the computer device to implement the method according to any implementation of the first aspect.
本申请实施例第四方面提供了一种计算机可读存储介质,包括计算机可读指令,当所述计算机可读指令在计算机上运行时,使得所述计算机执行如第一方面任一实现方式所述的方法。A fourth aspect of the embodiments of the present application provides a computer-readable storage medium, including computer-readable instructions, when the computer-readable instructions are executed on a computer, the computer is made to execute any implementation manner of the first aspect. method described.
本申请实施例第五方面提供了一种芯片,包括一个或多个处理器。所述处理器中的部分或全部用于读取并执行存储器中存储的计算机程序,以执行上述第一方面任意可能的实现方式中的方法。A fifth aspect of the embodiments of the present application provides a chip, including one or more processors. Part or all of the processor is used to read and execute the computer program stored in the memory, so as to execute the method in any possible implementation manner of the first aspect.
可选地,该芯片该包括存储器,该存储器与该处理器通过电路或电线与存储器连接。进一步可选地,该芯片还包括通信接口,处理器与该通信接口连接。通信接口用于接收需 要处理的数据和/或信息,处理器从该通信接口获取该数据和/或信息,并对该数据和/或信息进行处理,并通过该通信接口输出处理结果。该通信接口可以是输入输出接口。Optionally, the chip includes a memory, and the memory and the processor are connected to the memory through a circuit or a wire. Further optionally, the chip further includes a communication interface, and the processor is connected to the communication interface. The communication interface is used to receive data and/or information to be processed, and the processor obtains the data and/or information from the communication interface, processes the data and/or information, and outputs the processing result through the communication interface. The communication interface may be an input-output interface.
在一些实现方式中,所述一个或多个处理器中还可以有部分处理器是通过专用硬件的方式来实现以上方法中的部分步骤,例如涉及神经网络模型的处理可以由专用神经网络处理器或图形处理器来实现。In some implementations, some of the one or more processors may also implement some steps in the above method by means of dedicated hardware, for example, the processing involving the neural network model may be performed by a dedicated neural network processor or graphics processor.
本申请实施例提供的方法可以由一个芯片实现,也可以由多个芯片协同实现。The methods provided in the embodiments of the present application may be implemented by one chip, or may be implemented collaboratively by multiple chips.
本申请实施例第六方面提供了一种计算机程序产品,该计算机程序产品包括计算机软件指令,该计算机软件指令可通过处理器进行加载来实现上述第一方面中任意一种实现方式所述的方法。A sixth aspect of the embodiments of the present application provides a computer program product, where the computer program product includes computer software instructions, and the computer software instructions can be loaded by a processor to implement the method described in any one of the implementation manners of the first aspect above .
从以上技术方案可以看出,本申请实施例具有以下优点:As can be seen from the above technical solutions, the embodiments of the present application have the following advantages:
获取至少一个第一指令,然后基于第一指令确定GPU执行第一渲染操作的过程的负载数据,再根据负载数据确定目标方案,当获取到至少一个第二指令后,便可以根据目标方案对GPU执行第二渲染操作的过程中的负载进行控制,从而实现了图像渲染过程中负载的在线动态控制;由于负载数据是基于图像渲染过程中实际获取的第一指令确定的,所以本申请实施例提供的方法可以应用于任意游戏应用程序,不局限于某一款或某几款游戏应用程序,对于升级后的游戏应用程序以及新增加的游戏应用程序也同样适用,所以适用性强,应用范围广。Acquire at least one first instruction, then determine the load data of the process in which the GPU performs the first rendering operation based on the first instruction, and then determine the target scheme according to the load data. After acquiring at least one second instruction, the GPU can be executed according to the target scheme The load in the process of executing the second rendering operation is controlled, thereby realizing the online dynamic control of the load in the image rendering process; since the load data is determined based on the first instruction actually obtained in the image rendering process, the embodiment of the present application provides The method can be applied to any game application, not limited to one or several game applications. It is also applicable to upgraded game applications and newly added game applications, so it has strong applicability and wide application range. .
图1为本申请实施例中的系统架构示意图;1 is a schematic diagram of a system architecture in an embodiment of the present application;
图2为本申请实施例中控制负载的方法实施例示意图;FIG. 2 is a schematic diagram of an embodiment of a method for controlling a load in an embodiment of the present application;
图3为本申请实施中控制负载的一个实施例的流程示意图;FIG. 3 is a schematic flowchart of an embodiment of the control load in the implementation of the present application;
图4为本申请实施例中第一负载控制标签的一个实施例示意图;4 is a schematic diagram of an embodiment of a first load control label in an embodiment of the present application;
图5为本申请实施例中待简化的Mesh模型的特征示意图;Fig. 5 is the characteristic schematic diagram of the Mesh model to be simplified in the embodiment of the application;
图6为本申请实施例中伞状体的结构示意图;6 is a schematic structural diagram of an umbrella body in an embodiment of the present application;
图7为本申请实施例中闭包体的结构示意图;7 is a schematic structural diagram of a closure body in an embodiment of the present application;
图8为本申请实施例中延展体的结构示意图;8 is a schematic structural diagram of an extension body in an embodiment of the present application;
图9为本申请实施例中步骤103的过程示意图;FIG. 9 is a schematic process diagram of step 103 in an embodiment of the present application;
图10为本申请实施例中确定第三负载控制标签的过程示意图;10 is a schematic diagram of a process of determining a third load control label in an embodiment of the present application;
图11为本申请实施例中第三负载控制标签的一个实施例示意图;FIG. 11 is a schematic diagram of an embodiment of a third load control label in an embodiment of the application;
图12为本申请实施中控制负载的另一个实施例的流程示意图;FIG. 12 is a schematic flowchart of another embodiment of load control in the implementation of the present application;
图13为本申请实施例中控制负载的装置示意图;13 is a schematic diagram of a device for controlling a load in an embodiment of the present application;
图14为本申请实施例中终端设备的结构示意图。FIG. 14 is a schematic structural diagram of a terminal device in an embodiment of the present application.
下面结合附图,对本申请的实施例进行描述,显然,所描述的实施例仅仅是本申请一部分的实施例,而不是全部的实施例。本领域普通技术人员可知,随着技术的发展和新场景的出现,本申请实施例提供的技术方案对于类似的技术问题,同样适用。The embodiments of the present application will be described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Those of ordinary skill in the art know that with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的实施例能够以除了在这里图示或描述的内容以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或模块的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或模块,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或模块。在本申请中出现的对步骤进行的命名或者编号,并不意味着必须按照命名或者编号所指示的时间或逻辑先后顺序执行方法流程中的步骤,已经命名或者编号的流程步骤可以根据要实现的技术目的变更执行次序,只要能达到相同或者相类似的技术效果即可。The terms "first", "second" and the like in the description and claims of the present application and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It is to be understood that data so used may be interchanged under appropriate circumstances so that the embodiments described herein can be practiced in sequences other than those illustrated or described herein. Furthermore, the terms "comprising" and "having", and any variations thereof, are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device comprising a series of steps or modules is not necessarily limited to those expressly listed Rather, those steps or modules may include other steps or modules not expressly listed or inherent to the process, method, product or apparatus. The naming or numbering of the steps in this application does not mean that the steps in the method flow must be executed according to the time or logical sequence indicated by the naming or numbering, and the named or numbered process steps can be implemented according to the The technical purpose is to change the execution order, as long as the same or similar technical effects can be achieved.
本申请实施例可以应用于如图1所示的系统架构中。该系统架构包括应用程序层、图形应用程序接口(Application Program Interface,API)层、内核层和硬件层。The embodiments of the present application may be applied to the system architecture shown in FIG. 1 . The system architecture includes an application program layer, a graphics application program interface (API) layer, a kernel layer and a hardware layer.
需要说明的是,该系统框架可以应用于任意需要降低图像渲染时的负载的终端设备中,特别是图像渲染性能有限的一些终端设备。例如,该系统框架可以应用于手机、平板电脑、笔记本电脑等图像渲染性能有限的移动终端中,该系统框架还可以应用于车载电脑等特殊场景导致图像渲染性能有限的终端设备中。It should be noted that the system framework can be applied to any terminal device that needs to reduce the load during image rendering, especially some terminal devices with limited image rendering performance. For example, the system framework can be applied to mobile terminals with limited image rendering performance such as mobile phones, tablet computers, and notebook computers, and the system framework can also be applied to terminal devices with limited image rendering performance due to special scenarios such as car computers.
如图1所示,应用程序层包括三个游戏应用程序。需要说明的是,在该实施例中,应用程序层中的应用程序主要是指游戏应用程序,即本申请实施例主要应用于游戏渲染的场景中。但在本申请其它实施例中,应用程序层中的应用程序也可以是其他适用的应用程序,本申请对此不做具体限定;另外,游戏应用程序的数量也不限于三个,更少或更多都可以。As shown in Figure 1, the application layer includes three game applications. It should be noted that, in this embodiment, the application program in the application program layer mainly refers to the game application program, that is, the embodiment of the present application is mainly applied to the scene of game rendering. However, in other embodiments of the present application, the applications in the application layer may also be other applicable applications, which are not specifically limited in this application; in addition, the number of game applications is not limited to three, less or less. More is possible.
图形API层包括但不限于开放图形库(Open Graphics Library,OpenGL)、OpenGL ES(OpenGL for Embedded Systems)和Vulkan这三种图形API。其中,图形API层可以用于将2D或3D场景渲染至终端设备的屏幕上;例如,OpenGL用于渲染2D场景,OpenGL ES和Vulkan用于渲染3D场景。The graphics API layer includes but is not limited to three graphics APIs, Open Graphics Library (OpenGL), OpenGL ES (OpenGL for Embedded Systems) and Vulkan. Among them, the graphics API layer can be used to render 2D or 3D scenes to the screen of the terminal device; for example, OpenGL is used to render 2D scenes, and OpenGL ES and Vulkan are used to render 3D scenes.
内核层包括系统内核以及驱动等。The kernel layer includes the system kernel and drivers.
硬件层包括但不限于中央处理器CPU、图形处理器GPU和内部存储器等,其中,内部存储器可以是双倍速率SDRAM(Double Data Rate Synchronous Dynamic Random-access Memory,DDR SDRAM),也可以是其他类型的内部存储器。The hardware layer includes but is not limited to the central processing unit CPU, graphics processing unit GPU, and internal memory, among which the internal memory can be double-rate SDRAM (Double Data Rate Synchronous Dynamic Random-access Memory, DDR SDRAM), or other types of internal memory.
基于图1所示的系统框架,当游戏应用程序运行时,渲染流程Pipe Line包括:Based on the system framework shown in Figure 1, when the game application is running, the rendering process Pipe Line includes:
第一步,游戏应用程序中的游戏引擎对游戏场景进行遍历,裁剪剔除不可见物体。In the first step, the game engine in the game application traverses the game scene and cuts out invisible objects.
第二步,对应每个可见物体,游戏引擎准备数据资源,并发送调用图形API的指令,该调用图形API的指令会到达内核层。In the second step, corresponding to each visible object, the game engine prepares data resources and sends an instruction to call the graphics API, and the instruction to call the graphics API will reach the kernel layer.
第三步,内核层的驱动在接收到调用图形API的指令后,会将数据资源传递到GPU的内部存储器中,并向GPU发送渲染指令,以指示GPU进行渲染。In the third step, after receiving the instruction to call the graphics API, the driver of the kernel layer will transfer the data resource to the internal memory of the GPU, and send a rendering instruction to the GPU to instruct the GPU to render.
第四步,GPU在接收到渲染指令后,会从内部存储器中读取数据资源,并执行顶点着色器Vertex shader、像素着色器Fragment shader或者Compute shader等操作。In the fourth step, after receiving the rendering instruction, the GPU will read the data resources from the internal memory, and execute operations such as vertex shader Vertex shader, pixel shader Fragment shader or Compute shader.
顶点着色器是指在GPU上处理顶点变换的程序片段。对应网格Mesh模型的每个顶点,均会执行一次顶点着色器。因此,待渲染的场景中的顶点越多,顶点着色器的计算负载越重。A vertex shader is a program fragment that processes vertex transformations on the GPU. The vertex shader is executed once for each vertex of the mesh Mesh model. Therefore, the more vertices in the scene to be rendered, the heavier the computational load of the vertex shader.
像素着色器是指在GPU上处理像素着色的程序片段。模型经过顶点变换后,对屏幕上每个被Mesh模型覆盖的像素点执行一次像素着色器。因此,屏幕分辨率越高,像素着色器的计算负载越重。A pixel shader is a program fragment that handles pixel shading on the GPU. After the model has undergone vertex transformation, the pixel shader is executed once for each pixel on the screen that is covered by the Mesh model. Therefore, the higher the screen resolution, the more computationally loaded the pixel shader is.
Compute shader是指在GPU上执行的程序片段,可用于图形渲染之外的计算。具体地,可通过OpenGL ES或者Vulkan API将Compute shader传输至GPU,以被GPU执行。Compute shader refers to a program fragment executed on the GPU, which can be used for calculations other than graphics rendering. Specifically, the Compute shader can be transferred to the GPU through OpenGL ES or Vulkan API to be executed by the GPU.
基于高画质和高帧率的游戏应用程序为图像渲染带来了较高的负载,所以为了降低图像渲染时的负载,如图1所示,本申请实施例增加了负载控制层,该负载控制层能从图形API层截获到调用图形API的指令,然后从截获到的调用图形API的指令获取所需的信息,或对调用图形API的指令进行处理。最终将调用图形API的指令返回至图形API层,以使得调用图形API的指令继续向内核层传递。Game applications based on high image quality and high frame rate bring a high load to image rendering, so in order to reduce the load during image rendering, as shown in FIG. 1 , a load control layer is added in this embodiment of the present application. The control layer can intercept the instruction for calling the graphics API from the graphics API layer, and then obtain the required information from the intercepted instruction for calling the graphics API, or process the instruction for calling the graphics API. Finally, the instruction for calling the graphics API is returned to the graphics API layer, so that the instruction for calling the graphics API continues to be passed to the kernel layer.
具体地,该负载控制层在获取到调用图形API的指令后,会基于获取到的调用图形API的指令对图像渲染过程中的负载进行动态分析,然后基于分析结果选择相应的用于降低负载的方案。最终,利用用于降低负载的方案降低后续图像渲染过程中的负载。下文将结合图2本申请实施例提供的控制负载的方法进行具体介绍。如图2所示,本申请实施例提供了一种控制负载的方法的一个实施例,该实施例可以应用于CPU,包括:Specifically, after obtaining the instruction to call the graphics API, the load control layer will dynamically analyze the load in the image rendering process based on the obtained instruction to call the graphics API, and then select the corresponding load reducing method based on the analysis result. Program. Ultimately, the load in subsequent image rendering processes is reduced using the scheme for load reduction. The method for controlling load provided by the embodiment of the present application will be specifically introduced below with reference to FIG. 2 . As shown in FIG. 2 , an embodiment of the present application provides an embodiment of a method for controlling a load, which can be applied to a CPU, including:
步骤101,获取至少一个第一指令,至少一个第一指令用于调用应用程序接口API,以使得图形处理器GPU执行第一渲染操作。Step 101: Acquire at least one first instruction, where the at least one first instruction is used to call an application program interface API, so that the graphics processor GPU performs a first rendering operation.
本该实施例对第一指令的数量不做具体限定。例如,第一指令的数量可以为一个,也可以为多个。当第一指令的数量为多个时,多个第一指令可以构成一条或多条指令流,每条指令流用于调用API以使得GPU渲染一帧图像。This embodiment does not specifically limit the number of the first instructions. For example, the number of the first instruction may be one or multiple. When the number of the first instructions is multiple, the multiple first instructions may constitute one or more instruction streams, and each instruction stream is used to call an API to make the GPU render a frame of image.
相应地,第一渲染操作可以用于对一帧图像中的一个或多个物体(人物、背景等)进行渲染,也可以用于对多帧图像中的物体进行渲染。在本申请实施例中,API是指图形API;对应地,在图1所示的系统架构,第一指令则是由游戏应用程序发出的调用图形API的指令。Correspondingly, the first rendering operation may be used to render one or more objects (person, background, etc.) in one frame of image, and may also be used to render objects in multiple frames of images. In the embodiment of the present application, the API refers to the graphics API; correspondingly, in the system architecture shown in FIG. 1 , the first instruction is an instruction issued by the game application to call the graphics API.
需要说明的是,获取至少一个第一指令可以理解为感知并记录至少一个第一指令,并不会阻止该第一指令的向下传递。It should be noted that acquiring at least one first instruction may be understood as sensing and recording at least one first instruction, and will not prevent the downward transmission of the first instruction.
基于图1所示的系统框架的相关说明可知,用于调用API的第一指令传递到驱动后,驱动会向GPU发送渲染指令,使得GPU执行第一渲染操作。Based on the relevant description of the system framework shown in FIG. 1 , after the first instruction for calling the API is passed to the driver, the driver will send a rendering instruction to the GPU, so that the GPU performs the first rendering operation.
其中,图形处理过程主要包括建模、物理模拟、渲染render、后处理等多个环节,本申请实施例中的第一渲染操作主要是指上述过程中的渲染render环节。The graphics processing process mainly includes multiple links such as modeling, physical simulation, rendering, and post-processing, and the first rendering operation in the embodiment of the present application mainly refers to the rendering link in the above process.
步骤102,基于至少一个第一指令确定GPU执行第一渲染操作的过程的负载数据。Step 102: Determine load data of a process in which the GPU performs a first rendering operation based on at least one first instruction.
在本申请实施例中,负载数据的确定是基于获取的该至少一个第一指令的确定GPU, 并不依赖于GPU执行第一渲染操作的实际过程,也可以理解为确定负载数据的过程与GPU执行第一渲染操作的实际过程可以是并行的。In the embodiment of the present application, the determination of the load data is based on the acquired GPU of the at least one first instruction, and does not depend on the actual process of the GPU performing the first rendering operation, and can also be understood as the process of determining the load data and the GPU. The actual process of performing the first rendering operation may be parallel.
需要说明的是,确定负载数据的方法有多种,本实施例对此不做具体限定。例如,可以根据至少一个第一指令的数量、具体类别、作用等方面确定负载数据;也可以在获取到至少一个第一指令后,获取GPU执行第一渲染操作的过程中可能要使用的计算机硬件资源的一些信息,从而确定负载数据;还可以根据至少一个第一指令确定第一渲染操作的对象,然后根据第一渲染操作的对象的信息确定负载数据。It should be noted that there are various methods for determining load data, which are not specifically limited in this embodiment. For example, the load data can be determined according to the quantity, specific type, function, etc. of the at least one first instruction; it is also possible to acquire computer hardware that may be used by the GPU in the process of performing the first rendering operation after acquiring the at least one first instruction Some information of the resource is used to determine load data; the object of the first rendering operation may also be determined according to at least one first instruction, and then the load data may be determined according to the information of the object of the first rendering operation.
基于上述说明可知,负载数据可以有多种。为此,在本实施例中,预先定义负载特征因子,负载特征因子可以理解为负载数据的特征参数,每个负载特征因子指示一种负载,每个负载特征因子的取值则可以作为一种具体的负载数据。这样,便可以根据负载特征因子确定负载数据。Based on the above description, it can be known that there may be various types of load data. To this end, in this embodiment, a load characteristic factor is pre-defined, and the load characteristic factor can be understood as a characteristic parameter of the load data, each load characteristic factor indicates a type of load, and the value of each load characteristic factor can be used as a type of load. specific load data. In this way, the load data can be determined from the load characteristic factor.
示例性地,负载特征因子可以指示计算机硬件资源的一种信息,该负载特征因子的取值则可以作为一种负载数据;例如,特征因子指示CPU的频点,对应地,该CPU的实际频点则可以作为一种负载数据。Exemplarily, the load characteristic factor may indicate a kind of information of computer hardware resources, and the value of the load characteristic factor may be used as a kind of load data; for example, the characteristic factor indicates the frequency point of the CPU, and correspondingly, the actual frequency of the CPU. Points can be used as a kind of payload data.
示例性地,特征因子还可以指示第一指令的数量,对应地,第一指令的具体数量则可以作为一种负载数据。Exemplarily, the characteristic factor may also indicate the number of the first instructions, and correspondingly, the specific number of the first instructions may be used as a kind of load data.
示例性地,基于至少一个第一指令确定GPU执行第一渲染操作的过程的负载数据包括:Exemplarily, determining load data of a process in which the GPU performs the first rendering operation based on the at least one first instruction includes:
基于至少一个第一指令和至少一个负载特征因子获取GPU执行第一渲染操作的过程的至少一种负载数据,每个负载特征因子对应一种负载数据。At least one type of load data of a process in which the GPU performs the first rendering operation is acquired based on at least one first instruction and at least one load characteristic factor, and each load characteristic factor corresponds to one type of load data.
在本申请实施例中,对应每个负载特征因子,可以获取一种负载数据。In this embodiment of the present application, corresponding to each load characteristic factor, one type of load data may be acquired.
需要说明的是,负载特征因子可以根据实际需要进行定义,定义负载特征因子的维度可以有很多。下文将从多个维度对负载特征因子进行介绍。It should be noted that the load characteristic factor can be defined according to actual needs, and there can be many dimensions for defining the load characteristic factor. The load characteristic factor will be introduced from multiple dimensions below.
在本申请实施例中,由于可以根据需要预先设定至少一个负载特征因子,对应每个负载特征因子可以得到一种负载数据,所以可以保证负载数据比较全面且具有代表性。In this embodiment of the present application, since at least one load characteristic factor can be preset as required, and one type of load data can be obtained corresponding to each load characteristic factor, it can be ensured that the load data is comprehensive and representative.
步骤103,基于负载数据确定用于控制负载的目标方案。 Step 103 , determining a target solution for controlling the load based on the load data.
在获取负载数据后,可以对负载数据进行分析,然后确定用于控制负载的目标方案。可以理解的是,该目标方案通常用于降低图像渲染时的负载。After the load data is acquired, the load data can be analyzed, and then a target scheme for controlling the load can be determined. It can be understood that this target scheme is usually used to reduce the load during image rendering.
需要说明的是,基于负载数据确定目标方案的方法有多种,本申请实施例对此不做具体限定。例如,可以预先建立负载控制方案库,该负载控制方案库中包含多种用于负载控制方案,可以根据负载数据的分析结果从多种负载控制方案选择一个负载控制方案作为目标方案,用于控制负载。It should be noted that, there are various methods for determining the target solution based on the load data, which is not specifically limited in this embodiment of the present application. For example, a load control scheme library can be established in advance, and the load control scheme library contains a variety of load control schemes. According to the analysis result of the load data, a load control scheme can be selected from a variety of load control schemes as the target scheme for controlling load.
下面介绍基于负载数据确定目标方案的一种方法。示例性地,基于负载数据确定用于控制负载的目标方案包括:A method for determining a target scheme based on load data is described below. Exemplarily, determining the target solution for controlling the load based on the load data includes:
首先,基于负载数据确定负载控制标签,负载控制标签指示负载控制的内容;然后,基于负载控制标签从至少一种负载控制方案中选择一种负载控制方案,作为用于控制负载的目标方案。First, a load control tag is determined based on the load data, the load control tag indicates the content of the load control; then, a load control scheme is selected from at least one load control scheme based on the load control tag as a target scheme for controlling the load.
可以理解的是,负载控制标签指示负载控制的内容,用于关联具体的负载控制方案。 其中,对于同一负载数据,可以确定一个或多个负载控制标签。It can be understood that the load control label indicates the content of the load control and is used to associate with a specific load control scheme. Wherein, for the same load data, one or more load control tags can be determined.
本申请实施例对负载控制标签的形式和内容均不做具体限定;对于不同的负载数据,得到的负载控制标签的形式可以不同,内容也可以不同。下文将结合图4、图11以及表1至表3对控制标签可能的形式和内容进行具体介绍。The embodiments of the present application do not specifically limit the form and content of the load control label; for different load data, the form and content of the obtained load control label may be different. The possible forms and contents of the control label will be described in detail below with reference to FIG. 4 , FIG. 11 , and Tables 1 to 3.
其中,至少一种负载控制方案是预设的。Wherein, at least one load control scheme is preset.
在本申请实施例中,负载控制标签的设定,使得开发者可以灵活扩展负载控制方案,即预先设定与负载控制标签关联的更多的负载控制方案以供选择。In the embodiment of the present application, the setting of the load control label enables the developer to flexibly expand the load control scheme, that is, preset more load control schemes associated with the load control label for selection.
步骤104,获取至少一个第二指令,至少一个第二指令用于调用API,以使得GPU执行第二渲染操作。Step 104: Acquire at least one second instruction, where the at least one second instruction is used to call an API, so that the GPU performs a second rendering operation.
需要说明的是,第二指令与第一指令本质上相同,都属于调用API的指令;在步骤104中,对于至少一个第二指令中的任意一个第二指令来说,可以是在第一指令后发出的调用API的指令,也可以是第一指令,或者当第二指令和第一指令分别包含多个指令时,二者存在相同的指令。It should be noted that the second instruction is essentially the same as the first instruction, and both belong to the instruction to call the API; in step 104, for any second instruction in the at least one second instruction, it may be the first instruction The instruction for calling the API issued later may also be the first instruction, or when the second instruction and the first instruction respectively contain multiple instructions, the two have the same instruction.
因此,具体可参照步骤101的相关说明,对步骤104进行理解。Therefore, step 104 can be understood by referring to the relevant description of step 101 for details.
步骤105,基于目标方案控制GPU执行第二渲染操作的过程中的负载。 Step 105 , controlling the load in the process of performing the second rendering operation on the GPU based on the target scheme.
其中,与第一渲染操作类似,本申请实施例中的第二渲染操作主要是指上述过程中的渲染render环节。Wherein, similar to the first rendering operation, the second rendering operation in this embodiment of the present application mainly refers to the rendering link in the above process.
需要说明的是,基于目标方案控制负载的过程与目标方案的具体内容相关,本申请实施例对此不做具体限定。It should be noted that the process of controlling the load based on the target solution is related to the specific content of the target solution, which is not specifically limited in this embodiment of the present application.
例如,若目标方案指示对第二指令进行处理,则在步骤104后,先根据目标方案对步骤104中获取到的至少一个第二指令进行处理,然后将处理后的至少一个第二指令向图形API传递。For example, if the target scheme instructs to process the second instruction, after step 104, the at least one second instruction obtained in step 104 is processed according to the target scheme, and then the processed at least one second instruction is sent to the graphic API pass.
若目标方案不指示对第二指令处理,则在步骤104后,即可将至少一个第二指令向图形API传递,并根据目标方案的具体内容在传递第二指令之前、传递第二指令的过程中或传递第二指令之后,对负载进行控制。If the target solution does not instruct to process the second command, after step 104, at least one second command can be transferred to the graphics API, and the process of transferring the second command before transferring the second command according to the specific content of the target solution During or after passing the second command, the load is controlled.
基于步骤101至步骤105,本申请实施例提供的控制负载的方法可以概括成图3所示的方案。如图3所示,第一指令由应用程序发出,并经过图形API向驱动程序开发工具包(Driver Development Kit,DDK)传递,再向驱动传递的过程中被指令获取模块获取到,然后基于获取到的第一指令采集与第一指令相关的数据。此后,基于特征库中的负载特征因子识别出负载数据,并根据负载数据进行方案匹配,即从负载控制方案库中的所有负载控制方案中确定出目标方案。最终目标方案生效,便可以利用目标方案对GPU执行第二渲染操作的过程中负载进行控制。Based on steps 101 to 105 , the load control method provided by the embodiment of the present application can be summarized as the solution shown in FIG. 3 . As shown in Figure 3, the first instruction is issued by the application, and is transmitted to the Driver Development Kit (DDK) through the graphics API, and is acquired by the instruction acquisition module in the process of transmitting to the driver, and then based on the acquisition The received first instruction collects data related to the first instruction. After that, load data is identified based on the load characteristic factor in the characteristic database, and scheme matching is performed according to the load data, that is, the target scheme is determined from all load control schemes in the load control scheme library. When the final target scheme takes effect, the target scheme can be used to control the load in the process of the GPU performing the second rendering operation.
在本申请实施例中,基于第一指令确定GPU执行第一渲染操作的过程的负载数据,然后根据负载数据确定目标方案,最终根据目标方案对GPU执行第二渲染操作的过程中的负载进行控制,从而实现了图像渲染过程中负载的在线分析与控制;由于负载数据是基于图像渲染过程中实际获取的第一指令确定的,所以本申请实施例提供的方法可以应用于任意游戏应用程序,不局限于某一款或某几款游戏应用程序,对于升级后的游戏应用程序以及 新增加的游戏应用程序也同样适用,所以适用性强,应用范围广;并且,本申请实施例提供的方法也不需要离线执行,可以实现对负载的动态控制。In this embodiment of the present application, the load data of the process in which the GPU performs the first rendering operation is determined based on the first instruction, then the target scheme is determined according to the load data, and finally the load in the process of the GPU performing the second rendering operation is controlled according to the target scheme. , so as to realize the online analysis and control of the load in the image rendering process; since the load data is determined based on the first instruction actually obtained in the image rendering process, the method provided by the embodiment of the present application can be applied to any game application, without Limited to one or several game applications, it is also applicable to upgraded game applications and newly added game applications, so it has strong applicability and wide application range; in addition, the methods provided in the embodiments of the present application also No offline execution is required, and dynamic control of the load can be achieved.
基于前述说明可知,负载特征因子可以从多个维度进行定义。下面分别从三个维度对负载特征因子进行介绍,每个维度对应一类负载特征因子。Based on the foregoing description, it can be known that the load characteristic factor can be defined from multiple dimensions. The following describes the load characteristic factors from three dimensions, each of which corresponds to a type of load characteristic factor.
示例性地,负载特征因子包括以下三类负载特征因子中的至少一类:第一类负载特征因子、第二类负载特征因子和第三类负载特征因子。Exemplarily, the load characteristic factor includes at least one of the following three types of load characteristic factors: a first type of load characteristic factor, a second type of load characteristic factor, and a third type of load characteristic factor.
具体地,第一类负载特征因子用于表示GPU执行第一渲染操作的过程对计算机硬件资源的消耗情况,其中,该硬件资源可以是CPU、GPU以及内部存储器等,内部存储器可以为DDR SDRAM。Specifically, the first type of load characteristic factor is used to represent the consumption of computer hardware resources in the process of performing the first rendering operation by the GPU, wherein the hardware resources may be CPU, GPU, internal memory, etc., and the internal memory may be DDR SDRAM.
需要说明的是,第一类负载特征因子的具体种类可以有多种,本申请实施例对此不做具体限定。It should be noted that, there may be various specific types of the first type of load characteristic factors, which are not specifically limited in this embodiment of the present application.
示例性地,第一类负载特征因子包括以下的至少一种:GPU执行第一渲染操作的过程中的计算耗时、中央处理器CPU的运行参数、GPU的运行参数以及内部存储器的运行参数。Exemplarily, the first type of load characteristic factor includes at least one of the following: calculation time in the process of the GPU performing the first rendering operation, operating parameters of the central processing unit CPU, operating parameters of the GPU, and operating parameters of the internal memory.
其中,计算耗时可以具体包括逻辑运算耗时和GPU调用耗时;CPU的运行参数可以具体包括CPU频点和CPU使用率;GPU的运行参数可以具体包括GPU频点和GPU使用率。The calculation time may specifically include logic operation time and GPU call time; CPU operating parameters may specifically include CPU frequency and CPU usage; GPU operating parameters may specifically include GPU frequency and GPU usage.
第二类负载特征因子用于表示GPU执行第一渲染操作的过程所渲染的网格Mesh模型的信息。The second type of load characteristic factor is used to represent the information of the mesh model rendered by the GPU in the process of performing the first rendering operation.
在渲染场景中,3D模型一般用三角形网格表示,所以3D模型又可以称为Mesh模型。其中,每个三角形由三个顶点构成,顶点数据包括位置、法线、UV坐标等;一个顶点可被多个相邻三角形共享。Mesh模型的几何结构越复杂,三角形顶点数量越大。In the rendering scene, the 3D model is generally represented by a triangular mesh, so the 3D model can also be called a Mesh model. Among them, each triangle is composed of three vertices, and the vertex data includes position, normal, UV coordinates, etc.; a vertex can be shared by multiple adjacent triangles. The more complex the geometry of the mesh model, the larger the number of triangle vertices.
因此,可以使用Mesh模型的信息作为第二类负载特征因子,以指示负载的多少。Therefore, the information of the Mesh model can be used as the second type of load characteristic factor to indicate how much the load is.
在本申请实施例中,网格Mesh模型的信息可以包括网格Mesh模型的顶点数量以及网格Mesh模型的数量等多种信息。In this embodiment of the present application, the information of the mesh model may include various information such as the number of vertices of the mesh model and the number of mesh models.
需要说明的是,第二类负载特征因子的具体种类可以有多种,本申请实施例对此不做具体限定。It should be noted that, there may be multiple specific types of the second type of load characteristic factors, which are not specifically limited in this embodiment of the present application.
示例性地,第二类负载特征因子包括以下的至少一种:GPU执行第一渲染操作的过程所渲染的每个Mesh模型的顶点数量、GPU执行第一渲染操作的过程所渲染的每帧图像中的顶点数量、GPU执行第一渲染操作的过程所渲染的每帧图像中的Mesh模型的数量、GPU执行第一渲染操作的过程所渲染的每帧图像中Mesh模型的重复数量和GPU执行第一渲染操作的过程所渲染的每个Mesh模型相对于屏幕的距离。Exemplarily, the second type of load characteristic factor includes at least one of the following: the number of vertices of each Mesh model rendered by the GPU in the process of performing the first rendering operation, the number of vertices in each frame rendered by the GPU in the process of performing the first rendering operation The number of vertices in the image, the number of Mesh models in each frame of images rendered by the GPU in the process of performing the first rendering operation, the number of repetitions of the Mesh models in each frame of images rendered by the GPU in the process of performing the first rendering operation, and the number of Mesh models in each frame of images rendered by the GPU in the process of performing the first rendering operation. The distance of each Mesh model rendered relative to the screen during a rendering operation.
其中,Mesh模型的顶点数量表示该Mesh模型的几何结构的复杂程度,Mesh模型的顶点数量越大,则表示Mesh模型的几何结构越复杂,相应地,渲染该Mesh模型带来的负载就越大。因此可以使用Mesh模型的顶点数量作为第二类特征因子。Among them, the number of vertices of the Mesh model indicates the complexity of the geometric structure of the Mesh model. The larger the number of vertices of the Mesh model, the more complex the geometric structure of the Mesh model, and accordingly, the greater the load brought by rendering the Mesh model. . Therefore, the number of vertices of the Mesh model can be used as the second type of feature factor.
每帧图像中的顶点数量为渲染每帧图像的过程中需要遍历的顶点总量,需要遍历的顶点总量越大,则表示渲染该帧图像的负载就越大。因此,可以使用每帧图像中的顶点数量作为第二类特征因子。The number of vertices in each frame of image is the total number of vertices that need to be traversed in the process of rendering each frame of image. The larger the total number of vertices to be traversed, the greater the load of rendering the frame image. Therefore, the number of vertices in each frame of image can be used as the second kind of feature factor.
每帧图像中的Mesh模型的数量即表示渲染每帧图像的过程中需要渲染的Mesh模型的 多少。在渲染一帧图像的过程中,需要渲染的Mesh模型越多,则表示负载越大。因此,可以使用每帧图像中的Mesh模型的数量作为第二类特征因子。The number of Mesh models in each frame of image means how many Mesh models need to be rendered in the process of rendering each frame of image. In the process of rendering a frame of image, the more mesh models that need to be rendered, the greater the load. Therefore, the number of mesh models in each frame of image can be used as the second type of feature factor.
在一帧图像中,当一个Mesh模型的重复数量较大时,则意味着该Mesh模型的顶点总量较大,因此可以将每帧图像中Mesh模型的重复数量作为第二类特征因子。例如,一帧图像中的树木Mesh模型所包含的顶点数量较少,但该帧图像中的树木Mesh模型的重复数量较大,则意味着渲染该帧图像中的树木Mesh模型所带来的负载较大。每帧图像中Mesh模型的重复数量也可以称为该Mesh模型的实例数。In a frame of image, when the number of repetitions of a Mesh model is large, it means that the total number of vertices of the Mesh model is large, so the number of repetitions of the Mesh model in each frame of image can be used as the second type of feature factor. For example, the tree mesh model in one frame of image contains a small number of vertices, but the number of repetitions of the tree mesh model in the frame image is large, which means the load brought by rendering the tree mesh model in the frame image. larger. The number of repetitions of the Mesh model in each frame of image can also be referred to as the number of instances of the Mesh model.
当一个Mesh模型相对于屏幕的较近时,理论上需要将该Mesh模型渲染地较清楚,以保证画面的质量;当一个Mesh模型相对于屏幕的较远时,则可以降低对Mesh模型的渲染要求。即Mesh模型相对于屏幕的距离不同,可以表示不同负载。因此,可以使用每个Mesh模型相对于屏幕的距离作为第二类特征因子。When a Mesh model is relatively close to the screen, theoretically, the Mesh model needs to be rendered more clearly to ensure the quality of the picture; when a Mesh model is relatively far from the screen, the rendering of the Mesh model can be reduced. Require. That is, the distance of the Mesh model relative to the screen is different and can represent different loads. Therefore, the distance of each Mesh model relative to the screen can be used as the second type of feature factor.
第三类负载特征因子用于表示至少一个第一指令的信息,其中,第一指令的信息可以包括第一指令的数量和指令间的关系等多种信息。The third type of load characteristic factor is used to represent the information of at least one first instruction, where the information of the first instruction may include various information such as the number of the first instructions and the relationship between the instructions.
需要说明的是,第三类负载特征因子的具体种类可以有多种,本申请实施例对此不做具体限定。It should be noted that, there may be various specific types of the third type of load characteristic factors, which are not specifically limited in the embodiment of the present application.
示例性地,第三类负载特征因子包括以下的至少一种:至少一个第一指令构成的绘制命令(Draw Call,DC)的数量、至少一个第一指令对应的渲染通道Render Pass的数量、帧缓冲Frame Buffer尺寸、渲染通道与帧缓冲的引用关系、DC与帧缓冲的引用关系。Exemplarily, the third type of load characteristic factor includes at least one of the following: the number of drawing commands (Draw Call, DC) formed by at least one first instruction, the number of rendering channels Render Pass corresponding to at least one first instruction, the number of frames Buffer Frame Buffer size, reference relationship between rendering channel and frame buffer, reference relationship between DC and frame buffer.
为了便于理解,下面对第一指令、DC、渲染通道、渲染通道与帧缓冲的引用关系、DC与帧缓冲的引用关系进行说明。For ease of understanding, the following describes the first instruction, the DC, the rendering channel, the reference relationship between the rendering channel and the frame buffer, and the reference relationship between the DC and the frame buffer.
以渲染一帧图像为例,具体可以包含多个渲染通道,每个渲染通道可以对应多个DC,每个DC可以包括多个调用API的指令。因此,可以将至少一个第一指令构成的绘制命令DC的数量、至少一个第一指令对应的渲染通道Render Pass的数量作为第三类特征因子。Taking rendering a frame of image as an example, it may include multiple rendering channels, each rendering channel may correspond to multiple DCs, and each DC may include multiple API calling instructions. Therefore, the number of drawing commands DC formed by at least one first instruction and the number of rendering channels Render Pass corresponding to at least one first instruction can be used as the third type of characteristic factor.
在图像渲染的过程中,每个渲染通道的渲染结果会输出到一个对应的帧缓冲中,所以渲染通道与帧缓冲的对应关系又可以称为渲染通道与帧缓冲的引用关系。In the process of image rendering, the rendering result of each rendering channel will be output to a corresponding frame buffer, so the corresponding relationship between the rendering channel and the frame buffer can also be called the reference relationship between the rendering channel and the frame buffer.
同样地,每个DC对应的渲染结果会输出到一个对应的帧缓冲中,所以DC与帧缓冲的对应关系又可以称为DC与帧缓冲的引用关系。Similarly, the rendering result corresponding to each DC will be output to a corresponding frame buffer, so the corresponding relationship between DC and frame buffer can also be called the reference relationship between DC and frame buffer.
需要说明的是,由于第一类负载特征因子用于表示GPU执行第一渲染操作的过程对计算机硬件资源的消耗情况,因此,当负载特征因子包含第一类负载特征因子时,可以根据计算机硬件的运行参数获取GPU执行第一渲染操作的过程对应第一类负载特征因子的负载数据。而第三类负载特征因子用于表示至少一个第一指令的信息,因此,当负载特征因子包含第三类负载特征因子时,可以根据至少一个第一指令获取GPU执行第一渲染操作的过程对应第三类负载特征因子的负载数据。It should be noted that, since the first type of load characteristic factor is used to represent the consumption of computer hardware resources in the process of GPU performing the first rendering operation, when the load characteristic factor includes the first type of load characteristic factor, it can be calculated according to the computer hardware. The running parameters of the GPU obtain the load data corresponding to the first type of load characteristic factor in the process of the GPU performing the first rendering operation. The third type of load characteristic factor is used to represent the information of at least one first instruction. Therefore, when the load characteristic factor includes the third type of load characteristic factor, the corresponding process of the GPU performing the first rendering operation can be obtained according to at least one first instruction. Load data for the third type of load characteristic factor.
而第二类负载特征因子用于表示GPU执行第一渲染操作的过程所渲染的网格Mesh模型的信息,所以当负载特征因子包含第二类负载特征因子时,需要先确定GPU执行第一渲染操作的过程所渲染的网格Mesh模型的信息,才能确定负载数据。The second type of load characteristic factor is used to represent the information of the mesh model rendered by the GPU in the process of performing the first rendering operation. Therefore, when the load characteristic factor includes the second type of load characteristic factor, it is necessary to first determine that the GPU performs the first rendering. Only the information of the mesh model rendered during the operation process can determine the load data.
具体地,作为一种实现方式,至少一个负载特征因子包括第二类负载特征因子。Specifically, as an implementation manner, the at least one load characteristic factor includes the second type of load characteristic factor.
基于至少一个第一指令和至少一个负载特征因子获取GPU执行第一渲染操作的过程的至少一种负载数据包括:Acquiring at least one kind of load data of a process in which the GPU performs a first rendering operation based on at least one first instruction and at least one load characteristic factor includes:
基于至少一个第一指令各自携带的参数确定GPU执行第一渲染操作所渲染的网格Mesh模型的数据;Determine the data of the mesh Mesh model rendered by the GPU performing the first rendering operation based on the parameters carried by the at least one first instruction;
基于GPU执行第一渲染操作所渲染的网格Mesh模型的数据,获取GPU执行第一渲染操作的过程对应第二类负载特征因子的负载数据。Based on the data of the mesh model rendered by the GPU performing the first rendering operation, the load data of the second type of load characteristic factor corresponding to the process of the GPU performing the first rendering operation is acquired.
可以理解的是,第一指令中携带相应的参数,通过第一指令中携带的参数可以确定GPU执行第一渲染操作所渲染的网格Mesh模型,进而可以获取到GPU执行第一渲染操作所渲染的网格Mesh模型的数据。It can be understood that the first instruction carries corresponding parameters, and the parameters carried in the first instruction can determine the mesh Mesh model rendered by the GPU performing the first rendering operation, and then obtain the rendering of the GPU performing the first rendering operation. The mesh data for the mesh model.
对应上述三类负载特征因子,可以得到三类负载数据。因此,获取到的负载数据也可以包括第一类负载数据、第二类负载数据和第三类负载数据中的至少一种。Corresponding to the above three types of load characteristic factors, three types of load data can be obtained. Therefore, the acquired load data may also include at least one of the first type of load data, the second type of load data, and the third type of load data.
其中,第一类负载数据表示GPU执行第一渲染操作的过程对计算机硬件资源的消耗情况;第二类负载数据表示GPU执行第一渲染操作所渲染的网格Mesh模型的信息;第三类负载数据表示至少一个第一指令的信息。Among them, the first type of load data represents the consumption of computer hardware resources in the process of the GPU performing the first rendering operation; the second type of load data represents the information of the mesh model rendered by the GPU performing the first rendering operation; the third type of load The data represents information of at least one first instruction.
具体地,第一类负载数据可以包括以下的至少一种:计算耗时、中央处理器CPU的负载数据、GPU的负载数据以及DDR内存的负载数据。Specifically, the first type of load data may include at least one of the following: calculation time consumption, load data of central processing unit CPU, load data of GPU, and load data of DDR memory.
第二类负载数据可以包括以下的至少一种:GPU执行第一渲染操作的过程所渲染的每个Mesh模型的顶点数量、GPU执行第一渲染操作的过程所渲染的每帧图像中的顶点数量、GPU执行第一渲染操作的过程所渲染的每帧图像中的Mesh模型的数量、GPU执行第一渲染操作的过程所渲染的每帧图像中Mesh模型的重复数量和GPU执行第一渲染操作的过程所渲染的每个Mesh模型相对于屏幕的距离。The second type of load data may include at least one of the following: the number of vertices of each Mesh model rendered by the GPU in the process of performing the first rendering operation, the number of vertices in each frame of the image rendered by the GPU in the process of performing the first rendering operation , the number of Mesh models in each frame of images rendered by the process of performing the first rendering operation by the GPU, the number of repetitions of the Mesh models in each frame of images rendered by the process of performing the first rendering operation by the GPU, and the number of repetitions of the Mesh models in each frame of images rendered by the GPU in the process of performing the first rendering operation. The distance of each mesh model rendered by the pass relative to the screen.
第三类负载数据可以包括以下的至少一种:至少一个第一指令构成的绘制命令(Draw Call,DC)的数量、至少一个第一指令对应的渲染通道Render Pass的数量、帧缓冲Frame Buffer尺寸、渲染通道与帧缓冲的引用关系、DC与帧缓冲的引用关系。The third type of load data may include at least one of the following: the number of drawing commands (Draw Call, DC) formed by at least one first instruction, the number of rendering passes corresponding to at least one first instruction, and the size of the frame buffer. , the reference relationship between the rendering channel and the frame buffer, and the reference relationship between the DC and the frame buffer.
基于前述说明可知,基于不同的负载控制标签,确定负载控制标签的过程不同。下面以上述三种负载数据为例,对确定负载控制标签的过程进行分别说明。Based on the foregoing description, it can be known that the process of determining the load control label is different based on different load control labels. The above three kinds of load data are taken as examples below to describe the process of determining the load control label respectively.
作为一种实现方式,负载数据包括第一类负载数据,第一类负载数据表示GPU执行第一渲染操作的过程对计算机硬件资源的消耗情况。As an implementation manner, the load data includes the first type of load data, and the first type of load data represents the consumption of computer hardware resources in the process of the GPU performing the first rendering operation.
相应地,步骤103可以包括:Accordingly, step 103 may include:
基于第一类负载数据指示GPU执行第一渲染操作的过程对计算机硬件资源的消耗情况满足第一条件,确定第一负载数据对应的第一负载控制标签,第一负载控制标签指示对GPU执行第二渲染操作的过程中计算机硬件的运行参数进行调节。Based on the first type of load data instructing the GPU to perform the first rendering operation, the consumption of computer hardware resources satisfies the first condition, and determining the first load control tag corresponding to the first load data, and the first load control tag instructs the GPU to perform the first rendering operation on the GPU. 2. The operating parameters of the computer hardware are adjusted during the rendering operation.
其中,确定第一负载数据对应的第一负载控制标签的过程,可以是从已知的一个或多个负载控制标签中选择一个负载控制标签作为第一负载控制标签。The process of determining the first load control tag corresponding to the first load data may be to select one load control tag as the first load control tag from one or more known load control tags.
相应地,目标方案则用于对计算机硬件的运行参数进行调节。本申请实施例对目标方案的内容不做具体限定。Correspondingly, the target solution is used to adjust the operating parameters of the computer hardware. The embodiments of the present application do not specifically limit the content of the target solution.
可以理解的是,对于不同的第一类负载数据,第一条件以及第一负载控制标签可以不 同。It can be understood that, for different first type of load data, the first condition and the first load control label may be different.
例如,若第一负载数据包含CPU频点,则第一条件可以CPU频点大于预设频点;相应地,若CPU频点大于预设频点,则生成第一负载控制标签。第一负载控制标签可以包含“CPU Bound”,其中,“CPU Bound”表示当前运行的游戏应用程序属于计算密集型;第一负载控制标签还可以包含“Bound烈度”,“Bound烈度”表示计算密集程度。For example, if the first load data includes the CPU frequency, the first condition may be that the CPU frequency is greater than the preset frequency; correspondingly, if the CPU frequency is greater than the preset frequency, a first load control label is generated. The first load control label may include "CPU Bound", where "CPU Bound" indicates that the currently running game application is computationally intensive; the first load control label may also include "Bound intensity", where "Bound intensity" indicates that the calculation is intensive degree.
示例性地,如图4所示,第一负载控制标签指示对GPU执行第二渲染操作的过程中CPU、GPU或内部存储器的频点进行调节。Exemplarily, as shown in FIG. 4 , the first load control label indicates to adjust the frequency point of the CPU, the GPU or the internal memory in the process of performing the second rendering operation on the GPU.
相应地,第一负载控制标签的形式可以如下表1所示,具体包含调频对象和频点两个字段,即指示对调频对象的频点进行调节;其中,调频对象可以为CPU、GPU或内部存储器。Correspondingly, the form of the first load control label can be as shown in Table 1 below, which specifically includes two fields of frequency modulation object and frequency point, that is, it indicates that the frequency point of the frequency modulation object is adjusted; wherein, the frequency modulation object can be CPU, GPU or internal frequency modulation object. memory.
表1Table 1
需要说明的是,本申请实施例是以频点为例对确定第一负载控制标签的过程进行的说明,其他第一类负载数据看参阅上述说明进行具体理解。It should be noted that the embodiment of the present application uses frequency points as an example to describe the process of determining the first load control label, and other first type of load data can be specifically understood by referring to the above description.
作为一种实现方式,负载数据包括第二类负载数据,第二类负载数据表示GPU执行第一渲染操作所渲染的网格Mesh模型的信息。As an implementation manner, the load data includes a second type of load data, and the second type of load data represents information of a mesh model rendered by the GPU by performing the first rendering operation.
相应地,步骤103可以包括:Accordingly, step 103 may include:
基于第一类负载数据指示GPU执行第一渲染操作所渲染的网格Mesh模型的信息满足第二条件,确定第二负载数据对应的第二负载控制标签,第二负载控制标签指示对GPU执行第二渲染操作的过程中所渲染的Mesh模型进行简化。Based on the information of the mesh model rendered by the first type of load data indicating that the GPU performs the first rendering operation and meeting the second condition, a second load control label corresponding to the second load data is determined, and the second load control label instructs the GPU to perform the first rendering operation on the GPU. The Mesh model rendered during the second rendering operation is simplified.
其中,确定第二负载数据对应的第二负载控制标签的过程,可以是从已知的一个或多个负载控制标签中选择一个负载控制标签作为第二负载控制标签。The process of determining the second load control tag corresponding to the second load data may be to select one load control tag as the second load control tag from one or more known load control tags.
可以理解的是,若GPU执行第一渲染操作所渲染的网格Mesh模型的信息满足第二条件,则认为有必要进行模型简化。其中,模型简化可以理解为降低Mesh模型的细节精度;具体地,基于前述说明可知,Mesh模型由三角形网格构成,因此可以采用较少的三角形网格来表示Mesh模型,以达到简化Mesh模型和降低负载的目的。It can be understood that, if the information of the mesh model rendered by the GPU performing the first rendering operation satisfies the second condition, it is considered necessary to perform model simplification. Among them, model simplification can be understood as reducing the detail accuracy of the Mesh model; specifically, based on the foregoing description, it can be seen that the Mesh model is composed of triangular meshes, so fewer triangular meshes can be used to represent the Mesh model to simplify the Mesh model and The purpose of reducing the load.
相应地,目标方案则用于对GPU执行第二渲染操作的过程中所渲染的Mesh模型进行简化。本申请实施例对目标方案的内容不做具体限定。Correspondingly, the target solution is used to simplify the Mesh model rendered during the GPU performing the second rendering operation. The embodiments of the present application do not specifically limit the content of the target solution.
可以理解的是,对于不同的第二类负载数据,第二条件以及第二负载控制标签可以不同。It can be understood that, for different second types of load data, the second condition and the second load control label may be different.
示例性地,第二类负载数据包括第一渲染操作所渲染的每帧图像中的顶点数量和Mesh模型的数量,相应地,第二条件包括第一渲染操作所渲染的每帧图像中的顶点数量大于第一阈值,或第一渲染操作所渲染的每帧图像中的Mesh模型的数量大于第二阈值。Exemplarily, the second type of load data includes the number of vertices and the number of Mesh models in each frame of image rendered by the first rendering operation, and correspondingly, the second condition includes the number of vertices in each frame of image rendered by the first rendering operation. The number is greater than the first threshold, or the number of Mesh models in each frame of image rendered by the first rendering operation is greater than the second threshold.
以每帧图像中的顶点数量为例,可以先定义每帧图像中的顶点数量的多个等级。例如,每帧图像中的顶点数量小于或等于500K为第一级,每帧图像中的顶点数量大于500K且小于2000K为第二级,每帧图像中的顶点数量大于或等于2000K为第三级。第一阈值可以设置为500K,也可以设置为2000K。其中,K表示千个。Taking the number of vertices in each frame of image as an example, you can first define multiple levels of the number of vertices in each frame of image. For example, the number of vertices in each frame of image is less than or equal to 500K is the first level, the number of vertices in each frame of image is greater than 500K and less than 2000K is the second level, the number of vertices in each frame image is greater than or equal to 2000K is the third level . The first threshold can be set to 500K or 2000K. Among them, K represents thousands.
示例性地,第二负载控制标签的形式可以如表2所示,即指示GPU执行第二渲染操作的过程中待简化的Mesh模型的特征、待简化的Mesh模型适用的简化算法以及简化算法的参数。Exemplarily, the form of the second load control label can be as shown in Table 2, that is, the characteristics of the Mesh model to be simplified in the process of instructing the GPU to perform the second rendering operation, the simplified algorithm applicable to the Mesh model to be simplified, and the characteristics of the simplified algorithm. parameter.
表2Table 2
可以理解的是,GPU执行第一渲染操作所渲染的网格Mesh模型的信息满足第二条件,只能确定有必要进行模型简化,但并不是所有的Mesh模型均能够被简化,因此需要确定可以简化的Mesh模型。因此,本申请实施例中的第二负载控制标签指示待简化的Mesh模型的特征。It can be understood that the information of the mesh model rendered by the GPU performing the first rendering operation satisfies the second condition, and it can only be determined that model simplification is necessary, but not all Mesh models can be simplified. Simplified Mesh model. Therefore, the second load control label in the embodiment of the present application indicates the characteristics of the Mesh model to be simplified.
待简化的Mesh模型的特征可以包括多种特征,本申请实施例对此不做具体限定。示例性地,如图5所示,待简化的Mesh模型的特征可以包括形状特征、顶点数量规模、渲染频度、相对于屏幕的距离。The features of the Mesh model to be simplified may include various features, which are not specifically limited in this embodiment of the present application. Exemplarily, as shown in FIG. 5 , the features of the Mesh model to be simplified may include shape features, the scale of the number of vertices, the rendering frequency, and the distance relative to the screen.
其中,形状特征可以包括伞状体、闭包体和延展体;伞状体的结构如图6所示,在游戏场景中,树木的Mesh模型的形状特征通常为伞状体;闭包体的结构如图7所示,在游戏场景中,汽车、人物等Mesh模型的形状特征通常为闭包体;延展体结构如图8所示,在游戏场景中,山、河等Mesh模型的形状特征通常为延展体。Among them, the shape feature can include umbrella body, closure body and extension body; the structure of the umbrella body is shown in Figure 6, in the game scene, the shape feature of the Mesh model of the tree is usually the umbrella body; The structure is shown in Figure 7. In the game scene, the shape features of Mesh models such as cars and characters are usually closed bodies; the structure of the extended body is shown in Figure 8. In the game scene, the shape features of Mesh models such as mountains and rivers are Usually an extension.
顶点数量的规模可以包括大规模、中等规模和小规模;例如,顶点数量大于或等于50K的Mesh模型可以称为大规模,顶点数量大于5K且小于50K的Mesh模型可以称为中等规模,顶点数量小于5K的Mesh模型可以称为小规模。需要说明的是,顶点数量的规模的表示方式不限于上述方式。The scale of the number of vertices can include large-scale, medium-scale and small-scale; for example, a mesh model with a number of vertices greater than or equal to 50K can be called large-scale, and a mesh model with a number of vertices greater than 5K and less than 50K can be called medium-scale, and the number of vertices can be called medium-scale. Mesh models smaller than 5K can be called small scale. It should be noted that the representation of the scale of the number of vertices is not limited to the above.
渲染频度可以包括低频、中频和高频。例如,可以根据同一Mesh模型在1000帧图像中被渲染的次数的多少,将该Mesh模型的渲染频度进行分类。需要说明的是,渲染频度的表示方式也不限于上述方式。Rendering frequency can include low frequency, mid frequency and high frequency. For example, the rendering frequency of the Mesh model can be classified according to the number of times the same Mesh model is rendered in 1000 frames of images. It should be noted that the representation of the rendering frequency is not limited to the above-mentioned manner.
相对于屏幕的距离可以包括近距离和远距离;具体地,可以根据Mesh模型相对于屏幕的距离进行具体确定,本申请实施例在此不做赘述。The distance relative to the screen may include a short distance and a long distance; specifically, it may be specifically determined according to the distance of the Mesh model relative to the screen, which is not repeated in this embodiment of the present application.
基于前述说明可知,第二负载标签指示具体需要简化的Mesh模型。示例性地,第二负载控制标签指示对第一渲染操作所渲染的Mesh模型中,顶点数量大于第三阈值的Mesh模型、重复数量大于第四阈值的Mesh模型或相对于屏幕的距离大于第五阈值的Mesh模型进行简化。Based on the foregoing description, it can be known that the second load label indicates the Mesh model that needs to be simplified. Exemplarily, the second load control tag indicates that among the Mesh models rendered by the first rendering operation, the number of vertices is greater than the third threshold, the number of repetitions is greater than the fourth threshold, or the distance from the screen is greater than the fifth threshold. The threshold mesh model is simplified.
可以理解的是,当顶点数量大于第三阈值时,则表示Mesh模型的几何较复杂,即渲染该Mesh模型会带来较大的负载。因此有必要对该Mesh模型进行简化,即第二负载标签可以指示顶点数量大于第三阈值的Mesh模型。It can be understood that when the number of vertices is greater than the third threshold, it means that the geometry of the Mesh model is complex, that is, rendering the Mesh model will bring a larger load. Therefore, it is necessary to simplify the Mesh model, that is, the second load label may indicate a Mesh model whose number of vertices is greater than the third threshold.
当重复数量大于第四阈值时,则表示Mesh模型的重复数量过多;即使该Mesh模型包含的顶点数量不多,所有的该Mesh模型的顶点总量也较大。因此有必要对该Mesh模型进行简化,即第二负载标签可以指示对重复数量大于第四阈值的Mesh模型进行简化。When the number of repetitions is greater than the fourth threshold, it means that the number of repetitions of the Mesh model is too large; even if the number of vertices contained in the Mesh model is small, the total number of vertices in all the Mesh models is also large. Therefore, it is necessary to simplify the Mesh model, that is, the second load label may indicate that the Mesh model whose repetition number is greater than the fourth threshold is to be simplified.
在图像渲染过程中,对于相对于屏幕距离不同的Mesh模型,通常会选择同一细节层次(Levels of Detail,LOD)进行渲染;而对于相对于屏幕较远的Mesh模型来说,在图像中通常不重要,因此选择较高的LOD进行渲染存在浪费,即可以对相对于屏幕较远的Mesh模型进行简化。因此,第二负载标签可以指示相对于屏幕的距离大于第五阈值的Mesh模型进行简化。In the process of image rendering, for Mesh models with different distances from the screen, the same level of detail (LOD) is usually selected for rendering; while for Mesh models farther from the screen, there are usually different levels of detail in the image. It is important, so it is wasteful to choose a higher LOD for rendering, that is, the Mesh model that is far away from the screen can be simplified. Therefore, the second load label may indicate that the Mesh model whose distance relative to the screen is greater than the fifth threshold is simplified.
在上述示例中,步骤103的具体过程可以如图9所示。具体地,通过第一渲染操作所渲染的每帧图像中的顶点数量和Mesh模型的数量确定简化Mesh模型的必要性(即满足第二条件),通过GPU执行第一渲染操作的过程所渲染的每个Mesh模型的顶点数量、GPU执行第一渲染操作的过程所渲染的每帧图像中Mesh模型的重复数量和GPU执行第一渲染操作的过程所渲染的每个Mesh模型相对于屏幕的距离确定待简化的Mesh模型清单,待简化的Mesh模型清单可以理解为第二负载控制标签,具体指示待简化的Mesh模型的特征、待简化的Mesh模型适用的简化算法以及简化算法的参数。In the above example, the specific process of step 103 may be as shown in FIG. 9 . Specifically, the necessity of simplifying the Mesh model (that is, satisfying the second condition) is determined by the number of vertices in each frame of the image rendered by the first rendering operation and the number of Mesh models, and the image rendered by the GPU in the process of performing the first rendering operation is determined. The number of vertices of each Mesh model, the number of repetitions of the Mesh model in each frame of image rendered by the GPU performing the first rendering operation, and the distance of each Mesh model rendered by the GPU during the first rendering operation relative to the screen are determined The list of mesh models to be simplified. The list of mesh models to be simplified can be understood as the second load control label, which specifically indicates the characteristics of the mesh model to be simplified, the simplified algorithm applicable to the mesh model to be simplified, and the parameters of the simplified algorithm.
作为一种实现方式,负载数据包括第三类负载数据,第三类负载数据表示至少一个第一指令的信息。As an implementation manner, the load data includes a third type of load data, and the third type of load data represents information of at least one first instruction.
相应地,步骤103包括:Accordingly, step 103 includes:
基于第三类负载数据指示至少一个第一指令的指令信息满足第三条件,确定第三负载数据对应的第三负载控制标签,第三负载控制标签指示对至少一个第二指令进行处理。Based on the third type of load data indicating that the instruction information of the at least one first instruction satisfies the third condition, a third load control tag corresponding to the third load data is determined, and the third load control tag instructs to process the at least one second instruction.
其中,确定第三负载数据对应的第三负载控制标签的过程,可以是从已知的一个或多个负载控制标签中选择一个负载控制标签作为第三负载控制标签。The process of determining the third load control tag corresponding to the third load data may be to select one load control tag as the third load control tag from one or more known load control tags.
相应地,目标方案则用于对至少一个第二指令进行处理。本申请实施例对目标方案的内容不做具体限定。Correspondingly, the target solution is used to process the at least one second instruction. The embodiments of the present application do not specifically limit the content of the target solution.
可以理解的是,对于不同的第三类负载数据,第三条件以及第三负载控制标签可以不同。It can be understood that, for different third types of load data, the third condition and the third load control label may be different.
例如,当第三负载数据包括DC数量时,第三条件可以是DC数量为多个,且两个或两个以上的DC用于渲染同一物体。具体地,第三负载数据包括100个渲染同一人物的DC,由于第三负载数据中的DC满足第三条件,所以可以将渲染同一人物的这100个DC合并为一个DC。For example, when the third load data includes the number of DCs, the third condition may be that the number of DCs is multiple, and two or more DCs are used to render the same object. Specifically, the third load data includes 100 DCs that render the same character. Since the DCs in the third load data satisfy the third condition, the 100 DCs that render the same character can be combined into one DC.
再例如,当第三负载数据包括渲染通道的数量、帧缓冲的尺寸、以及渲染通道与帧缓冲的引用关系时,第三条件可以为渲染通道的数量为多个,两个或两个以上的渲染通道对与帧缓冲的引用关系临近,且两个或两个以上的渲染通道对应的帧缓冲的尺寸相同。For another example, when the third load data includes the number of rendering channels, the size of the frame buffer, and the reference relationship between the rendering channels and the frame buffer, the third condition may be that the number of rendering channels is multiple, two or more. The reference relationship between the rendering pass pair and the frame buffer is adjacent, and the frame buffers corresponding to two or more rendering passes have the same size.
具体地,第三负载数据包括三个渲染通道、帧缓冲的尺寸、三个渲染通道与帧缓冲的引用关系。其中,第一渲染通道用于渲染山和树木等Mesh模型,第一渲染通道的渲染结果输出至第一帧缓冲;第二渲染通道用于在第一渲染通道的渲染结果的基础上,渲染房子等建筑物的Mesh模型,第二渲染通道的渲染结果输出至第二帧缓冲;第三渲染通道用于在第二渲染通道的渲染结果的基础上,渲染人物的Mesh模型,第二渲染通道的渲染结果输出至第三帧缓冲。由于第二渲染通道需要在第一渲染通道的渲染结果的基础上进行渲染,所以第二渲染通道与第二帧缓冲的引用关系,临近于第一渲染通道与第一帧缓冲的引用关系; 同样地,第三渲染通道与第三帧缓冲的引用关系,临近于第二渲染通道与第二帧缓冲的引用关系。此外,第一帧缓冲、第二帧缓冲和第三帧缓冲的尺寸相同,则可以将第一渲染通道、第二渲染通道和第三渲染通道合并,合并后的渲染通道只需要一个帧缓冲。Specifically, the third load data includes three rendering channels, the size of the frame buffer, and the reference relationship between the three rendering channels and the frame buffer. Among them, the first rendering pass is used to render Mesh models such as mountains and trees, and the rendering results of the first rendering pass are output to the first frame buffer; the second rendering pass is used to render houses based on the rendering results of the first rendering pass. Waiting for the Mesh model of the building, the rendering result of the second rendering pass is output to the second frame buffer; the third rendering pass is used to render the Mesh model of the character on the basis of the rendering result of the second rendering pass, and the second rendering pass The rendering result is output to the third framebuffer. Since the second rendering pass needs to be rendered on the basis of the rendering result of the first rendering pass, the reference relationship between the second rendering pass and the second frame buffer is close to the reference relationship between the first rendering pass and the first frame buffer; the same Ground, the reference relationship between the third rendering pass and the third frame buffer is adjacent to the reference relationship between the second rendering pass and the second frame buffer. In addition, if the sizes of the first frame buffer, the second frame buffer and the third frame buffer are the same, the first rendering pass, the second rendering pass and the third rendering pass can be merged, and only one frame buffer is required for the merged rendering pass.
同样地,当第三负载数据包括DC数量、帧缓冲的尺寸、DC与帧缓冲的引用关系时,第三条件可以参照前述示例中的第三条件进行理解。Likewise, when the third load data includes the number of DCs, the size of the frame buffer, and the reference relationship between the DC and the frame buffer, the third condition can be understood with reference to the third condition in the foregoing example.
在上述示例中,确定第三负载控制标签的过程如图10所示,即根据API负载(包括DC数量、帧缓冲的尺寸、渲染通道的数量)和关系(包括DC与帧缓冲的引用关系、渲染通道与帧缓冲的引用关系)确定第三负载控制标签。In the above example, the process of determining the third load control tag is shown in Figure 10, that is, according to the API load (including the number of DCs, the size of the frame buffer, the number of rendering channels) and the relationship (including the reference relationship between the DC and the frame buffer, The reference relationship between the rendering pass and the frame buffer) determines the third load control label.
此外,还可以对API和相邻帧图像中场景变化进行分析,以得到指示隔帧渲染图像的第三负载控制标签。例如,在相邻帧图像中,场景变得越来越复杂,图像中Mesh模型的数量越来越多,则可以认为负载越来越大;基于此,可以确定相应的负载控制标签,进而确定相应的目标方案以降低负载。In addition, the API and scene changes in adjacent frame images can also be analyzed to obtain a third load control tag indicating that the image is rendered every other frame. For example, in the adjacent frame images, the scene becomes more and more complex, and the number of Mesh models in the image is more and more, it can be considered that the load is getting bigger and bigger; based on this, the corresponding load control label can be determined, and then the The corresponding target scheme to reduce the load.
基于前述说明可知,若第三负载控制标签指示对多个第二指令进行处理,则在步骤104后,先根据目标方案对步骤104中获取到的至少一个第二指令进行处理,然后将处理后的至少一个第二指令向图形API传递。Based on the foregoing description, if the third load control tag instructs to process multiple second instructions, after step 104, at least one second instruction acquired in step 104 is first processed according to the target scheme, and then the processed of at least one second instruction passed to the graphics API.
具体地,在步骤104中,获取到8个第二指令,这8个第二指令构成2个DC,则会将这8个第二指令构成的2个DC合并后,将合并后的DC向下传递。Specifically, in step 104, 8 second instructions are obtained, and these 8 second instructions constitute 2 DCs, after the 2 DCs constituted by these 8 second instructions are merged, the merged DCs are sent to pass down.
基于上述说明,示例性地,第二指令的数量为多个;如图11所示,第三负载控制标签指示以下的至少一种内容:对多个第二指令构成的多个DC进行合并、对多个第二指令对应的多个渲染通道进行合并。Based on the above description, exemplarily, the number of second instructions is multiple; as shown in FIG. 11 , the third load control label indicates at least one of the following contents: combining multiple DCs formed by multiple second instructions, Combine multiple rendering passes corresponding to multiple second instructions.
示例性地,第三负载控制标签还可以指示对多个实例Instance进行合并;例如,多个第二指令用于渲染50棵树,每5棵树为一组(即一个实例Instance)进行渲染,则可以将渲染50棵树的多个第二指令合并。Exemplarily, the third load control tag may also instruct to merge multiple instances; for example, multiple second instructions are used to render 50 trees, and each 5 trees are rendered as a group (that is, one instance Instance), Then multiple second instructions for rendering 50 trees can be combined.
示例性地,第三负载控制标签还可以指示隔振渲染图像。Illustratively, the third load control tag may also indicate a vibration isolation rendered image.
在本申请实施例中,第三负载控制标签的形式可以如下表3所示,第三负载标签指示待处理的第二指令的名称、第二指令的特征、处理第二指令的方案编码和处理第二指令的方案参数。In this embodiment of the present application, the form of the third load control tag may be as shown in Table 3 below, where the third load tag indicates the name of the second instruction to be processed, the characteristics of the second instruction, and the scheme encoding and processing for processing the second instruction Scheme parameters of the second command.
表3table 3
经过上述对本申请实施例提供的控制负载的方法进行介绍,图3所示的控制负载的流程可以如图12所示。具体地,获取的与第一指令相关的数据包括至少一个第一指令、耗时打点、运行数据和资源数据。After the above description of the load control method provided by the embodiment of the present application, the flow of the load control shown in FIG. 3 may be shown in FIG. 12 . Specifically, the acquired data related to the first instruction includes at least one first instruction, time-consuming management, running data and resource data.
其中,耗时打点用于确定第一类负载数据中的计算耗时,运行数据用于确定第一类负载数据中CPU的运行参数(例如频点)、GPU的运行参数(例如频点)以及内部存储器的运行参数(例如频点)。Among them, the time-consuming management is used to determine the calculation time in the first type of load data, and the operation data is used to determine the CPU's operating parameters (such as frequency points), the GPU's operating parameters (such as frequency points) in the first type of load data, and Operating parameters of the internal memory (eg frequency points).
根据特征库确定的负载数据则包含第一类负载数据、第二类负载数据和第三类负载数据。The load data determined according to the signature database includes the first type of load data, the second type of load data and the third type of load data.
根据上述三类负载数据可以确定负载控制标签,根据负载控制标签则可以从负载控制方案库中匹配到目标方案,该目标方案可以用于调节运行参数、简化Mesh模型以及处理至少一个第二指令。According to the above three types of load data, a load control label can be determined, and according to the load control label, a target solution can be matched from the load control solution library, and the target solution can be used to adjust the operating parameters, simplify the mesh model, and process at least one second instruction.
请参阅图13,本申请实施例还提供了一种控制负载的装置的一个实施例,该实施例可以应用于CPU,包括:Referring to FIG. 13 , an embodiment of the present application further provides an embodiment of an apparatus for controlling a load, which can be applied to a CPU, including:
指令获取模块201,用于获取至少一个第一指令,至少一个第一指令用于调用应用程序接口API,以使得图形处理器GPU执行第一渲染操作;an instruction acquisition module 201, configured to acquire at least one first instruction, where the at least one first instruction is used to call an application program interface API, so that the graphics processor GPU performs the first rendering operation;
负载数据确定模块202,用于基于至少一个第一指令确定GPU执行第一渲染操作的过程的负载数据;A load data determination module 202, configured to determine load data of a process in which the GPU performs the first rendering operation based on at least one first instruction;
目标方案确定模块203,用于基于负载数据确定用于控制负载的目标方案;a target solution determination module 203, configured to determine a target solution for controlling the load based on the load data;
指令获取模块201,还用于获取至少一个第二指令,至少一个第二指令用于调用API,以使得GPU执行第二渲染操作;The instruction acquisition module 201 is further configured to acquire at least one second instruction, and the at least one second instruction is used to call the API, so that the GPU performs the second rendering operation;
控制模块204,用于基于目标方案控制GPU执行第二渲染操作的过程中的负载。The control module 204 is configured to control the load in the process of performing the second rendering operation on the GPU based on the target scheme.
作为一种实现方式,负载数据确定模块202,用于基于至少一个第一指令和至少一个负载特征因子获取GPU执行第一渲染操作的过程的至少一种负载数据,每个负载特征因子对应一种负载数据。As an implementation manner, the load data determination module 202 is configured to obtain at least one kind of load data of a process in which the GPU performs the first rendering operation based on at least one first instruction and at least one load characteristic factor, and each load characteristic factor corresponds to one type of load data. load data.
作为一种实现方式,至少一个负载特征因子包括以下三类负载特征因子中的至少一类:第一类负载特征因子、第二类负载特征因子和第三类负载特征因子;第一类负载特征因子用于表示GPU执行第一渲染操作的过程对计算机硬件资源的消耗情况;第二类负载特征因子用于表示GPU执行第一渲染操作的过程所渲染的网格Mesh模型的信息;第三类负载特征因子用于表示至少一个第一指令的信息。As an implementation manner, the at least one load characteristic factor includes at least one of the following three types of load characteristic factors: a first type of load characteristic factor, a second type of load characteristic factor, and a third type of load characteristic factor; the first type of load characteristic factor The factor is used to represent the consumption of computer hardware resources in the process of the GPU performing the first rendering operation; the second type of load characteristic factor is used to represent the information of the mesh model rendered by the GPU in the process of performing the first rendering operation; the third type The load characteristic factor is used to represent information of at least one first instruction.
作为一种实现方式,第一类负载特征因子包括以下的至少一种:GPU执行第一渲染操作的过程中的计算耗时、中央处理器CPU的运行参数、GPU的运行参数以及内部存储器的运行参数;第二类负载特征因子包括以下的至少一种:GPU执行第一渲染操作的过程所渲染的每个Mesh模型的顶点数量、GPU执行第一渲染操作的过程所渲染的每帧图像中的顶点数量、GPU执行第一渲染操作的过程所渲染的每帧图像中的Mesh模型的数量、GPU执行第一渲染操作的过程所渲染的每帧图像中Mesh模型的重复数量和GPU执行第一渲染操作的过程所渲染的每个Mesh模型相对于屏幕的距离;第三类负载特征因子包括以下的至少一种:至少一个第一指令构成的绘制命令DC的数量、至少一个第一指令对应的渲染通道Render Pass的数量、帧缓冲Frame Buffer尺寸、渲染通道与帧缓冲的引用关系、DC与帧缓冲的引用关系。As an implementation manner, the first type of load characteristic factor includes at least one of the following: calculation time in the process of the GPU performing the first rendering operation, operating parameters of the central processing unit CPU, operating parameters of the GPU, and operation of the internal memory parameter; the second type of load characteristic factor includes at least one of the following: the number of vertices of each Mesh model rendered in the process of the GPU performing the first rendering operation, the number of vertices in each frame of the image rendered in the process of the GPU performing the first rendering operation. The number of vertices, the number of Mesh models in each frame of images rendered by the GPU in the process of performing the first rendering operation, the number of repetitions of Mesh models in each frame of images rendered by the GPU in the process of performing the first rendering operation, and the first rendering by the GPU The distance of each Mesh model rendered by the operation process relative to the screen; the third type of load characteristic factor includes at least one of the following: the number of drawing commands DC formed by at least one first instruction, the rendering corresponding to at least one first instruction The number of channel Render Passes, the frame buffer Frame Buffer size, the reference relationship between rendering channels and frame buffers, and the reference relationship between DC and frame buffers.
作为一种实现方式,至少一个负载特征因子包括第二类负载特征因子;负载数据确定模块202,用于基于至少一个第一指令各自携带的参数确定GPU执行第一渲染操作所渲染的网格Mesh模型的数据;基于GPU执行第一渲染操作所渲染的网格Mesh模型的数据,获取GPU执行第一渲染操作的过程对应第二类负载特征因子的负载数据。As an implementation manner, the at least one load characteristic factor includes a second type of load characteristic factor; the load data determination module 202 is configured to determine, based on the parameters carried by the at least one first instruction, the mesh rendered by the GPU by performing the first rendering operation Data of the model; based on the data of the mesh model rendered by the GPU performing the first rendering operation, obtain the load data corresponding to the second type of load characteristic factor in the process of the GPU performing the first rendering operation.
作为一种实现方式,目标方案确定模块203,用于基于负载数据确定负载控制标签,负载控制标签指示负载控制的内容;基于负载控制标签确定用于控制负载的目标方案。As an implementation manner, the target solution determination module 203 is configured to determine a load control label based on the load data, where the load control label indicates the content of the load control; and determine the target solution for controlling the load based on the load control label.
作为一种实现方式,负载数据包括第一类负载数据,第一类负载数据表示GPU执行第一渲染操作的过程对计算机硬件资源的消耗情况;目标方案确定模块203,用于基于第一类负载数据指示GPU执行第一渲染操作的过程对计算机硬件资源的消耗情况满足第一条件,确定第一负载控制标签,第一负载控制标签指示对GPU执行第二渲染操作的过程中计算机硬件的运行参数进行调节。As an implementation manner, the load data includes the first type of load data, and the first type of load data represents the consumption of computer hardware resources in the process of the GPU performing the first rendering operation; the target solution determination module 203 is configured to, based on the first type of load, The data indicates that the consumption of computer hardware resources in the process of executing the first rendering operation on the GPU satisfies the first condition, and a first load control label is determined, and the first load control label indicates the running parameters of the computer hardware in the process of executing the second rendering operation on the GPU Make adjustments.
作为一种实现方式,第一负载控制标签指示对GPU执行第二渲染操作的过程中CPU、GPU或内部存储器的频点进行调节。As an implementation manner, the first load control tag instructs to adjust the frequency point of the CPU, the GPU or the internal memory in the process of performing the second rendering operation on the GPU.
作为一种实现方式,负载数据包括第二类负载数据,第二类负载数据表示GPU执行第一渲染操作所渲染的网格Mesh模型的信息;目标方案确定模块203,用于基于第一类负载数据指示GPU执行第一渲染操作所渲染的网格Mesh模型的信息满足第二条件,确定第二负载控制标签,第二负载控制标签指示对GPU执行第二渲染操作的过程中所渲染的Mesh模型进行简化。As an implementation manner, the load data includes the second type of load data, and the second type of load data represents the information of the mesh model rendered by the GPU performing the first rendering operation; the target solution determination module 203 is configured to, based on the first type of load, The data indicates that the information of the mesh model rendered by the GPU performing the first rendering operation satisfies the second condition, and a second load control label is determined, and the second load control label indicates the Mesh model rendered in the process of performing the second rendering operation on the GPU to simplify.
作为一种实现方式,第二负载控制标签指示GPU执行第二渲染操作的过程中待简化的Mesh模型的特征、待简化的Mesh模型适用的简化算法以及简化算法的参数。As an implementation manner, the second load control tag indicates the characteristics of the Mesh model to be simplified during the GPU performing the second rendering operation, the simplified algorithm applicable to the Mesh model to be simplified, and the parameters of the simplified algorithm.
作为一种实现方式,第二类负载数据包括第一渲染操作所渲染的每帧图像中的顶点数量和Mesh模型的数量;第二条件包括第一渲染操作所渲染的每帧图像中的顶点数量大于第一阈值,或第一渲染操作所渲染的每帧图像中的Mesh模型的数量大于第二阈值。As an implementation manner, the second type of load data includes the number of vertices and the number of Mesh models in each frame of image rendered by the first rendering operation; the second condition includes the number of vertices in each frame of image rendered by the first rendering operation is greater than the first threshold, or the number of Mesh models in each frame of image rendered by the first rendering operation is greater than the second threshold.
作为一种实现方式,第二负载控制标签指示对第一渲染操作所渲染的Mesh模型中,顶点数量大于第三阈值的Mesh模型、重复数量大于第四阈值的Mesh模型或相对于屏幕的距离大于第五阈值的Mesh模型进行简化。As an implementation manner, the second load control tag indicates that among the Mesh models rendered by the first rendering operation, the number of vertices is greater than the third threshold, the number of repetitions is greater than the fourth threshold, or the distance from the screen is greater than The Mesh model of the fifth threshold is simplified.
作为一种实现方式,负载数据包括第三类负载数据,第三类负载数据表示至少一个第一指令的信息;目标方案确定模块203,用于基于第三类负载数据指示至少一个第一指令的指令信息满足第三条件,确定第三负载控制标签,第三负载控制标签指示对至少一个第二指令进行处理。As an implementation manner, the load data includes a third type of load data, and the third type of load data represents information of at least one first instruction; the target solution determination module 203 is configured to indicate the at least one first instruction based on the third type of load data. When the instruction information satisfies the third condition, a third load control tag is determined, and the third load control tag instructs to process at least one second instruction.
作为一种实现方式,第二指令的数量为多个;第三负载控制标签指示以下的至少一种内容:对多个第二指令构成的多个DC进行合并、对多个第二指令对应的多个Render Pass进行合并。As an implementation manner, the number of second instructions is multiple; the third load control label indicates at least one of the following contents: combining multiple DCs formed by multiple second instructions, and combining multiple DCs corresponding to multiple second instructions Combine multiple Render Passes.
本申请实施例还提供了另一种终端设备,如图14所示,为了便于说明,仅示出了与本申请实施例相关的部分,具体技术细节未揭示的,请参照本申请实施例方法部分。该终端可以为包括手机、平板电脑、个人数字助理(英文全称:Personal Digital Assistant,英文缩写:PDA)、销售终端(英文全称:Point of Sales,英文缩写:POS)、车载电脑等任意终端设备,以终端为手机为例:This embodiment of the present application also provides another terminal device, as shown in FIG. 14 . For the convenience of description, only the part related to the embodiment of the present application is shown. If the specific technical details are not disclosed, please refer to the method of the embodiment of the present application. part. The terminal can be any terminal device including mobile phone, tablet computer, personal digital assistant (full name in English: Personal Digital Assistant, English abbreviation: PDA), sales terminal (full name in English: Point of Sales, English abbreviation: POS), vehicle computer, etc. Take the terminal as a mobile phone as an example:
图14示出的是与本申请实施例提供的终端相关的手机的部分结构的框图。参考图14,手机包括:射频(英文全称:Radio Frequency,英文缩写:RF)电路1010、存储器1020、输入单元1030、显示单元1040、传感器1050、音频电路1060、无线保真(英文全称:wireless fidelity,英文缩写:WiFi)模块1070、中央处理器CPU1080、图形处理器GPU1090以及电源等部件。本领域技术人员可以理解,图14中示出的手机结构并不构成对手机的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。FIG. 14 is a block diagram showing a partial structure of a mobile phone related to a terminal provided by an embodiment of the present application. Referring to FIG. 14 , the mobile phone includes: a radio frequency (full name in English: Radio Frequency, English abbreviation: RF) circuit 1010, a memory 1020, an input unit 1030, a display unit 1040, a sensor 1050, an audio circuit 1060, a wireless fidelity (full name in English: wireless fidelity) , English abbreviation: WiFi) module 1070, central processing unit CPU1080, graphics processing unit GPU1090, power supply and other components. Those skilled in the art can understand that the structure of the mobile phone shown in FIG. 14 does not constitute a limitation on the mobile phone, and may include more or less components than the one shown, or combine some components, or arrange different components.
下面结合图14对手机的各个构成部件进行具体的介绍:The following is a detailed introduction to each component of the mobile phone with reference to Figure 14:
RF电路1010可用于收发信息或通话过程中,信号的接收和发送,特别地,将基站的下行信息接收后,给CPU1080处理;另外,将设计上行的数据发送给基站。通常,RF电路1010包括但不限于天线、至少一个放大器、收发信机、耦合器、低噪声放大器(英文全称:Low Noise Amplifier,英文缩写:LNA)、双工器等。此外,RF电路1010还可以通过无线通信与网络和其他设备通信。上述无线通信可以使用任一通信标准或协议,包括但不限于全球移动通讯系统(英文全称:Global System of Mobile communication,英文缩写:GSM)、通用分组无线服务(英文全称:General Packet Radio Service,GPRS)、码分多址(英文全称:Code Division Multiple Access,英文缩写:CDMA)、宽带码分多址(英文全称:Wideband Code Division Multiple Access,英文缩写:WCDMA)、长期演进(英文全称:Long Term Evolution,英文缩写:LTE)、电子邮件、短消息服务(英文全称:Short Messaging Service,SMS)等。The RF circuit 1010 can be used for receiving and sending signals during sending and receiving of information or during a call. In particular, after receiving the downlink information of the base station, it is processed by the CPU 1080; in addition, it sends the designed uplink data to the base station. Generally, the RF circuit 1010 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (full name in English: Low Noise Amplifier, English abbreviation: LNA), a duplexer, and the like. In addition, the RF circuit 1010 can also communicate with networks and other devices via wireless communication. The above wireless communication can use any communication standard or protocol, including but not limited to Global System for Mobile Communication (English full name: Global System of Mobile communication, English abbreviation: GSM), General Packet Radio Service (English full name: General Packet Radio Service, GPRS ), Code Division Multiple Access (English full name: Code Division Multiple Access, English abbreviation: CDMA), Wideband Code Division Multiple Access (English full name: Wideband Code Division Multiple Access, English abbreviation: WCDMA), Long Term Evolution (English full name: Long Term Evolution, English abbreviation: LTE), e-mail, short message service (full name in English: Short Messaging Service, SMS) and so on.
存储器1020可用于存储软件程序以及模块,CPU1080通过运行存储在存储器1020的软件程序以及模块,从而执行手机的各种功能应用以及数据处理。存储器1020可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据手机的使用所创建的数据(比如音频数据、电话本等)等。此外,存储器1020可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。The memory 1020 can be used to store software programs and modules, and the CPU 1080 executes various functional applications and data processing of the mobile phone by running the software programs and modules stored in the memory 1020 . The memory 1020 may mainly include a stored program area and a stored data area, wherein the stored program area may store an operating system, an application program required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; Data created by the use of the mobile phone (such as audio data, phone book, etc.), etc. Additionally, memory 1020 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
输入单元1030可用于接收输入的数字或字符信息,以及产生与手机的用户设置以及功能控制有关的键信号输入。具体地,输入单元1030可包括触控面板1031以及其他输入设备1032。触控面板1031,也称为触摸屏,可收集用户在其上或附近的触摸操作(比如用户使用手指、触笔等任何适合的物体或附件在触控面板1031上或在触控面板1031附近的操作),并根据预先设定的程式驱动相应的连接装置。可选的,触控面板1031可包括触摸检测装置和触摸控制器两个部分。其中,触摸检测装置检测用户的触摸方位,并检测触摸操作带来的信号,将信号传送给触摸控制器;触摸控制器从触摸检测装置上接收触摸信息,并将它转换成触点坐标,再送给CPU1080,并能接收CPU1080发来的命令并加以执行。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型实现触控面板1031。除了触控面板1031,输入单元1030还可以包括其他输入设备1032。具体地,其他输入设备1032可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)、轨迹球、鼠标、操作杆等中的一种或多种。The input unit 1030 can be used for receiving inputted number or character information, and generating key signal input related to user setting and function control of the mobile phone. Specifically, the input unit 1030 may include a touch panel 1031 and other input devices 1032 . The touch panel 1031, also referred to as a touch screen, can collect the user's touch operations on or near it (such as the user's finger, stylus, etc., any suitable object or accessory on or near the touch panel 1031). operation), and drive the corresponding connection device according to the preset program. Optionally, the touch panel 1031 may include two parts, a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it to the touch controller. To the CPU1080, and can receive the command sent by the CPU1080 and execute it. In addition, the touch panel 1031 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves. Besides the touch panel 1031 , the input unit 1030 may also include other input devices 1032 . Specifically, other input devices 1032 may include, but are not limited to, one or more of physical keyboards, function keys (such as volume control keys, switch keys, etc.), trackballs, mice, joysticks, and the like.
显示单元1040可用于显示由用户输入的信息或提供给用户的信息以及手机的各种菜单。显示单元1040可包括显示面板1041,可选的,可以采用液晶显示器(英文全称:Liquid Crystal Display,英文缩写:LCD)、有机发光二极管(英文全称:Organic Light-Emitting Diode,英文缩写:OLED)等形式来配置显示面板1041。进一步的,触控面板1031可覆盖显示面板1041,当触控面板1031检测到在其上或附近的触摸操作后,传送给CPU1080以确定触摸事件的类型,随后CPU1080根据触摸事件的类型在显示面板1041上提供相应的视觉输出。虽然在图14中,触控面板1031与显示面板1041是作为两个独立的部件来实现手机的输入和输入功能,但是在某些实施例中,可以将触控面板1031与显示面板1041集成而实现手机的输入和输出功能。The display unit 1040 may be used to display information input by the user or information provided to the user and various menus of the mobile phone. The display unit 1040 may include a display panel 1041. Optionally, a liquid crystal display (English full name: Liquid Crystal Display, English abbreviation: LCD), an organic light-emitting diode (English full name: Organic Light-Emitting Diode, English abbreviation: OLED), etc. form to configure the display panel 1041. Further, the touch panel 1031 can cover the display panel 1041. When the touch panel 1031 detects a touch operation on or near it, it transmits it to the CPU 1080 to determine the type of the touch event, and then the CPU 1080 displays the touch event on the display panel according to the type of the touch event. The corresponding visual output is provided on 1041. Although in FIG. 14, the touch panel 1031 and the display panel 1041 are used as two independent components to realize the input and input functions of the mobile phone, in some embodiments, the touch panel 1031 and the display panel 1041 can be integrated to form Realize the input and output functions of the mobile phone.
手机还可包括至少一种传感器1050,比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示面板1041的亮度,接近传感器可在手机移动到耳边时,关闭显示面板1041和/或背光。作为运动传感器的一种,加速计传感器可检测各个方向上(一般为三轴)加速度的大小,静止时可检测出重力的大小及方向,可用于识别手机姿态的应用(比如横竖屏切换、相关游戏、磁力计姿态校准)、振动识别相关功能(比如计步器、敲击)等;至于手机还可配置的陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器,在此不再赘述。The cell phone may also include at least one sensor 1050, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 1041 according to the brightness of the ambient light, and the proximity sensor may turn off the display panel 1041 and/or when the mobile phone is moved to the ear. or backlight. As a kind of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in all directions (usually three axes), and can detect the magnitude and direction of gravity when it is stationary. games, magnetometer attitude calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors such as gyroscope, barometer, hygrometer, thermometer, infrared sensor, etc. Repeat.
音频电路1060、扬声器1061,传声器1062可提供用户与手机之间的音频接口。音频电路1060可将接收到的音频数据转换后的电信号,传输到扬声器1061,由扬声器1061转换为声音信号输出;另一方面,传声器1062将收集的声音信号转换为电信号,由音频电路1060接收后转换为音频数据,再将音频数据输出CPU1080处理后,经RF电路1010以发送给比如另一手机,或者将音频数据输出至存储器1020以便进一步处理。The audio circuit 1060, the speaker 1061, and the microphone 1062 can provide an audio interface between the user and the mobile phone. The audio circuit 1060 can convert the received audio data into an electrical signal, and transmit it to the speaker 1061, and the speaker 1061 converts it into a sound signal and outputs it; After receiving, it is converted into audio data, and then the audio data is output to the CPU 1080 for processing, and then sent to, for example, another mobile phone via the RF circuit 1010, or the audio data is output to the memory 1020 for further processing.
WiFi属于短距离无线传输技术,手机通过WiFi模块1070可以帮助用户收发电子邮件、浏览网页和访问流式媒体等,它为用户提供了无线的宽带互联网访问。虽然图14示出了WiFi模块1070,但是可以理解的是,其并不属于手机的必须构成,完全可以根据需要在不改变发明的本质的范围内而省略。WiFi is a short-distance wireless transmission technology. The mobile phone can help users to send and receive emails, browse web pages, and access streaming media through the WiFi module 1070, which provides users with wireless broadband Internet access. Although FIG. 14 shows the WiFi module 1070, it can be understood that it is not a necessary component of the mobile phone, and can be completely omitted as required within the scope of not changing the essence of the invention.
CPU1080是手机的控制中心,利用各种接口和线路连接整个手机的各个部分,通过运行或执行存储在存储器1020内的软件程序和/或模块,以及调用存储在存储器1020内的数据,执行手机的各种功能和处理数据,从而对手机进行整体监控。可选的,CPU1080可包括一个或多个处理单元;优选的,CPU1080可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到CPU1080中。The CPU 1080 is the control center of the mobile phone, and uses various interfaces and lines to connect various parts of the entire mobile phone. Various functions and processing data for overall monitoring of the mobile phone. Optionally, the CPU 1080 may include one or more processing units; preferably, the CPU 1080 may integrate an application processor and a modulation and demodulation processor, wherein the application processor mainly processes the operating system, user interface, and application programs, etc. The processor mainly handles wireless communication. It can be understood that, the above-mentioned modulation and demodulation processor may not be integrated into the CPU 1080.
GPU1090主要用于将存储器1020中的数据渲染成图像,在显示单元1040中显示。The GPU 1090 is mainly used to render the data in the memory 1020 into images, which are displayed in the display unit 1040 .
手机还包括给各个部件供电的电源(比如电池),优选的,电源可以通过电源管理系统与CPU1080逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。The mobile phone also includes a power source (such as a battery) for supplying power to various components. Preferably, the power source can be logically connected to the CPU 1080 through a power management system, so as to manage charging, discharging, and power consumption management functions through the power management system.
尽管未示出,手机还可以包括摄像头、蓝牙模块等,在此不再赘述。Although not shown, the mobile phone may also include a camera, a Bluetooth module, and the like, which will not be repeated here.
在本申请实施例中,该终端所包括的CPU1080还具有以下功能:In this embodiment of the present application, the CPU 1080 included in the terminal also has the following functions:
获取至少一个第一指令,至少一个第一指令用于调用应用程序接口API,以使得图形处理器GPU执行第一渲染操作;Acquiring at least one first instruction, where the at least one first instruction is used to call an application program interface API, so that the graphics processor GPU performs the first rendering operation;
基于至少一个第一指令确定GPU执行第一渲染操作的过程的负载数据;determining load data of a process in which the GPU performs the first rendering operation based on the at least one first instruction;
基于负载数据确定用于控制负载的目标方案;Determine a target scheme for controlling the load based on the load data;
获取至少一个第二指令,至少一个第二指令用于调用API,以使得GPU执行第二渲染操作;Acquiring at least one second instruction, where the at least one second instruction is used to call the API, so that the GPU performs the second rendering operation;
基于目标方案控制GPU执行第二渲染操作的过程中的负载。The load during the execution of the second rendering operation by the GPU is controlled based on the target scheme.
在本申请实施例中,该终端所包括的GPU1090还具有以下功能:In this embodiment of the present application, the GPU 1090 included in the terminal also has the following functions:
基于至少一个第一指令执行第一渲染操作,以及基于至少一个第二指令执行第二渲染操作。A first rendering operation is performed based on at least one first instruction, and a second rendering operation is performed based on at least one second instruction.
本申请实施例还提供一种芯片,包括一个或多个处理器。所述处理器中的部分或全部用于读取并执行存储器中存储的计算机程序,以执行图2对应的各实施例的方法。Embodiments of the present application further provide a chip including one or more processors. Part or all of the processor is used to read and execute the computer program stored in the memory, so as to execute the method of each embodiment corresponding to FIG. 2 .
可选地,该芯片该包括存储器,该存储器与该处理器通过电路或电线与存储器连接。进一步可选地,该芯片还包括通信接口,处理器与该通信接口连接。通信接口用于接收需要处理的数据和/或信息,处理器从该通信接口获取该数据和/或信息,并对该数据和/或信息进行处理,并通过该通信接口输出处理结果。该通信接口可以是输入输出接口。Optionally, the chip includes a memory, and the memory and the processor are connected to the memory through a circuit or a wire. Further optionally, the chip further includes a communication interface, and the processor is connected to the communication interface. The communication interface is used for receiving data and/or information to be processed, the processor obtains the data and/or information from the communication interface, processes the data and/or information, and outputs the processing result through the communication interface. The communication interface may be an input-output interface.
在一些实现方式中,所述一个或多个处理器中还可以有部分处理器是通过专用硬件的方式来实现以上方法中的部分步骤,例如涉及神经网络模型的处理可以由专用神经网络处理器或图形处理器来实现。In some implementations, some of the one or more processors may also implement some steps in the above method by means of dedicated hardware, for example, the processing involving the neural network model may be performed by a dedicated neural network processor or graphics processor.
本申请实施例提供的方法可以由一个芯片实现,也可以由多个芯片协同实现。The methods provided in the embodiments of the present application may be implemented by one chip, or may be implemented collaboratively by multiple chips.
本申请实施例还提供了一种计算机存储介质,该计算机存储介质用于储存为上述计算机设备所用的计算机软件指令,其包括用于执行为计算机设备所设计的程序。Embodiments of the present application also provide a computer storage medium, where the computer storage medium is used for storing computer software instructions used by the above-mentioned computer device, which includes a program for executing a program designed for the computer device.
该计算机设备可以如前述图13所描述的运行应用程序的装置。The computer device can be an apparatus for running an application program as described in the aforementioned FIG. 13 .
本申请实施例还提供了一种计算机程序产品,该计算机程序产品包括计算机软件指令,该计算机软件指令可通过处理器进行加载来实现前述图2所示的方法中的流程。Embodiments of the present application further provide a computer program product, where the computer program product includes computer software instructions, and the computer software instructions can be loaded by a processor to implement the process in the method shown in FIG. 2 .
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system, device and unit described above may refer to the corresponding process in the foregoing method embodiments, which will not be repeated here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit. The above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可 以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the present application can be embodied in the form of software products in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, and the computer software products are stored in a storage medium , including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, Read-Only Memory (ROM, Read-Only Memory), Random Access Memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program codes .
Claims (18)
- 一种控制负载的方法,其特征在于,包括:A method for controlling a load, comprising:获取至少一个第一指令,所述至少一个第一指令用于调用应用程序接口API,以使得图形处理器GPU执行第一渲染操作;Acquiring at least one first instruction, where the at least one first instruction is used to call an application program interface API, so that the graphics processor GPU performs a first rendering operation;基于所述至少一个第一指令确定所述GPU执行所述第一渲染操作的过程的负载数据;determining load data of a process in which the GPU performs the first rendering operation based on the at least one first instruction;基于所述负载数据确定用于控制负载的目标方案;determining a target solution for controlling the load based on the load data;获取至少一个第二指令,所述至少一个第二指令用于调用所述API,以使得所述GPU执行第二渲染操作;Acquiring at least one second instruction, where the at least one second instruction is used to call the API, so that the GPU performs a second rendering operation;基于所述目标方案控制所述GPU执行所述第二渲染操作的过程中的负载。The load during the execution of the second rendering operation by the GPU is controlled based on the target scheme.
- 根据权利要求1所述的方法,其特征在于,所述基于所述至少一个第一指令确定所述GPU执行所述第一渲染操作的过程的负载数据包括:The method according to claim 1, wherein the determining, based on the at least one first instruction, the load data of the process in which the GPU performs the first rendering operation comprises:基于所述至少一个第一指令和至少一个负载特征因子获取所述GPU执行所述第一渲染操作的过程的至少一种负载数据,每个负载特征因子对应一种负载数据。At least one kind of load data of a process in which the GPU performs the first rendering operation is acquired based on the at least one first instruction and at least one load characteristic factor, and each load characteristic factor corresponds to one kind of load data.
- 根据权利要求2所述的方法,其特征在于,所述至少一个负载特征因子包括以下三类负载特征因子中的至少一类:第一类负载特征因子、第二类负载特征因子和第三类负载特征因子;The method of claim 2, wherein the at least one load characteristic factor comprises at least one of the following three types of load characteristic factors: a first type of load characteristic factor, a second type of load characteristic factor, and a third type of load characteristic factor load characteristic factor;所述第一类负载特征因子用于表示所述GPU执行所述第一渲染操作的过程对计算机硬件资源的消耗情况;The first type of load characteristic factor is used to represent the consumption of computer hardware resources in the process of executing the first rendering operation by the GPU;所述第二类负载特征因子用于表示所述GPU执行所述第一渲染操作的过程所渲染的网格Mesh模型的信息;The second type of load characteristic factor is used to represent the information of the mesh Mesh model rendered by the GPU in the process of performing the first rendering operation;所述第三类负载特征因子用于表示所述至少一个第一指令的信息。The third type of load characteristic factor is used to represent the information of the at least one first instruction.
- 根据权利要求3所述的方法,其特征在于,所述第一类负载特征因子包括以下的至少一种:所述GPU执行所述第一渲染操作的过程中的计算耗时、中央处理器CPU的运行参数、GPU的运行参数以及内部存储器的运行参数;The method according to claim 3, wherein the first type of load characteristic factor comprises at least one of the following: calculation time in the process of the GPU performing the first rendering operation, a central processing unit (CPU) The operating parameters of the GPU, the operating parameters of the GPU and the operating parameters of the internal memory;所述第二类负载特征因子包括以下的至少一种:所述GPU执行所述第一渲染操作的过程所渲染的每个Mesh模型的顶点数量、所述GPU执行所述第一渲染操作的过程所渲染的每帧图像中的顶点数量、所述GPU执行所述第一渲染操作的过程所渲染的每帧图像中的Mesh模型的数量、所述GPU执行所述第一渲染操作的过程所渲染的每帧图像中Mesh模型的重复数量和所述GPU执行所述第一渲染操作的过程所渲染的每个Mesh模型相对于屏幕的距离;或者The second type of load characteristic factor includes at least one of the following: the number of vertices of each Mesh model rendered in the process of the GPU performing the first rendering operation, the process of the GPU performing the first rendering operation The number of vertices in each frame of image to be rendered, the number of Mesh models in each frame of image rendered by the process of the GPU performing the first rendering operation, and the process of the GPU performing the first rendering operation. The number of repetitions of the Mesh model in each frame of image and the distance of each Mesh model rendered by the GPU in the process of performing the first rendering operation relative to the screen; or所述第三类负载特征因子包括以下的至少一种:所述至少一个第一指令构成的绘制命令DC的数量、所述至少一个第一指令对应的渲染通道Render Pass的数量、帧缓冲Frame Buffer尺寸、所述渲染通道与所述帧缓冲的引用关系、所述DC与所述帧缓冲的引用关系。The third type of load characteristic factor includes at least one of the following: the number of drawing commands DC formed by the at least one first instruction, the number of rendering channels Render Pass corresponding to the at least one first instruction, the frame buffer Frame Buffer size, the reference relationship between the rendering pass and the frame buffer, and the reference relationship between the DC and the frame buffer.
- 根据权利要求3或4所述的方法,其特征在于,若所述至少一个负载特征因子包括所述第二类负载特征因子,则所述基于所述至少一个第一指令和至少一个负载特征因子获取所述GPU执行所述第一渲染操作的过程的至少一种负载数据包括:The method according to claim 3 or 4, wherein, if the at least one load characteristic factor includes the second type of load characteristic factor, the at least one load characteristic factor is based on the at least one first instruction and the at least one load characteristic factor. Acquiring at least one kind of load data of the process in which the GPU performs the first rendering operation includes:基于所述至少一个第一指令各自携带的参数确定所述GPU执行所述第一渲染操作所渲染的网格Mesh模型的数据;determining data of the mesh model rendered by the GPU by performing the first rendering operation based on the parameters carried by the at least one first instruction;基于所述GPU执行所述第一渲染操作所渲染的网格Mesh模型的数据,获取所述GPU执行所述第一渲染操作的过程对应所述第二类负载特征因子的负载数据。Based on the data of the mesh model rendered by the GPU performing the first rendering operation, the load data corresponding to the second type of load characteristic factor in the process of the GPU performing the first rendering operation is acquired.
- 根据权利要求1至5中任意一项所述的方法,其特征在于,所述基于所述负载数据确定用于控制负载的目标方案包括:The method according to any one of claims 1 to 5, wherein the determining a target scheme for controlling the load based on the load data comprises:基于所述负载数据确定负载控制标签,所述负载控制标签指示负载控制的内容;determining a load control tag based on the load data, the load control tag indicating the content of the load control;基于所述负载控制标签从至少一种负载控制方案中选择一种负载控制方案,作为用于控制负载的目标方案。One load control scheme is selected from at least one load control scheme based on the load control tag as a target scheme for controlling the load.
- 根据权利要求6所述的方法,其特征在于,所述负载数据包括第一类负载数据,所述第一类负载数据表示所述GPU执行所述第一渲染操作的过程对计算机硬件资源的消耗情况;The method according to claim 6, wherein the load data comprises a first type of load data, and the first type of load data represents the consumption of computer hardware resources in the process of the GPU performing the first rendering operation Condition;所述基于所述负载数据确定负载控制标签包括:The determining of the load control tag based on the load data includes:基于所述第一类负载数据指示所述GPU执行所述第一渲染操作的过程对计算机硬件资源的消耗情况满足第一条件,确定所述第一负载数据对应的第一负载控制标签,所述第一负载控制标签指示对所述GPU执行所述第二渲染操作的过程中计算机硬件的运行参数进行调节。The first load control tag corresponding to the first load data is determined based on the first type of load data indicating that the consumption of computer hardware resources by the GPU in the process of performing the first rendering operation satisfies the first condition, and the The first load control tag instructs to adjust the operating parameters of the computer hardware in the process that the GPU performs the second rendering operation.
- 根据权利要求7所述的方法,其特征在于,所述第一负载控制标签指示对所述GPU执行所述第二渲染操作的过程中CPU、GPU或内部存储器的频点进行调节。The method according to claim 7, wherein the first load control tag instructs to adjust the frequency of the CPU, the GPU or the internal memory during the process of the GPU performing the second rendering operation.
- 根据权利要求6至8中任意一项所述的方法,其特征在于,所述负载数据包括第二类负载数据,所述第二类负载数据表示所述GPU执行所述第一渲染操作所渲染的网格Mesh模型的信息;The method according to any one of claims 6 to 8, wherein the load data comprises a second type of load data, and the second type of load data represents the rendering by the GPU by performing the first rendering operation The information of the mesh Mesh model;所述基于所述负载数据确定负载控制标签包括:The determining of the load control tag based on the load data includes:基于所述第一类负载数据指示所述GPU执行所述第一渲染操作所渲染的网格Mesh模型的信息满足第二条件,确定所述第二负载数据对应的第二负载控制标签,所述第二负载控制标签指示对所述GPU执行所述第二渲染操作的过程中所渲染的Mesh模型进行简化。Based on the information that the first type of load data indicates that the mesh model rendered by the GPU performing the first rendering operation satisfies the second condition, the second load control label corresponding to the second load data is determined, and the The second load control tag indicates to simplify the Mesh model rendered in the process of the GPU performing the second rendering operation.
- 根据权利要求9所述的方法,其特征在于,所述第二负载控制标签指示所述GPU执行所述第二渲染操作的过程中待简化的Mesh模型的特征、所述待简化的Mesh模型适用的简化算法以及所述简化算法的参数。The method according to claim 9, wherein the second load control label indicates the characteristics of the mesh model to be simplified in the process of the GPU performing the second rendering operation, and the mesh model to be simplified is applicable and the parameters of the simplified algorithm.
- 根据权利要求9或10所述的方法,其特征在于,所述第二类负载数据包括所述第一渲染操作所渲染的每帧图像中的顶点数量和Mesh模型的数量;The method according to claim 9 or 10, wherein the second type of load data includes the number of vertices and the number of Mesh models in each frame of image rendered by the first rendering operation;所述第二条件包括所述第一渲染操作所渲染的每帧图像中的顶点数量大于第一阈值,或所述第一渲染操作所渲染的每帧图像中的Mesh模型的数量大于第二阈值。The second condition includes that the number of vertices in each frame of image rendered by the first rendering operation is greater than a first threshold, or the number of Mesh models in each frame of image rendered by the first rendering operation is greater than a second threshold. .
- 根据权利要求9至11中任意一项所述的方法,其特征在于,所述第二负载控制标签指示对所述第一渲染操作所渲染的Mesh模型中,顶点数量大于第三阈值的Mesh模型、重复数量大于第四阈值的Mesh模型或相对于屏幕的距离大于第五阈值的Mesh模型进行简化。The method according to any one of claims 9 to 11, wherein the second load control tag indicates a Mesh model with a number of vertices greater than a third threshold among the Mesh models rendered by the first rendering operation , Simplify the Mesh model whose number of repetitions is greater than the fourth threshold or the Mesh model whose distance from the screen is greater than the fifth threshold.
- 根据权利要求6至12中任意一项所述的方法,其特征在于,所述负载数据包括第三类负载数据,所述第三类负载数据表示所述至少一个第一指令的信息;The method according to any one of claims 6 to 12, wherein the load data comprises a third type of load data, and the third type of load data represents information of the at least one first instruction;所述基于所述负载数据确定负载控制标签包括:The determining of the load control tag based on the load data includes:基于所述第三类负载数据指示所述至少一个第一指令的指令信息满足第三条件,确定所述第三负载数据对应的第三负载控制标签,所述第三负载控制标签指示对所述至少一个第二指令进行处理。Based on the third type of load data indicating that the instruction information of the at least one first instruction satisfies a third condition, a third load control tag corresponding to the third load data is determined, and the third load control tag indicates that the At least one second instruction is processed.
- 根据权利要求13所述的方法,其特征在于,所述第二指令的数量为多个;The method according to claim 13, wherein the number of the second instructions is multiple;所述第三负载控制标签指示以下的至少一种内容:对多个所述第二指令构成的多个DC进行合并、对多个所述第二指令对应的多个渲染通道进行合并。The third load control tag indicates at least one of the following: merging multiple DCs formed by multiple second instructions, and merging multiple rendering channels corresponding to multiple second instructions.
- 一种控制负载的装置,其特征在于,包括:A device for controlling a load, comprising:指令获取模块,用于获取至少一个第一指令,所述至少一个第一指令用于调用应用程序接口API,以使得图形处理器GPU执行第一渲染操作;an instruction acquisition module, configured to acquire at least one first instruction, where the at least one first instruction is used to call an application program interface API, so that the graphics processor GPU performs the first rendering operation;负载数据确定模块,用于基于所述至少一个第一指令确定所述GPU执行所述第一渲染操作的过程的负载数据;a load data determination module, configured to determine load data of a process in which the GPU performs the first rendering operation based on the at least one first instruction;目标方案确定模块,用于基于所述负载数据确定用于控制负载的目标方案;a target solution determination module, configured to determine a target solution for controlling the load based on the load data;指令获取模块,还用于获取至少一个第二指令,所述至少一个第二指令用于调用所述API,以使得所述GPU执行第二渲染操作;an instruction acquisition module, further configured to acquire at least one second instruction, where the at least one second instruction is used to call the API, so that the GPU performs a second rendering operation;控制模块,用于基于所述目标方案控制所述GPU执行所述第二渲染操作的过程中的负载。A control module, configured to control the load in the process of executing the second rendering operation by the GPU based on the target scheme.
- 一种终端设备,其特征在于,包括:一个或多个处理器和存储器;其中,所述存储器中存储有计算机可读指令;A terminal device, comprising: one or more processors and a memory; wherein, the memory stores computer-readable instructions;所述一个或多个处理器读取所述计算机可读指令,以使所述计算机设备实现如权利要求1至14中任一项所述的方法。The computer readable instructions are read by the one or more processors to cause the computer device to implement the method of any of claims 1 to 14.
- 一种计算机可读存储介质,其特征在于,包括计算机可读指令,当所述计算机可读指令在计算机上运行时,使得所述计算机执行如权利要求1至14中任一项所述的方法。A computer-readable storage medium, characterized by comprising computer-readable instructions, which, when executed on a computer, cause the computer to execute the method according to any one of claims 1 to 14 .
- 一种计算机程序产品,其特征在于,包括计算机可读指令,当所述计算机可读指令在计算机上运行时,使得所述计算机执行如权利要求1至14中任一项所述的方法。A computer program product comprising computer readable instructions which, when executed on a computer, cause the computer to perform the method of any one of claims 1 to 14.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011186852.6 | 2020-10-29 | ||
CN202011186852.6A CN114511438A (en) | 2020-10-29 | 2020-10-29 | Method, device and equipment for controlling load |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2022089512A1 true WO2022089512A1 (en) | 2022-05-05 |
Family
ID=81383344
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2021/126924 WO2022089512A1 (en) | 2020-10-29 | 2021-10-28 | Load control method and apparatus, and device |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN114511438A (en) |
WO (1) | WO2022089512A1 (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118245230A (en) * | 2024-05-27 | 2024-06-25 | 北京趋动智能科技有限公司 | Image rendering task scheduling method and device based on load balancing |
CN118245232A (en) * | 2024-05-27 | 2024-06-25 | 北京趋动智能科技有限公司 | Image rendering task scheduling method and device based on edge cloud cooperation |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102662822A (en) * | 2012-04-26 | 2012-09-12 | 华为技术有限公司 | Load monitoring device and load monitoring method |
CN105045367A (en) * | 2015-01-16 | 2015-11-11 | 中国矿业大学 | Android system equipment power consumption optimization method based on game load prediction |
US20150355996A1 (en) * | 2014-06-04 | 2015-12-10 | Nvidia Corporation | System, method, and computer program product for collecting execution statistics for graphics processing unit workloads |
CN109558937A (en) * | 2017-09-27 | 2019-04-02 | 三星电子株式会社 | The operating method of nerve network system and nerve network system |
CN110209501A (en) * | 2019-06-03 | 2019-09-06 | Oppo广东移动通信有限公司 | Frequency adjusting method, device, terminal and the storage medium of graphics processor |
-
2020
- 2020-10-29 CN CN202011186852.6A patent/CN114511438A/en active Pending
-
2021
- 2021-10-28 WO PCT/CN2021/126924 patent/WO2022089512A1/en active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102662822A (en) * | 2012-04-26 | 2012-09-12 | 华为技术有限公司 | Load monitoring device and load monitoring method |
US20150355996A1 (en) * | 2014-06-04 | 2015-12-10 | Nvidia Corporation | System, method, and computer program product for collecting execution statistics for graphics processing unit workloads |
CN105045367A (en) * | 2015-01-16 | 2015-11-11 | 中国矿业大学 | Android system equipment power consumption optimization method based on game load prediction |
CN109558937A (en) * | 2017-09-27 | 2019-04-02 | 三星电子株式会社 | The operating method of nerve network system and nerve network system |
CN110209501A (en) * | 2019-06-03 | 2019-09-06 | Oppo广东移动通信有限公司 | Frequency adjusting method, device, terminal and the storage medium of graphics processor |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118245230A (en) * | 2024-05-27 | 2024-06-25 | 北京趋动智能科技有限公司 | Image rendering task scheduling method and device based on load balancing |
CN118245232A (en) * | 2024-05-27 | 2024-06-25 | 北京趋动智能科技有限公司 | Image rendering task scheduling method and device based on edge cloud cooperation |
Also Published As
Publication number | Publication date |
---|---|
CN114511438A (en) | 2022-05-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106504185B (en) | Rendering optimization method and device | |
EP4006844A1 (en) | Image rendering method and related device | |
WO2021104365A1 (en) | Object sharing method and electronic device | |
US10877924B2 (en) | Instruction set processing method based on a chip architecture and apparatus, and storage medium | |
US20220413670A1 (en) | Content Sharing Method and Electronic Device | |
KR102057944B1 (en) | Terminal device and sharing method thereof | |
WO2022089512A1 (en) | Load control method and apparatus, and device | |
US20130335443A1 (en) | Buffers for display acceleration | |
WO2022100663A1 (en) | Method, apparatus and device for selecting anti-aliasing algorithm and readable storage medium | |
US11954787B2 (en) | Image rendering method in panoramic application and terminal device | |
US20150128033A1 (en) | Method and apparatus for webpage browsing | |
CN109753892B (en) | Face wrinkle generation method and device, computer storage medium and terminal | |
CN112788583B (en) | Equipment searching method and device, storage medium and electronic equipment | |
WO2019071600A1 (en) | Image processing method and apparatus | |
CN111857515B (en) | Image processing method, device, storage medium and electronic equipment | |
US10776979B2 (en) | Virtual skeleton based on computing device capability profile | |
CN106709856B (en) | Graph rendering method and related equipment | |
CN111399819A (en) | Data generation method and device, electronic equipment and storage medium | |
WO2017075779A1 (en) | Image stitching method and electronic device therefor | |
CN117576258A (en) | Image processing method, device, electronic equipment and storage medium | |
CN111210496B (en) | Picture decoding method, device and equipment | |
CN108369726B (en) | Method for changing graphic processing resolution according to scene and portable electronic device | |
CN109923606B (en) | Wide color gamut image display method and device | |
CN108009172B (en) | File three-dimensional display method and device and terminal | |
WO2024140589A1 (en) | Image processing methods and electronic device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 21885239 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 21885239 Country of ref document: EP Kind code of ref document: A1 |