{-# language CPP #-}
-- | = Name
--
-- VK_EXT_direct_mode_display - instance extension
--
-- == VK_EXT_direct_mode_display
--
-- [__Name String__]
--     @VK_EXT_direct_mode_display@
--
-- [__Extension Type__]
--     Instance extension
--
-- [__Registered Extension Number__]
--     89
--
-- [__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_display VK_KHR_display>
--
-- [__Contact__]
--
--     -   James Jones
--         <https://github.com/KhronosGroup/Vulkan-Docs/issues/new?body=[VK_EXT_direct_mode_display] @cubanismo%0A*Here describe the issue or question you have about the VK_EXT_direct_mode_display extension* >
--
-- == Other Extension Metadata
--
-- [__Last Modified Date__]
--     2016-12-13
--
-- [__IP Status__]
--     No known IP claims.
--
-- [__Contributors__]
--
--     -   Pierre Boudier, NVIDIA
--
--     -   James Jones, NVIDIA
--
--     -   Damien Leone, NVIDIA
--
--     -   Pierre-Loup Griffais, Valve
--
--     -   Liam Middlebrook, NVIDIA
--
-- == Description
--
-- This is extension, along with related platform extensions, allows
-- applications to take exclusive control of displays associated with a
-- native windowing system. This is especially useful for virtual reality
-- applications that wish to hide HMDs (head mounted displays) from the
-- native platform’s display management system, desktop, and\/or other
-- applications.
--
-- == New Commands
--
-- -   'releaseDisplayEXT'
--
-- == New Enum Constants
--
-- -   'EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME'
--
-- -   'EXT_DIRECT_MODE_DISPLAY_SPEC_VERSION'
--
-- == Issues
--
-- 1) Should this extension and its related platform-specific extensions
-- leverage @VK_KHR_display@, or provide separate equivalent interfaces.
--
-- __RESOLVED__: Use @VK_KHR_display@ concepts and objects.
-- @VK_KHR_display@ can be used to enumerate all displays on the system,
-- including those attached to\/in use by a window system or native
-- platform, but @VK_KHR_display_swapchain@ will fail to create a swapchain
-- on in-use displays. This extension and its platform-specific children
-- will allow applications to grab in-use displays away from window systems
-- and\/or native platforms, allowing them to be used with
-- @VK_KHR_display_swapchain@.
--
-- 2) Are separate calls needed to acquire displays and enable direct mode?
--
-- __RESOLVED__: No, these operations happen in one combined command.
-- Acquiring a display puts it into direct mode.
--
-- == Version History
--
-- -   Revision 1, 2016-12-13 (James Jones)
--
--     -   Initial draft
--
-- == See Also
--
-- 'releaseDisplayEXT'
--
-- == Document Notes
--
-- For more information, see the
-- <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VK_EXT_direct_mode_display 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_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 Vulkan.Internal.Utils (traceAroundEvent)
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(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
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_direct_mode_display VK_EXT_direct_mode_display>,
-- 'Vulkan.Extensions.Handles.DisplayKHR',
-- 'Vulkan.Core10.Handles.PhysicalDevice'
releaseDisplayEXT :: forall io
                   . (MonadIO io)
                  => -- | @physicalDevice@ The physical device the display is on.
                     --
                     -- #VUID-vkReleaseDisplayEXT-physicalDevice-parameter# @physicalDevice@
                     -- /must/ be a valid 'Vulkan.Core10.Handles.PhysicalDevice' handle
                     PhysicalDevice
                  -> -- | @display@ The display to release control of.
                     --
                     -- #VUID-vkReleaseDisplayEXT-display-parameter# @display@ /must/ be a valid
                     -- 'Vulkan.Extensions.Handles.DisplayKHR' handle
                     --
                     -- #VUID-vkReleaseDisplayEXT-display-parent# @display@ /must/ have been
                     -- created, allocated, or retrieved from @physicalDevice@
                     DisplayKHR
                  -> io ()
releaseDisplayEXT :: forall (io :: * -> *).
MonadIO io =>
PhysicalDevice -> DisplayKHR -> io ()
releaseDisplayEXT PhysicalDevice
physicalDevice DisplayKHR
display = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO 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 (case PhysicalDevice
physicalDevice of PhysicalDevice{InstanceCmds
$sel:instanceCmds:PhysicalDevice :: PhysicalDevice -> InstanceCmds
instanceCmds :: InstanceCmds
instanceCmds} -> InstanceCmds
instanceCmds)
  forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr (Ptr PhysicalDevice_T -> DisplayKHR -> IO Result)
vkReleaseDisplayEXTPtr 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 vkReleaseDisplayEXT is null" forall a. Maybe a
Nothing 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
_ <- forall a. String -> IO a -> IO a
traceAroundEvent String
"vkReleaseDisplayEXT" (Ptr PhysicalDevice_T -> DisplayKHR -> IO Result
vkReleaseDisplayEXT'
                                                 (PhysicalDevice -> Ptr PhysicalDevice_T
physicalDeviceHandle (PhysicalDevice
physicalDevice))
                                                 (DisplayKHR
display))
  forall (f :: * -> *) a. Applicative f => a -> f a
pure 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 :: forall a. Integral a => a
$mEXT_DIRECT_MODE_DISPLAY_SPEC_VERSION :: forall {r} {a}.
Integral a =>
a -> ((# #) -> r) -> ((# #) -> 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 :: forall a. (Eq a, IsString a) => a
$mEXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME = "VK_EXT_direct_mode_display"