{-# language CPP #-}
-- No documentation found for Chapter "Promoted_From_VK_KHR_external_memory_capabilities"
module Vulkan.Core11.Promoted_From_VK_KHR_external_memory_capabilities  ( getPhysicalDeviceExternalBufferProperties
                                                                        , ExternalMemoryProperties(..)
                                                                        , PhysicalDeviceExternalImageFormatInfo(..)
                                                                        , ExternalImageFormatProperties(..)
                                                                        , PhysicalDeviceExternalBufferInfo(..)
                                                                        , ExternalBufferProperties(..)
                                                                        , PhysicalDeviceIDProperties(..)
                                                                        , StructureType(..)
                                                                        , ExternalMemoryHandleTypeFlagBits(..)
                                                                        , ExternalMemoryHandleTypeFlags
                                                                        , ExternalMemoryFeatureFlagBits(..)
                                                                        , ExternalMemoryFeatureFlags
                                                                        , LUID_SIZE
                                                                        , pattern LUID_SIZE
                                                                        ) 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 (allocaBytesAligned)
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 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.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 Vulkan.Core10.FundamentalTypes (bool32ToBool)
import Vulkan.Core10.FundamentalTypes (boolToBool32)
import Vulkan.CStruct.Utils (peekByteStringFromSizedVectorPtr)
import Vulkan.CStruct.Utils (pokeFixedLengthByteString)
import Vulkan.Core10.FundamentalTypes (Bool32)
import Vulkan.Core10.Enums.BufferCreateFlagBits (BufferCreateFlags)
import Vulkan.Core10.Enums.BufferUsageFlagBits (BufferUsageFlags)
import Vulkan.Core11.Enums.ExternalMemoryFeatureFlagBits (ExternalMemoryFeatureFlags)
import Vulkan.Core11.Enums.ExternalMemoryHandleTypeFlagBits (ExternalMemoryHandleTypeFlagBits)
import Vulkan.Core11.Enums.ExternalMemoryHandleTypeFlagBits (ExternalMemoryHandleTypeFlags)
import Vulkan.Dynamic (InstanceCmds(pVkGetPhysicalDeviceExternalBufferProperties))
import Vulkan.Core10.APIConstants (LUID_SIZE)
import Vulkan.Core10.Handles (PhysicalDevice)
import Vulkan.Core10.Handles (PhysicalDevice(..))
import Vulkan.Core10.Handles (PhysicalDevice_T)
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Core10.APIConstants (UUID_SIZE)
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES))
import Vulkan.Core11.Enums.ExternalMemoryFeatureFlagBits (ExternalMemoryFeatureFlagBits(..))
import Vulkan.Core11.Enums.ExternalMemoryFeatureFlagBits (ExternalMemoryFeatureFlags)
import Vulkan.Core11.Enums.ExternalMemoryHandleTypeFlagBits (ExternalMemoryHandleTypeFlagBits(..))
import Vulkan.Core11.Enums.ExternalMemoryHandleTypeFlagBits (ExternalMemoryHandleTypeFlags)
import Vulkan.Core10.APIConstants (LUID_SIZE)
import Vulkan.Core10.Enums.StructureType (StructureType(..))
import Vulkan.Core10.APIConstants (pattern LUID_SIZE)
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkGetPhysicalDeviceExternalBufferProperties
  :: FunPtr (Ptr PhysicalDevice_T -> Ptr PhysicalDeviceExternalBufferInfo -> Ptr ExternalBufferProperties -> IO ()) -> Ptr PhysicalDevice_T -> Ptr PhysicalDeviceExternalBufferInfo -> Ptr ExternalBufferProperties -> IO ()

-- | vkGetPhysicalDeviceExternalBufferProperties - Query external handle
-- types supported by buffers
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- 'ExternalBufferProperties', 'Vulkan.Core10.Handles.PhysicalDevice',
-- 'PhysicalDeviceExternalBufferInfo'
getPhysicalDeviceExternalBufferProperties :: forall io
                                           . (MonadIO io)
                                          => -- | @physicalDevice@ is the physical device from which to query the buffer
                                             -- capabilities.
                                             --
                                             -- #VUID-vkGetPhysicalDeviceExternalBufferProperties-physicalDevice-parameter#
                                             -- @physicalDevice@ /must/ be a valid
                                             -- 'Vulkan.Core10.Handles.PhysicalDevice' handle
                                             PhysicalDevice
                                          -> -- | @pExternalBufferInfo@ is a pointer to a
                                             -- 'PhysicalDeviceExternalBufferInfo' structure describing the parameters
                                             -- that would be consumed by 'Vulkan.Core10.Buffer.createBuffer'.
                                             --
                                             -- #VUID-vkGetPhysicalDeviceExternalBufferProperties-pExternalBufferInfo-parameter#
                                             -- @pExternalBufferInfo@ /must/ be a valid pointer to a valid
                                             -- 'PhysicalDeviceExternalBufferInfo' structure
                                             PhysicalDeviceExternalBufferInfo
                                          -> io (ExternalBufferProperties)
getPhysicalDeviceExternalBufferProperties :: PhysicalDevice
-> PhysicalDeviceExternalBufferInfo -> io ExternalBufferProperties
getPhysicalDeviceExternalBufferProperties physicalDevice :: PhysicalDevice
physicalDevice externalBufferInfo :: PhysicalDeviceExternalBufferInfo
externalBufferInfo = IO ExternalBufferProperties -> io ExternalBufferProperties
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ExternalBufferProperties -> io ExternalBufferProperties)
-> (ContT ExternalBufferProperties IO ExternalBufferProperties
    -> IO ExternalBufferProperties)
-> ContT ExternalBufferProperties IO ExternalBufferProperties
-> io ExternalBufferProperties
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT ExternalBufferProperties IO ExternalBufferProperties
-> IO ExternalBufferProperties
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT ExternalBufferProperties IO ExternalBufferProperties
 -> io ExternalBufferProperties)
