{-# language CPP #-}
module Vulkan.Core11.Promoted_From_VK_KHR_get_memory_requirements2  ( getBufferMemoryRequirements2
                                                                    , getImageMemoryRequirements2
                                                                    , getImageSparseMemoryRequirements2
                                                                    , BufferMemoryRequirementsInfo2(..)
                                                                    , ImageMemoryRequirementsInfo2(..)
                                                                    , ImageSparseMemoryRequirementsInfo2(..)
                                                                    , MemoryRequirements2(..)
                                                                    , SparseImageMemoryRequirements2(..)
                                                                    , StructureType(..)
                                                                    ) where

import Control.Exception.Base (bracket)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Data.Typeable (eqT)
import Foreign.Marshal.Alloc (allocaBytesAligned)
import Foreign.Marshal.Alloc (callocBytes)
import Foreign.Marshal.Alloc (free)
import GHC.IO (throwIO)
import GHC.Ptr (castPtr)
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 Control.Monad.IO.Class (MonadIO)
import Data.Type.Equality ((:~:)(Refl))
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.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Data.Vector (Vector)
import Vulkan.CStruct.Utils (advancePtrBytes)
import Vulkan.CStruct.Extends (forgetExtensions)
import Vulkan.NamedType ((:::))
import Vulkan.Core10.Handles (Buffer)
import Vulkan.CStruct.Extends (Chain)
import Vulkan.Core10.Handles (Device)
import Vulkan.Core10.Handles (Device(..))
import Vulkan.Dynamic (DeviceCmds(pVkGetBufferMemoryRequirements2))
import Vulkan.Dynamic (DeviceCmds(pVkGetImageMemoryRequirements2))
import Vulkan.Dynamic (DeviceCmds(pVkGetImageSparseMemoryRequirements2))
import Vulkan.Core10.Handles (Device_T)
import Vulkan.CStruct.Extends (Extends)
import Vulkan.CStruct.Extends (Extendss)
import Vulkan.CStruct.Extends (Extensible(..))
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.Core10.Handles (Image)
import {-# SOURCE #-} Vulkan.Core11.Promoted_From_VK_KHR_sampler_ycbcr_conversion (ImagePlaneMemoryRequirementsInfo)
import {-# SOURCE #-} Vulkan.Core11.Promoted_From_VK_KHR_dedicated_allocation (MemoryDedicatedRequirements)
import Vulkan.Core10.MemoryManagement (MemoryRequirements)
import Vulkan.CStruct.Extends (PeekChain)
import Vulkan.CStruct.Extends (PeekChain(..))
import Vulkan.CStruct.Extends (PokeChain)
import Vulkan.CStruct.Extends (PokeChain(..))
import Vulkan.CStruct.Extends (SomeStruct)
import Vulkan.Core10.SparseResourceMemoryManagement (SparseImageMemoryRequirements)
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Zero (Zero(..))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_IMAGE_SPARSE_MEMORY_REQUIREMENTS_INFO_2))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_SPARSE_IMAGE_MEMORY_REQUIREMENTS_2))
import Vulkan.Core10.Enums.StructureType (StructureType(..))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkGetBufferMemoryRequirements2
  :: FunPtr (Ptr Device_T -> Ptr BufferMemoryRequirementsInfo2 -> Ptr (SomeStruct MemoryRequirements2) -> IO ()) -> Ptr Device_T -> Ptr BufferMemoryRequirementsInfo2 -> Ptr (SomeStruct MemoryRequirements2) -> IO ()

-- | vkGetBufferMemoryRequirements2 - Returns the memory requirements for
-- specified Vulkan object
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- 'BufferMemoryRequirementsInfo2', 'Vulkan.Core10.Handles.Device',
-- 'MemoryRequirements2'
getBufferMemoryRequirements2 :: forall a io
                              . (Extendss MemoryRequirements2 a, PokeChain a, PeekChain a, MonadIO io)
                             => -- | @device@ is the logical device that owns the buffer.
                                --
                                -- @device@ /must/ be a valid 'Vulkan.Core10.Handles.Device' handle
                                Device
                             -> -- | @pInfo@ is a pointer to a 'BufferMemoryRequirementsInfo2' structure
                                -- containing parameters required for the memory requirements query.
                                --
                                -- @pInfo@ /must/ be a valid pointer to a valid
                                -- 'BufferMemoryRequirementsInfo2' structure
                                BufferMemoryRequirementsInfo2
                             -> io (MemoryRequirements2 a)
getBufferMemoryRequirements2 :: Device
-> BufferMemoryRequirementsInfo2 -> io (MemoryRequirements2 a)
getBufferMemoryRequirements2 device :: Device
device info :: BufferMemoryRequirementsInfo2
info = IO (MemoryRequirements2 a) -> io (MemoryRequirements2 a)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (MemoryRequirements2 a) -> io (MemoryRequirements2 a))
-> (ContT (MemoryRequirements2 a) IO (MemoryRequirements2 a)
    -> IO (MemoryRequirements2 a))
-> ContT (MemoryRequirements2 a) IO (MemoryRequirements2 a)
-> io (MemoryRequirements2 a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT (MemoryRequirements2 a) IO (MemoryRequirements2 a)
-> IO (MemoryRequirements2 a)
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT (MemoryRequirements2 a) IO (MemoryRequirements2 a)
 -> io (MemoryRequirements2 a))
-> ContT (MemoryRequirements2 a) IO (MemoryRequirements2 a)
-> io (MemoryRequirements2 a)
forall a b. (a -> b) -> a -> b
$ do
  let vkGetBufferMemoryRequirements2Ptr :: FunPtr
  (Ptr Device_T
   -> ("pInfo" ::: Ptr BufferMemoryRequirementsInfo2)
   -> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
   -> IO ())
vkGetBufferMemoryRequirements2Ptr = DeviceCmds
-> FunPtr
     (Ptr Device_T
      -> ("pInfo" ::: Ptr BufferMemoryRequirementsInfo2)
      -> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
      -> IO ())
pVkGetBufferMemoryRequirements2 (Device -> DeviceCmds
deviceCmds (Device
device :: Device))
  IO () -> ContT (MemoryRequirements2 a) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT (MemoryRequirements2 a) IO ())
-> IO () -> ContT (MemoryRequirements2 a) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr Device_T
   -> ("pInfo" ::: Ptr BufferMemoryRequirementsInfo2)
   -> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
   -> IO ())
vkGetBufferMemoryRequirements2Ptr FunPtr
  (Ptr Device_T
   -> ("pInfo" ::: Ptr BufferMemoryRequirementsInfo2)
   -> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
   -> IO ())
-> FunPtr
     (Ptr Device_T
      -> ("pInfo" ::: Ptr BufferMemoryRequirementsInfo2)
      -> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
      -> IO ())
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr Device_T
   -> ("pInfo" ::: Ptr BufferMemoryRequirementsInfo2)
   -> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
   -> 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 vkGetBufferMemoryRequirements2 is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkGetBufferMemoryRequirements2' :: Ptr Device_T
-> ("pInfo" ::: Ptr BufferMemoryRequirementsInfo2)
-> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
-> IO ()
vkGetBufferMemoryRequirements2' = FunPtr
  (Ptr Device_T
   -> ("pInfo" ::: Ptr BufferMemoryRequirementsInfo2)
   -> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
   -> IO ())
-> Ptr Device_T
-> ("pInfo" ::: Ptr BufferMemoryRequirementsInfo2)
-> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
-> IO ()
mkVkGetBufferMemoryRequirements2 FunPtr
  (Ptr Device_T
   -> ("pInfo" ::: Ptr BufferMemoryRequirementsInfo2)
   -> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
   -> IO ())
vkGetBufferMemoryRequirements2Ptr
  "pInfo" ::: Ptr BufferMemoryRequirementsInfo2
pInfo <- ((("pInfo" ::: Ptr BufferMemoryRequirementsInfo2)
  -> IO (MemoryRequirements2 a))
 -> IO (MemoryRequirements2 a))
-> ContT
     (MemoryRequirements2 a)
     IO
     ("pInfo" ::: Ptr BufferMemoryRequirementsInfo2)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pInfo" ::: Ptr BufferMemoryRequirementsInfo2)
   -> IO (MemoryRequirements2 a))
  -> IO (MemoryRequirements2 a))
 -> ContT
      (MemoryRequirements2 a)
      IO
      ("pInfo" ::: Ptr BufferMemoryRequirementsInfo2))
-> ((("pInfo" ::: Ptr BufferMemoryRequirementsInfo2)
     -> IO (MemoryRequirements2 a))
    -> IO (MemoryRequirements2 a))
-> ContT
     (MemoryRequirements2 a)
     IO
     ("pInfo" ::: Ptr BufferMemoryRequirementsInfo2)
forall a b. (a -> b) -> a -> b
$ BufferMemoryRequirementsInfo2
-> (("pInfo" ::: Ptr BufferMemoryRequirementsInfo2)
    -> IO (MemoryRequirements2 a))
-> IO (MemoryRequirements2 a)
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (BufferMemoryRequirementsInfo2
info)
  Ptr (MemoryRequirements2 a)
pPMemoryRequirements <- ((Ptr (MemoryRequirements2 a) -> IO (MemoryRequirements2 a))
 -> IO (MemoryRequirements2 a))
-> ContT (MemoryRequirements2 a) IO (Ptr (MemoryRequirements2 a))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (forall b.
ToCStruct (MemoryRequirements2 a) =>
(Ptr (MemoryRequirements2 a) -> IO b) -> IO b
forall a b. ToCStruct a => (Ptr a -> IO b) -> IO b
withZeroCStruct @(MemoryRequirements2 _))
  IO () -> ContT (MemoryRequirements2 a) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT (MemoryRequirements2 a) IO ())
