{-# language CPP #-}
-- | = Name
--
-- VK_MVK_macos_surface - instance extension
--
-- == VK_MVK_macos_surface
--
-- [__Name String__]
--     @VK_MVK_macos_surface@
--
-- [__Extension Type__]
--     Instance extension
--
-- [__Registered Extension Number__]
--     124
--
-- [__Revision__]
--     3
--
-- [__Extension and Version Dependencies__]
--
--     -   Requires support for Vulkan 1.0
--
--     -   Requires @VK_KHR_surface@ to be enabled
--
-- [__Deprecation state__]
--
--     -   /Deprecated/ by @VK_EXT_metal_surface@ extension
--
-- [__Contact__]
--
--     -   Bill Hollings
--         <https://github.com/KhronosGroup/Vulkan-Docs/issues/new?body=[VK_MVK_macos_surface] @billhollings%0A*Here describe the issue or question you have about the VK_MVK_macos_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_macos_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 an @NSView@,
-- the native surface type of macOS, 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_macos_surface@ extension is considered deprecated and has
-- been superseded by the @VK_EXT_metal_surface@ extension.
--
-- == New Commands
--
-- -   'createMacOSSurfaceMVK'
--
-- == New Structures
--
-- -   'MacOSSurfaceCreateInfoMVK'
--
-- == New Bitmasks
--
-- -   'MacOSSurfaceCreateFlagsMVK'
--
-- == New Enum Constants
--
-- -   'MVK_MACOS_SURFACE_EXTENSION_NAME'
--
-- -   'MVK_MACOS_SURFACE_SPEC_VERSION'
--
-- -   Extending 'Vulkan.Core10.Enums.StructureType.StructureType':
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_MACOS_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 @NSView@ to
--         be backed by a
--         'Vulkan.Extensions.VK_EXT_metal_surface.CAMetalLayer'.
--
-- -   Revision 3, 2020-07-31 (Bill Hollings)
--
--     -   Update documentation on requirements for @NSView@.
--
--     -   Mark as deprecated by @VK_EXT_metal_surface@.
--
-- == See Also
--
-- 'MacOSSurfaceCreateFlagsMVK', 'MacOSSurfaceCreateInfoMVK',
-- 'createMacOSSurfaceMVK'
--
-- == Document Notes
--
-- For more information, see the
-- <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VK_MVK_macos_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_macos_surface  ( createMacOSSurfaceMVK
                                               , MacOSSurfaceCreateInfoMVK(..)
                                               , MacOSSurfaceCreateFlagsMVK(..)
                                               , MVK_MACOS_SURFACE_SPEC_VERSION
                                               , pattern MVK_MACOS_SURFACE_SPEC_VERSION
                                               , MVK_MACOS_SURFACE_EXTENSION_NAME
                                               , pattern MVK_MACOS_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(pVkCreateMacOSSurfaceMVK))
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_MACOS_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" mkVkCreateMacOSSurfaceMVK
  :: FunPtr (Ptr Instance_T -> Ptr MacOSSurfaceCreateInfoMVK -> Ptr AllocationCallbacks -> Ptr SurfaceKHR -> IO Result) -> Ptr Instance_T -> Ptr MacOSSurfaceCreateInfoMVK -> Ptr AllocationCallbacks -> Ptr SurfaceKHR -> IO Result

-- | vkCreateMacOSSurfaceMVK - Create a VkSurfaceKHR object for a macOS
-- NSView
--
-- = Parameters
--
-- Note
--
-- The 'createMacOSSurfaceMVK' 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 'MacOSSurfaceCreateInfoMVK'
--     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-vkCreateMacOSSurfaceMVK-instance-parameter# @instance@ /must/
--     be a valid 'Vulkan.Core10.Handles.Instance' handle
--
-- -   #VUID-vkCreateMacOSSurfaceMVK-pCreateInfo-parameter# @pCreateInfo@
--     /must/ be a valid pointer to a valid 'MacOSSurfaceCreateInfoMVK'
--     structure
--
-- -   #VUID-vkCreateMacOSSurfaceMVK-pAllocator-parameter# If @pAllocator@
--     is not @NULL@, @pAllocator@ /must/ be a valid pointer to a valid
--     'Vulkan.Core10.AllocationCallbacks.AllocationCallbacks' structure
--
-- -   #VUID-vkCreateMacOSSurfaceMVK-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_macos_surface VK_MVK_macos_surface>,
-- 'Vulkan.Core10.AllocationCallbacks.AllocationCallbacks',
-- 'Vulkan.Core10.Handles.Instance', 'MacOSSurfaceCreateInfoMVK',
-- 'Vulkan.Extensions.Handles.SurfaceKHR'
createMacOSSurfaceMVK :: forall io
                       . (MonadIO io)
                      => -- No documentation found for Nested "vkCreateMacOSSurfaceMVK" "instance"
                         Instance
                      -> -- No documentation found for Nested "vkCreateMacOSSurfaceMVK" "pCreateInfo"
                         MacOSSurfaceCreateInfoMVK
                      -> -- No documentation found for Nested "vkCreateMacOSSurfaceMVK" "pAllocator"
                         ("allocator" ::: Maybe AllocationCallbacks)
                      -> io (SurfaceKHR)
createMacOSSurfaceMVK :: forall (io :: * -> *).
MonadIO io =>
Instance
-> MacOSSurfaceCreateInfoMVK
-> ("allocator" ::: Maybe AllocationCallbacks)
-> io SurfaceKHR
createMacOSSurfaceMVK Instance
instance' MacOSSurfaceCreateInfoMVK
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 vkCreateMacOSSurfaceMVKPtr :: FunPtr
  (Ptr Instance_T
   -> ("pCreateInfo" ::: Ptr MacOSSurfaceCreateInfoMVK)
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> ("pSurface" ::: Ptr SurfaceKHR)
   -> IO Result)
vkCreateMacOSSurfaceMVKPtr = InstanceCmds
-> FunPtr
     (Ptr Instance_T
      -> ("pCreateInfo" ::: Ptr MacOSSurfaceCreateInfoMVK)
      -> ("pAllocator" ::: Ptr AllocationCallbacks)
      -> ("pSurface" ::: Ptr SurfaceKHR)
      -> IO Result)
pVkCreateMacOSSurfaceMVK (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 MacOSSurfaceCreateInfoMVK)
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> ("pSurface" ::: Ptr SurfaceKHR)
   -> IO Result)
