{-# language CPP #-}
-- | = Name
--
-- VK_EXT_metal_surface - instance extension
--
-- == VK_EXT_metal_surface
--
-- [__Name String__]
--     @VK_EXT_metal_surface@
--
-- [__Extension Type__]
--     Instance extension
--
-- [__Registered Extension Number__]
--     218
--
-- [__Revision__]
--     1
--
-- [__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>
--
-- [__Contact__]
--
--     -   Dzmitry Malyshau
--         <https://github.com/KhronosGroup/Vulkan-Docs/issues/new?body=[VK_EXT_metal_surface] @kvark%0A*Here describe the issue or question you have about the VK_EXT_metal_surface extension* >
--
-- == Other Extension Metadata
--
-- [__Last Modified Date__]
--     2018-10-01
--
-- [__IP Status__]
--     No known IP claims.
--
-- [__Contributors__]
--
--     -   Dzmitry Malyshau, Mozilla Corp.
--
-- == Description
--
-- The @VK_EXT_metal_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) from 'CAMetalLayer',
-- which is the native rendering surface of Apple’s Metal framework.
--
-- == New Base Types
--
-- -   'CAMetalLayer'
--
-- == New Commands
--
-- -   'createMetalSurfaceEXT'
--
-- == New Structures
--
-- -   'MetalSurfaceCreateInfoEXT'
--
-- == New Bitmasks
--
-- -   'MetalSurfaceCreateFlagsEXT'
--
-- == New Enum Constants
--
-- -   'EXT_METAL_SURFACE_EXTENSION_NAME'
--
-- -   'EXT_METAL_SURFACE_SPEC_VERSION'
--
-- -   Extending 'Vulkan.Core10.Enums.StructureType.StructureType':
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT'
--
-- == Version History
--
-- -   Revision 1, 2018-10-01 (Dzmitry Malyshau)
--
--     -   Initial version
--
-- == See Also
--
-- 'CAMetalLayer', 'MetalSurfaceCreateFlagsEXT',
-- 'MetalSurfaceCreateInfoEXT', 'createMetalSurfaceEXT'
--
-- == Document Notes
--
-- For more information, see the
-- <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VK_EXT_metal_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_EXT_metal_surface  ( createMetalSurfaceEXT
                                               , MetalSurfaceCreateInfoEXT(..)
                                               , MetalSurfaceCreateFlagsEXT(..)
                                               , EXT_METAL_SURFACE_SPEC_VERSION
                                               , pattern EXT_METAL_SURFACE_SPEC_VERSION
                                               , EXT_METAL_SURFACE_EXTENSION_NAME
                                               , pattern EXT_METAL_SURFACE_EXTENSION_NAME
                                               , CAMetalLayer
                                               , 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(pVkCreateMetalSurfaceEXT))
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_METAL_SURFACE_CREATE_INFO_EXT))
import Vulkan.Core10.Enums.Result (Result(SUCCESS))
import Vulkan.Extensions.Handles (SurfaceKHR(..))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkCreateMetalSurfaceEXT
  :: FunPtr (Ptr Instance_T -> Ptr MetalSurfaceCreateInfoEXT -> Ptr AllocationCallbacks -> Ptr SurfaceKHR -> IO Result) -> Ptr Instance_T -> Ptr MetalSurfaceCreateInfoEXT -> Ptr AllocationCallbacks -> Ptr SurfaceKHR -> IO Result