-> IO () -> ContT (MemoryRequirements2 a) IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Device_T
-> ("pInfo" ::: Ptr BufferMemoryRequirementsInfo2)
-> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
-> IO ()
vkGetBufferMemoryRequirements2' (Device -> Ptr Device_T
deviceHandle (Device
device)) "pInfo" ::: Ptr BufferMemoryRequirementsInfo2
pInfo (Ptr (MemoryRequirements2 a)
-> "pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2)
forall (a :: [*] -> *) (es :: [*]).
Ptr (a es) -> Ptr (SomeStruct a)
forgetExtensions (Ptr (MemoryRequirements2 a)
pPMemoryRequirements))
  MemoryRequirements2 a
pMemoryRequirements <- IO (MemoryRequirements2 a)
-> ContT (MemoryRequirements2 a) IO (MemoryRequirements2 a)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO (MemoryRequirements2 a)
 -> ContT (MemoryRequirements2 a) IO (MemoryRequirements2 a))
-> IO (MemoryRequirements2 a)
-> ContT (MemoryRequirements2 a) IO (MemoryRequirements2 a)
forall a b. (a -> b) -> a -> b
$ Ptr (MemoryRequirements2 a) -> IO (MemoryRequirements2 a)
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @(MemoryRequirements2 _) Ptr (MemoryRequirements2 a)
pPMemoryRequirements
  MemoryRequirements2 a
-> ContT (MemoryRequirements2 a) IO (MemoryRequirements2 a)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (MemoryRequirements2 a
 -> ContT (MemoryRequirements2 a) IO (MemoryRequirements2 a))
-> MemoryRequirements2 a
-> ContT (MemoryRequirements2 a) IO (MemoryRequirements2 a)
forall a b. (a -> b) -> a -> b
$ (MemoryRequirements2 a
pMemoryRequirements)


foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkGetImageMemoryRequirements2
  :: FunPtr (Ptr Device_T -> Ptr (SomeStruct ImageMemoryRequirementsInfo2) -> Ptr (SomeStruct MemoryRequirements2) -> IO ()) -> Ptr Device_T -> Ptr (SomeStruct ImageMemoryRequirementsInfo2) -> Ptr (SomeStruct MemoryRequirements2) -> IO ()

-- | vkGetImageMemoryRequirements2 - Returns the memory requirements for
-- specified Vulkan object
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- 'Vulkan.Core10.Handles.Device', 'ImageMemoryRequirementsInfo2',
-- 'MemoryRequirements2'
getImageMemoryRequirements2 :: forall a b io
                             . (Extendss ImageMemoryRequirementsInfo2 a, Extendss MemoryRequirements2 b, PokeChain a, PokeChain b, PeekChain b, MonadIO io)
                            => -- | @device@ is the logical device that owns the image.
                               --
                               -- @device@ /must/ be a valid 'Vulkan.Core10.Handles.Device' handle
                               Device
                            -> -- | @pInfo@ is a pointer to a 'ImageMemoryRequirementsInfo2' structure
                               -- containing parameters required for the memory requirements query.
                               --
                               -- @pInfo@ /must/ be a valid pointer to a valid
                               -- 'ImageMemoryRequirementsInfo2' structure
                               (ImageMemoryRequirementsInfo2 a)
                            -> io (MemoryRequirements2 b)
getImageMemoryRequirements2 :: Device
-> ImageMemoryRequirementsInfo2 a -> io (MemoryRequirements2 b)
getImageMemoryRequirements2 device :: Device
device info :: ImageMemoryRequirementsInfo2 a
info = IO (MemoryRequirements2 b) -> io (MemoryRequirements2 b)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (MemoryRequirements2 b) -> io (MemoryRequirements2 b))
-> (ContT (MemoryRequirements2 b) IO (MemoryRequirements2 b)
    -> IO (MemoryRequirements2 b))
-> ContT (MemoryRequirements2 b) IO (MemoryRequirements2 b)
-> io (MemoryRequirements2 b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT (MemoryRequirements2 b) IO (MemoryRequirements2 b)
-> IO (MemoryRequirements2 b)
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT (MemoryRequirements2 b) IO (MemoryRequirements2 b)
 -> io (MemoryRequirements2 b))
-> ContT (MemoryRequirements2 b) IO (MemoryRequirements2 b)
-> io (MemoryRequirements2 b)
forall a b. (a -> b) -> a -> b
$ do
  let vkGetImageMemoryRequirements2Ptr :: FunPtr
  (Ptr Device_T
   -> ("pInfo" ::: Ptr (SomeStruct ImageMemoryRequirementsInfo2))
   -> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
   -> IO ())
vkGetImageMemoryRequirements2Ptr = DeviceCmds
-> FunPtr
     (Ptr Device_T
      -> ("pInfo" ::: Ptr (SomeStruct ImageMemoryRequirementsInfo2))
      -> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
      -> IO ())
pVkGetImageMemoryRequirements2 (Device -> DeviceCmds
deviceCmds (Device
device :: Device))
  IO () -> ContT (MemoryRequirements2 b) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT (MemoryRequirements2 b) IO ())
-> IO () -> ContT (MemoryRequirements2 b) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr Device_T
   -> ("pInfo" ::: Ptr (SomeStruct ImageMemoryRequirementsInfo2))
   -> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
   -> IO ())
vkGetImageMemoryRequirements2Ptr FunPtr
  (Ptr Device_T
   -> ("pInfo" ::: Ptr (SomeStruct ImageMemoryRequirementsInfo2))
   -> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
   -> IO ())
-> FunPtr
     (Ptr Device_T
      -> ("pInfo" ::: Ptr (SomeStruct ImageMemoryRequirementsInfo2))
      -> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
      -> IO ())
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr Device_T
   -> ("pInfo" ::: Ptr (SomeStruct ImageMemoryRequirementsInfo2))
   -> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
   -> 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 vkGetImageMemoryRequirements2 is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkGetImageMemoryRequirements2' :: Ptr Device_T
-> ("pInfo" ::: Ptr (SomeStruct ImageMemoryRequirementsInfo2))
-> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
-> IO ()
vkGetImageMemoryRequirements2' = FunPtr
  (Ptr Device_T
   -> ("pInfo" ::: Ptr (SomeStruct ImageMemoryRequirementsInfo2))
   -> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
   -> IO ())
-> Ptr Device_T
-> ("pInfo" ::: Ptr (SomeStruct ImageMemoryRequirementsInfo2))
-> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
-> IO ()
mkVkGetImageMemoryRequirements2 FunPtr
  (Ptr Device_T
   -> ("pInfo" ::: Ptr (SomeStruct ImageMemoryRequirementsInfo2))
   -> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
   -> IO ())
vkGetImageMemoryRequirements2Ptr
  Ptr (ImageMemoryRequirementsInfo2 a)
pInfo <- ((Ptr (ImageMemoryRequirementsInfo2 a)
  -> IO (MemoryRequirements2 b))
 -> IO (MemoryRequirements2 b))
-> ContT
     (MemoryRequirements2 b) IO (Ptr (ImageMemoryRequirementsInfo2 a))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (ImageMemoryRequirementsInfo2 a)
   -> IO (MemoryRequirements2 b))
  -> IO (MemoryRequirements2 b))
 -> ContT
      (MemoryRequirements2 b) IO (Ptr (ImageMemoryRequirementsInfo2 a)))
-> ((Ptr (ImageMemoryRequirementsInfo2 a)
     -> IO (MemoryRequirements2 b))
    -> IO (MemoryRequirements2 b))
-> ContT
     (MemoryRequirements2 b) IO (Ptr (ImageMemoryRequirementsInfo2 a))
forall a b. (a -> b) -> a -> b
$ ImageMemoryRequirementsInfo2 a
-> (Ptr (ImageMemoryRequirementsInfo2 a)
    -> IO (MemoryRequirements2 b))
-> IO (MemoryRequirements2 b)
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (ImageMemoryRequirementsInfo2 a
info)
  Ptr (MemoryRequirements2 b)
pPMemoryRequirements <- ((Ptr (MemoryRequirements2 b) -> IO (MemoryRequirements2 b))
 -> IO (MemoryRequirements2 b))
-> ContT (MemoryRequirements2 b) IO (Ptr (MemoryRequirements2 b))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (forall b.
ToCStruct (MemoryRequirements2 b) =>
(Ptr (MemoryRequirements2 b) -> IO b) -> IO b
forall a b. ToCStruct a => (Ptr a -> IO b) -> IO b
withZeroCStruct @(MemoryRequirements2 _))
  IO () -> ContT (MemoryRequirements2 b) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT (MemoryRequirements2 b) IO ())
-> IO () -> ContT (MemoryRequirements2 b) IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Device_T
-> ("pInfo" ::: Ptr (SomeStruct ImageMemoryRequirementsInfo2))
-> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
-> IO ()
vkGetImageMemoryRequirements2' (Device -> Ptr Device_T
deviceHandle (Device
device)) (Ptr (ImageMemoryRequirementsInfo2 a)
-> "pInfo" ::: Ptr (SomeStruct ImageMemoryRequirementsInfo2)
forall (a :: [*] -> *) (es :: [*]).
Ptr (a es) -> Ptr (SomeStruct a)
forgetExtensions Ptr (ImageMemoryRequirementsInfo2 a)
pInfo) (Ptr (MemoryRequirements2 b)
-> "pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2)
forall (a :: [*] -> *) (es :: [*]).
Ptr (a es) -> Ptr (SomeStruct a)
forgetExtensions (Ptr (MemoryRequirements2 b)
pPMemoryRequirements))
  MemoryRequirements2 b
pMemoryRequirements <- IO (MemoryRequirements2 b)
-> ContT (MemoryRequirements2 b) IO (MemoryRequirements2 b)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO (MemoryRequirements2 b)
 -> ContT (MemoryRequirements2 b) IO (MemoryRequirements2 b))
-> IO (MemoryRequirements2 b)
-> ContT (MemoryRequirements2 b) IO (MemoryRequirements2 b)
forall a b. (a -> b) -> a -> b
$ Ptr (MemoryRequirements2 b) -> IO (MemoryRequirements2 b)
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @(MemoryRequirements2 _) Ptr (MemoryRequirements2 b)
pPMemoryRequirements
  MemoryRequirements2 b
