{-# language CPP #-}
-- | = Name
--
-- VK_MVK_ios_surface - instance extension
--
-- == VK_MVK_ios_surface
--
-- [__Name String__]
--     @VK_MVK_ios_surface@
--
-- [__Extension Type__]
--     Instance extension
--
-- [__Registered Extension Number__]
--     123
--
-- [__Revision__]
--     3
--
-- [__Ratification Status__]
--     Not ratified
--
-- [__Extension and Version Dependencies__]
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_surface VK_KHR_surface>
--
-- [__Deprecation State__]
--
--     -   /Deprecated/ by @VK_EXT_metal_surface@ extension
--
-- [__Contact__]
--
--     -   Bill Hollings
--         <https://github.com/KhronosGroup/Vulkan-Docs/issues/new?body=[VK_MVK_ios_surface] @billhollings%0A*Here describe the issue or question you have about the VK_MVK_ios_surface extension* >
--
-- == Other Extension Metadata
--
-- [__Last Modified Date__]
--     2020-07-31
--
-- [__IP Status__]
--     No known IP claims.
--
-- [__Contributors__]
--
--     -   Bill Hollings, The Brenwill Workshop Ltd.
--
-- == Description
--
-- The @VK_MVK_ios_surface@ extension is an instance extension. It provides
-- a mechanism to create a 'Vulkan.Extensions.Handles.SurfaceKHR' object
-- (defined by the @VK_KHR_surface@ extension) based on a @UIView@, the
-- native surface type of iOS, which is underpinned by a
-- 'Vulkan.Extensions.VK_EXT_metal_surface.CAMetalLayer', to support
-- rendering to the surface using Apple’s Metal framework.
--
-- == Deprecation by @VK_EXT_metal_surface@
--
-- The @VK_MVK_ios_surface@ extension is considered deprecated and has been
-- superseded by the @VK_EXT_metal_surface@ extension.
--
-- == New Commands
--
-- -   'createIOSSurfaceMVK'
--
-- == New Structures
--
-- -   'IOSSurfaceCreateInfoMVK'
--
-- == New Bitmasks
--
-- -   'IOSSurfaceCreateFlagsMVK'
--
-- == New Enum Constants
--
-- -   'MVK_IOS_SURFACE_EXTENSION_NAME'
--
-- -   'MVK_IOS_SURFACE_SPEC_VERSION'
--
-- -   Extending 'Vulkan.Core10.Enums.StructureType.StructureType':
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK'
--
-- == Version History
--
-- -   Revision 1, 2017-02-15 (Bill Hollings)
--
--     -   Initial draft.
--
-- -   Revision 2, 2017-02-24 (Bill Hollings)
--
--     -   Minor syntax fix to emphasize firm requirement for @UIView@ to
--         be backed by a
--         'Vulkan.Extensions.VK_EXT_metal_surface.CAMetalLayer'.
--
-- -   Revision 3, 2020-07-31 (Bill Hollings)
--
--     -   Update documentation on requirements for @UIView@.
--
--     -   Mark as deprecated by @VK_EXT_metal_surface@.
--
-- == See Also
--
-- 'IOSSurfaceCreateFlagsMVK', 'IOSSurfaceCreateInfoMVK',
-- 'createIOSSurfaceMVK'
--
-- == Document Notes
--
-- For more information, see the
-- <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VK_MVK_ios_surface Vulkan Specification>
--
-- This page is a generated document. Fixes and changes should be made to
-- the generator scripts, not directly.
module Vulkan.Extensions.VK_MVK_ios_surface  ( createIOSSurfaceMVK
                                             , IOSSurfaceCreateInfoMVK(..)
                                             , IOSSurfaceCreateFlagsMVK(..)
                                             , MVK_IOS_SURFACE_SPEC_VERSION
                                             , pattern MVK_IOS_SURFACE_SPEC_VERSION
                                             , MVK_IOS_SURFACE_EXTENSION_NAME
                                             , pattern MVK_IOS_SURFACE_EXTENSION_NAME
                                             , SurfaceKHR(..)
                                             ) where

import Data.Bits (Bits)
import Data.Bits (FiniteBits)
import Vulkan.Internal.Utils (enumReadPrec)
import Vulkan.Internal.Utils (enumShowsPrec)
import Vulkan.Internal.Utils (traceAroundEvent)
import Control.Exception.Base (bracket)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Foreign.Marshal.Alloc (allocaBytes)
import Foreign.Marshal.Alloc (callocBytes)
import Foreign.Marshal.Alloc (free)
import GHC.Base (when)
import GHC.IO (throwIO)
import GHC.Ptr (nullFunPtr)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import GHC.Show (showString)
import Numeric (showHex)
import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Cont (evalContT)
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Zero (Zero)
import Vulkan.Zero (Zero(..))
import Control.Monad.IO.Class (MonadIO)
import Data.String (IsString)
import Data.Typeable (Typeable)
import Foreign.Storable (Storable)
import Foreign.Storable (Storable(peek))
import Foreign.Storable (Storable(poke))
import qualified Foreign.Storable (Storable(..))
import GHC.Generics (Generic)
import GHC.IO.Exception (IOErrorType(..))
import GHC.IO.Exception (IOException(..))
import Foreign.Ptr (FunPtr)
import Foreign.Ptr (Ptr)
import GHC.Read (Read(readPrec))
import GHC.Show (Show(showsPrec))
import Data.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Vulkan.NamedType ((:::))
import Vulkan.Core10.AllocationCallbacks (AllocationCallbacks)
import Vulkan.Core10.FundamentalTypes (Flags)
import Vulkan.Core10.Handles (Instance)
import Vulkan.Core10.Handles (Instance(..))
import Vulkan.Core10.Handles (Instance(Instance))
import Vulkan.Dynamic (InstanceCmds(pVkCreateIOSSurfaceMVK))
import Vulkan.Core10.Handles (Instance_T)
import Vulkan.Core10.Enums.Result (Result)
import Vulkan.Core10.Enums.Result (Result(..))
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Extensions.Handles (SurfaceKHR)
import Vulkan.Extensions.Handles (SurfaceKHR(..))
import Vulkan.Exception (VulkanException(..))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK))
import Vulkan.Core10.Enums.Result (Result(SUCCESS))
import Vulkan.Extensions.Handles (SurfaceKHR(..))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkCreateIOSSurfaceMVK
  :: FunPtr (Ptr Instance_T -> Ptr IOSSurfaceCreateInfoMVK -> Ptr AllocationCallbacks -> Ptr SurfaceKHR -> IO Result) -> Ptr Instance_T -> Ptr IOSSurfaceCreateInfoMVK -> Ptr AllocationCallbacks -> Ptr SurfaceKHR -> IO Result

