当前位置:网站首页>Frame profiling

Frame profiling

2022-06-22 05:59:00 Vigilance and encouragement

///

Overview of frame analysis

With the help of Android GPU Inspector (AGI), You can analyze your Android Application specific frames , And use it on the application GPU Conduct in-depth analysis of usage . And separately Systems analysis comparison , This analytic data gives you a deeper understanding of the... Of your application GPU usage .

Use AGI The first step in frame analysis is to collect tracking and other performance data , Then it is measured and displayed for analysis .

The available frame analysis data includes the following :

  • Vulkan API call

  • Frame buffer contents

  • Render mesh draw call

  • Ordered RAM and GPU Memory value

  • To render an event GPU The performance data

  • Pipeline data

  • Render state data

  • Texture and shader resources

Start using

AGI Quick start Describes how to set up AGI、 Capture frame profile data , Then open the generated trace file . The next section describes the configuration options in more detail .

Analysis options

This section describes the main options available when capturing frame profiles .

graphics API Options

graphics API Option indicates which graphics your application uses API. These options are in “ Capture system configuration files ” Dialog box “ type ” Available in the list . These are the options available :

  • Vulkan: Suitable for direct use Vulkan API Applications for .
  • OpenGL on ANGLE: Suitable for use OpenGL ES Applications for .

AGI Direct tracking Vulkan command . however , If your application uses OpenGL ES,AGI Will use custom... Before tracking the application ANGLE Build converts commands to Vulkan command .

Additional arguments

Additional Arguments Field is used to pass other flags to adb command am start-activity, This command will be sent to your device to start your application during analysis . For more information , see also  adb command .

Start and duration options

stay Start and duration part , You can specify AGI How to capture frames for analysis . You can use the following options :

  • Start :AGI Capture all commands from the start of the application to the end of the first rendered frame .

  • Manual : Press the button in the trace dialog box to capture the frame manually .

  • Time:AGI Automatically capture a frame after a given number of seconds .

  • frame :AGI Automatically capture the specified frame .

Tracking options

Tracking options Section contains settings for configuring trace flags . These are the available settings :

  • Disable buffering : Disable memory buffering on the device while capturing data . This option is useful for debugging application crashes , Because it ensures that all trace data is serialized until it crashes . however , It will slightly increase the analysis period AGI The cost of .

  • Hide unknown extensions : Hide on device AGI Unsupported extensions . If your app uses AGI Unsupported extensions , You may encounter errors when replaying the trace .

  • Clear package data : Use pm clear adb command Ask the device to clear the user data of your application before starting .

Output Settings

Output Section contains settings for tracking file storage , for example :

  • Specify the directory where trace files are stored .

  • Modify the file name of the automatically generated trace file .

View results

When you open a trace file that contains frame analysis data ,AGI Will be in Frame Profiler UI Display data in for analysis .

Frame Profiler It's a AGI Components , It manages the... Used to analyze a single frame UI And tools .Frame Profiler In the following UI Display data in element :

The results of the analysis

These topics describe how to use AGI Analysis frame analysis data :

///

Determine the most expensive render channel

AGI Frame Profiler Lets you examine the various render channels that make up a single frame of your application . It executes each graph by intercepting and recording API Call all the states required to do this . stay Vulkan On , This is the use of Vulkan The layered system is completed locally . stay OpenGL On , Use ANGLE Intercept command , It will OpenGL The command is converted to Vulkan call , So that they can execute on hardware .

Adrenaline device

To identify expensive render channels , First look at the... At the top of the window AGI Timeline view . This shows all render channels that make up a given frame in chronological order . If you have GPU Queue information , This is with you System Profiler The same view as seen in . It also provides basic information about render channels , For example, the resolution of the rendered framebuffer , This provides some insight into what happens to the render channel itself .

  The first criterion you can use to investigate render channels is how much time they take . The longest render channel is likely to be the one with the greatest potential for improvement , So start by looking at the channel .

  Related to the relevant render channel GPU The slice already shows some information about what happens in the render channel :

  1. Binning: According to their position on the screen, the vertices are placed in bin Position in
  2. Rendering : Where pixels or segments are shaded
  3. GMEM load / Storage : When the contents of the frame buffer are from the inside GPU When memory is loaded or stored in main memory

By looking at each time spent in the rendering process , You can get a good idea of where the potential bottlenecks might be . for example :

  • If sorting takes up most of the time , This indicates that there is a bottleneck in vertex data , This indicates that there are too many vertices 、 Vertex size or other problems related to vertices .
  • If rendering takes up most of the time , This shows that coloring is the bottleneck . The possible cause may be complex shaders 、 Too much texture extraction 、 Render to high resolution framebuffers or other related issues when not needed .

