{-# language CPP #-}
-- | = Name
--
-- VK_EXT_shader_module_identifier - device extension
--
-- == VK_EXT_shader_module_identifier
--
-- [__Name String__]
--     @VK_EXT_shader_module_identifier@
--
-- [__Extension Type__]
--     Device extension
--
-- [__Registered Extension Number__]
--     463
--
-- [__Revision__]
--     1
--
-- [__Ratification Status__]
--     Not ratified
--
-- [__Extension and Version Dependencies__]
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_get_physical_device_properties2 VK_KHR_get_physical_device_properties2>
--     and
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_pipeline_creation_cache_control VK_EXT_pipeline_creation_cache_control>
--
-- [__Contact__]
--
--     -   Hans-Kristian Arntzen
--         <https://github.com/KhronosGroup/Vulkan-Docs/issues/new?body=[VK_EXT_shader_module_identifier] @HansKristian-Work%0A*Here describe the issue or question you have about the VK_EXT_shader_module_identifier extension* >
--
-- [__Extension Proposal__]
--     <https://github.com/KhronosGroup/Vulkan-Docs/tree/main/proposals/VK_EXT_shader_module_identifier.adoc VK_EXT_shader_module_identifier>
--
-- == Other Extension Metadata
--
-- [__Last Modified Date__]
--     2022-05-16
--
-- [__IP Status__]
--     No known IP claims.
--
-- [__Contributors__]
--
--     -   Hans-Kristian Arntzen, Valve
--
--     -   Ricardo Garcia, Igalia
--
--     -   Piers Daniell, NVIDIA
--
--     -   Jan-Harald Fredriksen, Arm
--
--     -   Tom Olson, Arm
--
--     -   Faith Ekstrand, Collabora
--
-- == Description
--
-- Some applications generate SPIR-V code at runtime. When pipeline caches
-- are primed, either explicitly through e.g.
-- 'Vulkan.Core10.Handles.PipelineCache' mechanisms, or implicitly through
-- driver managed caches, having to re-generate SPIR-V modules is
-- redundant. SPIR-V modules could be cached on disk by an application, but
-- the extra disk size requirement might be prohibitive in some use cases.
--
-- This extension adds the ability for an application to query a small
-- identifier associated with a 'Vulkan.Core10.Handles.ShaderModule'. On
-- subsequent runs of the application, the same identifier /can/ be
-- provided in lieu of a 'Vulkan.Core10.Handles.ShaderModule' object. A
-- pipeline creation call with such a module /may/ succeed if a pipeline
-- could be created without invoking compilation, and information inside
-- the SPIR-V module is not required by the implementation.
--
-- 'Vulkan.Core10.Enums.PipelineCreateFlagBits.PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT'
-- /must/ be used if only the identifier is provided, and this use case is
-- intended to work like a non-blocking, speculative compile. Applications
-- /can/ fallback as necessary.
--
-- The main motivation for identifying the module itself and not the entire
-- pipeline is that pipeline identifiers change when a driver is updated,
-- but module identifiers are expected to be stable for any particular
-- driver implementation. This approach is helpful for shader
-- pre-compilation systems which can prime pipeline caches ahead of time.
-- When on-disk pipeline caches are updated, the same shader identifiers
-- could lead to a pipeline cache hit.
--
-- == New Commands
--
-- -   'getShaderModuleCreateInfoIdentifierEXT'
--
-- -   'getShaderModuleIdentifierEXT'
--
-- == New Structures
--
-- -   'ShaderModuleIdentifierEXT'
--
-- -   Extending
--     'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceFeatures2',
--     'Vulkan.Core10.Device.DeviceCreateInfo':
--
--     -   'PhysicalDeviceShaderModuleIdentifierFeaturesEXT'
--
-- -   Extending
--     'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceProperties2':
--
--     -   'PhysicalDeviceShaderModuleIdentifierPropertiesEXT'
--
-- -   Extending 'Vulkan.Core10.Pipeline.PipelineShaderStageCreateInfo':
--
--     -   'PipelineShaderStageModuleIdentifierCreateInfoEXT'
--
-- == New Enum Constants
--
-- -   'EXT_SHADER_MODULE_IDENTIFIER_EXTENSION_NAME'
--
-- -   'EXT_SHADER_MODULE_IDENTIFIER_SPEC_VERSION'
--
-- -   'Vulkan.Core10.APIConstants.MAX_SHADER_MODULE_IDENTIFIER_SIZE_EXT'
--
-- -   Extending 'Vulkan.Core10.Enums.StructureType.StructureType':
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_FEATURES_EXT'
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_PROPERTIES_EXT'
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_MODULE_IDENTIFIER_CREATE_INFO_EXT'
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_SHADER_MODULE_IDENTIFIER_EXT'
--
-- == Version History
--
-- -   Revision 1, 2022-03-16 (Hans-Kristian Arntzen)
--
--     -   Initial draft
--
-- == See Also
--
-- 'Vulkan.Core10.APIConstants.MAX_SHADER_MODULE_IDENTIFIER_SIZE_EXT',
-- 'PhysicalDeviceShaderModuleIdentifierFeaturesEXT',
-- 'PhysicalDeviceShaderModuleIdentifierPropertiesEXT',
-- 'PipelineShaderStageModuleIdentifierCreateInfoEXT',
-- 'ShaderModuleIdentifierEXT', 'getShaderModuleCreateInfoIdentifierEXT',
-- 'getShaderModuleIdentifierEXT'
--
-- == Document Notes
--
-- For more information, see the
-- <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VK_EXT_shader_module_identifier Vulkan Specification>
--
-- This page is a generated document. Fixes and changes should be made to
-- the generator scripts, not directly.
module Vulkan.Extensions.VK_EXT_shader_module_identifier  ( getShaderModuleIdentifierEXT
                                                          , getShaderModuleCreateInfoIdentifierEXT
                                                          , PhysicalDeviceShaderModuleIdentifierFeaturesEXT(..)
                                                          , PhysicalDeviceShaderModuleIdentifierPropertiesEXT(..)
                                                          , PipelineShaderStageModuleIdentifierCreateInfoEXT(..)
                                                          , ShaderModuleIdentifierEXT(..)
                                                          , EXT_SHADER_MODULE_IDENTIFIER_SPEC_VERSION
                                                          , pattern EXT_SHADER_MODULE_IDENTIFIER_SPEC_VERSION
                                                          , EXT_SHADER_MODULE_IDENTIFIER_EXTENSION_NAME
                                                          , pattern EXT_SHADER_MODULE_IDENTIFIER_EXTENSION_NAME
                                                          , MAX_SHADER_MODULE_IDENTIFIER_SIZE_EXT
                                                          , pattern MAX_SHADER_MODULE_IDENTIFIER_SIZE_EXT
                                                          ) where

import Vulkan.CStruct.Utils (FixedArray)
import Vulkan.Internal.Utils (traceAroundEvent)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Foreign.Marshal.Alloc (allocaBytes)
import GHC.IO (throwIO)
import GHC.Ptr (nullFunPtr)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Cont (evalContT)
import Data.Vector (generateM)
import qualified Data.Vector (imapM_)
import qualified Data.Vector (length)
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Zero (Zero(..))
import Control.Monad.IO.Class (MonadIO)
import Data.String (IsString)
import Data.Typeable (Typeable)
import Foreign.Storable (Storable)
import Foreign.Storable (Storable(peek))
import Foreign.Storable (Storable(poke))
import qualified Foreign.Storable (Storable(..))
import GHC.Generics (Generic)
import GHC.IO.Exception (IOErrorType(..))
import GHC.IO.Exception (IOException(..))
import Foreign.Ptr (FunPtr)
import Foreign.Ptr (Ptr)
import Data.Word (Word32)
import Data.Word (Word8)
import Data.ByteString (ByteString)
import Data.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Data.Vector (Vector)
import Vulkan.CStruct.Utils (advancePtrBytes)
import Vulkan.Core10.FundamentalTypes (bool32ToBool)
import Vulkan.Core10.FundamentalTypes (boolToBool32)
import Vulkan.CStruct.Extends (forgetExtensions)
import Vulkan.CStruct.Utils (peekByteStringFromSizedVectorPtr)
import Vulkan.CStruct.Utils (pokeFixedLengthByteString)
import Vulkan.Core10.FundamentalTypes (Bool32)
import Vulkan.Core10.Handles (Device)
import Vulkan.Core10.Handles (Device(..))
import Vulkan.Core10.Handles (Device(Device))
import Vulkan.Dynamic (DeviceCmds(pVkGetShaderModuleCreateInfoIdentifierEXT))
import Vulkan.Dynamic (DeviceCmds(pVkGetShaderModuleIdentifierEXT))
import Vulkan.Core10.Handles (Device_T)
import Vulkan.CStruct.Extends (Extendss)
import Vulkan.Core10.APIConstants (MAX_SHADER_MODULE_IDENTIFIER_SIZE_EXT)
import Vulkan.CStruct.Extends (PokeChain)
import Vulkan.Core10.Handles (ShaderModule)
import Vulkan.Core10.Handles (ShaderModule(..))
import Vulkan.Core10.Shader (ShaderModuleCreateInfo)
import Vulkan.CStruct.Extends (SomeStruct)
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Core10.APIConstants (UUID_SIZE)
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_FEATURES_EXT))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_PROPERTIES_EXT))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_MODULE_IDENTIFIER_CREATE_INFO_EXT))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_SHADER_MODULE_IDENTIFIER_EXT))
import Vulkan.Core10.APIConstants (MAX_SHADER_MODULE_IDENTIFIER_SIZE_EXT)
import Vulkan.Core10.APIConstants (pattern MAX_SHADER_MODULE_IDENTIFIER_SIZE_EXT)
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkGetShaderModuleIdentifierEXT
  :: FunPtr (Ptr Device_T -> ShaderModule -> Ptr ShaderModuleIdentifierEXT -> IO ()) -> Ptr Device_T -> ShaderModule -> Ptr ShaderModuleIdentifierEXT -> IO ()

