mirror of
https://github.com/status-im/Vulkan-Docs.git
synced 2025-02-25 12:35:11 +00:00
* Update release number to 124. Github Issues: * Fix Makefile SPECREMARK macro to work when not building in a git tree (public issue 992). * Ignore pname:aspectMask for unused attachments in slink:VkSubpassDescription2KHR valid usage statements (public pull request 1028). * Minor markup / spelling fixes (public pull requests 1035, 1045). Internal Issues: * Fix markup in Valid Usage statement for slink:VkCreateFramebuffer (internal issue 1823). * Add a new <<synchronization-signal-operation-order, _signal operation order_>> section to the synchronization chapter which describes in detail the ordering guarantees provided by the API between fence and semaphore signal operations (internal merge request 3368). * Move generated `appendix/meta/` files into the Makefile GENERATED directory (internal merge request 3381). New Extensions * `<<VK_KHR_shader_clock>>` * `<<VK_KHR_timeline_semaphore>>`
110 lines
2.7 KiB
Plaintext
110 lines
2.7 KiB
Plaintext
include::{generated}/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:VkShaderResourceUsageAMD
|
|
* 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
|