GMEM Loading and storage also need to be kept in mind . Moving content from graphics memory to main memory is expensive , So minimizing the number of load or store operations will also help improve performance . A common example is a GMEM Storage depth / Templates , It will change the depth / The template buffer is written to main memory ; If you do not use this buffer in a later rendering process , This storage operation can be eliminated , You will save frame time and memory bandwidth .

Large render channel survey

To see all the individual paint commands issued during rendering :

  1. Click render passes in the timeline . This will in Frame Profiler Of Commands Pane to open the render pass in the hierarchy .

  2. Click the render channel menu , This menu displays all the individual paint commands issued during the render channel . If this is a OpenGL Applications , You can dig further and view ANGLE Emitted Vulkan command .

  Select one of the drawing calls . This will open Framebuffer Panes , It shows all the framebuffer attachments bound during this drawing , And the final result drawn on the additional frame buffer . Here you can also use AGI Open the previous and next drawing call at the same time , And compare the difference between the two . If they are almost the same visually , This indicates an opportunity to eliminate rendering calls that do not contribute to the final image .

  Open this drawn The Conduit The pane shows the status of the drawing pipe used to perform this drawing call .

Input Assembler Provides information about how vertex data is bound to this drawing . If you notice that the sub bin takes up most of the rendering channel , So this is a good research field ; ad locum , You can get information about vertex formats 、 Information about the number of vertices drawn and how the vertices are laid out in memory . More about this , see also Analyze vertex format .

Vertex Shader The section provides information about the vertex shaders you use during this painting , And it can also be a good place to investigate whether the distribution box is identified as a problem . You can view the... Of the shaders used SPIR-V And decompiled GLSL, And investigate the binding of this call Unified buffer . For more information , see also Analyze shader performance .

Rasterizer The section shows you more information about the fixed function settings of the pipeline , And it can be more used for debugging purposes of fixed functional state , For example, viewports 、 scissors 、 Depth state and polygon mode .

Fragment Shader The section provides a number of links to Vertex shader Some of the same information , But specific to Fragment Shader . under these circumstances , You can actually look at the textures being bound and investigate them by clicking on the handle .

Smaller render channel surveys

You can use it to improve GPU Another criterion for performance is to look at smaller groups of render channels . Usually , You want to minimize the number of render channels , because GPU It takes time to update the state from one render channel to another . These smaller render channels are usually used to generate shadow maps 、 Apply Gaussian Blur 、 Estimated brightness 、 Post process effects or rendering UI. Some of these may be merged into one render channel , If their impact on the overall image is not sufficient to justify the cost , They can even be completely eliminated .

 ///

Analyze vertex format

You can diagnose some possible vertex related performance problems by using frame analysis . Use command Pane to view all paint calls executed by the game in a given frame and the count of entities painted by each paint call . This gives an approximation of the total number of vertices submitted in a single frame .

Vertex attribute compression

A common problem your game may face is the large average vertex size . A large number of submitted vertices with a higher average vertex size result in GPU The read bandwidth of vertex memory is large .

To observe the vertex format of a given drawing call , Please complete the following steps :

  1. Choose the lottery you are interested in .

    This can be a typical rendering call for a scene 、 Paint calls with a large number of vertices 、 Drawing calls for complex character models or some other type of drawing calls .

  2. Navigate to Pipeline Panes , And then click IA Enter the assembly . This defines the entry GPU Vertex format of the vertex of .

  3. Look at a set of attributes and their format ; for example , R32G32B32_SFLOAT It's a 3 component 32 Bit signed floating point number .

Usually , You can compress vertex attributes , The quality reduction of the drawn model is the least . especially , We suggest :

  • Compress the vertex position to half precision 16 Bit floating point
  • take UV Texture coordinates compressed to 16 Bit unsigned integer ushorts
  • By using quaternions to pair normals 、 The tangent and binormal vectors are encoded to compress the tangent space

For low precision types , Other miscellaneous attributes can also be considered according to specific circumstances .

Vertex flow splitting

You can also investigate whether the vertex attribute flow is split properly . In areas such as mobile GPU And so on , The vertex position is first used in the case dividing process , To create an element box that is processed in each tile . If vertex attributes are interleaved into a single buffer , Then all vertex data is read into the cache for bin sorting , This is true even if only vertex positions are used .

To reduce vertex read memory bandwidth and improve cache efficiency , So as to reduce in binning pass Time spent on , Vertex data should be split into two separate streams , One for vertex position , One for all other vertex attributes .