-> ContT (MemoryRequirements2 b) IO (MemoryRequirements2 b)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (MemoryRequirements2 b
 -> ContT (MemoryRequirements2 b) IO (MemoryRequirements2 b))
-> MemoryRequirements2 b
-> ContT (MemoryRequirements2 b) IO (MemoryRequirements2 b)
forall a b. (a -> b) -> a -> b
$ (MemoryRequirements2 b
pMemoryRequirements)


foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkGetImageSparseMemoryRequirements2
  :: FunPtr (Ptr Device_T -> Ptr ImageSparseMemoryRequirementsInfo2 -> Ptr Word32 -> Ptr SparseImageMemoryRequirements2 -> IO ()) -> Ptr Device_T -> Ptr ImageSparseMemoryRequirementsInfo2 -> Ptr Word32 -> Ptr SparseImageMemoryRequirements2 -> IO ()

-- | vkGetImageSparseMemoryRequirements2 - Query the memory requirements for
-- a sparse image
--
-- == Valid Usage (Implicit)
--
-- -   @device@ /must/ be a valid 'Vulkan.Core10.Handles.Device' handle
--
-- -   @pInfo@ /must/ be a valid pointer to a valid
--     'ImageSparseMemoryRequirementsInfo2' structure
--
-- -   @pSparseMemoryRequirementCount@ /must/ be a valid pointer to a
--     @uint32_t@ value
--
-- -   If the value referenced by @pSparseMemoryRequirementCount@ is not
--     @0@, and @pSparseMemoryRequirements@ is not @NULL@,
--     @pSparseMemoryRequirements@ /must/ be a valid pointer to an array of
--     @pSparseMemoryRequirementCount@ 'SparseImageMemoryRequirements2'
--     structures
--
-- = See Also
--
-- 'Vulkan.Core10.Handles.Device', 'ImageSparseMemoryRequirementsInfo2',
-- 'SparseImageMemoryRequirements2'
getImageSparseMemoryRequirements2 :: forall io
                                   . (MonadIO io)
                                  => -- | @device@ is the logical device that owns the image.
                                     Device
                                  -> -- | @pInfo@ is a pointer to a 'ImageSparseMemoryRequirementsInfo2' structure
                                     -- containing parameters required for the memory requirements query.
                                     ImageSparseMemoryRequirementsInfo2
                                  -> io (("sparseMemoryRequirements" ::: Vector SparseImageMemoryRequirements2))
getImageSparseMemoryRequirements2 :: Device
-> ImageSparseMemoryRequirementsInfo2
-> io
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
getImageSparseMemoryRequirements2 device :: Device
device info :: ImageSparseMemoryRequirementsInfo2
info = IO
  ("sparseMemoryRequirements"
   ::: Vector SparseImageMemoryRequirements2)
-> io
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO
   ("sparseMemoryRequirements"
    ::: Vector SparseImageMemoryRequirements2)
 -> io
      ("sparseMemoryRequirements"
       ::: Vector SparseImageMemoryRequirements2))
-> (ContT
      ("sparseMemoryRequirements"
       ::: Vector SparseImageMemoryRequirements2)
      IO
      ("sparseMemoryRequirements"
       ::: Vector SparseImageMemoryRequirements2)
    -> IO
         ("sparseMemoryRequirements"
          ::: Vector SparseImageMemoryRequirements2))
-> ContT
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
     IO
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
-> io
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT
  ("sparseMemoryRequirements"
   ::: Vector SparseImageMemoryRequirements2)
  IO
  ("sparseMemoryRequirements"
   ::: Vector SparseImageMemoryRequirements2)
-> IO
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT
   ("sparseMemoryRequirements"
    ::: Vector SparseImageMemoryRequirements2)
   IO
   ("sparseMemoryRequirements"
    ::: Vector SparseImageMemoryRequirements2)
 -> io
      ("sparseMemoryRequirements"
       ::: Vector SparseImageMemoryRequirements2))
