{-# language CPP #-}
module Vulkan.Core10.Queue ( getDeviceQueue
, queueSubmit
, queueWaitIdle
, queueWaitIdleSafe
, deviceWaitIdle
, deviceWaitIdleSafe
, SubmitInfo(..)
, Queue(..)
, PipelineStageFlagBits(..)
, PipelineStageFlags
) where
import Vulkan.Internal.Utils (traceAroundEvent)
import Control.Exception.Base (bracket)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Data.Typeable (eqT)
import Foreign.Marshal.Alloc (allocaBytes)
import Foreign.Marshal.Alloc (callocBytes)
import Foreign.Marshal.Alloc (free)
import GHC.Base (when)
import GHC.IO (throwIO)
import GHC.Ptr (castPtr)
import GHC.Ptr (nullFunPtr)
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.Type.Equality ((:~:)(Refl))
import Data.Typeable (Typeable)
import Foreign.Storable (Storable(peek))
import Foreign.Storable (Storable(poke))
import GHC.Generics (Generic)
import GHC.IO.Exception (IOErrorType(..))
import GHC.IO.Exception (IOException(..))
import Foreign.Ptr (FunPtr)
import Foreign.Ptr (Ptr)
import Data.Word (Word32)
import Data.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Data.Vector (Vector)
import Vulkan.CStruct.Utils (advancePtrBytes)
import Vulkan.CStruct.Extends (forgetExtensions)
import Vulkan.CStruct.Extends (pokeSomeCStruct)
import Vulkan.NamedType ((:::))
import Vulkan.CStruct.Extends (Chain)
import Vulkan.Core10.Handles (CommandBuffer_T)
import {-# SOURCE #-} Vulkan.Extensions.VK_KHR_external_semaphore_win32 (D3D12FenceSubmitInfoKHR)
import Vulkan.Core10.Handles (Device)
import Vulkan.Core10.Handles (Device(..))
import Vulkan.Core10.Handles (Device(Device))
import Vulkan.Dynamic (DeviceCmds(pVkDeviceWaitIdle))
import Vulkan.Dynamic (DeviceCmds(pVkGetDeviceQueue))
import Vulkan.Dynamic (DeviceCmds(pVkQueueSubmit))
import Vulkan.Dynamic (DeviceCmds(pVkQueueWaitIdle))
import {-# SOURCE #-} Vulkan.Core11.Promoted_From_VK_KHR_device_group (DeviceGroupSubmitInfo)
import Vulkan.Core10.Handles (Device_T)
import Vulkan.CStruct.Extends (Extends)
import Vulkan.CStruct.Extends (Extendss)
import Vulkan.CStruct.Extends (Extensible(..))
import Vulkan.Core10.Handles (Fence)
import Vulkan.Core10.Handles (Fence(..))
import Vulkan.CStruct.Extends (PeekChain)
import Vulkan.CStruct.Extends (PeekChain(..))
import {-# SOURCE #-} Vulkan.Extensions.VK_KHR_performance_query (PerformanceQuerySubmitInfoKHR)
import Vulkan.Core10.Enums.PipelineStageFlagBits (PipelineStageFlags)
import Vulkan.CStruct.Extends (PokeChain)
import Vulkan.CStruct.Extends (PokeChain(..))
import {-# SOURCE #-} Vulkan.Core11.Originally_Based_On_VK_KHR_protected_memory (ProtectedSubmitInfo)
import Vulkan.Core10.Handles (Queue)
import Vulkan.Core10.Handles (Queue(..))
import Vulkan.Core10.Handles (Queue(Queue))
import Vulkan.Core10.Handles (Queue_T)
import Vulkan.Core10.Enums.Result (Result)
import Vulkan.Core10.Enums.Result (Result(..))
import Vulkan.Core10.Handles (Semaphore)
import Vulkan.CStruct.Extends (SomeStruct)
import Vulkan.Core10.Enums.StructureType (StructureType)
import {-# SOURCE #-} Vulkan.Core12.Promoted_From_VK_KHR_timeline_semaphore (TimelineSemaphoreSubmitInfo)
import Vulkan.Exception (VulkanException(..))
import {-# SOURCE #-} Vulkan.Extensions.VK_KHR_win32_keyed_mutex (Win32KeyedMutexAcquireReleaseInfoKHR)
import {-# SOURCE #-} Vulkan.Extensions.VK_NV_win32_keyed_mutex (Win32KeyedMutexAcquireReleaseInfoNV)
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_SUBMIT_INFO))
import Vulkan.Core10.Enums.Result (Result(SUCCESS))
import Vulkan.Core10.Enums.PipelineStageFlagBits (PipelineStageFlagBits(..))
import Vulkan.Core10.Enums.PipelineStageFlagBits (PipelineStageFlags)
import Vulkan.Core10.Handles (Queue(..))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkGetDeviceQueue
:: FunPtr (Ptr Device_T -> Word32 -> Word32 -> Ptr (Ptr Queue_T) -> IO ()) -> Ptr Device_T -> Word32 -> Word32 -> Ptr (Ptr Queue_T) -> IO ()
getDeviceQueue :: forall io
. (MonadIO io)
=>
Device
->
("queueFamilyIndex" ::: Word32)
->
("queueIndex" ::: Word32)
-> io (Queue)
getDeviceQueue :: Device
-> ("queueFamilyIndex" ::: Word32)
-> ("queueFamilyIndex" ::: Word32)
-> io Queue
getDeviceQueue Device
device "queueFamilyIndex" ::: Word32
queueFamilyIndex "queueFamilyIndex" ::: Word32
queueIndex = IO Queue -> io Queue
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Queue -> io Queue)
-> (ContT Queue IO Queue -> IO Queue)
-> ContT Queue IO Queue
-> io Queue
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT Queue IO Queue -> IO Queue
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT Queue IO Queue -> io Queue)
-> ContT Queue IO Queue -> io Queue
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 vkGetDeviceQueuePtr :: FunPtr
(Ptr Device_T
-> ("queueFamilyIndex" ::: Word32)
-> ("queueFamilyIndex" ::: Word32)
-> ("pQueue" ::: Ptr (Ptr Queue_T))
-> IO ())
vkGetDeviceQueuePtr = DeviceCmds
-> FunPtr
(Ptr Device_T
-> ("queueFamilyIndex" ::: Word32)
-> ("queueFamilyIndex" ::: Word32)
-> ("pQueue" ::: Ptr (Ptr Queue_T))
-> IO ())
pVkGetDeviceQueue DeviceCmds
cmds
IO () -> ContT Queue IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT Queue IO ()) -> IO () -> ContT Queue IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
(Ptr Device_T
-> ("queueFamilyIndex" ::: Word32)
-> ("queueFamilyIndex" ::: Word32)
-> ("pQueue" ::: Ptr (Ptr Queue_T))
-> IO ())
vkGetDeviceQueuePtr FunPtr
(Ptr Device_T
-> ("queueFamilyIndex" ::: Word32)
-> ("queueFamilyIndex" ::: Word32)
-> ("pQueue" ::: Ptr (Ptr Queue_T))
-> IO ())
-> FunPtr
(Ptr Device_T
-> ("queueFamilyIndex" ::: Word32)
-> ("queueFamilyIndex" ::: Word32)
-> ("pQueue" ::: Ptr (Ptr Queue_T))
-> IO ())
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
(Ptr Device_T
-> ("queueFamilyIndex" ::: Word32)
-> ("queueFamilyIndex" ::: Word32)
-> ("pQueue" ::: Ptr (Ptr Queue_T))
-> IO ())
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
IOException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"The function pointer for vkGetDeviceQueue is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
let vkGetDeviceQueue' :: Ptr Device_T
-> ("queueFamilyIndex" ::: Word32)
-> ("queueFamilyIndex" ::: Word32)
-> ("pQueue" ::: Ptr (Ptr Queue_T))
-> IO ()
vkGetDeviceQueue' = FunPtr
(Ptr Device_T
-> ("queueFamilyIndex" ::: Word32)
-> ("queueFamilyIndex" ::: Word32)
-> ("pQueue" ::: Ptr (Ptr Queue_T))
-> IO ())
-> Ptr Device_T
-> ("queueFamilyIndex" ::: Word32)
-> ("queueFamilyIndex" ::: Word32)
-> ("pQueue" ::: Ptr (Ptr Queue_T))
-> IO ()
mkVkGetDeviceQueue FunPtr
(Ptr Device_T
-> ("queueFamilyIndex" ::: Word32)
-> ("queueFamilyIndex" ::: Word32)
-> ("pQueue" ::: Ptr (Ptr Queue_T))
-> IO ())
vkGetDeviceQueuePtr
"pQueue" ::: Ptr (Ptr Queue_T)
pPQueue <- ((("pQueue" ::: Ptr (Ptr Queue_T)) -> IO Queue) -> IO Queue)
-> ContT Queue IO ("pQueue" ::: Ptr (Ptr Queue_T))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pQueue" ::: Ptr (Ptr Queue_T)) -> IO Queue) -> IO Queue)
-> ContT Queue IO ("pQueue" ::: Ptr (Ptr Queue_T)))
-> ((("pQueue" ::: Ptr (Ptr Queue_T)) -> IO Queue) -> IO Queue)
-> ContT Queue IO ("pQueue" ::: Ptr (Ptr Queue_T))
forall a b. (a -> b) -> a -> b
$ IO ("pQueue" ::: Ptr (Ptr Queue_T))
-> (("pQueue" ::: Ptr (Ptr Queue_T)) -> IO ())
-> (("pQueue" ::: Ptr (Ptr Queue_T)) -> IO Queue)
-> IO Queue
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int -> IO ("pQueue" ::: Ptr (Ptr Queue_T))
forall a. Int -> IO (Ptr a)
callocBytes @(Ptr Queue_T) Int
8) ("pQueue" ::: Ptr (Ptr Queue_T)) -> IO ()
forall a. Ptr a -> IO ()
free
IO () -> ContT Queue IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT Queue IO ()) -> IO () -> ContT Queue IO ()
forall a b. (a -> b) -> a -> b
$ String -> IO () -> IO ()
forall a. String -> IO a -> IO a
traceAroundEvent String
"vkGetDeviceQueue" (Ptr Device_T
-> ("queueFamilyIndex" ::: Word32)
-> ("queueFamilyIndex" ::: Word32)
-> ("pQueue" ::: Ptr (Ptr Queue_T))
-> IO ()
vkGetDeviceQueue' (Device -> Ptr Device_T
deviceHandle (Device
device)) ("queueFamilyIndex" ::: Word32
queueFamilyIndex) ("queueFamilyIndex" ::: Word32
queueIndex) ("pQueue" ::: Ptr (Ptr Queue_T)
pPQueue))
Ptr Queue_T
pQueue <- IO (Ptr Queue_T) -> ContT Queue IO (Ptr Queue_T)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO (Ptr Queue_T) -> ContT Queue IO (Ptr Queue_T))
-> IO (Ptr Queue_T) -> ContT Queue IO (Ptr Queue_T)
forall a b. (a -> b) -> a -> b
$ ("pQueue" ::: Ptr (Ptr Queue_T)) -> IO (Ptr Queue_T)
forall a. Storable a => Ptr a -> IO a
peek @(Ptr Queue_T) "pQueue" ::: Ptr (Ptr Queue_T)
pPQueue
Queue -> ContT Queue IO Queue
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Queue -> ContT Queue IO Queue) -> Queue -> ContT Queue IO Queue
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))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkQueueSubmit
:: FunPtr (Ptr Queue_T -> Word32 -> Ptr (SomeStruct SubmitInfo) -> Fence -> IO Result) -> Ptr Queue_T -> Word32 -> Ptr (SomeStruct SubmitInfo) -> Fence -> IO Result
queueSubmit :: forall io
. (MonadIO io)
=>
Queue
->
("submits" ::: Vector (SomeStruct SubmitInfo))
->
Fence
-> io ()
queueSubmit :: Queue
-> ("submits" ::: Vector (SomeStruct SubmitInfo)) -> Fence -> io ()
queueSubmit Queue
queue "submits" ::: Vector (SomeStruct SubmitInfo)
submits Fence
fence = IO () -> io ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> io ())
-> (ContT () IO () -> IO ()) -> ContT () IO () -> io ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT () IO () -> IO ()
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT () IO () -> io ()) -> ContT () IO () -> io ()
forall a b. (a -> b) -> a -> b
$ do
let vkQueueSubmitPtr :: FunPtr
(Ptr Queue_T
-> ("queueFamilyIndex" ::: Word32)
-> ("pSubmits" ::: Ptr (SomeStruct SubmitInfo))
-> Fence
-> IO Result)
vkQueueSubmitPtr = DeviceCmds
-> FunPtr
(Ptr Queue_T
-> ("queueFamilyIndex" ::: Word32)
-> ("pSubmits" ::: Ptr (SomeStruct SubmitInfo))
-> Fence
-> IO Result)
pVkQueueSubmit (case Queue
queue of Queue{DeviceCmds
$sel:deviceCmds:Queue :: Queue -> DeviceCmds
deviceCmds :: DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
IO () -> ContT () IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT () IO ()) -> IO () -> ContT () IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
(Ptr Queue_T
-> ("queueFamilyIndex" ::: Word32)
-> ("pSubmits" ::: Ptr (SomeStruct SubmitInfo))
-> Fence
-> IO Result)
vkQueueSubmitPtr FunPtr
(Ptr Queue_T
-> ("queueFamilyIndex" ::: Word32)
-> ("pSubmits" ::: Ptr (SomeStruct SubmitInfo))
-> Fence
-> IO Result)
-> FunPtr
(Ptr Queue_T
-> ("queueFamilyIndex" ::: Word32)
-> ("pSubmits" ::: Ptr (SomeStruct SubmitInfo))
-> Fence
-> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
(Ptr Queue_T
-> ("queueFamilyIndex" ::: Word32)
-> ("pSubmits" ::: Ptr (SomeStruct SubmitInfo))
-> Fence
-> 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 String
"" String
"The function pointer for vkQueueSubmit is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
let vkQueueSubmit' :: Ptr Queue_T
-> ("queueFamilyIndex" ::: Word32)
-> ("pSubmits" ::: Ptr (SomeStruct SubmitInfo))
-> Fence
-> IO Result
vkQueueSubmit' = FunPtr
(Ptr Queue_T
-> ("queueFamilyIndex" ::: Word32)
-> ("pSubmits" ::: Ptr (SomeStruct SubmitInfo))
-> Fence
-> IO Result)
-> Ptr Queue_T
-> ("queueFamilyIndex" ::: Word32)
-> ("pSubmits" ::: Ptr (SomeStruct SubmitInfo))
-> Fence
-> IO Result
mkVkQueueSubmit FunPtr
(Ptr Queue_T
-> ("queueFamilyIndex" ::: Word32)
-> ("pSubmits" ::: Ptr (SomeStruct SubmitInfo))
-> Fence
-> IO Result)
vkQueueSubmitPtr
Ptr (SubmitInfo Any)
pPSubmits <- ((Ptr (SubmitInfo Any) -> IO ()) -> IO ())
-> ContT () IO (Ptr (SubmitInfo Any))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (SubmitInfo Any) -> IO ()) -> IO ())
-> ContT () IO (Ptr (SubmitInfo Any)))
-> ((Ptr (SubmitInfo Any) -> IO ()) -> IO ())
-> ContT () IO (Ptr (SubmitInfo Any))
forall a b. (a -> b) -> a -> b
$ Int -> (Ptr (SubmitInfo Any) -> IO ()) -> IO ()
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes @(SubmitInfo _) ((("submits" ::: Vector (SomeStruct SubmitInfo)) -> Int
forall a. Vector a -> Int
Data.Vector.length ("submits" ::: Vector (SomeStruct SubmitInfo)
submits)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
72)
(Int -> SomeStruct SubmitInfo -> ContT () IO ())
-> ("submits" ::: Vector (SomeStruct SubmitInfo)) -> ContT () IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\Int
i SomeStruct SubmitInfo
e -> ((() -> IO ()) -> IO ()) -> ContT () IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO ()) -> IO ()) -> ContT () IO ())
-> ((() -> IO ()) -> IO ()) -> ContT () IO ()
forall a b. (a -> b) -> a -> b
$ ("pSubmits" ::: Ptr (SomeStruct SubmitInfo))
-> SomeStruct SubmitInfo -> IO () -> IO ()
forall (a :: [*] -> *) b.
(forall (es :: [*]).
(Extendss a es, PokeChain es) =>
ToCStruct (a es)) =>
Ptr (SomeStruct a) -> SomeStruct a -> IO b -> IO b
pokeSomeCStruct (Ptr (SubmitInfo Any) -> "pSubmits" ::: Ptr (SomeStruct SubmitInfo)
forall (a :: [*] -> *) (es :: [*]).
Ptr (a es) -> Ptr (SomeStruct a)
forgetExtensions (Ptr (SubmitInfo Any)
pPSubmits Ptr (SubmitInfo Any) -> Int -> Ptr (SubmitInfo _)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
72 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr (SubmitInfo _))) (SomeStruct SubmitInfo
e) (IO () -> IO ())
-> ((() -> IO ()) -> IO ()) -> (() -> IO ()) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO ()) -> () -> IO ()
forall a b. (a -> b) -> a -> b
$ ())) ("submits" ::: Vector (SomeStruct SubmitInfo)
submits)
Result
r <- IO Result -> ContT () IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result -> ContT () IO Result)
-> IO Result -> ContT () IO Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent String
"vkQueueSubmit" (Ptr Queue_T
-> ("queueFamilyIndex" ::: Word32)
-> ("pSubmits" ::: Ptr (SomeStruct SubmitInfo))
-> Fence
-> IO Result
vkQueueSubmit' (Queue -> Ptr Queue_T
queueHandle (Queue
queue)) ((Int -> "queueFamilyIndex" ::: Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (("submits" ::: Vector (SomeStruct SubmitInfo)) -> Int
forall a. Vector a -> Int
Data.Vector.length (("submits" ::: Vector (SomeStruct SubmitInfo)) -> Int)
-> ("submits" ::: Vector (SomeStruct SubmitInfo)) -> Int
forall a b. (a -> b) -> a -> b
$ ("submits" ::: Vector (SomeStruct SubmitInfo)
submits)) :: Word32)) (Ptr (SubmitInfo Any) -> "pSubmits" ::: Ptr (SomeStruct SubmitInfo)
forall (a :: [*] -> *) (es :: [*]).
Ptr (a es) -> Ptr (SomeStruct a)
forgetExtensions (Ptr (SubmitInfo Any)
pPSubmits)) (Fence
fence))
IO () -> ContT () IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT () IO ()) -> IO () -> ContT () 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))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkQueueWaitIdleUnsafe
:: FunPtr (Ptr Queue_T -> IO Result) -> Ptr Queue_T -> IO Result
foreign import ccall
"dynamic" mkVkQueueWaitIdleSafe
:: FunPtr (Ptr Queue_T -> IO Result) -> Ptr Queue_T -> IO Result
queueWaitIdleSafeOrUnsafe :: forall io
. (MonadIO io)
=> (FunPtr (Ptr Queue_T -> IO Result) -> Ptr Queue_T -> IO Result)
->
Queue
-> io ()
queueWaitIdleSafeOrUnsafe :: (FunPtr (Ptr Queue_T -> IO Result) -> Ptr Queue_T -> IO Result)
-> Queue -> io ()
queueWaitIdleSafeOrUnsafe FunPtr (Ptr Queue_T -> IO Result) -> Ptr Queue_T -> IO Result
mkVkQueueWaitIdle Queue
queue = IO () -> io ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> io ()) -> IO () -> io ()
forall a b. (a -> b) -> a -> b
$ do
let vkQueueWaitIdlePtr :: FunPtr (Ptr Queue_T -> IO Result)
vkQueueWaitIdlePtr = DeviceCmds -> FunPtr (Ptr Queue_T -> IO Result)
pVkQueueWaitIdle (case Queue
queue of Queue{DeviceCmds
deviceCmds :: DeviceCmds
$sel:deviceCmds:Queue :: Queue -> DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr (Ptr Queue_T -> IO Result)
vkQueueWaitIdlePtr FunPtr (Ptr Queue_T -> IO Result)
-> FunPtr (Ptr Queue_T -> IO Result) -> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr (Ptr Queue_T -> 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 String
"" String
"The function pointer for vkQueueWaitIdle is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
let vkQueueWaitIdle' :: Ptr Queue_T -> IO Result
vkQueueWaitIdle' = FunPtr (Ptr Queue_T -> IO Result) -> Ptr Queue_T -> IO Result
mkVkQueueWaitIdle FunPtr (Ptr Queue_T -> IO Result)
vkQueueWaitIdlePtr
Result
r <- String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent String
"vkQueueWaitIdle" (Ptr Queue_T -> IO Result
vkQueueWaitIdle' (Queue -> Ptr Queue_T
queueHandle (Queue
queue)))
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))
queueWaitIdle :: forall io
. (MonadIO io)
=>
Queue
-> io ()
queueWaitIdle :: Queue -> io ()
queueWaitIdle = (FunPtr (Ptr Queue_T -> IO Result) -> Ptr Queue_T -> IO Result)
-> Queue -> io ()
forall (io :: * -> *).
MonadIO io =>
(FunPtr (Ptr Queue_T -> IO Result) -> Ptr Queue_T -> IO Result)
-> Queue -> io ()
queueWaitIdleSafeOrUnsafe FunPtr (Ptr Queue_T -> IO Result) -> Ptr Queue_T -> IO Result
mkVkQueueWaitIdleUnsafe
queueWaitIdleSafe :: forall io
. (MonadIO io)
=>
Queue
-> io ()
queueWaitIdleSafe :: Queue -> io ()
queueWaitIdleSafe = (FunPtr (Ptr Queue_T -> IO Result) -> Ptr Queue_T -> IO Result)
-> Queue -> io ()
forall (io :: * -> *).
MonadIO io =>
(FunPtr (Ptr Queue_T -> IO Result) -> Ptr Queue_T -> IO Result)
-> Queue -> io ()
queueWaitIdleSafeOrUnsafe FunPtr (Ptr Queue_T -> IO Result) -> Ptr Queue_T -> IO Result
mkVkQueueWaitIdleSafe
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkDeviceWaitIdleUnsafe
:: FunPtr (Ptr Device_T -> IO Result) -> Ptr Device_T -> IO Result
foreign import ccall
"dynamic" mkVkDeviceWaitIdleSafe
:: FunPtr (Ptr Device_T -> IO Result) -> Ptr Device_T -> IO Result
deviceWaitIdleSafeOrUnsafe :: forall io
. (MonadIO io)
=> (FunPtr (Ptr Device_T -> IO Result) -> Ptr Device_T -> IO Result)
->
Device
-> io ()
deviceWaitIdleSafeOrUnsafe :: (FunPtr (Ptr Device_T -> IO Result) -> Ptr Device_T -> IO Result)
-> Device -> io ()
deviceWaitIdleSafeOrUnsafe FunPtr (Ptr Device_T -> IO Result) -> Ptr Device_T -> IO Result
mkVkDeviceWaitIdle Device
device = IO () -> io ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> io ()) -> IO () -> io ()
forall a b. (a -> b) -> a -> b
$ do
let vkDeviceWaitIdlePtr :: FunPtr (Ptr Device_T -> IO Result)
vkDeviceWaitIdlePtr = DeviceCmds -> FunPtr (Ptr Device_T -> IO Result)
pVkDeviceWaitIdle (case Device
device of Device{DeviceCmds
deviceCmds :: DeviceCmds
$sel:deviceCmds:Device :: Device -> DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr (Ptr Device_T -> IO Result)
vkDeviceWaitIdlePtr FunPtr (Ptr Device_T -> IO Result)
-> FunPtr (Ptr Device_T -> IO Result) -> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr (Ptr Device_T -> 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 String
"" String
"The function pointer for vkDeviceWaitIdle is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
let vkDeviceWaitIdle' :: Ptr Device_T -> IO Result
vkDeviceWaitIdle' = FunPtr (Ptr Device_T -> IO Result) -> Ptr Device_T -> IO Result
mkVkDeviceWaitIdle FunPtr (Ptr Device_T -> IO Result)
vkDeviceWaitIdlePtr
Result
r <- String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent String
"vkDeviceWaitIdle" (Ptr Device_T -> IO Result
vkDeviceWaitIdle' (Device -> Ptr Device_T
deviceHandle (Device
device)))
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))
deviceWaitIdle :: forall io
. (MonadIO io)
=>
Device
-> io ()
deviceWaitIdle :: Device -> io ()
deviceWaitIdle = (FunPtr (Ptr Device_T -> IO Result) -> Ptr Device_T -> IO Result)
-> Device -> io ()
forall (io :: * -> *).
MonadIO io =>
(FunPtr (Ptr Device_T -> IO Result) -> Ptr Device_T -> IO Result)
-> Device -> io ()
deviceWaitIdleSafeOrUnsafe FunPtr (Ptr Device_T -> IO Result) -> Ptr Device_T -> IO Result
mkVkDeviceWaitIdleUnsafe
deviceWaitIdleSafe :: forall io
. (MonadIO io)
=>
Device
-> io ()
deviceWaitIdleSafe :: Device -> io ()
deviceWaitIdleSafe = (FunPtr (Ptr Device_T -> IO Result) -> Ptr Device_T -> IO Result)
-> Device -> io ()
forall (io :: * -> *).
MonadIO io =>
(FunPtr (Ptr Device_T -> IO Result) -> Ptr Device_T -> IO Result)
-> Device -> io ()
deviceWaitIdleSafeOrUnsafe FunPtr (Ptr Device_T -> IO Result) -> Ptr Device_T -> IO Result
mkVkDeviceWaitIdleSafe
data SubmitInfo (es :: [Type]) = SubmitInfo
{
SubmitInfo es -> Chain es
next :: Chain es
,
SubmitInfo es -> Vector Semaphore
waitSemaphores :: Vector Semaphore
,
SubmitInfo es -> Vector PipelineStageFlags
waitDstStageMask :: Vector PipelineStageFlags
,
SubmitInfo es -> Vector (Ptr CommandBuffer_T)
commandBuffers :: Vector (Ptr CommandBuffer_T)
,
SubmitInfo es -> Vector Semaphore
signalSemaphores :: Vector Semaphore
}
deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (SubmitInfo (es :: [Type]))
#endif
deriving instance Show (Chain es) => Show (SubmitInfo es)
instance Extensible SubmitInfo where
extensibleTypeName :: String
extensibleTypeName = String
"SubmitInfo"
setNext :: SubmitInfo ds -> Chain es -> SubmitInfo es
setNext SubmitInfo{Vector (Ptr CommandBuffer_T)
Vector PipelineStageFlags
Vector Semaphore
Chain ds
signalSemaphores :: Vector Semaphore
commandBuffers :: Vector (Ptr CommandBuffer_T)
waitDstStageMask :: Vector PipelineStageFlags
waitSemaphores :: Vector Semaphore
next :: Chain ds
$sel:signalSemaphores:SubmitInfo :: forall (es :: [*]). SubmitInfo es -> Vector Semaphore
$sel:commandBuffers:SubmitInfo :: forall (es :: [*]). SubmitInfo es -> Vector (Ptr CommandBuffer_T)
$sel:waitDstStageMask:SubmitInfo :: forall (es :: [*]). SubmitInfo es -> Vector PipelineStageFlags
$sel:waitSemaphores:SubmitInfo :: forall (es :: [*]). SubmitInfo es -> Vector Semaphore
$sel:next:SubmitInfo :: forall (es :: [*]). SubmitInfo es -> Chain es
..} Chain es
next' = SubmitInfo :: forall (es :: [*]).
Chain es
-> Vector Semaphore
-> Vector PipelineStageFlags
-> Vector (Ptr CommandBuffer_T)
-> Vector Semaphore
-> SubmitInfo es
SubmitInfo{$sel:next:SubmitInfo :: Chain es
next = Chain es
next', Vector (Ptr CommandBuffer_T)
Vector PipelineStageFlags
Vector Semaphore
signalSemaphores :: Vector Semaphore
commandBuffers :: Vector (Ptr CommandBuffer_T)
waitDstStageMask :: Vector PipelineStageFlags
waitSemaphores :: Vector Semaphore
$sel:signalSemaphores:SubmitInfo :: Vector Semaphore
$sel:commandBuffers:SubmitInfo :: Vector (Ptr CommandBuffer_T)
$sel:waitDstStageMask:SubmitInfo :: Vector PipelineStageFlags
$sel:waitSemaphores:SubmitInfo :: Vector Semaphore
..}
getNext :: SubmitInfo es -> Chain es
getNext SubmitInfo{Vector (Ptr CommandBuffer_T)
Vector PipelineStageFlags
Vector Semaphore
Chain es
signalSemaphores :: Vector Semaphore
commandBuffers :: Vector (Ptr CommandBuffer_T)
waitDstStageMask :: Vector PipelineStageFlags
waitSemaphores :: Vector Semaphore
next :: Chain es
$sel:signalSemaphores:SubmitInfo :: forall (es :: [*]). SubmitInfo es -> Vector Semaphore
$sel:commandBuffers:SubmitInfo :: forall (es :: [*]). SubmitInfo es -> Vector (Ptr CommandBuffer_T)
$sel:waitDstStageMask:SubmitInfo :: forall (es :: [*]). SubmitInfo es -> Vector PipelineStageFlags
$sel:waitSemaphores:SubmitInfo :: forall (es :: [*]). SubmitInfo es -> Vector Semaphore
$sel:next:SubmitInfo :: forall (es :: [*]). SubmitInfo es -> Chain es
..} = Chain es
next
extends :: forall e b proxy. Typeable e => proxy e -> (Extends SubmitInfo e => b) -> Maybe b
extends :: proxy e -> (Extends SubmitInfo e => b) -> Maybe b
extends proxy e
_ Extends SubmitInfo e => b
f
| Just e :~: PerformanceQuerySubmitInfoKHR
Refl <- (Typeable e, Typeable PerformanceQuerySubmitInfoKHR) =>
Maybe (e :~: PerformanceQuerySubmitInfoKHR)
forall k (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
eqT @e @PerformanceQuerySubmitInfoKHR = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends SubmitInfo e => b
f
| Just e :~: TimelineSemaphoreSubmitInfo
Refl <- (Typeable e, Typeable TimelineSemaphoreSubmitInfo) =>
Maybe (e :~: TimelineSemaphoreSubmitInfo)
forall k (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
eqT @e @TimelineSemaphoreSubmitInfo = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends SubmitInfo e => b
f
| Just e :~: ProtectedSubmitInfo
Refl <- (Typeable e, Typeable ProtectedSubmitInfo) =>
Maybe (e :~: ProtectedSubmitInfo)
forall k (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
eqT @e @ProtectedSubmitInfo = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends SubmitInfo e => b
f
| Just e :~: DeviceGroupSubmitInfo
Refl <- (Typeable e, Typeable DeviceGroupSubmitInfo) =>
Maybe (e :~: DeviceGroupSubmitInfo)
forall k (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
eqT @e @DeviceGroupSubmitInfo = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends SubmitInfo e => b
f
| Just e :~: D3D12FenceSubmitInfoKHR
Refl <- (Typeable e, Typeable D3D12FenceSubmitInfoKHR) =>
Maybe (e :~: D3D12FenceSubmitInfoKHR)
forall k (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
eqT @e @D3D12FenceSubmitInfoKHR = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends SubmitInfo e => b
f
| Just e :~: Win32KeyedMutexAcquireReleaseInfoKHR
Refl <- (Typeable e, Typeable Win32KeyedMutexAcquireReleaseInfoKHR) =>
Maybe (e :~: Win32KeyedMutexAcquireReleaseInfoKHR)
forall k (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
eqT @e @Win32KeyedMutexAcquireReleaseInfoKHR = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends SubmitInfo e => b
f
| Just e :~: Win32KeyedMutexAcquireReleaseInfoNV
Refl <- (Typeable e, Typeable Win32KeyedMutexAcquireReleaseInfoNV) =>
Maybe (e :~: Win32KeyedMutexAcquireReleaseInfoNV)
forall k (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
eqT @e @Win32KeyedMutexAcquireReleaseInfoNV = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends SubmitInfo e => b
f
| Bool
otherwise = Maybe b
forall a. Maybe a
Nothing
instance (Extendss SubmitInfo es, PokeChain es) => ToCStruct (SubmitInfo es) where
withCStruct :: SubmitInfo es -> (Ptr (SubmitInfo es) -> IO b) -> IO b
withCStruct SubmitInfo es
x Ptr (SubmitInfo es) -> IO b
f = Int -> (Ptr (SubmitInfo es) -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
72 ((Ptr (SubmitInfo es) -> IO b) -> IO b)
-> (Ptr (SubmitInfo es) -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr (SubmitInfo es)
p -> Ptr (SubmitInfo es) -> SubmitInfo es -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr (SubmitInfo es)
p SubmitInfo es
x (Ptr (SubmitInfo es) -> IO b
f Ptr (SubmitInfo es)
p)
pokeCStruct :: Ptr (SubmitInfo es) -> SubmitInfo es -> IO b -> IO b
pokeCStruct Ptr (SubmitInfo es)
p SubmitInfo{Vector (Ptr CommandBuffer_T)
Vector PipelineStageFlags
Vector Semaphore
Chain es
signalSemaphores :: Vector Semaphore
commandBuffers :: Vector (Ptr CommandBuffer_T)
waitDstStageMask :: Vector PipelineStageFlags
waitSemaphores :: Vector Semaphore
next :: Chain es
$sel:signalSemaphores:SubmitInfo :: forall (es :: [*]). SubmitInfo es -> Vector Semaphore
$sel:commandBuffers:SubmitInfo :: forall (es :: [*]). SubmitInfo es -> Vector (Ptr CommandBuffer_T)
$sel:waitDstStageMask:SubmitInfo :: forall (es :: [*]). SubmitInfo es -> Vector PipelineStageFlags
$sel:waitSemaphores:SubmitInfo :: forall (es :: [*]). SubmitInfo es -> Vector Semaphore
$sel:next:SubmitInfo :: forall (es :: [*]). SubmitInfo es -> Chain es
..} 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 (SubmitInfo es)
p Ptr (SubmitInfo es) -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_SUBMIT_INFO)
Ptr ()
pNext'' <- (Ptr (Chain es) -> Ptr ())
-> ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Ptr (Chain es) -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr (ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ()))
-> (((Ptr (Chain es) -> IO b) -> IO b)
-> ContT b IO (Ptr (Chain es)))
-> ((Ptr (Chain es) -> IO b) -> IO b)
-> ContT b IO (Ptr ())
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr (Chain es))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ()))
-> ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ Chain es -> (Ptr (Chain es) -> IO b) -> IO b
forall (es :: [*]) a.
PokeChain es =>
Chain es -> (Ptr (Chain es) -> IO a) -> IO a
withChain (Chain es
next)
IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (SubmitInfo es)
p Ptr (SubmitInfo es) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) Ptr ()
pNext''
let pWaitSemaphoresLength :: Int
pWaitSemaphoresLength = Vector Semaphore -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector Semaphore -> Int) -> Vector Semaphore -> Int
forall a b. (a -> b) -> a -> b
$ (Vector Semaphore
waitSemaphores)
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
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless ((Vector PipelineStageFlags -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector PipelineStageFlags -> Int)
-> Vector PipelineStageFlags -> Int
forall a b. (a -> b) -> a -> b
$ (Vector PipelineStageFlags
waitDstStageMask)) Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
pWaitSemaphoresLength) (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 String
"" String
"pWaitDstStageMask and pWaitSemaphores must have the same length" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
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 ("queueFamilyIndex" ::: Word32)
-> ("queueFamilyIndex" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (SubmitInfo es)
p Ptr (SubmitInfo es) -> Int -> Ptr ("queueFamilyIndex" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32)) ((Int -> "queueFamilyIndex" ::: Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
pWaitSemaphoresLength :: Word32))
Ptr Semaphore
pPWaitSemaphores' <- ((Ptr Semaphore -> IO b) -> IO b) -> ContT b IO (Ptr Semaphore)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr Semaphore -> IO b) -> IO b) -> ContT b IO (Ptr Semaphore))
-> ((Ptr Semaphore -> IO b) -> IO b) -> ContT b IO (Ptr Semaphore)
forall a b. (a -> b) -> a -> b
$ Int -> (Ptr Semaphore -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes @Semaphore ((Vector Semaphore -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector Semaphore
waitSemaphores)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
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 -> Semaphore -> IO ()) -> Vector Semaphore -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\Int
i Semaphore
e -> Ptr Semaphore -> Semaphore -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Semaphore
pPWaitSemaphores' Ptr Semaphore -> Int -> Ptr Semaphore
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Semaphore) (Semaphore
e)) (Vector Semaphore
waitSemaphores)
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 Semaphore) -> Ptr Semaphore -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (SubmitInfo es)
p Ptr (SubmitInfo es) -> Int -> Ptr (Ptr Semaphore)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr Semaphore))) (Ptr Semaphore
pPWaitSemaphores')
Ptr PipelineStageFlags
pPWaitDstStageMask' <- ((Ptr PipelineStageFlags -> IO b) -> IO b)
-> ContT b IO (Ptr PipelineStageFlags)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr PipelineStageFlags -> IO b) -> IO b)
-> ContT b IO (Ptr PipelineStageFlags))
-> ((Ptr PipelineStageFlags -> IO b) -> IO b)
-> ContT b IO (Ptr PipelineStageFlags)
forall a b. (a -> b) -> a -> b
$ Int -> (Ptr PipelineStageFlags -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes @PipelineStageFlags ((Vector PipelineStageFlags -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector PipelineStageFlags
waitDstStageMask)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
4)
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 -> PipelineStageFlags -> IO ())
-> Vector PipelineStageFlags -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\Int
i PipelineStageFlags
e -> Ptr PipelineStageFlags -> PipelineStageFlags -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr PipelineStageFlags
pPWaitDstStageMask' Ptr PipelineStageFlags -> Int -> Ptr PipelineStageFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
4 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr PipelineStageFlags) (PipelineStageFlags
e)) (Vector PipelineStageFlags
waitDstStageMask)
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 PipelineStageFlags) -> Ptr PipelineStageFlags -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (SubmitInfo es)
p Ptr (SubmitInfo es) -> Int -> Ptr (Ptr PipelineStageFlags)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr (Ptr PipelineStageFlags))) (Ptr PipelineStageFlags
pPWaitDstStageMask')
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 ("queueFamilyIndex" ::: Word32)
-> ("queueFamilyIndex" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (SubmitInfo es)
p Ptr (SubmitInfo es) -> Int -> Ptr ("queueFamilyIndex" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
40 :: Ptr Word32)) ((Int -> "queueFamilyIndex" ::: Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Vector (Ptr CommandBuffer_T) -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector (Ptr CommandBuffer_T) -> Int)
-> Vector (Ptr CommandBuffer_T) -> Int
forall a b. (a -> b) -> a -> b
$ (Vector (Ptr CommandBuffer_T)
commandBuffers)) :: Word32))
Ptr (Ptr CommandBuffer_T)
pPCommandBuffers' <- ((Ptr (Ptr CommandBuffer_T) -> IO b) -> IO b)
-> ContT b IO (Ptr (Ptr CommandBuffer_T))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (Ptr CommandBuffer_T) -> IO b) -> IO b)
-> ContT b IO (Ptr (Ptr CommandBuffer_T)))
-> ((Ptr (Ptr CommandBuffer_T) -> IO b) -> IO b)
-> ContT b IO (Ptr (Ptr CommandBuffer_T))
forall a b. (a -> b) -> a -> b
$ Int -> (Ptr (Ptr CommandBuffer_T) -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes @(Ptr CommandBuffer_T) ((Vector (Ptr CommandBuffer_T) -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector (Ptr CommandBuffer_T)
commandBuffers)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
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 CommandBuffer_T -> IO ())
-> Vector (Ptr CommandBuffer_T) -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\Int
i Ptr CommandBuffer_T
e -> Ptr (Ptr CommandBuffer_T) -> Ptr CommandBuffer_T -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr (Ptr CommandBuffer_T)
pPCommandBuffers' Ptr (Ptr CommandBuffer_T) -> Int -> Ptr (Ptr CommandBuffer_T)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr (Ptr CommandBuffer_T)) (Ptr CommandBuffer_T
e)) (Vector (Ptr CommandBuffer_T)
commandBuffers)
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 CommandBuffer_T))
-> Ptr (Ptr CommandBuffer_T) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (SubmitInfo es)
p Ptr (SubmitInfo es) -> Int -> Ptr (Ptr (Ptr CommandBuffer_T))
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
48 :: Ptr (Ptr (Ptr CommandBuffer_T)))) (Ptr (Ptr CommandBuffer_T)
pPCommandBuffers')
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 ("queueFamilyIndex" ::: Word32)
-> ("queueFamilyIndex" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (SubmitInfo es)
p Ptr (SubmitInfo es) -> Int -> Ptr ("queueFamilyIndex" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
56 :: Ptr Word32)) ((Int -> "queueFamilyIndex" ::: Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Vector Semaphore -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector Semaphore -> Int) -> Vector Semaphore -> Int
forall a b. (a -> b) -> a -> b
$ (Vector Semaphore
signalSemaphores)) :: Word32))
Ptr Semaphore
pPSignalSemaphores' <- ((Ptr Semaphore -> IO b) -> IO b) -> ContT b IO (Ptr Semaphore)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr Semaphore -> IO b) -> IO b) -> ContT b IO (Ptr Semaphore))
-> ((Ptr Semaphore -> IO b) -> IO b) -> ContT b IO (Ptr Semaphore)
forall a b. (a -> b) -> a -> b
$ Int -> (Ptr Semaphore -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes @Semaphore ((Vector Semaphore -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector Semaphore
signalSemaphores)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
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 -> Semaphore -> IO ()) -> Vector Semaphore -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\Int
i Semaphore
e -> Ptr Semaphore -> Semaphore -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Semaphore
pPSignalSemaphores' Ptr Semaphore -> Int -> Ptr Semaphore
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Semaphore) (Semaphore
e)) (Vector Semaphore
signalSemaphores)
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 Semaphore) -> Ptr Semaphore -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (SubmitInfo es)
p Ptr (SubmitInfo es) -> Int -> Ptr (Ptr Semaphore)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
64 :: Ptr (Ptr Semaphore))) (Ptr Semaphore
pPSignalSemaphores')
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 = Int
72
cStructAlignment :: Int
cStructAlignment = Int
8
pokeZeroCStruct :: Ptr (SubmitInfo es) -> IO b -> IO b
pokeZeroCStruct Ptr (SubmitInfo es)
p 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 (SubmitInfo es)
p Ptr (SubmitInfo es) -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_SUBMIT_INFO)
Ptr ()
pNext' <- (Ptr (Chain es) -> Ptr ())
-> ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Ptr (Chain es) -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr (ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ()))
-> (((Ptr (Chain es) -> IO b) -> IO b)
-> ContT b IO (Ptr (Chain es)))
-> ((Ptr (Chain es) -> IO b) -> IO b)
-> ContT b IO (Ptr ())
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr (Chain es))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ()))
-> ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ forall a. PokeChain es => (Ptr (Chain es) -> IO a) -> IO a
forall (es :: [*]) a.
PokeChain es =>
(Ptr (Chain es) -> IO a) -> IO a
withZeroChain @es
IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (SubmitInfo es)
p Ptr (SubmitInfo es) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) Ptr ()
pNext'
IO b -> ContT b IO b
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO b -> ContT b IO b) -> IO b -> ContT b IO b
forall a b. (a -> b) -> a -> b
$ IO b
f
instance (Extendss SubmitInfo es, PeekChain es) => FromCStruct (SubmitInfo es) where
peekCStruct :: Ptr (SubmitInfo es) -> IO (SubmitInfo es)
peekCStruct Ptr (SubmitInfo es)
p = do
Ptr ()
pNext <- Ptr (Ptr ()) -> IO (Ptr ())
forall a. Storable a => Ptr a -> IO a
peek @(Ptr ()) ((Ptr (SubmitInfo es)
p Ptr (SubmitInfo es) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ())))
Chain es
next <- Ptr (Chain es) -> IO (Chain es)
forall (es :: [*]). PeekChain es => Ptr (Chain es) -> IO (Chain es)
peekChain (Ptr () -> Ptr (Chain es)
forall a b. Ptr a -> Ptr b
castPtr Ptr ()
pNext)
"queueFamilyIndex" ::: Word32
waitSemaphoreCount <- Ptr ("queueFamilyIndex" ::: Word32)
-> IO ("queueFamilyIndex" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr (SubmitInfo es)
p Ptr (SubmitInfo es) -> Int -> Ptr ("queueFamilyIndex" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32))
Ptr Semaphore
pWaitSemaphores <- Ptr (Ptr Semaphore) -> IO (Ptr Semaphore)
forall a. Storable a => Ptr a -> IO a
peek @(Ptr Semaphore) ((Ptr (SubmitInfo es)
p Ptr (SubmitInfo es) -> Int -> Ptr (Ptr Semaphore)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr Semaphore)))
Vector Semaphore
pWaitSemaphores' <- Int -> (Int -> IO Semaphore) -> IO (Vector Semaphore)
forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM (("queueFamilyIndex" ::: Word32) -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral "queueFamilyIndex" ::: Word32
waitSemaphoreCount) (\Int
i -> Ptr Semaphore -> IO Semaphore
forall a. Storable a => Ptr a -> IO a
peek @Semaphore ((Ptr Semaphore
pWaitSemaphores Ptr Semaphore -> Int -> Ptr Semaphore
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Semaphore)))
Ptr PipelineStageFlags
pWaitDstStageMask <- Ptr (Ptr PipelineStageFlags) -> IO (Ptr PipelineStageFlags)
forall a. Storable a => Ptr a -> IO a
peek @(Ptr PipelineStageFlags) ((Ptr (SubmitInfo es)
p Ptr (SubmitInfo es) -> Int -> Ptr (Ptr PipelineStageFlags)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr (Ptr PipelineStageFlags)))
Vector PipelineStageFlags
pWaitDstStageMask' <- Int
-> (Int -> IO PipelineStageFlags) -> IO (Vector PipelineStageFlags)
forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM (("queueFamilyIndex" ::: Word32) -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral "queueFamilyIndex" ::: Word32
waitSemaphoreCount) (\Int
i -> Ptr PipelineStageFlags -> IO PipelineStageFlags
forall a. Storable a => Ptr a -> IO a
peek @PipelineStageFlags ((Ptr PipelineStageFlags
pWaitDstStageMask Ptr PipelineStageFlags -> Int -> Ptr PipelineStageFlags
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
4 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr PipelineStageFlags)))
"queueFamilyIndex" ::: Word32
commandBufferCount <- Ptr ("queueFamilyIndex" ::: Word32)
-> IO ("queueFamilyIndex" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr (SubmitInfo es)
p Ptr (SubmitInfo es) -> Int -> Ptr ("queueFamilyIndex" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
40 :: Ptr Word32))
Ptr (Ptr CommandBuffer_T)
pCommandBuffers <- Ptr (Ptr (Ptr CommandBuffer_T)) -> IO (Ptr (Ptr CommandBuffer_T))
forall a. Storable a => Ptr a -> IO a
peek @(Ptr (Ptr CommandBuffer_T)) ((Ptr (SubmitInfo es)
p Ptr (SubmitInfo es) -> Int -> Ptr (Ptr (Ptr CommandBuffer_T))
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
48 :: Ptr (Ptr (Ptr CommandBuffer_T))))
Vector (Ptr CommandBuffer_T)
pCommandBuffers' <- Int
-> (Int -> IO (Ptr CommandBuffer_T))
-> IO (Vector (Ptr CommandBuffer_T))
forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM (("queueFamilyIndex" ::: Word32) -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral "queueFamilyIndex" ::: Word32
commandBufferCount) (\Int
i -> Ptr (Ptr CommandBuffer_T) -> IO (Ptr CommandBuffer_T)
forall a. Storable a => Ptr a -> IO a
peek @(Ptr CommandBuffer_T) ((Ptr (Ptr CommandBuffer_T)
pCommandBuffers Ptr (Ptr CommandBuffer_T) -> Int -> Ptr (Ptr CommandBuffer_T)
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr (Ptr CommandBuffer_T))))
"queueFamilyIndex" ::: Word32
signalSemaphoreCount <- Ptr ("queueFamilyIndex" ::: Word32)
-> IO ("queueFamilyIndex" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr (SubmitInfo es)
p Ptr (SubmitInfo es) -> Int -> Ptr ("queueFamilyIndex" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
56 :: Ptr Word32))
Ptr Semaphore
pSignalSemaphores <- Ptr (Ptr Semaphore) -> IO (Ptr Semaphore)
forall a. Storable a => Ptr a -> IO a
peek @(Ptr Semaphore) ((Ptr (SubmitInfo es)
p Ptr (SubmitInfo es) -> Int -> Ptr (Ptr Semaphore)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
64 :: Ptr (Ptr Semaphore)))
Vector Semaphore
pSignalSemaphores' <- Int -> (Int -> IO Semaphore) -> IO (Vector Semaphore)
forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM (("queueFamilyIndex" ::: Word32) -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral "queueFamilyIndex" ::: Word32
signalSemaphoreCount) (\Int
i -> Ptr Semaphore -> IO Semaphore
forall a. Storable a => Ptr a -> IO a
peek @Semaphore ((Ptr Semaphore
pSignalSemaphores Ptr Semaphore -> Int -> Ptr Semaphore
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Semaphore)))
SubmitInfo es -> IO (SubmitInfo es)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (SubmitInfo es -> IO (SubmitInfo es))
-> SubmitInfo es -> IO (SubmitInfo es)
forall a b. (a -> b) -> a -> b
$ Chain es
-> Vector Semaphore
-> Vector PipelineStageFlags
-> Vector (Ptr CommandBuffer_T)
-> Vector Semaphore
-> SubmitInfo es
forall (es :: [*]).
Chain es
-> Vector Semaphore
-> Vector PipelineStageFlags
-> Vector (Ptr CommandBuffer_T)
-> Vector Semaphore
-> SubmitInfo es
SubmitInfo
Chain es
next Vector Semaphore
pWaitSemaphores' Vector PipelineStageFlags
pWaitDstStageMask' Vector (Ptr CommandBuffer_T)
pCommandBuffers' Vector Semaphore
pSignalSemaphores'
instance es ~ '[] => Zero (SubmitInfo es) where
zero :: SubmitInfo es
zero = Chain es
-> Vector Semaphore
-> Vector PipelineStageFlags
-> Vector (Ptr CommandBuffer_T)
-> Vector Semaphore
-> SubmitInfo es
forall (es :: [*]).
Chain es
-> Vector Semaphore
-> Vector PipelineStageFlags
-> Vector (Ptr CommandBuffer_T)
-> Vector Semaphore
-> SubmitInfo es
SubmitInfo
()
Vector Semaphore
forall a. Monoid a => a
mempty
Vector PipelineStageFlags
forall a. Monoid a => a
mempty
Vector (Ptr CommandBuffer_T)
forall a. Monoid a => a
mempty
Vector Semaphore
forall a. Monoid a => a
mempty