-- | vkCreateMetalSurfaceEXT - Create a VkSurfaceKHR object for CAMetalLayer
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-vkCreateMetalSurfaceEXT-instance-parameter# @instance@ /must/
--     be a valid 'Vulkan.Core10.Handles.Instance' handle
--
-- -   #VUID-vkCreateMetalSurfaceEXT-pCreateInfo-parameter# @pCreateInfo@
--     /must/ be a valid pointer to a valid 'MetalSurfaceCreateInfoEXT'
--     structure
--
-- -   #VUID-vkCreateMetalSurfaceEXT-pAllocator-parameter# If @pAllocator@
--     is not @NULL@, @pAllocator@ /must/ be a valid pointer to a valid
--     'Vulkan.Core10.AllocationCallbacks.AllocationCallbacks' structure
--
-- -   #VUID-vkCreateMetalSurfaceEXT-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_EXT_metal_surface VK_EXT_metal_surface>,
-- 'Vulkan.Core10.AllocationCallbacks.AllocationCallbacks',
-- 'Vulkan.Core10.Handles.Instance', 'MetalSurfaceCreateInfoEXT',
-- 'Vulkan.Extensions.Handles.SurfaceKHR'
createMetalSurfaceEXT :: forall io
                       . (MonadIO io)
                      => -- | @instance@ is the instance with which to associate the surface.
                         Instance
                      -> -- | @pCreateInfo@ is a pointer to a 'MetalSurfaceCreateInfoEXT' structure
                         -- specifying parameters affecting the creation of the surface object.
                         MetalSurfaceCreateInfoEXT
                      -> -- | @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>).
                         ("allocator" ::: Maybe AllocationCallbacks)
                      -> io (SurfaceKHR)
createMetalSurfaceEXT :: forall (io :: * -> *).
MonadIO io =>
Instance
-> MetalSurfaceCreateInfoEXT
-> ("allocator" ::: Maybe AllocationCallbacks)
-> io SurfaceKHR
createMetalSurfaceEXT Instance
instance' MetalSurfaceCreateInfoEXT
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 vkCreateMetalSurfaceEXTPtr :: FunPtr
  (Ptr Instance_T
   -> ("pCreateInfo" ::: Ptr MetalSurfaceCreateInfoEXT)
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> ("pSurface" ::: Ptr SurfaceKHR)
   -> IO Result)
vkCreateMetalSurfaceEXTPtr = InstanceCmds
-> FunPtr
     (Ptr Instance_T
      -> ("pCreateInfo" ::: Ptr MetalSurfaceCreateInfoEXT)
      -> ("pAllocator" ::: Ptr AllocationCallbacks)
      -> ("pSurface" ::: Ptr SurfaceKHR)
      -> IO Result)
pVkCreateMetalSurfaceEXT (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 MetalSurfaceCreateInfoEXT)
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> ("pSurface" ::: Ptr SurfaceKHR)
   -> IO Result)
vkCreateMetalSurfaceEXTPtr 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 vkCreateMetalSurfaceEXT is null" forall a. Maybe a
Nothing forall a. Maybe a
Nothing
  let vkCreateMetalSurfaceEXT' :: Ptr Instance_T
-> ("pCreateInfo" ::: Ptr MetalSurfaceCreateInfoEXT)
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSurface" ::: Ptr SurfaceKHR)
-> IO Result
vkCreateMetalSurfaceEXT' = FunPtr
  (Ptr Instance_T
   -> ("pCreateInfo" ::: Ptr MetalSurfaceCreateInfoEXT)
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> ("pSurface" ::: Ptr SurfaceKHR)
   -> IO Result)
-> Ptr Instance_T
-> ("pCreateInfo" ::: Ptr MetalSurfaceCreateInfoEXT)
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSurface" ::: Ptr SurfaceKHR)
-> IO Result
mkVkCreateMetalSurfaceEXT FunPtr
  (Ptr Instance_T
   -> ("pCreateInfo" ::: Ptr MetalSurfaceCreateInfoEXT)
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> ("pSurface" ::: Ptr SurfaceKHR)
   -> IO Result)
