C Specification
Binary shader code can be retrieved from a shader object using the command:
// Provided by VK_EXT_shader_object
VkResult vkGetShaderBinaryDataEXT(
VkDevice device,
VkShaderEXT shader,
size_t* pDataSize,
void* pData);
Parameters
-
device
is the logical device that shader object was created from. -
shader
is the shader object to retrieve binary shader code from. -
pDataSize
is a pointer to asize_t
value related to the size of the binary shader code, as described below. -
pData
is eitherNULL
or a pointer to a buffer.
Description
If pData
is NULL
, then the size of the binary shader code of the
shader object, in bytes, is returned in pDataSize
.
Otherwise, pDataSize
must point to a variable set by the application
to the size of the buffer, in bytes, pointed to by pData
, and on
return the variable is overwritten with the amount of data actually written
to pData
.
If pDataSize
is less than the size of the binary shader code, nothing
is written to pData
, and VK_INCOMPLETE
will be returned instead
of VK_SUCCESS
.
Note
|
The behavior of this command when This behavior is not consistent with the behavior described in Opaque Binary Data Results, for historical reasons. If the amount of data available is larger than the passed |
Binary shader code retrieved using vkGetShaderBinaryDataEXT
can be
passed to a subsequent call to vkCreateShadersEXT on a compatible
physical device by specifying VK_SHADER_CODE_TYPE_BINARY_EXT
in the
codeType
member of VkShaderCreateInfoEXT
.
The shader code returned by repeated calls to this function with the same
VkShaderEXT
is guaranteed to be invariant for the lifetime of the
VkShaderEXT
object.
Document Notes
For more information, see the Vulkan Specification
This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.