{-# language CPP #-}
module Vulkan.Core13.Promoted_From_VK_KHR_maintenance4 ( getDeviceBufferMemoryRequirements
, getDeviceImageMemoryRequirements
, getDeviceImageSparseMemoryRequirements
, DeviceBufferMemoryRequirements(..)
, DeviceImageMemoryRequirements(..)
, PhysicalDeviceMaintenance4Features(..)
, PhysicalDeviceMaintenance4Properties(..)
, StructureType(..)
, ImageAspectFlagBits(..)
, ImageAspectFlags
) where
import Vulkan.Internal.Utils (traceAroundEvent)
import Control.Exception.Base (bracket)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Foreign.Marshal.Alloc (allocaBytes)
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 Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Zero (Zero(..))
import Control.Monad.IO.Class (MonadIO)
import Data.Typeable (Typeable)
import Foreign.Storable (Storable)
import Foreign.Storable (Storable(peek))
import Foreign.Storable (Storable(poke))
import qualified Foreign.Storable (Storable(..))
import GHC.Generics (Generic)
import GHC.IO.Exception (IOErrorType(..))
import GHC.IO.Exception (IOException(..))
import Foreign.Ptr (FunPtr)
import Foreign.Ptr (Ptr)
import Data.Word (Word32)
import Data.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Data.Vector (Vector)
import Vulkan.CStruct.Utils (advancePtrBytes)
import Vulkan.Core10.FundamentalTypes (bool32ToBool)
import Vulkan.Core10.FundamentalTypes (boolToBool32)
import Vulkan.CStruct.Extends (forgetExtensions)
import Vulkan.CStruct.Extends (peekSomeCStruct)
import Vulkan.CStruct.Extends (withSomeCStruct)
import Vulkan.NamedType ((:::))
import Vulkan.Core10.FundamentalTypes (Bool32)
import Vulkan.Core10.Buffer (BufferCreateInfo)
import Vulkan.Core10.Handles (Device)
import Vulkan.Core10.Handles (Device(..))
import Vulkan.Core10.Handles (Device(Device))
import Vulkan.Dynamic (DeviceCmds(pVkGetDeviceBufferMemoryRequirements))
import Vulkan.Dynamic (DeviceCmds(pVkGetDeviceImageMemoryRequirements))
import Vulkan.Dynamic (DeviceCmds(pVkGetDeviceImageSparseMemoryRequirements))
import Vulkan.Core10.FundamentalTypes (DeviceSize)
import Vulkan.Core10.Handles (Device_T)
import Vulkan.CStruct.Extends (Extendss)
import Vulkan.Core10.Enums.ImageAspectFlagBits (ImageAspectFlagBits)
import Vulkan.Core10.Image (ImageCreateInfo)
import Vulkan.Core11.Promoted_From_VK_KHR_get_memory_requirements2 (MemoryRequirements2)
import Vulkan.CStruct.Extends (PeekChain)
import Vulkan.CStruct.Extends (PokeChain)
import Vulkan.CStruct.Extends (SomeStruct)
import Vulkan.CStruct.Extends (SomeStruct(..))
import Vulkan.Core11.Promoted_From_VK_KHR_get_memory_requirements2 (SparseImageMemoryRequirements2)
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_DEVICE_BUFFER_MEMORY_REQUIREMENTS))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_DEVICE_IMAGE_MEMORY_REQUIREMENTS))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_FEATURES))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_PROPERTIES))
import Vulkan.Core10.Enums.ImageAspectFlagBits (ImageAspectFlagBits(..))
import Vulkan.Core10.Enums.ImageAspectFlagBits (ImageAspectFlags)
import Vulkan.Core10.Enums.StructureType (StructureType(..))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkGetDeviceBufferMemoryRequirements
:: FunPtr (Ptr Device_T -> Ptr DeviceBufferMemoryRequirements -> Ptr (SomeStruct MemoryRequirements2) -> IO ()) -> Ptr Device_T -> Ptr DeviceBufferMemoryRequirements -> Ptr (SomeStruct MemoryRequirements2) -> IO ()
getDeviceBufferMemoryRequirements :: forall a io
. ( Extendss MemoryRequirements2 a
, PokeChain a
, PeekChain a
, MonadIO io )
=>
Device
->
("info" ::: DeviceBufferMemoryRequirements)
-> io (MemoryRequirements2 a)
getDeviceBufferMemoryRequirements :: forall (a :: [*]) (io :: * -> *).
(Extendss MemoryRequirements2 a, PokeChain a, PeekChain a,
MonadIO io) =>
Device
-> DeviceBufferMemoryRequirements -> io (MemoryRequirements2 a)
getDeviceBufferMemoryRequirements Device
device DeviceBufferMemoryRequirements
info = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT forall a b. (a -> b) -> a -> b
$ do
let vkGetDeviceBufferMemoryRequirementsPtr :: FunPtr
(Ptr Device_T
-> ("pInfo" ::: Ptr DeviceBufferMemoryRequirements)
-> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
-> IO ())
vkGetDeviceBufferMemoryRequirementsPtr = DeviceCmds
-> FunPtr
(Ptr Device_T
-> ("pInfo" ::: Ptr DeviceBufferMemoryRequirements)
-> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
-> IO ())
pVkGetDeviceBufferMemoryRequirements (case Device
device of Device{DeviceCmds
$sel:deviceCmds:Device :: Device -> DeviceCmds
deviceCmds :: DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
(Ptr Device_T
-> ("pInfo" ::: Ptr DeviceBufferMemoryRequirements)
-> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
-> IO ())
vkGetDeviceBufferMemoryRequirementsPtr forall a. Eq a => a -> a -> Bool
/= forall a. FunPtr a
nullFunPtr) forall a b. (a -> b) -> a -> b
$
forall e a. Exception e => e -> IO a
throwIO forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"The function pointer for vkGetDeviceBufferMemoryRequirements is null" forall a. Maybe a
Nothing forall a. Maybe a
Nothing
let vkGetDeviceBufferMemoryRequirements' :: Ptr Device_T
-> ("pInfo" ::: Ptr DeviceBufferMemoryRequirements)
-> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
-> IO ()
vkGetDeviceBufferMemoryRequirements' = FunPtr
(Ptr Device_T
-> ("pInfo" ::: Ptr DeviceBufferMemoryRequirements)
-> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
-> IO ())
-> Ptr Device_T
-> ("pInfo" ::: Ptr DeviceBufferMemoryRequirements)
-> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
-> IO ()
mkVkGetDeviceBufferMemoryRequirements FunPtr
(Ptr Device_T
-> ("pInfo" ::: Ptr DeviceBufferMemoryRequirements)
-> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
-> IO ())
vkGetDeviceBufferMemoryRequirementsPtr
"pInfo" ::: Ptr DeviceBufferMemoryRequirements
pInfo <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT forall a b. (a -> b) -> a -> b
$ forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (DeviceBufferMemoryRequirements
info)
Ptr (MemoryRequirements2 a)
pPMemoryRequirements <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (forall a b. ToCStruct a => (Ptr a -> IO b) -> IO b
withZeroCStruct @(MemoryRequirements2 _))
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. String -> IO a -> IO a
traceAroundEvent String
"vkGetDeviceBufferMemoryRequirements" (Ptr Device_T
-> ("pInfo" ::: Ptr DeviceBufferMemoryRequirements)
-> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
-> IO ()
vkGetDeviceBufferMemoryRequirements'
(Device -> Ptr Device_T
deviceHandle (Device
device))
"pInfo" ::: Ptr DeviceBufferMemoryRequirements
pInfo
(forall (a :: [*] -> *) (es :: [*]).
Ptr (a es) -> Ptr (SomeStruct a)
forgetExtensions (Ptr (MemoryRequirements2 a)
pPMemoryRequirements)))
MemoryRequirements2 a
pMemoryRequirements <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @(MemoryRequirements2 _) Ptr (MemoryRequirements2 a)
pPMemoryRequirements
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ (MemoryRequirements2 a
pMemoryRequirements)
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkGetDeviceImageMemoryRequirements
:: FunPtr (Ptr Device_T -> Ptr DeviceImageMemoryRequirements -> Ptr (SomeStruct MemoryRequirements2) -> IO ()) -> Ptr Device_T -> Ptr DeviceImageMemoryRequirements -> Ptr (SomeStruct MemoryRequirements2) -> IO ()
getDeviceImageMemoryRequirements :: forall a io
. ( Extendss MemoryRequirements2 a
, PokeChain a
, PeekChain a
, MonadIO io )
=>
Device
->
("info" ::: DeviceImageMemoryRequirements)
-> io (MemoryRequirements2 a)
getDeviceImageMemoryRequirements :: forall (a :: [*]) (io :: * -> *).
(Extendss MemoryRequirements2 a, PokeChain a, PeekChain a,
MonadIO io) =>
Device
-> DeviceImageMemoryRequirements -> io (MemoryRequirements2 a)
getDeviceImageMemoryRequirements Device
device DeviceImageMemoryRequirements
info = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT forall a b. (a -> b) -> a -> b
$ do
let vkGetDeviceImageMemoryRequirementsPtr :: FunPtr
(Ptr Device_T
-> ("pInfo" ::: Ptr DeviceImageMemoryRequirements)
-> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
-> IO ())
vkGetDeviceImageMemoryRequirementsPtr = DeviceCmds
-> FunPtr
(Ptr Device_T
-> ("pInfo" ::: Ptr DeviceImageMemoryRequirements)
-> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
-> IO ())
pVkGetDeviceImageMemoryRequirements (case Device
device of Device{DeviceCmds
deviceCmds :: DeviceCmds
$sel:deviceCmds:Device :: Device -> DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
(Ptr Device_T
-> ("pInfo" ::: Ptr DeviceImageMemoryRequirements)
-> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
-> IO ())
vkGetDeviceImageMemoryRequirementsPtr forall a. Eq a => a -> a -> Bool
/= forall a. FunPtr a
nullFunPtr) forall a b. (a -> b) -> a -> b
$
forall e a. Exception e => e -> IO a
throwIO forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"The function pointer for vkGetDeviceImageMemoryRequirements is null" forall a. Maybe a
Nothing forall a. Maybe a
Nothing
let vkGetDeviceImageMemoryRequirements' :: Ptr Device_T
-> ("pInfo" ::: Ptr DeviceImageMemoryRequirements)
-> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
-> IO ()
vkGetDeviceImageMemoryRequirements' = FunPtr
(Ptr Device_T
-> ("pInfo" ::: Ptr DeviceImageMemoryRequirements)
-> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
-> IO ())
-> Ptr Device_T
-> ("pInfo" ::: Ptr DeviceImageMemoryRequirements)
-> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
-> IO ()
mkVkGetDeviceImageMemoryRequirements FunPtr
(Ptr Device_T
-> ("pInfo" ::: Ptr DeviceImageMemoryRequirements)
-> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
-> IO ())
vkGetDeviceImageMemoryRequirementsPtr
"pInfo" ::: Ptr DeviceImageMemoryRequirements
pInfo <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT forall a b. (a -> b) -> a -> b
$ forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (DeviceImageMemoryRequirements
info)
Ptr (MemoryRequirements2 a)
pPMemoryRequirements <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (forall a b. ToCStruct a => (Ptr a -> IO b) -> IO b
withZeroCStruct @(MemoryRequirements2 _))
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. String -> IO a -> IO a
traceAroundEvent String
"vkGetDeviceImageMemoryRequirements" (Ptr Device_T
-> ("pInfo" ::: Ptr DeviceImageMemoryRequirements)
-> ("pMemoryRequirements" ::: Ptr (SomeStruct MemoryRequirements2))
-> IO ()
vkGetDeviceImageMemoryRequirements'
(Device -> Ptr Device_T
deviceHandle (Device
device))
"pInfo" ::: Ptr DeviceImageMemoryRequirements
pInfo
(forall (a :: [*] -> *) (es :: [*]).
Ptr (a es) -> Ptr (SomeStruct a)
forgetExtensions (Ptr (MemoryRequirements2 a)
pPMemoryRequirements)))
MemoryRequirements2 a
pMemoryRequirements <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @(MemoryRequirements2 _) Ptr (MemoryRequirements2 a)
pPMemoryRequirements
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ (MemoryRequirements2 a
pMemoryRequirements)
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkGetDeviceImageSparseMemoryRequirements
:: FunPtr (Ptr Device_T -> Ptr DeviceImageMemoryRequirements -> Ptr Word32 -> Ptr SparseImageMemoryRequirements2 -> IO ()) -> Ptr Device_T -> Ptr DeviceImageMemoryRequirements -> Ptr Word32 -> Ptr SparseImageMemoryRequirements2 -> IO ()
getDeviceImageSparseMemoryRequirements :: forall io
. (MonadIO io)
=>
Device
->
("info" ::: DeviceImageMemoryRequirements)
-> io (("sparseMemoryRequirements" ::: Vector SparseImageMemoryRequirements2))
getDeviceImageSparseMemoryRequirements :: forall (io :: * -> *).
MonadIO io =>
Device
-> DeviceImageMemoryRequirements
-> io
("sparseMemoryRequirements"
::: Vector SparseImageMemoryRequirements2)
getDeviceImageSparseMemoryRequirements Device
device DeviceImageMemoryRequirements
info = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT forall a b. (a -> b) -> a -> b
$ do
let vkGetDeviceImageSparseMemoryRequirementsPtr :: FunPtr
(Ptr Device_T
-> ("pInfo" ::: Ptr DeviceImageMemoryRequirements)
-> ("pSparseMemoryRequirementCount" ::: Ptr Word32)
-> ("pSparseMemoryRequirements"
::: Ptr SparseImageMemoryRequirements2)
-> IO ())
vkGetDeviceImageSparseMemoryRequirementsPtr = DeviceCmds
-> FunPtr
(Ptr Device_T
-> ("pInfo" ::: Ptr DeviceImageMemoryRequirements)
-> ("pSparseMemoryRequirementCount" ::: Ptr Word32)
-> ("pSparseMemoryRequirements"
::: Ptr SparseImageMemoryRequirements2)
-> IO ())
pVkGetDeviceImageSparseMemoryRequirements (case Device
device of Device{DeviceCmds
deviceCmds :: DeviceCmds
$sel:deviceCmds:Device :: Device -> DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
(Ptr Device_T
-> ("pInfo" ::: Ptr DeviceImageMemoryRequirements)
-> ("pSparseMemoryRequirementCount" ::: Ptr Word32)
-> ("pSparseMemoryRequirements"
::: Ptr SparseImageMemoryRequirements2)
-> IO ())
vkGetDeviceImageSparseMemoryRequirementsPtr forall a. Eq a => a -> a -> Bool
/= forall a. FunPtr a
nullFunPtr) forall a b. (a -> b) -> a -> b
$
forall e a. Exception e => e -> IO a
throwIO forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"The function pointer for vkGetDeviceImageSparseMemoryRequirements is null" forall a. Maybe a
Nothing forall a. Maybe a
Nothing
let vkGetDeviceImageSparseMemoryRequirements' :: Ptr Device_T
-> ("pInfo" ::: Ptr DeviceImageMemoryRequirements)
-> ("pSparseMemoryRequirementCount" ::: Ptr Word32)
-> ("pSparseMemoryRequirements"
::: Ptr SparseImageMemoryRequirements2)
-> IO ()
vkGetDeviceImageSparseMemoryRequirements' = FunPtr
(Ptr Device_T
-> ("pInfo" ::: Ptr DeviceImageMemoryRequirements)
-> ("pSparseMemoryRequirementCount" ::: Ptr Word32)
-> ("pSparseMemoryRequirements"
::: Ptr SparseImageMemoryRequirements2)
-> IO ())
-> Ptr Device_T
-> ("pInfo" ::: Ptr DeviceImageMemoryRequirements)
-> ("pSparseMemoryRequirementCount" ::: Ptr Word32)
-> ("pSparseMemoryRequirements"
::: Ptr SparseImageMemoryRequirements2)
-> IO ()
mkVkGetDeviceImageSparseMemoryRequirements FunPtr
(Ptr Device_T
-> ("pInfo" ::: Ptr DeviceImageMemoryRequirements)
-> ("pSparseMemoryRequirementCount" ::: Ptr Word32)
-> ("pSparseMemoryRequirements"
::: Ptr SparseImageMemoryRequirements2)
-> IO ())
vkGetDeviceImageSparseMemoryRequirementsPtr
let device' :: Ptr Device_T
device' = Device -> Ptr Device_T
deviceHandle (Device
device)
"pInfo" ::: Ptr DeviceImageMemoryRequirements
pInfo <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT forall a b. (a -> b) -> a -> b
$ forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (DeviceImageMemoryRequirements
info)
"pSparseMemoryRequirementCount" ::: Ptr Word32
pPSparseMemoryRequirementCount <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT forall a b. (a -> b) -> a -> b
$ forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (forall a. Int -> IO (Ptr a)
callocBytes @Word32 Int
4) forall a. Ptr a -> IO ()
free
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. String -> IO a -> IO a
traceAroundEvent String
"vkGetDeviceImageSparseMemoryRequirements" (Ptr Device_T
-> ("pInfo" ::: Ptr DeviceImageMemoryRequirements)
-> ("pSparseMemoryRequirementCount" ::: Ptr Word32)
-> ("pSparseMemoryRequirements"
::: Ptr SparseImageMemoryRequirements2)
-> IO ()
vkGetDeviceImageSparseMemoryRequirements'
Ptr Device_T
device'
"pInfo" ::: Ptr DeviceImageMemoryRequirements
pInfo
("pSparseMemoryRequirementCount" ::: Ptr Word32
pPSparseMemoryRequirementCount)
(forall a. Ptr a
nullPtr))
Word32
pSparseMemoryRequirementCount <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> IO a
peek @Word32 "pSparseMemoryRequirementCount" ::: Ptr Word32
pPSparseMemoryRequirementCount
"pSparseMemoryRequirements" ::: Ptr SparseImageMemoryRequirements2
pPSparseMemoryRequirements <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT forall a b. (a -> b) -> a -> b
$ forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (forall a. Int -> IO (Ptr a)
callocBytes @SparseImageMemoryRequirements2 ((forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32
pSparseMemoryRequirementCount)) forall a. Num a => a -> a -> a
* Int
64)) forall a. Ptr a -> IO ()
free
[()]
_ <- forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse (\Int
i -> forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT forall a b. (a -> b) -> a -> b
$ forall a b. ToCStruct a => Ptr a -> IO b -> IO b
pokeZeroCStruct ("pSparseMemoryRequirements" ::: Ptr SparseImageMemoryRequirements2
pPSparseMemoryRequirements forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
i forall a. Num a => a -> a -> a
* Int
64) :: Ptr SparseImageMemoryRequirements2) forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall a b. (a -> b) -> a -> b
$ ())) [Int
0..(forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32
pSparseMemoryRequirementCount)) forall a. Num a => a -> a -> a
- Int
1]
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. String -> IO a -> IO a
traceAroundEvent String
"vkGetDeviceImageSparseMemoryRequirements" (Ptr Device_T
-> ("pInfo" ::: Ptr DeviceImageMemoryRequirements)
-> ("pSparseMemoryRequirementCount" ::: Ptr Word32)
-> ("pSparseMemoryRequirements"
::: Ptr SparseImageMemoryRequirements2)
-> IO ()
vkGetDeviceImageSparseMemoryRequirements'
Ptr Device_T
device'
"pInfo" ::: Ptr DeviceImageMemoryRequirements
pInfo
("pSparseMemoryRequirementCount" ::: Ptr Word32
pPSparseMemoryRequirementCount)
(("pSparseMemoryRequirements" ::: Ptr SparseImageMemoryRequirements2
pPSparseMemoryRequirements)))
Word32
pSparseMemoryRequirementCount' <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> IO a
peek @Word32 "pSparseMemoryRequirementCount" ::: Ptr Word32
pPSparseMemoryRequirementCount
"sparseMemoryRequirements"
::: Vector SparseImageMemoryRequirements2
pSparseMemoryRequirements' <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM (forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32
pSparseMemoryRequirementCount')) (\Int
i -> forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @SparseImageMemoryRequirements2 ((("pSparseMemoryRequirements" ::: Ptr SparseImageMemoryRequirements2
pPSparseMemoryRequirements) forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
64 forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr SparseImageMemoryRequirements2)))
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ ("sparseMemoryRequirements"
::: Vector SparseImageMemoryRequirements2
pSparseMemoryRequirements')
data DeviceBufferMemoryRequirements = DeviceBufferMemoryRequirements
{
DeviceBufferMemoryRequirements -> SomeStruct BufferCreateInfo
createInfo :: SomeStruct BufferCreateInfo }
deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (DeviceBufferMemoryRequirements)
#endif
deriving instance Show DeviceBufferMemoryRequirements
instance ToCStruct DeviceBufferMemoryRequirements where
withCStruct :: forall b.
DeviceBufferMemoryRequirements
-> (("pInfo" ::: Ptr DeviceBufferMemoryRequirements) -> IO b)
-> IO b
withCStruct DeviceBufferMemoryRequirements
x ("pInfo" ::: Ptr DeviceBufferMemoryRequirements) -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
24 forall a b. (a -> b) -> a -> b
$ \"pInfo" ::: Ptr DeviceBufferMemoryRequirements
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pInfo" ::: Ptr DeviceBufferMemoryRequirements
p DeviceBufferMemoryRequirements
x (("pInfo" ::: Ptr DeviceBufferMemoryRequirements) -> IO b
f "pInfo" ::: Ptr DeviceBufferMemoryRequirements
p)
pokeCStruct :: forall b.
("pInfo" ::: Ptr DeviceBufferMemoryRequirements)
-> DeviceBufferMemoryRequirements -> IO b -> IO b
pokeCStruct "pInfo" ::: Ptr DeviceBufferMemoryRequirements
p DeviceBufferMemoryRequirements{SomeStruct BufferCreateInfo
createInfo :: SomeStruct BufferCreateInfo
$sel:createInfo:DeviceBufferMemoryRequirements :: DeviceBufferMemoryRequirements -> SomeStruct BufferCreateInfo
..} IO b
f = forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT forall a b. (a -> b) -> a -> b
$ do
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke (("pInfo" ::: Ptr DeviceBufferMemoryRequirements
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_DEVICE_BUFFER_MEMORY_REQUIREMENTS)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke (("pInfo" ::: Ptr DeviceBufferMemoryRequirements
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
Ptr (BufferCreateInfo '[])
pCreateInfo'' <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT @_ @_ @(Ptr (BufferCreateInfo '[])) forall a b. (a -> b) -> a -> b
$ \Ptr (BufferCreateInfo '[]) -> IO b
cont -> forall (a :: [*] -> *) b.
(forall (es :: [*]).
(Extendss a es, PokeChain es) =>
ToCStruct (a es)) =>
SomeStruct a
-> (forall (es :: [*]).
(Extendss a es, PokeChain es) =>
Ptr (a es) -> IO b)
-> IO b
withSomeCStruct @BufferCreateInfo (SomeStruct BufferCreateInfo
createInfo) (Ptr (BufferCreateInfo '[]) -> IO b
cont forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. Ptr a -> Ptr b
castPtr)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke (("pInfo" ::: Ptr DeviceBufferMemoryRequirements
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr (Ptr (BufferCreateInfo _)))) Ptr (BufferCreateInfo '[])
pCreateInfo''
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ IO b
f
cStructSize :: Int
cStructSize = Int
24
cStructAlignment :: Int
cStructAlignment = Int
8
pokeZeroCStruct :: forall b.
("pInfo" ::: Ptr DeviceBufferMemoryRequirements) -> IO b -> IO b
pokeZeroCStruct "pInfo" ::: Ptr DeviceBufferMemoryRequirements
p IO b
f = forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT forall a b. (a -> b) -> a -> b
$ do
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke (("pInfo" ::: Ptr DeviceBufferMemoryRequirements
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_DEVICE_BUFFER_MEMORY_REQUIREMENTS)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke (("pInfo" ::: Ptr DeviceBufferMemoryRequirements
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
Ptr (BufferCreateInfo '[])
pCreateInfo'' <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT @_ @_ @(Ptr (BufferCreateInfo '[])) forall a b. (a -> b) -> a -> b
$ \Ptr (BufferCreateInfo '[]) -> IO b
cont -> forall (a :: [*] -> *) b.
(forall (es :: [*]).
(Extendss a es, PokeChain es) =>
ToCStruct (a es)) =>
SomeStruct a
-> (forall (es :: [*]).
(Extendss a es, PokeChain es) =>
Ptr (a es) -> IO b)
-> IO b
withSomeCStruct @BufferCreateInfo ((forall (a :: [*] -> *) (es :: [*]).
(Extendss a es, PokeChain es, Show (Chain es)) =>
a es -> SomeStruct a
SomeStruct forall a. Zero a => a
zero)) (Ptr (BufferCreateInfo '[]) -> IO b
cont forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. Ptr a -> Ptr b
castPtr)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke (("pInfo" ::: Ptr DeviceBufferMemoryRequirements
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr (Ptr (BufferCreateInfo _)))) Ptr (BufferCreateInfo '[])
pCreateInfo''
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ IO b
f
instance FromCStruct DeviceBufferMemoryRequirements where
peekCStruct :: ("pInfo" ::: Ptr DeviceBufferMemoryRequirements)
-> IO DeviceBufferMemoryRequirements
peekCStruct "pInfo" ::: Ptr DeviceBufferMemoryRequirements
p = do
SomeStruct BufferCreateInfo
pCreateInfo <- forall (a :: [*] -> *).
(Extensible a,
forall (es :: [*]).
(Extendss a es, PeekChain es) =>
FromCStruct (a es)) =>
Ptr (SomeStruct a) -> IO (SomeStruct a)
peekSomeCStruct forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (a :: [*] -> *) (es :: [*]).
Ptr (a es) -> Ptr (SomeStruct a)
forgetExtensions forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< forall a. Storable a => Ptr a -> IO a
peek (("pInfo" ::: Ptr DeviceBufferMemoryRequirements
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr (Ptr (BufferCreateInfo _))))
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ SomeStruct BufferCreateInfo -> DeviceBufferMemoryRequirements
DeviceBufferMemoryRequirements
SomeStruct BufferCreateInfo
pCreateInfo
instance Zero DeviceBufferMemoryRequirements where
zero :: DeviceBufferMemoryRequirements
zero = SomeStruct BufferCreateInfo -> DeviceBufferMemoryRequirements
DeviceBufferMemoryRequirements
(forall (a :: [*] -> *) (es :: [*]).
(Extendss a es, PokeChain es, Show (Chain es)) =>
a es -> SomeStruct a
SomeStruct forall a. Zero a => a
zero)
data DeviceImageMemoryRequirements = DeviceImageMemoryRequirements
{
DeviceImageMemoryRequirements -> SomeStruct ImageCreateInfo
createInfo :: SomeStruct ImageCreateInfo
,
DeviceImageMemoryRequirements -> ImageAspectFlagBits
planeAspect :: ImageAspectFlagBits
}
deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (DeviceImageMemoryRequirements)
#endif
deriving instance Show DeviceImageMemoryRequirements
instance ToCStruct DeviceImageMemoryRequirements where
withCStruct :: forall b.
DeviceImageMemoryRequirements
-> (("pInfo" ::: Ptr DeviceImageMemoryRequirements) -> IO b)
-> IO b
withCStruct DeviceImageMemoryRequirements
x ("pInfo" ::: Ptr DeviceImageMemoryRequirements) -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
32 forall a b. (a -> b) -> a -> b
$ \"pInfo" ::: Ptr DeviceImageMemoryRequirements
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pInfo" ::: Ptr DeviceImageMemoryRequirements
p DeviceImageMemoryRequirements
x (("pInfo" ::: Ptr DeviceImageMemoryRequirements) -> IO b
f "pInfo" ::: Ptr DeviceImageMemoryRequirements
p)
pokeCStruct :: forall b.
("pInfo" ::: Ptr DeviceImageMemoryRequirements)
-> DeviceImageMemoryRequirements -> IO b -> IO b
pokeCStruct "pInfo" ::: Ptr DeviceImageMemoryRequirements
p DeviceImageMemoryRequirements{ImageAspectFlagBits
SomeStruct ImageCreateInfo
planeAspect :: ImageAspectFlagBits
createInfo :: SomeStruct ImageCreateInfo
$sel:planeAspect:DeviceImageMemoryRequirements :: DeviceImageMemoryRequirements -> ImageAspectFlagBits
$sel:createInfo:DeviceImageMemoryRequirements :: DeviceImageMemoryRequirements -> SomeStruct ImageCreateInfo
..} IO b
f = forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT forall a b. (a -> b) -> a -> b
$ do
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke (("pInfo" ::: Ptr DeviceImageMemoryRequirements
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_DEVICE_IMAGE_MEMORY_REQUIREMENTS)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke (("pInfo" ::: Ptr DeviceImageMemoryRequirements
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
Ptr (ImageCreateInfo '[])
pCreateInfo'' <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT @_ @_ @(Ptr (ImageCreateInfo '[])) forall a b. (a -> b) -> a -> b
$ \Ptr (ImageCreateInfo '[]) -> IO b
cont -> forall (a :: [*] -> *) b.
(forall (es :: [*]).
(Extendss a es, PokeChain es) =>
ToCStruct (a es)) =>
SomeStruct a
-> (forall (es :: [*]).
(Extendss a es, PokeChain es) =>
Ptr (a es) -> IO b)
-> IO b
withSomeCStruct @ImageCreateInfo (SomeStruct ImageCreateInfo
createInfo) (Ptr (ImageCreateInfo '[]) -> IO b
cont forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. Ptr a -> Ptr b
castPtr)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke (("pInfo" ::: Ptr DeviceImageMemoryRequirements
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr (Ptr (ImageCreateInfo _)))) Ptr (ImageCreateInfo '[])
pCreateInfo''
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke (("pInfo" ::: Ptr DeviceImageMemoryRequirements
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr ImageAspectFlagBits)) (ImageAspectFlagBits
planeAspect)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ IO b
f
cStructSize :: Int
cStructSize = Int
32
cStructAlignment :: Int
cStructAlignment = Int
8
pokeZeroCStruct :: forall b.
("pInfo" ::: Ptr DeviceImageMemoryRequirements) -> IO b -> IO b
pokeZeroCStruct "pInfo" ::: Ptr DeviceImageMemoryRequirements
p IO b
f = forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT forall a b. (a -> b) -> a -> b
$ do
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke (("pInfo" ::: Ptr DeviceImageMemoryRequirements
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_DEVICE_IMAGE_MEMORY_REQUIREMENTS)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke (("pInfo" ::: Ptr DeviceImageMemoryRequirements
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
Ptr (ImageCreateInfo '[])
pCreateInfo'' <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT @_ @_ @(Ptr (ImageCreateInfo '[])) forall a b. (a -> b) -> a -> b
$ \Ptr (ImageCreateInfo '[]) -> IO b
cont -> forall (a :: [*] -> *) b.
(forall (es :: [*]).
(Extendss a es, PokeChain es) =>
ToCStruct (a es)) =>
SomeStruct a
-> (forall (es :: [*]).
(Extendss a es, PokeChain es) =>
Ptr (a es) -> IO b)
-> IO b
withSomeCStruct @ImageCreateInfo ((forall (a :: [*] -> *) (es :: [*]).
(Extendss a es, PokeChain es, Show (Chain es)) =>
a es -> SomeStruct a
SomeStruct forall a. Zero a => a
zero)) (Ptr (ImageCreateInfo '[]) -> IO b
cont forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. Ptr a -> Ptr b
castPtr)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke (("pInfo" ::: Ptr DeviceImageMemoryRequirements
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr (Ptr (ImageCreateInfo _)))) Ptr (ImageCreateInfo '[])
pCreateInfo''
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ IO b
f
instance FromCStruct DeviceImageMemoryRequirements where
peekCStruct :: ("pInfo" ::: Ptr DeviceImageMemoryRequirements)
-> IO DeviceImageMemoryRequirements
peekCStruct "pInfo" ::: Ptr DeviceImageMemoryRequirements
p = do
SomeStruct ImageCreateInfo
pCreateInfo <- forall (a :: [*] -> *).
(Extensible a,
forall (es :: [*]).
(Extendss a es, PeekChain es) =>
FromCStruct (a es)) =>
Ptr (SomeStruct a) -> IO (SomeStruct a)
peekSomeCStruct forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (a :: [*] -> *) (es :: [*]).
Ptr (a es) -> Ptr (SomeStruct a)
forgetExtensions forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< forall a. Storable a => Ptr a -> IO a
peek (("pInfo" ::: Ptr DeviceImageMemoryRequirements
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr (Ptr (ImageCreateInfo _))))
ImageAspectFlagBits
planeAspect <- forall a. Storable a => Ptr a -> IO a
peek @ImageAspectFlagBits (("pInfo" ::: Ptr DeviceImageMemoryRequirements
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr ImageAspectFlagBits))
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ SomeStruct ImageCreateInfo
-> ImageAspectFlagBits -> DeviceImageMemoryRequirements
DeviceImageMemoryRequirements
SomeStruct ImageCreateInfo
pCreateInfo ImageAspectFlagBits
planeAspect
instance Zero DeviceImageMemoryRequirements where
zero :: DeviceImageMemoryRequirements
zero = SomeStruct ImageCreateInfo
-> ImageAspectFlagBits -> DeviceImageMemoryRequirements
DeviceImageMemoryRequirements
(forall (a :: [*] -> *) (es :: [*]).
(Extendss a es, PokeChain es, Show (Chain es)) =>
a es -> SomeStruct a
SomeStruct forall a. Zero a => a
zero)
forall a. Zero a => a
zero
data PhysicalDeviceMaintenance4Features = PhysicalDeviceMaintenance4Features
{
PhysicalDeviceMaintenance4Features -> Bool
maintenance4 :: Bool }
deriving (Typeable, PhysicalDeviceMaintenance4Features
-> PhysicalDeviceMaintenance4Features -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhysicalDeviceMaintenance4Features
-> PhysicalDeviceMaintenance4Features -> Bool
$c/= :: PhysicalDeviceMaintenance4Features
-> PhysicalDeviceMaintenance4Features -> Bool
== :: PhysicalDeviceMaintenance4Features
-> PhysicalDeviceMaintenance4Features -> Bool
$c== :: PhysicalDeviceMaintenance4Features
-> PhysicalDeviceMaintenance4Features -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceMaintenance4Features)
#endif
deriving instance Show PhysicalDeviceMaintenance4Features
instance ToCStruct PhysicalDeviceMaintenance4Features where
withCStruct :: forall b.
PhysicalDeviceMaintenance4Features
-> (Ptr PhysicalDeviceMaintenance4Features -> IO b) -> IO b
withCStruct PhysicalDeviceMaintenance4Features
x Ptr PhysicalDeviceMaintenance4Features -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
24 forall a b. (a -> b) -> a -> b
$ \Ptr PhysicalDeviceMaintenance4Features
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceMaintenance4Features
p PhysicalDeviceMaintenance4Features
x (Ptr PhysicalDeviceMaintenance4Features -> IO b
f Ptr PhysicalDeviceMaintenance4Features
p)
pokeCStruct :: forall b.
Ptr PhysicalDeviceMaintenance4Features
-> PhysicalDeviceMaintenance4Features -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceMaintenance4Features
p PhysicalDeviceMaintenance4Features{Bool
maintenance4 :: Bool
$sel:maintenance4:PhysicalDeviceMaintenance4Features :: PhysicalDeviceMaintenance4Features -> Bool
..} IO b
f = do
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceMaintenance4Features
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_FEATURES)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceMaintenance4Features
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceMaintenance4Features
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
maintenance4))
IO b
f
cStructSize :: Int
cStructSize = Int
24
cStructAlignment :: Int
cStructAlignment = Int
8
pokeZeroCStruct :: forall b. Ptr PhysicalDeviceMaintenance4Features -> IO b -> IO b
pokeZeroCStruct Ptr PhysicalDeviceMaintenance4Features
p IO b
f = do
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceMaintenance4Features
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_FEATURES)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceMaintenance4Features
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceMaintenance4Features
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (forall a. Zero a => a
zero))
IO b
f
instance FromCStruct PhysicalDeviceMaintenance4Features where
peekCStruct :: Ptr PhysicalDeviceMaintenance4Features
-> IO PhysicalDeviceMaintenance4Features
peekCStruct Ptr PhysicalDeviceMaintenance4Features
p = do
Bool32
maintenance4 <- forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PhysicalDeviceMaintenance4Features
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32))
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Bool -> PhysicalDeviceMaintenance4Features
PhysicalDeviceMaintenance4Features
(Bool32 -> Bool
bool32ToBool Bool32
maintenance4)
instance Storable PhysicalDeviceMaintenance4Features where
sizeOf :: PhysicalDeviceMaintenance4Features -> Int
sizeOf ~PhysicalDeviceMaintenance4Features
_ = Int
24
alignment :: PhysicalDeviceMaintenance4Features -> Int
alignment ~PhysicalDeviceMaintenance4Features
_ = Int
8
peek :: Ptr PhysicalDeviceMaintenance4Features
-> IO PhysicalDeviceMaintenance4Features
peek = forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: Ptr PhysicalDeviceMaintenance4Features
-> PhysicalDeviceMaintenance4Features -> IO ()
poke Ptr PhysicalDeviceMaintenance4Features
ptr PhysicalDeviceMaintenance4Features
poked = forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceMaintenance4Features
ptr PhysicalDeviceMaintenance4Features
poked (forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero PhysicalDeviceMaintenance4Features where
zero :: PhysicalDeviceMaintenance4Features
zero = Bool -> PhysicalDeviceMaintenance4Features
PhysicalDeviceMaintenance4Features
forall a. Zero a => a
zero
data PhysicalDeviceMaintenance4Properties = PhysicalDeviceMaintenance4Properties
{
PhysicalDeviceMaintenance4Properties -> DeviceSize
maxBufferSize :: DeviceSize }
deriving (Typeable, PhysicalDeviceMaintenance4Properties
-> PhysicalDeviceMaintenance4Properties -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhysicalDeviceMaintenance4Properties
-> PhysicalDeviceMaintenance4Properties -> Bool
$c/= :: PhysicalDeviceMaintenance4Properties
-> PhysicalDeviceMaintenance4Properties -> Bool
== :: PhysicalDeviceMaintenance4Properties
-> PhysicalDeviceMaintenance4Properties -> Bool
$c== :: PhysicalDeviceMaintenance4Properties
-> PhysicalDeviceMaintenance4Properties -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceMaintenance4Properties)
#endif
deriving instance Show PhysicalDeviceMaintenance4Properties
instance ToCStruct PhysicalDeviceMaintenance4Properties where
withCStruct :: forall b.
PhysicalDeviceMaintenance4Properties
-> (Ptr PhysicalDeviceMaintenance4Properties -> IO b) -> IO b
withCStruct PhysicalDeviceMaintenance4Properties
x Ptr PhysicalDeviceMaintenance4Properties -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
24 forall a b. (a -> b) -> a -> b
$ \Ptr PhysicalDeviceMaintenance4Properties
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceMaintenance4Properties
p PhysicalDeviceMaintenance4Properties
x (Ptr PhysicalDeviceMaintenance4Properties -> IO b
f Ptr PhysicalDeviceMaintenance4Properties
p)
pokeCStruct :: forall b.
Ptr PhysicalDeviceMaintenance4Properties
-> PhysicalDeviceMaintenance4Properties -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceMaintenance4Properties
p PhysicalDeviceMaintenance4Properties{DeviceSize
maxBufferSize :: DeviceSize
$sel:maxBufferSize:PhysicalDeviceMaintenance4Properties :: PhysicalDeviceMaintenance4Properties -> DeviceSize
..} IO b
f = do
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceMaintenance4Properties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_PROPERTIES)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceMaintenance4Properties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceMaintenance4Properties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr DeviceSize)) (DeviceSize
maxBufferSize)
IO b
f
cStructSize :: Int
cStructSize = Int
24
cStructAlignment :: Int
cStructAlignment = Int
8
pokeZeroCStruct :: forall b. Ptr PhysicalDeviceMaintenance4Properties -> IO b -> IO b
pokeZeroCStruct Ptr PhysicalDeviceMaintenance4Properties
p IO b
f = do
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceMaintenance4Properties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_PROPERTIES)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceMaintenance4Properties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceMaintenance4Properties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr DeviceSize)) (forall a. Zero a => a
zero)
IO b
f
instance FromCStruct PhysicalDeviceMaintenance4Properties where
peekCStruct :: Ptr PhysicalDeviceMaintenance4Properties
-> IO PhysicalDeviceMaintenance4Properties
peekCStruct Ptr PhysicalDeviceMaintenance4Properties
p = do
DeviceSize
maxBufferSize <- forall a. Storable a => Ptr a -> IO a
peek @DeviceSize ((Ptr PhysicalDeviceMaintenance4Properties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr DeviceSize))
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ DeviceSize -> PhysicalDeviceMaintenance4Properties
PhysicalDeviceMaintenance4Properties
DeviceSize
maxBufferSize
instance Storable PhysicalDeviceMaintenance4Properties where
sizeOf :: PhysicalDeviceMaintenance4Properties -> Int
sizeOf ~PhysicalDeviceMaintenance4Properties
_ = Int
24
alignment :: PhysicalDeviceMaintenance4Properties -> Int
alignment ~PhysicalDeviceMaintenance4Properties
_ = Int
8
peek :: Ptr PhysicalDeviceMaintenance4Properties
-> IO PhysicalDeviceMaintenance4Properties
peek = forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: Ptr PhysicalDeviceMaintenance4Properties
-> PhysicalDeviceMaintenance4Properties -> IO ()
poke Ptr PhysicalDeviceMaintenance4Properties
ptr PhysicalDeviceMaintenance4Properties
poked = forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceMaintenance4Properties
ptr PhysicalDeviceMaintenance4Properties
poked (forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero PhysicalDeviceMaintenance4Properties where
zero :: PhysicalDeviceMaintenance4Properties
zero = DeviceSize -> PhysicalDeviceMaintenance4Properties
PhysicalDeviceMaintenance4Properties
forall a. Zero a => a
zero