-- | vkCreateIOSSurfaceMVK - Create a VkSurfaceKHR object for an iOS UIView
--
-- = Parameters
--
-- Note
--
-- The 'createIOSSurfaceMVK' function is considered deprecated and has been
-- superseded by
-- 'Vulkan.Extensions.VK_EXT_metal_surface.createMetalSurfaceEXT' from the
-- @VK_EXT_metal_surface@ extension.
--
-- = Description
--
-- -   @instance@ is the instance with which to associate the surface.
--
-- -   @pCreateInfo@ is a pointer to a 'IOSSurfaceCreateInfoMVK' structure
--     containing parameters affecting the creation of the surface object.
--
-- -   @pAllocator@ is the allocator used for host memory allocated for the
--     surface object when there is no more specific allocator available
--     (see
--     <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#memory-allocation Memory Allocation>).
--
-- -   @pSurface@ is a pointer to a 'Vulkan.Extensions.Handles.SurfaceKHR'
--     handle in which the created surface object is returned.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-vkCreateIOSSurfaceMVK-instance-parameter# @instance@ /must/ be
--     a valid 'Vulkan.Core10.Handles.Instance' handle
--
-- -   #VUID-vkCreateIOSSurfaceMVK-pCreateInfo-parameter# @pCreateInfo@
--     /must/ be a valid pointer to a valid 'IOSSurfaceCreateInfoMVK'
--     structure
--
-- -   #VUID-vkCreateIOSSurfaceMVK-pAllocator-parameter# If @pAllocator@ is
--     not @NULL@, @pAllocator@ /must/ be a valid pointer to a valid
--     'Vulkan.Core10.AllocationCallbacks.AllocationCallbacks' structure
--
-- -   #VUID-vkCreateIOSSurfaceMVK-pSurface-parameter# @pSurface@ /must/ be
--     a valid pointer to a 'Vulkan.Extensions.Handles.SurfaceKHR' handle
--
-- == Return Codes
--
-- [<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#fundamentals-successcodes Success>]
--
--     -   'Vulkan.Core10.Enums.Result.SUCCESS'
--
-- [<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#fundamentals-errorcodes Failure>]
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_OUT_OF_HOST_MEMORY'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_OUT_OF_DEVICE_MEMORY'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_NATIVE_WINDOW_IN_USE_KHR'
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_MVK_ios_surface VK_MVK_ios_surface>,
-- 'Vulkan.Core10.AllocationCallbacks.AllocationCallbacks',
-- 'IOSSurfaceCreateInfoMVK', 'Vulkan.Core10.Handles.Instance',
-- 'Vulkan.Extensions.Handles.SurfaceKHR'
createIOSSurfaceMVK :: forall io
                     . (MonadIO io)
                    => -- No documentation found for Nested "vkCreateIOSSurfaceMVK" "instance"
                       Instance
                    -> -- No documentation found for Nested "vkCreateIOSSurfaceMVK" "pCreateInfo"
                       IOSSurfaceCreateInfoMVK
                    -> -- No documentation found for Nested "vkCreateIOSSurfaceMVK" "pAllocator"
                       ("allocator" ::: Maybe AllocationCallbacks)
                    -> io (SurfaceKHR)
createIOSSurfaceMVK :: forall (io :: * -> *).
MonadIO io =>
Instance
-> IOSSurfaceCreateInfoMVK
-> ("allocator" ::: Maybe AllocationCallbacks)
-> io SurfaceKHR
createIOSSurfaceMVK Instance
instance' IOSSurfaceCreateInfoMVK
createInfo "allocator" ::: Maybe AllocationCallbacks
allocator = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT forall a b. (a -> b) -> a -> b
$ do
  let vkCreateIOSSurfaceMVKPtr :: FunPtr
  (Ptr Instance_T
   -> ("pCreateInfo" ::: Ptr IOSSurfaceCreateInfoMVK)
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> ("pSurface" ::: Ptr SurfaceKHR)
   -> IO Result)
vkCreateIOSSurfaceMVKPtr = InstanceCmds
-> FunPtr
     (Ptr Instance_T
      -> ("pCreateInfo" ::: Ptr IOSSurfaceCreateInfoMVK)
      -> ("pAllocator" ::: Ptr AllocationCallbacks)
      -> ("pSurface" ::: Ptr SurfaceKHR)
      -> IO Result)
pVkCreateIOSSurfaceMVK (case Instance
instance' of Instance{InstanceCmds
$sel:instanceCmds:Instance :: Instance -> InstanceCmds
instanceCmds :: InstanceCmds
instanceCmds} -> InstanceCmds
instanceCmds)
  forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr Instance_T
   -> ("pCreateInfo" ::: Ptr IOSSurfaceCreateInfoMVK)
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> ("pSurface" ::: Ptr SurfaceKHR)
   -> IO Result)
vkCreateIOSSurfaceMVKPtr forall a. Eq a => a -> a -> Bool
/= forall a. FunPtr a
nullFunPtr) forall a b. (a -> b) -> a -> b
$
    forall e a. Exception e => e -> IO a