vkCreateMetalSurfaceEXTPtr
  "pCreateInfo" ::: Ptr MetalSurfaceCreateInfoEXT
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 (MetalSurfaceCreateInfoEXT
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
"vkCreateMetalSurfaceEXT" (Ptr Instance_T
-> ("pCreateInfo" ::: Ptr MetalSurfaceCreateInfoEXT)
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSurface" ::: Ptr SurfaceKHR)
-> IO Result
vkCreateMetalSurfaceEXT'
                                                            (Instance -> Ptr Instance_T
instanceHandle (Instance
instance'))
                                                            "pCreateInfo" ::: Ptr MetalSurfaceCreateInfoEXT
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)


-- | VkMetalSurfaceCreateInfoEXT - Structure specifying parameters of a newly
-- created Metal surface object
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_metal_surface VK_EXT_metal_surface>,
-- 'MetalSurfaceCreateFlagsEXT',
-- 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'createMetalSurfaceEXT'
data MetalSurfaceCreateInfoEXT = MetalSurfaceCreateInfoEXT
  { -- | @flags@ is reserved for future use.
    --
    -- #VUID-VkMetalSurfaceCreateInfoEXT-flags-zerobitmask# @flags@ /must/ be
    -- @0@
    MetalSurfaceCreateInfoEXT -> MetalSurfaceCreateFlagsEXT
flags :: MetalSurfaceCreateFlagsEXT
  , -- | @pLayer@ is a reference to a 'CAMetalLayer' object representing a
    -- renderable surface.
    MetalSurfaceCreateInfoEXT -> Ptr CAMetalLayer
layer :: Ptr CAMetalLayer
  }
  deriving (Typeable, MetalSurfaceCreateInfoEXT -> MetalSurfaceCreateInfoEXT -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MetalSurfaceCreateInfoEXT -> MetalSurfaceCreateInfoEXT -> Bool
$c/= :: MetalSurfaceCreateInfoEXT -> MetalSurfaceCreateInfoEXT -> Bool
== :: MetalSurfaceCreateInfoEXT -> MetalSurfaceCreateInfoEXT -> Bool
$c== :: MetalSurfaceCreateInfoEXT -> MetalSurfaceCreateInfoEXT -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (MetalSurfaceCreateInfoEXT)
#endif
deriving instance Show MetalSurfaceCreateInfoEXT

instance ToCStruct MetalSurfaceCreateInfoEXT where
  withCStruct :: forall b.
MetalSurfaceCreateInfoEXT
-> (("pCreateInfo" ::: Ptr MetalSurfaceCreateInfoEXT) -> IO b)
-> IO b
withCStruct MetalSurfaceCreateInfoEXT
x ("pCreateInfo" ::: Ptr MetalSurfaceCreateInfoEXT) -> 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 MetalSurfaceCreateInfoEXT
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pCreateInfo" ::: Ptr MetalSurfaceCreateInfoEXT
p MetalSurfaceCreateInfoEXT
x (("pCreateInfo" ::: Ptr MetalSurfaceCreateInfoEXT) -> IO b
f "pCreateInfo" ::: Ptr MetalSurfaceCreateInfoEXT
p)
  pokeCStruct :: forall b.
("pCreateInfo" ::: Ptr MetalSurfaceCreateInfoEXT)
-> MetalSurfaceCreateInfoEXT -> IO b -> IO b
pokeCStruct "pCreateInfo" ::: Ptr MetalSurfaceCreateInfoEXT
p MetalSurfaceCreateInfoEXT{Ptr CAMetalLayer
MetalSurfaceCreateFlagsEXT
layer :: Ptr CAMetalLayer
flags :: MetalSurfaceCreateFlagsEXT
$sel:layer:MetalSurfaceCreateInfoEXT :: MetalSurfaceCreateInfoEXT -> Ptr CAMetalLayer
$sel:flags:MetalSurfaceCreateInfoEXT :: MetalSurfaceCreateInfoEXT -> MetalSurfaceCreateFlagsEXT
..} IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr MetalSurfaceCreateInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr MetalSurfaceCreateInfoEXT
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 MetalSurfaceCreateInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr MetalSurfaceCreateFlagsEXT)) (MetalSurfaceCreateFlagsEXT
flags)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr MetalSurfaceCreateInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr CAMetalLayer))) (Ptr CAMetalLayer
layer)
    IO b
f
  cStructSize :: Int
cStructSize = Int
32
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b.
("pCreateInfo" ::: Ptr MetalSurfaceCreateInfoEXT) -> IO b -> IO b
pokeZeroCStruct "pCreateInfo" ::: Ptr MetalSurfaceCreateInfoEXT
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr MetalSurfaceCreateInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr MetalSurfaceCreateInfoEXT
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 MetalSurfaceCreateInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr CAMetalLayer))) (forall a. Zero a => a
zero)
    IO b
