Vulkan-Docs/doc/specs/vulkan/appendices/VK_AMD_shader_info.txt

109 lines
2.6 KiB
Plaintext
Raw Normal View History

Change log for October 20, 2017 Vulkan 1.0.64 spec update: * Bump API patch number and header version number to 64 for this update. Github Issues: * Add chapter name to the PDF page footer (public pull request 458). * Fix several mistaken references to the nonexistent etext:VK_DEVICE_LOST status to etext:VK_ERROR_DEVICE_LOST (public pull request 502). * Fix description of the tlink:PFN_vkDebugReportCallbackEXT debug report callback function pointer to match the validation layer behavior (public issue 534). * Document experimental KHX extensions and alternate vendor author IDs also ending in X in more detail in the <<extensions, Layers & Extensions>> appendix, the extensions section of the style guide, and the registry schema description document (public issues 536, 580). * Fix references to ptext:pDepthStencil to properly refer to pname:pDepthStencilState or pname:pRasterizationState as appropriate in the slink:VkGraphicsPipelineCreateInfo description (public issue 542). * Fix wrong parameter name in slink:VkPipelineMultisampleStateCreateInfo valid usage (public pull request 571). Internal Issues: * Update the style guide to describe how to write LaTeX math expressions in table cells (internal issue 908). * Define how framebuffer-local dependencies work between subpasses with the same or different numbers of samples, in the slink:VkSubpassDescription and <<synchronization-framebuffer-regions, Framebuffer Region Dependencies>> sections. This clarifies which samples in an input attachment you are allowed to access after a framebuffer-local dependency (internal issue 915). * Specify which storage classes can have an initializer in the <<spirvenv-module-validation, Validation Rules within a Module>> section (internal issue 1023). * Use "LOD" consistently for "level-of-detail", to eliminate spelling inconsistencies. The term is already standardized in the Glossary (internal issue 1027). Other Issues: * Fix false positives in Makefile dependencies when rules fail, by deleting partially-made targets. New Extensions: * `VK_AMD_shader_info`
2017-10-21 00:18:37 +00:00
include::meta/VK_AMD_shader_info.txt[]
*Last Modified Date*::
2017-10-09
*IP Status*::
No known IP claims.
*Contributors*::
- Jaakko Konttinen, AMD
This extension adds a way to query certain information about a compiled
shader which is part of a pipeline.
This information may include shader disassembly, shader binary and various
statistics about a shader's resource usage.
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.
=== New Object Types
None.
=== New Enum Constants
None.
=== New Enums
* elink:VkShaderInfoTypeAMD
=== New Structures
* slink:VkShaderStatisticsInfoAMD
=== New Functions
* flink:vkGetShaderInfoAMD
=== Examples
This example extracts the register usage of a fragment shader within a
particular graphics pipeline:
[source,c++]
----------------------------------------
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:
[source,c++]
----------------------------------------
// 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);
}
----------------------------------------
=== Version History
* Revision 1, 2017-10-09 (Jaakko Konttinen)
- Initial revision