throwIO forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"The function pointer for vkCreateIOSSurfaceMVK is null" forall a. Maybe a
Nothing forall a. Maybe a
Nothing
  let vkCreateIOSSurfaceMVK' :: Ptr Instance_T
-> ("pCreateInfo" ::: Ptr IOSSurfaceCreateInfoMVK)
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSurface" ::: Ptr SurfaceKHR)
-> IO Result
vkCreateIOSSurfaceMVK' = FunPtr
  (Ptr Instance_T
   -> ("pCreateInfo" ::: Ptr IOSSurfaceCreateInfoMVK)
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> ("pSurface" ::: Ptr SurfaceKHR)
   -> IO Result)
-> Ptr Instance_T
-> ("pCreateInfo" ::: Ptr IOSSurfaceCreateInfoMVK)
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSurface" ::: Ptr SurfaceKHR)
-> IO Result
mkVkCreateIOSSurfaceMVK FunPtr
  (Ptr Instance_T
   -> ("pCreateInfo" ::: Ptr IOSSurfaceCreateInfoMVK)
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> ("pSurface" ::: Ptr SurfaceKHR)
   -> IO Result)
vkCreateIOSSurfaceMVKPtr
  "pCreateInfo" ::: Ptr IOSSurfaceCreateInfoMVK
pCreateInfo <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT forall a b. (a -> b) -> a -> b
$ forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (IOSSurfaceCreateInfoMVK
createInfo)
  "pAllocator" ::: Ptr AllocationCallbacks
pAllocator <- case ("allocator" ::: Maybe AllocationCallbacks
allocator) of
    "allocator" ::: Maybe AllocationCallbacks
Nothing -> forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a. Ptr a
nullPtr
    Just AllocationCallbacks
j -> forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT forall a b. (a -> b) -> a -> b
$ forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (AllocationCallbacks
j)
  "pSurface" ::: Ptr SurfaceKHR
pPSurface <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT forall a b. (a -> b) -> a -> b
$ forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (forall a. Int -> IO (Ptr a)
callocBytes @SurfaceKHR Int
8) forall a. Ptr a -> IO ()
free
  Result