-> ContT
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
     IO
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
-> io
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
forall a b. (a -> b) -> a -> b
$ do
  let vkGetImageSparseMemoryRequirements2Ptr :: FunPtr
  (Ptr Device_T
   -> ("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2)
   -> ("pSparseMemoryRequirementCount" ::: Ptr Word32)
   -> ("pSparseMemoryRequirements"
       ::: Ptr SparseImageMemoryRequirements2)
   -> IO ())
vkGetImageSparseMemoryRequirements2Ptr = DeviceCmds
-> FunPtr
     (Ptr Device_T
      -> ("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2)
      -> ("pSparseMemoryRequirementCount" ::: Ptr Word32)
      -> ("pSparseMemoryRequirements"
          ::: Ptr SparseImageMemoryRequirements2)
      -> IO ())
pVkGetImageSparseMemoryRequirements2 (Device -> DeviceCmds
deviceCmds (Device
device :: Device))
  IO ()
-> ContT
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
     IO
     ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ()
 -> ContT
      ("sparseMemoryRequirements"
       ::: Vector SparseImageMemoryRequirements2)
      IO
      ())
-> IO ()
-> ContT
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
     IO
     ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr Device_T
   -> ("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2)
   -> ("pSparseMemoryRequirementCount" ::: Ptr Word32)
   -> ("pSparseMemoryRequirements"
       ::: Ptr SparseImageMemoryRequirements2)
   -> IO ())
vkGetImageSparseMemoryRequirements2Ptr FunPtr
  (Ptr Device_T
   -> ("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2)
   -> ("pSparseMemoryRequirementCount" ::: Ptr Word32)
   -> ("pSparseMemoryRequirements"
       ::: Ptr SparseImageMemoryRequirements2)
   -> IO ())
-> FunPtr
     (Ptr Device_T
      -> ("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2)
      -> ("pSparseMemoryRequirementCount" ::: Ptr Word32)
      -> ("pSparseMemoryRequirements"
          ::: Ptr SparseImageMemoryRequirements2)
      -> IO ())
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr Device_T
   -> ("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2)
   -> ("pSparseMemoryRequirementCount" ::: Ptr Word32)
   -> ("pSparseMemoryRequirements"
       ::: Ptr SparseImageMemoryRequirements2)
   -> 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 vkGetImageSparseMemoryRequirements2 is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkGetImageSparseMemoryRequirements2' :: Ptr Device_T
-> ("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2)
-> ("pSparseMemoryRequirementCount" ::: Ptr Word32)
-> ("pSparseMemoryRequirements"
    ::: Ptr SparseImageMemoryRequirements2)
-> IO ()
vkGetImageSparseMemoryRequirements2' = FunPtr
  (Ptr Device_T
   -> ("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2)
   -> ("pSparseMemoryRequirementCount" ::: Ptr Word32)
   -> ("pSparseMemoryRequirements"
       ::: Ptr SparseImageMemoryRequirements2)
   -> IO ())
-> Ptr Device_T
-> ("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2)
-> ("pSparseMemoryRequirementCount" ::: Ptr Word32)
-> ("pSparseMemoryRequirements"
    ::: Ptr SparseImageMemoryRequirements2)
-> IO ()
mkVkGetImageSparseMemoryRequirements2 FunPtr
  (Ptr Device_T
   -> ("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2)
   -> ("pSparseMemoryRequirementCount" ::: Ptr Word32)
   -> ("pSparseMemoryRequirements"
       ::: Ptr SparseImageMemoryRequirements2)
   -> IO ())
vkGetImageSparseMemoryRequirements2Ptr
  let device' :: Ptr Device_T
device' = Device -> Ptr Device_T
deviceHandle (Device
device)
  "pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2
pInfo <- ((("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2)
  -> IO
       ("sparseMemoryRequirements"
        ::: Vector SparseImageMemoryRequirements2))
 -> IO
      ("sparseMemoryRequirements"
       ::: Vector SparseImageMemoryRequirements2))
-> ContT
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
     IO
     ("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2)
   -> IO
        ("sparseMemoryRequirements"
         ::: Vector SparseImageMemoryRequirements2))
  -> IO
       ("sparseMemoryRequirements"
        ::: Vector SparseImageMemoryRequirements2))
 -> ContT
      ("sparseMemoryRequirements"
       ::: Vector SparseImageMemoryRequirements2)
      IO
      ("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2))
-> ((("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2)
     -> IO
          ("sparseMemoryRequirements"
           ::: Vector SparseImageMemoryRequirements2))
    -> IO
         ("sparseMemoryRequirements"
          ::: Vector SparseImageMemoryRequirements2))
-> ContT
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
     IO
     ("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2)
forall a b. (a -> b) -> a -> b
$ ImageSparseMemoryRequirementsInfo2
-> (("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2)
    -> IO
         ("sparseMemoryRequirements"
          ::: Vector SparseImageMemoryRequirements2))
-> IO
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (ImageSparseMemoryRequirementsInfo2
info)
  "pSparseMemoryRequirementCount" ::: Ptr Word32
pPSparseMemoryRequirementCount <- ((("pSparseMemoryRequirementCount" ::: Ptr Word32)
  -> IO
       ("sparseMemoryRequirements"
        ::: Vector SparseImageMemoryRequirements2))
 -> IO
      ("sparseMemoryRequirements"
       ::: Vector SparseImageMemoryRequirements2))
-> ContT
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
     IO
     ("pSparseMemoryRequirementCount" ::: Ptr Word32)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pSparseMemoryRequirementCount" ::: Ptr Word32)
   -> IO
        ("sparseMemoryRequirements"
         ::: Vector SparseImageMemoryRequirements2))
  -> IO
       ("sparseMemoryRequirements"
        ::: Vector SparseImageMemoryRequirements2))
 -> ContT
      ("sparseMemoryRequirements"
       ::: Vector SparseImageMemoryRequirements2)
      IO
      ("pSparseMemoryRequirementCount" ::: Ptr Word32))
-> ((("pSparseMemoryRequirementCount" ::: Ptr Word32)
     -> IO
          ("sparseMemoryRequirements"
           ::: Vector SparseImageMemoryRequirements2))
    -> IO
         ("sparseMemoryRequirements"
          ::: Vector SparseImageMemoryRequirements2))
-> ContT
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
     IO
     ("pSparseMemoryRequirementCount" ::: Ptr Word32)
forall a b. (a -> b) -> a -> b
$ IO ("pSparseMemoryRequirementCount" ::: Ptr Word32)
-> (("pSparseMemoryRequirementCount" ::: Ptr Word32) -> IO ())
-> (("pSparseMemoryRequirementCount" ::: Ptr Word32)
    -> IO
         ("sparseMemoryRequirements"
          ::: Vector SparseImageMemoryRequirements2))
-> IO
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int -> IO ("pSparseMemoryRequirementCount" ::: Ptr Word32)
forall a. Int -> IO (Ptr a)
callocBytes @Word32 4) ("pSparseMemoryRequirementCount" ::: Ptr Word32) -> IO ()
forall a. Ptr a -> IO ()
free
  IO ()
-> ContT
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
     IO
     ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ()
 -> ContT
      ("sparseMemoryRequirements"
       ::: Vector SparseImageMemoryRequirements2)
      IO
      ())
-> IO ()
-> ContT
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
     IO
     ()
forall a b. (a -> b) -> a -> b
$ Ptr Device_T
-> ("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2)
-> ("pSparseMemoryRequirementCount" ::: Ptr Word32)
-> ("pSparseMemoryRequirements"
    ::: Ptr SparseImageMemoryRequirements2)
-> IO ()
vkGetImageSparseMemoryRequirements2' Ptr Device_T
device' "pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2
pInfo ("pSparseMemoryRequirementCount" ::: Ptr Word32
pPSparseMemoryRequirementCount) ("pSparseMemoryRequirements" ::: Ptr SparseImageMemoryRequirements2
forall a. Ptr a
nullPtr)
  Word32
pSparseMemoryRequirementCount <- IO Word32
-> ContT
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
     IO
     Word32
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Word32
 -> ContT
      ("sparseMemoryRequirements"
       ::: Vector SparseImageMemoryRequirements2)
      IO
      Word32)
-> IO Word32
-> ContT
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
     IO
     Word32
forall a b. (a -> b) -> a -> b
$ ("pSparseMemoryRequirementCount" ::: Ptr Word32) -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 "pSparseMemoryRequirementCount" ::: Ptr Word32
pPSparseMemoryRequirementCount
  "pSparseMemoryRequirements" ::: Ptr SparseImageMemoryRequirements2
pPSparseMemoryRequirements <- ((("pSparseMemoryRequirements"
   ::: Ptr SparseImageMemoryRequirements2)
  -> IO
       ("sparseMemoryRequirements"
        ::: Vector SparseImageMemoryRequirements2))
 -> IO
      ("sparseMemoryRequirements"
       ::: Vector SparseImageMemoryRequirements2))
-> ContT
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
     IO
     ("pSparseMemoryRequirements"
      ::: Ptr SparseImageMemoryRequirements2)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pSparseMemoryRequirements"
    ::: Ptr SparseImageMemoryRequirements2)
   -> IO
        ("sparseMemoryRequirements"
         ::: Vector SparseImageMemoryRequirements2))
  -> IO
       ("sparseMemoryRequirements"
        ::: Vector SparseImageMemoryRequirements2))
 -> ContT
      ("sparseMemoryRequirements"
       ::: Vector SparseImageMemoryRequirements2)
      IO
      ("pSparseMemoryRequirements"
       ::: Ptr SparseImageMemoryRequirements2))
-> ((("pSparseMemoryRequirements"
      ::: Ptr SparseImageMemoryRequirements2)
     -> IO
          ("sparseMemoryRequirements"
           ::: Vector SparseImageMemoryRequirements2))
    -> IO
         ("sparseMemoryRequirements"
          ::: Vector SparseImageMemoryRequirements2))
-> ContT
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
     IO
     ("pSparseMemoryRequirements"
      ::: Ptr SparseImageMemoryRequirements2)
forall a b. (a -> b) -> a -> b
$ IO
  ("pSparseMemoryRequirements"
   ::: Ptr SparseImageMemoryRequirements2)
-> (("pSparseMemoryRequirements"
     ::: Ptr SparseImageMemoryRequirements2)
    -> IO ())
-> (("pSparseMemoryRequirements"
     ::: Ptr SparseImageMemoryRequirements2)
    -> IO
         ("sparseMemoryRequirements"
          ::: Vector SparseImageMemoryRequirements2))
-> IO
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int
-> IO
     ("pSparseMemoryRequirements"
      ::: Ptr SparseImageMemoryRequirements2)
forall a. Int -> IO (Ptr a)
callocBytes @SparseImageMemoryRequirements2 ((Word32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32
pSparseMemoryRequirementCount)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* 64)) ("pSparseMemoryRequirements"
 ::: Ptr SparseImageMemoryRequirements2)
-> IO ()
forall a. Ptr a -> IO ()
free
  [()]
_ <- (Int
 -> ContT
      ("sparseMemoryRequirements"
       ::: Vector SparseImageMemoryRequirements2)
      IO
      ())
-> [Int]
-> ContT
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
     IO
     [()]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse (\i :: Int
i -> ((()
  -> IO
       ("sparseMemoryRequirements"
        ::: Vector SparseImageMemoryRequirements2))
 -> IO
      ("sparseMemoryRequirements"
       ::: Vector SparseImageMemoryRequirements2))
-> ContT
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
     IO
     ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((()
   -> IO
        ("sparseMemoryRequirements"
         ::: Vector SparseImageMemoryRequirements2))
  -> IO
       ("sparseMemoryRequirements"
        ::: Vector SparseImageMemoryRequirements2))
 -> ContT
      ("sparseMemoryRequirements"
       ::: Vector SparseImageMemoryRequirements2)
      IO
      ())
-> ((()
     -> IO
          ("sparseMemoryRequirements"
           ::: Vector SparseImageMemoryRequirements2))
    -> IO
         ("sparseMemoryRequirements"
          ::: Vector SparseImageMemoryRequirements2))
-> ContT
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
     IO
     ()
forall a b. (a -> b) -> a -> b
$ ("pSparseMemoryRequirements"
 ::: Ptr SparseImageMemoryRequirements2)
-> IO
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
-> IO
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
forall a b. ToCStruct a => Ptr a -> IO b -> IO b
pokeZeroCStruct ("pSparseMemoryRequirements" ::: Ptr SparseImageMemoryRequirements2
pPSparseMemoryRequirements ("pSparseMemoryRequirements"
 ::: Ptr SparseImageMemoryRequirements2)
-> Int
-> "pSparseMemoryRequirements"
   ::: Ptr SparseImageMemoryRequirements2
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
i Int -> Int -> Int
forall a. Num a => a -> a -> a
* 64) :: Ptr SparseImageMemoryRequirements2) (IO
   ("sparseMemoryRequirements"
    ::: Vector SparseImageMemoryRequirements2)
 -> IO
      ("sparseMemoryRequirements"
       ::: Vector SparseImageMemoryRequirements2))
-> ((()
     -> IO
          ("sparseMemoryRequirements"
           ::: Vector SparseImageMemoryRequirements2))
    -> IO
         ("sparseMemoryRequirements"
          ::: Vector SparseImageMemoryRequirements2))
-> (()
    -> IO
         ("sparseMemoryRequirements"
          ::: Vector SparseImageMemoryRequirements2))
-> IO
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((()
 -> IO
      ("sparseMemoryRequirements"
       ::: Vector SparseImageMemoryRequirements2))
-> ()
-> IO
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
forall a b. (a -> b) -> a -> b
$ ())) [0..(Word32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32
pSparseMemoryRequirementCount)) Int -> Int -> Int
forall a. Num a => a -> a -> a
- 1]
  IO ()
-> ContT
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
     IO
     ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ()
 -> ContT
      ("sparseMemoryRequirements"
       ::: Vector SparseImageMemoryRequirements2)
      IO
      ())
-> IO ()
-> ContT
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
     IO
     ()
forall a b. (a -> b) -> a -> b
$ Ptr Device_T
-> ("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2)
-> ("pSparseMemoryRequirementCount" ::: Ptr Word32)
-> ("pSparseMemoryRequirements"
    ::: Ptr SparseImageMemoryRequirements2)
-> IO ()
vkGetImageSparseMemoryRequirements2' Ptr Device_T
device' "pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2
pInfo ("pSparseMemoryRequirementCount" ::: Ptr Word32
pPSparseMemoryRequirementCount) (("pSparseMemoryRequirements" ::: Ptr SparseImageMemoryRequirements2
pPSparseMemoryRequirements))
  Word32
pSparseMemoryRequirementCount' <- IO Word32
-> ContT
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
     IO
     Word32
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Word32
 -> ContT
      ("sparseMemoryRequirements"
       ::: Vector SparseImageMemoryRequirements2)
      IO
      Word32)
-> IO Word32
-> ContT
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
     IO
     Word32
forall a b. (a -> b) -> a -> b
$ ("pSparseMemoryRequirementCount" ::: Ptr Word32) -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 "pSparseMemoryRequirementCount" ::: Ptr Word32
pPSparseMemoryRequirementCount
  "sparseMemoryRequirements"
::: Vector SparseImageMemoryRequirements2
pSparseMemoryRequirements' <- IO
  ("sparseMemoryRequirements"
   ::: Vector SparseImageMemoryRequirements2)
-> ContT
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
     IO
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO
   ("sparseMemoryRequirements"
    ::: Vector SparseImageMemoryRequirements2)
 -> ContT
      ("sparseMemoryRequirements"
       ::: Vector SparseImageMemoryRequirements2)
      IO
      ("sparseMemoryRequirements"
       ::: Vector SparseImageMemoryRequirements2))
