Rendering overhead statistical method and device, electronic equipment and storage medium

By obtaining and analyzing target rendering snapshots and determining the rendering overhead of each target rendering event, the problem that existing tools cannot accurately define the rendering overhead of each shader is solved, and the optimization efficiency and resource utilization of the rendering strategy are improved.

CN119105939APending Publication Date: 2024-12-10ZHUHAI KINGSOFT ONLINE GAME TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411167051.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-23
Publication Date
2024-12-10

AI Technical Summary

Technical Problem

Existing analysis tools can only count the total rendering overhead of the GPU, and it is difficult to determine the rendering overhead of each shader, resulting in low debugging efficiency and affecting the optimization efficiency of the rendering strategy.

Method used

By obtaining the target rendering snapshot of the target image frame, the rendering overhead and target shader of each target rendering event are determined based on the rendering snapshot, and the rendering overhead of each target shader is counted using event playback and buffer traversal to build the target file to display the rendering overhead changing trends.

Benefits of technology

This improves the analysis efficiency during the debugging process, and thus improves the optimization efficiency of the rendering strategy, can accurately determine the rendering overhead of each target shader, and improves resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119105939A_ABST
    Figure CN119105939A_ABST
Patent Text Reader

Abstract

The invention provides a rendering overhead statistical method and device, electronic equipment and a storage medium, and the method comprises the steps: obtaining a target rendering snapshot of a target image frame, and determining the rendering information and each target rendering event in a rendering process through the target rendering snapshot; determining a first rendering overhead and a target shader of each target rendering event based on the target rendering snapshot, wherein the target shader can be determined from the rendering resources of the target rendering events; and determining a second rendering overhead of the target shader based on the first rendering overhead, wherein the second rendering overhead of the target shader can be counted by using the rendering overhead of the target rendering event. Therefore, the rendering overhead of each target shader can be determined by utilizing a snapshot mechanism, the analysis efficiency in the debugging process is improved, and the optimization efficiency of the rendering strategy is further improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data statistics, and in particular to a rendering overhead statistics method, device, electronic device, and storage medium. Background Art

[0002] With the development of computer technology, the rendering capability of Graphics Processing Unit (GPU) has been greatly improved, and the cost of image rendering has also increased. Shaders are important resources for image rendering. Developers need to optimize rendering strategies based on the rendering cost of shaders to improve resource utilization.

[0003] However, common analysis tools can only count the total GPU overhead, such as the total time taken to render a frame of an image. Developers need to manually analyze the total overhead to determine the rendering overhead of each shader, which is very inefficient and affects the optimization efficiency of the rendering strategy. Summary of the invention

[0004] The present invention aims to solve at least one of the technical problems existing in the prior art. To this end, the present invention proposes a rendering overhead statistics method, device, electronic device, and storage medium, which can determine the rendering overhead of each shader and improve the debugging efficiency and the optimization efficiency of the rendering strategy.

[0005] In a first aspect, an embodiment of the present invention provides a rendering overhead statistics method, including:

[0006] Acquire a target rendering snapshot of a target image frame, wherein the target rendering snapshot is used to indicate a rendering process of the target image frame, and the rendering process of the target image frame includes a plurality of target rendering events;

[0007] Determine a first rendering cost and a target shader for each of the target rendering events based on the target rendering snapshot;

[0008] A second rendering cost of the target shader is determined based on the first rendering cost.

[0009] According to some embodiments of the present invention, after acquiring the target rendering snapshot of the target image frame, the method further includes:

[0010] Simulating a rendering process of the target image frame based on the target rendering snapshot, recording a first candidate duration of each target rendering event, and determining a second candidate duration of the target image frame based on all of the first candidate durations;

[0011] Repeat the simulation of the rendering process of the target image frame multiple times, determine the one with the smallest value among the multiple second candidate durations as the second target duration, and determine each of the first candidate durations of the simulation process corresponding to the second target duration as the first target duration of the corresponding target rendering event, wherein the first target duration is used to construct the first rendering overhead.

[0012] According to some embodiments of the present invention, determining a first rendering cost and a target shader of each target rendering event based on the target rendering snapshot includes:

[0013] Building an event tree based on the target rendering snapshot, wherein the event tree includes a plurality of snapshot rendering events;

[0014] Building a first list based on the snapshot rendering event, wherein the first list is used to indicate a mapping relationship between a snapshot event identifier and a first resource identifier, the snapshot event identifier is used to indicate the snapshot rendering event, and the first resource identifier is used to indicate an event rendering resource of the snapshot rendering event;

[0015] Determine the target rendering event from the plurality of snapshot rendering events, and determine the target shader corresponding to the target rendering event based on the first list;

[0016] The first rendering cost of the target rendering event is determined based on event playback.

[0017] According to some embodiments of the present invention, determining the target rendering event from the plurality of snapshot rendering events comprises:

[0018] Obtaining a preset configuration file, wherein the configuration file records a plurality of candidate buffers, and the candidate buffers are used to buffer the snapshot rendering event;

[0019] Selecting a target buffer from the plurality of candidate buffers, and determining one of the snapshot rendering events in the target buffer as the target rendering event based on the event tree;

[0020] Whenever the target shader and the first rendering cost are determined based on one target rendering event, another target rendering event is determined from the target buffer;

[0021] When the snapshot rendering event of the target buffer is traversed completely, a new target buffer is selected from the remaining candidate buffers, and a new target rendering event is determined based on the new target buffer.

[0022] According to some embodiments of the present invention, determining the target shader corresponding to the target rendering event based on the first list includes:

[0023] Obtain a target event identifier of the target rendering event, and determine at least one candidate rendering resource from the first list based on the target event identifier;

[0024] Determine a target rendering module of the target rendering event based on event playback, and determine a target resource identifier corresponding to a module rendering resource of the target rendering module;

[0025] When the first list does not record the target resource identifier, giving up counting the current target rendering event;

[0026] When the first list records the target resource identifier, the target shader is determined from the candidate rendering resources based on the target resource identifier.

[0027] According to some embodiments of the present invention, determining the target rendering module of the target rendering event based on event playback, and determining the target resource identifier corresponding to the module rendering resource of the target rendering module, includes:

[0028] Determine rendering pipeline information of the target rendering event based on event playback, and determine at least one candidate rendering module based on the rendering pipeline information;

[0029] Building a second list based on the candidate rendering modules, wherein the second list is used to indicate a mapping relationship between the candidate rendering modules and the corresponding second resource identifiers of the module rendering resources;

[0030] Determine a target operation type of the target rendering event based on a structure file, and determine the target rendering module based on the target operation type, wherein the structure file is constructed based on the target rendering snapshot, and the structure file is used to indicate a mapping relationship between the snapshot rendering event, the optional operation type, and the candidate rendering module;

[0031] The target resource identifier is determined based on the target rendering module and the second list.

[0032] According to some embodiments of the present invention, the method of determining the target shader from the candidate rendering resources based on the target resource identifier further includes:

[0033] Obtaining a preset configuration file, wherein the configuration file records a third list and execution configuration information, and the third list records a plurality of target names;

[0034] Determine the candidate rendering resource corresponding to the target resource identifier as a candidate shader;

[0035] When the execution configuration information is used to indicate a first execution operation, when the shader name of the candidate shader is recorded in the third list, the candidate shader is determined as the target shader, or, when the shader name of the candidate shader is not recorded in the third list, the current target rendering event is abandoned;