r <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. String -> IO a -> IO a
traceAroundEvent String
"vkCreateIOSSurfaceMVK" (Ptr Instance_T
-> ("pCreateInfo" ::: Ptr IOSSurfaceCreateInfoMVK)
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSurface" ::: Ptr SurfaceKHR)
-> IO Result
vkCreateIOSSurfaceMVK'
                                                          (Instance -> Ptr Instance_T
instanceHandle (Instance
instance'))
                                                          "pCreateInfo" ::: Ptr IOSSurfaceCreateInfoMVK
pCreateInfo
                                                          "pAllocator" ::: Ptr AllocationCallbacks
pAllocator
                                                          ("pSurface" ::: Ptr SurfaceKHR
pPSurface))
  forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Result
r forall a. Ord a => a -> a -> Bool
< Result
SUCCESS) (forall e a. Exception e => e -> IO a
throwIO (Result -> VulkanException
VulkanException Result
r))
  SurfaceKHR
pSurface <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> IO a
peek @SurfaceKHR "pSurface" ::: Ptr SurfaceKHR
pPSurface
  forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ (SurfaceKHR
pSurface)


-- | VkIOSSurfaceCreateInfoMVK - Structure specifying parameters of a newly
-- created iOS surface object
--
-- == Valid Usage
--
-- -   #VUID-VkIOSSurfaceCreateInfoMVK-pView-04143# If @pView@ is a
--     'Vulkan.Extensions.VK_EXT_metal_surface.CAMetalLayer' object, it
--     /must/ be a valid
--     'Vulkan.Extensions.VK_EXT_metal_surface.CAMetalLayer'
--
-- -   #VUID-VkIOSSurfaceCreateInfoMVK-pView-01316# If @pView@ is a
--     @UIView@ object, it /must/ be a valid @UIView@, /must/ be backed by
--     a @CALayer@ object of type
--     'Vulkan.Extensions.VK_EXT_metal_surface.CAMetalLayer', and
--     'createIOSSurfaceMVK' /must/ be called on the main thread
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkIOSSurfaceCreateInfoMVK-sType-sType# @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK'
--
-- -   #VUID-VkIOSSurfaceCreateInfoMVK-pNext-pNext# @pNext@ /must/ be
--     @NULL@
--
-- -   #VUID-VkIOSSurfaceCreateInfoMVK-flags-zerobitmask# @flags@ /must/ be
--     @0@
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_MVK_ios_surface VK_MVK_ios_surface>,
-- 'IOSSurfaceCreateFlagsMVK',
-- 'Vulkan.Core10.Enums.StructureType.StructureType', 'createIOSSurfaceMVK'
data IOSSurfaceCreateInfoMVK = IOSSurfaceCreateInfoMVK
  { -- | @flags@ is reserved for future use.
    IOSSurfaceCreateInfoMVK -> IOSSurfaceCreateFlagsMVK
flags :: IOSSurfaceCreateFlagsMVK
  , -- | @pView@ is a reference to either a
    -- 'Vulkan.Extensions.VK_EXT_metal_surface.CAMetalLayer' object or a
    -- @UIView@ object.
    IOSSurfaceCreateInfoMVK -> Ptr ()
view :: Ptr ()
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (IOSSurfaceCreateInfoMVK)
#endif
deriving instance Show IOSSurfaceCreateInfoMVK

instance ToCStruct IOSSurfaceCreateInfoMVK where
  withCStruct :: forall b.
IOSSurfaceCreateInfoMVK
-> (("pCreateInfo" ::: Ptr IOSSurfaceCreateInfoMVK) -> IO b)
-> IO b
withCStruct IOSSurfaceCreateInfoMVK
x ("pCreateInfo" ::: Ptr IOSSurfaceCreateInfoMVK) -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
32 forall a b. (a -> b) -> a -> b
$ \"pCreateInfo" ::: Ptr IOSSurfaceCreateInfoMVK
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pCreateInfo" ::: Ptr IOSSurfaceCreateInfoMVK
p IOSSurfaceCreateInfoMVK
x (("pCreateInfo" ::: Ptr IOSSurfaceCreateInfoMVK) -> IO b
f "pCreateInfo" ::: Ptr IOSSurfaceCreateInfoMVK
p)
  pokeCStruct :: forall b.
("pCreateInfo" ::: Ptr IOSSurfaceCreateInfoMVK)
-> IOSSurfaceCreateInfoMVK -> IO b -> IO b
pokeCStruct "pCreateInfo" ::: Ptr IOSSurfaceCreateInfoMVK
p IOSSurfaceCreateInfoMVK{Ptr ()
IOSSurfaceCreateFlagsMVK
view :: Ptr ()
flags :: IOSSurfaceCreateFlagsMVK
$sel:view:IOSSurfaceCreateInfoMVK :: IOSSurfaceCreateInfoMVK -> Ptr ()
$sel:flags:IOSSurfaceCreateInfoMVK :: IOSSurfaceCreateInfoMVK -> IOSSurfaceCreateFlagsMVK
..} IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr IOSSurfaceCreateInfoMVK
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr IOSSurfaceCreateInfoMVK
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr IOSSurfaceCreateInfoMVK
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr IOSSurfaceCreateFlagsMVK)) (IOSSurfaceCreateFlagsMVK
flags)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr IOSSurfaceCreateInfoMVK
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr ()))) (Ptr ()
view)
    IO b
f
  cStructSize :: Int