-> IO
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
-> ContT
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
     IO
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
forall a b. (a -> b) -> a -> b
$ Int
-> (Int -> IO SparseImageMemoryRequirements2)
-> IO
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM (Word32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32
pSparseMemoryRequirementCount')) (\i :: Int
i -> ("pSparseMemoryRequirements"
 ::: Ptr SparseImageMemoryRequirements2)
-> IO SparseImageMemoryRequirements2
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @SparseImageMemoryRequirements2 ((("pSparseMemoryRequirements" ::: Ptr SparseImageMemoryRequirements2
pPSparseMemoryRequirements) ("pSparseMemoryRequirements"
 ::: Ptr SparseImageMemoryRequirements2)
-> Int
-> "pSparseMemoryRequirements"
   ::: Ptr SparseImageMemoryRequirements2
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (64 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr SparseImageMemoryRequirements2)))
  ("sparseMemoryRequirements"
 ::: Vector SparseImageMemoryRequirements2)
-> ContT
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
     IO
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (("sparseMemoryRequirements"
  ::: Vector SparseImageMemoryRequirements2)
 -> ContT
      ("sparseMemoryRequirements"
       ::: Vector SparseImageMemoryRequirements2)
      IO
      ("sparseMemoryRequirements"
       ::: Vector SparseImageMemoryRequirements2))
-> ("sparseMemoryRequirements"
    ::: Vector SparseImageMemoryRequirements2)
-> ContT
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
     IO
     ("sparseMemoryRequirements"
      ::: Vector SparseImageMemoryRequirements2)
forall a b. (a -> b) -> a -> b
$ ("sparseMemoryRequirements"
::: Vector SparseImageMemoryRequirements2
pSparseMemoryRequirements')


-- | VkBufferMemoryRequirementsInfo2 - (None)
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- 'Vulkan.Core10.Handles.Buffer',
-- 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'getBufferMemoryRequirements2',
-- 'Vulkan.Extensions.VK_KHR_get_memory_requirements2.getBufferMemoryRequirements2KHR'
data BufferMemoryRequirementsInfo2 = BufferMemoryRequirementsInfo2
  { -- | @buffer@ is the buffer to query.
    --
    -- @buffer@ /must/ be a valid 'Vulkan.Core10.Handles.Buffer' handle
    BufferMemoryRequirementsInfo2 -> Buffer
buffer :: Buffer }
  deriving (Typeable, BufferMemoryRequirementsInfo2
-> BufferMemoryRequirementsInfo2 -> Bool
(BufferMemoryRequirementsInfo2
 -> BufferMemoryRequirementsInfo2 -> Bool)
-> (BufferMemoryRequirementsInfo2
    -> BufferMemoryRequirementsInfo2 -> Bool)
-> Eq BufferMemoryRequirementsInfo2
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BufferMemoryRequirementsInfo2
-> BufferMemoryRequirementsInfo2 -> Bool
$c/= :: BufferMemoryRequirementsInfo2
-> BufferMemoryRequirementsInfo2 -> Bool
== :: BufferMemoryRequirementsInfo2
-> BufferMemoryRequirementsInfo2 -> Bool
$c== :: BufferMemoryRequirementsInfo2
-> BufferMemoryRequirementsInfo2 -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (BufferMemoryRequirementsInfo2)
#endif
deriving instance Show BufferMemoryRequirementsInfo2

instance ToCStruct BufferMemoryRequirementsInfo2 where
  withCStruct :: BufferMemoryRequirementsInfo2
-> (("pInfo" ::: Ptr BufferMemoryRequirementsInfo2) -> IO b)
-> IO b
withCStruct x :: BufferMemoryRequirementsInfo2
x f :: ("pInfo" ::: Ptr BufferMemoryRequirementsInfo2) -> IO b
f = Int
-> Int
-> (("pInfo" ::: Ptr BufferMemoryRequirementsInfo2) -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 24 8 ((("pInfo" ::: Ptr BufferMemoryRequirementsInfo2) -> IO b) -> IO b)
-> (("pInfo" ::: Ptr BufferMemoryRequirementsInfo2) -> IO b)
-> IO b
forall a b. (a -> b) -> a -> b
$ \p :: "pInfo" ::: Ptr BufferMemoryRequirementsInfo2
p -> ("pInfo" ::: Ptr BufferMemoryRequirementsInfo2)
-> BufferMemoryRequirementsInfo2 -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pInfo" ::: Ptr BufferMemoryRequirementsInfo2
p BufferMemoryRequirementsInfo2
x (("pInfo" ::: Ptr BufferMemoryRequirementsInfo2) -> IO b
f "pInfo" ::: Ptr BufferMemoryRequirementsInfo2
p)
  pokeCStruct :: ("pInfo" ::: Ptr BufferMemoryRequirementsInfo2)
-> BufferMemoryRequirementsInfo2 -> IO b -> IO b
pokeCStruct p :: "pInfo" ::: Ptr BufferMemoryRequirementsInfo2
p BufferMemoryRequirementsInfo2{..} f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pInfo" ::: Ptr BufferMemoryRequirementsInfo2
p ("pInfo" ::: Ptr BufferMemoryRequirementsInfo2)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pInfo" ::: Ptr BufferMemoryRequirementsInfo2
p ("pInfo" ::: Ptr BufferMemoryRequirementsInfo2)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Buffer -> Buffer -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pInfo" ::: Ptr BufferMemoryRequirementsInfo2
p ("pInfo" ::: Ptr BufferMemoryRequirementsInfo2)
-> Int -> Ptr Buffer
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Buffer)) (Buffer
buffer)
    IO b
f
  cStructSize :: Int
cStructSize = 24
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: ("pInfo" ::: Ptr BufferMemoryRequirementsInfo2) -> IO b -> IO b
pokeZeroCStruct p :: "pInfo" ::: Ptr BufferMemoryRequirementsInfo2
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pInfo" ::: Ptr BufferMemoryRequirementsInfo2
p ("pInfo" ::: Ptr BufferMemoryRequirementsInfo2)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pInfo" ::: Ptr BufferMemoryRequirementsInfo2
p ("pInfo" ::: Ptr BufferMemoryRequirementsInfo2)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Buffer -> Buffer -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pInfo" ::: Ptr BufferMemoryRequirementsInfo2
p ("pInfo" ::: Ptr BufferMemoryRequirementsInfo2)
-> Int -> Ptr Buffer
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Buffer)) (Buffer
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct BufferMemoryRequirementsInfo2 where
  peekCStruct :: ("pInfo" ::: Ptr BufferMemoryRequirementsInfo2)
-> IO BufferMemoryRequirementsInfo2
peekCStruct p :: "pInfo" ::: Ptr BufferMemoryRequirementsInfo2
p = do
    Buffer
buffer <- Ptr Buffer -> IO Buffer
forall a. Storable a => Ptr a -> IO a
peek @Buffer (("pInfo" ::: Ptr BufferMemoryRequirementsInfo2
p ("pInfo" ::: Ptr BufferMemoryRequirementsInfo2)
-> Int -> Ptr Buffer
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Buffer))
    BufferMemoryRequirementsInfo2 -> IO BufferMemoryRequirementsInfo2
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BufferMemoryRequirementsInfo2 -> IO BufferMemoryRequirementsInfo2)
-> BufferMemoryRequirementsInfo2
-> IO BufferMemoryRequirementsInfo2
forall a b. (a -> b) -> a -> b
$ Buffer -> BufferMemoryRequirementsInfo2
BufferMemoryRequirementsInfo2
             Buffer
buffer

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

instance Zero BufferMemoryRequirementsInfo2 where
  zero :: BufferMemoryRequirementsInfo2
zero = Buffer -> BufferMemoryRequirementsInfo2
BufferMemoryRequirementsInfo2
           Buffer
forall a. Zero a => a
zero


-- | VkImageMemoryRequirementsInfo2 - (None)
--
-- == Valid Usage
--
-- -   If @image@ was created with a /multi-planar/ format and the
--     'Vulkan.Core10.Enums.ImageCreateFlagBits.IMAGE_CREATE_DISJOINT_BIT'
--     flag, there /must/ be a
--     'Vulkan.Core11.Promoted_From_VK_KHR_sampler_ycbcr_conversion.ImagePlaneMemoryRequirementsInfo'
--     included in the @pNext@ chain of the 'ImageMemoryRequirementsInfo2'
--     structure
--
-- -   If @image@ was created with
--     'Vulkan.Core10.Enums.ImageCreateFlagBits.IMAGE_CREATE_DISJOINT_BIT'
--     and with
--     'Vulkan.Core10.Enums.ImageTiling.IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT',
--     then there /must/ be a
--     'Vulkan.Core11.Promoted_From_VK_KHR_sampler_ycbcr_conversion.ImagePlaneMemoryRequirementsInfo'
--     included in the @pNext@ chain of the 'ImageMemoryRequirementsInfo2'
--     structure
--
-- -   If @image@ was not created with the
--     'Vulkan.Core10.Enums.ImageCreateFlagBits.IMAGE_CREATE_DISJOINT_BIT'
--     flag, there /must/ not be a
--     'Vulkan.Core11.Promoted_From_VK_KHR_sampler_ycbcr_conversion.ImagePlaneMemoryRequirementsInfo'
--     included in the @pNext@ chain of the 'ImageMemoryRequirementsInfo2'
--     structure
--
-- -   If @image@ was created with a single-plane format and with any
--     @tiling@ other than
--     'Vulkan.Core10.Enums.ImageTiling.IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT',
--     then there /must/ not be a
--     'Vulkan.Core11.Promoted_From_VK_KHR_sampler_ycbcr_conversion.ImagePlaneMemoryRequirementsInfo'
--     included in the @pNext@ chain of the 'ImageMemoryRequirementsInfo2'
--     structure
--
-- -   If @image@ was created with the
--     'Vulkan.Core11.Enums.ExternalMemoryHandleTypeFlagBits.EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID'
--     external memory handle type, then @image@ /must/ be bound to memory
--
-- == Valid Usage (Implicit)
--
-- -   @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2'
--
-- -   @pNext@ /must/ be @NULL@ or a pointer to a valid instance of
--     'Vulkan.Core11.Promoted_From_VK_KHR_sampler_ycbcr_conversion.ImagePlaneMemoryRequirementsInfo'
--
-- -   The @sType@ value of each struct in the @pNext@ chain /must/ be
--     unique
--
-- -   @image@ /must/ be a valid 'Vulkan.Core10.Handles.Image' handle
--
-- = See Also
--
-- 'Vulkan.Core10.Handles.Image',
-- 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'getImageMemoryRequirements2',
-- 'Vulkan.Extensions.VK_KHR_get_memory_requirements2.getImageMemoryRequirements2KHR'
data ImageMemoryRequirementsInfo2 (es :: [Type]) = ImageMemoryRequirementsInfo2
  { -- | @pNext@ is @NULL@ or a pointer to a structure extending this structure.
    ImageMemoryRequirementsInfo2 es -> Chain es
next :: Chain es
  , -- | @image@ is the image to query.
    ImageMemoryRequirementsInfo2 es -> Image
image :: Image
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ImageMemoryRequirementsInfo2 (es :: [Type]))
#endif
deriving instance Show (Chain es) => Show (ImageMemoryRequirementsInfo2 es)

