Visible to Intel only — GUID: GUID-1C118F60-18C3-4D4A-BDA3-D5921EEC60C3
Visible to Intel only — GUID: GUID-1C118F60-18C3-4D4A-BDA3-D5921EEC60C3
Create a Custom Plugin for Graphics Frame Analyzer
Integrate your own plugin into the Graphics Frame Analyzer Plugin Interface.
The following workflow is used for creating a plugin for Graphics Frame Analyzer:
Write a __init__.py script containing desc() and run() methods.
Write additional scripts, if needed.
Copy the plugin folder to %USERPROFILE%\Documents\GPA\python_plugins.
Folder name must be PEP-8 compatible and is used for plugin invocation from the Type Filter Expression field in the Graphics Frame Analyzer.
desc() method
The method is used to obtain the following meta information about a plugin:
name(optional): plugin name shown in the Graphics Frame Analyzer Plugin Interface. If the name is not defined, a directory name can be used.
description(optional): plugin description.
apis(optional): supported APIs.
The following values are available:
DirectX
DirectX 11
DirectX 12
OpenGL
Vulkan
NOTE:If no value is defined, all the available values apply.plugin_api_version(required): plugin API version. The available values are 1.0 and 1.1.
applicabilities(optional): Graphics Frame Analyzer pane(s) where the plugin is used.
The following values are available:
Apilog
Resources
NOTE:If no value is defined, all the available values apply.
An example of the desc() method:
def desc():
return {
"name" : "My sample plugin",
"description" : "Sample plugin is written for educational purpose",
"apis" : ["DirectX"],
"plugin_api_version" : "1.1",
"applicabilities" : ["Apilog"]
}
run() method
The method returns items which are found by the defined criteria. The method uses the node_to_result() method or the resource_to_result() method of the utils.common module distributed with the Graphics Frame Analyzer.
An example of the run() method:
def run():
api_log = plugin_api.get_api_log_accessor()
calls = [x for x in api_log.get_full() if x.get_description()['name'] == 'ClearRenderTargetView']
return [common.node_to_result(x, 'info', 'This is a clear call!') for x in calls]
You can use the following types of marks:
informational
warning
erroneous
The run() method supports arguments that are passed from the Graphics Frame Analyzer. Each argument can be decorated with function decorators in compliance with PEP-3107. Argument descriptions are shown in the Graphics Frame Analyzer.
def run(name: "Draw call name" = 'ClearRenderTargetView'):
api_log = plugin_api.get_api_log_accessor()
calls = [x for x in api_log.get_full() if x.get_description()['name'] == name]
return [common.node_to_result(x, 'info') for x in calls]
plugin_api
To access different methods of a custom plugin API, import plugin_api into the plugin that you created, and then get accessors for the required data.
plugin_api is located at <Intel® GPA installation directory>/python_plugins/plugin_api.
The available accessors are the following:
get_api_log_accessor() - processes the API Log: gets calls, arguments, bindings, etc.
get_resources_accessor() - processes resources: gets resource descriptions, views, shaders, etc.
get_metrics_accessor() - processes metrics: gets metric values, metric descriptions, etc.
An example of an accessor:
import plugin_api
def run():
metrics_accessor = plugin_api.get_metrics_accessor()
descs = metrics_accessor.get_metrics_descriptions()
# some code