cStructSize = Int
32
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b.
("pCreateInfo" ::: Ptr IOSSurfaceCreateInfoMVK) -> IO b -> IO b
pokeZeroCStruct "pCreateInfo" ::: Ptr IOSSurfaceCreateInfoMVK
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr IOSSurfaceCreateInfoMVK
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr IOSSurfaceCreateInfoMVK
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr IOSSurfaceCreateInfoMVK
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr ()))) (forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct IOSSurfaceCreateInfoMVK where
  peekCStruct :: ("pCreateInfo" ::: Ptr IOSSurfaceCreateInfoMVK)
-> IO IOSSurfaceCreateInfoMVK
peekCStruct "pCreateInfo" ::: Ptr IOSSurfaceCreateInfoMVK
p = do
    IOSSurfaceCreateFlagsMVK
flags <- forall a. Storable a => Ptr a -> IO a
peek @IOSSurfaceCreateFlagsMVK (("pCreateInfo" ::: Ptr IOSSurfaceCreateInfoMVK
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr IOSSurfaceCreateFlagsMVK))
    Ptr ()
pView <- forall a. Storable a => Ptr a -> IO a
peek @(Ptr ()) (("pCreateInfo" ::: Ptr IOSSurfaceCreateInfoMVK
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr ())))
    forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ IOSSurfaceCreateFlagsMVK -> Ptr () -> IOSSurfaceCreateInfoMVK
IOSSurfaceCreateInfoMVK
             IOSSurfaceCreateFlagsMVK
flags Ptr ()
pView

instance Storable IOSSurfaceCreateInfoMVK where
  sizeOf :: IOSSurfaceCreateInfoMVK -> Int
sizeOf ~IOSSurfaceCreateInfoMVK
_ = Int
32
  alignment :: IOSSurfaceCreateInfoMVK -> Int
alignment ~IOSSurfaceCreateInfoMVK
_ = Int
8
  peek :: ("pCreateInfo" ::: Ptr IOSSurfaceCreateInfoMVK)
-> IO IOSSurfaceCreateInfoMVK
peek = forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
  poke :: ("pCreateInfo" ::: Ptr IOSSurfaceCreateInfoMVK)
-> IOSSurfaceCreateInfoMVK -> IO ()
poke "pCreateInfo" ::: Ptr IOSSurfaceCreateInfoMVK
ptr IOSSurfaceCreateInfoMVK
poked = forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pCreateInfo" ::: Ptr IOSSurfaceCreateInfoMVK
ptr IOSSurfaceCreateInfoMVK
poked (forall (f :: * -> *) a. Applicative f => a -> f a
pure ())

instance Zero IOSSurfaceCreateInfoMVK where
  zero :: IOSSurfaceCreateInfoMVK
zero = IOSSurfaceCreateFlagsMVK -> Ptr () -> IOSSurfaceCreateInfoMVK
IOSSurfaceCreateInfoMVK
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero


-- | VkIOSSurfaceCreateFlagsMVK - Reserved for future use
--
-- = Description
--
-- 'IOSSurfaceCreateFlagsMVK' is a bitmask type for setting a mask, but is
-- currently reserved for future use.
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_MVK_ios_surface VK_MVK_ios_surface>,
-- 'IOSSurfaceCreateInfoMVK'
newtype IOSSurfaceCreateFlagsMVK = IOSSurfaceCreateFlagsMVK Flags
  deriving newtype (IOSSurfaceCreateFlagsMVK -> IOSSurfaceCreateFlagsMVK -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IOSSurfaceCreateFlagsMVK -> IOSSurfaceCreateFlagsMVK -> Bool
$c/= :: IOSSurfaceCreateFlagsMVK -> IOSSurfaceCreateFlagsMVK -> Bool
== :: IOSSurfaceCreateFlagsMVK -> IOSSurfaceCreateFlagsMVK -> Bool
$c== :: IOSSurfaceCreateFlagsMVK -> IOSSurfaceCreateFlagsMVK -> Bool
Eq, Eq IOSSurfaceCreateFlagsMVK
IOSSurfaceCreateFlagsMVK -> IOSSurfaceCreateFlagsMVK -> Bool
IOSSurfaceCreateFlagsMVK -> IOSSurfaceCreateFlagsMVK -> Ordering
IOSSurfaceCreateFlagsMVK
-> IOSSurfaceCreateFlagsMVK -> IOSSurfaceCreateFlagsMVK
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: IOSSurfaceCreateFlagsMVK
-> IOSSurfaceCreateFlagsMVK -> IOSSurfaceCreateFlagsMVK
$cmin :: IOSSurfaceCreateFlagsMVK
-> IOSSurfaceCreateFlagsMVK -> IOSSurfaceCreateFlagsMVK
max :: IOSSurfaceCreateFlagsMVK
-> IOSSurfaceCreateFlagsMVK -> IOSSurfaceCreateFlagsMVK
$cmax :: IOSSurfaceCreateFlagsMVK
-> IOSSurfaceCreateFlagsMVK -> IOSSurfaceCreateFlagsMVK
>= :: IOSSurfaceCreateFlagsMVK -> IOSSurfaceCreateFlagsMVK -> Bool
$c>= :: IOSSurfaceCreateFlagsMVK -> IOSSurfaceCreateFlagsMVK -> Bool
> :: IOSSurfaceCreateFlagsMVK -> IOSSurfaceCreateFlagsMVK -> Bool
$c> :: IOSSurfaceCreateFlagsMVK -> IOSSurfaceCreateFlagsMVK -> Bool
<= :: IOSSurfaceCreateFlagsMVK -> IOSSurfaceCreateFlagsMVK -> Bool
$c<= :: IOSSurfaceCreateFlagsMVK -> IOSSurfaceCreateFlagsMVK -> Bool
< :: IOSSurfaceCreateFlagsMVK -> IOSSurfaceCreateFlagsMVK -> Bool
$c< :: IOSSurfaceCreateFlagsMVK -> IOSSurfaceCreateFlagsMVK -> Bool
compare :: IOSSurfaceCreateFlagsMVK -> IOSSurfaceCreateFlagsMVK -> Ordering
$ccompare :: IOSSurfaceCreateFlagsMVK -> IOSSurfaceCreateFlagsMVK -> Ordering
Ord, Ptr IOSSurfaceCreateFlagsMVK -> IO IOSSurfaceCreateFlagsMVK
Ptr IOSSurfaceCreateFlagsMVK -> Int -> IO IOSSurfaceCreateFlagsMVK
Ptr IOSSurfaceCreateFlagsMVK
-> Int -> IOSSurfaceCreateFlagsMVK -> IO ()
Ptr IOSSurfaceCreateFlagsMVK -> IOSSurfaceCreateFlagsMVK -> IO ()
IOSSurfaceCreateFlagsMVK -> Int
forall b. Ptr b -> Int -> IO IOSSurfaceCreateFlagsMVK
forall b. Ptr b -> Int -> IOSSurfaceCreateFlagsMVK -> IO ()
forall a.
(a -> Int)
-> (a -> Int)
-> (Ptr a -> Int -> IO a)
-> (Ptr a -> Int -> a -> IO ())
-> (forall b. Ptr b -> Int -> IO a)
-> (forall b. Ptr b -> Int -> a -> IO ())
-> (Ptr a -> IO a)
-> (Ptr a -> a -> IO ())
-> Storable a
poke :: Ptr IOSSurfaceCreateFlagsMVK -> IOSSurfaceCreateFlagsMVK -> IO ()
$cpoke :: Ptr IOSSurfaceCreateFlagsMVK -> IOSSurfaceCreateFlagsMVK -> IO ()
peek :: Ptr IOSSurfaceCreateFlagsMVK -> IO IOSSurfaceCreateFlagsMVK
$cpeek :: Ptr IOSSurfaceCreateFlagsMVK -> IO IOSSurfaceCreateFlagsMVK
pokeByteOff :: forall b. Ptr b -> Int -> IOSSurfaceCreateFlagsMVK -> IO ()
$cpokeByteOff :: forall b. Ptr b -> Int -> IOSSurfaceCreateFlagsMVK -> IO ()
peekByteOff :: forall b. Ptr b -> Int -> IO IOSSurfaceCreateFlagsMVK
$cpeekByteOff :: forall b. Ptr b -> Int -> IO IOSSurfaceCreateFlagsMVK
pokeElemOff :: Ptr IOSSurfaceCreateFlagsMVK
-> Int -> IOSSurfaceCreateFlagsMVK -> IO ()
$cpokeElemOff :: Ptr IOSSurfaceCreateFlagsMVK
-> Int -> IOSSurfaceCreateFlagsMVK -> IO ()
peekElemOff :: Ptr IOSSurfaceCreateFlagsMVK -> Int -> IO IOSSurfaceCreateFlagsMVK
$cpeekElemOff :: Ptr IOSSurfaceCreateFlagsMVK -> Int -> IO IOSSurfaceCreateFlagsMVK
alignment :: IOSSurfaceCreateFlagsMVK -> Int
$calignment :: IOSSurfaceCreateFlagsMVK -> Int
sizeOf :: IOSSurfaceCreateFlagsMVK -> Int
$csizeOf :: IOSSurfaceCreateFlagsMVK -> Int
Storable, IOSSurfaceCreateFlagsMVK
forall a. a -> Zero a
zero :: IOSSurfaceCreateFlagsMVK
$czero :: IOSSurfaceCreateFlagsMVK
Zero, Eq IOSSurfaceCreateFlagsMVK
IOSSurfaceCreateFlagsMVK
Int -> IOSSurfaceCreateFlagsMVK
IOSSurfaceCreateFlagsMVK -> Bool
IOSSurfaceCreateFlagsMVK -> Int
IOSSurfaceCreateFlagsMVK -> Maybe Int
IOSSurfaceCreateFlagsMVK -> IOSSurfaceCreateFlagsMVK
IOSSurfaceCreateFlagsMVK -> Int -> Bool
IOSSurfaceCreateFlagsMVK -> Int -> IOSSurfaceCreateFlagsMVK
IOSSurfaceCreateFlagsMVK
-> IOSSurfaceCreateFlagsMVK -> IOSSurfaceCreateFlagsMVK
forall a.
Eq a
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> a
-> (Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> Bool)
-> (a -> Maybe Int)
-> (a -> Int)
-> (a -> Bool)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int)
-> Bits a
popCount :: IOSSurfaceCreateFlagsMVK -> Int
$cpopCount :: IOSSurfaceCreateFlagsMVK -> Int
rotateR :: IOSSurfaceCreateFlagsMVK -> Int -> IOSSurfaceCreateFlagsMVK
$crotateR :: IOSSurfaceCreateFlagsMVK -> Int -> IOSSurfaceCreateFlagsMVK
rotateL :: IOSSurfaceCreateFlagsMVK -> Int -> IOSSurfaceCreateFlagsMVK
$crotateL :: IOSSurfaceCreateFlagsMVK -> Int -> IOSSurfaceCreateFlagsMVK
unsafeShiftR :: IOSSurfaceCreateFlagsMVK -> Int -> IOSSurfaceCreateFlagsMVK
$cunsafeShiftR :: IOSSurfaceCreateFlagsMVK -> Int -> IOSSurfaceCreateFlagsMVK
shiftR :: IOSSurfaceCreateFlagsMVK -> Int -> IOSSurfaceCreateFlagsMVK
$cshiftR :: IOSSurfaceCreateFlagsMVK -> Int -> IOSSurfaceCreateFlagsMVK
unsafeShiftL :: IOSSurfaceCreateFlagsMVK -> Int -> IOSSurfaceCreateFlagsMVK
$cunsafeShiftL :: IOSSurfaceCreateFlagsMVK -> Int -> IOSSurfaceCreateFlagsMVK
shiftL :: IOSSurfaceCreateFlagsMVK -> Int -> IOSSurfaceCreateFlagsMVK
$cshiftL :: IOSSurfaceCreateFlagsMVK -> Int -> IOSSurfaceCreateFlagsMVK
isSigned :: IOSSurfaceCreateFlagsMVK -> Bool
$cisSigned :: IOSSurfaceCreateFlagsMVK -> Bool
bitSize :: IOSSurfaceCreateFlagsMVK -> Int
$cbitSize :: IOSSurfaceCreateFlagsMVK -> Int
bitSizeMaybe :: IOSSurfaceCreateFlagsMVK -> Maybe Int
$cbitSizeMaybe :: IOSSurfaceCreateFlagsMVK -> Maybe Int
testBit :: IOSSurfaceCreateFlagsMVK -> Int -> Bool
$ctestBit :: IOSSurfaceCreateFlagsMVK -> Int -> Bool
complementBit :: IOSSurfaceCreateFlagsMVK -> Int -> IOSSurfaceCreateFlagsMVK
$ccomplementBit :: IOSSurfaceCreateFlagsMVK -> Int -> IOSSurfaceCreateFlagsMVK
clearBit :: IOSSurfaceCreateFlagsMVK -> Int -> IOSSurfaceCreateFlagsMVK
$cclearBit :: IOSSurfaceCreateFlagsMVK -> Int -> IOSSurfaceCreateFlagsMVK
setBit :: IOSSurfaceCreateFlagsMVK -> Int -> IOSSurfaceCreateFlagsMVK
$csetBit :: IOSSurfaceCreateFlagsMVK -> Int -> IOSSurfaceCreateFlagsMVK
bit :: Int -> IOSSurfaceCreateFlagsMVK
$cbit :: Int -> IOSSurfaceCreateFlagsMVK
zeroBits :: IOSSurfaceCreateFlagsMVK
$czeroBits :: IOSSurfaceCreateFlagsMVK
rotate :: IOSSurfaceCreateFlagsMVK -> Int -> IOSSurfaceCreateFlagsMVK
$crotate :: IOSSurfaceCreateFlagsMVK -> Int -> IOSSurfaceCreateFlagsMVK
shift :: IOSSurfaceCreateFlagsMVK -> Int -> IOSSurfaceCreateFlagsMVK
$cshift :: IOSSurfaceCreateFlagsMVK -> Int -> IOSSurfaceCreateFlagsMVK
complement :: IOSSurfaceCreateFlagsMVK -> IOSSurfaceCreateFlagsMVK
$ccomplement :: IOSSurfaceCreateFlagsMVK -> IOSSurfaceCreateFlagsMVK
xor :: IOSSurfaceCreateFlagsMVK
-> IOSSurfaceCreateFlagsMVK -> IOSSurfaceCreateFlagsMVK
$cxor :: IOSSurfaceCreateFlagsMVK
-> IOSSurfaceCreateFlagsMVK -> IOSSurfaceCreateFlagsMVK
.|. :: IOSSurfaceCreateFlagsMVK
-> IOSSurfaceCreateFlagsMVK -> IOSSurfaceCreateFlagsMVK
$c.|. :: IOSSurfaceCreateFlagsMVK
-> IOSSurfaceCreateFlagsMVK -> IOSSurfaceCreateFlagsMVK
.&. :: IOSSurfaceCreateFlagsMVK
-> IOSSurfaceCreateFlagsMVK -> IOSSurfaceCreateFlagsMVK
$c.&. :: IOSSurfaceCreateFlagsMVK
-> IOSSurfaceCreateFlagsMVK -> IOSSurfaceCreateFlagsMVK
Bits, Bits IOSSurfaceCreateFlagsMVK
IOSSurfaceCreateFlagsMVK -> Int
forall b.
Bits b -> (b -> Int) -> (b -> Int) -> (b -> Int) -> FiniteBits b
countTrailingZeros :: IOSSurfaceCreateFlagsMVK -> Int
$ccountTrailingZeros :: IOSSurfaceCreateFlagsMVK -> Int
countLeadingZeros :: IOSSurfaceCreateFlagsMVK -> Int
$ccountLeadingZeros :: IOSSurfaceCreateFlagsMVK -> Int
finiteBitSize :: IOSSurfaceCreateFlagsMVK -> Int
$cfiniteBitSize :: IOSSurfaceCreateFlagsMVK -> Int
FiniteBits)