vkCreateMacOSSurfaceMVKPtr 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 vkCreateMacOSSurfaceMVK is null" forall a. Maybe a
Nothing forall a. Maybe a
Nothing
  let vkCreateMacOSSurfaceMVK' :: Ptr Instance_T
-> ("pCreateInfo" ::: Ptr MacOSSurfaceCreateInfoMVK)
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSurface" ::: Ptr SurfaceKHR)
-> IO Result
vkCreateMacOSSurfaceMVK' = FunPtr
  (Ptr Instance_T
   -> ("pCreateInfo" ::: Ptr MacOSSurfaceCreateInfoMVK)
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> ("pSurface" ::: Ptr SurfaceKHR)
   -> IO Result)
-> Ptr Instance_T
-> ("pCreateInfo" ::: Ptr MacOSSurfaceCreateInfoMVK)
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSurface" ::: Ptr SurfaceKHR)
-> IO Result
mkVkCreateMacOSSurfaceMVK FunPtr
  (Ptr Instance_T
   -> ("pCreateInfo" ::: Ptr MacOSSurfaceCreateInfoMVK)
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> ("pSurface" ::: Ptr SurfaceKHR)
   -> IO Result)
vkCreateMacOSSurfaceMVKPtr
  "pCreateInfo" ::: Ptr MacOSSurfaceCreateInfoMVK
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 (MacOSSurfaceCreateInfoMVK
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
"vkCreateMacOSSurfaceMVK" (Ptr Instance_T
-> ("pCreateInfo" ::: Ptr MacOSSurfaceCreateInfoMVK)
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSurface" ::: Ptr SurfaceKHR)
-> IO Result
vkCreateMacOSSurfaceMVK'
                                                            (Instance -> Ptr Instance_T
instanceHandle (Instance
instance'))
                                                            "pCreateInfo" ::: Ptr MacOSSurfaceCreateInfoMVK
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)


-- | VkMacOSSurfaceCreateInfoMVK - Structure specifying parameters of a newly
-- created macOS surface object
--
-- == Valid Usage
--
-- -   #VUID-VkMacOSSurfaceCreateInfoMVK-pView-04144# 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-VkMacOSSurfaceCreateInfoMVK-pView-01317# If @pView@ is an
--     @NSView@ object, it /must/ be a valid @NSView@, /must/ be backed by
--     a @CALayer@ object of type
--     'Vulkan.Extensions.VK_EXT_metal_surface.CAMetalLayer', and
--     'createMacOSSurfaceMVK' /must/ be called on the main thread
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkMacOSSurfaceCreateInfoMVK-sType-sType# @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK'
--
-- -   #VUID-VkMacOSSurfaceCreateInfoMVK-pNext-pNext# @pNext@ /must/ be
--     @NULL@
--
-- -   #VUID-VkMacOSSurfaceCreateInfoMVK-flags-zerobitmask# @flags@ /must/
--     be @0@
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_MVK_macos_surface VK_MVK_macos_surface>,
-- 'MacOSSurfaceCreateFlagsMVK',
-- 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'createMacOSSurfaceMVK'
data MacOSSurfaceCreateInfoMVK = MacOSSurfaceCreateInfoMVK
  { -- | @flags@ is reserved for future use.
    MacOSSurfaceCreateInfoMVK -> MacOSSurfaceCreateFlagsMVK
flags :: MacOSSurfaceCreateFlagsMVK
  , -- | @pView@ is a reference to either a
    -- 'Vulkan.Extensions.VK_EXT_metal_surface.CAMetalLayer' object or an
    -- @NSView@ object.
    MacOSSurfaceCreateInfoMVK -> Ptr ()
view :: Ptr ()
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (MacOSSurfaceCreateInfoMVK)
#endif
deriving instance Show MacOSSurfaceCreateInfoMVK

instance ToCStruct MacOSSurfaceCreateInfoMVK where
  withCStruct :: forall b.
MacOSSurfaceCreateInfoMVK
-> (("pCreateInfo" ::: Ptr MacOSSurfaceCreateInfoMVK) -> IO b)
-> IO b
withCStruct MacOSSurfaceCreateInfoMVK
x ("pCreateInfo" ::: Ptr MacOSSurfaceCreateInfoMVK) -> 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 MacOSSurfaceCreateInfoMVK
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pCreateInfo" ::: Ptr MacOSSurfaceCreateInfoMVK
p MacOSSurfaceCreateInfoMVK
x (("pCreateInfo" ::: Ptr MacOSSurfaceCreateInfoMVK) -> IO b
f "pCreateInfo" ::: Ptr MacOSSurfaceCreateInfoMVK
p)
  pokeCStruct :: forall b.
("pCreateInfo" ::: Ptr MacOSSurfaceCreateInfoMVK)
-> MacOSSurfaceCreateInfoMVK -> IO b -> IO b
pokeCStruct "pCreateInfo" ::: Ptr MacOSSurfaceCreateInfoMVK
p MacOSSurfaceCreateInfoMVK{Ptr ()
MacOSSurfaceCreateFlagsMVK
view :: Ptr ()
flags :: MacOSSurfaceCreateFlagsMVK
$sel:view:MacOSSurfaceCreateInfoMVK :: MacOSSurfaceCreateInfoMVK -> Ptr ()
$sel:flags:MacOSSurfaceCreateInfoMVK :: MacOSSurfaceCreateInfoMVK -> MacOSSurfaceCreateFlagsMVK
..} IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr MacOSSurfaceCreateInfoMVK
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr MacOSSurfaceCreateInfoMVK
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 MacOSSurfaceCreateInfoMVK
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr MacOSSurfaceCreateFlagsMVK)) (MacOSSurfaceCreateFlagsMVK
flags)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr MacOSSurfaceCreateInfoMVK
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 MacOSSurfaceCreateInfoMVK) -> IO b -> IO b
pokeZeroCStruct "pCreateInfo" ::: Ptr MacOSSurfaceCreateInfoMVK
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr MacOSSurfaceCreateInfoMVK
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr MacOSSurfaceCreateInfoMVK
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 MacOSSurfaceCreateInfoMVK
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 MacOSSurfaceCreateInfoMVK where
  peekCStruct :: ("pCreateInfo" ::: Ptr MacOSSurfaceCreateInfoMVK)
-> IO MacOSSurfaceCreateInfoMVK
peekCStruct "pCreateInfo" ::: Ptr MacOSSurfaceCreateInfoMVK
p = do
    MacOSSurfaceCreateFlagsMVK
flags <- forall a. Storable a => Ptr a -> IO a
peek @MacOSSurfaceCreateFlagsMVK (("pCreateInfo" ::: Ptr MacOSSurfaceCreateInfoMVK
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr MacOSSurfaceCreateFlagsMVK))
    Ptr ()
pView <- forall a. Storable a => Ptr a -> IO a
peek @(Ptr ()) (("pCreateInfo" ::: Ptr MacOSSurfaceCreateInfoMVK
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
$ MacOSSurfaceCreateFlagsMVK -> Ptr () -> MacOSSurfaceCreateInfoMVK
MacOSSurfaceCreateInfoMVK
             MacOSSurfaceCreateFlagsMVK
flags Ptr ()
pView

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

instance Zero MacOSSurfaceCreateInfoMVK where
  zero :: MacOSSurfaceCreateInfoMVK
zero = MacOSSurfaceCreateFlagsMVK -> Ptr () -> MacOSSurfaceCreateInfoMVK
MacOSSurfaceCreateInfoMVK
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero


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

conNameMacOSSurfaceCreateFlagsMVK :: String
conNameMacOSSurfaceCreateFlagsMVK :: String
conNameMacOSSurfaceCreateFlagsMVK = String
"MacOSSurfaceCreateFlagsMVK"

enumPrefixMacOSSurfaceCreateFlagsMVK :: String
enumPrefixMacOSSurfaceCreateFlagsMVK :: String
enumPrefixMacOSSurfaceCreateFlagsMVK = String
""

showTableMacOSSurfaceCreateFlagsMVK :: [(MacOSSurfaceCreateFlagsMVK, String)]
showTableMacOSSurfaceCreateFlagsMVK :: [(MacOSSurfaceCreateFlagsMVK, String)]
showTableMacOSSurfaceCreateFlagsMVK = []

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

type MVK_MACOS_SURFACE_SPEC_VERSION = 3

-- No documentation found for TopLevel "VK_MVK_MACOS_SURFACE_SPEC_VERSION"
pattern MVK_MACOS_SURFACE_SPEC_VERSION :: forall a . Integral a => a
pattern $bMVK_MACOS_SURFACE_SPEC_VERSION :: forall a. Integral a => a
$mMVK_MACOS_SURFACE_SPEC_VERSION :: forall {r} {a}.
Integral a =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
MVK_MACOS_SURFACE_SPEC_VERSION = 3


type MVK_MACOS_SURFACE_EXTENSION_NAME = "VK_MVK_macos_surface"

-- No documentation found for TopLevel "VK_MVK_MACOS_SURFACE_EXTENSION_NAME"
pattern MVK_MACOS_SURFACE_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bMVK_MACOS_SURFACE_EXTENSION_NAME :: forall a. (Eq a, IsString a) => a
$mMVK_MACOS_SURFACE_EXTENSION_NAME :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
MVK_MACOS_SURFACE_EXTENSION_NAME = "VK_MVK_macos_surface"