• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// This section is included inside the Pipelines chapter (pipelines.txt)
2
3[[pipelines-shader-information]]
4== Pipeline Shader Information
5
6[open,refpage='vkGetShaderInfoAMD',desc='Get information about a shader in a pipeline',type='protos']
7--
8
9Information about a particular shader that has been compiled as part of a
10pipeline object can be extracted by calling:
11
12include::../api/protos/vkGetShaderInfoAMD.txt[]
13
14  * pname:device is the device that created pname:pipeline.
15  * pname:pipeline is the target of the query.
16  * pname:shaderStage identifies the particular shader within the pipeline
17    about which information is being queried.
18  * pname:infoType describes what kind of information is being queried.
19  * pname:pInfoSize is a pointer to a value related to the amount of data
20    the query returns, as described below.
21  * pname:pInfo is either NULL or a pointer to a buffer.
22
23If pname:pInfo is `NULL`, then the maximum size of the information that can:
24be retrieved about the shader, in bytes, is returned in pname:pInfoSize.
25Otherwise, pname:pInfoSize must: point to a variable set by the user to the
26size of the buffer, in bytes, pointed to by pname:pInfo, and on return the
27variable is overwritten with the amount of data actually written to
28pname:pInfo.
29
30If pname:pInfoSize is less than the maximum size that can: be retrieved by
31the pipeline cache, then at most pname:pInfoSize bytes will be written to
32pname:pInfo, and fname:vkGetShaderInfoAMD will return ename:VK_INCOMPLETE.
33
34Not all information is available for every shader and implementations may
35not support all kinds of information for any shader.
36When a certain type of information is unavailable, the function returns
37ename:VK_ERROR_FEATURE_NOT_PRESENT.
38
39If information is successfully and fully queried, the function will return
40ename:VK_SUCCESS.
41
42For ename:VK_SHADER_INFO_TYPE_STATISTICS_AMD, an instance of
43sname:VkShaderStatisticsInfoAMD will be written to the buffer pointed to by
44pname:pInfo.
45This structure will be populated with statistics regarding the physical
46device resources used by that shader along with other miscellaneous
47information and is described in further detail below.
48
49For ename:VK_SHADER_INFO_TYPE_DISASSEMBLY_AMD, pname:pInfo points to a UTF-8
50null-terminated string containing human-readable disassembly.
51The exact formatting and contents of the disassembly string are
52vendor-specific.
53
54The formatting and contents of all other types of information, including
55ename:VK_SHADER_INFO_TYPE_BINARY_AMD, are left to the vendor and are not
56further specified by this extension.
57
58include::../validity/protos/vkGetShaderInfoAMD.txt[]
59--
60
61[open,refpage='VkShaderStatisticsInfoAMD',desc='Statistical information about a particular shader within a pipeline',type='structs']
62--
63
64The sname:VkShaderStatisticsInfoAMD structure is defined as:
65
66include::../api/structs/VkShaderStatisticsInfoAMD.txt[]
67
68  * pname:shaderStageMask are the combination of logical shader stages
69    contained within this shader.
70  * pname:resourceUsage is an instance of slink:VkShaderResourceUsageAMD
71    describing internal physical device resources used by this shader.
72  * pname:numPhysicalVgprs is the maximum number of vector instruction
73    general-purpose registers (VGPRs) available to the physical device.
74  * pname:numPhysicalSgprs is the maximum number of scalar instruction
75    general-purpose registers (SGPRs) available to the physical device.
76  * pname:numAvailableVgprs is the maximum limit of VGPRs made available to
77    the shader compiler.
78  * pname:numAvailableSgprs is the maximum limit of SGPRs made available to
79    the shader compiler.
80  * pname:computeWorkGroupSize is the local workgroup size of this shader in
81    { X, Y, Z } dimensions.
82
83Some implementations may merge multiple logical shader stages together in a
84single shader.
85In such cases, pname:shaderStageMask will contain a bitmask of all of the
86stages that are active within that shader.
87Consequently, if specifying those stages as input to
88flink:vkGetShaderInfoAMD, the same output information may: be returned for
89all such shader stage queries.
90
91The number of available VGPRs and SGPRs (pname:numAvailableVgprs and
92pname:numAvailableSgprs respectively) are the shader-addressable subset of
93physical registers that is given as a limit to the compiler for register
94assignment.
95These values may: further be limited by implementations due to performance
96optimizations where register pressure is a bottleneck.
97
98include::../validity/structs/VkShaderStatisticsInfoAMD.txt[]
99--
100
101[open,refpage='VkShaderResourceUsageAMD',desc='Resource usage information about a particular shader within a pipeline',type='structs']
102--
103
104The sname:VkShaderResourceUsageAMD structure is defined as:
105
106include::../api/structs/VkShaderResourceUsageAMD.txt[]
107
108  * pname:numUsedVgprs is the number of vector instruction general-purpose
109    registers used by this shader.
110  * pname:numUsedSgprs is the number of scalar instruction general-purpose
111    registers used by this shader.
112  * pname:ldsSizePerLocalWorkGroup is the maximum local data store size per
113    work group in bytes.
114  * pname:ldsUsageSizeInBytes is the LDS usage size in bytes per work group
115    by this shader.
116  * pname:scratchMemUsageInBytes is the scratch memory usage in bytes by
117    this shader.
118
119include::../validity/structs/VkShaderResourceUsageAMD.txt[]
120--
121