Safe Haskell | None |
---|---|
Language | Haskell2010 |
Name
VK_AMD_shader_info - device extension
VK_AMD_shader_info
- Name String
VK_AMD_shader_info
- Extension Type
- Device extension
- Registered Extension Number
- 43
- Revision
- 1
- Extension and Version Dependencies
- Requires Vulkan 1.0
- Special Use
- Contact
Other Extension Metadata
- Last Modified Date
- 2017-10-09
- IP Status
- No known IP claims.
- Contributors
- Jaakko Konttinen, AMD
Description
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 Commands
New Structures
New Enums
New Enum Constants
Examples
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); }
Version History
Revision 1, 2017-10-09 (Jaakko Konttinen)
- Initial revision
See Also
ShaderInfoTypeAMD
, ShaderResourceUsageAMD
,
ShaderStatisticsInfoAMD
, getShaderInfoAMD
Document Notes
For more information, see the Vulkan Specification
This page is a generated document. Fixes and changes should be made to the generator scripts, not directly.
Synopsis
- getShaderInfoAMD :: forall io. MonadIO io => Device -> Pipeline -> ShaderStageFlagBits -> ShaderInfoTypeAMD -> io (Result, "info" ::: ByteString)
- data ShaderResourceUsageAMD = ShaderResourceUsageAMD {}
- data ShaderStatisticsInfoAMD = ShaderStatisticsInfoAMD {}
- newtype ShaderInfoTypeAMD where
- type AMD_SHADER_INFO_SPEC_VERSION = 1
- pattern AMD_SHADER_INFO_SPEC_VERSION :: forall a. Integral a => a
- type AMD_SHADER_INFO_EXTENSION_NAME = "VK_AMD_shader_info"
- pattern AMD_SHADER_INFO_EXTENSION_NAME :: forall a. (Eq a, IsString a) => a
Documentation
:: forall io. MonadIO io | |
=> Device |
|
-> Pipeline |
|
-> ShaderStageFlagBits |
|
-> ShaderInfoTypeAMD |
|
-> io (Result, "info" ::: ByteString) |
vkGetShaderInfoAMD - Get information about a shader in a pipeline
Description
If pInfo
is NULL
, then the maximum size of the information that
can be retrieved about the shader, in bytes, is returned in
pInfoSize
. Otherwise, pInfoSize
must point to a variable set by
the user to the size of the buffer, in bytes, pointed to by pInfo
, and
on return the variable is overwritten with the amount of data actually
written to pInfo
.
If pInfoSize
is less than the maximum size that can be retrieved by
the pipeline cache, then at most pInfoSize
bytes will be written to
pInfo
, and getShaderInfoAMD
will return
INCOMPLETE
.
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
ERROR_FEATURE_NOT_PRESENT
.
If information is successfully and fully queried, the function will
return SUCCESS
.
For infoType
SHADER_INFO_TYPE_STATISTICS_AMD
, a
ShaderStatisticsInfoAMD
structure will be written to the buffer
pointed to by pInfo
. This structure will be populated with statistics
regarding the physical device resources used by that shader along with
other miscellaneous information and is described in further detail
below.
For infoType
SHADER_INFO_TYPE_DISASSEMBLY_AMD
, pInfo
is a pointer
to a UTF-8 null-terminated string containing human-readable disassembly.
The exact formatting and contents of the disassembly string are
vendor-specific.
The formatting and contents of all other types of information, including
infoType
SHADER_INFO_TYPE_BINARY_AMD
, are left to the vendor and are
not further specified by this extension.
Valid Usage (Implicit)
-
device
must be a validDevice
handle
-
pipeline
must be a validPipeline
handle -
shaderStage
must be a validShaderStageFlagBits
value -
infoType
must be a validShaderInfoTypeAMD
value -
pInfoSize
must be a valid pointer to asize_t
value - If the value referenced by
pInfoSize
is not0
, andpInfo
is notNULL
,pInfo
must be a valid pointer to an array ofpInfoSize
bytes -
pipeline
must have been created, allocated, or retrieved fromdevice
Return Codes
See Also
data ShaderResourceUsageAMD Source #
VkShaderResourceUsageAMD - Resource usage information about a particular shader within a pipeline
See Also
ShaderResourceUsageAMD | |
|
Instances
data ShaderStatisticsInfoAMD Source #
VkShaderStatisticsInfoAMD - Statistical information about a particular shader within a pipeline
Description
Some implementations may merge multiple logical shader stages together
in a single shader. In such cases, shaderStageMask
will contain a
bitmask of all of the stages that are active within that shader.
Consequently, if specifying those stages as input to getShaderInfoAMD
,
the same output information may be returned for all such shader stage
queries.
The number of available VGPRs and SGPRs (numAvailableVgprs
and
numAvailableSgprs
respectively) are the shader-addressable subset of
physical registers that is given as a limit to the compiler for register
assignment. These values may further be limited by implementations due
to performance optimizations where register pressure is a bottleneck.
See Also
ShaderStatisticsInfoAMD | |
|
Instances
newtype ShaderInfoTypeAMD Source #
pattern SHADER_INFO_TYPE_STATISTICS_AMD :: ShaderInfoTypeAMD |
|
pattern SHADER_INFO_TYPE_BINARY_AMD :: ShaderInfoTypeAMD |
|
pattern SHADER_INFO_TYPE_DISASSEMBLY_AMD :: ShaderInfoTypeAMD |
|
Instances
type AMD_SHADER_INFO_SPEC_VERSION = 1 Source #
pattern AMD_SHADER_INFO_SPEC_VERSION :: forall a. Integral a => a Source #
type AMD_SHADER_INFO_EXTENSION_NAME = "VK_AMD_shader_info" Source #
pattern AMD_SHADER_INFO_EXTENSION_NAME :: forall a. (Eq a, IsString a) => a Source #