Investigate whether vertex attributes are properly segmented :

  1. Select the lottery number you are interested in , And write down the lottery telephone number .

    This can be a typical rendering call for a scene 、 Paint calls with a large number of vertices 、 Drawing calls for complex character models or some other type of drawing calls .

  2. Navigate to Pipeline Panes , And then click IA Enter the assembly . This defines the entry GPU Vertex format of the vertex of .

  3. Observe the binding of your vertex attributes ; Usually these may increase linearly (0、1、2、3 etc. ), But that's not always the case . Vertex position is usually the first vertex attribute listed .

  4. stay state In the pane , find LastDrawInfos And expand the matching drawing call number . then , an BoundVertexBuffers This drawing calls .

  5. Observe the vertex buffers bound during a given paint call , Its index matches the previous vertex attribute binding .

  6. Expand the binding of vertex attributes called by drawing , And expand the buffer .

  7. Observe VulkanHandle buffer , It represents the underlying memory of the vertex data source . If VulkanHandles Different , This means that attributes come from different underlying buffers . If VulkanHandles Same but with a large offset ( for example , Greater than 100), Then the attribute may still come from different sub buffers , But this requires further investigation .

More details about vertex flow splitting and how to solve it on various game engines , See our on this topic Blog posts .

//

Analyze shader performance

AGI Frame Profiler Allows you to call... By selecting a paint call from one of our render channels , And pass Pipeline  Paned Vertex Shader Part or Fragment Shader Section to study your shaders .

ad locum , You'll find useful statistics from static analysis of the shader code , as well as   our GLSL Compiled Standard portable intermediate representation (SPIR-V) Assembly . There is also a tab for viewing and using SPIR-V Cross Decompiled raw GLSL( With compiler generated variables 、 Function and so on ) It means , by SPIR-V Provide additional context .

Static analysis

Use static analysis counters to view low-level operations in shaders .

  • ALU Instructions : This count shows the ALU operation ( Add 、 Multiplication 、 Division, etc ) The number of , And it can well reflect the complexity of shaders . Try to minimize this value .

    Refactoring common calculations or simplifying calculations done in shaders can help reduce the number of instructions required .

  • Texture description : This count shows the number of times texture sampling occurred in the shader .

    • Texture sampling can be expensive , It depends on the type of texture you sample from , Therefore, the shader code is compared with “ Descriptor set ” The bound texture cross reference in the section provides more information about the type of texture being used .
    • Avoid random access when sampling textures , Because this behavior is not suitable for texture caching .
  • Branch instruction : This count shows the branch operands in the shader . Minimizing branches is GPU And other parallel processors , It can even help the compiler find additional optimizations :

    • Use 、 and Such as function min Come on max avoid clamp Need to branch values .
    • Calculation cost of test branch . Because both paths of a branch execute in many architectures , So in many cases , It is faster to always perform calculations than to use branches to skip calculations .
  • Temporary register : These are fast core registers , Used to hold GPU Calculate the results of the intermediate operations required . stay GPU You have to overflow until you use other out of core memory to store intermediate values , The number of registers available for computation is limited , This reduces overall performance .( This restriction is due to GPU Different models .)

    If the shader compiler performs operations such as unrolling a loop , The number of temporary registers used may be higher than expected , Therefore, it is better to compare this value with SPIR-V Or decompiled GLSL Cross reference to see what the code is doing .

Shader code analysis

It is possible to investigate the decompiled shader code itself to determine if there are any potential improvements .

  • precision : The accuracy of shader variables affects the performance of the application GPU performance .
    • mediump Try using precision modifiers on variables whenever possible , Because of medium accuracy ( ) 16 Bit variables are usually better than full precision ( ) 32 Bit variable mediump Faster and more energy efficient .highp
    • If you do not see any precision qualifiers in the shader declared by the variable or at the top of the shader  precision precision-qualifier​ type​, It defaults to full precision ( highp). Make sure you also look at variable declarations .
    • mediump For the same reasons as above , Using vertex shader output is also preferred , It also has the advantage of reducing memory bandwidth and the use of temporary registers that may need interpolation .
  • Uniform Buffers: Try to keep Uniform Buffers As small as possible ( While maintaining alignment rules ). This helps make computing and caching more compatible , It may also allow uniform data to be promoted to faster core registers .
  • Remove unused Vertex shader output of : If you find that vertex shader output is not used in the clip shader , Please remove them from the shader to free memory bandwidth and temporary registers .

  • Move calculation from clip shader to vertex shader : If the clip shader code performs calculations independent of the particular state of the shaded clip ( Or it can interpolate correctly ), It is ideal to move it to a vertex shader . The reason is that in most applications , Vertex shaders run much less frequently than clip shaders .

