While this extension provides a mechanism for extracting this information, the details regarding the contents or format of this information are not specified by this extension and may be provided by the vendor externally.
Furthermore, all information types are optionally supported, and users should not assume every implementation supports querying every type of information.
This example extracts the register usage of a fragment shader within a particular graphics pipeline:
extern VkDevice device;
extern VkPipeline gfxPipeline;
PFN_vkGetShaderInfoAMD pfnGetShaderInfoAMD = (PFN_vkGetShaderInfoAMD)vkGetDeviceProcAddr(
device, "vkGetShaderInfoAMD");
VkShaderStatisticsInfoAMD statistics = {};
size_t dataSize = sizeof(statistics);
if (pfnGetShaderInfoAMD(device,
gfxPipeline,
VK_SHADER_STAGE_FRAGMENT_BIT,
VK_SHADER_INFO_TYPE_STATISTICS_AMD,
&dataSize,
&statistics) == VK_SUCCESS)
{
printf("VGPR usage: %d\n", statistics.resourceUsage.numUsedVgprs);
printf("SGPR usage: %d\n", statistics.resourceUsage.numUsedSgprs);
}
The following example continues the previous example by subsequently attempting to query and print shader disassembly about the fragment shader:
// Query disassembly size (if available)
if (pfnGetShaderInfoAMD(device,
gfxPipeline,
VK_SHADER_STAGE_FRAGMENT_BIT,
VK_SHADER_INFO_TYPE_DISASSEMBLY_AMD,
&dataSize,
nullptr) == VK_SUCCESS)
{
printf("Fragment shader disassembly:\n");
void* disassembly = malloc(dataSize);
// Query disassembly and print
if (pfnGetShaderInfoAMD(device,
gfxPipeline,
VK_SHADER_STAGE_FRAGMENT_BIT,
VK_SHADER_INFO_TYPE_DISASSEMBLY_AMD,
&dataSize,
disassembly) == VK_SUCCESS)
{
printf((char*)disassembly);
}
free(disassembly);
}
VK_AMD_shader_info| Modifier and Type | Field and Description |
|---|---|
| public static final String | VK_AMD_SHADER_INFO_EXTENSION_NAME
The extension name. |
| public static final int | VK_AMD_SHADER_INFO_SPEC_VERSION
The extension specification version. |
| public static final int | VK_SHADER_INFO_TYPE_BINARY_AMD
VkShaderInfoTypeAMD - Enum specifying which type of shader information to query Description
|
| public static final int | VK_SHADER_INFO_TYPE_DISASSEMBLY_AMD
VkShaderInfoTypeAMD - Enum specifying which type of shader information to query Description
|
| public static final int | VK_SHADER_INFO_TYPE_STATISTICS_AMD
VkShaderInfoTypeAMD - Enum specifying which type of shader information to query Description
|
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public static int | nvkGetShaderInfoAMD(VkDevice device, long pipeline, int shaderStage, int infoType, long
a pointer to a value related to the amount of data the query returns, as described below. pInfoSize, long pInfo)Unsafe version of: |
| public static int | vkGetShaderInfoAMD(VkDevice
the device that created device, long pipeline.the target of the query. pipeline, int a shaderStage, int VkShaderStageFlagBits specifying the particular shader within the pipeline about which information is being queried.describes what kind of information is being queried. infoType, PointerBuffer a pointer to a value related to the amount of data the query returns, as described below. pInfoSize, ByteBuffer either pInfo)NULL or a pointer to a buffer.Get information about a shader in a pipeline. |
| VK_AMD_SHADER_INFO_EXTENSION_NAME | back to summary |
|---|---|
| public static final String VK_AMD_SHADER_INFO_EXTENSION_NAME The extension name. | |
| VK_AMD_SHADER_INFO_SPEC_VERSION | back to summary |
|---|---|
| public static final int VK_AMD_SHADER_INFO_SPEC_VERSION The extension specification version. | |
| VK_SHADER_INFO_TYPE_BINARY_AMD | back to summary |
|---|---|
| public static final int VK_SHADER_INFO_TYPE_BINARY_AMD VkShaderInfoTypeAMD - Enum specifying which type of shader information to query Description
See Also | |
| VK_SHADER_INFO_TYPE_DISASSEMBLY_AMD | back to summary |
|---|---|
| public static final int VK_SHADER_INFO_TYPE_DISASSEMBLY_AMD VkShaderInfoTypeAMD - Enum specifying which type of shader information to query Description
See Also | |
| VK_SHADER_INFO_TYPE_STATISTICS_AMD | back to summary |
|---|---|
| public static final int VK_SHADER_INFO_TYPE_STATISTICS_AMD VkShaderInfoTypeAMD - Enum specifying which type of shader information to query Description
See Also | |
| AMDShaderInfo | back to summary |
|---|---|
| protected AMDShaderInfo() | |
| nvkGetShaderInfoAMD | back to summary |
|---|---|
| public static int nvkGetShaderInfoAMD(VkDevice device, long pipeline, int shaderStage, int infoType, long pInfoSize, long pInfo) Unsafe version of:
| |
| vkGetShaderInfoAMD | back to summary |
|---|---|
| public static int vkGetShaderInfoAMD(VkDevice device, long pipeline, int shaderStage, int infoType, PointerBuffer pInfoSize, ByteBuffer pInfo) Get information about a shader in a pipeline. C SpecificationInformation about a particular shader that has been compiled as part of a pipeline object can be extracted by calling:
DescriptionIf Not all information is available for every shader and implementations may not support all kinds of information for any shader. When a certain type of information is unavailable, the function returns If information is successfully and fully queried, the function will return For For The formatting and contents of all other types of information, including Valid Usage (Implicit)
Return Codes
| |