-- | vkGetShaderModuleIdentifierEXT - Query a unique identifier for a shader
-- module
--
-- = Description
--
-- The identifier returned by the implementation /must/ only depend on
-- @shaderIdentifierAlgorithmUUID@ and information provided in the
-- 'Vulkan.Core10.Shader.ShaderModuleCreateInfo' which created
-- @shaderModule@. The implementation /may/ return equal identifiers for
-- two different 'Vulkan.Core10.Shader.ShaderModuleCreateInfo' structures
-- if the difference does not affect pipeline compilation. Identifiers are
-- only meaningful on different 'Vulkan.Core10.Handles.Device' objects if
-- the device the identifier was queried from had the same
-- <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#limits-shaderModuleIdentifierAlgorithmUUID shaderModuleIdentifierAlgorithmUUID>
-- as the device consuming the identifier.
--
-- == Valid Usage
--
-- -   #VUID-vkGetShaderModuleIdentifierEXT-shaderModuleIdentifier-06884#
--     <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#features-shaderModuleIdentifier shaderModuleIdentifier>
--     feature /must/ be enabled
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-vkGetShaderModuleIdentifierEXT-device-parameter# @device@
--     /must/ be a valid 'Vulkan.Core10.Handles.Device' handle
--
-- -   #VUID-vkGetShaderModuleIdentifierEXT-shaderModule-parameter#
--     @shaderModule@ /must/ be a valid
--     'Vulkan.Core10.Handles.ShaderModule' handle
--
-- -   #VUID-vkGetShaderModuleIdentifierEXT-pIdentifier-parameter#
--     @pIdentifier@ /must/ be a valid pointer to a
--     'ShaderModuleIdentifierEXT' structure
--
-- -   #VUID-vkGetShaderModuleIdentifierEXT-shaderModule-parent#
--     @shaderModule@ /must/ have been created, allocated, or retrieved
--     from @device@
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_shader_module_identifier VK_EXT_shader_module_identifier>,
-- 'Vulkan.Core10.Handles.Device', 'Vulkan.Core10.Handles.ShaderModule',
-- 'ShaderModuleIdentifierEXT'
getShaderModuleIdentifierEXT :: forall io
                              . (MonadIO io)
                             => -- | @device@ is the logical device that created the shader module.
                                Device
                             -> -- | @shaderModule@ is the handle of the shader module.
                                ShaderModule
                             -> io (ShaderModuleIdentifierEXT)