instance Extensible ImageMemoryRequirementsInfo2 where
  extensibleType :: StructureType
extensibleType = StructureType
STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2
  setNext :: ImageMemoryRequirementsInfo2 ds
-> Chain es -> ImageMemoryRequirementsInfo2 es
setNext x :: ImageMemoryRequirementsInfo2 ds
x next :: Chain es
next = ImageMemoryRequirementsInfo2 ds
x{$sel:next:ImageMemoryRequirementsInfo2 :: Chain es
next = Chain es
next}
  getNext :: ImageMemoryRequirementsInfo2 es -> Chain es
getNext ImageMemoryRequirementsInfo2{..} = Chain es
next
  extends :: forall e b proxy. Typeable e => proxy e -> (Extends ImageMemoryRequirementsInfo2 e => b) -> Maybe b
  extends :: proxy e -> (Extends ImageMemoryRequirementsInfo2 e => b) -> Maybe b
extends _ f :: Extends ImageMemoryRequirementsInfo2 e => b
f
    | Just Refl <- (Typeable e, Typeable ImagePlaneMemoryRequirementsInfo) =>
Maybe (e :~: ImagePlaneMemoryRequirementsInfo)
forall k (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
eqT @e @ImagePlaneMemoryRequirementsInfo = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends ImageMemoryRequirementsInfo2 e => b
f
    | Bool
otherwise = Maybe b
forall a. Maybe a
Nothing

instance (Extendss ImageMemoryRequirementsInfo2 es, PokeChain es) => ToCStruct (ImageMemoryRequirementsInfo2 es) where
  withCStruct :: ImageMemoryRequirementsInfo2 es
-> (Ptr (ImageMemoryRequirementsInfo2 es) -> IO b) -> IO b
withCStruct x :: ImageMemoryRequirementsInfo2 es
x f :: Ptr (ImageMemoryRequirementsInfo2 es) -> IO b
f = Int
-> Int -> (Ptr (ImageMemoryRequirementsInfo2 es) -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 24 8 ((Ptr (ImageMemoryRequirementsInfo2 es) -> IO b) -> IO b)
-> (Ptr (ImageMemoryRequirementsInfo2 es) -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr (ImageMemoryRequirementsInfo2 es)
p -> Ptr (ImageMemoryRequirementsInfo2 es)
-> ImageMemoryRequirementsInfo2 es -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr (ImageMemoryRequirementsInfo2 es)
p ImageMemoryRequirementsInfo2 es
x (Ptr (ImageMemoryRequirementsInfo2 es) -> IO b
f Ptr (ImageMemoryRequirementsInfo2 es)
p)
  pokeCStruct :: Ptr (ImageMemoryRequirementsInfo2 es)
-> ImageMemoryRequirementsInfo2 es -> IO b -> IO b
pokeCStruct p :: Ptr (ImageMemoryRequirementsInfo2 es)
p ImageMemoryRequirementsInfo2{..} f :: IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (ImageMemoryRequirementsInfo2 es)
p Ptr (ImageMemoryRequirementsInfo2 es) -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2)
    Ptr ()
pNext'' <- (Ptr (Chain es) -> Ptr ())
-> ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Ptr (Chain es) -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr (ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ()))
-> (((Ptr (Chain es) -> IO b) -> IO b)
    -> ContT b IO (Ptr (Chain es)))
-> ((Ptr (Chain es) -> IO b) -> IO b)
-> ContT b IO (Ptr ())
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr (Chain es))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ()))
-> ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ Chain es -> (Ptr (Chain es) -> IO b) -> IO b
forall (es :: [*]) a.
PokeChain es =>
Chain es -> (Ptr (Chain es) -> IO a) -> IO a
withChain (Chain es
next)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (ImageMemoryRequirementsInfo2 es)
p Ptr (ImageMemoryRequirementsInfo2 es) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) Ptr ()
pNext''
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Image -> Image -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (ImageMemoryRequirementsInfo2 es)
p Ptr (ImageMemoryRequirementsInfo2 es) -> Int -> Ptr Image
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Image)) (Image
image)
    IO b -> ContT b IO b
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO b -> ContT b IO b) -> IO b -> ContT b IO b
forall a b. (a -> b) -> a -> b
$ IO b
f
  cStructSize :: Int
cStructSize = 24
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr (ImageMemoryRequirementsInfo2 es) -> IO b -> IO b
pokeZeroCStruct p :: Ptr (ImageMemoryRequirementsInfo2 es)
p f :: IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (ImageMemoryRequirementsInfo2 es)
p Ptr (ImageMemoryRequirementsInfo2 es) -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2)
    Ptr ()
pNext' <- (Ptr (Chain es) -> Ptr ())
-> ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Ptr (Chain es) -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr (ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ()))
-> (((Ptr (Chain es) -> IO b) -> IO b)
    -> ContT b IO (Ptr (Chain es)))
-> ((Ptr (Chain es) -> IO b) -> IO b)
-> ContT b IO (Ptr ())
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr (Chain es))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ()))
-> ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ forall a. PokeChain es => (Ptr (Chain es) -> IO a) -> IO a
forall (es :: [*]) a.
PokeChain es =>
(Ptr (Chain es) -> IO a) -> IO a
withZeroChain @es
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (ImageMemoryRequirementsInfo2 es)
p Ptr (ImageMemoryRequirementsInfo2 es) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) Ptr ()
pNext'
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Image -> Image -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (ImageMemoryRequirementsInfo2 es)
p Ptr (ImageMemoryRequirementsInfo2 es) -> Int -> Ptr Image
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Image)) (Image
forall a. Zero a => a
zero)
    IO b -> ContT b IO b
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO b -> ContT b IO b) -> IO b -> ContT b IO b
forall a b. (a -> b) -> a -> b
$ IO b
f

instance (Extendss ImageMemoryRequirementsInfo2 es, PeekChain es) => FromCStruct (ImageMemoryRequirementsInfo2 es) where
  peekCStruct :: Ptr (ImageMemoryRequirementsInfo2 es)
-> IO (ImageMemoryRequirementsInfo2 es)
peekCStruct p :: Ptr (ImageMemoryRequirementsInfo2 es)
p = do
    Ptr ()
pNext <- Ptr (Ptr ()) -> IO (Ptr ())
forall a. Storable a => Ptr a -> IO a
peek @(Ptr ()) ((Ptr (ImageMemoryRequirementsInfo2 es)
p Ptr (ImageMemoryRequirementsInfo2 es) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ())))
    Chain es
next <- Ptr (Chain es) -> IO (Chain es)
forall (es :: [*]). PeekChain es => Ptr (Chain es) -> IO (Chain es)
peekChain (Ptr () -> Ptr (Chain es)
forall a b. Ptr a -> Ptr b
castPtr Ptr ()
pNext)
    Image
image <- Ptr Image -> IO Image
forall a. Storable a => Ptr a -> IO a
peek @Image ((Ptr (ImageMemoryRequirementsInfo2 es)
p Ptr (ImageMemoryRequirementsInfo2 es) -> Int -> Ptr Image
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Image))
    ImageMemoryRequirementsInfo2 es
-> IO (ImageMemoryRequirementsInfo2 es)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ImageMemoryRequirementsInfo2 es
 -> IO (ImageMemoryRequirementsInfo2 es))
-> ImageMemoryRequirementsInfo2 es
-> IO (ImageMemoryRequirementsInfo2 es)
forall a b. (a -> b) -> a -> b
$ Chain es -> Image -> ImageMemoryRequirementsInfo2 es
forall (es :: [*]).
Chain es -> Image -> ImageMemoryRequirementsInfo2 es
ImageMemoryRequirementsInfo2
             Chain es
next Image
image

instance es ~ '[] => Zero (ImageMemoryRequirementsInfo2 es) where
  zero :: ImageMemoryRequirementsInfo2 es
zero = Chain es -> Image -> ImageMemoryRequirementsInfo2 es
forall (es :: [*]).
Chain es -> Image -> ImageMemoryRequirementsInfo2 es
ImageMemoryRequirementsInfo2
           ()
           Image
forall a. Zero a => a
zero