[0036] Alternatively, when the execution configuration information is used to indicate a second execution operation, the candidate shader is determined as the target shader, and when the shader name of the target shader is not recorded in the third list, a new target name is added to the third list based on the shader name of the target shader.

[0037] According to some embodiments of the present invention, before determining the rendering pipeline information of the target rendering event based on event playback, the method further includes:

[0038] Get the target event name of the target rendering event;

[0039] When the target event name includes preset target characters, an event screen of the target rendering event is captured and saved.

[0040] According to some embodiments of the present invention, after determining the second rendering cost of the target shader based on the first rendering cost, the method further includes:

[0041] Building a target file based on each of the target shaders and the corresponding second rendering cost;

[0042] Target display information is constructed based on the target file, wherein the target display information is used to indicate a change trend of each of the second rendering costs.

[0043] In a second aspect, an embodiment of the present invention provides a rendering overhead statistics method, which is applied to an analyzer of a human-computer interaction device, the analyzer being communicatively connected to a client, and the rendering overhead statistics method comprising:

[0044] After the analyzer is started, when a trigger signal sent by the client is obtained, a target file is output based on a target rendering snapshot of a target image frame obtained from the client, wherein the target rendering snapshot is used to indicate a rendering process of the target image frame, the rendering process of the target image frame includes a plurality of target rendering events, the target rendering snapshot is used to determine a first rendering cost and a target shader of each of the target rendering events, the target file is constructed based on each of the target shaders and a corresponding second rendering cost, and the second rendering cost is determined based on the first rendering cost;

[0045] In response to a user's selection operation on the target file, target display information is constructed based on the target file, wherein the target display information is used to indicate a change trend of each of the second rendering costs.

[0046] In a third aspect, an embodiment of the present invention provides a rendering overhead statistics device, including:

[0047] A snapshot capturing unit is configured to obtain a target rendering snapshot of a target image frame, wherein the target rendering snapshot is used to indicate a rendering process of the target image frame, and the rendering process of the target image frame includes a plurality of target rendering events;

[0048] A snapshot application unit, configured to determine a first rendering cost and a target shader of each of the target rendering events based on the target rendering snapshot;

[0049] The cost statistics unit is configured to determine a second rendering cost of the target shader based on the first rendering cost.

[0050] In a fourth aspect, an embodiment of the present invention provides an electronic device comprising at least one control processor and a memory for communicating with the at least one control processor; the memory stores instructions executable by the at least one control processor, and the instructions are executed by the at least one control processor so that the at least one control processor can execute the rendering overhead statistics method as described in the first aspect above, or execute the rendering overhead statistics method as described in the second aspect above.

[0051] In a fifth aspect, an embodiment of the present invention provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute the rendering overhead statistics method as described in the first aspect above, or to execute the rendering overhead statistics method as described in the second aspect above.

[0052] According to the method of the embodiment of the present invention, a target rendering snapshot of a target image frame is obtained, and rendering information and each target rendering event in the rendering process can be determined through the target rendering snapshot; the first rendering cost and target shader of each target rendering event are determined based on the target rendering snapshot, and the target shader can be determined from the rendering resources of the target rendering event; the second rendering cost of the target shader is determined based on the first rendering cost, and the second rendering cost of the target shader can be calculated using the rendering cost of the target rendering event. In this way, the rendering cost of each target shader can be determined using the snapshot mechanism, which improves the analysis efficiency during the debugging process, and further improves the optimization efficiency of the rendering strategy. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] Figure 1 It is a schematic diagram of the processing process of a rendering overhead statistics method according to an embodiment of the present invention;

[0054] Figure 2 is a flowchart of a rendering overhead statistics method provided by an embodiment of the present invention;

[0055] Figure 3 is a flowchart of a rendering overhead statistics method applied to a human-computer interaction device provided by an embodiment of the present invention;

[0056] Figure 4 is a flow chart of a rendering cost statistics method applied to a game scene provided by an embodiment of the present invention;

[0057] Figure 5 It is a structural schematic diagram of a rendering overhead statistics device provided by an embodiment of the present invention;

[0058] Figure 6 It is a structural diagram of an electronic device provided by another embodiment of the present invention. DETAILED DESCRIPTION

[0059] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.

[0060] In the description of the present invention, it should be understood that descriptions involving orientations, such as up, down, front, back, left, right, etc., and orientations or positional relationships indicated are based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present invention.

[0061] In the description of the present invention, "several" means one or more, "more" means more than two, "greater than", "less than", "exceed" etc. are understood as not including the number itself, and "above", "below", "within" etc. are understood as including the number itself. If there is a description of "first" or "second", it is only used for the purpose of distinguishing the technical features, and cannot be understood as indicating or implying the relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.

[0062] In the description of the present invention, unless otherwise clearly defined, terms such as setting, installing, connecting, etc. should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meanings of the above terms in the present invention based on the specific content of the technical solution.

[0063] It should be noted that with the development of rendering technology, more and more images are rendered by GPU in the game, and the content is becoming richer and richer. GPU needs to occupy more system resources when rendering images, so the rendering overhead is large. In order to improve the user experience, it is necessary to improve the rendering efficiency of each rendered object in the game. Based on this, developers usually analyze the rendering overhead of each shader, optimize the rendering strategy of the shader with abnormal overhead, and then reduce the overall rendering overhead, reduce terminal heating, and improve the resource utilization of the system. However, common analysis tools can only count the total overhead of the GPU. For example, it can only determine that the total rendering time of the GPU is 1 millisecond, and it cannot be determined that the rendering time of shader A is 0.7 milliseconds and the rendering time of shader B is 0.3 milliseconds. Developers need to perform manual analysis based on the total overhead to determine the rendering overhead of each shader. The debugging efficiency is very low, which affects the optimization efficiency of the rendering strategy.

[0064] Therefore, an embodiment of the present invention provides a rendering cost statistics method, which obtains a target rendering snapshot of a target image frame, and can determine the rendering information and each target rendering event in the rendering process through the target rendering snapshot; determine the first rendering cost and target shader of each target rendering event based on the target rendering snapshot, and can determine the target shader from the rendering resources of the target rendering event; determine the second rendering cost of the target shader based on the first rendering cost, and can use the rendering cost of the target rendering event to count the second rendering cost of the target shader. In this way, the snapshot mechanism can be used to determine the rendering cost of each target shader, improve the analysis efficiency in the debugging process, and then improve the optimization efficiency of the rendering strategy.

[0065] In the present invention, a rendering overhead statistics method, device, electronic device, and computer-readable storage medium are provided, which are described in detail one by one in the following embodiments.

[0066] Reference Figure 1 , Figure 1 A schematic diagram of a processing process of a rendering overhead statistics method provided by an embodiment of the present invention, such as Figure 1 As shown, after the analyzer 10 is started, the client 20 sends a notification to the analyzer 10 and starts the game. The client 20 obtains the target rendering snapshot of the game screen frame and sends it to the analyzer 10. After the analyzer 10 loads the target rendering snapshot, it builds a first list based on the target rendering snapshot, obtains the configuration file, and traverses the target rendering events in the buffer based on the configuration file. Each time a target rendering event is traversed, the first rendering cost of the target rendering event and the corresponding target rendering module are determined through event playback, the target resource identifier is determined based on the target rendering module, the target shader is determined according to the target resource identifier and the first list, and the second rendering cost of the target shader is determined based on the first rendering cost.