getShaderModuleIdentifierEXT :: forall (io :: * -> *).
MonadIO io =>
Device -> ShaderModule -> io ShaderModuleIdentifierEXT
getShaderModuleIdentifierEXT Device
device ShaderModule
shaderModule = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT forall a b. (a -> b) -> a -> b
$ do
  let vkGetShaderModuleIdentifierEXTPtr :: FunPtr
  (Ptr Device_T
   -> ShaderModule
   -> ("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT)
   -> IO ())
vkGetShaderModuleIdentifierEXTPtr = DeviceCmds
-> FunPtr
     (Ptr Device_T
      -> ShaderModule
      -> ("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT)
      -> IO ())
pVkGetShaderModuleIdentifierEXT (case Device
device of Device{DeviceCmds
$sel:deviceCmds:Device :: Device -> DeviceCmds
deviceCmds :: DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
  forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr Device_T
   -> ShaderModule
   -> ("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT)
   -> IO ())
vkGetShaderModuleIdentifierEXTPtr forall a. Eq a => a -> a -> Bool
/= forall a. FunPtr a
nullFunPtr) forall a b. (a -> b) -> a -> b
$
    forall e a. Exception e => e -> IO a
throwIO forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"The function pointer for vkGetShaderModuleIdentifierEXT is null" forall a. Maybe a
Nothing forall a. Maybe a
Nothing
  let vkGetShaderModuleIdentifierEXT' :: Ptr Device_T
-> ShaderModule
-> ("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT)
-> IO ()
vkGetShaderModuleIdentifierEXT' = FunPtr
  (Ptr Device_T
   -> ShaderModule
   -> ("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT)
   -> IO ())
-> Ptr Device_T
-> ShaderModule
-> ("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT)
-> IO ()
mkVkGetShaderModuleIdentifierEXT FunPtr
  (Ptr Device_T
   -> ShaderModule
   -> ("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT)
   -> IO ())
vkGetShaderModuleIdentifierEXTPtr
  "pIdentifier" ::: Ptr ShaderModuleIdentifierEXT
pPIdentifier <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (forall a b. ToCStruct a => (Ptr a -> IO b) -> IO b
withZeroCStruct @ShaderModuleIdentifierEXT)
  forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. String -> IO a -> IO a
traceAroundEvent String
"vkGetShaderModuleIdentifierEXT" (Ptr Device_T
-> ShaderModule
-> ("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT)
-> IO ()
vkGetShaderModuleIdentifierEXT'
                                                              (Device -> Ptr Device_T
deviceHandle (Device
device))
                                                              (ShaderModule
shaderModule)
                                                              ("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT
pPIdentifier))
  ShaderModuleIdentifierEXT
pIdentifier <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @ShaderModuleIdentifierEXT "pIdentifier" ::: Ptr ShaderModuleIdentifierEXT
pPIdentifier
  forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ (ShaderModuleIdentifierEXT
pIdentifier)


foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkGetShaderModuleCreateInfoIdentifierEXT
  :: FunPtr (Ptr Device_T -> Ptr (SomeStruct ShaderModuleCreateInfo) -> Ptr ShaderModuleIdentifierEXT -> IO ()) -> Ptr Device_T -> Ptr (SomeStruct ShaderModuleCreateInfo) -> Ptr ShaderModuleIdentifierEXT -> IO ()

-- | vkGetShaderModuleCreateInfoIdentifierEXT - Query a unique identifier for
-- a shader module create info
--
-- = Description
--
-- The identifier returned by implementation /must/ only depend on
-- @shaderIdentifierAlgorithmUUID@ and information provided in the
-- 'Vulkan.Core10.Shader.ShaderModuleCreateInfo'. The implementation /may/
-- return equal identifiers for two different
-- 'Vulkan.Core10.Shader.ShaderModuleCreateInfo' structures if the
-- difference does not affect pipeline compilation. Identifiers are only
-- meaningful on different 'Vulkan.Core10.Handles.Device' objects if the
-- device the identifier was queried from had the same
-- <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#limits-shaderModuleIdentifierAlgorithmUUID shaderModuleIdentifierAlgorithmUUID>
-- as the device consuming the identifier.
--
-- The identifier returned by the implementation in
-- 'getShaderModuleCreateInfoIdentifierEXT' /must/ be equal to the
-- identifier returned by 'getShaderModuleIdentifierEXT' given equivalent
-- definitions of 'Vulkan.Core10.Shader.ShaderModuleCreateInfo' and any
-- chained @pNext@ structures.
--
-- == Valid Usage
--
-- -   #VUID-vkGetShaderModuleCreateInfoIdentifierEXT-shaderModuleIdentifier-06885#
--     <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#features-shaderModuleIdentifier shaderModuleIdentifier>
--     feature /must/ be enabled
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-vkGetShaderModuleCreateInfoIdentifierEXT-device-parameter#
--     @device@ /must/ be a valid 'Vulkan.Core10.Handles.Device' handle
--
-- -   #VUID-vkGetShaderModuleCreateInfoIdentifierEXT-pCreateInfo-parameter#
--     @pCreateInfo@ /must/ be a valid pointer to a valid
--     'Vulkan.Core10.Shader.ShaderModuleCreateInfo' structure
--
-- -   #VUID-vkGetShaderModuleCreateInfoIdentifierEXT-pIdentifier-parameter#
--     @pIdentifier@ /must/ be a valid pointer to a
--     'ShaderModuleIdentifierEXT' structure
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_shader_module_identifier VK_EXT_shader_module_identifier>,
-- 'Vulkan.Core10.Handles.Device',
-- 'Vulkan.Core10.Shader.ShaderModuleCreateInfo',
-- 'ShaderModuleIdentifierEXT'
getShaderModuleCreateInfoIdentifierEXT :: forall a io
                                        . ( Extendss ShaderModuleCreateInfo a
                                          , PokeChain a
                                          , MonadIO io )
                                       => -- | @device@ is the logical device that /can/ create a
                                          -- 'Vulkan.Core10.Handles.ShaderModule' from @pCreateInfo@.
                                          Device
                                       -> -- | @pCreateInfo@ is a pointer to a
                                          -- 'Vulkan.Core10.Shader.ShaderModuleCreateInfo' structure.
                                          (ShaderModuleCreateInfo a)
                                       -> io (ShaderModuleIdentifierEXT)
getShaderModuleCreateInfoIdentifierEXT :: forall (a :: [*]) (io :: * -> *).
(Extendss ShaderModuleCreateInfo a, PokeChain a, MonadIO io) =>
Device -> ShaderModuleCreateInfo a -> io ShaderModuleIdentifierEXT
getShaderModuleCreateInfoIdentifierEXT Device
device
                                         ShaderModuleCreateInfo a
createInfo = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT forall a b. (a -> b) -> a -> b
$ do
  let vkGetShaderModuleCreateInfoIdentifierEXTPtr :: FunPtr
  (Ptr Device_T
   -> ("pCreateInfo" ::: Ptr (SomeStruct ShaderModuleCreateInfo))
   -> ("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT)
   -> IO ())
vkGetShaderModuleCreateInfoIdentifierEXTPtr = DeviceCmds
-> FunPtr
     (Ptr Device_T
      -> ("pCreateInfo" ::: Ptr (SomeStruct ShaderModuleCreateInfo))
      -> ("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT)
      -> IO ())
pVkGetShaderModuleCreateInfoIdentifierEXT (case Device
device of Device{DeviceCmds
deviceCmds :: DeviceCmds
$sel:deviceCmds:Device :: Device -> DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
  forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr Device_T
   -> ("pCreateInfo" ::: Ptr (SomeStruct ShaderModuleCreateInfo))
   -> ("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT)
   -> IO ())
vkGetShaderModuleCreateInfoIdentifierEXTPtr forall a. Eq a => a -> a -> Bool
/= forall a. FunPtr a
nullFunPtr) forall a b. (a -> b) -> a -> b
$
    forall e a. Exception e => e -> IO a
throwIO forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"The function pointer for vkGetShaderModuleCreateInfoIdentifierEXT is null" forall a. Maybe a
Nothing forall a. Maybe a
Nothing
  let vkGetShaderModuleCreateInfoIdentifierEXT' :: Ptr Device_T
-> ("pCreateInfo" ::: Ptr (SomeStruct ShaderModuleCreateInfo))
-> ("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT)
-> IO ()
vkGetShaderModuleCreateInfoIdentifierEXT' = FunPtr
  (Ptr Device_T
   -> ("pCreateInfo" ::: Ptr (SomeStruct ShaderModuleCreateInfo))
   -> ("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT)
   -> IO ())
-> Ptr Device_T
-> ("pCreateInfo" ::: Ptr (SomeStruct ShaderModuleCreateInfo))
-> ("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT)
-> IO ()
mkVkGetShaderModuleCreateInfoIdentifierEXT FunPtr
  (Ptr Device_T
   -> ("pCreateInfo" ::: Ptr (SomeStruct ShaderModuleCreateInfo))
   -> ("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT)
   -> IO ())
vkGetShaderModuleCreateInfoIdentifierEXTPtr
  Ptr (ShaderModuleCreateInfo a)
pCreateInfo <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT forall a b. (a -> b) -> a -> b
$ forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (ShaderModuleCreateInfo a
createInfo)
  "pIdentifier" ::: Ptr ShaderModuleIdentifierEXT
pPIdentifier <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (forall a b. ToCStruct a => (Ptr a -> IO b) -> IO b
withZeroCStruct @ShaderModuleIdentifierEXT)
  forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. String -> IO a -> IO a
traceAroundEvent String
"vkGetShaderModuleCreateInfoIdentifierEXT" (Ptr Device_T
-> ("pCreateInfo" ::: Ptr (SomeStruct ShaderModuleCreateInfo))
-> ("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT)
-> IO ()
vkGetShaderModuleCreateInfoIdentifierEXT'
                                                                        (Device -> Ptr Device_T
deviceHandle (Device
device))
                                                                        (forall (a :: [*] -> *) (es :: [*]).
Ptr (a es) -> Ptr (SomeStruct a)
forgetExtensions Ptr (ShaderModuleCreateInfo a)
pCreateInfo)
                                                                        ("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT
pPIdentifier))
  ShaderModuleIdentifierEXT
pIdentifier <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @ShaderModuleIdentifierEXT "pIdentifier" ::: Ptr ShaderModuleIdentifierEXT
pPIdentifier
  forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ (ShaderModuleIdentifierEXT
pIdentifier)


-- | VkPhysicalDeviceShaderModuleIdentifierFeaturesEXT - Structure describing
-- whether querying and providing an identifier of a shader module is
-- supported by the implementation
--
-- = Members
--
-- This structure describes the following feature:
--
-- = Description
--
-- If the 'PhysicalDeviceShaderModuleIdentifierFeaturesEXT' structure is
-- included in the @pNext@ chain of the
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceFeatures2'
-- structure passed to
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.getPhysicalDeviceFeatures2',
-- it is filled in to indicate whether each corresponding feature is
-- supported. 'PhysicalDeviceShaderModuleIdentifierFeaturesEXT' /can/ also
-- be used in the @pNext@ chain of 'Vulkan.Core10.Device.DeviceCreateInfo'
-- to selectively enable these features.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_shader_module_identifier VK_EXT_shader_module_identifier>,
-- 'Vulkan.Core10.FundamentalTypes.Bool32',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PhysicalDeviceShaderModuleIdentifierFeaturesEXT = PhysicalDeviceShaderModuleIdentifierFeaturesEXT
  { -- | #features-shaderModuleIdentifier# @shaderModuleIdentifier@ indicates
    -- whether the implementation supports querying an identifier of a
    -- 'Vulkan.Core10.Handles.ShaderModule' or
    -- 'Vulkan.Core10.Shader.ShaderModuleCreateInfo' structure, and creating
    -- pipelines from identifiers only.
    PhysicalDeviceShaderModuleIdentifierFeaturesEXT -> Bool
shaderModuleIdentifier :: Bool }
  deriving (Typeable, PhysicalDeviceShaderModuleIdentifierFeaturesEXT
-> PhysicalDeviceShaderModuleIdentifierFeaturesEXT -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhysicalDeviceShaderModuleIdentifierFeaturesEXT
-> PhysicalDeviceShaderModuleIdentifierFeaturesEXT -> Bool
$c/= :: PhysicalDeviceShaderModuleIdentifierFeaturesEXT
-> PhysicalDeviceShaderModuleIdentifierFeaturesEXT -> Bool
== :: PhysicalDeviceShaderModuleIdentifierFeaturesEXT
-> PhysicalDeviceShaderModuleIdentifierFeaturesEXT -> Bool
$c== :: PhysicalDeviceShaderModuleIdentifierFeaturesEXT
-> PhysicalDeviceShaderModuleIdentifierFeaturesEXT -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceShaderModuleIdentifierFeaturesEXT)
#endif
deriving instance Show PhysicalDeviceShaderModuleIdentifierFeaturesEXT

instance ToCStruct PhysicalDeviceShaderModuleIdentifierFeaturesEXT where
  withCStruct :: forall b.
PhysicalDeviceShaderModuleIdentifierFeaturesEXT
-> (Ptr PhysicalDeviceShaderModuleIdentifierFeaturesEXT -> IO b)
-> IO b
withCStruct PhysicalDeviceShaderModuleIdentifierFeaturesEXT
x Ptr PhysicalDeviceShaderModuleIdentifierFeaturesEXT -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
24 forall a b. (a -> b) -> a -> b
$ \Ptr PhysicalDeviceShaderModuleIdentifierFeaturesEXT
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceShaderModuleIdentifierFeaturesEXT
p PhysicalDeviceShaderModuleIdentifierFeaturesEXT
x (Ptr PhysicalDeviceShaderModuleIdentifierFeaturesEXT -> IO b
f Ptr PhysicalDeviceShaderModuleIdentifierFeaturesEXT
p)
  pokeCStruct :: forall b.
Ptr PhysicalDeviceShaderModuleIdentifierFeaturesEXT
-> PhysicalDeviceShaderModuleIdentifierFeaturesEXT -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceShaderModuleIdentifierFeaturesEXT
p PhysicalDeviceShaderModuleIdentifierFeaturesEXT{Bool
shaderModuleIdentifier :: Bool
$sel:shaderModuleIdentifier:PhysicalDeviceShaderModuleIdentifierFeaturesEXT :: PhysicalDeviceShaderModuleIdentifierFeaturesEXT -> Bool
..} IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceShaderModuleIdentifierFeaturesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_FEATURES_EXT)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceShaderModuleIdentifierFeaturesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceShaderModuleIdentifierFeaturesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
shaderModuleIdentifier))
    IO b
f
  cStructSize :: Int
cStructSize = Int
24
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b.
Ptr PhysicalDeviceShaderModuleIdentifierFeaturesEXT -> IO b -> IO b
pokeZeroCStruct Ptr PhysicalDeviceShaderModuleIdentifierFeaturesEXT
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceShaderModuleIdentifierFeaturesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_FEATURES_EXT)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceShaderModuleIdentifierFeaturesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceShaderModuleIdentifierFeaturesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (forall a. Zero a => a
zero))
    IO b
f

instance FromCStruct PhysicalDeviceShaderModuleIdentifierFeaturesEXT where
  peekCStruct :: Ptr PhysicalDeviceShaderModuleIdentifierFeaturesEXT
-> IO PhysicalDeviceShaderModuleIdentifierFeaturesEXT
peekCStruct Ptr PhysicalDeviceShaderModuleIdentifierFeaturesEXT
p = do
    Bool32
shaderModuleIdentifier <- forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PhysicalDeviceShaderModuleIdentifierFeaturesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32))
    forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Bool -> PhysicalDeviceShaderModuleIdentifierFeaturesEXT
PhysicalDeviceShaderModuleIdentifierFeaturesEXT
             (Bool32 -> Bool
bool32ToBool Bool32
shaderModuleIdentifier)

instance Storable PhysicalDeviceShaderModuleIdentifierFeaturesEXT where
  sizeOf :: PhysicalDeviceShaderModuleIdentifierFeaturesEXT -> Int
sizeOf ~PhysicalDeviceShaderModuleIdentifierFeaturesEXT
_ = Int
24
  alignment :: PhysicalDeviceShaderModuleIdentifierFeaturesEXT -> Int
alignment ~PhysicalDeviceShaderModuleIdentifierFeaturesEXT
_ = Int
8
  peek :: Ptr PhysicalDeviceShaderModuleIdentifierFeaturesEXT
-> IO PhysicalDeviceShaderModuleIdentifierFeaturesEXT
peek = forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
  poke :: Ptr PhysicalDeviceShaderModuleIdentifierFeaturesEXT
-> PhysicalDeviceShaderModuleIdentifierFeaturesEXT -> IO ()
poke Ptr PhysicalDeviceShaderModuleIdentifierFeaturesEXT
ptr PhysicalDeviceShaderModuleIdentifierFeaturesEXT
poked = forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceShaderModuleIdentifierFeaturesEXT
ptr PhysicalDeviceShaderModuleIdentifierFeaturesEXT
poked (forall (f :: * -> *) a. Applicative f => a -> f a
pure ())

instance Zero PhysicalDeviceShaderModuleIdentifierFeaturesEXT where
  zero :: PhysicalDeviceShaderModuleIdentifierFeaturesEXT
zero = Bool -> PhysicalDeviceShaderModuleIdentifierFeaturesEXT
PhysicalDeviceShaderModuleIdentifierFeaturesEXT
           forall a. Zero a => a
zero


-- | VkPhysicalDeviceShaderModuleIdentifierPropertiesEXT - Structure
-- describing shader module identifier properties of an implementation
--
-- = Members
--
-- The members of the 'PhysicalDeviceShaderModuleIdentifierPropertiesEXT'
-- structure describe the following:
--
-- = Description
--
-- Note
--
-- The algorithm UUID may be the same in different ICDs if the algorithms
-- are guaranteed to produce the same results. This may happen in driver
-- stacks which support different kinds of hardware with shared code.
--
-- Khronos\' conformance testing can not guarantee that
-- @shaderModuleIdentifierAlgorithmUUID@ values are actually unique, so
-- implementors should make their own best efforts to ensure that their
-- UUID is unlikely to conflict with other implementations which may use a
-- different algorithm. In particular, hard-coded values which easily
-- conflict, such as all-@0@ bits, /should/ never be used. Hard-coded
-- values are acceptable if best effort is ensured that the value will not
-- accidentally conflict.
--
-- If the 'PhysicalDeviceShaderModuleIdentifierPropertiesEXT' structure is
-- included in the @pNext@ chain of the
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceProperties2'
-- structure passed to
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.getPhysicalDeviceProperties2',
-- it is filled in with each corresponding implementation-dependent
-- property.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_shader_module_identifier VK_EXT_shader_module_identifier>,
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PhysicalDeviceShaderModuleIdentifierPropertiesEXT = PhysicalDeviceShaderModuleIdentifierPropertiesEXT
  { -- | #limits-shaderModuleIdentifierAlgorithmUUID#
    -- @shaderModuleIdentifierAlgorithmUUID@ is an array of
    -- 'Vulkan.Core10.APIConstants.UUID_SIZE' @uint8_t@ values which uniquely
    -- represents the algorithm used to compute an identifier in
    -- 'getShaderModuleIdentifierEXT' and
    -- 'getShaderModuleCreateInfoIdentifierEXT'. Implementations /should/ not
    -- change this value in different driver versions if the algorithm used to
    -- compute an identifier is the same.
    PhysicalDeviceShaderModuleIdentifierPropertiesEXT -> ByteString
shaderModuleIdentifierAlgorithmUUID :: ByteString }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceShaderModuleIdentifierPropertiesEXT)
#endif
deriving instance Show PhysicalDeviceShaderModuleIdentifierPropertiesEXT

instance ToCStruct PhysicalDeviceShaderModuleIdentifierPropertiesEXT where
  withCStruct :: forall b.
PhysicalDeviceShaderModuleIdentifierPropertiesEXT
-> (Ptr PhysicalDeviceShaderModuleIdentifierPropertiesEXT -> IO b)
-> IO b
withCStruct PhysicalDeviceShaderModuleIdentifierPropertiesEXT
x Ptr PhysicalDeviceShaderModuleIdentifierPropertiesEXT -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
32 forall a b. (a -> b) -> a -> b
$ \Ptr PhysicalDeviceShaderModuleIdentifierPropertiesEXT
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceShaderModuleIdentifierPropertiesEXT
p PhysicalDeviceShaderModuleIdentifierPropertiesEXT
x (Ptr PhysicalDeviceShaderModuleIdentifierPropertiesEXT -> IO b
f Ptr PhysicalDeviceShaderModuleIdentifierPropertiesEXT
p)
  pokeCStruct :: forall b.
Ptr PhysicalDeviceShaderModuleIdentifierPropertiesEXT
-> PhysicalDeviceShaderModuleIdentifierPropertiesEXT
-> IO b
-> IO b
pokeCStruct Ptr PhysicalDeviceShaderModuleIdentifierPropertiesEXT
p PhysicalDeviceShaderModuleIdentifierPropertiesEXT{ByteString
shaderModuleIdentifierAlgorithmUUID :: ByteString
$sel:shaderModuleIdentifierAlgorithmUUID:PhysicalDeviceShaderModuleIdentifierPropertiesEXT :: PhysicalDeviceShaderModuleIdentifierPropertiesEXT -> ByteString
..} IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceShaderModuleIdentifierPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_PROPERTIES_EXT)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceShaderModuleIdentifierPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall (n :: Nat).
KnownNat n =>
Ptr (FixedArray n Word8) -> ByteString -> IO ()
pokeFixedLengthByteString ((Ptr PhysicalDeviceShaderModuleIdentifierPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr (FixedArray UUID_SIZE Word8))) (ByteString
shaderModuleIdentifierAlgorithmUUID)
    IO b
f
  cStructSize :: Int
cStructSize = Int
32
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b.
Ptr PhysicalDeviceShaderModuleIdentifierPropertiesEXT
-> IO b -> IO b
pokeZeroCStruct Ptr PhysicalDeviceShaderModuleIdentifierPropertiesEXT
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceShaderModuleIdentifierPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_PROPERTIES_EXT)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceShaderModuleIdentifierPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall (n :: Nat).
KnownNat n =>
Ptr (FixedArray n Word8) -> ByteString -> IO ()
pokeFixedLengthByteString ((Ptr PhysicalDeviceShaderModuleIdentifierPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr (FixedArray UUID_SIZE Word8))) (forall a. Monoid a => a
mempty)
    IO b
f

instance FromCStruct PhysicalDeviceShaderModuleIdentifierPropertiesEXT where
  peekCStruct :: Ptr PhysicalDeviceShaderModuleIdentifierPropertiesEXT
-> IO PhysicalDeviceShaderModuleIdentifierPropertiesEXT
peekCStruct Ptr PhysicalDeviceShaderModuleIdentifierPropertiesEXT
p = do
    ByteString
shaderModuleIdentifierAlgorithmUUID <- forall (n :: Nat).
KnownNat n =>
Ptr (FixedArray n Word8) -> IO ByteString
peekByteStringFromSizedVectorPtr ((Ptr PhysicalDeviceShaderModuleIdentifierPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr (FixedArray UUID_SIZE Word8)))
    forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ ByteString -> PhysicalDeviceShaderModuleIdentifierPropertiesEXT
PhysicalDeviceShaderModuleIdentifierPropertiesEXT
             ByteString
shaderModuleIdentifierAlgorithmUUID

instance Storable PhysicalDeviceShaderModuleIdentifierPropertiesEXT where
  sizeOf :: PhysicalDeviceShaderModuleIdentifierPropertiesEXT -> Int
sizeOf ~PhysicalDeviceShaderModuleIdentifierPropertiesEXT
_ = Int
32
  alignment :: PhysicalDeviceShaderModuleIdentifierPropertiesEXT -> Int
alignment ~PhysicalDeviceShaderModuleIdentifierPropertiesEXT
_ = Int
8
  peek :: Ptr PhysicalDeviceShaderModuleIdentifierPropertiesEXT
-> IO PhysicalDeviceShaderModuleIdentifierPropertiesEXT
peek = forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
  poke :: Ptr PhysicalDeviceShaderModuleIdentifierPropertiesEXT
-> PhysicalDeviceShaderModuleIdentifierPropertiesEXT -> IO ()
poke Ptr PhysicalDeviceShaderModuleIdentifierPropertiesEXT
ptr PhysicalDeviceShaderModuleIdentifierPropertiesEXT
poked = forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceShaderModuleIdentifierPropertiesEXT
ptr PhysicalDeviceShaderModuleIdentifierPropertiesEXT
poked (forall (f :: * -> *) a. Applicative f => a -> f a
pure ())

instance Zero PhysicalDeviceShaderModuleIdentifierPropertiesEXT where
  zero :: PhysicalDeviceShaderModuleIdentifierPropertiesEXT
zero = ByteString -> PhysicalDeviceShaderModuleIdentifierPropertiesEXT
PhysicalDeviceShaderModuleIdentifierPropertiesEXT
           forall a. Monoid a => a
mempty


-- | VkPipelineShaderStageModuleIdentifierCreateInfoEXT - Structure
-- specifying an identifier for a shader module
--
-- = Description
--
-- Any identifier /can/ be used. If the pipeline being created with
-- identifier requires compilation to complete the pipeline creation call,
-- pipeline compilation /must/ fail as defined by
-- 'Vulkan.Core10.Enums.PipelineCreateFlagBits.PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT'.
--
-- @pIdentifier@ and @identifierSize@ /can/ be obtained from an
-- 'ShaderModuleIdentifierEXT' queried earlier.
--
-- == Valid Usage
--
-- -   #VUID-VkPipelineShaderStageModuleIdentifierCreateInfoEXT-pNext-06850#
--     If this structure is included in a @pNext@ chain and
--     @identifierSize@ is not equal to 0, the
--     <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#features-shaderModuleIdentifier shaderModuleIdentifier>
--     feature /must/ be enabled
--
-- -   #VUID-VkPipelineShaderStageModuleIdentifierCreateInfoEXT-pNext-06851#
--     If this struct is included in a @pNext@ chain of
--     'Vulkan.Core10.Pipeline.PipelineShaderStageCreateInfo' and
--     @identifierSize@ is not equal to 0, the pipeline /must/ be created
--     with the
--     'Vulkan.Core10.Enums.PipelineCreateFlagBits.PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT'
--     flag set
--
-- -   #VUID-VkPipelineShaderStageModuleIdentifierCreateInfoEXT-identifierSize-06852#
--     @identifierSize@ /must/ be less-or-equal to
--     'Vulkan.Core10.APIConstants.MAX_SHADER_MODULE_IDENTIFIER_SIZE_EXT'
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkPipelineShaderStageModuleIdentifierCreateInfoEXT-sType-sType#
--     @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_MODULE_IDENTIFIER_CREATE_INFO_EXT'
--
-- -   #VUID-VkPipelineShaderStageModuleIdentifierCreateInfoEXT-pIdentifier-parameter#
--     If @identifierSize@ is not @0@, @pIdentifier@ /must/ be a valid
--     pointer to an array of @identifierSize@ @uint8_t@ values
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_shader_module_identifier VK_EXT_shader_module_identifier>,
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PipelineShaderStageModuleIdentifierCreateInfoEXT = PipelineShaderStageModuleIdentifierCreateInfoEXT
  { -- | @pIdentifier@ is a pointer to a buffer of opaque data specifying an
    -- identifier.
    PipelineShaderStageModuleIdentifierCreateInfoEXT -> Vector Word8
identifier :: Vector Word8 }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PipelineShaderStageModuleIdentifierCreateInfoEXT)
#endif
deriving instance Show PipelineShaderStageModuleIdentifierCreateInfoEXT

instance ToCStruct PipelineShaderStageModuleIdentifierCreateInfoEXT where
  withCStruct :: forall b.
PipelineShaderStageModuleIdentifierCreateInfoEXT
-> (Ptr PipelineShaderStageModuleIdentifierCreateInfoEXT -> IO b)
-> IO b
withCStruct PipelineShaderStageModuleIdentifierCreateInfoEXT
x Ptr PipelineShaderStageModuleIdentifierCreateInfoEXT -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
32 forall a b. (a -> b) -> a -> b
$ \Ptr PipelineShaderStageModuleIdentifierCreateInfoEXT
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PipelineShaderStageModuleIdentifierCreateInfoEXT
p PipelineShaderStageModuleIdentifierCreateInfoEXT
x (Ptr PipelineShaderStageModuleIdentifierCreateInfoEXT -> IO b
f Ptr PipelineShaderStageModuleIdentifierCreateInfoEXT
p)
  pokeCStruct :: forall b.
Ptr PipelineShaderStageModuleIdentifierCreateInfoEXT
-> PipelineShaderStageModuleIdentifierCreateInfoEXT -> IO b -> IO b
pokeCStruct Ptr PipelineShaderStageModuleIdentifierCreateInfoEXT
p PipelineShaderStageModuleIdentifierCreateInfoEXT{Vector Word8
identifier :: Vector Word8
$sel:identifier:PipelineShaderStageModuleIdentifierCreateInfoEXT :: PipelineShaderStageModuleIdentifierCreateInfoEXT -> Vector Word8
..} IO b
f = forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT forall a b. (a -> b) -> a -> b
$ do
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineShaderStageModuleIdentifierCreateInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_MODULE_IDENTIFIER_CREATE_INFO_EXT)
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineShaderStageModuleIdentifierCreateInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineShaderStageModuleIdentifierCreateInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32)) ((forall a b. (Integral a, Num b) => a -> b
fromIntegral (forall a. Vector a -> Int
Data.Vector.length forall a b. (a -> b) -> a -> b
$ (Vector Word8
identifier)) :: Word32))
    Ptr Word8
pPIdentifier' <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT forall a b. (a -> b) -> a -> b
$ forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes @Word8 (forall a. Vector a -> Int
Data.Vector.length (Vector Word8
identifier))
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\Int
i Word8
e -> forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word8
pPIdentifier' forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
1 forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Word8) (Word8
e)) (Vector Word8
identifier)
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineShaderStageModuleIdentifierCreateInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr Word8))) (Ptr Word8
pPIdentifier')
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ IO b
f
  cStructSize :: Int
cStructSize = Int
32
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b.
Ptr PipelineShaderStageModuleIdentifierCreateInfoEXT
-> IO b -> IO b
pokeZeroCStruct Ptr PipelineShaderStageModuleIdentifierCreateInfoEXT
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineShaderStageModuleIdentifierCreateInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_MODULE_IDENTIFIER_CREATE_INFO_EXT)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineShaderStageModuleIdentifierCreateInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    IO b
f