Performance pane

 

performance The pane shows... For different render events GPU performance .

This pane contains three components :

  • The toolbar : Contains for customizing performance tables   Or the function button to start the experiment .
  • Performance table performance Tab . Each line represents a render event , Each column represents a GPU indicators (GPU Time or GPU Counter ). In this way , A particular digital unit represents a particular GPU Metrics performance in specific rendering events .
  • GPU Counter details figure : Show in detail GPU How the metrics fluctuate during rendering events . The chart only refreshes GPU Counter indicators , But do not refresh GPU Time indicator , Because the time index is self-evident and does not fluctuate with time .

The toolbar

  • It is estimated that / Confidence range Button : Switch the display mode of performance figures . because GPU Counter samples are polled at their own pace , Therefore, its time range may not be exactly consistent with the time range of the rendered event . When they partially overlap , There may be several explanations for the contribution of counter samples to rendered events , Range from zero contribution to full contribution . Based on the edge case , We calculated Confidence Range; And based on the weight of overlapping time , We calculated Estimate.
  • experiment : Open a dialog box to select the experiment you want to run .AGI Let you choose to try some common optimization practices , Without recompiling your application . When you start the experiment ,AGI The frame will be replayed according to the new settings , And update accordingly GPU Performance table .
  • Filter counters : Open a dialog box , Used to select what you want to do in Performance table Indicator columns shown in .
  • Preset bar : from Add a new preset Button and the following custom preset buttons . The default is GPU Predefined combinations of metrics . When you click the preset button , Performance table The filter list of predefined indicators will be displayed . You can also “  Add a new preset ” Dialog box to manage presets .

Performance table

This table is similar to The configuration file Panes and command Pane Links . Rendered events are represented in trace in three formats : Rows in the Performance pane 、 The configuration file Slices and... In the pane command Nodes in the pane . For easy browsing , When you select one of the formats , The other two formats are also highlighted . for example , If you are right about Profile The longest slice in the pane is of interest , You can choose it , Then navigate to the highlighted Performance Line to view the details of this event GPU Counter performance .

GPU Counter details figure

  • x The axis shows the timestamp of the counter sample . Please note that , The time is based on the start time of the first rendering event , So sometimes you might see a negative timestamp in the counter detail graph of the first counter sample , This timestamp partially overlaps with the first render event .
  • y The axis displays the indicator performance value of the counter sample .
  • The bracketed number above each bar shows the weight of the counter sample , Or we consider the contribution of the sample to the rendering events in the estimated scene .

//

Command Pane

The command pane shows the calls made by the application , Group by frame and draw call or user tag .

chart 1: OpenGL or Vulkan Initial view of the trace

chart 2: see OpenGL track

chart 3: see Vulkan track

chart 4: stay Vulkan Search for commands in the trace

operating

You can do the following in this pane :

Operation describe
Show results Click a command or group to update the other panes to reflect the status after the selected command or group .
Expand or collapse the command hierarchy Click the gray triangle to the left of the group or double-click the group to expand or collapse it .
Search for Type a string in the search bar at the top of the pane , Then press  Return( See above ). To find the next match , Make sure that the column is selected and press... Again Return.

choice Regex Box to search for patterns using regular expressions . for example , Also match the command   and .  You can also search for command parameter values , for example buffer: , It is used for glClear.*glClear()glClearColor()2glBindBuffer().
edit Right click the command and select edit . stay “ edit ” In the dialog box , Change one or more values , And then click “ determine ” . Be careful : This is only for Vulkan The order is valid , Yes OpenGL Invalid command .
View status or memory information Click the command parameter that references the status parameter , For example, texture ID. state The pane displays additional information . Click the memory address or pointer to open “ Memory ” Panes . Be careful : This is only for Vulkan The order is valid , Yes OpenGL Invalid command .
Copy command Select an item in the pane and press Control+C( or Command+C) To copy the command and its parameter values . You can paste this information into a text file .
Zoom in on Thumbnails Thumbnails are displayed on the left side of the call , As shown in the figure below . Hover the cursor over the thumbnail to enlarge it .

OpenGL ES Command hierarchy

OpenGL ES The command is translated into Vulkan, Yes Vulkan Command analysis . therefore ,OpenGL ES Command and extension hierarchy OpenGL ES and Vulkan Commands are displayed together . In the previous example , You can glDrawElement stay RenderPass.  Extends the second  glDrawElements Command hierarchy , And shows OpenGL ES Commands  and DrawIndexed. You can expand these two hierarchies to show the related OpenGL ES command , And what they are translated into Vulkan command .