[0067] Reference Figure 2 , Figure 2 A flowchart of a rendering cost statistics method provided by an embodiment of the present invention, the rendering cost statistics method includes but is not limited to the following steps:

[0068] S21, obtaining a target rendering snapshot of a target image frame, wherein the target rendering snapshot is used to indicate a rendering process of the target image frame, and the rendering process of the target image frame includes a plurality of target rendering events.

[0069] Specifically, the target image frame is the current frame of image rendering, and this implementation performs rendering analysis in frames. The target rendering snapshot is a snapshot of the rendering process of the target image frame, through which rendering information such as rendering events and rendering resources can be obtained during the rendering process of the target image frame.

[0070] In actual applications, the overhead statistics of this embodiment can be executed by an analyzer. The analyzer is connected to the client for communication. After the client starts rendering, it sends a notification to the analyzer. The analyzer captures multiple target rendering snapshots during the rendering process of the client, and executes the technical solution of this embodiment in turn for each target rendering snapshot, thereby performing rendering overhead statistics for multiple target image frames.

[0071] For example, taking the gaming field as an example, an analyzer is deployed in the game server. The developer starts the analyzer and then opens the client. After connecting to the analyzer through the client, the game is started. Each time the game completes the rendering of a frame of the game screen, the game screen is determined as the target image frame, and the corresponding target rendering snapshot is captured, and subsequent analysis processing is performed through the analyzer.

[0072] It should be noted that the target rendering event is a rendering operation in the rendering process, such as a calculation operation or a drawing operation, each operation forms a rendering event, and each target rendering snapshot records multiple rendering events and system resources allocated to each rendering event.

[0073] In an implementation of the embodiment of the present invention, after obtaining the target rendering snapshot of the target image frame, the following steps are also included but not limited to:

[0074] Simulate the rendering process of the target image frame based on the target rendering snapshot, record the first candidate duration of each target rendering event, and determine the second candidate duration of the target image frame based on all the first candidate durations; repeatedly simulate the rendering process of the target image frame multiple times, determine the one with the smallest value among the multiple second candidate durations as the second target duration, and determine each first candidate duration of the simulation process corresponding to the second target duration as the first target duration of the corresponding target rendering event, wherein the first target duration is used to construct the first rendering overhead.

[0075] Specifically, the GPU can perform the same rendering operation as the target image frame based on the target rendering snapshot to simulate the rendering process of the target image frame. During the simulation process, the time consumption of each target rendering event is counted as the first candidate duration, and the time consumption of each target rendering event is summarized to obtain the total rendering time of the target image frame, which is the second candidate duration.

[0076] In actual applications, the GPU also carries out other tasks during the process of simulated rendering, so the computing resources of the GPU will fluctuate to a certain extent. In this case, the time consumed by the simulated rendering process may be different from the time consumed by the actual rendering process. Therefore, this embodiment uses multiple simulations to take the smallest of the second candidate durations obtained by the multiple simulations as the second target duration, thereby determining that the simulation process corresponding to the second target duration is the least affected by the GPU and is closest to the actual rendering process, and then determining the first candidate duration obtained by the simulation as the first target duration for each target rendering event.

[0077] Exemplarily, the target image frame is replayed by the analyzer based on the target rendering snapshot. The time consumption of rendering event A obtained in the first replay is 0.2 milliseconds, and the time consumption of rendering event B is 0.8 milliseconds, so the total time consumption of the first replay is 1 millisecond. The time consumption of rendering event A after the second replay is 0.1 milliseconds, and the time consumption of rendering event B is 0.5 milliseconds, so the total time consumption is 0.6 milliseconds. The 0.6 milliseconds of the second replay is used as the second target duration, and the time consumption of rendering event A is determined to be 0.1 milliseconds, and the time consumption of rendering event B is 0.5 milliseconds.

[0078] S22, determining a first rendering cost and a target shader for each target rendering event based on the target rendering snapshot.

[0079] Specifically, the target rendering event needs to apply multiple resources during the rendering process. The target shader is one of the rendering resources of the target rendering event. During the rendering process, different resources will generate different rendering overheads. The first rendering overhead is all overheads generated by the target rendering event during the rendering process. The overheads involved in different resources can be distinguished. Therefore, after determining the first rendering overhead, the second rendering overhead of the target shader can be counted based on the first rendering overhead, thereby realizing the statistics of shader overhead.

[0080] In actual applications, rendering resources may include tensors or shaders. During the execution of a target rendering event, the overhead of the tensor or shader will be recorded as the overhead of the target rendering event. However, the overhead involved in different resources is not the same. Therefore, to determine the rendering overhead of each shader in the rendering process, you can first determine the first rendering overhead of the target rendering event, identify the target shader from the rendering resources of the target rendering event, and then determine the second rendering overhead of the target shader based on the first rendering overhead.

[0081] Exemplarily, after determining the first rendering cost, the number of indexes, the number of instances, and time-consuming information are obtained from the first rendering cost, and then the number of rendering surfaces is calculated based on the above information, and the number of rendering surfaces is used as the rendering cost of the target shader.

[0082] In an implementation of the embodiment of the present invention, step S22 specifically includes but is not limited to the following steps:

[0083] An event tree is constructed based on a target rendering snapshot, wherein the event tree includes multiple snapshot rendering events; a first list is constructed based on the snapshot rendering events, wherein the first list is used to indicate a mapping relationship between a snapshot event identifier and a first resource identifier, the snapshot event identifier is used to indicate a snapshot rendering event, and the first resource identifier is used to indicate an event rendering resource of the snapshot rendering event; a target rendering event is determined from multiple snapshot rendering events, and a target shader corresponding to the target rendering event is determined based on the first list; and a first rendering overhead of the target rendering event is determined based on event playback.

[0084] Specifically, a snapshot rendering event is each rendering event in the target image frame rendering process determined based on the target rendering snapshot. The event tree is a tree structure constructed based on the snapshot rendering events. Each snapshot rendering event is a node of the event tree. The parent-child relationship of each snapshot rendering event is represented by the event tree.

[0085] In practical applications, the rendering trigger event of the target image frame can be determined as the root node event according to the target rendering snapshot, the child event of the root node event can be determined as the snapshot rendering event through event traversal, and an event tree can be constructed based on the parent-child relationship of each snapshot rendering event.

[0086] It should be noted that this embodiment determines all events as snapshot rendering events based on the target rendering snapshot, determines the system resources allocated to the snapshot rendering events as event rendering resources, and constructs a first list based on the mapping relationship between the snapshot rendering events and the event rendering resources, providing a data basis for subsequent identification of the target shader based on the event identifier.

[0087] For example, Figure 1As shown, the snapshot event identifier takes the event ID as an example, and the first resource identifier takes the resource ID as an example. The event ID of each snapshot rendering event is associated with at least one resource ID. The first item in the first list records event ID1, which is associated with resource ID1-1 and resource ID1-2. The second item in the first list records event ID2, which is associated with resource ID2-1 and resource ID2-2.