instance FromCStruct PipelineShaderStageModuleIdentifierCreateInfoEXT where
  peekCStruct :: Ptr PipelineShaderStageModuleIdentifierCreateInfoEXT
-> IO PipelineShaderStageModuleIdentifierCreateInfoEXT
peekCStruct Ptr PipelineShaderStageModuleIdentifierCreateInfoEXT
p = do
    Word32
identifierSize <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr PipelineShaderStageModuleIdentifierCreateInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32))
    Ptr Word8
pIdentifier <- forall a. Storable a => Ptr a -> IO a
peek @(Ptr Word8) ((Ptr PipelineShaderStageModuleIdentifierCreateInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr Word8)))
    Vector Word8
pIdentifier' <- forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM (forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
identifierSize) (\Int
i -> forall a. Storable a => Ptr a -> IO a
peek @Word8 ((Ptr Word8
pIdentifier forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
1 forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Word8)))
    forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Vector Word8 -> PipelineShaderStageModuleIdentifierCreateInfoEXT
PipelineShaderStageModuleIdentifierCreateInfoEXT
             Vector Word8
pIdentifier'

instance Zero PipelineShaderStageModuleIdentifierCreateInfoEXT where
  zero :: PipelineShaderStageModuleIdentifierCreateInfoEXT