-- | VkImageSparseMemoryRequirementsInfo2 - (None)
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- 'Vulkan.Core10.Handles.Image',
-- 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'getImageSparseMemoryRequirements2',
-- 'Vulkan.Extensions.VK_KHR_get_memory_requirements2.getImageSparseMemoryRequirements2KHR'
data ImageSparseMemoryRequirementsInfo2 = ImageSparseMemoryRequirementsInfo2
  { -- | @image@ is the image to query.
    --
    -- @image@ /must/ be a valid 'Vulkan.Core10.Handles.Image' handle
    ImageSparseMemoryRequirementsInfo2 -> Image
image :: Image }
  deriving (Typeable, ImageSparseMemoryRequirementsInfo2
-> ImageSparseMemoryRequirementsInfo2 -> Bool
(ImageSparseMemoryRequirementsInfo2
 -> ImageSparseMemoryRequirementsInfo2 -> Bool)
-> (ImageSparseMemoryRequirementsInfo2
    -> ImageSparseMemoryRequirementsInfo2 -> Bool)
-> Eq ImageSparseMemoryRequirementsInfo2
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImageSparseMemoryRequirementsInfo2
-> ImageSparseMemoryRequirementsInfo2 -> Bool
$c/= :: ImageSparseMemoryRequirementsInfo2
-> ImageSparseMemoryRequirementsInfo2 -> Bool
== :: ImageSparseMemoryRequirementsInfo2
-> ImageSparseMemoryRequirementsInfo2 -> Bool
$c== :: ImageSparseMemoryRequirementsInfo2
-> ImageSparseMemoryRequirementsInfo2 -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ImageSparseMemoryRequirementsInfo2)
#endif
deriving instance Show ImageSparseMemoryRequirementsInfo2

instance ToCStruct ImageSparseMemoryRequirementsInfo2 where
  withCStruct :: ImageSparseMemoryRequirementsInfo2