-> ContT ExternalBufferProperties IO ExternalBufferProperties
-> io ExternalBufferProperties
forall a b. (a -> b) -> a -> b
$ do
  let vkGetPhysicalDeviceExternalBufferPropertiesPtr :: FunPtr
  (Ptr PhysicalDevice_T
   -> ("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo)
   -> ("pExternalBufferProperties" ::: Ptr ExternalBufferProperties)
   -> IO ())
vkGetPhysicalDeviceExternalBufferPropertiesPtr = InstanceCmds
-> FunPtr
     (Ptr PhysicalDevice_T
      -> ("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo)
      -> ("pExternalBufferProperties" ::: Ptr ExternalBufferProperties)
      -> IO ())
pVkGetPhysicalDeviceExternalBufferProperties (PhysicalDevice -> InstanceCmds
instanceCmds (PhysicalDevice
physicalDevice :: PhysicalDevice))
  IO () -> ContT ExternalBufferProperties IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT ExternalBufferProperties IO ())
-> IO () -> ContT ExternalBufferProperties IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr PhysicalDevice_T
   -> ("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo)
   -> ("pExternalBufferProperties" ::: Ptr ExternalBufferProperties)
   -> IO ())
vkGetPhysicalDeviceExternalBufferPropertiesPtr FunPtr
  (Ptr PhysicalDevice_T
   -> ("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo)
   -> ("pExternalBufferProperties" ::: Ptr ExternalBufferProperties)
   -> IO ())
-> FunPtr
     (Ptr PhysicalDevice_T
      -> ("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo)
      -> ("pExternalBufferProperties" ::: Ptr ExternalBufferProperties)
      -> IO ())
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr PhysicalDevice_T
   -> ("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo)
   -> ("pExternalBufferProperties" ::: Ptr ExternalBufferProperties)
   -> IO ())
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
    IOException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument "" "The function pointer for vkGetPhysicalDeviceExternalBufferProperties is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkGetPhysicalDeviceExternalBufferProperties' :: Ptr PhysicalDevice_T
-> ("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo)
-> ("pExternalBufferProperties" ::: Ptr ExternalBufferProperties)
-> IO ()
vkGetPhysicalDeviceExternalBufferProperties' = FunPtr
  (Ptr PhysicalDevice_T
   -> ("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo)
   -> ("pExternalBufferProperties" ::: Ptr ExternalBufferProperties)
   -> IO ())
-> Ptr PhysicalDevice_T
-> ("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo)
-> ("pExternalBufferProperties" ::: Ptr ExternalBufferProperties)
-> IO ()
mkVkGetPhysicalDeviceExternalBufferProperties FunPtr
  (Ptr PhysicalDevice_T
   -> ("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo)
   -> ("pExternalBufferProperties" ::: Ptr ExternalBufferProperties)
   -> IO ())
vkGetPhysicalDeviceExternalBufferPropertiesPtr
  "pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo
pExternalBufferInfo <- ((("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo)
  -> IO ExternalBufferProperties)
 -> IO ExternalBufferProperties)
-> ContT
     ExternalBufferProperties
     IO
     ("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo)
   -> IO ExternalBufferProperties)
  -> IO ExternalBufferProperties)
 -> ContT
      ExternalBufferProperties
      IO
      ("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo))
-> ((("pExternalBufferInfo"
      ::: Ptr PhysicalDeviceExternalBufferInfo)
     -> IO ExternalBufferProperties)
    -> IO ExternalBufferProperties)
-> ContT
     ExternalBufferProperties
     IO
     ("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo)
forall a b. (a -> b) -> a -> b
$ PhysicalDeviceExternalBufferInfo
-> (("pExternalBufferInfo"
     ::: Ptr PhysicalDeviceExternalBufferInfo)
    -> IO ExternalBufferProperties)
-> IO ExternalBufferProperties
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (PhysicalDeviceExternalBufferInfo
externalBufferInfo)
  "pExternalBufferProperties" ::: Ptr ExternalBufferProperties
pPExternalBufferProperties <- ((("pExternalBufferProperties" ::: Ptr ExternalBufferProperties)
  -> IO ExternalBufferProperties)
 -> IO ExternalBufferProperties)
-> ContT
     ExternalBufferProperties
     IO
     ("pExternalBufferProperties" ::: Ptr ExternalBufferProperties)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (forall b.
ToCStruct ExternalBufferProperties =>
(("pExternalBufferProperties" ::: Ptr ExternalBufferProperties)
 -> IO b)
-> IO b
forall a b. ToCStruct a => (Ptr a -> IO b) -> IO b
withZeroCStruct @ExternalBufferProperties)
  IO () -> ContT ExternalBufferProperties IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT ExternalBufferProperties IO ())
-> IO () -> ContT ExternalBufferProperties IO ()
forall a b. (a -> b) -> a -> b
$ String -> IO () -> IO ()
forall a. String -> IO a -> IO a
traceAroundEvent "vkGetPhysicalDeviceExternalBufferProperties" (Ptr PhysicalDevice_T
-> ("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo)
-> ("pExternalBufferProperties" ::: Ptr ExternalBufferProperties)
-> IO ()
vkGetPhysicalDeviceExternalBufferProperties' (PhysicalDevice -> Ptr PhysicalDevice_T
physicalDeviceHandle (PhysicalDevice
physicalDevice)) "pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo
pExternalBufferInfo ("pExternalBufferProperties" ::: Ptr ExternalBufferProperties
pPExternalBufferProperties))
  ExternalBufferProperties
pExternalBufferProperties <- IO ExternalBufferProperties
-> ContT ExternalBufferProperties IO ExternalBufferProperties
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ExternalBufferProperties
 -> ContT ExternalBufferProperties IO ExternalBufferProperties)
-> IO ExternalBufferProperties
-> ContT ExternalBufferProperties IO ExternalBufferProperties
forall a b. (a -> b) -> a -> b
$ ("pExternalBufferProperties" ::: Ptr ExternalBufferProperties)
-> IO ExternalBufferProperties
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @ExternalBufferProperties "pExternalBufferProperties" ::: Ptr ExternalBufferProperties
pPExternalBufferProperties
  ExternalBufferProperties
-> ContT ExternalBufferProperties IO ExternalBufferProperties
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ExternalBufferProperties
 -> ContT ExternalBufferProperties IO ExternalBufferProperties)
-> ExternalBufferProperties
-> ContT ExternalBufferProperties IO ExternalBufferProperties
forall a b. (a -> b) -> a -> b
$ (ExternalBufferProperties
pExternalBufferProperties)


-- | VkExternalMemoryProperties - Structure specifying external memory handle
-- type capabilities
--
-- = Description
--
-- @compatibleHandleTypes@ /must/ include at least @handleType@. Inclusion
-- of a handle type in @compatibleHandleTypes@ does not imply the values
-- returned in
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.ImageFormatProperties2'
-- will be the same when
-- 'PhysicalDeviceExternalImageFormatInfo'::@handleType@ is set to that
-- type. The application is responsible for querying the capabilities of
-- all handle types intended for concurrent use in a single image and
-- intersecting them to obtain the compatible set of capabilities.
--
-- = See Also
--
-- 'ExternalBufferProperties', 'ExternalImageFormatProperties',
-- 'Vulkan.Core11.Enums.ExternalMemoryFeatureFlagBits.ExternalMemoryFeatureFlags',
-- 'Vulkan.Core11.Enums.ExternalMemoryHandleTypeFlagBits.ExternalMemoryHandleTypeFlags'
data ExternalMemoryProperties = ExternalMemoryProperties
  { -- | @externalMemoryFeatures@ is a bitmask of
    -- 'Vulkan.Core11.Enums.ExternalMemoryFeatureFlagBits.ExternalMemoryFeatureFlagBits'
    -- specifying the features of @handleType@.
    ExternalMemoryProperties -> ExternalMemoryFeatureFlags
externalMemoryFeatures :: ExternalMemoryFeatureFlags
  , -- | @exportFromImportedHandleTypes@ is a bitmask of
    -- 'Vulkan.Core11.Enums.ExternalMemoryHandleTypeFlagBits.ExternalMemoryHandleTypeFlagBits'
    -- specifying which types of imported handle @handleType@ /can/ be exported
    -- from.
    ExternalMemoryProperties -> ExternalMemoryHandleTypeFlags
exportFromImportedHandleTypes :: ExternalMemoryHandleTypeFlags
  , -- | @compatibleHandleTypes@ is a bitmask of
    -- 'Vulkan.Core11.Enums.ExternalMemoryHandleTypeFlagBits.ExternalMemoryHandleTypeFlagBits'
    -- specifying handle types which /can/ be specified at the same time as
    -- @handleType@ when creating an image compatible with external memory.
    ExternalMemoryProperties -> ExternalMemoryHandleTypeFlags
compatibleHandleTypes :: ExternalMemoryHandleTypeFlags
  }
  deriving (Typeable, ExternalMemoryProperties -> ExternalMemoryProperties -> Bool
(ExternalMemoryProperties -> ExternalMemoryProperties -> Bool)
-> (ExternalMemoryProperties -> ExternalMemoryProperties -> Bool)
-> Eq ExternalMemoryProperties
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExternalMemoryProperties -> ExternalMemoryProperties -> Bool
$c/= :: ExternalMemoryProperties -> ExternalMemoryProperties -> Bool
== :: ExternalMemoryProperties -> ExternalMemoryProperties -> Bool
$c== :: ExternalMemoryProperties -> ExternalMemoryProperties -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ExternalMemoryProperties)
#endif
deriving instance Show ExternalMemoryProperties

instance ToCStruct ExternalMemoryProperties where
  withCStruct :: ExternalMemoryProperties
-> (Ptr ExternalMemoryProperties -> IO b) -> IO b
withCStruct x :: ExternalMemoryProperties
x f :: Ptr ExternalMemoryProperties -> IO b
f = Int -> Int -> (Ptr ExternalMemoryProperties -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 12 4 ((Ptr ExternalMemoryProperties -> IO b) -> IO b)
-> (Ptr ExternalMemoryProperties -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr ExternalMemoryProperties
p -> Ptr ExternalMemoryProperties
-> ExternalMemoryProperties -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr ExternalMemoryProperties
p ExternalMemoryProperties
x (Ptr ExternalMemoryProperties -> IO b
f Ptr ExternalMemoryProperties
p)
  pokeCStruct :: Ptr ExternalMemoryProperties
-> ExternalMemoryProperties -> IO b -> IO b
pokeCStruct p :: Ptr ExternalMemoryProperties
p ExternalMemoryProperties{..} f :: IO b
f = do
    Ptr ExternalMemoryFeatureFlags
-> ExternalMemoryFeatureFlags -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExternalMemoryProperties
p Ptr ExternalMemoryProperties
-> Int -> Ptr ExternalMemoryFeatureFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr ExternalMemoryFeatureFlags)) (ExternalMemoryFeatureFlags
externalMemoryFeatures)
    Ptr ExternalMemoryHandleTypeFlags
-> ExternalMemoryHandleTypeFlags -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExternalMemoryProperties
p Ptr ExternalMemoryProperties
-> Int -> Ptr ExternalMemoryHandleTypeFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4 :: Ptr ExternalMemoryHandleTypeFlags)) (ExternalMemoryHandleTypeFlags
exportFromImportedHandleTypes)
    Ptr ExternalMemoryHandleTypeFlags
-> ExternalMemoryHandleTypeFlags -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExternalMemoryProperties
p Ptr ExternalMemoryProperties
-> Int -> Ptr ExternalMemoryHandleTypeFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr ExternalMemoryHandleTypeFlags)) (ExternalMemoryHandleTypeFlags
compatibleHandleTypes)
    IO b
f
  cStructSize :: Int
cStructSize = 12
  cStructAlignment :: Int
cStructAlignment = 4
  pokeZeroCStruct :: Ptr ExternalMemoryProperties -> IO b -> IO b
pokeZeroCStruct p :: Ptr ExternalMemoryProperties
p f :: IO b
f = do
    Ptr ExternalMemoryFeatureFlags
-> ExternalMemoryFeatureFlags -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExternalMemoryProperties
p Ptr ExternalMemoryProperties
-> Int -> Ptr ExternalMemoryFeatureFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr ExternalMemoryFeatureFlags)) (ExternalMemoryFeatureFlags
forall a. Zero a => a
zero)
    Ptr ExternalMemoryHandleTypeFlags