because OpenGL ES and Vulkan There is no one-to-one relationship between , So there may be some differences . for example ,glClear Appears before the first command glDraw* The command appears in RenderPass.  If you extend Hierarchical structure glClear, There will be no Vulkan command . This is because the purge will be delayed and started Vulkan A part of RenderPass.

Debug flags

According to your application ,“ command ” The pane can contain a long list of commands in one frame . For better navigation and readability , You can define debug tags , Combine calls under headings in the tree . This may include a grouping , for example , be known as “Setup” or “Render World” The grouping .

If debug flags are enabled , Please click on the command Pane to display a link to this information .OpenGL ES Have the following API To group commands :

Expand / edition PUSH Pop music
KHR_debugglPushDebugGroupKHR()glPopDebugGroupKHR()
EXT_debug_markerStringString
OpenGL ES 3.2StringString

Vulkan Have the following API To group commands :

Expand / edition PUSH Pop music
VK_EXT_debug_markerglPushDebugGroupKHR()glPopDebugGroupKHR()

Framebuffer pane

Framebuffer The pane displays the contents of the currently bound framebuffer . According to your “ command ” Items selected in the pane ,“ frame buffer ” The pane can display on-screen or off screen framebuffers .

When you are in “ command ” When a command is selected in the pane ,“ frame buffer ” The pane displays the contents of the framebuffer after the call is completed . If you select a command group , It displays the framebuffer that best represents the Group . Usually , This is the framebuffer after the last call in the group .

First select the first call in the frame , Then click on each successive call to see the framebuffer components draw one after the other , Until the end of the frame . These frame buffer displays for on-screen and off screen graphics can help you locate the source of any rendering errors .

Move the cursor over the image to display an enlarged preview of the surrounding pixels in the lower left corner of the view , As shown in the figure above . The pane also displays the width and height of the image and the height of the point on the image x and y coordinate 、 Standardize image coordinates (U and V value ) and RBGA Hexadecimal value .

Select different attachments

A frame buffer can contain multiple attachments . You can select the attachments to display , Then click... As needed Show attachments or Hide attachments . The attachment thumbnail icon has attachment types ( for example , Color 、 Depth and input ) And its index .

After selecting an attachment , The home view will be displayed in the upper left corner .

operating

You can use the following buttons to perform operations on the framebuffer image :

 

 

 /

Geometry pane

The geometry pane presents the pre converted grid for the selected drawing call . You can use the mouse or touchpad to rotate the model , And zoom in and out  

The following table describes the actions you can perform using the toolbar buttons :

//

Report pane

 

The report The pane displays any problems found during capture and playback . This includes the use of... By incorrect parameters 、 Problems caused by invalid command sequences or errors reported by drivers used for playback .

If you use GAPID To diagnose incorrect rendering , Please check “ The report ” Is there any problem with the pane .

Vulkan Precautions for

The report ” The pane currently displays Vulkan There is little news . Besides , Whereas Vulkan The explicit and low-level properties of , Replay on a different target than the tracking target Vulkan Tracing is unlikely to work on the most direct tracing .

///

Shader pane

 

Shaders The pane allows you to view the individual shaders used in the trace .

To use this pane , Please select a shader in the list . This will create a new tab , Displays the source of the shader and static analysis statistics .

To view a specific shader bound to a specific phase in the pipeline , See... In the route view This stage .

Select shader code

You can choose SPIR-V or ( If possible )GLSL. note :

  • If SPIR-V The code is in its OpSource The original... Is provided in the instruction GLSL Code , be GLSL The tab displays only the same code . without ,AGI Will try to use SPIRV-Cross take SPIR-V The compiled to GLSL.
  • If an error occurs in Decompilation , Is displayed GLSL Options for source code are not available .

Static analysis

AGI Provide information from SPIR-V Statistics for static analysis of shaders . Here are the supported Statistics :

Statistics describe
ALU Instructions Use ALU The number of instructions in the shader of .
Texture description The number of textures obtained in the shader .
Branch instruction Number of branch instructions in the shader .
Peak temporary registration pressure Maximum number of simultaneously active temporary registers . The life cycle of a temporary value begins with its definition , Until its last use in the shader . This statistic will p The number of registers used for each real-time value is added ( for example ,4D Floating point numbers will be 4 A register ).

///

Memory pane

 

Memory The pane shows the selected command in RAM or GPU Value in memory .