[0088] It should be noted that the target rendering event of this embodiment is a rendering event that involves the GPU performing calculations or drawing and other resource-consuming overheads during the rendering process of the target image frame. There are multiple snapshot rendering events involved in the rendering process, but not every snapshot rendering event belongs to the target rendering event of this embodiment. There are many graphic objects involved in the image rendering process. For the graphic objects that have been rendered in the previous frame, the rendering operation in the current frame does not involve calculations or drawing operations, and only needs to be used. Therefore, it does not cause rendering overhead. This embodiment skips such events and does not perform statistics on related overhead. This embodiment selects the target rendering event from the snapshot rendering event for event playback, thereby determining the first rendering overhead.

[0089] In actual applications, the first list records all rendering resources of the target rendering event, so the resource identifier of the target shader is recorded in the first list. This embodiment determines the target shader based on the first list, thereby counting the first rendering resources into the target shader.

[0090] In practical applications, the first rendering overhead can be determined through event playback. The first rendering overhead may include the number of indexes, the number of instances, the number of rendering surfaces, the rendering time, etc. This embodiment does not limit the specific overhead type.

[0091] For example, Figure 1 As shown, after determining that the event identifier of the target rendering event is event ID2, the playback controller is obtained, and event ID2 is input into the playback controller, so that the playback controller performs event playback based on event ID2, and determines the first rendering overhead during the playback process, including time consumption A, index number B, instance number C and face number D, wherein the face number D is calculated based on the index number B and the instance number C, and A, B, C and D are positive numbers.

[0092] In an implementation of the embodiment of the present invention, determining a target rendering event from multiple snapshot rendering events specifically includes but is not limited to the following steps:

[0093] Obtain a preset configuration file, wherein the configuration file records a plurality of candidate buffers, and the candidate buffers are used to buffer snapshot rendering events; select a target buffer from the plurality of candidate buffers, and determine a snapshot rendering event in the target buffer as a target rendering event based on an event tree; whenever a target shader and a first rendering overhead are determined based on a target rendering event, determine another target rendering event from the target buffer; when the snapshot rendering event of the target buffer is traversed, select a new target buffer from the remaining candidate buffers, and determine a new target rendering event based on the new target buffer.

[0094] Specifically, the configuration file is a preset file, in which multiple candidate buffers are recorded. During playback of the target image frame, each snapshot rendering event will be buffered to the corresponding candidate buffer, and relevant rendering information of each snapshot rendering event can be obtained in the candidate buffer.

[0095] In actual applications, the configuration file can record the buffer path of each candidate buffer. The buffer path is obtained by the DirectX driver, so it can be obtained by any tool during the playback of the target image frame. Each candidate buffer can buffer any number of snapshot rendering events, or may not include snapshot rendering events. The analyzer of this embodiment can be used to continuously analyze multiple frames of target image frames. The buffer path of each target image frame is not necessarily the same, and it does not necessarily occupy all candidate buffers. This embodiment obtains all optional buffer paths through relevant tools and records them in the configuration file, and then traverses the candidate buffer to the corresponding target rendering event through the snapshot rendering event.

[0096] It should be noted that this embodiment determines the second rendering cost of the corresponding target shader based on the first rendering cost of the target rendering event. After determining a target buffer, event retrieval is performed in the target buffer, and the snapshot rendering event at the highest level of the event tree is used as the first target rendering event. After completing the statistics of the first rendering cost of a target rendering event and determining the target shader, the next target rendering event is further obtained from the same target buffer based on the event tree until all event traversals are completed in the current target buffer, and then the same traversal operation is performed from the next target buffer, thereby realizing the traversal of all target rendering events in the entire event tree and completing the cost statistics of each target shader.

[0097] For example, Figure 1As shown, the cache paths recorded in the configuration file include "buffer 1", "buffer 2", etc. The event ID of the root node event is event ID1. When traversing buffer 1, the highest-level event is the snapshot rendering event corresponding to event ID2. After completing the statistics of the first rendering overhead and the target shader, the next event ID3 is obtained from the target buffer for the same processing; after completing the event traversal of buffer 1, the same operation is performed in buffer 2. If event ID1 is retrieved, relevant statistics are performed on the root node event, and then the next node of the event tree in buffer 2 is obtained for the same processing, and so on until the event traversal of each buffer recorded in the configuration file is completed.

[0098] In an implementation of the embodiment of the present invention, determining the target shader corresponding to the target rendering event based on the first list specifically includes but is not limited to the following steps:

[0099] Obtain a target event identifier of a target rendering event, and determine at least one candidate rendering resource from the first list based on the target event identifier; determine a target rendering module of the target rendering event based on event playback, and determine a target resource identifier corresponding to the module rendering resource of the target rendering module; when the first list does not record the target resource identifier, abandon counting the current target rendering event; when the first list records the target resource identifier, determine a target shader from the candidate rendering resources based on the target resource identifier.

[0100] It should be noted that the candidate rendering resources are not necessarily shaders, but can also be other rendering-related resources. The first list of this implementation only stores the first resource identifier, and it is not possible to determine whether the corresponding candidate rendering resource is a shader through the first resource identifier. This embodiment further determines the target rendering module of the target rendering event, and takes the intersection of the resources used by the target rendering module and the candidate rendering resources to determine the target shader.

[0101] In practical applications, the target rendering module is the rendering PASS involved in the rendering process, such as the common ComputeShader module and VertexShader module. The resources used by the target rendering module are the target shader. Therefore, after determining the target resource identifier of the target rendering module, the target shader is determined from the candidate rendering resources based on the target resource identifier.

[0102] For example, Figure 1As shown, taking event ID2 as an example of the target event identifier, the resource identifiers of the matched candidate rendering resources include resource ID2-1 and resource ID2-2. After event playback of the target rendering event, it is determined that the target rendering module is the ComputeShader module. The target resource identifier of the module rendering resource used by the ComputeShader module is I resource ID2-2, and the candidate rendering resource corresponding to resource ID2-2 can be determined as the corresponding target shader.

[0103] In an implementation of the embodiment of the present invention, determining a target rendering module of a target rendering event based on event playback and determining a target resource identifier corresponding to a module rendering resource of the target rendering module specifically includes but is not limited to the following steps:

[0104] Determine rendering pipeline information of a target rendering event based on event playback, and determine at least one candidate rendering module based on the rendering pipeline information; construct a second list based on the candidate rendering modules, wherein the second list is used to indicate a mapping relationship between the candidate rendering modules and a second resource identifier of a corresponding module rendering resource; determine a target operation type of the target rendering event based on a structured file, and determine a target rendering module based on the target operation type, wherein the structured file is constructed based on a target rendering snapshot, and the structured file is used to indicate a mapping relationship between a snapshot rendering event, an optional operation type, and a candidate rendering module; determine a target resource identifier based on the target rendering module and the second list.

[0105] It should be noted that the rendering pipeline information includes detailed information such as the pipeline state (Pip lineState) of the target rendering event. Based on the pipeline state, the relevant resource call information of the target rendering event in each rendering module can be obtained, thereby determining the rendering resources of each candidate rendering module, and building the second list based on this.

[0106] In actual applications, the second resource identifier and the first resource identifier can be the identifier of the same rendering resource, the difference is that they belong to different lists. For example, the resource ID of the target shader corresponds to the event ID in the first list, so it is determined as the first resource identifier in the first list, and corresponds to the candidate rendering module in the second list, so it is determined as the second resource identifier in the second list.