-> ExternalMemoryHandleTypeFlags -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExternalMemoryProperties
p Ptr ExternalMemoryProperties
-> Int -> Ptr ExternalMemoryHandleTypeFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr ExternalMemoryHandleTypeFlags)) (ExternalMemoryHandleTypeFlags
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct ExternalMemoryProperties where
  peekCStruct :: Ptr ExternalMemoryProperties -> IO ExternalMemoryProperties
peekCStruct p :: Ptr ExternalMemoryProperties
p = do
    ExternalMemoryFeatureFlags
externalMemoryFeatures <- Ptr ExternalMemoryFeatureFlags -> IO ExternalMemoryFeatureFlags
forall a. Storable a => Ptr a -> IO a
peek @ExternalMemoryFeatureFlags ((Ptr ExternalMemoryProperties
p Ptr ExternalMemoryProperties
-> Int -> Ptr ExternalMemoryFeatureFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr ExternalMemoryFeatureFlags))
    ExternalMemoryHandleTypeFlags
exportFromImportedHandleTypes <- Ptr ExternalMemoryHandleTypeFlags
-> IO ExternalMemoryHandleTypeFlags
forall a. Storable a => Ptr a -> IO a
peek @ExternalMemoryHandleTypeFlags ((Ptr ExternalMemoryProperties
p Ptr ExternalMemoryProperties
-> Int -> Ptr ExternalMemoryHandleTypeFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4 :: Ptr ExternalMemoryHandleTypeFlags))
    ExternalMemoryHandleTypeFlags
compatibleHandleTypes <- Ptr ExternalMemoryHandleTypeFlags
-> IO ExternalMemoryHandleTypeFlags
forall a. Storable a => Ptr a -> IO a
peek @ExternalMemoryHandleTypeFlags ((Ptr ExternalMemoryProperties
p Ptr ExternalMemoryProperties
-> Int -> Ptr ExternalMemoryHandleTypeFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr ExternalMemoryHandleTypeFlags))
    ExternalMemoryProperties -> IO ExternalMemoryProperties
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ExternalMemoryProperties -> IO ExternalMemoryProperties)
-> ExternalMemoryProperties -> IO ExternalMemoryProperties
forall a b. (a -> b) -> a -> b
$ ExternalMemoryFeatureFlags
-> ExternalMemoryHandleTypeFlags
-> ExternalMemoryHandleTypeFlags
-> ExternalMemoryProperties
ExternalMemoryProperties
             ExternalMemoryFeatureFlags
externalMemoryFeatures ExternalMemoryHandleTypeFlags
exportFromImportedHandleTypes ExternalMemoryHandleTypeFlags
compatibleHandleTypes

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

instance Zero ExternalMemoryProperties where
  zero :: ExternalMemoryProperties
zero = ExternalMemoryFeatureFlags
-> ExternalMemoryHandleTypeFlags
-> ExternalMemoryHandleTypeFlags
-> ExternalMemoryProperties
ExternalMemoryProperties
           ExternalMemoryFeatureFlags
forall a. Zero a => a
zero
           ExternalMemoryHandleTypeFlags
forall a. Zero a => a
zero
           ExternalMemoryHandleTypeFlags
forall a. Zero a => a
zero


-- | VkPhysicalDeviceExternalImageFormatInfo - Structure specifying external
-- image creation parameters
--
-- = Description
--
-- If @handleType@ is 0,
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.getPhysicalDeviceImageFormatProperties2'
-- will behave as if 'PhysicalDeviceExternalImageFormatInfo' was not
-- present, and 'ExternalImageFormatProperties' will be ignored.
--
-- If @handleType@ is not compatible with the @format@, @type@, @tiling@,
-- @usage@, and @flags@ specified in
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceImageFormatInfo2',
-- then
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.getPhysicalDeviceImageFormatProperties2'
-- returns 'Vulkan.Core10.Enums.Result.ERROR_FORMAT_NOT_SUPPORTED'.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkPhysicalDeviceExternalImageFormatInfo-sType-sType# @sType@
--     /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO'
--
-- -   #VUID-VkPhysicalDeviceExternalImageFormatInfo-handleType-parameter#
--     If @handleType@ is not @0@, @handleType@ /must/ be a valid
--     'Vulkan.Core11.Enums.ExternalMemoryHandleTypeFlagBits.ExternalMemoryHandleTypeFlagBits'
--     value
--
-- = See Also
--
-- 'Vulkan.Core11.Enums.ExternalMemoryHandleTypeFlagBits.ExternalMemoryHandleTypeFlagBits',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PhysicalDeviceExternalImageFormatInfo = PhysicalDeviceExternalImageFormatInfo
  { -- | @handleType@ is a
    -- 'Vulkan.Core11.Enums.ExternalMemoryHandleTypeFlagBits.ExternalMemoryHandleTypeFlagBits'
    -- value specifying the memory handle type that will be used with the
    -- memory associated with the image.
    PhysicalDeviceExternalImageFormatInfo
-> ExternalMemoryHandleTypeFlags
handleType :: ExternalMemoryHandleTypeFlagBits }
  deriving (Typeable, PhysicalDeviceExternalImageFormatInfo
-> PhysicalDeviceExternalImageFormatInfo -> Bool
(PhysicalDeviceExternalImageFormatInfo
 -> PhysicalDeviceExternalImageFormatInfo -> Bool)
-> (PhysicalDeviceExternalImageFormatInfo
    -> PhysicalDeviceExternalImageFormatInfo -> Bool)
-> Eq PhysicalDeviceExternalImageFormatInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhysicalDeviceExternalImageFormatInfo
-> PhysicalDeviceExternalImageFormatInfo -> Bool
$c/= :: PhysicalDeviceExternalImageFormatInfo
-> PhysicalDeviceExternalImageFormatInfo -> Bool
== :: PhysicalDeviceExternalImageFormatInfo
-> PhysicalDeviceExternalImageFormatInfo -> Bool
$c== :: PhysicalDeviceExternalImageFormatInfo
-> PhysicalDeviceExternalImageFormatInfo -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceExternalImageFormatInfo)
#endif
deriving instance Show PhysicalDeviceExternalImageFormatInfo