f

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

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

instance Zero MetalSurfaceCreateInfoEXT where
  zero :: MetalSurfaceCreateInfoEXT
zero = MetalSurfaceCreateFlagsEXT
-> Ptr CAMetalLayer -> MetalSurfaceCreateInfoEXT
MetalSurfaceCreateInfoEXT
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero


-- | VkMetalSurfaceCreateFlagsEXT - Reserved for future use
--
-- = Description
--
-- 'MetalSurfaceCreateFlagsEXT' 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_EXT_metal_surface VK_EXT_metal_surface>,
-- 'MetalSurfaceCreateInfoEXT'
newtype MetalSurfaceCreateFlagsEXT = MetalSurfaceCreateFlagsEXT Flags
  deriving newtype (MetalSurfaceCreateFlagsEXT -> MetalSurfaceCreateFlagsEXT -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MetalSurfaceCreateFlagsEXT -> MetalSurfaceCreateFlagsEXT -> Bool
$c/= :: MetalSurfaceCreateFlagsEXT -> MetalSurfaceCreateFlagsEXT -> Bool
== :: MetalSurfaceCreateFlagsEXT -> MetalSurfaceCreateFlagsEXT -> Bool
$c== :: MetalSurfaceCreateFlagsEXT -> MetalSurfaceCreateFlagsEXT -> Bool
Eq, Eq MetalSurfaceCreateFlagsEXT
MetalSurfaceCreateFlagsEXT -> MetalSurfaceCreateFlagsEXT -> Bool
MetalSurfaceCreateFlagsEXT
-> MetalSurfaceCreateFlagsEXT -> Ordering
MetalSurfaceCreateFlagsEXT
-> MetalSurfaceCreateFlagsEXT -> MetalSurfaceCreateFlagsEXT
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 :: MetalSurfaceCreateFlagsEXT
-> MetalSurfaceCreateFlagsEXT -> MetalSurfaceCreateFlagsEXT
$cmin :: MetalSurfaceCreateFlagsEXT
-> MetalSurfaceCreateFlagsEXT -> MetalSurfaceCreateFlagsEXT
max :: MetalSurfaceCreateFlagsEXT
-> MetalSurfaceCreateFlagsEXT -> MetalSurfaceCreateFlagsEXT
$cmax :: MetalSurfaceCreateFlagsEXT
-> MetalSurfaceCreateFlagsEXT -> MetalSurfaceCreateFlagsEXT
>= :: MetalSurfaceCreateFlagsEXT -> MetalSurfaceCreateFlagsEXT -> Bool
$c>= :: MetalSurfaceCreateFlagsEXT -> MetalSurfaceCreateFlagsEXT -> Bool
> :: MetalSurfaceCreateFlagsEXT -> MetalSurfaceCreateFlagsEXT -> Bool
$c> :: MetalSurfaceCreateFlagsEXT -> MetalSurfaceCreateFlagsEXT -> Bool
<= :: MetalSurfaceCreateFlagsEXT -> MetalSurfaceCreateFlagsEXT -> Bool
$c<= :: MetalSurfaceCreateFlagsEXT -> MetalSurfaceCreateFlagsEXT -> Bool
< :: MetalSurfaceCreateFlagsEXT -> MetalSurfaceCreateFlagsEXT -> Bool
$c< :: MetalSurfaceCreateFlagsEXT -> MetalSurfaceCreateFlagsEXT -> Bool
compare :: MetalSurfaceCreateFlagsEXT
-> MetalSurfaceCreateFlagsEXT -> Ordering
$ccompare :: MetalSurfaceCreateFlagsEXT
-> MetalSurfaceCreateFlagsEXT -> Ordering
Ord, Ptr MetalSurfaceCreateFlagsEXT -> IO MetalSurfaceCreateFlagsEXT
Ptr MetalSurfaceCreateFlagsEXT
-> Int -> IO MetalSurfaceCreateFlagsEXT
Ptr MetalSurfaceCreateFlagsEXT
-> Int -> MetalSurfaceCreateFlagsEXT -> IO ()
Ptr MetalSurfaceCreateFlagsEXT
-> MetalSurfaceCreateFlagsEXT -> IO ()
MetalSurfaceCreateFlagsEXT -> Int
forall b. Ptr b -> Int -> IO MetalSurfaceCreateFlagsEXT
forall b. Ptr b -> Int -> MetalSurfaceCreateFlagsEXT -> 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 MetalSurfaceCreateFlagsEXT
-> MetalSurfaceCreateFlagsEXT -> IO ()
$cpoke :: Ptr MetalSurfaceCreateFlagsEXT
-> MetalSurfaceCreateFlagsEXT -> IO ()
peek :: Ptr MetalSurfaceCreateFlagsEXT -> IO MetalSurfaceCreateFlagsEXT
$cpeek :: Ptr MetalSurfaceCreateFlagsEXT -> IO MetalSurfaceCreateFlagsEXT
pokeByteOff :: forall b. Ptr b -> Int -> MetalSurfaceCreateFlagsEXT -> IO ()
$cpokeByteOff :: forall b. Ptr b -> Int -> MetalSurfaceCreateFlagsEXT -> IO ()
peekByteOff :: forall b. Ptr b -> Int -> IO MetalSurfaceCreateFlagsEXT
$cpeekByteOff :: forall b. Ptr b -> Int -> IO MetalSurfaceCreateFlagsEXT
pokeElemOff :: Ptr MetalSurfaceCreateFlagsEXT
-> Int -> MetalSurfaceCreateFlagsEXT -> IO ()
$cpokeElemOff :: Ptr MetalSurfaceCreateFlagsEXT
-> Int -> MetalSurfaceCreateFlagsEXT -> IO ()
peekElemOff :: Ptr MetalSurfaceCreateFlagsEXT
-> Int -> IO MetalSurfaceCreateFlagsEXT
$cpeekElemOff :: Ptr MetalSurfaceCreateFlagsEXT
-> Int -> IO MetalSurfaceCreateFlagsEXT
alignment :: MetalSurfaceCreateFlagsEXT -> Int
$calignment :: MetalSurfaceCreateFlagsEXT -> Int
sizeOf :: MetalSurfaceCreateFlagsEXT -> Int
$csizeOf :: MetalSurfaceCreateFlagsEXT -> Int
Storable, MetalSurfaceCreateFlagsEXT
forall a. a -> Zero a
zero :: MetalSurfaceCreateFlagsEXT
$czero :: MetalSurfaceCreateFlagsEXT
Zero, Eq MetalSurfaceCreateFlagsEXT
MetalSurfaceCreateFlagsEXT
Int -> MetalSurfaceCreateFlagsEXT
MetalSurfaceCreateFlagsEXT -> Bool
MetalSurfaceCreateFlagsEXT -> Int
MetalSurfaceCreateFlagsEXT -> Maybe Int
MetalSurfaceCreateFlagsEXT -> MetalSurfaceCreateFlagsEXT
MetalSurfaceCreateFlagsEXT -> Int -> Bool
MetalSurfaceCreateFlagsEXT -> Int -> MetalSurfaceCreateFlagsEXT
MetalSurfaceCreateFlagsEXT
-> MetalSurfaceCreateFlagsEXT -> MetalSurfaceCreateFlagsEXT
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 :: MetalSurfaceCreateFlagsEXT -> Int
$cpopCount :: MetalSurfaceCreateFlagsEXT -> Int
rotateR :: MetalSurfaceCreateFlagsEXT -> Int -> MetalSurfaceCreateFlagsEXT
$crotateR :: MetalSurfaceCreateFlagsEXT -> Int -> MetalSurfaceCreateFlagsEXT
rotateL :: MetalSurfaceCreateFlagsEXT -> Int -> MetalSurfaceCreateFlagsEXT
$crotateL :: MetalSurfaceCreateFlagsEXT -> Int -> MetalSurfaceCreateFlagsEXT
unsafeShiftR :: MetalSurfaceCreateFlagsEXT -> Int -> MetalSurfaceCreateFlagsEXT
$cunsafeShiftR :: MetalSurfaceCreateFlagsEXT -> Int -> MetalSurfaceCreateFlagsEXT
shiftR :: MetalSurfaceCreateFlagsEXT -> Int -> MetalSurfaceCreateFlagsEXT
$cshiftR :: MetalSurfaceCreateFlagsEXT -> Int -> MetalSurfaceCreateFlagsEXT
unsafeShiftL :: MetalSurfaceCreateFlagsEXT -> Int -> MetalSurfaceCreateFlagsEXT
$cunsafeShiftL :: MetalSurfaceCreateFlagsEXT -> Int -> MetalSurfaceCreateFlagsEXT
shiftL :: MetalSurfaceCreateFlagsEXT -> Int -> MetalSurfaceCreateFlagsEXT
$cshiftL :: MetalSurfaceCreateFlagsEXT -> Int -> MetalSurfaceCreateFlagsEXT
isSigned :: MetalSurfaceCreateFlagsEXT -> Bool
$cisSigned :: MetalSurfaceCreateFlagsEXT -> Bool
bitSize :: MetalSurfaceCreateFlagsEXT -> Int
$cbitSize :: MetalSurfaceCreateFlagsEXT -> Int
bitSizeMaybe :: MetalSurfaceCreateFlagsEXT -> Maybe Int
$cbitSizeMaybe :: MetalSurfaceCreateFlagsEXT -> Maybe Int
testBit :: MetalSurfaceCreateFlagsEXT -> Int -> Bool
$ctestBit :: MetalSurfaceCreateFlagsEXT -> Int -> Bool
complementBit :: MetalSurfaceCreateFlagsEXT -> Int -> MetalSurfaceCreateFlagsEXT
$ccomplementBit :: MetalSurfaceCreateFlagsEXT -> Int -> MetalSurfaceCreateFlagsEXT
clearBit :: MetalSurfaceCreateFlagsEXT -> Int -> MetalSurfaceCreateFlagsEXT
$cclearBit :: MetalSurfaceCreateFlagsEXT -> Int -> MetalSurfaceCreateFlagsEXT
setBit :: MetalSurfaceCreateFlagsEXT -> Int -> MetalSurfaceCreateFlagsEXT
$csetBit :: MetalSurfaceCreateFlagsEXT -> Int -> MetalSurfaceCreateFlagsEXT
bit :: Int -> MetalSurfaceCreateFlagsEXT
$cbit :: Int -> MetalSurfaceCreateFlagsEXT
zeroBits :: MetalSurfaceCreateFlagsEXT
$czeroBits :: MetalSurfaceCreateFlagsEXT
rotate :: MetalSurfaceCreateFlagsEXT -> Int -> MetalSurfaceCreateFlagsEXT
$crotate :: MetalSurfaceCreateFlagsEXT -> Int -> MetalSurfaceCreateFlagsEXT
shift :: MetalSurfaceCreateFlagsEXT -> Int -> MetalSurfaceCreateFlagsEXT
$cshift :: MetalSurfaceCreateFlagsEXT -> Int -> MetalSurfaceCreateFlagsEXT
complement :: MetalSurfaceCreateFlagsEXT -> MetalSurfaceCreateFlagsEXT
$ccomplement :: MetalSurfaceCreateFlagsEXT -> MetalSurfaceCreateFlagsEXT
xor :: MetalSurfaceCreateFlagsEXT
-> MetalSurfaceCreateFlagsEXT -> MetalSurfaceCreateFlagsEXT
$cxor :: MetalSurfaceCreateFlagsEXT
-> MetalSurfaceCreateFlagsEXT -> MetalSurfaceCreateFlagsEXT
.|. :: MetalSurfaceCreateFlagsEXT
-> MetalSurfaceCreateFlagsEXT -> MetalSurfaceCreateFlagsEXT
$c.|. :: MetalSurfaceCreateFlagsEXT
-> MetalSurfaceCreateFlagsEXT -> MetalSurfaceCreateFlagsEXT
.&. :: MetalSurfaceCreateFlagsEXT
-> MetalSurfaceCreateFlagsEXT -> MetalSurfaceCreateFlagsEXT
$c.&. :: MetalSurfaceCreateFlagsEXT
-> MetalSurfaceCreateFlagsEXT -> MetalSurfaceCreateFlagsEXT
Bits, Bits MetalSurfaceCreateFlagsEXT
MetalSurfaceCreateFlagsEXT -> Int
forall b.
Bits b -> (b -> Int) -> (b -> Int) -> (b -> Int) -> FiniteBits b
countTrailingZeros :: MetalSurfaceCreateFlagsEXT -> Int
$ccountTrailingZeros :: MetalSurfaceCreateFlagsEXT -> Int
countLeadingZeros :: MetalSurfaceCreateFlagsEXT -> Int
$ccountLeadingZeros :: MetalSurfaceCreateFlagsEXT -> Int
finiteBitSize :: MetalSurfaceCreateFlagsEXT -> Int
$cfiniteBitSize :: MetalSurfaceCreateFlagsEXT -> Int
FiniteBits)