zero = Vector Word8 -> PipelineShaderStageModuleIdentifierCreateInfoEXT
PipelineShaderStageModuleIdentifierCreateInfoEXT
           forall a. Monoid a => a
mempty


-- | VkShaderModuleIdentifierEXT - A unique identifier for a shader module
--
-- = Description
--
-- Any returned values beyond the first @identifierSize@ bytes are
-- undefined. Implementations /must/ return an @identifierSize@ greater
-- than 0, and less-or-equal to
-- 'Vulkan.Core10.APIConstants.MAX_SHADER_MODULE_IDENTIFIER_SIZE_EXT'.
--
-- Two identifiers are considered equal if @identifierSize@ is equal and
-- the first @identifierSize@ bytes of @identifier@ compare equal.
--
-- Implementations /may/ return a different @identifierSize@ for different
-- modules. Implementations /should/ ensure that @identifierSize@ is large
-- enough to uniquely define a shader module.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_shader_module_identifier VK_EXT_shader_module_identifier>,
-- 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'getShaderModuleCreateInfoIdentifierEXT', 'getShaderModuleIdentifierEXT'
data ShaderModuleIdentifierEXT = ShaderModuleIdentifierEXT
  { -- | @identifierSize@ is the size, in bytes, of valid data returned in
    -- @identifier@.
    ShaderModuleIdentifierEXT -> Word32
identifierSize :: Word32
  , -- | @identifier@ is a buffer of opaque data specifying an identifier.
    ShaderModuleIdentifierEXT -> ByteString
identifier :: ByteString
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ShaderModuleIdentifierEXT)
#endif
deriving instance Show ShaderModuleIdentifierEXT