[0107] For example, Figure 1 As shown, in the second list, the candidate rendering modules corresponding to the target rendering event of event ID2 include the ComputeShader module and the VertexShader module. The second resource identifier of the module rendering resource corresponding to the ComputeShader module is "resource ID2-2", and the second resource identifier of the module rendering resource corresponding to the VertexShader module is "resource ID2-1".

[0108] Specifically, the structure file is constructed based on the target rendering snapshot, and records the mapping relationship between the event name, the rendering operation and the rendering module name.

[0109] Exemplarily, when the event name of the target rendering event includes "dispatch", the target operation type is determined to be a computing operation based on the structure file, and the corresponding target rendering module is the ComputeShader module; if the event name does not include "dispatch", the target operation type is a drawing operation, and the corresponding target rendering module is the VertexShader module.

[0110] It should be noted that after determining the target resource identifier, when the target shader cannot be matched from the first list based on the target resource identifier, it can be determined that the target rendering event does not belong to the "Act ion", that is, it does not belong to a rendering operation, and the target rendering event will not generate any overhead, that is, it will not affect the performance, which is not our goal. The event is skipped, and the next target rendering event is traversed from the buffer based on the steps of the above embodiment.

[0111] In an implementation of the embodiment of the present invention, determining a target shader from candidate rendering resources based on the target resource identifier specifically includes but is not limited to the following steps:

[0112] Obtain a preset configuration file, wherein the configuration file records a third list and execution configuration information, and the third list records multiple target names; determine the candidate rendering resource corresponding to the target resource identifier as a candidate shader; when the execution configuration information is used to indicate a first execution operation, when the shader name of the candidate shader is recorded in the third list, determine the candidate shader as a target shader, or, when the shader name of the candidate shader is not recorded in the third list, abandon counting the current target rendering event; or, when the execution configuration information is used to indicate a second execution operation, determine the candidate shader as a target shader, and when the shader name of the target shader is not recorded in the third list, add a new target name to the third list based on the shader name of the target shader.

[0113] Specifically, the configuration file not only records the buffer path, but also records the preset third list and execution configuration information. The third list records multiple target names, which are the names of any number of target shaders. The execution configuration information records multiple execution operations, and whether to apply the third list is determined by different execution operations. When the third list is applied, after determining the target shader, it is determined whether to count the second rendering overhead of the target shader based on the target name recorded in the third list; when the third list is not applied, the second rendering overhead of the target shader is directly counted.

[0114] It should be noted that after determining the target resource identifier, the candidate rendering resource corresponding to the target resource identifier is first determined as a candidate shader, and whether to count the candidate shader is determined based on the execution configuration information. If counted, the candidate shader is determined as the target shader, otherwise the candidate shader is skipped and the next node is traversed based on the buffer.

[0115] In actual applications, the third list is a keyword list, with the target name of the shader to be counted as the keyword. The third list can be maintained by the developer and adjusted according to actual needs, and the shader to be counted can be flexibly configured.

[0116] For example, taking the game field as an example, it is necessary to count the rendering overhead of rocks (Rock) and grass (Grass) in the game screen. "Rock" and "Grass" are recorded in the keyword list. When the name of the target shader is determined to be "Rock" or "Grass", the corresponding second rendering overhead is recorded and applied to subsequent analysis. If it is another name, no statistics are performed.

[0117] In actual applications, the execution configuration information may include multiple options, each option corresponds to an execution operation, and the developer selects the corresponding option in the configuration file to trigger whether to apply the third list.

[0118] For example, Figure 1 As shown, continuing to refer to the example of the above-mentioned game field, the first execution operation takes "specific keyword query" as an example, and the second execution operation takes "full distribution query" as an example. When "specific keyword query" is selected, the keyword list is applied, and when the name of the target shader is "Rock" or "Grass", statistics are performed, otherwise the target shader determined this time is skipped; when "full distribution query" is selected, the keyword list is not applied. When the name of the target shader is "flower", although it is not recorded in the keyword list, the rendering overhead is still counted, and "f lower" is added as a new keyword in the keyword list.

[0119] In an implementation of the embodiment of the present invention, before determining the rendering pipeline information of the target rendering event based on the event playback, the following steps are also included but not limited to:

[0120] The target event name of the target rendering event is obtained; when the target event name includes a preset target character, the event screen of the target rendering event is captured and saved.

[0121] Specifically, the target event name is the name string of the target rendering event, and the target characters are used to represent the matching keywords that need to be captured and saved. When the target event name includes the target characters, the event screen of the target rendering event is saved, which is convenient for developers to identify the location and situation of the snapshot capture.

[0122] Exemplarily, the target character is "Pl ayerEndOfFrame". When the event name of the target rendering event includes the above string, the current event screen is saved as a png image, and the developer can determine the interception status of the target rendering snapshot based on the image.

[0123] S23: Determine a second rendering cost of the target shader based on the first rendering cost.

[0124] Specifically, the target shader is one of the rendering resources of the target rendering event. The first rendering overhead can be obtained through the event playback of the above embodiment. The first rendering overhead includes all rendering overhead items of the target rendering event. The overhead information related to shader processing can be determined therefrom to determine the second rendering overhead of the target shader.

[0125] In actual applications, the second rendering overhead of the target shader includes time consumption, number of rendering surfaces, etc. The time consumption can use the first target duration obtained by the above embodiment, and the number of rendering surfaces can be calculated based on the index number and instance number of the target rendering event, thereby separating the rendering overhead related to the shader in the target rendering event into an independent second rendering overhead, and determining the second rendering overhead of each shader in the rendering process of the target image frame based on event playback and buffer traversal, thereby improving the efficiency of analyzing the rendering process.

[0126] In an implementation of the embodiment of the present invention, after executing step S23, the following steps are also included but not limited to:

[0127] A target file is constructed based on each target shader and the corresponding second rendering cost; and target display information is constructed based on the target file, wherein the target display information is used to indicate a change trend of each second rendering cost.

[0128] It should be noted that, through the technical solution of the above embodiment, the second rendering overhead of each target shader can be determined in turn by traversing the target buffer. This embodiment records the acquired second rendering overhead to the target file, and outputs the target file after completing the traversal of all events of the target image frame, so that the developer can import the target file to analyze the rendering situation of the target image frame.

[0129] In practical applications, the target display information can be generated by common analysis tools such as line graphs or trend graphs, where each object in the line graph corresponds to the second rendering cost of a target shader, thereby analyzing the second rendering cost through intuitive images.

[0130] For example, the target file can be a json file. After generating an xl sx table based on the json file, a line chart is generated as the target display information through common office software. The overhead trend, proportion and other related data of the target shader of the GPU as a whole and each buffer or component can be seen through the intuitive line chart. For example, the time consumption and the number of rendering surfaces of the target shader corresponding to "Rock" are greatly increased in the line chart, and the developer can judge that the rendering strategy of the object needs to be optimized to improve the debugging efficiency.

[0131] In addition, refer to Figure 3 The embodiment of the present invention further provides a rendering overhead statistics method, which is applied to an analyzer of a human-computer interaction device, and the analyzer is connected to a client for communication. The rendering overhead statistics method includes but is not limited to steps S31 to S32.

