{-# language CPP #-}
module Vulkan.Core11.Originally_Based_On_VK_KHR_protected_memory ( getDeviceQueue2
, ProtectedSubmitInfo(..)
, PhysicalDeviceProtectedMemoryFeatures(..)
, PhysicalDeviceProtectedMemoryProperties(..)
, DeviceQueueInfo2(..)
, StructureType(..)
, QueueFlagBits(..)
, QueueFlags
, DeviceQueueCreateFlagBits(..)
, DeviceQueueCreateFlags
, MemoryPropertyFlagBits(..)
, MemoryPropertyFlags
, BufferCreateFlagBits(..)
, BufferCreateFlags
, ImageCreateFlagBits(..)
, ImageCreateFlags
, CommandPoolCreateFlagBits(..)
, CommandPoolCreateFlags
) 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 (nullFunPtr)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Cont (evalContT)
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Zero (Zero(..))
import Control.Monad.IO.Class (MonadIO)
import Data.Typeable (Typeable)
import Foreign.Storable (Storable)
import Foreign.Storable (Storable(peek))
import Foreign.Storable (Storable(poke))
import qualified Foreign.Storable (Storable(..))
import GHC.Generics (Generic)
import GHC.IO.Exception (IOErrorType(..))
import GHC.IO.Exception (IOException(..))
import Foreign.Ptr (FunPtr)
import Foreign.Ptr (Ptr)
import Data.Word (Word32)
import Data.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Vulkan.Core10.FundamentalTypes (bool32ToBool)
import Vulkan.Core10.FundamentalTypes (boolToBool32)
import Vulkan.Core10.FundamentalTypes (Bool32)
import Vulkan.Core10.Handles (Device)
import Vulkan.Core10.Handles (Device(..))
import Vulkan.Core10.Handles (Device(Device))
import Vulkan.Dynamic (DeviceCmds(pVkGetDeviceQueue2))
import Vulkan.Core10.Enums.DeviceQueueCreateFlagBits (DeviceQueueCreateFlags)
import Vulkan.Core10.Handles (Device_T)
import Vulkan.Core10.Handles (Queue)
import Vulkan.Core10.Handles (Queue(Queue))
import Vulkan.Core10.Handles (Queue_T)
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_DEVICE_QUEUE_INFO_2))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_PROPERTIES))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PROTECTED_SUBMIT_INFO))
import Vulkan.Core10.Enums.BufferCreateFlagBits (BufferCreateFlagBits(..))
import Vulkan.Core10.Enums.BufferCreateFlagBits (BufferCreateFlags)
import Vulkan.Core10.Enums.CommandPoolCreateFlagBits (CommandPoolCreateFlagBits(..))
import Vulkan.Core10.Enums.CommandPoolCreateFlagBits (CommandPoolCreateFlags)
import Vulkan.Core10.Enums.DeviceQueueCreateFlagBits (DeviceQueueCreateFlagBits(..))
import Vulkan.Core10.Enums.DeviceQueueCreateFlagBits (DeviceQueueCreateFlags)
import Vulkan.Core10.Enums.ImageCreateFlagBits (ImageCreateFlagBits(..))
import Vulkan.Core10.Enums.ImageCreateFlagBits (ImageCreateFlags)
import Vulkan.Core10.Enums.MemoryPropertyFlagBits (MemoryPropertyFlagBits(..))
import Vulkan.Core10.Enums.MemoryPropertyFlagBits (MemoryPropertyFlags)
import Vulkan.Core10.Enums.QueueFlagBits (QueueFlagBits(..))
import Vulkan.Core10.Enums.QueueFlagBits (QueueFlags)
import Vulkan.Core10.Enums.StructureType (StructureType(..))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkGetDeviceQueue2
:: FunPtr (Ptr Device_T -> Ptr DeviceQueueInfo2 -> Ptr (Ptr Queue_T) -> IO ()) -> Ptr Device_T -> Ptr DeviceQueueInfo2 -> Ptr (Ptr Queue_T) -> IO ()
getDeviceQueue2 :: forall io
. (MonadIO io)
=>
Device
->
DeviceQueueInfo2
-> io (Queue)
getDeviceQueue2 :: forall (io :: * -> *).
MonadIO io =>
Device -> DeviceQueueInfo2 -> io Queue
getDeviceQueue2 Device
device DeviceQueueInfo2
queueInfo = 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 cmds :: DeviceCmds
cmds = case Device
device of Device{DeviceCmds
$sel:deviceCmds:Device :: Device -> DeviceCmds
deviceCmds :: DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds
let vkGetDeviceQueue2Ptr :: FunPtr
(Ptr Device_T
-> ("pQueueInfo" ::: Ptr DeviceQueueInfo2)
-> ("pQueue" ::: Ptr (Ptr Queue_T))
-> IO ())
vkGetDeviceQueue2Ptr = DeviceCmds
-> FunPtr
(Ptr Device_T
-> ("pQueueInfo" ::: Ptr DeviceQueueInfo2)
-> ("pQueue" ::: Ptr (Ptr Queue_T))
-> IO ())
pVkGetDeviceQueue2 DeviceCmds
cmds
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
-> ("pQueueInfo" ::: Ptr DeviceQueueInfo2)
-> ("pQueue" ::: Ptr (Ptr Queue_T))
-> IO ())
vkGetDeviceQueue2Ptr 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 vkGetDeviceQueue2 is null" forall a. Maybe a
Nothing forall a. Maybe a
Nothing
let vkGetDeviceQueue2' :: Ptr Device_T
-> ("pQueueInfo" ::: Ptr DeviceQueueInfo2)
-> ("pQueue" ::: Ptr (Ptr Queue_T))
-> IO ()
vkGetDeviceQueue2' = FunPtr
(Ptr Device_T
-> ("pQueueInfo" ::: Ptr DeviceQueueInfo2)
-> ("pQueue" ::: Ptr (Ptr Queue_T))
-> IO ())
-> Ptr Device_T
-> ("pQueueInfo" ::: Ptr DeviceQueueInfo2)
-> ("pQueue" ::: Ptr (Ptr Queue_T))
-> IO ()
mkVkGetDeviceQueue2 FunPtr
(Ptr Device_T
-> ("pQueueInfo" ::: Ptr DeviceQueueInfo2)
-> ("pQueue" ::: Ptr (Ptr Queue_T))
-> IO ())
vkGetDeviceQueue2Ptr
"pQueueInfo" ::: Ptr DeviceQueueInfo2
pQueueInfo <- 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 (DeviceQueueInfo2
queueInfo)
"pQueue" ::: Ptr (Ptr Queue_T)
pPQueue <- 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 @(Ptr Queue_T) Int
8) 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
"vkGetDeviceQueue2" (Ptr Device_T
-> ("pQueueInfo" ::: Ptr DeviceQueueInfo2)
-> ("pQueue" ::: Ptr (Ptr Queue_T))
-> IO ()
vkGetDeviceQueue2'
(Device -> Ptr Device_T
deviceHandle (Device
device))
"pQueueInfo" ::: Ptr DeviceQueueInfo2
pQueueInfo
("pQueue" ::: Ptr (Ptr Queue_T)
pPQueue))
Ptr Queue_T
pQueue <- 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 @(Ptr Queue_T) "pQueue" ::: Ptr (Ptr Queue_T)
pPQueue
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ (((\Ptr Queue_T
h -> Ptr Queue_T -> DeviceCmds -> Queue
Queue Ptr Queue_T
h DeviceCmds
cmds ) Ptr Queue_T
pQueue))
data ProtectedSubmitInfo = ProtectedSubmitInfo
{
ProtectedSubmitInfo -> Bool
protectedSubmit :: Bool }
deriving (Typeable, ProtectedSubmitInfo -> ProtectedSubmitInfo -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProtectedSubmitInfo -> ProtectedSubmitInfo -> Bool
$c/= :: ProtectedSubmitInfo -> ProtectedSubmitInfo -> Bool
== :: ProtectedSubmitInfo -> ProtectedSubmitInfo -> Bool
$c== :: ProtectedSubmitInfo -> ProtectedSubmitInfo -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ProtectedSubmitInfo)
#endif
deriving instance Show ProtectedSubmitInfo
instance ToCStruct ProtectedSubmitInfo where
withCStruct :: forall b.
ProtectedSubmitInfo -> (Ptr ProtectedSubmitInfo -> IO b) -> IO b
withCStruct ProtectedSubmitInfo
x Ptr ProtectedSubmitInfo -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
24 forall a b. (a -> b) -> a -> b
$ \Ptr ProtectedSubmitInfo
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr ProtectedSubmitInfo
p ProtectedSubmitInfo
x (Ptr ProtectedSubmitInfo -> IO b
f Ptr ProtectedSubmitInfo
p)
pokeCStruct :: forall b.
Ptr ProtectedSubmitInfo -> ProtectedSubmitInfo -> IO b -> IO b
pokeCStruct Ptr ProtectedSubmitInfo
p ProtectedSubmitInfo{Bool
protectedSubmit :: Bool
$sel:protectedSubmit:ProtectedSubmitInfo :: ProtectedSubmitInfo -> Bool
..} IO b
f = do
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ProtectedSubmitInfo
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PROTECTED_SUBMIT_INFO)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ProtectedSubmitInfo
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 ProtectedSubmitInfo
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
protectedSubmit))
IO b
f
cStructSize :: Int
cStructSize = Int
24
cStructAlignment :: Int
cStructAlignment = Int
8
pokeZeroCStruct :: forall b. Ptr ProtectedSubmitInfo -> IO b -> IO b
pokeZeroCStruct Ptr ProtectedSubmitInfo
p IO b
f = do
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ProtectedSubmitInfo
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PROTECTED_SUBMIT_INFO)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ProtectedSubmitInfo
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 ProtectedSubmitInfo
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 ProtectedSubmitInfo where
peekCStruct :: Ptr ProtectedSubmitInfo -> IO ProtectedSubmitInfo
peekCStruct Ptr ProtectedSubmitInfo
p = do
Bool32
protectedSubmit <- forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr ProtectedSubmitInfo
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 -> ProtectedSubmitInfo
ProtectedSubmitInfo
(Bool32 -> Bool
bool32ToBool Bool32
protectedSubmit)
instance Storable ProtectedSubmitInfo where
sizeOf :: ProtectedSubmitInfo -> Int
sizeOf ~ProtectedSubmitInfo
_ = Int
24
alignment :: ProtectedSubmitInfo -> Int
alignment ~ProtectedSubmitInfo
_ = Int
8
peek :: Ptr ProtectedSubmitInfo -> IO ProtectedSubmitInfo
peek = forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: Ptr ProtectedSubmitInfo -> ProtectedSubmitInfo -> IO ()
poke Ptr ProtectedSubmitInfo
ptr ProtectedSubmitInfo
poked = forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr ProtectedSubmitInfo
ptr ProtectedSubmitInfo
poked (forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero ProtectedSubmitInfo where
zero :: ProtectedSubmitInfo
zero = Bool -> ProtectedSubmitInfo
ProtectedSubmitInfo
forall a. Zero a => a
zero
data PhysicalDeviceProtectedMemoryFeatures = PhysicalDeviceProtectedMemoryFeatures
{
PhysicalDeviceProtectedMemoryFeatures -> Bool
protectedMemory :: Bool }
deriving (Typeable, PhysicalDeviceProtectedMemoryFeatures
-> PhysicalDeviceProtectedMemoryFeatures -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhysicalDeviceProtectedMemoryFeatures
-> PhysicalDeviceProtectedMemoryFeatures -> Bool
$c/= :: PhysicalDeviceProtectedMemoryFeatures
-> PhysicalDeviceProtectedMemoryFeatures -> Bool
== :: PhysicalDeviceProtectedMemoryFeatures
-> PhysicalDeviceProtectedMemoryFeatures -> Bool
$c== :: PhysicalDeviceProtectedMemoryFeatures
-> PhysicalDeviceProtectedMemoryFeatures -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceProtectedMemoryFeatures)
#endif
deriving instance Show PhysicalDeviceProtectedMemoryFeatures
instance ToCStruct PhysicalDeviceProtectedMemoryFeatures where
withCStruct :: forall b.
PhysicalDeviceProtectedMemoryFeatures
-> (Ptr PhysicalDeviceProtectedMemoryFeatures -> IO b) -> IO b
withCStruct PhysicalDeviceProtectedMemoryFeatures
x Ptr PhysicalDeviceProtectedMemoryFeatures -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
24 forall a b. (a -> b) -> a -> b
$ \Ptr PhysicalDeviceProtectedMemoryFeatures
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceProtectedMemoryFeatures
p PhysicalDeviceProtectedMemoryFeatures
x (Ptr PhysicalDeviceProtectedMemoryFeatures -> IO b
f Ptr PhysicalDeviceProtectedMemoryFeatures
p)
pokeCStruct :: forall b.
Ptr PhysicalDeviceProtectedMemoryFeatures
-> PhysicalDeviceProtectedMemoryFeatures -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceProtectedMemoryFeatures
p PhysicalDeviceProtectedMemoryFeatures{Bool
protectedMemory :: Bool
$sel:protectedMemory:PhysicalDeviceProtectedMemoryFeatures :: PhysicalDeviceProtectedMemoryFeatures -> Bool
..} IO b
f = do
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceProtectedMemoryFeatures
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceProtectedMemoryFeatures
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 PhysicalDeviceProtectedMemoryFeatures
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
protectedMemory))
IO b
f
cStructSize :: Int
cStructSize = Int
24
cStructAlignment :: Int
cStructAlignment = Int
8
pokeZeroCStruct :: forall b. Ptr PhysicalDeviceProtectedMemoryFeatures -> IO b -> IO b
pokeZeroCStruct Ptr PhysicalDeviceProtectedMemoryFeatures
p IO b
f = do
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceProtectedMemoryFeatures
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceProtectedMemoryFeatures
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 PhysicalDeviceProtectedMemoryFeatures
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 PhysicalDeviceProtectedMemoryFeatures where
peekCStruct :: Ptr PhysicalDeviceProtectedMemoryFeatures
-> IO PhysicalDeviceProtectedMemoryFeatures
peekCStruct Ptr PhysicalDeviceProtectedMemoryFeatures
p = do
Bool32
protectedMemory <- forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PhysicalDeviceProtectedMemoryFeatures
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 -> PhysicalDeviceProtectedMemoryFeatures
PhysicalDeviceProtectedMemoryFeatures
(Bool32 -> Bool
bool32ToBool Bool32
protectedMemory)
instance Storable PhysicalDeviceProtectedMemoryFeatures where
sizeOf :: PhysicalDeviceProtectedMemoryFeatures -> Int
sizeOf ~PhysicalDeviceProtectedMemoryFeatures
_ = Int
24
alignment :: PhysicalDeviceProtectedMemoryFeatures -> Int
alignment ~PhysicalDeviceProtectedMemoryFeatures
_ = Int
8
peek :: Ptr PhysicalDeviceProtectedMemoryFeatures
-> IO PhysicalDeviceProtectedMemoryFeatures
peek = forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: Ptr PhysicalDeviceProtectedMemoryFeatures
-> PhysicalDeviceProtectedMemoryFeatures -> IO ()
poke Ptr PhysicalDeviceProtectedMemoryFeatures
ptr PhysicalDeviceProtectedMemoryFeatures
poked = forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceProtectedMemoryFeatures
ptr PhysicalDeviceProtectedMemoryFeatures
poked (forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero PhysicalDeviceProtectedMemoryFeatures where
zero :: PhysicalDeviceProtectedMemoryFeatures
zero = Bool -> PhysicalDeviceProtectedMemoryFeatures
PhysicalDeviceProtectedMemoryFeatures
forall a. Zero a => a
zero
data PhysicalDeviceProtectedMemoryProperties = PhysicalDeviceProtectedMemoryProperties
{
PhysicalDeviceProtectedMemoryProperties -> Bool
protectedNoFault :: Bool }
deriving (Typeable, PhysicalDeviceProtectedMemoryProperties
-> PhysicalDeviceProtectedMemoryProperties -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhysicalDeviceProtectedMemoryProperties
-> PhysicalDeviceProtectedMemoryProperties -> Bool
$c/= :: PhysicalDeviceProtectedMemoryProperties
-> PhysicalDeviceProtectedMemoryProperties -> Bool
== :: PhysicalDeviceProtectedMemoryProperties
-> PhysicalDeviceProtectedMemoryProperties -> Bool
$c== :: PhysicalDeviceProtectedMemoryProperties
-> PhysicalDeviceProtectedMemoryProperties -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceProtectedMemoryProperties)
#endif
deriving instance Show PhysicalDeviceProtectedMemoryProperties
instance ToCStruct PhysicalDeviceProtectedMemoryProperties where
withCStruct :: forall b.
PhysicalDeviceProtectedMemoryProperties
-> (Ptr PhysicalDeviceProtectedMemoryProperties -> IO b) -> IO b
withCStruct PhysicalDeviceProtectedMemoryProperties
x Ptr PhysicalDeviceProtectedMemoryProperties -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
24 forall a b. (a -> b) -> a -> b
$ \Ptr PhysicalDeviceProtectedMemoryProperties
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceProtectedMemoryProperties
p PhysicalDeviceProtectedMemoryProperties
x (Ptr PhysicalDeviceProtectedMemoryProperties -> IO b
f Ptr PhysicalDeviceProtectedMemoryProperties
p)
pokeCStruct :: forall b.
Ptr PhysicalDeviceProtectedMemoryProperties
-> PhysicalDeviceProtectedMemoryProperties -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceProtectedMemoryProperties
p PhysicalDeviceProtectedMemoryProperties{Bool
protectedNoFault :: Bool
$sel:protectedNoFault:PhysicalDeviceProtectedMemoryProperties :: PhysicalDeviceProtectedMemoryProperties -> Bool
..} IO b
f = do
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceProtectedMemoryProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_PROPERTIES)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceProtectedMemoryProperties
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 PhysicalDeviceProtectedMemoryProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
protectedNoFault))
IO b
f
cStructSize :: Int
cStructSize = Int
24
cStructAlignment :: Int
cStructAlignment = Int
8
pokeZeroCStruct :: forall b.
Ptr PhysicalDeviceProtectedMemoryProperties -> IO b -> IO b
pokeZeroCStruct Ptr PhysicalDeviceProtectedMemoryProperties
p IO b
f = do
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceProtectedMemoryProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_PROPERTIES)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceProtectedMemoryProperties
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 PhysicalDeviceProtectedMemoryProperties
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 PhysicalDeviceProtectedMemoryProperties where
peekCStruct :: Ptr PhysicalDeviceProtectedMemoryProperties
-> IO PhysicalDeviceProtectedMemoryProperties
peekCStruct Ptr PhysicalDeviceProtectedMemoryProperties
p = do
Bool32
protectedNoFault <- forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PhysicalDeviceProtectedMemoryProperties
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 -> PhysicalDeviceProtectedMemoryProperties
PhysicalDeviceProtectedMemoryProperties
(Bool32 -> Bool
bool32ToBool Bool32
protectedNoFault)
instance Storable PhysicalDeviceProtectedMemoryProperties where
sizeOf :: PhysicalDeviceProtectedMemoryProperties -> Int
sizeOf ~PhysicalDeviceProtectedMemoryProperties
_ = Int
24
alignment :: PhysicalDeviceProtectedMemoryProperties -> Int
alignment ~PhysicalDeviceProtectedMemoryProperties
_ = Int
8
peek :: Ptr PhysicalDeviceProtectedMemoryProperties
-> IO PhysicalDeviceProtectedMemoryProperties
peek = forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: Ptr PhysicalDeviceProtectedMemoryProperties
-> PhysicalDeviceProtectedMemoryProperties -> IO ()
poke Ptr PhysicalDeviceProtectedMemoryProperties
ptr PhysicalDeviceProtectedMemoryProperties
poked = forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceProtectedMemoryProperties
ptr PhysicalDeviceProtectedMemoryProperties
poked (forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero PhysicalDeviceProtectedMemoryProperties where
zero :: PhysicalDeviceProtectedMemoryProperties
zero = Bool -> PhysicalDeviceProtectedMemoryProperties
PhysicalDeviceProtectedMemoryProperties
forall a. Zero a => a
zero
data DeviceQueueInfo2 = DeviceQueueInfo2
{
DeviceQueueInfo2 -> DeviceQueueCreateFlags
flags :: DeviceQueueCreateFlags
,
DeviceQueueInfo2 -> Word32
queueFamilyIndex :: Word32
,
DeviceQueueInfo2 -> Word32
queueIndex :: Word32
}
deriving (Typeable, DeviceQueueInfo2 -> DeviceQueueInfo2 -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeviceQueueInfo2 -> DeviceQueueInfo2 -> Bool
$c/= :: DeviceQueueInfo2 -> DeviceQueueInfo2 -> Bool
== :: DeviceQueueInfo2 -> DeviceQueueInfo2 -> Bool
$c== :: DeviceQueueInfo2 -> DeviceQueueInfo2 -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (DeviceQueueInfo2)
#endif
deriving instance Show DeviceQueueInfo2
instance ToCStruct DeviceQueueInfo2 where
withCStruct :: forall b.
DeviceQueueInfo2
-> (("pQueueInfo" ::: Ptr DeviceQueueInfo2) -> IO b) -> IO b
withCStruct DeviceQueueInfo2
x ("pQueueInfo" ::: Ptr DeviceQueueInfo2) -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
32 forall a b. (a -> b) -> a -> b
$ \"pQueueInfo" ::: Ptr DeviceQueueInfo2
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pQueueInfo" ::: Ptr DeviceQueueInfo2
p DeviceQueueInfo2
x (("pQueueInfo" ::: Ptr DeviceQueueInfo2) -> IO b
f "pQueueInfo" ::: Ptr DeviceQueueInfo2
p)
pokeCStruct :: forall b.
("pQueueInfo" ::: Ptr DeviceQueueInfo2)
-> DeviceQueueInfo2 -> IO b -> IO b
pokeCStruct "pQueueInfo" ::: Ptr DeviceQueueInfo2
p DeviceQueueInfo2{Word32
DeviceQueueCreateFlags
queueIndex :: Word32
queueFamilyIndex :: Word32
flags :: DeviceQueueCreateFlags
$sel:queueIndex:DeviceQueueInfo2 :: DeviceQueueInfo2 -> Word32
$sel:queueFamilyIndex:DeviceQueueInfo2 :: DeviceQueueInfo2 -> Word32
$sel:flags:DeviceQueueInfo2 :: DeviceQueueInfo2 -> DeviceQueueCreateFlags
..} IO b
f = do
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pQueueInfo" ::: Ptr DeviceQueueInfo2
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_DEVICE_QUEUE_INFO_2)
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pQueueInfo" ::: Ptr DeviceQueueInfo2
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 (("pQueueInfo" ::: Ptr DeviceQueueInfo2
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr DeviceQueueCreateFlags)) (DeviceQueueCreateFlags
flags)
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pQueueInfo" ::: Ptr DeviceQueueInfo2
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Word32)) (Word32
queueFamilyIndex)
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pQueueInfo" ::: Ptr DeviceQueueInfo2
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Word32)) (Word32
queueIndex)
IO b
f
cStructSize :: Int
cStructSize = Int
32
cStructAlignment :: Int
cStructAlignment = Int
8
pokeZeroCStruct :: forall b. ("pQueueInfo" ::: Ptr DeviceQueueInfo2) -> IO b -> IO b
pokeZeroCStruct "pQueueInfo" ::: Ptr DeviceQueueInfo2
p IO b
f = do
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pQueueInfo" ::: Ptr DeviceQueueInfo2
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_DEVICE_QUEUE_INFO_2)
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pQueueInfo" ::: Ptr DeviceQueueInfo2
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 (("pQueueInfo" ::: Ptr DeviceQueueInfo2
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Word32)) (forall a. Zero a => a
zero)
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pQueueInfo" ::: Ptr DeviceQueueInfo2
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Word32)) (forall a. Zero a => a
zero)
IO b
f
instance FromCStruct DeviceQueueInfo2 where
peekCStruct :: ("pQueueInfo" ::: Ptr DeviceQueueInfo2) -> IO DeviceQueueInfo2
peekCStruct "pQueueInfo" ::: Ptr DeviceQueueInfo2
p = do
DeviceQueueCreateFlags
flags <- forall a. Storable a => Ptr a -> IO a
peek @DeviceQueueCreateFlags (("pQueueInfo" ::: Ptr DeviceQueueInfo2
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr DeviceQueueCreateFlags))
Word32
queueFamilyIndex <- forall a. Storable a => Ptr a -> IO a
peek @Word32 (("pQueueInfo" ::: Ptr DeviceQueueInfo2
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Word32))
Word32
queueIndex <- forall a. Storable a => Ptr a -> IO a
peek @Word32 (("pQueueInfo" ::: Ptr DeviceQueueInfo2
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Word32))
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ DeviceQueueCreateFlags -> Word32 -> Word32 -> DeviceQueueInfo2
DeviceQueueInfo2
DeviceQueueCreateFlags
flags Word32
queueFamilyIndex Word32
queueIndex
instance Storable DeviceQueueInfo2 where
sizeOf :: DeviceQueueInfo2 -> Int
sizeOf ~DeviceQueueInfo2
_ = Int
32
alignment :: DeviceQueueInfo2 -> Int
alignment ~DeviceQueueInfo2
_ = Int
8
peek :: ("pQueueInfo" ::: Ptr DeviceQueueInfo2) -> IO DeviceQueueInfo2
peek = forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: ("pQueueInfo" ::: Ptr DeviceQueueInfo2)
-> DeviceQueueInfo2 -> IO ()
poke "pQueueInfo" ::: Ptr DeviceQueueInfo2
ptr DeviceQueueInfo2
poked = forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pQueueInfo" ::: Ptr DeviceQueueInfo2
ptr DeviceQueueInfo2
poked (forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero DeviceQueueInfo2 where
zero :: DeviceQueueInfo2
zero = DeviceQueueCreateFlags -> Word32 -> Word32 -> DeviceQueueInfo2
DeviceQueueInfo2
forall a. Zero a => a
zero
forall a. Zero a => a
zero
forall a. Zero a => a
zero