instance ToCStruct ShaderModuleIdentifierEXT where
  withCStruct :: forall b.
ShaderModuleIdentifierEXT
-> (("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT) -> IO b)
-> IO b
withCStruct ShaderModuleIdentifierEXT
x ("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT) -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
56 forall a b. (a -> b) -> a -> b
$ \"pIdentifier" ::: Ptr ShaderModuleIdentifierEXT
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pIdentifier" ::: Ptr ShaderModuleIdentifierEXT
p ShaderModuleIdentifierEXT
x (("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT) -> IO b
f "pIdentifier" ::: Ptr ShaderModuleIdentifierEXT
p)
  pokeCStruct :: forall b.
("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT)
-> ShaderModuleIdentifierEXT -> IO b -> IO b
pokeCStruct "pIdentifier" ::: Ptr ShaderModuleIdentifierEXT
p ShaderModuleIdentifierEXT{Word32
ByteString
identifier :: ByteString
identifierSize :: Word32
$sel:identifier:ShaderModuleIdentifierEXT :: ShaderModuleIdentifierEXT -> ByteString
$sel:identifierSize:ShaderModuleIdentifierEXT :: ShaderModuleIdentifierEXT -> Word32
..} IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_SHADER_MODULE_IDENTIFIER_EXT)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32)) (Word32
identifierSize)
    forall (n :: Nat).
KnownNat n =>
Ptr (FixedArray n Word8) -> ByteString -> IO ()
pokeFixedLengthByteString (("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr (FixedArray MAX_SHADER_MODULE_IDENTIFIER_SIZE_EXT Word8))) (ByteString
identifier)
    IO b
f
  cStructSize :: Int
cStructSize = Int
56
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b.
("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT) -> IO b -> IO b
pokeZeroCStruct "pIdentifier" ::: Ptr ShaderModuleIdentifierEXT
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_SHADER_MODULE_IDENTIFIER_EXT)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32)) (forall a. Zero a => a
zero)
    forall (n :: Nat).
KnownNat n =>
Ptr (FixedArray n Word8) -> ByteString -> IO ()
pokeFixedLengthByteString (("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr (FixedArray MAX_SHADER_MODULE_IDENTIFIER_SIZE_EXT Word8))) (forall a. Monoid a => a
mempty)
    IO b
f

instance FromCStruct ShaderModuleIdentifierEXT where
  peekCStruct :: ("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT)
-> IO ShaderModuleIdentifierEXT
peekCStruct "pIdentifier" ::: Ptr ShaderModuleIdentifierEXT
p = do
    Word32
identifierSize <- forall a. Storable a => Ptr a -> IO a
peek @Word32 (("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32))
    ByteString
identifier <- forall (n :: Nat).
KnownNat n =>
Ptr (FixedArray n Word8) -> IO ByteString
peekByteStringFromSizedVectorPtr (("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr (FixedArray MAX_SHADER_MODULE_IDENTIFIER_SIZE_EXT Word8)))
    forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Word32 -> ByteString -> ShaderModuleIdentifierEXT
ShaderModuleIdentifierEXT
             Word32
identifierSize ByteString
identifier

instance Storable ShaderModuleIdentifierEXT where
  sizeOf :: ShaderModuleIdentifierEXT -> Int
sizeOf ~ShaderModuleIdentifierEXT
_ = Int
56
  alignment :: ShaderModuleIdentifierEXT -> Int
alignment ~ShaderModuleIdentifierEXT
_ = Int
8
  peek :: ("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT)
-> IO ShaderModuleIdentifierEXT
peek = forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
  poke :: ("pIdentifier" ::: Ptr ShaderModuleIdentifierEXT)
-> ShaderModuleIdentifierEXT -> IO ()
poke "pIdentifier" ::: Ptr ShaderModuleIdentifierEXT
ptr ShaderModuleIdentifierEXT
poked = forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pIdentifier" ::: Ptr ShaderModuleIdentifierEXT
ptr ShaderModuleIdentifierEXT
poked (forall (f :: * -> *) a. Applicative f => a -> f a
pure ())

instance Zero ShaderModuleIdentifierEXT where
  zero :: ShaderModuleIdentifierEXT
zero = Word32 -> ByteString -> ShaderModuleIdentifierEXT
ShaderModuleIdentifierEXT
           forall a. Zero a => a
zero
           forall a. Monoid a => a
mempty


type EXT_SHADER_MODULE_IDENTIFIER_SPEC_VERSION = 1

-- No documentation found for TopLevel "VK_EXT_SHADER_MODULE_IDENTIFIER_SPEC_VERSION"
pattern EXT_SHADER_MODULE_IDENTIFIER_SPEC_VERSION :: forall a . Integral a => a
pattern $bEXT_SHADER_MODULE_IDENTIFIER_SPEC_VERSION :: forall a. Integral a => a
$mEXT_SHADER_MODULE_IDENTIFIER_SPEC_VERSION :: forall {r} {a}.
Integral a =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
EXT_SHADER_MODULE_IDENTIFIER_SPEC_VERSION = 1


type EXT_SHADER_MODULE_IDENTIFIER_EXTENSION_NAME = "VK_EXT_shader_module_identifier"

-- No documentation found for TopLevel "VK_EXT_SHADER_MODULE_IDENTIFIER_EXTENSION_NAME"
pattern EXT_SHADER_MODULE_IDENTIFIER_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bEXT_SHADER_MODULE_IDENTIFIER_EXTENSION_NAME :: forall a. (Eq a, IsString a) => a
$mEXT_SHADER_MODULE_IDENTIFIER_EXTENSION_NAME :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
EXT_SHADER_MODULE_IDENTIFIER_EXTENSION_NAME = "VK_EXT_shader_module_identifier"