{-# language CPP #-}
module Vulkan.Core11.Promoted_From_VK_KHR_device_group_creation ( enumeratePhysicalDeviceGroups
, PhysicalDeviceGroupProperties(..)
, DeviceGroupDeviceCreateInfo(..)
, StructureType(..)
, MemoryHeapFlagBits(..)
, MemoryHeapFlags
, MAX_DEVICE_GROUP_SIZE
, pattern MAX_DEVICE_GROUP_SIZE
) where
import Vulkan.CStruct.Utils (FixedArray)
import Vulkan.Internal.Utils (traceAroundEvent)
import Control.Exception.Base (bracket)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Foreign.Marshal.Alloc (allocaBytesAligned)
import Foreign.Marshal.Alloc (callocBytes)
import Foreign.Marshal.Alloc (free)
import GHC.Base (when)
import GHC.IO (throwIO)
import GHC.Ptr (nullFunPtr)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Cont (evalContT)
import Data.Vector (generateM)
import qualified Data.Vector (imapM_)
import qualified Data.Vector (length)
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Zero (Zero(..))
import Control.Monad.IO.Class (MonadIO)
import Data.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.Utils (lowerArrayPtr)
import Vulkan.NamedType ((:::))
import Vulkan.Core10.FundamentalTypes (Bool32)
import Vulkan.Core10.Handles (Instance)
import Vulkan.Core10.Handles (Instance(..))
import Vulkan.Dynamic (InstanceCmds(pVkEnumeratePhysicalDeviceGroups))
import Vulkan.Core10.Handles (Instance_T)
import Vulkan.Core10.APIConstants (MAX_DEVICE_GROUP_SIZE)
import Vulkan.Core10.Handles (PhysicalDevice_T)
import Vulkan.Core10.Enums.Result (Result)
import Vulkan.Core10.Enums.Result (Result(..))
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Exception (VulkanException(..))
import Vulkan.Core10.APIConstants (pattern MAX_DEVICE_GROUP_SIZE)
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES))
import Vulkan.Core10.Enums.Result (Result(SUCCESS))
import Vulkan.Core10.APIConstants (MAX_DEVICE_GROUP_SIZE)
import Vulkan.Core10.Enums.MemoryHeapFlagBits (MemoryHeapFlagBits(..))
import Vulkan.Core10.Enums.MemoryHeapFlagBits (MemoryHeapFlags)
import Vulkan.Core10.Enums.StructureType (StructureType(..))
import Vulkan.Core10.APIConstants (pattern MAX_DEVICE_GROUP_SIZE)
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkEnumeratePhysicalDeviceGroups
:: FunPtr (Ptr Instance_T -> Ptr Word32 -> Ptr PhysicalDeviceGroupProperties -> IO Result) -> Ptr Instance_T -> Ptr Word32 -> Ptr PhysicalDeviceGroupProperties -> IO Result
enumeratePhysicalDeviceGroups :: forall io
. (MonadIO io)
=>
Instance
-> io (Result, ("physicalDeviceGroupProperties" ::: Vector PhysicalDeviceGroupProperties))
enumeratePhysicalDeviceGroups :: Instance
-> io
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
enumeratePhysicalDeviceGroups instance' :: Instance
instance' = IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
-> io
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
-> io
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties))
-> (ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
-> IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties))
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
-> io
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
-> IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
-> io
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties))
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
-> io
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
forall a b. (a -> b) -> a -> b
$ do
let vkEnumeratePhysicalDeviceGroupsPtr :: FunPtr
(Ptr Instance_T
-> ("pPhysicalDeviceGroupCount" ::: Ptr Word32)
-> ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> IO Result)
vkEnumeratePhysicalDeviceGroupsPtr = InstanceCmds
-> FunPtr
(Ptr Instance_T
-> ("pPhysicalDeviceGroupCount" ::: Ptr Word32)
-> ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> IO Result)
pVkEnumeratePhysicalDeviceGroups (Instance -> InstanceCmds
instanceCmds (Instance
instance' :: Instance))
IO ()
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ()
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
())
-> IO ()
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
(Ptr Instance_T
-> ("pPhysicalDeviceGroupCount" ::: Ptr Word32)
-> ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> IO Result)
vkEnumeratePhysicalDeviceGroupsPtr FunPtr
(Ptr Instance_T
-> ("pPhysicalDeviceGroupCount" ::: Ptr Word32)
-> ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> IO Result)
-> FunPtr
(Ptr Instance_T
-> ("pPhysicalDeviceGroupCount" ::: Ptr Word32)
-> ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
(Ptr Instance_T
-> ("pPhysicalDeviceGroupCount" ::: Ptr Word32)
-> ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> IO Result)
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 vkEnumeratePhysicalDeviceGroups is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
let vkEnumeratePhysicalDeviceGroups' :: Ptr Instance_T
-> ("pPhysicalDeviceGroupCount" ::: Ptr Word32)
-> ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> IO Result
vkEnumeratePhysicalDeviceGroups' = FunPtr
(Ptr Instance_T
-> ("pPhysicalDeviceGroupCount" ::: Ptr Word32)
-> ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> IO Result)
-> Ptr Instance_T
-> ("pPhysicalDeviceGroupCount" ::: Ptr Word32)
-> ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> IO Result
mkVkEnumeratePhysicalDeviceGroups FunPtr
(Ptr Instance_T
-> ("pPhysicalDeviceGroupCount" ::: Ptr Word32)
-> ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> IO Result)
vkEnumeratePhysicalDeviceGroupsPtr
let instance'' :: Ptr Instance_T
instance'' = Instance -> Ptr Instance_T
instanceHandle (Instance
instance')
"pPhysicalDeviceGroupCount" ::: Ptr Word32
pPPhysicalDeviceGroupCount <- ((("pPhysicalDeviceGroupCount" ::: Ptr Word32)
-> IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties))
-> IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties))
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
("pPhysicalDeviceGroupCount" ::: Ptr Word32)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pPhysicalDeviceGroupCount" ::: Ptr Word32)
-> IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties))
-> IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties))
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
("pPhysicalDeviceGroupCount" ::: Ptr Word32))
-> ((("pPhysicalDeviceGroupCount" ::: Ptr Word32)
-> IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties))
-> IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties))
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
("pPhysicalDeviceGroupCount" ::: Ptr Word32)
forall a b. (a -> b) -> a -> b
$ IO ("pPhysicalDeviceGroupCount" ::: Ptr Word32)
-> (("pPhysicalDeviceGroupCount" ::: Ptr Word32) -> IO ())
-> (("pPhysicalDeviceGroupCount" ::: Ptr Word32)
-> IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties))
-> IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int -> IO ("pPhysicalDeviceGroupCount" ::: Ptr Word32)
forall a. Int -> IO (Ptr a)
callocBytes @Word32 4) ("pPhysicalDeviceGroupCount" ::: Ptr Word32) -> IO ()
forall a. Ptr a -> IO ()
free
Result
r <- IO Result
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
Result)
-> IO Result
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "vkEnumeratePhysicalDeviceGroups" (Ptr Instance_T
-> ("pPhysicalDeviceGroupCount" ::: Ptr Word32)
-> ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> IO Result
vkEnumeratePhysicalDeviceGroups' Ptr Instance_T
instance'' ("pPhysicalDeviceGroupCount" ::: Ptr Word32
pPPhysicalDeviceGroupCount) ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties
forall a. Ptr a
nullPtr))
IO ()
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ()
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
())
-> IO ()
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Result
r Result -> Result -> Bool
forall a. Ord a => a -> a -> Bool
< Result
SUCCESS) (VulkanException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (Result -> VulkanException
VulkanException Result
r))
Word32
pPhysicalDeviceGroupCount <- IO Word32
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
Word32
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Word32
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
Word32)
-> IO Word32
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
Word32
forall a b. (a -> b) -> a -> b
$ ("pPhysicalDeviceGroupCount" ::: Ptr Word32) -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 "pPhysicalDeviceGroupCount" ::: Ptr Word32
pPPhysicalDeviceGroupCount
"pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties
pPPhysicalDeviceGroupProperties <- ((("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties))
-> IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties))
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties))
-> IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties))
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties))
-> ((("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties))
-> IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties))
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
forall a b. (a -> b) -> a -> b
$ IO
("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> (("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> IO ())
-> (("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties))
-> IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int
-> IO
("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
forall a. Int -> IO (Ptr a)
callocBytes @PhysicalDeviceGroupProperties ((Word32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32
pPhysicalDeviceGroupCount)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* 288)) ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> IO ()
forall a. Ptr a -> IO ()
free
[()]
_ <- (Int
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
())
-> [Int]
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
[()]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse (\i :: Int
i -> ((()
-> IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties))
-> IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties))
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((()
-> IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties))
-> IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties))
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
())
-> ((()
-> IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties))
-> IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties))
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
()
forall a b. (a -> b) -> a -> b
$ ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
-> IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
forall a b. ToCStruct a => Ptr a -> IO b -> IO b
pokeZeroCStruct ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties
pPPhysicalDeviceGroupProperties ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> Int
-> "pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
i Int -> Int -> Int
forall a. Num a => a -> a -> a
* 288) :: Ptr PhysicalDeviceGroupProperties) (IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
-> IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties))
-> ((()
-> IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties))
-> IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties))
-> (()
-> IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties))
-> IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((()
-> IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties))
-> ()
-> IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
forall a b. (a -> b) -> a -> b
$ ())) [0..(Word32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32
pPhysicalDeviceGroupCount)) Int -> Int -> Int
forall a. Num a => a -> a -> a
- 1]
Result
r' <- IO Result
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
Result)
-> IO Result
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "vkEnumeratePhysicalDeviceGroups" (Ptr Instance_T
-> ("pPhysicalDeviceGroupCount" ::: Ptr Word32)
-> ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> IO Result
vkEnumeratePhysicalDeviceGroups' Ptr Instance_T
instance'' ("pPhysicalDeviceGroupCount" ::: Ptr Word32
pPPhysicalDeviceGroupCount) (("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties
pPPhysicalDeviceGroupProperties)))
IO ()
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ()
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
())
-> IO ()
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Result
r' Result -> Result -> Bool
forall a. Ord a => a -> a -> Bool
< Result
SUCCESS) (VulkanException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (Result -> VulkanException
VulkanException Result
r'))
Word32
pPhysicalDeviceGroupCount' <- IO Word32
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
Word32
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Word32
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
Word32)
-> IO Word32
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
Word32
forall a b. (a -> b) -> a -> b
$ ("pPhysicalDeviceGroupCount" ::: Ptr Word32) -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 "pPhysicalDeviceGroupCount" ::: Ptr Word32
pPPhysicalDeviceGroupCount
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties
pPhysicalDeviceGroupProperties' <- IO
("physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
("physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO
("physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
("physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties))
-> IO
("physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
("physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
forall a b. (a -> b) -> a -> b
$ Int
-> (Int -> IO PhysicalDeviceGroupProperties)
-> IO
("physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
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
pPhysicalDeviceGroupCount')) (\i :: Int
i -> ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> IO PhysicalDeviceGroupProperties
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @PhysicalDeviceGroupProperties ((("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties
pPPhysicalDeviceGroupProperties) ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> Int
-> "pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (288 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr PhysicalDeviceGroupProperties)))
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
forall (f :: * -> *) a. Applicative f => a -> f a
pure ((Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties))
-> (Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
-> ContT
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
IO
(Result,
"physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties)
forall a b. (a -> b) -> a -> b
$ ((Result
r'), "physicalDeviceGroupProperties"
::: Vector PhysicalDeviceGroupProperties
pPhysicalDeviceGroupProperties')
data PhysicalDeviceGroupProperties = PhysicalDeviceGroupProperties
{
PhysicalDeviceGroupProperties -> Word32
physicalDeviceCount :: Word32
,
PhysicalDeviceGroupProperties -> Vector (Ptr PhysicalDevice_T)
physicalDevices :: Vector (Ptr PhysicalDevice_T)
,
PhysicalDeviceGroupProperties -> Bool
subsetAllocation :: Bool
}
deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceGroupProperties)
#endif
deriving instance Show PhysicalDeviceGroupProperties
instance ToCStruct PhysicalDeviceGroupProperties where
withCStruct :: PhysicalDeviceGroupProperties
-> (("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> IO b)
-> IO b
withCStruct x :: PhysicalDeviceGroupProperties
x f :: ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> IO b
f = Int
-> Int
-> (("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 288 8 ((("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> IO b)
-> IO b)
-> (("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> IO b)
-> IO b
forall a b. (a -> b) -> a -> b
$ \p :: "pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties
p -> ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> PhysicalDeviceGroupProperties -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties
p PhysicalDeviceGroupProperties
x (("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> IO b
f "pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties
p)
pokeCStruct :: ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> PhysicalDeviceGroupProperties -> IO b -> IO b
pokeCStruct p :: "pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties
p PhysicalDeviceGroupProperties{..} f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties
p ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties
p ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
("pPhysicalDeviceGroupCount" ::: Ptr Word32) -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties
p ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> Int -> "pPhysicalDeviceGroupCount" ::: Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Word32)) (Word32
physicalDeviceCount)
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless ((Vector (Ptr PhysicalDevice_T) -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector (Ptr PhysicalDevice_T) -> Int)
-> Vector (Ptr PhysicalDevice_T) -> Int
forall a b. (a -> b) -> a -> b
$ (Vector (Ptr PhysicalDevice_T)
physicalDevices)) Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
<= Int
forall a. Integral a => a
MAX_DEVICE_GROUP_SIZE) (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 "" "physicalDevices is too long, a maximum of MAX_DEVICE_GROUP_SIZE elements are allowed" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
(Int -> Ptr PhysicalDevice_T -> IO ())
-> Vector (Ptr PhysicalDevice_T) -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\i :: Int
i e :: Ptr PhysicalDevice_T
e -> Ptr (Ptr PhysicalDevice_T) -> Ptr PhysicalDevice_T -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (FixedArray MAX_DEVICE_GROUP_SIZE (Ptr PhysicalDevice_T))
-> Ptr (Ptr PhysicalDevice_T)
forall a (n :: Nat). Ptr (FixedArray n a) -> Ptr a
lowerArrayPtr (("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties
p ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> Int
-> Ptr (FixedArray MAX_DEVICE_GROUP_SIZE (Ptr PhysicalDevice_T))
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr (FixedArray MAX_DEVICE_GROUP_SIZE (Ptr PhysicalDevice_T))))) Ptr (Ptr PhysicalDevice_T) -> Int -> Ptr (Ptr PhysicalDevice_T)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr (Ptr PhysicalDevice_T)) (Ptr PhysicalDevice_T
e)) (Vector (Ptr PhysicalDevice_T)
physicalDevices)
Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties
p ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 280 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
subsetAllocation))
IO b
f
cStructSize :: Int
cStructSize = 288
cStructAlignment :: Int
cStructAlignment = 8
pokeZeroCStruct :: ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> IO b -> IO b
pokeZeroCStruct p :: "pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties
p f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties
p ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties
p ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
("pPhysicalDeviceGroupCount" ::: Ptr Word32) -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties
p ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> Int -> "pPhysicalDeviceGroupCount" ::: Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless ((Vector Any -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector Any -> Int) -> Vector Any -> Int
forall a b. (a -> b) -> a -> b
$ (Vector Any
forall a. Monoid a => a
mempty)) Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
<= Int
forall a. Integral a => a
MAX_DEVICE_GROUP_SIZE) (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 "" "physicalDevices is too long, a maximum of MAX_DEVICE_GROUP_SIZE elements are allowed" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
(Int -> Ptr PhysicalDevice_T -> IO ())
-> Vector (Ptr PhysicalDevice_T) -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\i :: Int
i e :: Ptr PhysicalDevice_T
e -> Ptr (Ptr PhysicalDevice_T) -> Ptr PhysicalDevice_T -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (FixedArray MAX_DEVICE_GROUP_SIZE (Ptr PhysicalDevice_T))
-> Ptr (Ptr PhysicalDevice_T)
forall a (n :: Nat). Ptr (FixedArray n a) -> Ptr a
lowerArrayPtr (("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties
p ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> Int
-> Ptr (FixedArray MAX_DEVICE_GROUP_SIZE (Ptr PhysicalDevice_T))
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr (FixedArray MAX_DEVICE_GROUP_SIZE (Ptr PhysicalDevice_T))))) Ptr (Ptr PhysicalDevice_T) -> Int -> Ptr (Ptr PhysicalDevice_T)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr (Ptr PhysicalDevice_T)) (Ptr PhysicalDevice_T
e)) (Vector (Ptr PhysicalDevice_T)
forall a. Monoid a => a
mempty)
Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties
p ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 280 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
forall a. Zero a => a
zero))
IO b
f
instance FromCStruct PhysicalDeviceGroupProperties where
peekCStruct :: ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> IO PhysicalDeviceGroupProperties
peekCStruct p :: "pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties
p = do
Word32
physicalDeviceCount <- ("pPhysicalDeviceGroupCount" ::: Ptr Word32) -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 (("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties
p ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> Int -> "pPhysicalDeviceGroupCount" ::: Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Word32))
Vector (Ptr PhysicalDevice_T)
physicalDevices <- Int
-> (Int -> IO (Ptr PhysicalDevice_T))
-> IO (Vector (Ptr PhysicalDevice_T))
forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM (Int
forall a. Integral a => a
MAX_DEVICE_GROUP_SIZE) (\i :: Int
i -> Ptr (Ptr PhysicalDevice_T) -> IO (Ptr PhysicalDevice_T)
forall a. Storable a => Ptr a -> IO a
peek @(Ptr PhysicalDevice_T) (((Ptr (FixedArray MAX_DEVICE_GROUP_SIZE (Ptr PhysicalDevice_T))
-> Ptr (Ptr PhysicalDevice_T)
forall a (n :: Nat). Ptr (FixedArray n a) -> Ptr a
lowerArrayPtr @(Ptr PhysicalDevice_T) (("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties
p ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> Int
-> Ptr (FixedArray MAX_DEVICE_GROUP_SIZE (Ptr PhysicalDevice_T))
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr (FixedArray MAX_DEVICE_GROUP_SIZE (Ptr PhysicalDevice_T))))) Ptr (Ptr PhysicalDevice_T) -> Int -> Ptr (Ptr PhysicalDevice_T)
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr (Ptr PhysicalDevice_T))))
Bool32
subsetAllocation <- Ptr Bool32 -> IO Bool32
forall a. Storable a => Ptr a -> IO a
peek @Bool32 (("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties
p ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 280 :: Ptr Bool32))
PhysicalDeviceGroupProperties -> IO PhysicalDeviceGroupProperties
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PhysicalDeviceGroupProperties -> IO PhysicalDeviceGroupProperties)
-> PhysicalDeviceGroupProperties
-> IO PhysicalDeviceGroupProperties
forall a b. (a -> b) -> a -> b
$ Word32
-> Vector (Ptr PhysicalDevice_T)
-> Bool
-> PhysicalDeviceGroupProperties
PhysicalDeviceGroupProperties
Word32
physicalDeviceCount Vector (Ptr PhysicalDevice_T)
physicalDevices (Bool32 -> Bool
bool32ToBool Bool32
subsetAllocation)
instance Storable PhysicalDeviceGroupProperties where
sizeOf :: PhysicalDeviceGroupProperties -> Int
sizeOf ~PhysicalDeviceGroupProperties
_ = 288
alignment :: PhysicalDeviceGroupProperties -> Int
alignment ~PhysicalDeviceGroupProperties
_ = 8
peek :: ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> IO PhysicalDeviceGroupProperties
peek = ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> IO PhysicalDeviceGroupProperties
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> PhysicalDeviceGroupProperties -> IO ()
poke ptr :: "pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties
ptr poked :: PhysicalDeviceGroupProperties
poked = ("pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties)
-> PhysicalDeviceGroupProperties -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pPhysicalDeviceGroupProperties"
::: Ptr PhysicalDeviceGroupProperties
ptr PhysicalDeviceGroupProperties
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero PhysicalDeviceGroupProperties where
zero :: PhysicalDeviceGroupProperties
zero = Word32
-> Vector (Ptr PhysicalDevice_T)
-> Bool
-> PhysicalDeviceGroupProperties
PhysicalDeviceGroupProperties
Word32
forall a. Zero a => a
zero
Vector (Ptr PhysicalDevice_T)
forall a. Monoid a => a
mempty
Bool
forall a. Zero a => a
zero
data DeviceGroupDeviceCreateInfo = DeviceGroupDeviceCreateInfo
{
DeviceGroupDeviceCreateInfo -> Vector (Ptr PhysicalDevice_T)
physicalDevices :: Vector (Ptr PhysicalDevice_T) }
deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (DeviceGroupDeviceCreateInfo)
#endif
deriving instance Show DeviceGroupDeviceCreateInfo
instance ToCStruct DeviceGroupDeviceCreateInfo where
withCStruct :: DeviceGroupDeviceCreateInfo
-> (Ptr DeviceGroupDeviceCreateInfo -> IO b) -> IO b
withCStruct x :: DeviceGroupDeviceCreateInfo
x f :: Ptr DeviceGroupDeviceCreateInfo -> IO b
f = Int -> Int -> (Ptr DeviceGroupDeviceCreateInfo -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 32 8 ((Ptr DeviceGroupDeviceCreateInfo -> IO b) -> IO b)
-> (Ptr DeviceGroupDeviceCreateInfo -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr DeviceGroupDeviceCreateInfo
p -> Ptr DeviceGroupDeviceCreateInfo
-> DeviceGroupDeviceCreateInfo -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr DeviceGroupDeviceCreateInfo
p DeviceGroupDeviceCreateInfo
x (Ptr DeviceGroupDeviceCreateInfo -> IO b
f Ptr DeviceGroupDeviceCreateInfo
p)
pokeCStruct :: Ptr DeviceGroupDeviceCreateInfo
-> DeviceGroupDeviceCreateInfo -> IO b -> IO b
pokeCStruct p :: Ptr DeviceGroupDeviceCreateInfo
p DeviceGroupDeviceCreateInfo{..} 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 DeviceGroupDeviceCreateInfo
p Ptr DeviceGroupDeviceCreateInfo -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO)
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 DeviceGroupDeviceCreateInfo
p Ptr DeviceGroupDeviceCreateInfo -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
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
$ ("pPhysicalDeviceGroupCount" ::: Ptr Word32) -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DeviceGroupDeviceCreateInfo
p Ptr DeviceGroupDeviceCreateInfo
-> Int -> "pPhysicalDeviceGroupCount" ::: Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Word32)) ((Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Vector (Ptr PhysicalDevice_T) -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector (Ptr PhysicalDevice_T) -> Int)
-> Vector (Ptr PhysicalDevice_T) -> Int
forall a b. (a -> b) -> a -> b
$ (Vector (Ptr PhysicalDevice_T)
physicalDevices)) :: Word32))
Ptr (Ptr PhysicalDevice_T)
pPPhysicalDevices' <- ((Ptr (Ptr PhysicalDevice_T) -> IO b) -> IO b)
-> ContT b IO (Ptr (Ptr PhysicalDevice_T))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (Ptr PhysicalDevice_T) -> IO b) -> IO b)
-> ContT b IO (Ptr (Ptr PhysicalDevice_T)))
-> ((Ptr (Ptr PhysicalDevice_T) -> IO b) -> IO b)
-> ContT b IO (Ptr (Ptr PhysicalDevice_T))
forall a b. (a -> b) -> a -> b
$ Int -> Int -> (Ptr (Ptr PhysicalDevice_T) -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned @(Ptr PhysicalDevice_T) ((Vector (Ptr PhysicalDevice_T) -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector (Ptr PhysicalDevice_T)
physicalDevices)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* 8) 8
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
$ (Int -> Ptr PhysicalDevice_T -> IO ())
-> Vector (Ptr PhysicalDevice_T) -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\i :: Int
i e :: Ptr PhysicalDevice_T
e -> Ptr (Ptr PhysicalDevice_T) -> Ptr PhysicalDevice_T -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr (Ptr PhysicalDevice_T)
pPPhysicalDevices' Ptr (Ptr PhysicalDevice_T) -> Int -> Ptr (Ptr PhysicalDevice_T)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr (Ptr PhysicalDevice_T)) (Ptr PhysicalDevice_T
e)) (Vector (Ptr PhysicalDevice_T)
physicalDevices)
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 PhysicalDevice_T))
-> Ptr (Ptr PhysicalDevice_T) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DeviceGroupDeviceCreateInfo
p Ptr DeviceGroupDeviceCreateInfo
-> Int -> Ptr (Ptr (Ptr PhysicalDevice_T))
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr (Ptr (Ptr PhysicalDevice_T)))) (Ptr (Ptr PhysicalDevice_T)
pPPhysicalDevices')
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 = 32
cStructAlignment :: Int
cStructAlignment = 8
pokeZeroCStruct :: Ptr DeviceGroupDeviceCreateInfo -> IO b -> IO b
pokeZeroCStruct p :: Ptr DeviceGroupDeviceCreateInfo
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 DeviceGroupDeviceCreateInfo
p Ptr DeviceGroupDeviceCreateInfo -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO)
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 DeviceGroupDeviceCreateInfo
p Ptr DeviceGroupDeviceCreateInfo -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
Ptr (Ptr PhysicalDevice_T)
pPPhysicalDevices' <- ((Ptr (Ptr PhysicalDevice_T) -> IO b) -> IO b)
-> ContT b IO (Ptr (Ptr PhysicalDevice_T))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (Ptr PhysicalDevice_T) -> IO b) -> IO b)
-> ContT b IO (Ptr (Ptr PhysicalDevice_T)))
-> ((Ptr (Ptr PhysicalDevice_T) -> IO b) -> IO b)
-> ContT b IO (Ptr (Ptr PhysicalDevice_T))
forall a b. (a -> b) -> a -> b
$ Int -> Int -> (Ptr (Ptr PhysicalDevice_T) -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned @(Ptr PhysicalDevice_T) ((Vector Any -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector Any
forall a. Monoid a => a
mempty)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* 8) 8
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
$ (Int -> Ptr PhysicalDevice_T -> IO ())
-> Vector (Ptr PhysicalDevice_T) -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\i :: Int
i e :: Ptr PhysicalDevice_T
e -> Ptr (Ptr PhysicalDevice_T) -> Ptr PhysicalDevice_T -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr (Ptr PhysicalDevice_T)
pPPhysicalDevices' Ptr (Ptr PhysicalDevice_T) -> Int -> Ptr (Ptr PhysicalDevice_T)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr (Ptr PhysicalDevice_T)) (Ptr PhysicalDevice_T
e)) (Vector (Ptr PhysicalDevice_T)
forall a. Monoid a => a
mempty)
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 PhysicalDevice_T))
-> Ptr (Ptr PhysicalDevice_T) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DeviceGroupDeviceCreateInfo
p Ptr DeviceGroupDeviceCreateInfo
-> Int -> Ptr (Ptr (Ptr PhysicalDevice_T))
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr (Ptr (Ptr PhysicalDevice_T)))) (Ptr (Ptr PhysicalDevice_T)
pPPhysicalDevices')
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 DeviceGroupDeviceCreateInfo where
peekCStruct :: Ptr DeviceGroupDeviceCreateInfo -> IO DeviceGroupDeviceCreateInfo
peekCStruct p :: Ptr DeviceGroupDeviceCreateInfo
p = do
Word32
physicalDeviceCount <- ("pPhysicalDeviceGroupCount" ::: Ptr Word32) -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr DeviceGroupDeviceCreateInfo
p Ptr DeviceGroupDeviceCreateInfo
-> Int -> "pPhysicalDeviceGroupCount" ::: Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Word32))
Ptr (Ptr PhysicalDevice_T)
pPhysicalDevices <- Ptr (Ptr (Ptr PhysicalDevice_T)) -> IO (Ptr (Ptr PhysicalDevice_T))
forall a. Storable a => Ptr a -> IO a
peek @(Ptr (Ptr PhysicalDevice_T)) ((Ptr DeviceGroupDeviceCreateInfo
p Ptr DeviceGroupDeviceCreateInfo
-> Int -> Ptr (Ptr (Ptr PhysicalDevice_T))
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr (Ptr (Ptr PhysicalDevice_T))))
Vector (Ptr PhysicalDevice_T)
pPhysicalDevices' <- Int
-> (Int -> IO (Ptr PhysicalDevice_T))
-> IO (Vector (Ptr PhysicalDevice_T))
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
physicalDeviceCount) (\i :: Int
i -> Ptr (Ptr PhysicalDevice_T) -> IO (Ptr PhysicalDevice_T)
forall a. Storable a => Ptr a -> IO a
peek @(Ptr PhysicalDevice_T) ((Ptr (Ptr PhysicalDevice_T)
pPhysicalDevices Ptr (Ptr PhysicalDevice_T) -> Int -> Ptr (Ptr PhysicalDevice_T)
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr (Ptr PhysicalDevice_T))))
DeviceGroupDeviceCreateInfo -> IO DeviceGroupDeviceCreateInfo
forall (f :: * -> *) a. Applicative f => a -> f a
pure (DeviceGroupDeviceCreateInfo -> IO DeviceGroupDeviceCreateInfo)
-> DeviceGroupDeviceCreateInfo -> IO DeviceGroupDeviceCreateInfo
forall a b. (a -> b) -> a -> b
$ Vector (Ptr PhysicalDevice_T) -> DeviceGroupDeviceCreateInfo
DeviceGroupDeviceCreateInfo
Vector (Ptr PhysicalDevice_T)
pPhysicalDevices'
instance Zero DeviceGroupDeviceCreateInfo where
zero :: DeviceGroupDeviceCreateInfo
zero = Vector (Ptr PhysicalDevice_T) -> DeviceGroupDeviceCreateInfo
DeviceGroupDeviceCreateInfo
Vector (Ptr PhysicalDevice_T)
forall a. Monoid a => a
mempty