{-# language CPP #-}
module Vulkan.Extensions.VK_EXT_direct_mode_display  ( releaseDisplayEXT
                                                     , EXT_DIRECT_MODE_DISPLAY_SPEC_VERSION
                                                     , pattern EXT_DIRECT_MODE_DISPLAY_SPEC_VERSION
                                                     , EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME
                                                     , pattern EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME
                                                     , DisplayKHR(..)
                                                     ) where

import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import GHC.IO (throwIO)
import GHC.Ptr (nullFunPtr)
import Control.Monad.IO.Class (MonadIO)
import Data.String (IsString)
import GHC.IO.Exception (IOErrorType(..))
import GHC.IO.Exception (IOException(..))
import Foreign.Ptr (FunPtr)
import Foreign.Ptr (Ptr)
import Vulkan.Extensions.Handles (DisplayKHR)
import Vulkan.Extensions.Handles (DisplayKHR(..))
import Vulkan.Dynamic (InstanceCmds(pVkReleaseDisplayEXT))
import Vulkan.Core10.Handles (PhysicalDevice)
import Vulkan.Core10.Handles (PhysicalDevice(..))
import Vulkan.Core10.Handles (PhysicalDevice_T)
import Vulkan.Core10.Enums.Result (Result)
import Vulkan.Core10.Enums.Result (Result(..))
import Vulkan.Extensions.Handles (DisplayKHR(..))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkReleaseDisplayEXT
  :: FunPtr (Ptr PhysicalDevice_T -> DisplayKHR -> IO Result) -> Ptr PhysicalDevice_T -> DisplayKHR -> IO Result

-- | vkReleaseDisplayEXT - Release access to an acquired VkDisplayKHR
--
-- == Return Codes
--
-- [<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#fundamentals-successcodes Success>]
--
--     -   'Vulkan.Core10.Enums.Result.SUCCESS'
--
-- = See Also
--
-- 'Vulkan.Extensions.Handles.DisplayKHR',
-- 'Vulkan.Core10.Handles.PhysicalDevice'
releaseDisplayEXT :: forall io
                   . (MonadIO io)
                  => -- | @physicalDevice@ The physical device the display is on.
                     --
                     -- @physicalDevice@ /must/ be a valid
                     -- 'Vulkan.Core10.Handles.PhysicalDevice' handle
                     PhysicalDevice
                  -> -- | @display@ The display to release control of.
                     --
                     -- @display@ /must/ be a valid 'Vulkan.Extensions.Handles.DisplayKHR'
                     -- handle
                     --
                     -- @display@ /must/ have been created, allocated, or retrieved from
                     -- @physicalDevice@
                     DisplayKHR
                  -> io ()
releaseDisplayEXT :: PhysicalDevice -> DisplayKHR -> io ()
releaseDisplayEXT physicalDevice :: PhysicalDevice
physicalDevice display :: DisplayKHR
display = IO () -> io ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> io ()) -> IO () -> io ()
forall a b. (a -> b) -> a -> b
$ do
  let vkReleaseDisplayEXTPtr :: FunPtr (Ptr PhysicalDevice_T -> DisplayKHR -> IO Result)
vkReleaseDisplayEXTPtr = InstanceCmds
-> FunPtr (Ptr PhysicalDevice_T -> DisplayKHR -> IO Result)
pVkReleaseDisplayEXT (PhysicalDevice -> InstanceCmds
instanceCmds (PhysicalDevice
physicalDevice :: PhysicalDevice))
  Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr (Ptr PhysicalDevice_T -> DisplayKHR -> IO Result)
vkReleaseDisplayEXTPtr FunPtr (Ptr PhysicalDevice_T -> DisplayKHR -> IO Result)
-> FunPtr (Ptr PhysicalDevice_T -> DisplayKHR -> IO Result) -> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr (Ptr PhysicalDevice_T -> DisplayKHR -> IO Result)
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
    IOException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument "" "The function pointer for vkReleaseDisplayEXT is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkReleaseDisplayEXT' :: Ptr PhysicalDevice_T -> DisplayKHR -> IO Result
vkReleaseDisplayEXT' = FunPtr (Ptr PhysicalDevice_T -> DisplayKHR -> IO Result)
-> Ptr PhysicalDevice_T -> DisplayKHR -> IO Result
mkVkReleaseDisplayEXT FunPtr (Ptr PhysicalDevice_T -> DisplayKHR -> IO Result)
vkReleaseDisplayEXTPtr
  Result
_ <- Ptr PhysicalDevice_T -> DisplayKHR -> IO Result
vkReleaseDisplayEXT' (PhysicalDevice -> Ptr PhysicalDevice_T
physicalDeviceHandle (PhysicalDevice
physicalDevice)) (DisplayKHR
display)
  () -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure (() -> IO ()) -> () -> IO ()
forall a b. (a -> b) -> a -> b
$ ()


type EXT_DIRECT_MODE_DISPLAY_SPEC_VERSION = 1

-- No documentation found for TopLevel "VK_EXT_DIRECT_MODE_DISPLAY_SPEC_VERSION"
pattern EXT_DIRECT_MODE_DISPLAY_SPEC_VERSION :: forall a . Integral a => a
pattern $bEXT_DIRECT_MODE_DISPLAY_SPEC_VERSION :: a
$mEXT_DIRECT_MODE_DISPLAY_SPEC_VERSION :: forall r a. Integral a => a -> (Void# -> r) -> (Void# -> r) -> r
EXT_DIRECT_MODE_DISPLAY_SPEC_VERSION = 1


type EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME = "VK_EXT_direct_mode_display"

-- No documentation found for TopLevel "VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME"
pattern EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bEXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME :: a
$mEXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME :: forall r a.
(Eq a, IsString a) =>
a -> (Void# -> r) -> (Void# -> r) -> r
EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME = "VK_EXT_direct_mode_display"