Vulkan-Docs/appendices/VK_AMD_shader_info.txt
Jon Leech dd9919749a 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 06:23:03 -07:00

109 lines
2.6 KiB
Plaintext

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