instance ToCStruct PhysicalDeviceExternalImageFormatInfo where
  withCStruct :: PhysicalDeviceExternalImageFormatInfo
-> (Ptr PhysicalDeviceExternalImageFormatInfo -> IO b) -> IO b
withCStruct x :: PhysicalDeviceExternalImageFormatInfo
x f :: Ptr PhysicalDeviceExternalImageFormatInfo -> IO b
f = Int
-> Int
-> (Ptr PhysicalDeviceExternalImageFormatInfo -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 24 8 ((Ptr PhysicalDeviceExternalImageFormatInfo -> IO b) -> IO b)
-> (Ptr PhysicalDeviceExternalImageFormatInfo -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr PhysicalDeviceExternalImageFormatInfo
p -> Ptr PhysicalDeviceExternalImageFormatInfo
-> PhysicalDeviceExternalImageFormatInfo -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceExternalImageFormatInfo
p PhysicalDeviceExternalImageFormatInfo
x (Ptr PhysicalDeviceExternalImageFormatInfo -> IO b
f Ptr PhysicalDeviceExternalImageFormatInfo
p)
  pokeCStruct :: Ptr PhysicalDeviceExternalImageFormatInfo
-> PhysicalDeviceExternalImageFormatInfo -> IO b -> IO b
pokeCStruct p :: Ptr PhysicalDeviceExternalImageFormatInfo
p PhysicalDeviceExternalImageFormatInfo{..} f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceExternalImageFormatInfo
p Ptr PhysicalDeviceExternalImageFormatInfo
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceExternalImageFormatInfo
p Ptr PhysicalDeviceExternalImageFormatInfo -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr ExternalMemoryHandleTypeFlags
-> ExternalMemoryHandleTypeFlags -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceExternalImageFormatInfo
p Ptr PhysicalDeviceExternalImageFormatInfo
-> Int -> Ptr ExternalMemoryHandleTypeFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr ExternalMemoryHandleTypeFlagBits)) (ExternalMemoryHandleTypeFlags
handleType)
    IO b
f
  cStructSize :: Int
cStructSize = 24
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr PhysicalDeviceExternalImageFormatInfo -> IO b -> IO b
pokeZeroCStruct p :: Ptr PhysicalDeviceExternalImageFormatInfo
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceExternalImageFormatInfo
p Ptr PhysicalDeviceExternalImageFormatInfo
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceExternalImageFormatInfo
p Ptr PhysicalDeviceExternalImageFormatInfo -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    IO b
f

instance FromCStruct PhysicalDeviceExternalImageFormatInfo where
  peekCStruct :: Ptr PhysicalDeviceExternalImageFormatInfo
-> IO PhysicalDeviceExternalImageFormatInfo
peekCStruct p :: Ptr PhysicalDeviceExternalImageFormatInfo
p = do
    ExternalMemoryHandleTypeFlags
handleType <- Ptr ExternalMemoryHandleTypeFlags
-> IO ExternalMemoryHandleTypeFlags
forall a. Storable a => Ptr a -> IO a
peek @ExternalMemoryHandleTypeFlagBits ((Ptr PhysicalDeviceExternalImageFormatInfo
p Ptr PhysicalDeviceExternalImageFormatInfo
-> Int -> Ptr ExternalMemoryHandleTypeFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr ExternalMemoryHandleTypeFlagBits))
    PhysicalDeviceExternalImageFormatInfo
-> IO PhysicalDeviceExternalImageFormatInfo
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PhysicalDeviceExternalImageFormatInfo
 -> IO PhysicalDeviceExternalImageFormatInfo)
-> PhysicalDeviceExternalImageFormatInfo
-> IO PhysicalDeviceExternalImageFormatInfo
forall a b. (a -> b) -> a -> b
$ ExternalMemoryHandleTypeFlags
-> PhysicalDeviceExternalImageFormatInfo
PhysicalDeviceExternalImageFormatInfo
             ExternalMemoryHandleTypeFlags
handleType

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

instance Zero PhysicalDeviceExternalImageFormatInfo where
  zero :: PhysicalDeviceExternalImageFormatInfo
zero = ExternalMemoryHandleTypeFlags
-> PhysicalDeviceExternalImageFormatInfo
PhysicalDeviceExternalImageFormatInfo
           ExternalMemoryHandleTypeFlags
forall a. Zero a => a
zero


-- | VkExternalImageFormatProperties - Structure specifying supported
-- external handle properties
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- 'ExternalMemoryProperties',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data ExternalImageFormatProperties = ExternalImageFormatProperties
  { -- | @externalMemoryProperties@ is a 'ExternalMemoryProperties' structure
    -- specifying various capabilities of the external handle type when used
    -- with the specified image creation parameters.
    ExternalImageFormatProperties -> ExternalMemoryProperties
externalMemoryProperties :: ExternalMemoryProperties }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ExternalImageFormatProperties)
#endif
deriving instance Show ExternalImageFormatProperties

instance ToCStruct ExternalImageFormatProperties where
  withCStruct :: ExternalImageFormatProperties
-> (Ptr ExternalImageFormatProperties -> IO b) -> IO b
withCStruct x :: ExternalImageFormatProperties
x f :: Ptr ExternalImageFormatProperties -> IO b
f = Int -> Int -> (Ptr ExternalImageFormatProperties -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 32 8 ((Ptr ExternalImageFormatProperties -> IO b) -> IO b)
-> (Ptr ExternalImageFormatProperties -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr ExternalImageFormatProperties
p -> Ptr ExternalImageFormatProperties
-> ExternalImageFormatProperties -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr ExternalImageFormatProperties
p ExternalImageFormatProperties
x (Ptr ExternalImageFormatProperties -> IO b
f Ptr ExternalImageFormatProperties
p)
  pokeCStruct :: Ptr ExternalImageFormatProperties
-> ExternalImageFormatProperties -> IO b -> IO b
pokeCStruct p :: Ptr ExternalImageFormatProperties
p ExternalImageFormatProperties{..} f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExternalImageFormatProperties
p Ptr ExternalImageFormatProperties -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExternalImageFormatProperties
p Ptr ExternalImageFormatProperties -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr ExternalMemoryProperties -> ExternalMemoryProperties -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExternalImageFormatProperties
p Ptr ExternalImageFormatProperties
-> Int -> Ptr ExternalMemoryProperties
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr ExternalMemoryProperties)) (ExternalMemoryProperties
externalMemoryProperties)
    IO b