conNameMetalSurfaceCreateFlagsEXT :: String
conNameMetalSurfaceCreateFlagsEXT :: String
conNameMetalSurfaceCreateFlagsEXT = String
"MetalSurfaceCreateFlagsEXT"

enumPrefixMetalSurfaceCreateFlagsEXT :: String
enumPrefixMetalSurfaceCreateFlagsEXT :: String
enumPrefixMetalSurfaceCreateFlagsEXT = String
""

showTableMetalSurfaceCreateFlagsEXT :: [(MetalSurfaceCreateFlagsEXT, String)]
showTableMetalSurfaceCreateFlagsEXT :: [(MetalSurfaceCreateFlagsEXT, String)]
showTableMetalSurfaceCreateFlagsEXT = []

instance Show MetalSurfaceCreateFlagsEXT where
  showsPrec :: Int -> MetalSurfaceCreateFlagsEXT -> ShowS
showsPrec =
    forall a i.
Eq a =>
String
-> [(a, String)]
-> String
-> (a -> i)
-> (i -> ShowS)
-> Int
-> a
-> ShowS
enumShowsPrec
      String
enumPrefixMetalSurfaceCreateFlagsEXT
      [(MetalSurfaceCreateFlagsEXT, String)]
showTableMetalSurfaceCreateFlagsEXT
      String