[0132] S31, after the analyzer is started, when a trigger signal sent by the client is obtained, a target file is output based on a target rendering snapshot of a target image frame obtained from the client, wherein the target rendering snapshot is used to indicate a rendering process of the target image frame, the rendering process of the target image frame includes a plurality of target rendering events, the target rendering snapshot is used to determine a first rendering cost and a target shader for each target rendering event, the target file is constructed based on each target shader and a corresponding second rendering cost, and the second rendering cost is determined based on the first rendering cost;

[0133] S32, in response to the user's selection operation on the target file, construct target display information based on the target file, wherein the target display information is used to indicate a change trend of each second rendering cost.

[0134] It should be noted that the analyzer is a component that can implement the rendering overhead statistics function of the above-mentioned embodiment. After the analyzer is running, it starts the Socket service, waits for the client to connect and send a notification. After the client starts and sends a notification to the analyzer, the analyzer uses the notification as a trigger signal, captures the current frame from the client as the target image frame, obtains the corresponding rendering information to generate a target rendering snapshot, generates a target file according to the technical solution of the above-mentioned embodiment, and constructs target display information based on the target file, such as the line graph or trend graph in the above-mentioned embodiment.

[0135] It should be noted that the technical solution of determining the second rendering cost of each target shader based on the target rendering snapshot in this embodiment can refer to the description of steps S21 to S23, which will not be repeated here.

[0136] The following further describes the rendering cost statistics method by taking the application of the rendering cost statistics method provided by the present invention in a game scene as an example. Figure 4 A flowchart of a rendering cost statistics method applied to a game scene provided by an embodiment of the present invention is shown, which specifically includes the following steps:

[0137] S41, the analyzer starts the Socket service, and obtains a game rendering snapshot of the current game screen frame from the client in response to the client notification.

[0138] Among them, the game screen frame is the target image frame of the above embodiment, and the game rendering snapshot is the above target rendering snapshot.

[0139] S42, loading the game rendering snapshot and obtaining the snapshot controller.

[0140] The snapshot controller is the playback controller used for event playback in the above embodiment.

[0141] S43, obtaining a snapshot resource object based on the game rendering snapshot, and constructing a resource comparison table.

[0142] Among them, the snapshot resource object is the candidate rendering resource of the above embodiment, and the resource comparison table is the above first list.

[0143] S44, obtaining each Act ion pointer, and determining the corresponding pointer resource ID based on the Act ion pointer.

[0144] Among them, Act ion is the target rendering event of the above embodiment, Act ion pointer is the above target event name, and pointer resource ID is the above first resource identifier.

[0145] S45, obtain the snapshot counter, replay the game screen frame, record the time consumption of each rendering event, and calculate the total time consumption. After multiple replays, use the event time consumption and rendering time consumption of the replay with the minimum total time consumption to build a time consumption comparison table.

[0146] Among them, the event duration is the above-mentioned first target duration, and the rendering time is the above-mentioned second target duration.

[0147] S46, loading a configuration file, and obtaining a default configuration if there is no configuration file, wherein the configuration file records a buffer list, a keyword list of a shader, and an execution type.

[0148] The buffer list includes multiple candidate buffers of the above embodiment, the keyword list is the above third list, and the execution type is the above execution configuration information.

[0149] S47, obtaining a root node event, constructing an event tree based on the root node event, selecting a target buffer and determining a buffer node based on the event tree, and determining an event corresponding to the buffer node as a target rendering event.

[0150] The buffer node is the snapshot rendering event in the target buffer.

[0151] S48, obtain the event name and event ID. If the event name includes PlayerEndOfFrame, save the current screen as a png file. Use the playback controller to obtain the rendering pipeline information according to the event ID. Determine the resource list of each candidate rendering module based on the rendering pipeline information. If the event name contains Dispatch, obtain the module resource ID corresponding to the ComputeShader module. Otherwise, obtain the module resource ID of the VertexShader module. Determine the target shader according to the module resource ID and the pointer resource ID. Record the event duration of this event. Calculate the number of faces according to the number of indexes and instances. If the target shader cannot be obtained, skip this event.

[0152] Among them, the event ID is the above-mentioned target event identifier, the resource list of the candidate rendering module is the above-mentioned second list, the ComputeShader module and the VertexShader module are the above-mentioned candidate resource modules, the module resource ID is the above-mentioned target resource identifier, and the event duration, number of indexes, number of instances and number of faces are the above-mentioned first rendering overhead.

[0153] S49, determine whether the shader is recorded based on the keyword list and the execution type, wherein, when the execution type is a specific keyword query, only the target shader whose shader name is in the keyword list is recorded, or, when the execution type is a full distribution query, the target shader is counted and the shader name of the target shader is added to the keyword list, the next buffer node is obtained in the target buffer, and steps S48 and S49 are repeated until every event in the target buffer is visited and all buffers are traversed.

[0154] Among them, specific keyword query is the above-mentioned first execution operation, and full distribution query is the above-mentioned second execution operation.

[0155] S410, output json file, feedback client message, report to the platform, generate xl sx table, and draw a line chart.

[0156] Among them, the json file is the above-mentioned target file, and the line chart is the above-mentioned target display information.

[0157] In the rendering cost statistics method applied to the game scene provided by the embodiment of the present invention, after the analyzer is started, after the client initiates the analysis notification, the target rendering snapshot of the target image frame is obtained from the client, and the rendering information and each target rendering event in the client rendering process can be determined through the target rendering snapshot; the first rendering cost and target shader of each target rendering event are determined based on the target rendering snapshot, and the target shader can be determined from the rendering resources of the target rendering event; the second rendering cost of the target shader is determined based on the first rendering cost, and the second rendering cost of the target shader can be counted using the rendering cost of the target rendering event. In this way, the rendering cost of each target shader can be determined using the snapshot mechanism, the analysis efficiency in the debugging process can be improved, and then the optimization efficiency of the rendering strategy can be improved.

[0158] Corresponding to the above method embodiment, the present invention also provides an embodiment of a rendering cost statistics device, Figure 5 FIG. 2 is a schematic diagram showing the structure of a rendering overhead statistics device according to an embodiment of the present invention. Figure 5 As shown, the rendering cost statistics device includes:

[0159] The snapshot capturing unit 501 is configured to obtain a target rendering snapshot of a target image frame, wherein the target rendering snapshot is used to indicate a rendering process of the target image frame, and the rendering process of the target image frame includes a plurality of target rendering events;

[0160] A snapshot application unit 502 is configured to determine a first rendering cost and a target shader for each target rendering event based on the target rendering snapshot;

[0161] The cost statistics unit 503 is configured to determine a second rendering cost of the target shader based on the first rendering cost.

[0162] In an implementation manner of the embodiment of the present invention, the rendering cost statistics device is further configured to:

[0163] a snapshot replay unit configured to simulate a rendering process of a target image frame based on a target rendering snapshot, record a first candidate duration of each target rendering event, and determine a second candidate duration of the target image frame based on all the first candidate durations;

[0164] The duration statistics unit is configured to repeatedly simulate the rendering process of the target image frame for multiple times, determine the one with the smallest value among multiple second candidate durations as the second target duration, and determine each first candidate duration of the simulation process corresponding to the second target duration as the first target duration of the corresponding target rendering event, wherein the first target duration is used to construct the first rendering overhead.