This pane shows the selected command reads and / Or the memory location written to . Each command usually has multiple read or write operations ; from Range Select one from the list . The view is updated to show the starting memory address of the operation . Green indicates read operation , Red indicates write operation . for example , The command in the figure above contains the 64 Byte read operation 0x000000728185be58. You can do this from the type Select a different data type in the list to change the way the data is displayed . 

Pool Field set to 0 To display the values corresponding to the application memory . If pool Set to any other number , The pane will display GPU The value of the allocated memory . Application memory usage RAM, and GPU Allocated memory may be used RAM or GPU Memory .

single click “ command ” The pointer value in the pane can jump directly to “ Memory ” A specific address in the pane .

You are not limited to viewing specific address ranges in this pane . Select a command , And then choose state Panes . choice DeviceMemories.( This part consists of Vulkan tracking Vulkan Handle organization .) Expand the handle and select  Data. Click a specific address to display it in the view .

 /

Check Vulkan Render states

 

To check the rendering status after a specific command is submitted , Please click on the Command Pane The command . state The pane allows you to check the rendering status using the following items .

Finally, bind the queue ( The current binding queue )

LastBoundQueue The node contains a queue for submitting related commands   Information vkQueueSubmit. take VulkanHandle Used in Find the drawing information of the current rendering state in  LastDrawInfos.

  1. Show VulkanHandlelast used Value VkQueue, It is actually the current binding queue for the related submit command .

  2. Information about the current rendering state is stored in in LastDrawInfos, And by the VkQueue Value index .

Last drawing information ( Current render state information )

LastDrawInfos The node contains each Information about the last drawing of  ,VkQueue And include the following information :

  • Frame buffer information
  • Render pass information
  • Binding descriptor set
  • Bind vertex and index buffers
  • Graphics pipeline
  • Drawing parameters

Bind frame buffer

 

  • Framebuffer node : Displays the currently bound framebuffer Information about .vkCmdBeginRenderPass After each execution on the same queue , This node will be updated .

  • Render channel node : Displays the render channel information used to create the framebuffer . Please note that , This is not the render channel currently bound for painting .

  • ImageAttachments node : List all VkImageViews Image attachment bound to frame buffer ( ). Each item in the list displays information about the image view .

  • Images The node displays the image information bound to the image view .

Bind render channel

  • Render channel node : Displays the current render channel information for rendering .VkCmdBeginRenderPass After each execution on the same queue , It's updated .

  • AttachmentDescriptions node : List all VkAttachmentDescription The render channel currently in use .

  • SubpassDescriptions node : List VkSubpassDescription Of each subchannel .

  • SubpassDependencies node : List VkSubpassDependency Of each subchannel .

Binding descriptor set

  • DescriptorSets node : Lists all currently bound descriptor sets . The list of bounded descriptor sets reflects the last vkCmdBindDescriptorSets Status after rolling out of the same queue , The original descriptor set information will be overwritten or new information will be added according to the last executed parameter vkCmdBindDescriptorSets.

  • Bindings: Node lists all currently bound descriptor bindings in the descriptor set .

    Each descriptor binding also lists the descriptors it binds to .

  • Layout node : Show VkDescriptorSetLayout Information for allocating descriptor sets .

Binding graphics pipes

GraphicsPipeline node : Contains information about the last bound drawing pipe .VkCmdBindPipeline After each execution on the current queue , This node will be updated .

Bind buffer

  • BoundVertexBuffers Node lists all bound vertex buffers . For each bound vertex buffer , It displays information about the fallback buffer .vkCmdBindVertexBuffers After each execution on the same queue , The list will be updated accordingly .

  • BoundIndexBuffernode Display the last bound index buffer , Include information about index types and fallback buffers .

Draw command parameters

CommandParameters node : contain vkCmdDrawvkCmdDrawIndexed and vkCmdDrawIndirect Parameters of vkCmdDrawIndirectIndexed. For each type of drawing command , There is a corresponding child node to contain the parameter value . Because these four drawing commands cannot be used at the same time , Therefore, only one of the four child nodes can be populated at a time . After executing any of the four drawing commands on the same queue , CommandParameters Will be updated .

///

Texture pane

 

Textures The pane shows all created textures resources , Include selected commands .

  Select a texture resource from the list to display in the Texture view Check them out . choice Show deleted textures Check the box to display the UI Display texture in , Even if they have been deleted .

//

Texture pane

 

texture The pane shows that it has been in Texture view Texture content selected in .

If the texture has mip-map chain , You can change the displayed... Using the slider at the bottom mip-map Level ( Not shown ). By default , The highest resolution level... Will be displayed 0.