conNameMetalSurfaceCreateFlagsEXT
      (\(MetalSurfaceCreateFlagsEXT 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 MetalSurfaceCreateFlagsEXT where
  readPrec :: ReadPrec MetalSurfaceCreateFlagsEXT
readPrec =
    forall i a.
Read i =>
String -> [(a, String)] -> String -> (i -> a) -> ReadPrec a
enumReadPrec
      String
enumPrefixMetalSurfaceCreateFlagsEXT
      [(MetalSurfaceCreateFlagsEXT, String)]
showTableMetalSurfaceCreateFlagsEXT
      String
conNameMetalSurfaceCreateFlagsEXT
      Flags -> MetalSurfaceCreateFlagsEXT
MetalSurfaceCreateFlagsEXT

type EXT_METAL_SURFACE_SPEC_VERSION = 1

-- No documentation found for TopLevel "VK_EXT_METAL_SURFACE_SPEC_VERSION"
pattern EXT_METAL_SURFACE_SPEC_VERSION :: forall a . Integral a => a
pattern $bEXT_METAL_SURFACE_SPEC_VERSION :: forall a. Integral a => a
$mEXT_METAL_SURFACE_SPEC_VERSION :: forall {r} {a}.
Integral a =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
EXT_METAL_SURFACE_SPEC_VERSION = 1


type EXT_METAL_SURFACE_EXTENSION_NAME = "VK_EXT_metal_surface"

-- No documentation found for TopLevel "VK_EXT_METAL_SURFACE_EXTENSION_NAME"
pattern EXT_METAL_SURFACE_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bEXT_METAL_SURFACE_EXTENSION_NAME :: forall a. (Eq a, IsString a) => a
$mEXT_METAL_SURFACE_EXTENSION_NAME :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
EXT_METAL_SURFACE_EXTENSION_NAME = "VK_EXT_metal_surface"


data CAMetalLayer