{-# language CPP #-}
module Vulkan.Extensions.VK_KHR_display_swapchain ( createSharedSwapchainsKHR
, DisplayPresentInfoKHR(..)
, KHR_DISPLAY_SWAPCHAIN_SPEC_VERSION
, pattern KHR_DISPLAY_SWAPCHAIN_SPEC_VERSION
, KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME
, pattern KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME
, SurfaceKHR(..)
, SwapchainKHR(..)
, SwapchainCreateInfoKHR(..)
, PresentModeKHR(..)
, ColorSpaceKHR(..)
, CompositeAlphaFlagBitsKHR(..)
, CompositeAlphaFlagsKHR
, SurfaceTransformFlagBitsKHR(..)
, SurfaceTransformFlagsKHR
, SwapchainCreateFlagBitsKHR(..)
, SwapchainCreateFlagsKHR
) where
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 Control.Monad.IO.Class (MonadIO)
import Data.String (IsString)
import Data.Typeable (Typeable)
import Foreign.Storable (Storable(peek))
import Foreign.Storable (Storable(poke))
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.BaseType (bool32ToBool)
import Vulkan.Core10.BaseType (boolToBool32)
import Vulkan.CStruct.Extends (forgetExtensions)
import Vulkan.CStruct.Extends (pokeSomeCStruct)
import Vulkan.NamedType ((:::))
import Vulkan.Core10.AllocationCallbacks (AllocationCallbacks)
import Vulkan.Core10.BaseType (Bool32)
import Vulkan.Core10.Handles (Device)
import Vulkan.Core10.Handles (Device(..))
import Vulkan.Dynamic (DeviceCmds(pVkCreateSharedSwapchainsKHR))
import Vulkan.Core10.Handles (Device_T)
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.Core10.CommandBufferBuilding (Rect2D)
import Vulkan.Core10.Enums.Result (Result)
import Vulkan.Core10.Enums.Result (Result(..))
import Vulkan.CStruct.Extends (SomeStruct)
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Extensions.VK_KHR_swapchain (SwapchainCreateInfoKHR)
import Vulkan.Extensions.Handles (SwapchainKHR)
import Vulkan.Extensions.Handles (SwapchainKHR(..))
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Exception (VulkanException(..))
import Vulkan.Zero (Zero(..))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_DISPLAY_PRESENT_INFO_KHR))
import Vulkan.Core10.Enums.Result (Result(SUCCESS))
import Vulkan.Extensions.VK_KHR_surface (ColorSpaceKHR(..))
import Vulkan.Extensions.VK_KHR_surface (CompositeAlphaFlagBitsKHR(..))
import Vulkan.Extensions.VK_KHR_surface (CompositeAlphaFlagsKHR)
import Vulkan.Extensions.VK_KHR_surface (PresentModeKHR(..))
import Vulkan.Extensions.Handles (SurfaceKHR(..))
import Vulkan.Extensions.VK_KHR_surface (SurfaceTransformFlagBitsKHR(..))
import Vulkan.Extensions.VK_KHR_surface (SurfaceTransformFlagsKHR)
import Vulkan.Extensions.VK_KHR_swapchain (SwapchainCreateFlagBitsKHR(..))
import Vulkan.Extensions.VK_KHR_swapchain (SwapchainCreateFlagsKHR)
import Vulkan.Extensions.VK_KHR_swapchain (SwapchainCreateInfoKHR(..))
import Vulkan.Extensions.Handles (SwapchainKHR(..))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkCreateSharedSwapchainsKHR
:: FunPtr (Ptr Device_T -> Word32 -> Ptr (SwapchainCreateInfoKHR a) -> Ptr AllocationCallbacks -> Ptr SwapchainKHR -> IO Result) -> Ptr Device_T -> Word32 -> Ptr (SwapchainCreateInfoKHR a) -> Ptr AllocationCallbacks -> Ptr SwapchainKHR -> IO Result
createSharedSwapchainsKHR :: forall io . MonadIO io => Device -> ("createInfos" ::: Vector (SomeStruct SwapchainCreateInfoKHR)) -> ("allocator" ::: Maybe AllocationCallbacks) -> io (("swapchains" ::: Vector SwapchainKHR))
createSharedSwapchainsKHR :: Device
-> ("createInfos" ::: Vector (SomeStruct SwapchainCreateInfoKHR))
-> ("allocator" ::: Maybe AllocationCallbacks)
-> io ("swapchains" ::: Vector SwapchainKHR)
createSharedSwapchainsKHR device :: Device
device createInfos :: "createInfos" ::: Vector (SomeStruct SwapchainCreateInfoKHR)
createInfos allocator :: "allocator" ::: Maybe AllocationCallbacks
allocator = IO ("swapchains" ::: Vector SwapchainKHR)
-> io ("swapchains" ::: Vector SwapchainKHR)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ("swapchains" ::: Vector SwapchainKHR)
-> io ("swapchains" ::: Vector SwapchainKHR))
-> (ContT
("swapchains" ::: Vector SwapchainKHR)
IO
("swapchains" ::: Vector SwapchainKHR)
-> IO ("swapchains" ::: Vector SwapchainKHR))
-> ContT
("swapchains" ::: Vector SwapchainKHR)
IO
("swapchains" ::: Vector SwapchainKHR)
-> io ("swapchains" ::: Vector SwapchainKHR)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT
("swapchains" ::: Vector SwapchainKHR)
IO
("swapchains" ::: Vector SwapchainKHR)
-> IO ("swapchains" ::: Vector SwapchainKHR)
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT
("swapchains" ::: Vector SwapchainKHR)
IO
("swapchains" ::: Vector SwapchainKHR)
-> io ("swapchains" ::: Vector SwapchainKHR))
-> ContT
("swapchains" ::: Vector SwapchainKHR)
IO
("swapchains" ::: Vector SwapchainKHR)
-> io ("swapchains" ::: Vector SwapchainKHR)
forall a b. (a -> b) -> a -> b
$ do
let vkCreateSharedSwapchainsKHRPtr :: FunPtr
(Ptr Device_T
-> ("swapchainCount" ::: Word32)
-> ("pCreateInfos" ::: Ptr (SwapchainCreateInfoKHR Any))
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSwapchains" ::: Ptr SwapchainKHR)
-> IO Result)
vkCreateSharedSwapchainsKHRPtr = DeviceCmds
-> forall (a :: [*]).
FunPtr
(Ptr Device_T
-> ("swapchainCount" ::: Word32)
-> ("pCreateInfos" ::: Ptr (SwapchainCreateInfoKHR a))
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSwapchains" ::: Ptr SwapchainKHR)
-> IO Result)
pVkCreateSharedSwapchainsKHR (Device -> DeviceCmds
deviceCmds (Device
device :: Device))
IO () -> ContT ("swapchains" ::: Vector SwapchainKHR) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT ("swapchains" ::: Vector SwapchainKHR) IO ())
-> IO () -> ContT ("swapchains" ::: Vector SwapchainKHR) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
(Ptr Device_T
-> ("swapchainCount" ::: Word32)
-> ("pCreateInfos" ::: Ptr (SwapchainCreateInfoKHR Any))
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSwapchains" ::: Ptr SwapchainKHR)
-> IO Result)
vkCreateSharedSwapchainsKHRPtr FunPtr
(Ptr Device_T
-> ("swapchainCount" ::: Word32)
-> ("pCreateInfos" ::: Ptr (SwapchainCreateInfoKHR Any))
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSwapchains" ::: Ptr SwapchainKHR)
-> IO Result)
-> FunPtr
(Ptr Device_T
-> ("swapchainCount" ::: Word32)
-> ("pCreateInfos" ::: Ptr (SwapchainCreateInfoKHR Any))
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSwapchains" ::: Ptr SwapchainKHR)
-> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
(Ptr Device_T
-> ("swapchainCount" ::: Word32)
-> ("pCreateInfos" ::: Ptr (SwapchainCreateInfoKHR Any))
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSwapchains" ::: Ptr SwapchainKHR)
-> 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 vkCreateSharedSwapchainsKHR is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
let vkCreateSharedSwapchainsKHR' :: Ptr Device_T
-> ("swapchainCount" ::: Word32)
-> ("pCreateInfos" ::: Ptr (SwapchainCreateInfoKHR Any))
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSwapchains" ::: Ptr SwapchainKHR)
-> IO Result
vkCreateSharedSwapchainsKHR' = FunPtr
(Ptr Device_T
-> ("swapchainCount" ::: Word32)
-> ("pCreateInfos" ::: Ptr (SwapchainCreateInfoKHR Any))
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSwapchains" ::: Ptr SwapchainKHR)
-> IO Result)
-> Ptr Device_T
-> ("swapchainCount" ::: Word32)
-> ("pCreateInfos" ::: Ptr (SwapchainCreateInfoKHR Any))
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSwapchains" ::: Ptr SwapchainKHR)
-> IO Result
forall (a :: [*]).
FunPtr
(Ptr Device_T
-> ("swapchainCount" ::: Word32)
-> Ptr (SwapchainCreateInfoKHR a)
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSwapchains" ::: Ptr SwapchainKHR)
-> IO Result)
-> Ptr Device_T
-> ("swapchainCount" ::: Word32)
-> Ptr (SwapchainCreateInfoKHR a)
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSwapchains" ::: Ptr SwapchainKHR)
-> IO Result
mkVkCreateSharedSwapchainsKHR FunPtr
(Ptr Device_T
-> ("swapchainCount" ::: Word32)
-> ("pCreateInfos" ::: Ptr (SwapchainCreateInfoKHR Any))
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSwapchains" ::: Ptr SwapchainKHR)
-> IO Result)
vkCreateSharedSwapchainsKHRPtr
"pCreateInfos" ::: Ptr (SwapchainCreateInfoKHR Any)
pPCreateInfos <- ((("pCreateInfos" ::: Ptr (SwapchainCreateInfoKHR Any))
-> IO ("swapchains" ::: Vector SwapchainKHR))
-> IO ("swapchains" ::: Vector SwapchainKHR))
-> ContT
("swapchains" ::: Vector SwapchainKHR)
IO
("pCreateInfos" ::: Ptr (SwapchainCreateInfoKHR Any))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pCreateInfos" ::: Ptr (SwapchainCreateInfoKHR Any))
-> IO ("swapchains" ::: Vector SwapchainKHR))
-> IO ("swapchains" ::: Vector SwapchainKHR))
-> ContT
("swapchains" ::: Vector SwapchainKHR)
IO
("pCreateInfos" ::: Ptr (SwapchainCreateInfoKHR Any)))
-> ((("pCreateInfos" ::: Ptr (SwapchainCreateInfoKHR Any))
-> IO ("swapchains" ::: Vector SwapchainKHR))
-> IO ("swapchains" ::: Vector SwapchainKHR))
-> ContT
("swapchains" ::: Vector SwapchainKHR)
IO
("pCreateInfos" ::: Ptr (SwapchainCreateInfoKHR Any))
forall a b. (a -> b) -> a -> b
$ Int
-> Int
-> (("pCreateInfos" ::: Ptr (SwapchainCreateInfoKHR Any))
-> IO ("swapchains" ::: Vector SwapchainKHR))
-> IO ("swapchains" ::: Vector SwapchainKHR)
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned @(SwapchainCreateInfoKHR _) ((("createInfos" ::: Vector (SomeStruct SwapchainCreateInfoKHR))
-> Int
forall a. Vector a -> Int
Data.Vector.length ("createInfos" ::: Vector (SomeStruct SwapchainCreateInfoKHR)
createInfos)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* 104) 8
(Int
-> SomeStruct SwapchainCreateInfoKHR
-> ContT ("swapchains" ::: Vector SwapchainKHR) IO ())
-> ("createInfos" ::: Vector (SomeStruct SwapchainCreateInfoKHR))
-> ContT ("swapchains" ::: Vector SwapchainKHR) IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\i :: Int
i e :: SomeStruct SwapchainCreateInfoKHR
e -> ((() -> IO ("swapchains" ::: Vector SwapchainKHR))
-> IO ("swapchains" ::: Vector SwapchainKHR))
-> ContT ("swapchains" ::: Vector SwapchainKHR) IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO ("swapchains" ::: Vector SwapchainKHR))
-> IO ("swapchains" ::: Vector SwapchainKHR))
-> ContT ("swapchains" ::: Vector SwapchainKHR) IO ())
-> ((() -> IO ("swapchains" ::: Vector SwapchainKHR))
-> IO ("swapchains" ::: Vector SwapchainKHR))
-> ContT ("swapchains" ::: Vector SwapchainKHR) IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (SomeStruct SwapchainCreateInfoKHR)
-> SomeStruct SwapchainCreateInfoKHR
-> IO ("swapchains" ::: Vector SwapchainKHR)
-> IO ("swapchains" ::: Vector SwapchainKHR)
forall (a :: [*] -> *) b.
(forall (es :: [*]).
(Extendss a es, PokeChain es) =>
ToCStruct (a es)) =>
Ptr (SomeStruct a) -> SomeStruct a -> IO b -> IO b
pokeSomeCStruct (("pCreateInfos" ::: Ptr (SwapchainCreateInfoKHR Any))
-> Ptr (SomeStruct SwapchainCreateInfoKHR)
forall (a :: [*] -> *) (es :: [*]).
Ptr (a es) -> Ptr (SomeStruct a)
forgetExtensions ("pCreateInfos" ::: Ptr (SwapchainCreateInfoKHR Any)
pPCreateInfos ("pCreateInfos" ::: Ptr (SwapchainCreateInfoKHR Any))
-> Int -> Ptr (SwapchainCreateInfoKHR _)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (104 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr (SwapchainCreateInfoKHR _))) (SomeStruct SwapchainCreateInfoKHR
e) (IO ("swapchains" ::: Vector SwapchainKHR)
-> IO ("swapchains" ::: Vector SwapchainKHR))
-> ((() -> IO ("swapchains" ::: Vector SwapchainKHR))
-> IO ("swapchains" ::: Vector SwapchainKHR))
-> (() -> IO ("swapchains" ::: Vector SwapchainKHR))
-> IO ("swapchains" ::: Vector SwapchainKHR)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO ("swapchains" ::: Vector SwapchainKHR))
-> () -> IO ("swapchains" ::: Vector SwapchainKHR)
forall a b. (a -> b) -> a -> b
$ ())) ("createInfos" ::: Vector (SomeStruct SwapchainCreateInfoKHR)
createInfos)
"pAllocator" ::: Ptr AllocationCallbacks
pAllocator <- case ("allocator" ::: Maybe AllocationCallbacks
allocator) of
Nothing -> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ContT
("swapchains" ::: Vector SwapchainKHR)
IO
("pAllocator" ::: Ptr AllocationCallbacks)
forall (f :: * -> *) a. Applicative f => a -> f a
pure "pAllocator" ::: Ptr AllocationCallbacks
forall a. Ptr a
nullPtr
Just j :: AllocationCallbacks
j -> ((("pAllocator" ::: Ptr AllocationCallbacks)
-> IO ("swapchains" ::: Vector SwapchainKHR))
-> IO ("swapchains" ::: Vector SwapchainKHR))
-> ContT
("swapchains" ::: Vector SwapchainKHR)
IO
("pAllocator" ::: Ptr AllocationCallbacks)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pAllocator" ::: Ptr AllocationCallbacks)
-> IO ("swapchains" ::: Vector SwapchainKHR))
-> IO ("swapchains" ::: Vector SwapchainKHR))
-> ContT
("swapchains" ::: Vector SwapchainKHR)
IO
("pAllocator" ::: Ptr AllocationCallbacks))
-> ((("pAllocator" ::: Ptr AllocationCallbacks)
-> IO ("swapchains" ::: Vector SwapchainKHR))
-> IO ("swapchains" ::: Vector SwapchainKHR))
-> ContT
("swapchains" ::: Vector SwapchainKHR)
IO
("pAllocator" ::: Ptr AllocationCallbacks)
forall a b. (a -> b) -> a -> b
$ AllocationCallbacks
-> (("pAllocator" ::: Ptr AllocationCallbacks)
-> IO ("swapchains" ::: Vector SwapchainKHR))
-> IO ("swapchains" ::: Vector SwapchainKHR)
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (AllocationCallbacks
j)
"pSwapchains" ::: Ptr SwapchainKHR
pPSwapchains <- ((("pSwapchains" ::: Ptr SwapchainKHR)
-> IO ("swapchains" ::: Vector SwapchainKHR))
-> IO ("swapchains" ::: Vector SwapchainKHR))
-> ContT
("swapchains" ::: Vector SwapchainKHR)
IO
("pSwapchains" ::: Ptr SwapchainKHR)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pSwapchains" ::: Ptr SwapchainKHR)
-> IO ("swapchains" ::: Vector SwapchainKHR))
-> IO ("swapchains" ::: Vector SwapchainKHR))
-> ContT
("swapchains" ::: Vector SwapchainKHR)
IO
("pSwapchains" ::: Ptr SwapchainKHR))
-> ((("pSwapchains" ::: Ptr SwapchainKHR)
-> IO ("swapchains" ::: Vector SwapchainKHR))
-> IO ("swapchains" ::: Vector SwapchainKHR))
-> ContT
("swapchains" ::: Vector SwapchainKHR)
IO
("pSwapchains" ::: Ptr SwapchainKHR)
forall a b. (a -> b) -> a -> b
$ IO ("pSwapchains" ::: Ptr SwapchainKHR)
-> (("pSwapchains" ::: Ptr SwapchainKHR) -> IO ())
-> (("pSwapchains" ::: Ptr SwapchainKHR)
-> IO ("swapchains" ::: Vector SwapchainKHR))
-> IO ("swapchains" ::: Vector SwapchainKHR)
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int -> IO ("pSwapchains" ::: Ptr SwapchainKHR)
forall a. Int -> IO (Ptr a)
callocBytes @SwapchainKHR ((("swapchainCount" ::: Word32) -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral ((Int -> "swapchainCount" ::: Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (("createInfos" ::: Vector (SomeStruct SwapchainCreateInfoKHR))
-> Int
forall a. Vector a -> Int
Data.Vector.length (("createInfos" ::: Vector (SomeStruct SwapchainCreateInfoKHR))
-> Int)
-> ("createInfos" ::: Vector (SomeStruct SwapchainCreateInfoKHR))
-> Int
forall a b. (a -> b) -> a -> b
$ ("createInfos" ::: Vector (SomeStruct SwapchainCreateInfoKHR)
createInfos)) :: Word32))) Int -> Int -> Int
forall a. Num a => a -> a -> a
* 8)) ("pSwapchains" ::: Ptr SwapchainKHR) -> IO ()
forall a. Ptr a -> IO ()
free
Result
r <- IO Result -> ContT ("swapchains" ::: Vector SwapchainKHR) IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result
-> ContT ("swapchains" ::: Vector SwapchainKHR) IO Result)
-> IO Result
-> ContT ("swapchains" ::: Vector SwapchainKHR) IO Result
forall a b. (a -> b) -> a -> b
$ Ptr Device_T
-> ("swapchainCount" ::: Word32)
-> ("pCreateInfos" ::: Ptr (SwapchainCreateInfoKHR Any))
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSwapchains" ::: Ptr SwapchainKHR)
-> IO Result
vkCreateSharedSwapchainsKHR' (Device -> Ptr Device_T
deviceHandle (Device
device)) ((Int -> "swapchainCount" ::: Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (("createInfos" ::: Vector (SomeStruct SwapchainCreateInfoKHR))
-> Int
forall a. Vector a -> Int
Data.Vector.length (("createInfos" ::: Vector (SomeStruct SwapchainCreateInfoKHR))
-> Int)
-> ("createInfos" ::: Vector (SomeStruct SwapchainCreateInfoKHR))
-> Int
forall a b. (a -> b) -> a -> b
$ ("createInfos" ::: Vector (SomeStruct SwapchainCreateInfoKHR)
createInfos)) :: Word32)) ("pCreateInfos" ::: Ptr (SwapchainCreateInfoKHR Any)
pPCreateInfos) "pAllocator" ::: Ptr AllocationCallbacks
pAllocator ("pSwapchains" ::: Ptr SwapchainKHR
pPSwapchains)
IO () -> ContT ("swapchains" ::: Vector SwapchainKHR) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT ("swapchains" ::: Vector SwapchainKHR) IO ())
-> IO () -> ContT ("swapchains" ::: Vector SwapchainKHR) 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))
"swapchains" ::: Vector SwapchainKHR
pSwapchains <- IO ("swapchains" ::: Vector SwapchainKHR)
-> ContT
("swapchains" ::: Vector SwapchainKHR)
IO
("swapchains" ::: Vector SwapchainKHR)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ("swapchains" ::: Vector SwapchainKHR)
-> ContT
("swapchains" ::: Vector SwapchainKHR)
IO
("swapchains" ::: Vector SwapchainKHR))
-> IO ("swapchains" ::: Vector SwapchainKHR)
-> ContT
("swapchains" ::: Vector SwapchainKHR)
IO
("swapchains" ::: Vector SwapchainKHR)
forall a b. (a -> b) -> a -> b
$ Int
-> (Int -> IO SwapchainKHR)
-> IO ("swapchains" ::: Vector SwapchainKHR)
forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM (("swapchainCount" ::: Word32) -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral ((Int -> "swapchainCount" ::: Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (("createInfos" ::: Vector (SomeStruct SwapchainCreateInfoKHR))
-> Int
forall a. Vector a -> Int
Data.Vector.length (("createInfos" ::: Vector (SomeStruct SwapchainCreateInfoKHR))
-> Int)
-> ("createInfos" ::: Vector (SomeStruct SwapchainCreateInfoKHR))
-> Int
forall a b. (a -> b) -> a -> b
$ ("createInfos" ::: Vector (SomeStruct SwapchainCreateInfoKHR)
createInfos)) :: Word32))) (\i :: Int
i -> ("pSwapchains" ::: Ptr SwapchainKHR) -> IO SwapchainKHR
forall a. Storable a => Ptr a -> IO a
peek @SwapchainKHR (("pSwapchains" ::: Ptr SwapchainKHR
pPSwapchains ("pSwapchains" ::: Ptr SwapchainKHR)
-> Int -> "pSwapchains" ::: Ptr SwapchainKHR
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr SwapchainKHR)))
("swapchains" ::: Vector SwapchainKHR)
-> ContT
("swapchains" ::: Vector SwapchainKHR)
IO
("swapchains" ::: Vector SwapchainKHR)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (("swapchains" ::: Vector SwapchainKHR)
-> ContT
("swapchains" ::: Vector SwapchainKHR)
IO
("swapchains" ::: Vector SwapchainKHR))
-> ("swapchains" ::: Vector SwapchainKHR)
-> ContT
("swapchains" ::: Vector SwapchainKHR)
IO
("swapchains" ::: Vector SwapchainKHR)
forall a b. (a -> b) -> a -> b
$ ("swapchains" ::: Vector SwapchainKHR
pSwapchains)
data DisplayPresentInfoKHR = DisplayPresentInfoKHR
{
DisplayPresentInfoKHR -> Rect2D
srcRect :: Rect2D
,
DisplayPresentInfoKHR -> Rect2D
dstRect :: Rect2D
,
DisplayPresentInfoKHR -> Bool
persistent :: Bool
}
deriving (Typeable)
deriving instance Show DisplayPresentInfoKHR
instance ToCStruct DisplayPresentInfoKHR where
withCStruct :: DisplayPresentInfoKHR
-> (Ptr DisplayPresentInfoKHR -> IO b) -> IO b
withCStruct x :: DisplayPresentInfoKHR
x f :: Ptr DisplayPresentInfoKHR -> IO b
f = Int -> Int -> (Ptr DisplayPresentInfoKHR -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 56 8 ((Ptr DisplayPresentInfoKHR -> IO b) -> IO b)
-> (Ptr DisplayPresentInfoKHR -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr DisplayPresentInfoKHR
p -> Ptr DisplayPresentInfoKHR -> DisplayPresentInfoKHR -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr DisplayPresentInfoKHR
p DisplayPresentInfoKHR
x (Ptr DisplayPresentInfoKHR -> IO b
f Ptr DisplayPresentInfoKHR
p)
pokeCStruct :: Ptr DisplayPresentInfoKHR -> DisplayPresentInfoKHR -> IO b -> IO b
pokeCStruct p :: Ptr DisplayPresentInfoKHR
p DisplayPresentInfoKHR{..} 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 DisplayPresentInfoKHR
p Ptr DisplayPresentInfoKHR -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_DISPLAY_PRESENT_INFO_KHR)
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 DisplayPresentInfoKHR
p Ptr DisplayPresentInfoKHR -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Rect2D -> Rect2D -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct ((Ptr DisplayPresentInfoKHR
p Ptr DisplayPresentInfoKHR -> Int -> Ptr Rect2D
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Rect2D)) (Rect2D
srcRect) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())
((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Rect2D -> Rect2D -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct ((Ptr DisplayPresentInfoKHR
p Ptr DisplayPresentInfoKHR -> Int -> Ptr Rect2D
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr Rect2D)) (Rect2D
dstRect) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())
IO () -> 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 Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DisplayPresentInfoKHR
p Ptr DisplayPresentInfoKHR -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 48 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
persistent))
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 = 56
cStructAlignment :: Int
cStructAlignment = 8
pokeZeroCStruct :: Ptr DisplayPresentInfoKHR -> IO b -> IO b
pokeZeroCStruct p :: Ptr DisplayPresentInfoKHR
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 DisplayPresentInfoKHR
p Ptr DisplayPresentInfoKHR -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_DISPLAY_PRESENT_INFO_KHR)
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 DisplayPresentInfoKHR
p Ptr DisplayPresentInfoKHR -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Rect2D -> Rect2D -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct ((Ptr DisplayPresentInfoKHR
p Ptr DisplayPresentInfoKHR -> Int -> Ptr Rect2D
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Rect2D)) (Rect2D
forall a. Zero a => a
zero) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())
((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Rect2D -> Rect2D -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct ((Ptr DisplayPresentInfoKHR
p Ptr DisplayPresentInfoKHR -> Int -> Ptr Rect2D
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr Rect2D)) (Rect2D
forall a. Zero a => a
zero) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())
IO () -> 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 Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DisplayPresentInfoKHR
p Ptr DisplayPresentInfoKHR -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 48 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
forall a. Zero a => a
zero))
IO b -> ContT b IO b
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO b -> ContT b IO b) -> IO b -> ContT b IO b
forall a b. (a -> b) -> a -> b
$ IO b
f
instance FromCStruct DisplayPresentInfoKHR where
peekCStruct :: Ptr DisplayPresentInfoKHR -> IO DisplayPresentInfoKHR
peekCStruct p :: Ptr DisplayPresentInfoKHR
p = do
Rect2D
srcRect <- Ptr Rect2D -> IO Rect2D
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @Rect2D ((Ptr DisplayPresentInfoKHR
p Ptr DisplayPresentInfoKHR -> Int -> Ptr Rect2D
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Rect2D))
Rect2D
dstRect <- Ptr Rect2D -> IO Rect2D
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @Rect2D ((Ptr DisplayPresentInfoKHR
p Ptr DisplayPresentInfoKHR -> Int -> Ptr Rect2D
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr Rect2D))
Bool32
persistent <- Ptr Bool32 -> IO Bool32
forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr DisplayPresentInfoKHR
p Ptr DisplayPresentInfoKHR -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 48 :: Ptr Bool32))
DisplayPresentInfoKHR -> IO DisplayPresentInfoKHR
forall (f :: * -> *) a. Applicative f => a -> f a
pure (DisplayPresentInfoKHR -> IO DisplayPresentInfoKHR)
-> DisplayPresentInfoKHR -> IO DisplayPresentInfoKHR
forall a b. (a -> b) -> a -> b
$ Rect2D -> Rect2D -> Bool -> DisplayPresentInfoKHR
DisplayPresentInfoKHR
Rect2D
srcRect Rect2D
dstRect (Bool32 -> Bool
bool32ToBool Bool32
persistent)
instance Zero DisplayPresentInfoKHR where
zero :: DisplayPresentInfoKHR
zero = Rect2D -> Rect2D -> Bool -> DisplayPresentInfoKHR
DisplayPresentInfoKHR
Rect2D
forall a. Zero a => a
zero
Rect2D
forall a. Zero a => a
zero
Bool
forall a. Zero a => a
zero
type KHR_DISPLAY_SWAPCHAIN_SPEC_VERSION = 10
pattern KHR_DISPLAY_SWAPCHAIN_SPEC_VERSION :: forall a . Integral a => a
pattern $bKHR_DISPLAY_SWAPCHAIN_SPEC_VERSION :: a
$mKHR_DISPLAY_SWAPCHAIN_SPEC_VERSION :: forall r a. Integral a => a -> (Void# -> r) -> (Void# -> r) -> r
KHR_DISPLAY_SWAPCHAIN_SPEC_VERSION = 10
type KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME = "VK_KHR_display_swapchain"
pattern KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bKHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME :: a
$mKHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME :: forall r a.
(Eq a, IsString a) =>
a -> (Void# -> r) -> (Void# -> r) -> r
KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME = "VK_KHR_display_swapchain"