Move the cursor over the texture image to display an enlarged preview of the surrounding pixels in the lower left corner of the view , As shown in the figure above . The pane also displays the width and height of the texture and the height of the point on the image x and y coordinate 、 Normalized texture coordinates (U and V value ) and RBGA Hexadecimal value .

operating

You can use the following buttons to manipulate the image : |  Button |  explain |  Sample results | |:-------------:|:-------------:| :-----:| | |  Adjust the image to fit the pane perfectly . You can also right-click the image to adjust the zoom to fit the image .|

 

 | | 

|  Display the image without scale , One device pixel is equivalent to one screen pixel .|

| | 

|  Zoom in on the image . You can also zoom in and out using the mouse wheel or the two finger slide on the touch pad . You can drag an image with the cursor .| 

 

| |  

|  Zoom out the image . You can also zoom in and out using the mouse wheel or the two finger slide on the touch pad .| 

 

| |

| Display the color histogram of the image . You can select the control handle on either side to limit the color value displayed .| 

 

| | | Select the color channel to render . The options are red 、 green 、 Blue and Alpha( transparency ). 

 

| | | Choose a checkerboard pattern or solid color for the image background .| 

| | | Flip image vertically .| 

 

 /

Pipe pane

 

Pipeline The pane displays the contents of the currently bound pipeline . In the command Pane to select a valid draw or schedule call . If you select a set of commands that contain draw or schedule calls , It displays the last bound pipe .

The phase currently bound to the pipeline is at the top of the pane . They are presented in the order in which they are used in their respective pipelines . However , Not every stage can be used . If a phase is not used , Then this stage is not optional , And any arrows from the previous stage are drawn on it to indicate that it is being skipped . When the user selects a phase , The rest of the pane shows only the data related to that stage . The following are the currently supported phases :

Stage full name Pipe type ( Call type )
IA Input components graphics ( draw )
VS Vertex shader graphics ( draw )
TCS Tessellation control shader graphics ( draw )
TES Subdivision evaluation shader graphics ( draw )
GS Geometry shaders graphics ( draw )
RAST Rasterizer graphics ( draw )
FS Fragment Shader graphics ( draw )
blend Color blending graphics ( draw )
CS Compute Shader Calculation ( Dispatch )

Data organization

The data of each phase is represented by shader code 、 Form organization of tables and key value pairs .

Shader code

This box contains the shader for the currently selected phase , But it's just a shader phase . The tabs at the top of the box allow you to view SPIR-V and GLSL Shaders in . Please note that ,GLSL from SPIR-V Decompiled , Instead of the actual original source .

surface

Tables usually contain data that you have defined statically or dynamically . If the data is set dynamically , A message will be displayed next to the table name . Some watches , for example Stencil State, Represents state rather than user-defined data , Such as buffer or descriptor , And grayed out when inactive . These tables may contain links to open other panes . for example , single click   Descriptor set Tabular View Any handle under the title will open the... Of the texture represented by the descriptor Texture tab .

 

Key value pair

Key value pairs usually represent status data . In the shader phase Static analysis Except for statistics . A pair with dynamic settings has an asterisk next to its key . Any inactive pairs are grayed out . The user can hover over any deactivated pair to check that other pairs have deactivated it .

//

AGI Troubleshooting

 

This topic describes how to solve the problem of using Android GPU Inspector (AGI) The most common question is .

Reset AGI Set up

AGI Store its settings in ~/.agic In file . Deleting this file will delete all AGI Set up , Include the recently opened tracking list and device verification results .

AGI Failed on some devices

Please make sure your settings meet all   requirement .

The following can also help :

  • Stop any possible passage ADB A program that interacts with a device , for example Android Studio.

  • Enable this Stay awake Options ( stay Android Under the developer option on ) To prevent problems when the device screen is turned off due to sleep mode .

The system analyzer does not report OpenGL ES Game GPU Activities

at present , When you track OpenGL ES Application time , Support only GPU Counter .OpenGL ES Application's GPU Campaign information is being actively developed .

Frame analyzer in some Vulkan Failure in the game

The first thing to verify is whether your game is used correctly Vulkan. Use  Vulkan Verification layer   And make sure your game doesn't cause errors or warnings .

If there is any Vulkan Validation error , be AGI The frame analyzer is not expected to work .

The game failed while creating a frame analyzer trace

If the game is not AGI Successfully run , But it failed to run when creating the frame profile trace , The game may have forked different processes during its startup sequence . under these circumstances , You need to track options in the “ Process name ” Field to specify the name of the process to be tracked .