conNameIOSSurfaceCreateFlagsMVK :: String
conNameIOSSurfaceCreateFlagsMVK :: String
conNameIOSSurfaceCreateFlagsMVK = String
"IOSSurfaceCreateFlagsMVK"

enumPrefixIOSSurfaceCreateFlagsMVK :: String
enumPrefixIOSSurfaceCreateFlagsMVK :: String
enumPrefixIOSSurfaceCreateFlagsMVK = String
""

showTableIOSSurfaceCreateFlagsMVK :: [(IOSSurfaceCreateFlagsMVK, String)]
showTableIOSSurfaceCreateFlagsMVK :: [(IOSSurfaceCreateFlagsMVK, String)]
showTableIOSSurfaceCreateFlagsMVK = []

instance Show IOSSurfaceCreateFlagsMVK where
  showsPrec :: Int -> IOSSurfaceCreateFlagsMVK -> ShowS
showsPrec =
    forall a i.
Eq a =>
String
-> [(a, String)]
-> String
-> (a -> i)
-> (i -> ShowS)
-> Int
-> a
-> ShowS
enumShowsPrec
      String
enumPrefixIOSSurfaceCreateFlagsMVK
      [(IOSSurfaceCreateFlagsMVK, String)]
showTableIOSSurfaceCreateFlagsMVK
      String