f
  cStructSize :: Int
cStructSize = 32
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr ExternalImageFormatProperties -> IO b -> IO b
pokeZeroCStruct p :: Ptr ExternalImageFormatProperties
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExternalImageFormatProperties
p Ptr ExternalImageFormatProperties -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExternalImageFormatProperties
p Ptr ExternalImageFormatProperties -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr ExternalMemoryProperties -> ExternalMemoryProperties -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExternalImageFormatProperties
p Ptr ExternalImageFormatProperties
-> Int -> Ptr ExternalMemoryProperties
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr ExternalMemoryProperties)) (ExternalMemoryProperties
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct ExternalImageFormatProperties where
  peekCStruct :: Ptr ExternalImageFormatProperties
-> IO ExternalImageFormatProperties
peekCStruct p :: Ptr ExternalImageFormatProperties
p = do
    ExternalMemoryProperties
externalMemoryProperties <- Ptr ExternalMemoryProperties -> IO ExternalMemoryProperties
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @ExternalMemoryProperties ((Ptr ExternalImageFormatProperties
p Ptr ExternalImageFormatProperties
-> Int -> Ptr ExternalMemoryProperties
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr ExternalMemoryProperties))
    ExternalImageFormatProperties -> IO ExternalImageFormatProperties
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ExternalImageFormatProperties -> IO ExternalImageFormatProperties)
-> ExternalImageFormatProperties
-> IO ExternalImageFormatProperties
forall a b. (a -> b) -> a -> b
$ ExternalMemoryProperties -> ExternalImageFormatProperties
ExternalImageFormatProperties
             ExternalMemoryProperties
externalMemoryProperties

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

instance Zero ExternalImageFormatProperties where
  zero :: ExternalImageFormatProperties
zero = ExternalMemoryProperties -> ExternalImageFormatProperties
ExternalImageFormatProperties
           ExternalMemoryProperties
forall a. Zero a => a
zero


-- | VkPhysicalDeviceExternalBufferInfo - Structure specifying buffer
-- creation parameters
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- 'Vulkan.Core10.Enums.BufferCreateFlagBits.BufferCreateFlags',
-- 'Vulkan.Core10.Enums.BufferUsageFlagBits.BufferUsageFlags',
-- 'Vulkan.Core11.Enums.ExternalMemoryHandleTypeFlagBits.ExternalMemoryHandleTypeFlagBits',
-- 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'getPhysicalDeviceExternalBufferProperties',
-- 'Vulkan.Extensions.VK_KHR_external_memory_capabilities.getPhysicalDeviceExternalBufferPropertiesKHR'
data PhysicalDeviceExternalBufferInfo = PhysicalDeviceExternalBufferInfo
  { -- | @flags@ is a bitmask of
    -- 'Vulkan.Core10.Enums.BufferCreateFlagBits.BufferCreateFlagBits'
    -- describing additional parameters of the buffer, corresponding to
    -- 'Vulkan.Core10.Buffer.BufferCreateInfo'::@flags@.
    --
    -- #VUID-VkPhysicalDeviceExternalBufferInfo-flags-parameter# @flags@ /must/
    -- be a valid combination of
    -- 'Vulkan.Core10.Enums.BufferCreateFlagBits.BufferCreateFlagBits' values
    PhysicalDeviceExternalBufferInfo -> BufferCreateFlags
flags :: BufferCreateFlags
  , -- | @usage@ is a bitmask of
    -- 'Vulkan.Core10.Enums.BufferUsageFlagBits.BufferUsageFlagBits' describing
    -- the intended usage of the buffer, corresponding to
    -- 'Vulkan.Core10.Buffer.BufferCreateInfo'::@usage@.
    --
    -- #VUID-VkPhysicalDeviceExternalBufferInfo-usage-parameter# @usage@ /must/
    -- be a valid combination of
    -- 'Vulkan.Core10.Enums.BufferUsageFlagBits.BufferUsageFlagBits' values
    --
    -- #VUID-VkPhysicalDeviceExternalBufferInfo-usage-requiredbitmask# @usage@
    -- /must/ not be @0@
    PhysicalDeviceExternalBufferInfo -> BufferUsageFlags
usage :: BufferUsageFlags
  , -- | @handleType@ is a
    -- 'Vulkan.Core11.Enums.ExternalMemoryHandleTypeFlagBits.ExternalMemoryHandleTypeFlagBits'
    -- value specifying the memory handle type that will be used with the
    -- memory associated with the buffer.
    --
    -- #VUID-VkPhysicalDeviceExternalBufferInfo-handleType-parameter#
    -- @handleType@ /must/ be a valid
    -- 'Vulkan.Core11.Enums.ExternalMemoryHandleTypeFlagBits.ExternalMemoryHandleTypeFlagBits'
    -- value
    PhysicalDeviceExternalBufferInfo -> ExternalMemoryHandleTypeFlags
handleType :: ExternalMemoryHandleTypeFlagBits
  }
  deriving (Typeable, PhysicalDeviceExternalBufferInfo
-> PhysicalDeviceExternalBufferInfo -> Bool
(PhysicalDeviceExternalBufferInfo
 -> PhysicalDeviceExternalBufferInfo -> Bool)
-> (PhysicalDeviceExternalBufferInfo
    -> PhysicalDeviceExternalBufferInfo -> Bool)
-> Eq PhysicalDeviceExternalBufferInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhysicalDeviceExternalBufferInfo
-> PhysicalDeviceExternalBufferInfo -> Bool
$c/= :: PhysicalDeviceExternalBufferInfo
-> PhysicalDeviceExternalBufferInfo -> Bool
== :: PhysicalDeviceExternalBufferInfo
-> PhysicalDeviceExternalBufferInfo -> Bool
$c== :: PhysicalDeviceExternalBufferInfo
-> PhysicalDeviceExternalBufferInfo -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceExternalBufferInfo)
#endif
deriving instance Show PhysicalDeviceExternalBufferInfo

instance ToCStruct PhysicalDeviceExternalBufferInfo where
  withCStruct :: PhysicalDeviceExternalBufferInfo
-> (("pExternalBufferInfo"
     ::: Ptr PhysicalDeviceExternalBufferInfo)
    -> IO b)