-> (("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2) -> IO b)
-> IO b
withCStruct x :: ImageSparseMemoryRequirementsInfo2
x f :: ("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2) -> IO b
f = Int
-> Int
-> (("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2) -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 24 8 ((("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2) -> IO b)
 -> IO b)
-> (("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2) -> IO b)
-> IO b
forall a b. (a -> b) -> a -> b
$ \p :: "pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2
p -> ("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2)
-> ImageSparseMemoryRequirementsInfo2 -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2
p ImageSparseMemoryRequirementsInfo2
x (("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2) -> IO b
f "pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2
p)
  pokeCStruct :: ("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2)
-> ImageSparseMemoryRequirementsInfo2 -> IO b -> IO b
pokeCStruct p :: "pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2
p ImageSparseMemoryRequirementsInfo2{..} f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2
p ("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IMAGE_SPARSE_MEMORY_REQUIREMENTS_INFO_2)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2
p ("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Image -> Image -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2
p ("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2)
-> Int -> Ptr Image
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Image)) (Image
image)
    IO b
f
  cStructSize :: Int
cStructSize = 24
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: ("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2)
-> IO b -> IO b
pokeZeroCStruct p :: "pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2
p ("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IMAGE_SPARSE_MEMORY_REQUIREMENTS_INFO_2)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2
p ("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Image -> Image -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2
p ("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2)
-> Int -> Ptr Image
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Image)) (Image
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct ImageSparseMemoryRequirementsInfo2 where
  peekCStruct :: ("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2)
-> IO ImageSparseMemoryRequirementsInfo2
peekCStruct p :: "pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2
p = do
    Image
image <- Ptr Image -> IO Image
forall a. Storable a => Ptr a -> IO a
peek @Image (("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2
p ("pInfo" ::: Ptr ImageSparseMemoryRequirementsInfo2)
-> Int -> Ptr Image
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Image))
    ImageSparseMemoryRequirementsInfo2
-> IO ImageSparseMemoryRequirementsInfo2
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ImageSparseMemoryRequirementsInfo2
 -> IO ImageSparseMemoryRequirementsInfo2)
-> ImageSparseMemoryRequirementsInfo2
-> IO ImageSparseMemoryRequirementsInfo2
forall a b. (a -> b) -> a -> b
$ Image -> ImageSparseMemoryRequirementsInfo2
ImageSparseMemoryRequirementsInfo2
             Image
image

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

instance Zero ImageSparseMemoryRequirementsInfo2 where
  zero :: ImageSparseMemoryRequirementsInfo2
zero = Image -> ImageSparseMemoryRequirementsInfo2
ImageSparseMemoryRequirementsInfo2
           Image
forall a. Zero a => a
zero


-- | VkMemoryRequirements2 - Structure specifying memory requirements
--
-- == Valid Usage (Implicit)
--
-- -   @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2'
--
-- -   @pNext@ /must/ be @NULL@ or a pointer to a valid instance of
--     'Vulkan.Core11.Promoted_From_VK_KHR_dedicated_allocation.MemoryDedicatedRequirements'
--
-- -   The @sType@ value of each struct in the @pNext@ chain /must/ be
--     unique
--
-- = See Also
--
-- 'Vulkan.Core10.MemoryManagement.MemoryRequirements',
-- 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'Vulkan.Extensions.VK_KHR_ray_tracing.getAccelerationStructureMemoryRequirementsKHR',
-- 'getBufferMemoryRequirements2',
-- 'Vulkan.Extensions.VK_KHR_get_memory_requirements2.getBufferMemoryRequirements2KHR',
-- 'Vulkan.Extensions.VK_NV_device_generated_commands.getGeneratedCommandsMemoryRequirementsNV',
-- 'getImageMemoryRequirements2',
-- 'Vulkan.Extensions.VK_KHR_get_memory_requirements2.getImageMemoryRequirements2KHR'
data MemoryRequirements2 (es :: [Type]) = MemoryRequirements2
  { -- | @pNext@ is @NULL@ or a pointer to a structure extending this structure.
    MemoryRequirements2 es -> Chain es
next :: Chain es
  , -- | @memoryRequirements@ is a
    -- 'Vulkan.Core10.MemoryManagement.MemoryRequirements' structure describing
    -- the memory requirements of the resource.
    MemoryRequirements2 es -> MemoryRequirements
memoryRequirements :: MemoryRequirements
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (MemoryRequirements2 (es :: [Type]))
#endif
deriving instance Show (Chain es) => Show (MemoryRequirements2 es)

instance Extensible MemoryRequirements2 where
  extensibleType :: StructureType
extensibleType = StructureType
STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2
  setNext :: MemoryRequirements2 ds -> Chain es -> MemoryRequirements2 es
setNext x :: MemoryRequirements2 ds
x next :: Chain es
next = MemoryRequirements2 ds
x{$sel:next:MemoryRequirements2 :: Chain es
next = Chain es
next}
  getNext :: MemoryRequirements2 es -> Chain es
getNext MemoryRequirements2{..} = Chain es
next
  extends :: forall e b proxy. Typeable e => proxy e -> (Extends MemoryRequirements2 e => b) -> Maybe b
  extends :: proxy e -> (Extends MemoryRequirements2 e => b) -> Maybe b
extends _ f :: Extends MemoryRequirements2 e => b
f
    | Just Refl <- (Typeable e, Typeable MemoryDedicatedRequirements) =>
Maybe (e :~: MemoryDedicatedRequirements)
forall k (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
eqT @e @MemoryDedicatedRequirements = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends MemoryRequirements2 e => b
f
    | Bool
otherwise = Maybe b
forall a. Maybe a
Nothing

instance (Extendss MemoryRequirements2 es, PokeChain es) => ToCStruct (MemoryRequirements2 es) where
  withCStruct :: MemoryRequirements2 es
-> (Ptr (MemoryRequirements2 es) -> IO b) -> IO b
withCStruct x :: MemoryRequirements2 es
x f :: Ptr (MemoryRequirements2 es) -> IO b
f = Int -> Int -> (Ptr (MemoryRequirements2 es) -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 40 8 ((Ptr (MemoryRequirements2 es) -> IO b) -> IO b)
-> (Ptr (MemoryRequirements2 es) -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr (MemoryRequirements2 es)
p -> Ptr (MemoryRequirements2 es)
-> MemoryRequirements2 es -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr (MemoryRequirements2 es)
p MemoryRequirements2 es
x (Ptr (MemoryRequirements2 es) -> IO b
f Ptr (MemoryRequirements2 es)
p)
  pokeCStruct :: Ptr (MemoryRequirements2 es)
-> MemoryRequirements2 es -> IO b -> IO b
pokeCStruct p :: Ptr (MemoryRequirements2 es)
p MemoryRequirements2{..} f :: IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (MemoryRequirements2 es)
p Ptr (MemoryRequirements2 es) -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2)
    Ptr ()
pNext'' <- (Ptr (Chain es) -> Ptr ())
-> ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Ptr (Chain es) -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr (ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ()))
-> (((Ptr (Chain es) -> IO b) -> IO b)
    -> ContT b IO (Ptr (Chain es)))
-> ((Ptr (Chain es) -> IO b) -> IO b)
-> ContT b IO (Ptr ())
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr (Chain es))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ()))
-> ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ Chain es -> (Ptr (Chain es) -> IO b) -> IO b
forall (es :: [*]) a.
PokeChain es =>
Chain es -> (Ptr (Chain es) -> IO a) -> IO a
withChain (Chain es
next)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (MemoryRequirements2 es)
p Ptr (MemoryRequirements2 es) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) Ptr ()
pNext''
    ((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr MemoryRequirements -> MemoryRequirements -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct ((Ptr (MemoryRequirements2 es)
p Ptr (MemoryRequirements2 es) -> Int -> Ptr MemoryRequirements
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr MemoryRequirements)) (MemoryRequirements
memoryRequirements) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())
    IO b -> ContT b IO b
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO b -> ContT b IO b) -> IO b -> ContT b IO b
forall a b. (a -> b) -> a -> b
$ IO b
f
  cStructSize :: Int
cStructSize = 40
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr (MemoryRequirements2 es) -> IO b -> IO b
pokeZeroCStruct p :: Ptr (MemoryRequirements2 es)
p f :: IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (MemoryRequirements2 es)
p Ptr (MemoryRequirements2 es) -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2)
    Ptr ()
pNext' <- (Ptr (Chain es) -> Ptr ())
-> ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Ptr (Chain es) -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr (ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ()))
-> (((Ptr (Chain es) -> IO b) -> IO b)
    -> ContT b IO (Ptr (Chain es)))
-> ((Ptr (Chain es) -> IO b) -> IO b)
-> ContT b IO (Ptr ())
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr (Chain es))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ()))
-> ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ forall a. PokeChain es => (Ptr (Chain es) -> IO a) -> IO a
forall (es :: [*]) a.
PokeChain es =>
(Ptr (Chain es) -> IO a) -> IO a
withZeroChain @es
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (MemoryRequirements2 es)
p Ptr (MemoryRequirements2 es) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) Ptr ()
pNext'
    ((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr MemoryRequirements -> MemoryRequirements -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct ((Ptr (MemoryRequirements2 es)
p Ptr (MemoryRequirements2 es) -> Int -> Ptr MemoryRequirements
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr MemoryRequirements)) (MemoryRequirements
forall a. Zero a => a
zero) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())
    IO b -> ContT b IO b
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO b -> ContT b IO b) -> IO b -> ContT b IO b
forall a b. (a -> b) -> a -> b
$ IO b
f

instance (Extendss MemoryRequirements2 es, PeekChain es) => FromCStruct (MemoryRequirements2 es) where
  peekCStruct :: Ptr (MemoryRequirements2 es) -> IO (MemoryRequirements2 es)
peekCStruct p :: Ptr (MemoryRequirements2 es)
p = do
    Ptr ()
pNext <- Ptr (Ptr ()) -> IO (Ptr ())
forall a. Storable a => Ptr a -> IO a
peek @(Ptr ()) ((Ptr (MemoryRequirements2 es)
p Ptr (MemoryRequirements2 es) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ())))
    Chain es
next <- Ptr (Chain es) -> IO (Chain es)
forall (es :: [*]). PeekChain es => Ptr (Chain es) -> IO (Chain es)
peekChain (Ptr () -> Ptr (Chain es)
forall a b. Ptr a -> Ptr b
castPtr Ptr ()
pNext)
    MemoryRequirements
memoryRequirements <- Ptr MemoryRequirements -> IO MemoryRequirements
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @MemoryRequirements ((Ptr (MemoryRequirements2 es)
p Ptr (MemoryRequirements2 es) -> Int -> Ptr MemoryRequirements
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr MemoryRequirements))
    MemoryRequirements2 es -> IO (MemoryRequirements2 es)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (MemoryRequirements2 es -> IO (MemoryRequirements2 es))
-> MemoryRequirements2 es -> IO (MemoryRequirements2 es)
forall a b. (a -> b) -> a -> b
$ Chain es -> MemoryRequirements -> MemoryRequirements2 es
forall (es :: [*]).
Chain es -> MemoryRequirements -> MemoryRequirements2 es
MemoryRequirements2
             Chain es
next MemoryRequirements
memoryRequirements

instance es ~ '[] => Zero (MemoryRequirements2 es) where
  zero :: MemoryRequirements2 es
zero = Chain es -> MemoryRequirements -> MemoryRequirements2 es
forall (es :: [*]).
Chain es -> MemoryRequirements -> MemoryRequirements2 es
MemoryRequirements2
           ()
           MemoryRequirements
forall a. Zero a => a
zero


-- | VkSparseImageMemoryRequirements2 - (None)
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- 'Vulkan.Core10.SparseResourceMemoryManagement.SparseImageMemoryRequirements',
-- 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'getImageSparseMemoryRequirements2',
-- 'Vulkan.Extensions.VK_KHR_get_memory_requirements2.getImageSparseMemoryRequirements2KHR'
data SparseImageMemoryRequirements2 = SparseImageMemoryRequirements2
  { -- | @memoryRequirements@ is a
    -- 'Vulkan.Core10.SparseResourceMemoryManagement.SparseImageMemoryRequirements'
    -- structure describing the memory requirements of the sparse image.
    SparseImageMemoryRequirements2 -> SparseImageMemoryRequirements
memoryRequirements :: SparseImageMemoryRequirements }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (SparseImageMemoryRequirements2)
#endif
deriving instance Show SparseImageMemoryRequirements2

instance ToCStruct SparseImageMemoryRequirements2 where
  withCStruct :: SparseImageMemoryRequirements2
-> (("pSparseMemoryRequirements"
     ::: Ptr SparseImageMemoryRequirements2)
    -> IO b)
-> IO b
withCStruct x :: SparseImageMemoryRequirements2
x f :: ("pSparseMemoryRequirements"
 ::: Ptr SparseImageMemoryRequirements2)
-> IO b
f = Int
-> Int
-> (("pSparseMemoryRequirements"
     ::: Ptr SparseImageMemoryRequirements2)
    -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 64 8 ((("pSparseMemoryRequirements"
   ::: Ptr SparseImageMemoryRequirements2)
  -> IO b)
 -> IO b)
-> (("pSparseMemoryRequirements"
     ::: Ptr SparseImageMemoryRequirements2)
    -> IO b)
-> IO b
forall a b. (a -> b) -> a -> b
$ \p :: "pSparseMemoryRequirements" ::: Ptr SparseImageMemoryRequirements2
p -> ("pSparseMemoryRequirements"
 ::: Ptr SparseImageMemoryRequirements2)
-> SparseImageMemoryRequirements2 -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pSparseMemoryRequirements" ::: Ptr SparseImageMemoryRequirements2
p SparseImageMemoryRequirements2
x (("pSparseMemoryRequirements"
 ::: Ptr SparseImageMemoryRequirements2)
-> IO b
f "pSparseMemoryRequirements" ::: Ptr SparseImageMemoryRequirements2
p)
  pokeCStruct :: ("pSparseMemoryRequirements"
 ::: Ptr SparseImageMemoryRequirements2)
-> SparseImageMemoryRequirements2 -> IO b -> IO b
pokeCStruct p :: "pSparseMemoryRequirements" ::: Ptr SparseImageMemoryRequirements2
p SparseImageMemoryRequirements2{..} f :: IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pSparseMemoryRequirements" ::: Ptr SparseImageMemoryRequirements2
p ("pSparseMemoryRequirements"
 ::: Ptr SparseImageMemoryRequirements2)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_SPARSE_IMAGE_MEMORY_REQUIREMENTS_2)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pSparseMemoryRequirements" ::: Ptr SparseImageMemoryRequirements2
p ("pSparseMemoryRequirements"
 ::: Ptr SparseImageMemoryRequirements2)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    ((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr SparseImageMemoryRequirements
-> SparseImageMemoryRequirements -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct (("pSparseMemoryRequirements" ::: Ptr SparseImageMemoryRequirements2
p ("pSparseMemoryRequirements"
 ::: Ptr SparseImageMemoryRequirements2)
-> Int -> Ptr SparseImageMemoryRequirements
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr SparseImageMemoryRequirements)) (SparseImageMemoryRequirements
memoryRequirements) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())
    IO b -> ContT b IO b
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO b -> ContT b IO b) -> IO b -> ContT b IO b
forall a b. (a -> b) -> a -> b
$ IO b
f
  cStructSize :: Int
cStructSize = 64
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: ("pSparseMemoryRequirements"
 ::: Ptr SparseImageMemoryRequirements2)
-> IO b -> IO b
pokeZeroCStruct p :: "pSparseMemoryRequirements" ::: Ptr SparseImageMemoryRequirements2
p f :: IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pSparseMemoryRequirements" ::: Ptr SparseImageMemoryRequirements2
p ("pSparseMemoryRequirements"
 ::: Ptr SparseImageMemoryRequirements2)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_SPARSE_IMAGE_MEMORY_REQUIREMENTS_2)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pSparseMemoryRequirements" ::: Ptr SparseImageMemoryRequirements2
p ("pSparseMemoryRequirements"
 ::: Ptr SparseImageMemoryRequirements2)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    ((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr SparseImageMemoryRequirements
-> SparseImageMemoryRequirements -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct (("pSparseMemoryRequirements" ::: Ptr SparseImageMemoryRequirements2
p ("pSparseMemoryRequirements"
 ::: Ptr SparseImageMemoryRequirements2)
-> Int -> Ptr SparseImageMemoryRequirements
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr SparseImageMemoryRequirements)) (SparseImageMemoryRequirements
forall a. Zero a => a
zero) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())
    IO b -> ContT b IO b
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO b -> ContT b IO b) -> IO b -> ContT b IO b
forall a b. (a -> b) -> a -> b
$ IO b
f

instance FromCStruct SparseImageMemoryRequirements2 where
  peekCStruct :: ("pSparseMemoryRequirements"
 ::: Ptr SparseImageMemoryRequirements2)
-> IO SparseImageMemoryRequirements2
peekCStruct p :: "pSparseMemoryRequirements" ::: Ptr SparseImageMemoryRequirements2
p = do
    SparseImageMemoryRequirements
memoryRequirements <- Ptr SparseImageMemoryRequirements
-> IO SparseImageMemoryRequirements
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @SparseImageMemoryRequirements (("pSparseMemoryRequirements" ::: Ptr SparseImageMemoryRequirements2
p ("pSparseMemoryRequirements"
 ::: Ptr SparseImageMemoryRequirements2)
-> Int -> Ptr SparseImageMemoryRequirements
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr SparseImageMemoryRequirements))
    SparseImageMemoryRequirements2 -> IO SparseImageMemoryRequirements2
forall (f :: * -> *) a. Applicative f => a -> f a
pure (SparseImageMemoryRequirements2
 -> IO SparseImageMemoryRequirements2)
-> SparseImageMemoryRequirements2
-> IO SparseImageMemoryRequirements2
forall a b. (a -> b) -> a -> b
$ SparseImageMemoryRequirements -> SparseImageMemoryRequirements2
SparseImageMemoryRequirements2
             SparseImageMemoryRequirements
memoryRequirements

instance Zero SparseImageMemoryRequirements2 where
  zero :: SparseImageMemoryRequirements2
zero = SparseImageMemoryRequirements -> SparseImageMemoryRequirements2
SparseImageMemoryRequirements2
           SparseImageMemoryRequirements
forall a. Zero a => a
zero