{-# language CPP #-}
module Vulkan.Extensions.VK_KHR_get_surface_capabilities2 ( getPhysicalDeviceSurfaceCapabilities2KHR
, getPhysicalDeviceSurfaceFormats2KHR
, PhysicalDeviceSurfaceInfo2KHR(..)
, SurfaceCapabilities2KHR(..)
, SurfaceFormat2KHR(..)
, KHR_GET_SURFACE_CAPABILITIES_2_SPEC_VERSION
, pattern KHR_GET_SURFACE_CAPABILITIES_2_SPEC_VERSION
, KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME
, pattern KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME
, SurfaceKHR(..)
, SurfaceCapabilitiesKHR(..)
, SurfaceFormatKHR(..)
, ColorSpaceKHR(..)
, CompositeAlphaFlagBitsKHR(..)
, CompositeAlphaFlagsKHR
, SurfaceTransformFlagBitsKHR(..)
, SurfaceTransformFlagsKHR
) where
import Control.Exception.Base (bracket)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Data.Typeable (eqT)
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 (castPtr)
import GHC.Ptr (nullFunPtr)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Cont (evalContT)
import Data.Vector (generateM)
import Control.Monad.IO.Class (MonadIO)
import Data.String (IsString)
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.NamedType ((:::))
import Vulkan.CStruct.Extends (Chain)
import {-# SOURCE #-} Vulkan.Extensions.VK_AMD_display_native_hdr (DisplayNativeHdrSurfaceCapabilitiesAMD)
import Vulkan.CStruct.Extends (Extends)
import Vulkan.CStruct.Extends (Extendss)
import Vulkan.CStruct.Extends (Extensible(..))
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.Dynamic (InstanceCmds(pVkGetPhysicalDeviceSurfaceCapabilities2KHR))
import Vulkan.Dynamic (InstanceCmds(pVkGetPhysicalDeviceSurfaceFormats2KHR))
import Vulkan.CStruct.Extends (PeekChain)
import Vulkan.CStruct.Extends (PeekChain(..))
import Vulkan.Core10.Handles (PhysicalDevice)
import Vulkan.Core10.Handles (PhysicalDevice(..))
import Vulkan.Core10.Handles (PhysicalDevice_T)
import Vulkan.CStruct.Extends (PokeChain)
import Vulkan.CStruct.Extends (PokeChain(..))
import Vulkan.Core10.Enums.Result (Result)
import Vulkan.Core10.Enums.Result (Result(..))
import {-# SOURCE #-} Vulkan.Extensions.VK_KHR_shared_presentable_image (SharedPresentSurfaceCapabilitiesKHR)
import Vulkan.CStruct.Extends (SomeStruct)
import Vulkan.Core10.Enums.StructureType (StructureType)
import {-# SOURCE #-} Vulkan.Extensions.VK_EXT_full_screen_exclusive (SurfaceCapabilitiesFullScreenExclusiveEXT)
import Vulkan.Extensions.VK_KHR_surface (SurfaceCapabilitiesKHR)
import Vulkan.Extensions.VK_KHR_surface (SurfaceFormatKHR)
import {-# SOURCE #-} Vulkan.Extensions.VK_EXT_full_screen_exclusive (SurfaceFullScreenExclusiveInfoEXT)
import {-# SOURCE #-} Vulkan.Extensions.VK_EXT_full_screen_exclusive (SurfaceFullScreenExclusiveWin32InfoEXT)
import Vulkan.Extensions.Handles (SurfaceKHR)
import {-# SOURCE #-} Vulkan.Extensions.VK_KHR_surface_protected_capabilities (SurfaceProtectedCapabilitiesKHR)
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Exception (VulkanException(..))
import Vulkan.Zero (Zero(..))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_SURFACE_FORMAT_2_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 (SurfaceCapabilitiesKHR(..))
import Vulkan.Extensions.VK_KHR_surface (SurfaceFormatKHR(..))
import Vulkan.Extensions.Handles (SurfaceKHR(..))
import Vulkan.Extensions.VK_KHR_surface (SurfaceTransformFlagBitsKHR(..))
import Vulkan.Extensions.VK_KHR_surface (SurfaceTransformFlagsKHR)
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkGetPhysicalDeviceSurfaceCapabilities2KHR
:: FunPtr (Ptr PhysicalDevice_T -> Ptr (SomeStruct PhysicalDeviceSurfaceInfo2KHR) -> Ptr (SomeStruct SurfaceCapabilities2KHR) -> IO Result) -> Ptr PhysicalDevice_T -> Ptr (SomeStruct PhysicalDeviceSurfaceInfo2KHR) -> Ptr (SomeStruct SurfaceCapabilities2KHR) -> IO Result
getPhysicalDeviceSurfaceCapabilities2KHR :: forall a b io
. (Extendss PhysicalDeviceSurfaceInfo2KHR a, Extendss SurfaceCapabilities2KHR b, PokeChain a, PokeChain b, PeekChain b, MonadIO io)
=>
PhysicalDevice
->
(PhysicalDeviceSurfaceInfo2KHR a)
-> io (SurfaceCapabilities2KHR b)
getPhysicalDeviceSurfaceCapabilities2KHR :: PhysicalDevice
-> PhysicalDeviceSurfaceInfo2KHR a
-> io (SurfaceCapabilities2KHR b)
getPhysicalDeviceSurfaceCapabilities2KHR physicalDevice :: PhysicalDevice
physicalDevice surfaceInfo :: PhysicalDeviceSurfaceInfo2KHR a
surfaceInfo = IO (SurfaceCapabilities2KHR b) -> io (SurfaceCapabilities2KHR b)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (SurfaceCapabilities2KHR b) -> io (SurfaceCapabilities2KHR b))
-> (ContT
(SurfaceCapabilities2KHR b) IO (SurfaceCapabilities2KHR b)
-> IO (SurfaceCapabilities2KHR b))
-> ContT (SurfaceCapabilities2KHR b) IO (SurfaceCapabilities2KHR b)
-> io (SurfaceCapabilities2KHR b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT (SurfaceCapabilities2KHR b) IO (SurfaceCapabilities2KHR b)
-> IO (SurfaceCapabilities2KHR b)
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT (SurfaceCapabilities2KHR b) IO (SurfaceCapabilities2KHR b)
-> io (SurfaceCapabilities2KHR b))
-> ContT (SurfaceCapabilities2KHR b) IO (SurfaceCapabilities2KHR b)
-> io (SurfaceCapabilities2KHR b)
forall a b. (a -> b) -> a -> b
$ do
let vkGetPhysicalDeviceSurfaceCapabilities2KHRPtr :: FunPtr
(Ptr PhysicalDevice_T
-> ("pSurfaceInfo"
::: Ptr (SomeStruct PhysicalDeviceSurfaceInfo2KHR))
-> ("pSurfaceCapabilities"
::: Ptr (SomeStruct SurfaceCapabilities2KHR))
-> IO Result)
vkGetPhysicalDeviceSurfaceCapabilities2KHRPtr = InstanceCmds
-> FunPtr
(Ptr PhysicalDevice_T
-> ("pSurfaceInfo"
::: Ptr (SomeStruct PhysicalDeviceSurfaceInfo2KHR))
-> ("pSurfaceCapabilities"
::: Ptr (SomeStruct SurfaceCapabilities2KHR))
-> IO Result)
pVkGetPhysicalDeviceSurfaceCapabilities2KHR (PhysicalDevice -> InstanceCmds
instanceCmds (PhysicalDevice
physicalDevice :: PhysicalDevice))
IO () -> ContT (SurfaceCapabilities2KHR b) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT (SurfaceCapabilities2KHR b) IO ())
-> IO () -> ContT (SurfaceCapabilities2KHR b) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
(Ptr PhysicalDevice_T
-> ("pSurfaceInfo"
::: Ptr (SomeStruct PhysicalDeviceSurfaceInfo2KHR))
-> ("pSurfaceCapabilities"
::: Ptr (SomeStruct SurfaceCapabilities2KHR))
-> IO Result)
vkGetPhysicalDeviceSurfaceCapabilities2KHRPtr FunPtr
(Ptr PhysicalDevice_T
-> ("pSurfaceInfo"
::: Ptr (SomeStruct PhysicalDeviceSurfaceInfo2KHR))
-> ("pSurfaceCapabilities"
::: Ptr (SomeStruct SurfaceCapabilities2KHR))
-> IO Result)
-> FunPtr
(Ptr PhysicalDevice_T
-> ("pSurfaceInfo"
::: Ptr (SomeStruct PhysicalDeviceSurfaceInfo2KHR))
-> ("pSurfaceCapabilities"
::: Ptr (SomeStruct SurfaceCapabilities2KHR))
-> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
(Ptr PhysicalDevice_T
-> ("pSurfaceInfo"
::: Ptr (SomeStruct PhysicalDeviceSurfaceInfo2KHR))
-> ("pSurfaceCapabilities"
::: Ptr (SomeStruct SurfaceCapabilities2KHR))
-> 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 vkGetPhysicalDeviceSurfaceCapabilities2KHR is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
let vkGetPhysicalDeviceSurfaceCapabilities2KHR' :: Ptr PhysicalDevice_T
-> ("pSurfaceInfo"
::: Ptr (SomeStruct PhysicalDeviceSurfaceInfo2KHR))
-> ("pSurfaceCapabilities"
::: Ptr (SomeStruct SurfaceCapabilities2KHR))
-> IO Result
vkGetPhysicalDeviceSurfaceCapabilities2KHR' = FunPtr
(Ptr PhysicalDevice_T
-> ("pSurfaceInfo"
::: Ptr (SomeStruct PhysicalDeviceSurfaceInfo2KHR))
-> ("pSurfaceCapabilities"
::: Ptr (SomeStruct SurfaceCapabilities2KHR))
-> IO Result)
-> Ptr PhysicalDevice_T
-> ("pSurfaceInfo"
::: Ptr (SomeStruct PhysicalDeviceSurfaceInfo2KHR))
-> ("pSurfaceCapabilities"
::: Ptr (SomeStruct SurfaceCapabilities2KHR))
-> IO Result
mkVkGetPhysicalDeviceSurfaceCapabilities2KHR FunPtr
(Ptr PhysicalDevice_T
-> ("pSurfaceInfo"
::: Ptr (SomeStruct PhysicalDeviceSurfaceInfo2KHR))
-> ("pSurfaceCapabilities"
::: Ptr (SomeStruct SurfaceCapabilities2KHR))
-> IO Result)
vkGetPhysicalDeviceSurfaceCapabilities2KHRPtr
Ptr (PhysicalDeviceSurfaceInfo2KHR a)
pSurfaceInfo <- ((Ptr (PhysicalDeviceSurfaceInfo2KHR a)
-> IO (SurfaceCapabilities2KHR b))
-> IO (SurfaceCapabilities2KHR b))
-> ContT
(SurfaceCapabilities2KHR b)
IO
(Ptr (PhysicalDeviceSurfaceInfo2KHR a))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (PhysicalDeviceSurfaceInfo2KHR a)
-> IO (SurfaceCapabilities2KHR b))
-> IO (SurfaceCapabilities2KHR b))
-> ContT
(SurfaceCapabilities2KHR b)
IO
(Ptr (PhysicalDeviceSurfaceInfo2KHR a)))
-> ((Ptr (PhysicalDeviceSurfaceInfo2KHR a)
-> IO (SurfaceCapabilities2KHR b))
-> IO (SurfaceCapabilities2KHR b))
-> ContT
(SurfaceCapabilities2KHR b)
IO
(Ptr (PhysicalDeviceSurfaceInfo2KHR a))
forall a b. (a -> b) -> a -> b
$ PhysicalDeviceSurfaceInfo2KHR a
-> (Ptr (PhysicalDeviceSurfaceInfo2KHR a)
-> IO (SurfaceCapabilities2KHR b))
-> IO (SurfaceCapabilities2KHR b)
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (PhysicalDeviceSurfaceInfo2KHR a
surfaceInfo)
Ptr (SurfaceCapabilities2KHR b)
pPSurfaceCapabilities <- ((Ptr (SurfaceCapabilities2KHR b)
-> IO (SurfaceCapabilities2KHR b))
-> IO (SurfaceCapabilities2KHR b))
-> ContT
(SurfaceCapabilities2KHR b) IO (Ptr (SurfaceCapabilities2KHR b))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (forall b.
ToCStruct (SurfaceCapabilities2KHR b) =>
(Ptr (SurfaceCapabilities2KHR b) -> IO b) -> IO b
forall a b. ToCStruct a => (Ptr a -> IO b) -> IO b
withZeroCStruct @(SurfaceCapabilities2KHR _))
Result
r <- IO Result -> ContT (SurfaceCapabilities2KHR b) IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result -> ContT (SurfaceCapabilities2KHR b) IO Result)
-> IO Result -> ContT (SurfaceCapabilities2KHR b) IO Result
forall a b. (a -> b) -> a -> b
$ Ptr PhysicalDevice_T
-> ("pSurfaceInfo"
::: Ptr (SomeStruct PhysicalDeviceSurfaceInfo2KHR))
-> ("pSurfaceCapabilities"
::: Ptr (SomeStruct SurfaceCapabilities2KHR))
-> IO Result
vkGetPhysicalDeviceSurfaceCapabilities2KHR' (PhysicalDevice -> Ptr PhysicalDevice_T
physicalDeviceHandle (PhysicalDevice
physicalDevice)) (Ptr (PhysicalDeviceSurfaceInfo2KHR a)
-> "pSurfaceInfo"
::: Ptr (SomeStruct PhysicalDeviceSurfaceInfo2KHR)
forall (a :: [*] -> *) (es :: [*]).
Ptr (a es) -> Ptr (SomeStruct a)
forgetExtensions Ptr (PhysicalDeviceSurfaceInfo2KHR a)
pSurfaceInfo) (Ptr (SurfaceCapabilities2KHR b)
-> "pSurfaceCapabilities"
::: Ptr (SomeStruct SurfaceCapabilities2KHR)
forall (a :: [*] -> *) (es :: [*]).
Ptr (a es) -> Ptr (SomeStruct a)
forgetExtensions (Ptr (SurfaceCapabilities2KHR b)
pPSurfaceCapabilities))
IO () -> ContT (SurfaceCapabilities2KHR b) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT (SurfaceCapabilities2KHR b) IO ())
-> IO () -> ContT (SurfaceCapabilities2KHR b) 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))
SurfaceCapabilities2KHR b
pSurfaceCapabilities <- IO (SurfaceCapabilities2KHR b)
-> ContT (SurfaceCapabilities2KHR b) IO (SurfaceCapabilities2KHR b)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO (SurfaceCapabilities2KHR b)
-> ContT
(SurfaceCapabilities2KHR b) IO (SurfaceCapabilities2KHR b))
-> IO (SurfaceCapabilities2KHR b)
-> ContT (SurfaceCapabilities2KHR b) IO (SurfaceCapabilities2KHR b)
forall a b. (a -> b) -> a -> b
$ Ptr (SurfaceCapabilities2KHR b) -> IO (SurfaceCapabilities2KHR b)
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @(SurfaceCapabilities2KHR _) Ptr (SurfaceCapabilities2KHR b)
pPSurfaceCapabilities
SurfaceCapabilities2KHR b
-> ContT (SurfaceCapabilities2KHR b) IO (SurfaceCapabilities2KHR b)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (SurfaceCapabilities2KHR b
-> ContT
(SurfaceCapabilities2KHR b) IO (SurfaceCapabilities2KHR b))
-> SurfaceCapabilities2KHR b
-> ContT (SurfaceCapabilities2KHR b) IO (SurfaceCapabilities2KHR b)
forall a b. (a -> b) -> a -> b
$ (SurfaceCapabilities2KHR b
pSurfaceCapabilities)
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkGetPhysicalDeviceSurfaceFormats2KHR
:: FunPtr (Ptr PhysicalDevice_T -> Ptr (SomeStruct PhysicalDeviceSurfaceInfo2KHR) -> Ptr Word32 -> Ptr SurfaceFormat2KHR -> IO Result) -> Ptr PhysicalDevice_T -> Ptr (SomeStruct PhysicalDeviceSurfaceInfo2KHR) -> Ptr Word32 -> Ptr SurfaceFormat2KHR -> IO Result
getPhysicalDeviceSurfaceFormats2KHR :: forall a io
. (Extendss PhysicalDeviceSurfaceInfo2KHR a, PokeChain a, MonadIO io)
=>
PhysicalDevice
->
(PhysicalDeviceSurfaceInfo2KHR a)
-> io (Result, ("surfaceFormats" ::: Vector SurfaceFormat2KHR))
getPhysicalDeviceSurfaceFormats2KHR :: PhysicalDevice
-> PhysicalDeviceSurfaceInfo2KHR a
-> io (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
getPhysicalDeviceSurfaceFormats2KHR physicalDevice :: PhysicalDevice
physicalDevice surfaceInfo :: PhysicalDeviceSurfaceInfo2KHR a
surfaceInfo = IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
-> io (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
-> io (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> (ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
IO
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
IO
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
-> io (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
IO
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
IO
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
-> io (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
IO
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
-> io (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
forall a b. (a -> b) -> a -> b
$ do
let vkGetPhysicalDeviceSurfaceFormats2KHRPtr :: FunPtr
(Ptr PhysicalDevice_T
-> ("pSurfaceInfo"
::: Ptr (SomeStruct PhysicalDeviceSurfaceInfo2KHR))
-> ("pSurfaceFormatCount" ::: Ptr Word32)
-> ("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR)
-> IO Result)
vkGetPhysicalDeviceSurfaceFormats2KHRPtr = InstanceCmds
-> FunPtr
(Ptr PhysicalDevice_T
-> ("pSurfaceInfo"
::: Ptr (SomeStruct PhysicalDeviceSurfaceInfo2KHR))
-> ("pSurfaceFormatCount" ::: Ptr Word32)
-> ("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR)
-> IO Result)
pVkGetPhysicalDeviceSurfaceFormats2KHR (PhysicalDevice -> InstanceCmds
instanceCmds (PhysicalDevice
physicalDevice :: PhysicalDevice))
IO ()
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ()
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR) IO ())
-> IO ()
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
(Ptr PhysicalDevice_T
-> ("pSurfaceInfo"
::: Ptr (SomeStruct PhysicalDeviceSurfaceInfo2KHR))
-> ("pSurfaceFormatCount" ::: Ptr Word32)
-> ("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR)
-> IO Result)
vkGetPhysicalDeviceSurfaceFormats2KHRPtr FunPtr
(Ptr PhysicalDevice_T
-> ("pSurfaceInfo"
::: Ptr (SomeStruct PhysicalDeviceSurfaceInfo2KHR))
-> ("pSurfaceFormatCount" ::: Ptr Word32)
-> ("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR)
-> IO Result)
-> FunPtr
(Ptr PhysicalDevice_T
-> ("pSurfaceInfo"
::: Ptr (SomeStruct PhysicalDeviceSurfaceInfo2KHR))
-> ("pSurfaceFormatCount" ::: Ptr Word32)
-> ("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR)
-> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
(Ptr PhysicalDevice_T
-> ("pSurfaceInfo"
::: Ptr (SomeStruct PhysicalDeviceSurfaceInfo2KHR))
-> ("pSurfaceFormatCount" ::: Ptr Word32)
-> ("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR)
-> 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 vkGetPhysicalDeviceSurfaceFormats2KHR is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
let vkGetPhysicalDeviceSurfaceFormats2KHR' :: Ptr PhysicalDevice_T
-> ("pSurfaceInfo"
::: Ptr (SomeStruct PhysicalDeviceSurfaceInfo2KHR))
-> ("pSurfaceFormatCount" ::: Ptr Word32)
-> ("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR)
-> IO Result
vkGetPhysicalDeviceSurfaceFormats2KHR' = FunPtr
(Ptr PhysicalDevice_T
-> ("pSurfaceInfo"
::: Ptr (SomeStruct PhysicalDeviceSurfaceInfo2KHR))
-> ("pSurfaceFormatCount" ::: Ptr Word32)
-> ("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR)
-> IO Result)
-> Ptr PhysicalDevice_T
-> ("pSurfaceInfo"
::: Ptr (SomeStruct PhysicalDeviceSurfaceInfo2KHR))
-> ("pSurfaceFormatCount" ::: Ptr Word32)
-> ("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR)
-> IO Result
mkVkGetPhysicalDeviceSurfaceFormats2KHR FunPtr
(Ptr PhysicalDevice_T
-> ("pSurfaceInfo"
::: Ptr (SomeStruct PhysicalDeviceSurfaceInfo2KHR))
-> ("pSurfaceFormatCount" ::: Ptr Word32)
-> ("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR)
-> IO Result)
vkGetPhysicalDeviceSurfaceFormats2KHRPtr
let physicalDevice' :: Ptr PhysicalDevice_T
physicalDevice' = PhysicalDevice -> Ptr PhysicalDevice_T
physicalDeviceHandle (PhysicalDevice
physicalDevice)
Ptr (PhysicalDeviceSurfaceInfo2KHR a)
pSurfaceInfo <- ((Ptr (PhysicalDeviceSurfaceInfo2KHR a)
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
IO
(Ptr (PhysicalDeviceSurfaceInfo2KHR a))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (PhysicalDeviceSurfaceInfo2KHR a)
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
IO
(Ptr (PhysicalDeviceSurfaceInfo2KHR a)))
-> ((Ptr (PhysicalDeviceSurfaceInfo2KHR a)
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
IO
(Ptr (PhysicalDeviceSurfaceInfo2KHR a))
forall a b. (a -> b) -> a -> b
$ PhysicalDeviceSurfaceInfo2KHR a
-> (Ptr (PhysicalDeviceSurfaceInfo2KHR a)
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (PhysicalDeviceSurfaceInfo2KHR a
surfaceInfo)
let x9 :: "pSurfaceInfo" ::: Ptr (SomeStruct PhysicalDeviceSurfaceInfo2KHR)
x9 = Ptr (PhysicalDeviceSurfaceInfo2KHR a)
-> "pSurfaceInfo"
::: Ptr (SomeStruct PhysicalDeviceSurfaceInfo2KHR)
forall (a :: [*] -> *) (es :: [*]).
Ptr (a es) -> Ptr (SomeStruct a)
forgetExtensions Ptr (PhysicalDeviceSurfaceInfo2KHR a)
pSurfaceInfo
"pSurfaceFormatCount" ::: Ptr Word32
pPSurfaceFormatCount <- ((("pSurfaceFormatCount" ::: Ptr Word32)
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
IO
("pSurfaceFormatCount" ::: Ptr Word32)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pSurfaceFormatCount" ::: Ptr Word32)
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
IO
("pSurfaceFormatCount" ::: Ptr Word32))
-> ((("pSurfaceFormatCount" ::: Ptr Word32)
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
IO
("pSurfaceFormatCount" ::: Ptr Word32)
forall a b. (a -> b) -> a -> b
$ IO ("pSurfaceFormatCount" ::: Ptr Word32)
-> (("pSurfaceFormatCount" ::: Ptr Word32) -> IO ())
-> (("pSurfaceFormatCount" ::: Ptr Word32)
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int -> IO ("pSurfaceFormatCount" ::: Ptr Word32)
forall a. Int -> IO (Ptr a)
callocBytes @Word32 4) ("pSurfaceFormatCount" ::: Ptr Word32) -> IO ()
forall a. Ptr a -> IO ()
free
Result
r <- IO Result
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR) IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR) IO Result)
-> IO Result
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR) IO Result
forall a b. (a -> b) -> a -> b
$ Ptr PhysicalDevice_T
-> ("pSurfaceInfo"
::: Ptr (SomeStruct PhysicalDeviceSurfaceInfo2KHR))
-> ("pSurfaceFormatCount" ::: Ptr Word32)
-> ("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR)
-> IO Result
vkGetPhysicalDeviceSurfaceFormats2KHR' Ptr PhysicalDevice_T
physicalDevice' "pSurfaceInfo" ::: Ptr (SomeStruct PhysicalDeviceSurfaceInfo2KHR)
x9 ("pSurfaceFormatCount" ::: Ptr Word32
pPSurfaceFormatCount) ("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR
forall a. Ptr a
nullPtr)
IO ()
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ()
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR) IO ())
-> IO ()
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR) 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
pSurfaceFormatCount <- IO Word32
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR) IO Word32
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Word32
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR) IO Word32)
-> IO Word32
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR) IO Word32
forall a b. (a -> b) -> a -> b
$ ("pSurfaceFormatCount" ::: Ptr Word32) -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 "pSurfaceFormatCount" ::: Ptr Word32
pPSurfaceFormatCount
"pSurfaceFormats" ::: Ptr SurfaceFormat2KHR
pPSurfaceFormats <- ((("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR)
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
IO
("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR)
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
IO
("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR))
-> ((("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR)
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
IO
("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR)
forall a b. (a -> b) -> a -> b
$ IO ("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR)
-> (("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR) -> IO ())
-> (("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR)
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int -> IO ("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR)
forall a. Int -> IO (Ptr a)
callocBytes @SurfaceFormat2KHR ((Word32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32
pSurfaceFormatCount)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* 24)) ("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR) -> IO ()
forall a. Ptr a -> IO ()
free
[()]
_ <- (Int
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR) IO ())
-> [Int]
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR) IO [()]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse (\i :: Int
i -> ((() -> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR) IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((()
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR) IO ())
-> ((()
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR) IO ()
forall a b. (a -> b) -> a -> b
$ ("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR)
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
forall a b. ToCStruct a => Ptr a -> IO b -> IO b
pokeZeroCStruct ("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR
pPSurfaceFormats ("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR)
-> Int -> "pSurfaceFormats" ::: Ptr SurfaceFormat2KHR
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
i Int -> Int -> Int
forall a. Num a => a -> a -> a
* 24) :: Ptr SurfaceFormat2KHR) (IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> ((()
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> (()
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> () -> IO (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
forall a b. (a -> b) -> a -> b
$ ())) [0..(Word32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32
pSurfaceFormatCount)) Int -> Int -> Int
forall a. Num a => a -> a -> a
- 1]
Result
r' <- IO Result
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR) IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR) IO Result)
-> IO Result
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR) IO Result
forall a b. (a -> b) -> a -> b
$ Ptr PhysicalDevice_T
-> ("pSurfaceInfo"
::: Ptr (SomeStruct PhysicalDeviceSurfaceInfo2KHR))
-> ("pSurfaceFormatCount" ::: Ptr Word32)
-> ("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR)
-> IO Result
vkGetPhysicalDeviceSurfaceFormats2KHR' Ptr PhysicalDevice_T
physicalDevice' "pSurfaceInfo" ::: Ptr (SomeStruct PhysicalDeviceSurfaceInfo2KHR)
x9 ("pSurfaceFormatCount" ::: Ptr Word32
pPSurfaceFormatCount) (("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR
pPSurfaceFormats))
IO ()
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ()
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR) IO ())
-> IO ()
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR) 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
pSurfaceFormatCount' <- IO Word32
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR) IO Word32
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Word32
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR) IO Word32)
-> IO Word32
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR) IO Word32
forall a b. (a -> b) -> a -> b
$ ("pSurfaceFormatCount" ::: Ptr Word32) -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 "pSurfaceFormatCount" ::: Ptr Word32
pPSurfaceFormatCount
"surfaceFormats" ::: Vector SurfaceFormat2KHR
pSurfaceFormats' <- IO ("surfaceFormats" ::: Vector SurfaceFormat2KHR)
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
IO
("surfaceFormats" ::: Vector SurfaceFormat2KHR)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ("surfaceFormats" ::: Vector SurfaceFormat2KHR)
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
IO
("surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> IO ("surfaceFormats" ::: Vector SurfaceFormat2KHR)
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
IO
("surfaceFormats" ::: Vector SurfaceFormat2KHR)
forall a b. (a -> b) -> a -> b
$ Int
-> (Int -> IO SurfaceFormat2KHR)
-> IO ("surfaceFormats" ::: Vector SurfaceFormat2KHR)
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
pSurfaceFormatCount')) (\i :: Int
i -> ("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR)
-> IO SurfaceFormat2KHR
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @SurfaceFormat2KHR ((("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR
pPSurfaceFormats) ("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR)
-> Int -> "pSurfaceFormats" ::: Ptr SurfaceFormat2KHR
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (24 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr SurfaceFormat2KHR)))
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
IO
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
forall (f :: * -> *) a. Applicative f => a -> f a
pure ((Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
IO
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR))
-> (Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
-> ContT
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
IO
(Result, "surfaceFormats" ::: Vector SurfaceFormat2KHR)
forall a b. (a -> b) -> a -> b
$ ((Result
r'), "surfaceFormats" ::: Vector SurfaceFormat2KHR
pSurfaceFormats')
data PhysicalDeviceSurfaceInfo2KHR (es :: [Type]) = PhysicalDeviceSurfaceInfo2KHR
{
PhysicalDeviceSurfaceInfo2KHR es -> Chain es
next :: Chain es
,
PhysicalDeviceSurfaceInfo2KHR es -> SurfaceKHR
surface :: SurfaceKHR
}
deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceSurfaceInfo2KHR (es :: [Type]))
#endif
deriving instance Show (Chain es) => Show (PhysicalDeviceSurfaceInfo2KHR es)
instance Extensible PhysicalDeviceSurfaceInfo2KHR where
extensibleType :: StructureType
extensibleType = StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR
setNext :: PhysicalDeviceSurfaceInfo2KHR ds
-> Chain es -> PhysicalDeviceSurfaceInfo2KHR es
setNext x :: PhysicalDeviceSurfaceInfo2KHR ds
x next :: Chain es
next = PhysicalDeviceSurfaceInfo2KHR ds
x{$sel:next:PhysicalDeviceSurfaceInfo2KHR :: Chain es
next = Chain es
next}
getNext :: PhysicalDeviceSurfaceInfo2KHR es -> Chain es
getNext PhysicalDeviceSurfaceInfo2KHR{..} = Chain es
next
extends :: forall e b proxy. Typeable e => proxy e -> (Extends PhysicalDeviceSurfaceInfo2KHR e => b) -> Maybe b
extends :: proxy e
-> (Extends PhysicalDeviceSurfaceInfo2KHR e => b) -> Maybe b
extends _ f :: Extends PhysicalDeviceSurfaceInfo2KHR e => b
f
| Just Refl <- (Typeable e, Typeable SurfaceFullScreenExclusiveWin32InfoEXT) =>
Maybe (e :~: SurfaceFullScreenExclusiveWin32InfoEXT)
forall k (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
eqT @e @SurfaceFullScreenExclusiveWin32InfoEXT = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends PhysicalDeviceSurfaceInfo2KHR e => b
f
| Just Refl <- (Typeable e, Typeable SurfaceFullScreenExclusiveInfoEXT) =>
Maybe (e :~: SurfaceFullScreenExclusiveInfoEXT)
forall k (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
eqT @e @SurfaceFullScreenExclusiveInfoEXT = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends PhysicalDeviceSurfaceInfo2KHR e => b
f
| Bool
otherwise = Maybe b
forall a. Maybe a
Nothing
instance (Extendss PhysicalDeviceSurfaceInfo2KHR es, PokeChain es) => ToCStruct (PhysicalDeviceSurfaceInfo2KHR es) where
withCStruct :: PhysicalDeviceSurfaceInfo2KHR es
-> (Ptr (PhysicalDeviceSurfaceInfo2KHR es) -> IO b) -> IO b
withCStruct x :: PhysicalDeviceSurfaceInfo2KHR es
x f :: Ptr (PhysicalDeviceSurfaceInfo2KHR es) -> IO b
f = Int
-> Int -> (Ptr (PhysicalDeviceSurfaceInfo2KHR es) -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 24 8 ((Ptr (PhysicalDeviceSurfaceInfo2KHR es) -> IO b) -> IO b)
-> (Ptr (PhysicalDeviceSurfaceInfo2KHR es) -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr (PhysicalDeviceSurfaceInfo2KHR es)
p -> Ptr (PhysicalDeviceSurfaceInfo2KHR es)
-> PhysicalDeviceSurfaceInfo2KHR es -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr (PhysicalDeviceSurfaceInfo2KHR es)
p PhysicalDeviceSurfaceInfo2KHR es
x (Ptr (PhysicalDeviceSurfaceInfo2KHR es) -> IO b
f Ptr (PhysicalDeviceSurfaceInfo2KHR es)
p)
pokeCStruct :: Ptr (PhysicalDeviceSurfaceInfo2KHR es)
-> PhysicalDeviceSurfaceInfo2KHR es -> IO b -> IO b
pokeCStruct p :: Ptr (PhysicalDeviceSurfaceInfo2KHR es)
p PhysicalDeviceSurfaceInfo2KHR{..} 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 (PhysicalDeviceSurfaceInfo2KHR es)
p Ptr (PhysicalDeviceSurfaceInfo2KHR es) -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR)
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 (PhysicalDeviceSurfaceInfo2KHR es)
p Ptr (PhysicalDeviceSurfaceInfo2KHR es) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) Ptr ()
pNext''
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 SurfaceKHR -> SurfaceKHR -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (PhysicalDeviceSurfaceInfo2KHR es)
p Ptr (PhysicalDeviceSurfaceInfo2KHR es) -> Int -> Ptr SurfaceKHR
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr SurfaceKHR)) (SurfaceKHR
surface)
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 = 24
cStructAlignment :: Int
cStructAlignment = 8
pokeZeroCStruct :: Ptr (PhysicalDeviceSurfaceInfo2KHR es) -> IO b -> IO b
pokeZeroCStruct p :: Ptr (PhysicalDeviceSurfaceInfo2KHR es)
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 (PhysicalDeviceSurfaceInfo2KHR es)
p Ptr (PhysicalDeviceSurfaceInfo2KHR es) -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR)
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 (PhysicalDeviceSurfaceInfo2KHR es)
p Ptr (PhysicalDeviceSurfaceInfo2KHR es) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) Ptr ()
pNext'
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 SurfaceKHR -> SurfaceKHR -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (PhysicalDeviceSurfaceInfo2KHR es)
p Ptr (PhysicalDeviceSurfaceInfo2KHR es) -> Int -> Ptr SurfaceKHR
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr SurfaceKHR)) (SurfaceKHR
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 (Extendss PhysicalDeviceSurfaceInfo2KHR es, PeekChain es) => FromCStruct (PhysicalDeviceSurfaceInfo2KHR es) where
peekCStruct :: Ptr (PhysicalDeviceSurfaceInfo2KHR es)
-> IO (PhysicalDeviceSurfaceInfo2KHR es)
peekCStruct p :: Ptr (PhysicalDeviceSurfaceInfo2KHR es)
p = do
Ptr ()
pNext <- Ptr (Ptr ()) -> IO (Ptr ())
forall a. Storable a => Ptr a -> IO a
peek @(Ptr ()) ((Ptr (PhysicalDeviceSurfaceInfo2KHR es)
p Ptr (PhysicalDeviceSurfaceInfo2KHR es) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 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)
SurfaceKHR
surface <- Ptr SurfaceKHR -> IO SurfaceKHR
forall a. Storable a => Ptr a -> IO a
peek @SurfaceKHR ((Ptr (PhysicalDeviceSurfaceInfo2KHR es)
p Ptr (PhysicalDeviceSurfaceInfo2KHR es) -> Int -> Ptr SurfaceKHR
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr SurfaceKHR))
PhysicalDeviceSurfaceInfo2KHR es
-> IO (PhysicalDeviceSurfaceInfo2KHR es)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PhysicalDeviceSurfaceInfo2KHR es
-> IO (PhysicalDeviceSurfaceInfo2KHR es))
-> PhysicalDeviceSurfaceInfo2KHR es
-> IO (PhysicalDeviceSurfaceInfo2KHR es)
forall a b. (a -> b) -> a -> b
$ Chain es -> SurfaceKHR -> PhysicalDeviceSurfaceInfo2KHR es
forall (es :: [*]).
Chain es -> SurfaceKHR -> PhysicalDeviceSurfaceInfo2KHR es
PhysicalDeviceSurfaceInfo2KHR
Chain es
next SurfaceKHR
surface
instance es ~ '[] => Zero (PhysicalDeviceSurfaceInfo2KHR es) where
zero :: PhysicalDeviceSurfaceInfo2KHR es
zero = Chain es -> SurfaceKHR -> PhysicalDeviceSurfaceInfo2KHR es
forall (es :: [*]).
Chain es -> SurfaceKHR -> PhysicalDeviceSurfaceInfo2KHR es
PhysicalDeviceSurfaceInfo2KHR
()
SurfaceKHR
forall a. Zero a => a
zero
data SurfaceCapabilities2KHR (es :: [Type]) = SurfaceCapabilities2KHR
{
SurfaceCapabilities2KHR es -> Chain es
next :: Chain es
,
SurfaceCapabilities2KHR es -> SurfaceCapabilitiesKHR
surfaceCapabilities :: SurfaceCapabilitiesKHR
}
deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (SurfaceCapabilities2KHR (es :: [Type]))
#endif
deriving instance Show (Chain es) => Show (SurfaceCapabilities2KHR es)
instance Extensible SurfaceCapabilities2KHR where
extensibleType :: StructureType
extensibleType = StructureType
STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR
setNext :: SurfaceCapabilities2KHR ds
-> Chain es -> SurfaceCapabilities2KHR es
setNext x :: SurfaceCapabilities2KHR ds
x next :: Chain es
next = SurfaceCapabilities2KHR ds
x{$sel:next:SurfaceCapabilities2KHR :: Chain es
next = Chain es
next}
getNext :: SurfaceCapabilities2KHR es -> Chain es
getNext SurfaceCapabilities2KHR{..} = Chain es
next
extends :: forall e b proxy. Typeable e => proxy e -> (Extends SurfaceCapabilities2KHR e => b) -> Maybe b
extends :: proxy e -> (Extends SurfaceCapabilities2KHR e => b) -> Maybe b
extends _ f :: Extends SurfaceCapabilities2KHR e => b
f
| Just Refl <- (Typeable e, Typeable SurfaceCapabilitiesFullScreenExclusiveEXT) =>
Maybe (e :~: SurfaceCapabilitiesFullScreenExclusiveEXT)
forall k (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
eqT @e @SurfaceCapabilitiesFullScreenExclusiveEXT = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends SurfaceCapabilities2KHR e => b
f
| Just Refl <- (Typeable e, Typeable SurfaceProtectedCapabilitiesKHR) =>
Maybe (e :~: SurfaceProtectedCapabilitiesKHR)
forall k (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
eqT @e @SurfaceProtectedCapabilitiesKHR = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends SurfaceCapabilities2KHR e => b
f
| Just Refl <- (Typeable e, Typeable SharedPresentSurfaceCapabilitiesKHR) =>
Maybe (e :~: SharedPresentSurfaceCapabilitiesKHR)
forall k (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
eqT @e @SharedPresentSurfaceCapabilitiesKHR = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends SurfaceCapabilities2KHR e => b
f
| Just Refl <- (Typeable e, Typeable DisplayNativeHdrSurfaceCapabilitiesAMD) =>
Maybe (e :~: DisplayNativeHdrSurfaceCapabilitiesAMD)
forall k (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
eqT @e @DisplayNativeHdrSurfaceCapabilitiesAMD = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends SurfaceCapabilities2KHR e => b
f
| Bool
otherwise = Maybe b
forall a. Maybe a
Nothing
instance (Extendss SurfaceCapabilities2KHR es, PokeChain es) => ToCStruct (SurfaceCapabilities2KHR es) where
withCStruct :: SurfaceCapabilities2KHR es
-> (Ptr (SurfaceCapabilities2KHR es) -> IO b) -> IO b
withCStruct x :: SurfaceCapabilities2KHR es
x f :: Ptr (SurfaceCapabilities2KHR es) -> IO b
f = Int -> Int -> (Ptr (SurfaceCapabilities2KHR es) -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 72 8 ((Ptr (SurfaceCapabilities2KHR es) -> IO b) -> IO b)
-> (Ptr (SurfaceCapabilities2KHR es) -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr (SurfaceCapabilities2KHR es)
p -> Ptr (SurfaceCapabilities2KHR es)
-> SurfaceCapabilities2KHR es -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr (SurfaceCapabilities2KHR es)
p SurfaceCapabilities2KHR es
x (Ptr (SurfaceCapabilities2KHR es) -> IO b
f Ptr (SurfaceCapabilities2KHR es)
p)
pokeCStruct :: Ptr (SurfaceCapabilities2KHR es)
-> SurfaceCapabilities2KHR es -> IO b -> IO b
pokeCStruct p :: Ptr (SurfaceCapabilities2KHR es)
p SurfaceCapabilities2KHR{..} 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 (SurfaceCapabilities2KHR es)
p Ptr (SurfaceCapabilities2KHR es) -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR)
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 (SurfaceCapabilities2KHR es)
p Ptr (SurfaceCapabilities2KHR es) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) Ptr ()
pNext''
((() -> 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 SurfaceCapabilitiesKHR
-> SurfaceCapabilitiesKHR -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct ((Ptr (SurfaceCapabilities2KHR es)
p Ptr (SurfaceCapabilities2KHR es)
-> Int -> Ptr SurfaceCapabilitiesKHR
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr SurfaceCapabilitiesKHR)) (SurfaceCapabilitiesKHR
surfaceCapabilities) (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 -> 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 = 72
cStructAlignment :: Int
cStructAlignment = 8
pokeZeroCStruct :: Ptr (SurfaceCapabilities2KHR es) -> IO b -> IO b
pokeZeroCStruct p :: Ptr (SurfaceCapabilities2KHR es)
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 (SurfaceCapabilities2KHR es)
p Ptr (SurfaceCapabilities2KHR es) -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR)
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 (SurfaceCapabilities2KHR es)
p Ptr (SurfaceCapabilities2KHR es) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) Ptr ()
pNext'
((() -> 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 SurfaceCapabilitiesKHR
-> SurfaceCapabilitiesKHR -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct ((Ptr (SurfaceCapabilities2KHR es)
p Ptr (SurfaceCapabilities2KHR es)
-> Int -> Ptr SurfaceCapabilitiesKHR
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr SurfaceCapabilitiesKHR)) (SurfaceCapabilitiesKHR
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 -> 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 SurfaceCapabilities2KHR es, PeekChain es) => FromCStruct (SurfaceCapabilities2KHR es) where
peekCStruct :: Ptr (SurfaceCapabilities2KHR es) -> IO (SurfaceCapabilities2KHR es)
peekCStruct p :: Ptr (SurfaceCapabilities2KHR es)
p = do
Ptr ()
pNext <- Ptr (Ptr ()) -> IO (Ptr ())
forall a. Storable a => Ptr a -> IO a
peek @(Ptr ()) ((Ptr (SurfaceCapabilities2KHR es)
p Ptr (SurfaceCapabilities2KHR es) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 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)
SurfaceCapabilitiesKHR
surfaceCapabilities <- Ptr SurfaceCapabilitiesKHR -> IO SurfaceCapabilitiesKHR
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @SurfaceCapabilitiesKHR ((Ptr (SurfaceCapabilities2KHR es)
p Ptr (SurfaceCapabilities2KHR es)
-> Int -> Ptr SurfaceCapabilitiesKHR
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr SurfaceCapabilitiesKHR))
SurfaceCapabilities2KHR es -> IO (SurfaceCapabilities2KHR es)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (SurfaceCapabilities2KHR es -> IO (SurfaceCapabilities2KHR es))
-> SurfaceCapabilities2KHR es -> IO (SurfaceCapabilities2KHR es)
forall a b. (a -> b) -> a -> b
$ Chain es -> SurfaceCapabilitiesKHR -> SurfaceCapabilities2KHR es
forall (es :: [*]).
Chain es -> SurfaceCapabilitiesKHR -> SurfaceCapabilities2KHR es
SurfaceCapabilities2KHR
Chain es
next SurfaceCapabilitiesKHR
surfaceCapabilities
instance es ~ '[] => Zero (SurfaceCapabilities2KHR es) where
zero :: SurfaceCapabilities2KHR es
zero = Chain es -> SurfaceCapabilitiesKHR -> SurfaceCapabilities2KHR es
forall (es :: [*]).
Chain es -> SurfaceCapabilitiesKHR -> SurfaceCapabilities2KHR es
SurfaceCapabilities2KHR
()
SurfaceCapabilitiesKHR
forall a. Zero a => a
zero
data SurfaceFormat2KHR = SurfaceFormat2KHR
{
SurfaceFormat2KHR -> SurfaceFormatKHR
surfaceFormat :: SurfaceFormatKHR }
deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (SurfaceFormat2KHR)
#endif
deriving instance Show SurfaceFormat2KHR
instance ToCStruct SurfaceFormat2KHR where
withCStruct :: SurfaceFormat2KHR
-> (("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR) -> IO b) -> IO b
withCStruct x :: SurfaceFormat2KHR
x f :: ("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR) -> IO b
f = Int
-> Int
-> (("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR) -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 24 8 ((("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR) -> IO b) -> IO b)
-> (("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR) -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: "pSurfaceFormats" ::: Ptr SurfaceFormat2KHR
p -> ("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR)
-> SurfaceFormat2KHR -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pSurfaceFormats" ::: Ptr SurfaceFormat2KHR
p SurfaceFormat2KHR
x (("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR) -> IO b
f "pSurfaceFormats" ::: Ptr SurfaceFormat2KHR
p)
pokeCStruct :: ("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR)
-> SurfaceFormat2KHR -> IO b -> IO b
pokeCStruct p :: "pSurfaceFormats" ::: Ptr SurfaceFormat2KHR
p SurfaceFormat2KHR{..} 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 (("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR
p ("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_SURFACE_FORMAT_2_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 (("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR
p ("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR)
-> 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 SurfaceFormatKHR -> SurfaceFormatKHR -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct (("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR
p ("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR)
-> Int -> Ptr SurfaceFormatKHR
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr SurfaceFormatKHR)) (SurfaceFormatKHR
surfaceFormat) (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 -> 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 = 24
cStructAlignment :: Int
cStructAlignment = 8
pokeZeroCStruct :: ("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR) -> IO b -> IO b
pokeZeroCStruct p :: "pSurfaceFormats" ::: Ptr SurfaceFormat2KHR
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 (("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR
p ("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_SURFACE_FORMAT_2_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 (("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR
p ("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR)
-> 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 SurfaceFormatKHR -> SurfaceFormatKHR -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct (("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR
p ("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR)
-> Int -> Ptr SurfaceFormatKHR
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr SurfaceFormatKHR)) (SurfaceFormatKHR
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 -> 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 SurfaceFormat2KHR where
peekCStruct :: ("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR)
-> IO SurfaceFormat2KHR
peekCStruct p :: "pSurfaceFormats" ::: Ptr SurfaceFormat2KHR
p = do
SurfaceFormatKHR
surfaceFormat <- Ptr SurfaceFormatKHR -> IO SurfaceFormatKHR
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @SurfaceFormatKHR (("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR
p ("pSurfaceFormats" ::: Ptr SurfaceFormat2KHR)
-> Int -> Ptr SurfaceFormatKHR
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr SurfaceFormatKHR))
SurfaceFormat2KHR -> IO SurfaceFormat2KHR
forall (f :: * -> *) a. Applicative f => a -> f a
pure (SurfaceFormat2KHR -> IO SurfaceFormat2KHR)
-> SurfaceFormat2KHR -> IO SurfaceFormat2KHR
forall a b. (a -> b) -> a -> b
$ SurfaceFormatKHR -> SurfaceFormat2KHR
SurfaceFormat2KHR
SurfaceFormatKHR
surfaceFormat
instance Zero SurfaceFormat2KHR where
zero :: SurfaceFormat2KHR
zero = SurfaceFormatKHR -> SurfaceFormat2KHR
SurfaceFormat2KHR
SurfaceFormatKHR
forall a. Zero a => a
zero
type KHR_GET_SURFACE_CAPABILITIES_2_SPEC_VERSION = 1
pattern KHR_GET_SURFACE_CAPABILITIES_2_SPEC_VERSION :: forall a . Integral a => a
pattern $bKHR_GET_SURFACE_CAPABILITIES_2_SPEC_VERSION :: a
$mKHR_GET_SURFACE_CAPABILITIES_2_SPEC_VERSION :: forall r a. Integral a => a -> (Void# -> r) -> (Void# -> r) -> r
KHR_GET_SURFACE_CAPABILITIES_2_SPEC_VERSION = 1
type KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME = "VK_KHR_get_surface_capabilities2"
pattern KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bKHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME :: a
$mKHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME :: forall r a.
(Eq a, IsString a) =>
a -> (Void# -> r) -> (Void# -> r) -> r
KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME = "VK_KHR_get_surface_capabilities2"