To identify this problem , You can check... When you create a trace logcat Output and verify that different processes are starting :

<span style="color:var(--devsite-code-color)"><code><span style="color:var(--devsite-code-comments-color)"># Clear the logcat output</span>
adb logcat -c

<span style="color:var(--devsite-code-comments-color)">## Use AGI to attempt to create a frame profile trace</span>

<span style="color:var(--devsite-code-types-color)">Look</span> at the logcat output to identify the processes that are running AGI. 

adb logcat | grep <span style="color:var(--devsite-code-strings-color)">"this process name"</span>
I GAPID   : gapii [gapii/cc/spy.cpp:<span style="color:var(--devsite-code-numbers-color)">109</span>] this process name: com.example.mygame
I GAPID   : gapii [gapii/cc/spy.cpp:<span style="color:var(--devsite-code-numbers-color)">109</span>] this process name: com.example.mygame:<span style="color:var(--devsite-code-types-color)">GameProcess</span>
</code></span>

Most games have only one process , The above example shows the expectations for a game with multiple processes .

The game starts with a game called The main process of starts com.example.mygame, Then derive a named The new process of com.example.mygame:GameProcess. If the actual game rendering takes place in the second process , Then you must tell AGI This is the process you want to track . You can Process name Enter the name of the process in the field of the trace Options dialog box to perform this operation .

Use AGI The post game failed

If the trace does not terminate correctly ,AGI May cause some Android The setting is in a state that may interrupt the subsequent operation of the application . These settings are :

  • Vulkan Layer related settings :

    • enable_gpu_debug_layers

    • gpu_debug_app

    • gpu_debug_layers

    • gpu_debug_layer_app

  • Angle related settings :

    • angle_debug_package

    • angle_gl_driver_selection_values

    • angle_gl_driver_selection_pkgs

If your application is using AGI Any questions after , You can try the following adb Command to clear these settings :

<span style="color:var(--devsite-code-color)"><code><span style="color:var(--devsite-code-comments-color)"># Vulkan layers</span>
adb shell settings delete global enable_gpu_debug_layers
adb shell settings delete global gpu_debug_app
adb shell settings delete global gpu_debug_layers
adb shell settings delete global gpu_debug_layer_app
<span style="color:var(--devsite-code-comments-color)"># ANGLE</span>
adb shell settings delete global angle_debug_package
adb shell settings delete global angle_gl_driver_selection_values
adb shell settings delete global angle_gl_driver_selection_pkgs
</code></span>

adopt AGI When starting the game and creating a frame configuration trace , Your game will look different

To create a frame configuration trace ,AGI Will block the graphics of the game API call , This may affect game rendering .

AGI Capture Vulkan call . about OpenGL ES game ,AGI rely on  ANGLE take OpenGL ES Convert to Vulkan. If your game is passing AGI It looks different at startup ( for example , Some colors are not what you expect ), It may be AGI or ANGLE Mistakes in . You can help us better understand the root cause of the problem by trying the following methods .

Vulkan game : Support all Vulkan Extended trace

Hide unknown extensions Trace options control AGI Whether it should filter out what it does not support Vulkan Expand .

You can try disabling this option and starting the frame analyzer trace again . If you disable this option, the game looks good , The game may depend on AGI Don't support Vulkan Expand .

OpenGL ES game : Use only ANGLE function

You can use ANGLE But don't use AGI function OpenGL ES game , To see if the error rendering came from ANGLE Problems in .

If you have tried to create OpenGL ES Game frame profile tracking , that AGI Has been installed on your device ANGLE.AGI The use of ANGLE Package name is org.chromium.angle.agi.

To force your game on ANGLE Up operation , Please use the following command :

<span style="color:var(--devsite-code-color)"><code><span style="color:var(--devsite-code-comments-color)"># Make sure that the AGI capture layer will be ignored</span>
adb shell settings delete global enable_gpu_debug_layers
<span style="color:var(--devsite-code-comments-color)"># Force the package com.example.mygame to use ANGLE</span>
adb shell settings put global angle_debug_package org.chromium.angle.agi
adb shell settings put global angle_gl_driver_selection_values angle
adb shell settings put global angle_gl_driver_selection_pkgs com.example.mygame
</code></span>

If the game looks different under these settings , Then it could be ANGLE Mistakes in , instead of AGI. If the game looks right under these settings , But creating AGI Tracking looks different , Then it could be AGI Mistakes in .

You can create  GitHub problem To report AGI error .

//

原网站

版权声明
本文为[Vigilance and encouragement]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/173/202206220534368006.html