Vulkan-Docs/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
Change log for August 13, 2018 Vulkan 1.1.83 spec update: * Update release number to 83. Public Issues: * Use [%inline] directive for all SVGs to reduce file size (public pull request 734). * Convert XML `value` aliases into \<alias> tags (public pull request 747). * Fix metadoc script showing non-selected extensions (public pull request 748). * Reapply public pull request 742 to make ename:VK_PIPELINE_STAGE_CONDITIONAL_RENDERING_BIT_EXT part of the graphices pipeline (public pull request 749). * Fix numerous typos related to accidental duplication of words (public pull request 760). * Fix `vk.xml` contact typos (public pull request 761). Internal Issues: * Add images to the <<Standard sample locations>> table (internal issue 1115). * Add a definition of "`Inherited from`" precision in the <<spirvenv-precision-operation, Precision and Operation of SPIR-V Instructions>> section (internal issue 1314). * Clarify that both built-in and user-defined variables count against the location limits for shader interfaces in the <<interfaces-iointerfaces-locations, Location Assignment>> section (internal issue 1316). * Merge "`required`" capabilities into the <<spirvenv-capabilities-table, list of optional: SPIR-V capabilities>> (internal issue 1320). * Relax the layout matching rules of descriptors referring to only a single aspect of a depth/stencil image, by reference to the new <<resources-image-layouts-matching-rule, Image Layout Matching Rules>> section (internal issue 1346). * Revert extension metadoc generator warning about name mismatches to a diagnostic, due to annoying warnings in build output for conscious choices we've made (internal issue 1351). Other Issues: * Reserve bits for pending vendor extensions. * Make Vulkan consistent with SPIR-V regarding code:DepthReplacing and code:FragDepth in the <<interfaces-builtin-variables, Built-In Variables>> section. * Add missing ChangeLog entries for the previous three spec updates.
2018-08-13 13:23:03 +00:00
* slink:VkShaderStatisticsInfoAMD
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
=== 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