[0165] In an implementation of the embodiment of the present invention, the snapshot application unit 502 is further configured to:

[0166] An event tree construction unit is configured to construct an event tree based on a target rendering snapshot, wherein the event tree includes a plurality of snapshot rendering events;

[0167] A first list building unit is configured to build a first list based on the snapshot rendering event, wherein the first list is used to indicate a mapping relationship between a snapshot event identifier and a first resource identifier, the snapshot event identifier is used to indicate the snapshot rendering event, and the first resource identifier is used to indicate an event rendering resource of the snapshot rendering event;

[0168] A first determining unit is configured to determine a target rendering event from a plurality of snapshot rendering events, and determine a target shader corresponding to the target rendering event based on a first list;

[0169] The first playback unit is configured to determine a first rendering cost of a target rendering event based on event playback.

[0170] In an implementation manner of the embodiment of the present invention, the rendering cost statistics device is further configured to:

[0171] A first file acquisition unit is configured to acquire a preset configuration file, wherein the configuration file records a plurality of candidate buffers, and the candidate buffers are used to buffer the snapshot rendering event;

[0172] A first event determination unit is configured to select a target buffer from the plurality of candidate buffers and determine a snapshot rendering event in the target buffer as the target rendering event based on the event tree;

[0173] A first traversal unit is configured to determine another target rendering event from the target buffer whenever the target shader and the first rendering cost are determined based on one target rendering event;

[0174] The second traversal unit is configured to select a new target buffer from the remaining candidate buffers when the snapshot rendering event of the target buffer is traversed, and determine a new target rendering event based on the new target buffer.

[0175] In an implementation manner of the embodiment of the present invention, the rendering cost statistics device is further configured to:

[0176] A first identifier acquisition unit is configured to acquire a target event identifier of a target rendering event, and determine at least one candidate rendering resource from a first list based on the target event identifier;

[0177] A second identifier acquisition unit is configured to determine a target rendering module of a target rendering event based on event playback, and determine a target resource identifier corresponding to a module rendering resource of the target rendering module;

[0178] An event abandonment unit, configured to abandon counting of the current target rendering event when the first list does not record the target resource identifier;

[0179] The shader determination unit is configured to determine a target shader from candidate rendering resources based on the target resource identifier when the first list records the target resource identifier.

[0180] In an implementation manner of the embodiment of the present invention, the rendering cost statistics device is further configured to:

[0181] A first module determination unit is configured to determine rendering pipeline information of a target rendering event based on event playback, and determine at least one candidate rendering module based on the rendering pipeline information;

[0182] A second list building unit is configured to build a second list based on the candidate rendering modules, wherein the second list is used to indicate a mapping relationship between the candidate rendering modules and the second resource identifiers of the corresponding module rendering resources;

[0183] A second module determination unit is configured to determine a target operation type of a target rendering event based on a structure file, and determine a target rendering module based on the target operation type, wherein the structure file is constructed based on a target rendering snapshot, and the structure file is used to indicate a mapping relationship between a snapshot rendering event, an optional operation type, and a candidate rendering module;

[0184] The resource identifier determining unit is configured to determine a target resource identifier based on the target rendering module and the second list.

[0185] In an implementation manner of the embodiment of the present invention, the rendering cost statistics device is further configured to:

[0186] A second file acquisition unit is configured to acquire a preset configuration file, wherein the configuration file records a third list and execution configuration information, and the third list records a plurality of target names;

[0187] A candidate shader determination unit is configured to determine the candidate rendering resource corresponding to the target resource identifier as a candidate shader;

[0188] A first execution unit is configured to, when the execution configuration information is used to indicate a first execution operation, determine the candidate shader as a target shader when the shader name of the candidate shader is recorded in the third list, or, when the shader name of the candidate shader is not recorded in the third list, abandon counting the current target rendering event;

[0189] The second execution unit is configured to, when the execution configuration information is used to indicate a second execution operation, determine the candidate shader as a target shader, and when the shader name of the target shader is not recorded in the third list, add a new target name to the third list based on the shader name of the target shader.

[0190] In an implementation manner of the embodiment of the present invention, the rendering cost statistics device is further configured to:

[0191] An event name obtaining unit, configured to obtain a target event name of a target rendering event;

[0192] The image capture unit is configured to capture and save the event screen of the target rendering event when the target event name includes preset target characters.

[0193] In an implementation manner of the embodiment of the present invention, the rendering cost statistics device is further configured to:

[0194] A file construction unit, configured to construct a target file based on each target shader and a corresponding second rendering cost;

[0195] The display unit is configured to construct target display information based on the target file, wherein the target display information is used to indicate a change trend of each second rendering cost.

[0196] In the rendering cost statistics device provided by the embodiment of the present invention, a target rendering snapshot of a target image frame is obtained, and rendering information and each target rendering event in the rendering process can be determined through the target rendering snapshot; the first rendering cost and target shader of each target rendering event are determined based on the target rendering snapshot, and the target shader can be determined from the rendering resources of the target rendering event; the second rendering cost of the target shader is determined based on the first rendering cost, and the second rendering cost of the target shader can be counted using the rendering cost of the target rendering event. In this way, the rendering cost of each target shader can be determined using the snapshot mechanism, which improves the analysis efficiency in the debugging process, and further improves the optimization efficiency of the rendering strategy.

[0197] The above is a schematic scheme of a rendering cost statistics device of this embodiment. It should be noted that the technical scheme of the rendering cost statistics device and the technical scheme of the rendering cost statistics method described above belong to the same concept, and the details of the technical scheme of the rendering cost statistics device that are not described in detail can be found in the description of the technical scheme of the rendering cost statistics method described above.

[0198] like Figure 6 As shown, Figure 6The structure block diagram of an electronic device 600 provided according to an embodiment of the present invention is shown. The components of the electronic device 600 include but are not limited to a memory 610 and a processor 620. The processor 620 is connected to the memory 610 via a bus 630, and the database 650 is used to store data.

[0199] The electronic device 600 also includes an access device 640 that enables the electronic device 600 to communicate via one or more networks 660. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 640 may include one or more of any type of network interface (e.g., a network interface card (NIC)) that is wired or wireless, such as an IEEE 602.11 wireless local area network (WLAN) wireless interface, a World Wide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.

[0200] In one embodiment of the present invention, the above components of the electronic device 600 and Figure 6 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 6 The electronic device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of the present invention. Those skilled in the art can add or replace other components as needed.

[0201] The electronic device 600 may be any type of stationary or mobile electronic device, including a mobile computer or mobile electronic device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable electronic device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary electronic device such as a desktop computer or a PC. The electronic device 600 may also be a mobile or stationary server.

[0202] The processor 620 is used to execute computer executable instructions of the object processing method.

[0203] The above is a schematic scheme of an electronic device of this embodiment. It should be noted that the technical scheme of the electronic device and the technical scheme of the object processing method described above are of the same concept, and the details not described in detail in the technical scheme of the electronic device can be referred to the description of the technical scheme of the object processing method described above.

[0204] An embodiment of the present invention further provides a storage medium, which is a computer-readable storage medium and stores a computer program. When the computer program is executed by a processor, the above-mentioned rendering cost statistics method is implemented.

[0205] As a non-transient computer-readable storage medium, the memory can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage devices. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof. The device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and are implemented to be located in one place, or may also be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.