conNameIOSSurfaceCreateFlagsMVK
      (\(IOSSurfaceCreateFlagsMVK Flags
x) -> Flags
x)
      (\Flags
x -> String -> ShowS
showString String
"0x" forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. (Integral a, Show a) => a -> ShowS
showHex Flags
x)

instance Read IOSSurfaceCreateFlagsMVK where
  readPrec :: ReadPrec IOSSurfaceCreateFlagsMVK
readPrec =
    forall i a.
Read i =>
String -> [(a, String)] -> String -> (i -> a) -> ReadPrec a
enumReadPrec
      String
enumPrefixIOSSurfaceCreateFlagsMVK
      [(IOSSurfaceCreateFlagsMVK, String)]
showTableIOSSurfaceCreateFlagsMVK
      String
conNameIOSSurfaceCreateFlagsMVK
      Flags -> IOSSurfaceCreateFlagsMVK
IOSSurfaceCreateFlagsMVK

type MVK_IOS_SURFACE_SPEC_VERSION = 3

-- No documentation found for TopLevel "VK_MVK_IOS_SURFACE_SPEC_VERSION"
pattern MVK_IOS_SURFACE_SPEC_VERSION :: forall a . Integral a => a
pattern $bMVK_IOS_SURFACE_SPEC_VERSION :: forall a. Integral a => a
$mMVK_IOS_SURFACE_SPEC_VERSION :: forall {r} {a}.
Integral a =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
MVK_IOS_SURFACE_SPEC_VERSION = 3


type MVK_IOS_SURFACE_EXTENSION_NAME = "VK_MVK_ios_surface"

-- No documentation found for TopLevel "VK_MVK_IOS_SURFACE_EXTENSION_NAME"
pattern MVK_IOS_SURFACE_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bMVK_IOS_SURFACE_EXTENSION_NAME :: forall a. (Eq a, IsString a) => a
$mMVK_IOS_SURFACE_EXTENSION_NAME :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
MVK_IOS_SURFACE_EXTENSION_NAME = "VK_MVK_ios_surface"