-> IO b
withCStruct x :: PhysicalDeviceExternalBufferInfo
x f :: ("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo)
-> IO b
f = Int
-> Int
-> (("pExternalBufferInfo"
     ::: Ptr PhysicalDeviceExternalBufferInfo)
    -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 32 8 ((("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo)
  -> IO b)
 -> IO b)
-> (("pExternalBufferInfo"
     ::: Ptr PhysicalDeviceExternalBufferInfo)
    -> IO b)
-> IO b
forall a b. (a -> b) -> a -> b
$ \p :: "pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo
p -> ("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo)
-> PhysicalDeviceExternalBufferInfo -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo
p PhysicalDeviceExternalBufferInfo
x (("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo)
-> IO b
f "pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo
p)
  pokeCStruct :: ("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo)
-> PhysicalDeviceExternalBufferInfo -> IO b -> IO b
pokeCStruct p :: "pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo
p PhysicalDeviceExternalBufferInfo{..} f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo
p ("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo
p ("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr BufferCreateFlags -> BufferCreateFlags -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo
p ("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo)
-> Int -> Ptr BufferCreateFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr BufferCreateFlags)) (BufferCreateFlags
flags)
    Ptr BufferUsageFlags -> BufferUsageFlags -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo
p ("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo)
-> Int -> Ptr BufferUsageFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr BufferUsageFlags)) (BufferUsageFlags
usage)
    Ptr ExternalMemoryHandleTypeFlags
-> ExternalMemoryHandleTypeFlags -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo
p ("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo)
-> Int -> Ptr ExternalMemoryHandleTypeFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr ExternalMemoryHandleTypeFlagBits)) (ExternalMemoryHandleTypeFlags
handleType)
    IO b
f
  cStructSize :: Int
cStructSize = 32
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: ("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo)
-> IO b -> IO b
pokeZeroCStruct p :: "pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo
p ("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo
p ("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr BufferUsageFlags -> BufferUsageFlags -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo
p ("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo)
-> Int -> Ptr BufferUsageFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr BufferUsageFlags)) (BufferUsageFlags
forall a. Zero a => a
zero)
    Ptr ExternalMemoryHandleTypeFlags
-> ExternalMemoryHandleTypeFlags -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo
p ("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo)
-> Int -> Ptr ExternalMemoryHandleTypeFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr ExternalMemoryHandleTypeFlagBits)) (ExternalMemoryHandleTypeFlags
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct PhysicalDeviceExternalBufferInfo where
  peekCStruct :: ("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo)
-> IO PhysicalDeviceExternalBufferInfo
peekCStruct p :: "pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo
p = do
    BufferCreateFlags
flags <- Ptr BufferCreateFlags -> IO BufferCreateFlags
forall a. Storable a => Ptr a -> IO a
peek @BufferCreateFlags (("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo
p ("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo)
-> Int -> Ptr BufferCreateFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr BufferCreateFlags))
    BufferUsageFlags
usage <- Ptr BufferUsageFlags -> IO BufferUsageFlags
forall a. Storable a => Ptr a -> IO a
peek @BufferUsageFlags (("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo
p ("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo)
-> Int -> Ptr BufferUsageFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr BufferUsageFlags))
    ExternalMemoryHandleTypeFlags
handleType <- Ptr ExternalMemoryHandleTypeFlags
-> IO ExternalMemoryHandleTypeFlags
forall a. Storable a => Ptr a -> IO a
peek @ExternalMemoryHandleTypeFlagBits (("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo
p ("pExternalBufferInfo" ::: Ptr PhysicalDeviceExternalBufferInfo)
-> Int -> Ptr ExternalMemoryHandleTypeFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr ExternalMemoryHandleTypeFlagBits))
    PhysicalDeviceExternalBufferInfo
-> IO PhysicalDeviceExternalBufferInfo
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PhysicalDeviceExternalBufferInfo
 -> IO PhysicalDeviceExternalBufferInfo)
-> PhysicalDeviceExternalBufferInfo
-> IO PhysicalDeviceExternalBufferInfo
forall a b. (a -> b) -> a -> b
$ BufferCreateFlags
-> BufferUsageFlags
-> ExternalMemoryHandleTypeFlags
-> PhysicalDeviceExternalBufferInfo
PhysicalDeviceExternalBufferInfo
             BufferCreateFlags
flags BufferUsageFlags
usage ExternalMemoryHandleTypeFlags
handleType

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

instance Zero PhysicalDeviceExternalBufferInfo where
  zero :: PhysicalDeviceExternalBufferInfo
zero = BufferCreateFlags
-> BufferUsageFlags
-> ExternalMemoryHandleTypeFlags
-> PhysicalDeviceExternalBufferInfo
PhysicalDeviceExternalBufferInfo
           BufferCreateFlags
forall a. Zero a => a
zero
           BufferUsageFlags
forall a. Zero a => a
zero
           ExternalMemoryHandleTypeFlags
forall a. Zero a => a
zero


-- | VkExternalBufferProperties - Structure specifying supported external
-- handle capabilities
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- 'ExternalMemoryProperties',
-- 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'getPhysicalDeviceExternalBufferProperties',
-- 'Vulkan.Extensions.VK_KHR_external_memory_capabilities.getPhysicalDeviceExternalBufferPropertiesKHR'
data ExternalBufferProperties = ExternalBufferProperties
  { -- | @externalMemoryProperties@ is a 'ExternalMemoryProperties' structure
    -- specifying various capabilities of the external handle type when used
    -- with the specified buffer creation parameters.
    ExternalBufferProperties -> ExternalMemoryProperties
externalMemoryProperties :: ExternalMemoryProperties }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ExternalBufferProperties)
#endif
deriving instance Show ExternalBufferProperties

instance ToCStruct ExternalBufferProperties where
  withCStruct :: ExternalBufferProperties
-> (("pExternalBufferProperties" ::: Ptr ExternalBufferProperties)
    -> IO b)
-> IO b
withCStruct x :: ExternalBufferProperties
x f :: ("pExternalBufferProperties" ::: Ptr ExternalBufferProperties)
-> IO b
f = Int
-> Int
-> (("pExternalBufferProperties" ::: Ptr ExternalBufferProperties)
    -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 32 8 ((("pExternalBufferProperties" ::: Ptr ExternalBufferProperties)
  -> IO b)
 -> IO b)
-> (("pExternalBufferProperties" ::: Ptr ExternalBufferProperties)
    -> IO b)
-> IO b
forall a b. (a -> b) -> a -> b
$ \p :: "pExternalBufferProperties" ::: Ptr ExternalBufferProperties
p -> ("pExternalBufferProperties" ::: Ptr ExternalBufferProperties)
-> ExternalBufferProperties -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pExternalBufferProperties" ::: Ptr ExternalBufferProperties
p ExternalBufferProperties
x (("pExternalBufferProperties" ::: Ptr ExternalBufferProperties)
-> IO b
f "pExternalBufferProperties" ::: Ptr ExternalBufferProperties
p)
  pokeCStruct :: ("pExternalBufferProperties" ::: Ptr ExternalBufferProperties)
-> ExternalBufferProperties -> IO b -> IO b
pokeCStruct p :: "pExternalBufferProperties" ::: Ptr ExternalBufferProperties
p ExternalBufferProperties{..} f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalBufferProperties" ::: Ptr ExternalBufferProperties
p ("pExternalBufferProperties" ::: Ptr ExternalBufferProperties)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalBufferProperties" ::: Ptr ExternalBufferProperties
p ("pExternalBufferProperties" ::: Ptr ExternalBufferProperties)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr ExternalMemoryProperties -> ExternalMemoryProperties -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalBufferProperties" ::: Ptr ExternalBufferProperties
p ("pExternalBufferProperties" ::: Ptr ExternalBufferProperties)
-> Int -> Ptr ExternalMemoryProperties
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr ExternalMemoryProperties)) (ExternalMemoryProperties
externalMemoryProperties)
    IO b
f
  cStructSize :: Int
cStructSize = 32
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: ("pExternalBufferProperties" ::: Ptr ExternalBufferProperties)
-> IO b -> IO b
pokeZeroCStruct p :: "pExternalBufferProperties" ::: Ptr ExternalBufferProperties
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalBufferProperties" ::: Ptr ExternalBufferProperties
p ("pExternalBufferProperties" ::: Ptr ExternalBufferProperties)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalBufferProperties" ::: Ptr ExternalBufferProperties
p ("pExternalBufferProperties" ::: Ptr ExternalBufferProperties)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr ExternalMemoryProperties -> ExternalMemoryProperties -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalBufferProperties" ::: Ptr ExternalBufferProperties
p ("pExternalBufferProperties" ::: Ptr ExternalBufferProperties)
-> Int -> Ptr ExternalMemoryProperties
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr ExternalMemoryProperties)) (ExternalMemoryProperties
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct ExternalBufferProperties where
  peekCStruct :: ("pExternalBufferProperties" ::: Ptr ExternalBufferProperties)
-> IO ExternalBufferProperties
peekCStruct p :: "pExternalBufferProperties" ::: Ptr ExternalBufferProperties
p = do
    ExternalMemoryProperties
externalMemoryProperties <- Ptr ExternalMemoryProperties -> IO ExternalMemoryProperties
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @ExternalMemoryProperties (("pExternalBufferProperties" ::: Ptr ExternalBufferProperties
p ("pExternalBufferProperties" ::: Ptr ExternalBufferProperties)
-> Int -> Ptr ExternalMemoryProperties
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr ExternalMemoryProperties))
    ExternalBufferProperties -> IO ExternalBufferProperties
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ExternalBufferProperties -> IO ExternalBufferProperties)
-> ExternalBufferProperties -> IO ExternalBufferProperties
forall a b. (a -> b) -> a -> b
$ ExternalMemoryProperties -> ExternalBufferProperties
ExternalBufferProperties
             ExternalMemoryProperties
externalMemoryProperties

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

instance Zero ExternalBufferProperties where
  zero :: ExternalBufferProperties
zero = ExternalMemoryProperties -> ExternalBufferProperties
ExternalBufferProperties
           ExternalMemoryProperties
forall a. Zero a => a
zero


-- | VkPhysicalDeviceIDProperties - Structure specifying IDs related to the
-- physical device
--
-- = Description
--
-- -   @deviceUUID@ is an array of 'Vulkan.Core10.APIConstants.UUID_SIZE'
--     @uint8_t@ values representing a universally unique identifier for
--     the device.
--
-- -   @driverUUID@ is an array of 'Vulkan.Core10.APIConstants.UUID_SIZE'
--     @uint8_t@ values representing a universally unique identifier for
--     the driver build in use by the device.
--
-- -   @deviceLUID@ is an array of 'Vulkan.Core10.APIConstants.LUID_SIZE'
--     @uint8_t@ values representing a locally unique identifier for the
--     device.
--
-- -   @deviceNodeMask@ is a @uint32_t@ bitfield identifying the node
--     within a linked device adapter corresponding to the device.
--
-- -   @deviceLUIDValid@ is a boolean value that will be
--     'Vulkan.Core10.FundamentalTypes.TRUE' if @deviceLUID@ contains a
--     valid LUID and @deviceNodeMask@ contains a valid node mask, and
--     'Vulkan.Core10.FundamentalTypes.FALSE' if they do not.
--
-- @deviceUUID@ /must/ be immutable for a given device across instances,
-- processes, driver APIs, driver versions, and system reboots.
--
-- Applications /can/ compare the @driverUUID@ value across instance and
-- process boundaries, and /can/ make similar queries in external APIs to
-- determine whether they are capable of sharing memory objects and
-- resources using them with the device.
--
-- @deviceUUID@ and\/or @driverUUID@ /must/ be used to determine whether a
-- particular external object can be shared between driver components,
-- where such a restriction exists as defined in the compatibility table
-- for the particular object type:
--
-- -   <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#external-memory-handle-types-compatibility External memory handle types compatibility>
--
-- -   <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#external-semaphore-handle-types-compatibility External semaphore handle types compatibility>
--
-- -   <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#external-fence-handle-types-compatibility External fence handle types compatibility>
--
-- If @deviceLUIDValid@ is 'Vulkan.Core10.FundamentalTypes.FALSE', the
-- values of @deviceLUID@ and @deviceNodeMask@ are undefined. If
-- @deviceLUIDValid@ is 'Vulkan.Core10.FundamentalTypes.TRUE' and Vulkan is
-- running on the Windows operating system, the contents of @deviceLUID@
-- /can/ be cast to an @LUID@ object and /must/ be equal to the locally
-- unique identifier of a @IDXGIAdapter1@ object that corresponds to
-- @physicalDevice@. If @deviceLUIDValid@ is
-- 'Vulkan.Core10.FundamentalTypes.TRUE', @deviceNodeMask@ /must/ contain
-- exactly one bit. If Vulkan is running on an operating system that
-- supports the Direct3D 12 API and @physicalDevice@ corresponds to an
-- individual device in a linked device adapter, @deviceNodeMask@
-- identifies the Direct3D 12 node corresponding to @physicalDevice@.
-- Otherwise, @deviceNodeMask@ /must/ be @1@.
--
-- Note
--
-- Although they have identical descriptions,
-- 'PhysicalDeviceIDProperties'::@deviceUUID@ may differ from
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceProperties2'::@pipelineCacheUUID@.
-- The former is intended to identify and correlate devices across API and
-- driver boundaries, while the latter is used to identify a compatible
-- device and driver combination to use when serializing and de-serializing
-- pipeline state.
--
-- Implementations /should/ return @deviceUUID@ values which are likely to
-- be unique even in the presence of multiple Vulkan implementations (such
-- as a GPU driver and a software renderer; two drivers for different GPUs;
-- or the same Vulkan driver running on two logically different devices).
--
-- Khronos\' conformance testing can not guarantee that @deviceUUID@ values
-- are actually unique, so implementors should make their own best efforts
-- to ensure this. In particular, hard-coded @deviceUUID@ values,
-- especially all-@0@ bits, /should/ never be used.
--
-- A combination of values unique to the vendor, the driver, and the
-- hardware environment can be used to provide a @deviceUUID@ which is
-- unique to a high degree of certainty. Some possible inputs to such a
-- computation are:
--
-- -   Information reported by
--     'Vulkan.Core10.DeviceInitialization.getPhysicalDeviceProperties'
--
-- -   PCI device ID (if defined)
--
-- -   PCI bus ID, or similar system configuration information.
--
-- -   Driver binary checksums.
--
-- Note
--
-- While 'PhysicalDeviceIDProperties'::@deviceUUID@ is specified to remain
-- consistent across driver versions and system reboots, it is not intended
-- to be usable as a serializable persistent identifier for a device. It
-- may change when a device is physically added to, removed from, or moved
-- to a different connector in a system while that system is powered down.
-- Further, there is no reasonable way to verify with conformance testing
-- that a given device retains the same UUID in a given system across all
-- driver versions supported in that system. While implementations should
-- make every effort to report consistent device UUIDs across driver
-- versions, applications should avoid relying on the persistence of this
-- value for uses other than identifying compatible devices for external
-- object sharing purposes.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkPhysicalDeviceIDProperties-sType-sType# @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES'
--
-- = See Also
--
-- 'Vulkan.Core10.FundamentalTypes.Bool32',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PhysicalDeviceIDProperties = PhysicalDeviceIDProperties
  { -- No documentation found for Nested "VkPhysicalDeviceIDProperties" "deviceUUID"
    PhysicalDeviceIDProperties -> ByteString
deviceUUID :: ByteString
  , -- No documentation found for Nested "VkPhysicalDeviceIDProperties" "driverUUID"
    PhysicalDeviceIDProperties -> ByteString
driverUUID :: ByteString
  , -- No documentation found for Nested "VkPhysicalDeviceIDProperties" "deviceLUID"
    PhysicalDeviceIDProperties -> ByteString
deviceLUID :: ByteString
  , -- No documentation found for Nested "VkPhysicalDeviceIDProperties" "deviceNodeMask"
    PhysicalDeviceIDProperties -> Word32
deviceNodeMask :: Word32
  , -- No documentation found for Nested "VkPhysicalDeviceIDProperties" "deviceLUIDValid"
    PhysicalDeviceIDProperties -> Bool
deviceLUIDValid :: Bool
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceIDProperties)
#endif
deriving instance Show PhysicalDeviceIDProperties

instance ToCStruct PhysicalDeviceIDProperties where
  withCStruct :: PhysicalDeviceIDProperties
-> (Ptr PhysicalDeviceIDProperties -> IO b) -> IO b
withCStruct x :: PhysicalDeviceIDProperties
x f :: Ptr PhysicalDeviceIDProperties -> IO b
f = Int -> Int -> (Ptr PhysicalDeviceIDProperties -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 64 8 ((Ptr PhysicalDeviceIDProperties -> IO b) -> IO b)
-> (Ptr PhysicalDeviceIDProperties -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr PhysicalDeviceIDProperties
p -> Ptr PhysicalDeviceIDProperties
-> PhysicalDeviceIDProperties -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceIDProperties
p PhysicalDeviceIDProperties
x (Ptr PhysicalDeviceIDProperties -> IO b
f Ptr PhysicalDeviceIDProperties
p)
  pokeCStruct :: Ptr PhysicalDeviceIDProperties
-> PhysicalDeviceIDProperties -> IO b -> IO b
pokeCStruct p :: Ptr PhysicalDeviceIDProperties
p PhysicalDeviceIDProperties{..} f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceIDProperties
p Ptr PhysicalDeviceIDProperties -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceIDProperties
p Ptr PhysicalDeviceIDProperties -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr (FixedArray UUID_SIZE Word8) -> ByteString -> IO ()
forall (n :: Nat).
KnownNat n =>
Ptr (FixedArray n Word8) -> ByteString -> IO ()
pokeFixedLengthByteString ((Ptr PhysicalDeviceIDProperties
p Ptr PhysicalDeviceIDProperties
-> Int -> Ptr (FixedArray UUID_SIZE Word8)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr (FixedArray UUID_SIZE Word8))) (ByteString
deviceUUID)
    Ptr (FixedArray UUID_SIZE Word8) -> ByteString -> IO ()
forall (n :: Nat).
KnownNat n =>
Ptr (FixedArray n Word8) -> ByteString -> IO ()
pokeFixedLengthByteString ((Ptr PhysicalDeviceIDProperties
p Ptr PhysicalDeviceIDProperties
-> Int -> Ptr (FixedArray UUID_SIZE Word8)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr (FixedArray UUID_SIZE Word8))) (ByteString
driverUUID)
    Ptr (FixedArray LUID_SIZE Word8) -> ByteString -> IO ()
forall (n :: Nat).
KnownNat n =>
Ptr (FixedArray n Word8) -> ByteString -> IO ()
pokeFixedLengthByteString ((Ptr PhysicalDeviceIDProperties
p Ptr PhysicalDeviceIDProperties
-> Int -> Ptr (FixedArray LUID_SIZE Word8)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 48 :: Ptr (FixedArray LUID_SIZE Word8))) (ByteString
deviceLUID)
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceIDProperties
p Ptr PhysicalDeviceIDProperties -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 56 :: Ptr Word32)) (Word32
deviceNodeMask)
    Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceIDProperties
p Ptr PhysicalDeviceIDProperties -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 60 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
deviceLUIDValid))
    IO b
f
  cStructSize :: Int
cStructSize = 64
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr PhysicalDeviceIDProperties -> IO b -> IO b
pokeZeroCStruct p :: Ptr PhysicalDeviceIDProperties
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceIDProperties
p Ptr PhysicalDeviceIDProperties -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceIDProperties
p Ptr PhysicalDeviceIDProperties -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr (FixedArray UUID_SIZE Word8) -> ByteString -> IO ()
forall (n :: Nat).
KnownNat n =>
Ptr (FixedArray n Word8) -> ByteString -> IO ()
pokeFixedLengthByteString ((Ptr PhysicalDeviceIDProperties
p Ptr PhysicalDeviceIDProperties
-> Int -> Ptr (FixedArray UUID_SIZE Word8)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr (FixedArray UUID_SIZE Word8))) (ByteString
forall a. Monoid a => a
mempty)
    Ptr (FixedArray UUID_SIZE Word8) -> ByteString -> IO ()
forall (n :: Nat).
KnownNat n =>
Ptr (FixedArray n Word8) -> ByteString -> IO ()
pokeFixedLengthByteString ((Ptr PhysicalDeviceIDProperties
p Ptr PhysicalDeviceIDProperties
-> Int -> Ptr (FixedArray UUID_SIZE Word8)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr (FixedArray UUID_SIZE Word8))) (ByteString
forall a. Monoid a => a
mempty)
    Ptr (FixedArray LUID_SIZE Word8) -> ByteString -> IO ()
forall (n :: Nat).
KnownNat n =>
Ptr (FixedArray n Word8) -> ByteString -> IO ()
pokeFixedLengthByteString ((Ptr PhysicalDeviceIDProperties
p Ptr PhysicalDeviceIDProperties
-> Int -> Ptr (FixedArray LUID_SIZE Word8)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 48 :: Ptr (FixedArray LUID_SIZE Word8))) (ByteString
forall a. Monoid a => a
mempty)
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceIDProperties
p Ptr PhysicalDeviceIDProperties -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 56 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
    Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceIDProperties
p Ptr PhysicalDeviceIDProperties -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 60 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
forall a. Zero a => a
zero))
    IO b
f

instance FromCStruct PhysicalDeviceIDProperties where
  peekCStruct :: Ptr PhysicalDeviceIDProperties -> IO PhysicalDeviceIDProperties
peekCStruct p :: Ptr PhysicalDeviceIDProperties
p = do
    ByteString
deviceUUID <- Ptr (FixedArray UUID_SIZE Word8) -> IO ByteString
forall (n :: Nat).
KnownNat n =>
Ptr (FixedArray n Word8) -> IO ByteString
peekByteStringFromSizedVectorPtr ((Ptr PhysicalDeviceIDProperties
p Ptr PhysicalDeviceIDProperties
-> Int -> Ptr (FixedArray UUID_SIZE Word8)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr (FixedArray UUID_SIZE Word8)))
    ByteString
driverUUID <- Ptr (FixedArray UUID_SIZE Word8) -> IO ByteString
forall (n :: Nat).
KnownNat n =>
Ptr (FixedArray n Word8) -> IO ByteString
peekByteStringFromSizedVectorPtr ((Ptr PhysicalDeviceIDProperties
p Ptr PhysicalDeviceIDProperties
-> Int -> Ptr (FixedArray UUID_SIZE Word8)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr (FixedArray UUID_SIZE Word8)))
    ByteString
deviceLUID <- Ptr (FixedArray LUID_SIZE Word8) -> IO ByteString
forall (n :: Nat).
KnownNat n =>
Ptr (FixedArray n Word8) -> IO ByteString
peekByteStringFromSizedVectorPtr ((Ptr PhysicalDeviceIDProperties
p Ptr PhysicalDeviceIDProperties
-> Int -> Ptr (FixedArray LUID_SIZE Word8)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 48 :: Ptr (FixedArray LUID_SIZE Word8)))
    Word32
deviceNodeMask <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr PhysicalDeviceIDProperties
p Ptr PhysicalDeviceIDProperties -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 56 :: Ptr Word32))
    Bool32
deviceLUIDValid <- Ptr Bool32 -> IO Bool32
forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PhysicalDeviceIDProperties
p Ptr PhysicalDeviceIDProperties -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 60 :: Ptr Bool32))
    PhysicalDeviceIDProperties -> IO PhysicalDeviceIDProperties
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PhysicalDeviceIDProperties -> IO PhysicalDeviceIDProperties)
-> PhysicalDeviceIDProperties -> IO PhysicalDeviceIDProperties
forall a b. (a -> b) -> a -> b
$ ByteString
-> ByteString
-> ByteString
-> Word32
-> Bool
-> PhysicalDeviceIDProperties
PhysicalDeviceIDProperties
             ByteString
deviceUUID ByteString
driverUUID ByteString
deviceLUID Word32
deviceNodeMask (Bool32 -> Bool
bool32ToBool Bool32
deviceLUIDValid)

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

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