[0206] It will be appreciated by those skilled in the art that all or some of the steps and systems in the disclosed method above may be implemented as software, firmware, hardware and appropriate combinations thereof. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor or a microprocessor, or may be implemented as hardware, or may be implemented as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or a non-transitory medium) and a communication medium (or a temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that may be used to store desired information and may be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically include computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

[0207] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the above-mentioned implementation mode. Technical personnel familiar with the field can also make various equivalent deformations or substitutions under the shared conditions without violating the spirit of the present invention. These equivalent deformations or substitutions are all included in the scope defined by the claims of the present invention.

Claims

1. A rendering cost statistics method, characterized in that: include: Acquire a target rendering snapshot of a target image frame, wherein the target rendering snapshot is used to indicate a rendering process of the target image frame, and the rendering process of the target image frame includes a plurality of target rendering events; Determine a first rendering cost and a target shader for each of the target rendering events based on the target rendering snapshot; A second rendering cost of the target shader is determined based on the first rendering cost.

2. The method according to claim 1, characterized in that After obtaining the target rendering snapshot of the target image frame, the method further includes: Simulating a rendering process of the target image frame based on the target rendering snapshot, recording a first candidate duration of each target rendering event, and determining a second candidate duration of the target image frame based on all of the first candidate durations; Repeat the simulation of the rendering process of the target image frame multiple times, determine the one with the smallest value among the multiple second candidate durations as the second target duration, and determine each of the first candidate durations of the simulation process corresponding to the second target duration as the first target duration of the corresponding target rendering event, wherein the first target duration is used to construct the first rendering overhead.

3. The method according to claim 1, characterized in that The determining, based on the target rendering snapshot, a first rendering cost and a target shader of each target rendering event comprises: Building an event tree based on the target rendering snapshot, wherein the event tree includes a plurality of snapshot rendering events; Building a first list based on the snapshot rendering event, wherein the first list is used to indicate a mapping relationship between a snapshot event identifier and a first resource identifier, the snapshot event identifier is used to indicate the snapshot rendering event, and the first resource identifier is used to indicate an event rendering resource of the snapshot rendering event; Determine the target rendering event from the plurality of snapshot rendering events, and determine the target shader corresponding to the target rendering event based on the first list; The first rendering cost of the target rendering event is determined based on event playback.

4. The method according to claim 3, characterized in that: The determining the target rendering event from the plurality of snapshot rendering events comprises: Obtaining a preset configuration file, wherein the configuration file records a plurality of candidate buffers, and the candidate buffers are used to buffer the snapshot rendering event; Selecting a target buffer from the plurality of candidate buffers, and determining one of the snapshot rendering events in the target buffer as the target rendering event based on the event tree; Whenever the target shader and the first rendering cost are determined based on one target rendering event, another target rendering event is determined from the target buffer; When the snapshot rendering event of the target buffer is traversed completely, a new target buffer is selected from the remaining candidate buffers, and a new target rendering event is determined based on the new target buffer.

5. The method according to claim 3, characterized in that: The determining the target shader corresponding to the target rendering event based on the first list includes: Obtain a target event identifier of the target rendering event, and determine at least one candidate rendering resource from the first list based on the target event identifier; Determine a target rendering module of the target rendering event based on event playback, and determine a target resource identifier corresponding to a module rendering resource of the target rendering module; When the first list does not record the target resource identifier, giving up counting the current target rendering event; When the first list records the target resource identifier, the target shader is determined from the candidate rendering resources based on the target resource identifier.

6. The method according to claim 5, characterized in that The step of determining a target rendering module of the target rendering event based on event playback, and determining a target resource identifier corresponding to a module rendering resource of the target rendering module, includes: Determine rendering pipeline information of the target rendering event based on event playback, and determine at least one candidate rendering module based on the rendering pipeline information; Building a second list based on the candidate rendering modules, wherein the second list is used to indicate a mapping relationship between the candidate rendering modules and the corresponding second resource identifiers of the module rendering resources; Determine a target operation type of the target rendering event based on a structure file, and determine the target rendering module based on the target operation type, wherein the structure file is constructed based on the target rendering snapshot, and the structure file is used to indicate a mapping relationship between the snapshot rendering event, the optional operation type, and the candidate rendering module; The target resource identifier is determined based on the target rendering module and the second list.

7. The method according to claim 6, characterized in that The method further comprises: determining the target shader from the candidate rendering resources based on the target resource identifier; Obtaining a preset configuration file, wherein the configuration file records a third list and execution configuration information, and the third list records a plurality of target names; Determine the candidate rendering resource corresponding to the target resource identifier as a candidate shader; When the execution configuration information is used to indicate a first execution operation, when the shader name of the candidate shader is recorded in the third list, the candidate shader is determined as the target shader, or, when the shader name of the candidate shader is not recorded in the third list, the current target rendering event is abandoned; Alternatively, when the execution configuration information is used to indicate a second execution operation, the candidate shader is determined as the target shader, and when the shader name of the target shader is not recorded in the third list, a new target name is added to the third list based on the shader name of the target shader.

8. The method according to claim 6, characterized in that Before determining the rendering pipeline information of the target rendering event based on event playback, the method further includes: Get the target event name of the target rendering event; When the target event name includes preset target characters, an event screen of the target rendering event is captured and saved.

9. The method according to claim 1, characterized in that: After determining the second rendering cost of the target shader based on the first rendering cost, the method further includes: Building a target file based on each of the target shaders and the corresponding second rendering cost; Target display information is constructed based on the target file, wherein the target display information is used to indicate a change trend of each of the second rendering costs.

10. A rendering cost statistics method, characterized in that: An analyzer applied to a human-computer interaction device, the analyzer being in communication connection with a client, and the rendering overhead statistics method comprising: After the analyzer is started, when a trigger signal sent by the client is obtained, a target file is output based on a target rendering snapshot of a target image frame obtained from the client, wherein the target rendering snapshot is used to indicate a rendering process of the target image frame, the rendering process of the target image frame includes a plurality of target rendering events, the target rendering snapshot is used to determine a first rendering cost and a target shader of each of the target rendering events, the target file is constructed based on each of the target shaders and a corresponding second rendering cost, and the second rendering cost is determined based on the first rendering cost; In response to a user's selection operation on the target file, target display information is constructed based on the target file, wherein the target display information is used to indicate a change trend of each of the second rendering costs.

11. A rendering cost statistics device, characterized in that: include: A snapshot capturing unit is configured to obtain a target rendering snapshot of a target image frame, wherein the target rendering snapshot is used to indicate a rendering process of the target image frame, and the rendering process of the target image frame includes a plurality of target rendering events; A snapshot application unit, configured to determine a first rendering cost and a target shader of each of the target rendering events based on the target rendering snapshot; The cost statistics unit is configured to determine a second rendering cost of the target shader based on the first rendering cost.

12. An electronic device, characterized in that: It includes at least one control processor and a memory for communicating with the at least one control processor; the memory stores instructions that can be executed by the at least one control processor, and the instructions are executed by the at least one control processor to enable the at least one control processor to execute the rendering overhead statistics method as described in any one of claims 1 to 9, or execute the rendering overhead statistics method as described in claim 10.

13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the rendering cost statistics method according to any one of claims 1 to 9, or to execute the rendering cost statistics method according to claim 10.