{-# language CPP #-}
-- | = Name
--
-- VK_EXT_depth_clamp_control - device extension
--
-- = VK_EXT_depth_clamp_control
--
-- [__Name String__]
--     @VK_EXT_depth_clamp_control@
--
-- [__Extension Type__]
--     Device extension
--
-- [__Registered Extension Number__]
--     583
--
-- [__Revision__]
--     1
--
-- [__Ratification Status__]
--     Ratified
--
-- [__Extension and Version Dependencies__]
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_get_physical_device_properties2 VK_KHR_get_physical_device_properties2>
--     or
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#versions-1.1 Vulkan Version 1.1>
--
-- [__Contact__]
--
--     -   Jules Blok
--         <https://github.com/KhronosGroup/Vulkan-Docs/issues/new?body=[VK_EXT_depth_clamp_control] @jules%0A*Here describe the issue or question you have about the VK_EXT_depth_clamp_control extension* >
--
-- [__Extension Proposal__]
--     <https://github.com/KhronosGroup/Vulkan-Docs/tree/main/proposals/VK_EXT_depth_clamp_control.adoc VK_EXT_depth_clamp_control>
--
-- == Other Extension Metadata
--
-- [__Last Modified Date__]
--     2024-07-15
--
-- [__Contributors__]
--
--     -   Jules Blok, Independent
--
-- == Description
--
-- This extension allows the application to control the viewport depth
-- clamp range separately from the viewport @minDepth@ and @maxDepth@. This
-- gives the ability for the application to restrict depth values to an
-- application-defined range rather than the viewport depth range or the
-- range defined in the
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_depth_clamp_zero_one VK_EXT_depth_clamp_zero_one>
-- extension.
--
-- It can be used to set a smaller or larger clamping range than the
-- viewport depth range without affecting the depth mapping of the viewport
-- transform. Another possible use of this extension is to restrict depth
-- values beyond the viewport depth range to a clamping range other than
-- the [0, 1] range defined in the
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_depth_clamp_zero_one VK_EXT_depth_clamp_zero_one>
-- extension.
--
-- == New Commands
--
-- -   'cmdSetDepthClampRangeEXT'
--
-- == New Structures
--
-- -   'DepthClampRangeEXT'
--
-- -   Extending
--     'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceFeatures2',
--     'Vulkan.Core10.Device.DeviceCreateInfo':
--
--     -   'PhysicalDeviceDepthClampControlFeaturesEXT'
--
-- -   Extending
--     'Vulkan.Core10.GraphicsPipeline.PipelineViewportStateCreateInfo':
--
--     -   'PipelineViewportDepthClampControlCreateInfoEXT'
--
-- == New Enums
--
-- -   'DepthClampModeEXT'
--
-- == New Enum Constants
--
-- -   'EXT_DEPTH_CLAMP_CONTROL_EXTENSION_NAME'
--
-- -   'EXT_DEPTH_CLAMP_CONTROL_SPEC_VERSION'
--
-- -   Extending 'Vulkan.Core10.Enums.DynamicState.DynamicState':
--
--     -   'Vulkan.Core10.Enums.DynamicState.DYNAMIC_STATE_DEPTH_CLAMP_RANGE_EXT'
--
-- -   Extending 'Vulkan.Core10.Enums.StructureType.StructureType':
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLAMP_CONTROL_FEATURES_EXT'
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_PIPELINE_VIEWPORT_DEPTH_CLAMP_CONTROL_CREATE_INFO_EXT'
--
-- == Issues
--
-- 1) Should the depth clamp range be a per-viewport parameter?
--
-- __RESOLVED__: No. Because the depth clamp range was previously defined
-- to be equal to the viewport depth range, conformant runtimes are already
-- handling the depth clamp range as a per-viewport parameter. However
-- because of complexities from interactions with multiple viewports a
-- per-viewport clamp range is left to a future extensions if a use case
-- arises.
--
-- 2) Should this pipeline state be dynamic?
--
-- __RESOLVED__: Yes. Since the viewport depth range can already be a
-- dynamic state conformant runtimes are already able to handle the depth
-- clamp range as a dynamic state.
--
-- 3) Can the depth clamp range be ignored when depth clamping is disabled?
--
-- __RESOLVED__: Yes. This extension overrides the clamping range used only
-- when depth clamping is enabled. The alternative would be highly
-- unintuitive. As a consequence the
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_depth_clip_enable VK_EXT_depth_clip_enable>
-- extension is required if depth clipping is desired in combination with
-- this extension.
--
-- == Version History
--
-- -   Revision 1, 2024-02-13 (Jules Blok)
--
--     -   Initial draft
--
-- == See Also
--
-- No cross-references are available
--
-- == Document Notes
--
-- For more information, see the
-- <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#VK_EXT_depth_clamp_control 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_depth_clamp_control  ( cmdSetDepthClampRangeEXT
                                                     , PhysicalDeviceDepthClampControlFeaturesEXT(..)
                                                     , PipelineViewportDepthClampControlCreateInfoEXT(..)
                                                     , DepthClampRangeEXT(..)
                                                     , DepthClampModeEXT( DEPTH_CLAMP_MODE_VIEWPORT_RANGE_EXT
                                                                        , DEPTH_CLAMP_MODE_USER_DEFINED_RANGE_EXT
                                                                        , ..
                                                                        )
                                                     , EXT_DEPTH_CLAMP_CONTROL_SPEC_VERSION
                                                     , pattern EXT_DEPTH_CLAMP_CONTROL_SPEC_VERSION
                                                     , EXT_DEPTH_CLAMP_CONTROL_EXTENSION_NAME
                                                     , pattern EXT_DEPTH_CLAMP_CONTROL_EXTENSION_NAME
                                                     ) where

import Vulkan.Internal.Utils (enumReadPrec)
import Vulkan.Internal.Utils (enumShowsPrec)
import Vulkan.Internal.Utils (traceAroundEvent)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Foreign.Marshal.Alloc (allocaBytes)
import Foreign.Marshal.Utils (maybePeek)
import GHC.IO (throwIO)
import GHC.Ptr (nullFunPtr)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import GHC.Show (showsPrec)
import Data.Coerce (coerce)
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.C.Types (CFloat)
import Foreign.C.Types (CFloat(..))
import Foreign.C.Types (CFloat(CFloat))
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 Data.Int (Int32)
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.Core10.FundamentalTypes (bool32ToBool)
import Vulkan.Core10.FundamentalTypes (boolToBool32)
import Vulkan.NamedType ((:::))
import Vulkan.Core10.FundamentalTypes (Bool32)
import Vulkan.Core10.Handles (CommandBuffer)
import Vulkan.Core10.Handles (CommandBuffer(..))
import Vulkan.Core10.Handles (CommandBuffer(CommandBuffer))
import Vulkan.Core10.Handles (CommandBuffer_T)
import Vulkan.Dynamic (DeviceCmds(pVkCmdSetDepthClampRangeEXT))
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLAMP_CONTROL_FEATURES_EXT))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PIPELINE_VIEWPORT_DEPTH_CLAMP_CONTROL_CREATE_INFO_EXT))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkCmdSetDepthClampRangeEXT
  :: FunPtr (Ptr CommandBuffer_T -> DepthClampModeEXT -> Ptr DepthClampRangeEXT -> IO ()) -> Ptr CommandBuffer_T -> DepthClampModeEXT -> Ptr DepthClampRangeEXT -> IO ()

-- | vkCmdSetDepthClampRangeEXT - Set the viewport depth clamp range
-- dynamically for a command buffer
--
-- = Description
--
-- This command sets the viewport depth clamp range for subsequent drawing
-- commands when drawing using
-- <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#shaders-objects shader objects>,
-- or when the graphics pipeline is created with
-- 'Vulkan.Core10.Enums.DynamicState.DYNAMIC_STATE_DEPTH_CLAMP_RANGE_EXT'
-- set in
-- 'Vulkan.Core10.GraphicsPipeline.PipelineDynamicStateCreateInfo'::@pDynamicStates@.
-- Otherwise, this state is specified by the
-- 'PipelineViewportDepthClampControlCreateInfoEXT'::@depthClampMode@ value
-- used to create the currently active pipeline.
--
-- == Valid Usage
--
-- -   #VUID-vkCmdSetDepthClampRangeEXT-pDepthClampRange-09647# If
--     @depthClampMode@ is 'DEPTH_CLAMP_MODE_USER_DEFINED_RANGE_EXT', then
--     @pDepthClampRange@ must be a valid pointer to a valid
--     'DepthClampRangeEXT' structure
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-vkCmdSetDepthClampRangeEXT-commandBuffer-parameter#
--     @commandBuffer@ /must/ be a valid
--     'Vulkan.Core10.Handles.CommandBuffer' handle
--
-- -   #VUID-vkCmdSetDepthClampRangeEXT-depthClampMode-parameter#
--     @depthClampMode@ /must/ be a valid 'DepthClampModeEXT' value
--
-- -   #VUID-vkCmdSetDepthClampRangeEXT-pDepthClampRange-parameter# If
--     @pDepthClampRange@ is not @NULL@, @pDepthClampRange@ /must/ be a
--     valid pointer to a valid 'DepthClampRangeEXT' structure
--
-- -   #VUID-vkCmdSetDepthClampRangeEXT-commandBuffer-recording#
--     @commandBuffer@ /must/ be in the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#commandbuffers-lifecycle recording state>
--
-- -   #VUID-vkCmdSetDepthClampRangeEXT-commandBuffer-cmdpool# The
--     'Vulkan.Core10.Handles.CommandPool' that @commandBuffer@ was
--     allocated from /must/ support
--     'Vulkan.Core10.Enums.QueueFlagBits.QUEUE_GRAPHICS_BIT' operations
--
-- -   #VUID-vkCmdSetDepthClampRangeEXT-videocoding# This command /must/
--     only be called outside of a video coding scope
--
-- == Host Synchronization
--
-- -   Host access to @commandBuffer@ /must/ be externally synchronized
--
-- -   Host access to the 'Vulkan.Core10.Handles.CommandPool' that
--     @commandBuffer@ was allocated from /must/ be externally synchronized
--
-- == Command Properties
--
-- \'
--
-- +----------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
-- | <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VkCommandBufferLevel Command Buffer Levels> | <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#vkCmdBeginRenderPass Render Pass Scope> | <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#vkCmdBeginVideoCodingKHR Video Coding Scope> | <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VkQueueFlagBits Supported Queue Types> | <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#fundamentals-queueoperation-command-types Command Type> |
-- +============================================================================================================================+========================================================================================================================+=============================================================================================================================+=======================================================================================================================+========================================================================================================================================+
-- | Primary                                                                                                                    | Both                                                                                                                   | Outside                                                                                                                     | VK_QUEUE_GRAPHICS_BIT                                                                                                 | State                                                                                                                                  |
-- | Secondary                                                                                                                  |                                                                                                                        |                                                                                                                             |                                                                                                                       |                                                                                                                                        |
-- +----------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
--
-- == Conditional Rendering
--
-- vkCmdSetDepthClampRangeEXT is not affected by
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#drawing-conditional-rendering conditional rendering>
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_depth_clamp_control VK_EXT_depth_clamp_control>,
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_shader_object VK_EXT_shader_object>,
-- 'Vulkan.Core10.Handles.CommandBuffer', 'DepthClampModeEXT',
-- 'DepthClampRangeEXT'
cmdSetDepthClampRangeEXT :: forall io
                          . (MonadIO io)
                         => -- | @commandBuffer@ is the command buffer into which the command will be
                            -- recorded.
                            CommandBuffer
                         -> -- | @depthClampMode@ determines how the clamp range is determined for each
                            -- viewport.
                            DepthClampModeEXT
                         -> -- | @pDepthClampRange@ sets the depth clamp range for all viewports if
                            -- @depthClampMode@ is 'DEPTH_CLAMP_MODE_USER_DEFINED_RANGE_EXT'.
                            ("depthClampRange" ::: Maybe DepthClampRangeEXT)
                         -> io ()
cmdSetDepthClampRangeEXT :: forall (io :: * -> *).
MonadIO io =>
CommandBuffer
-> DepthClampModeEXT
-> ("depthClampRange" ::: Maybe DepthClampRangeEXT)
-> io ()
cmdSetDepthClampRangeEXT CommandBuffer
commandBuffer
                           DepthClampModeEXT
depthClampMode
                           "depthClampRange" ::: Maybe DepthClampRangeEXT
depthClampRange = IO () -> io ()
forall a. IO a -> io a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> io ())
-> (ContT () IO () -> IO ()) -> ContT () IO () -> io ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT () IO () -> IO ()
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT () IO () -> io ()) -> ContT () IO () -> io ()
forall a b. (a -> b) -> a -> b
$ do
  let vkCmdSetDepthClampRangeEXTPtr :: FunPtr
  (Ptr CommandBuffer_T
   -> DepthClampModeEXT -> Ptr DepthClampRangeEXT -> IO ())
vkCmdSetDepthClampRangeEXTPtr = DeviceCmds
-> FunPtr
     (Ptr CommandBuffer_T
      -> DepthClampModeEXT -> Ptr DepthClampRangeEXT -> IO ())
pVkCmdSetDepthClampRangeEXT (case CommandBuffer
commandBuffer of CommandBuffer{DeviceCmds
deviceCmds :: DeviceCmds
deviceCmds :: CommandBuffer -> DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
  IO () -> ContT () IO ()
forall (m :: * -> *) a. Monad m => m a -> ContT () m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT () IO ()) -> IO () -> ContT () IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr CommandBuffer_T
   -> DepthClampModeEXT -> Ptr DepthClampRangeEXT -> IO ())
vkCmdSetDepthClampRangeEXTPtr FunPtr
  (Ptr CommandBuffer_T
   -> DepthClampModeEXT -> Ptr DepthClampRangeEXT -> IO ())
-> FunPtr
     (Ptr CommandBuffer_T
      -> DepthClampModeEXT -> Ptr DepthClampRangeEXT -> IO ())
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr CommandBuffer_T
   -> DepthClampModeEXT -> Ptr DepthClampRangeEXT -> IO ())
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
    IOException -> IO ()
forall e a. (HasCallStack, 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 String
"" String
"The function pointer for vkCmdSetDepthClampRangeEXT is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkCmdSetDepthClampRangeEXT' :: Ptr CommandBuffer_T
-> DepthClampModeEXT -> Ptr DepthClampRangeEXT -> IO ()
vkCmdSetDepthClampRangeEXT' = FunPtr
  (Ptr CommandBuffer_T
   -> DepthClampModeEXT -> Ptr DepthClampRangeEXT -> IO ())
-> Ptr CommandBuffer_T
-> DepthClampModeEXT
-> Ptr DepthClampRangeEXT
-> IO ()
mkVkCmdSetDepthClampRangeEXT FunPtr
  (Ptr CommandBuffer_T
   -> DepthClampModeEXT -> Ptr DepthClampRangeEXT -> IO ())
vkCmdSetDepthClampRangeEXTPtr
  pDepthClampRange <- case ("depthClampRange" ::: Maybe DepthClampRangeEXT
depthClampRange) of
    "depthClampRange" ::: Maybe DepthClampRangeEXT
Nothing -> Ptr DepthClampRangeEXT -> ContT () IO (Ptr DepthClampRangeEXT)
forall a. a -> ContT () IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Ptr DepthClampRangeEXT
forall a. Ptr a
nullPtr
    Just DepthClampRangeEXT
j -> ((Ptr DepthClampRangeEXT -> IO ()) -> IO ())
-> ContT () IO (Ptr DepthClampRangeEXT)
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr DepthClampRangeEXT -> IO ()) -> IO ())
 -> ContT () IO (Ptr DepthClampRangeEXT))
-> ((Ptr DepthClampRangeEXT -> IO ()) -> IO ())
-> ContT () IO (Ptr DepthClampRangeEXT)
forall a b. (a -> b) -> a -> b
$ DepthClampRangeEXT -> (Ptr DepthClampRangeEXT -> IO ()) -> IO ()
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
forall b.
DepthClampRangeEXT -> (Ptr DepthClampRangeEXT -> IO b) -> IO b
withCStruct (DepthClampRangeEXT
j)
  lift $ traceAroundEvent "vkCmdSetDepthClampRangeEXT" (vkCmdSetDepthClampRangeEXT'
                                                          (commandBufferHandle (commandBuffer))
                                                          (depthClampMode)
                                                          pDepthClampRange)
  pure $ ()


-- | VkPhysicalDeviceDepthClampControlFeaturesEXT - Structure describing
-- additional depth clamp control supported by an implementation
--
-- = Members
--
-- This structure describes the following feature:
--
-- = Description
--
-- If the 'PhysicalDeviceDepthClampControlFeaturesEXT' structure is
-- included in the @pNext@ chain of the
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceFeatures2'
-- structure passed to
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.getPhysicalDeviceFeatures2',
-- it is filled in to indicate whether each corresponding feature is
-- supported. If the application wishes to use a
-- 'Vulkan.Core10.Handles.Device' with any features described by
-- 'PhysicalDeviceDepthClampControlFeaturesEXT', it /must/ add an instance
-- of the structure, with the desired feature members set to
-- 'Vulkan.Core10.FundamentalTypes.TRUE', to the @pNext@ chain of
-- 'Vulkan.Core10.Device.DeviceCreateInfo' when creating the
-- 'Vulkan.Core10.Handles.Device'.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_depth_clamp_control VK_EXT_depth_clamp_control>,
-- 'Vulkan.Core10.FundamentalTypes.Bool32',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PhysicalDeviceDepthClampControlFeaturesEXT = PhysicalDeviceDepthClampControlFeaturesEXT
  { -- | #features-depthClampControl# @depthClampControl@ indicates that the
    -- implementation supports setting
    -- 'PipelineViewportDepthClampControlCreateInfoEXT'::@depthClampMode@ to
    -- 'DEPTH_CLAMP_MODE_USER_DEFINED_RANGE_EXT'.
    PhysicalDeviceDepthClampControlFeaturesEXT -> Bool
depthClampControl :: Bool }
  deriving (Typeable, PhysicalDeviceDepthClampControlFeaturesEXT
-> PhysicalDeviceDepthClampControlFeaturesEXT -> Bool
(PhysicalDeviceDepthClampControlFeaturesEXT
 -> PhysicalDeviceDepthClampControlFeaturesEXT -> Bool)
-> (PhysicalDeviceDepthClampControlFeaturesEXT
    -> PhysicalDeviceDepthClampControlFeaturesEXT -> Bool)
-> Eq PhysicalDeviceDepthClampControlFeaturesEXT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PhysicalDeviceDepthClampControlFeaturesEXT
-> PhysicalDeviceDepthClampControlFeaturesEXT -> Bool
== :: PhysicalDeviceDepthClampControlFeaturesEXT
-> PhysicalDeviceDepthClampControlFeaturesEXT -> Bool
$c/= :: PhysicalDeviceDepthClampControlFeaturesEXT
-> PhysicalDeviceDepthClampControlFeaturesEXT -> Bool
/= :: PhysicalDeviceDepthClampControlFeaturesEXT
-> PhysicalDeviceDepthClampControlFeaturesEXT -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceDepthClampControlFeaturesEXT)
#endif
deriving instance Show PhysicalDeviceDepthClampControlFeaturesEXT

instance ToCStruct PhysicalDeviceDepthClampControlFeaturesEXT where
  withCStruct :: forall b.
PhysicalDeviceDepthClampControlFeaturesEXT
-> (Ptr PhysicalDeviceDepthClampControlFeaturesEXT -> IO b) -> IO b
withCStruct PhysicalDeviceDepthClampControlFeaturesEXT
x Ptr PhysicalDeviceDepthClampControlFeaturesEXT -> IO b
f = Int
-> (Ptr PhysicalDeviceDepthClampControlFeaturesEXT -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
24 ((Ptr PhysicalDeviceDepthClampControlFeaturesEXT -> IO b) -> IO b)
-> (Ptr PhysicalDeviceDepthClampControlFeaturesEXT -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr PhysicalDeviceDepthClampControlFeaturesEXT
p -> Ptr PhysicalDeviceDepthClampControlFeaturesEXT
-> PhysicalDeviceDepthClampControlFeaturesEXT -> IO b -> IO b
forall b.
Ptr PhysicalDeviceDepthClampControlFeaturesEXT
-> PhysicalDeviceDepthClampControlFeaturesEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceDepthClampControlFeaturesEXT
p PhysicalDeviceDepthClampControlFeaturesEXT
x (Ptr PhysicalDeviceDepthClampControlFeaturesEXT -> IO b
f Ptr PhysicalDeviceDepthClampControlFeaturesEXT
p)
  pokeCStruct :: forall b.
Ptr PhysicalDeviceDepthClampControlFeaturesEXT
-> PhysicalDeviceDepthClampControlFeaturesEXT -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceDepthClampControlFeaturesEXT
p PhysicalDeviceDepthClampControlFeaturesEXT{Bool
depthClampControl :: PhysicalDeviceDepthClampControlFeaturesEXT -> Bool
depthClampControl :: Bool
..} IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceDepthClampControlFeaturesEXT
p Ptr PhysicalDeviceDepthClampControlFeaturesEXT
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLAMP_CONTROL_FEATURES_EXT)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceDepthClampControlFeaturesEXT
p Ptr PhysicalDeviceDepthClampControlFeaturesEXT
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceDepthClampControlFeaturesEXT
p Ptr PhysicalDeviceDepthClampControlFeaturesEXT -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
depthClampControl))
    IO b
f
  cStructSize :: Int
cStructSize = Int
24
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b.
Ptr PhysicalDeviceDepthClampControlFeaturesEXT -> IO b -> IO b
pokeZeroCStruct Ptr PhysicalDeviceDepthClampControlFeaturesEXT
p IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceDepthClampControlFeaturesEXT
p Ptr PhysicalDeviceDepthClampControlFeaturesEXT
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLAMP_CONTROL_FEATURES_EXT)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceDepthClampControlFeaturesEXT
p Ptr PhysicalDeviceDepthClampControlFeaturesEXT
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceDepthClampControlFeaturesEXT
p Ptr PhysicalDeviceDepthClampControlFeaturesEXT -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
forall a. Zero a => a
zero))
    IO b
f

instance FromCStruct PhysicalDeviceDepthClampControlFeaturesEXT where
  peekCStruct :: Ptr PhysicalDeviceDepthClampControlFeaturesEXT
-> IO PhysicalDeviceDepthClampControlFeaturesEXT
peekCStruct Ptr PhysicalDeviceDepthClampControlFeaturesEXT
p = do
    depthClampControl <- forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PhysicalDeviceDepthClampControlFeaturesEXT
p Ptr PhysicalDeviceDepthClampControlFeaturesEXT -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32))
    pure $ PhysicalDeviceDepthClampControlFeaturesEXT
             (bool32ToBool depthClampControl)

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

instance Zero PhysicalDeviceDepthClampControlFeaturesEXT where
  zero :: PhysicalDeviceDepthClampControlFeaturesEXT
zero = Bool -> PhysicalDeviceDepthClampControlFeaturesEXT
PhysicalDeviceDepthClampControlFeaturesEXT
           Bool
forall a. Zero a => a
zero


-- | VkPipelineViewportDepthClampControlCreateInfoEXT - Structure specifying
-- parameters of a newly created pipeline depth clamp control state
--
-- = Description
--
-- This structure extends
-- 'Vulkan.Core10.GraphicsPipeline.PipelineViewportStateCreateInfo' and
-- specifies the depth clamp range used in the pipeline. If this structure
-- is not provided in the next chain then @depthClampMode@ defaults to
-- 'DEPTH_CLAMP_MODE_VIEWPORT_RANGE_EXT'.
--
-- == Valid Usage
--
-- -   #VUID-VkPipelineViewportDepthClampControlCreateInfoEXT-pDepthClampRange-09646#
--     If @depthClampMode@ is 'DEPTH_CLAMP_MODE_USER_DEFINED_RANGE_EXT',
--     and the pipeline is not created with
--     'Vulkan.Core10.Enums.DynamicState.DYNAMIC_STATE_DEPTH_CLAMP_RANGE_EXT',
--     then @pDepthClampRange@ /must/ be a valid pointer to a valid
--     'DepthClampRangeEXT' structure
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkPipelineViewportDepthClampControlCreateInfoEXT-sType-sType#
--     @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_PIPELINE_VIEWPORT_DEPTH_CLAMP_CONTROL_CREATE_INFO_EXT'
--
-- -   #VUID-VkPipelineViewportDepthClampControlCreateInfoEXT-depthClampMode-parameter#
--     @depthClampMode@ /must/ be a valid 'DepthClampModeEXT' value
--
-- -   #VUID-VkPipelineViewportDepthClampControlCreateInfoEXT-pDepthClampRange-parameter#
--     If @pDepthClampRange@ is not @NULL@, @pDepthClampRange@ /must/ be a
--     valid pointer to a valid 'DepthClampRangeEXT' structure
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_depth_clamp_control VK_EXT_depth_clamp_control>,
-- 'DepthClampModeEXT', 'DepthClampRangeEXT',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PipelineViewportDepthClampControlCreateInfoEXT = PipelineViewportDepthClampControlCreateInfoEXT
  { -- | @depthClampMode@ determines how the clamp range is determined for each
    -- viewport.
    PipelineViewportDepthClampControlCreateInfoEXT -> DepthClampModeEXT
depthClampMode :: DepthClampModeEXT
  , -- | @pDepthClampRange@ sets the depth clamp range for all viewports if
    -- @depthClampMode@ is 'DEPTH_CLAMP_MODE_USER_DEFINED_RANGE_EXT'.
    PipelineViewportDepthClampControlCreateInfoEXT
-> "depthClampRange" ::: Maybe DepthClampRangeEXT
depthClampRange :: Maybe DepthClampRangeEXT
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PipelineViewportDepthClampControlCreateInfoEXT)
#endif
deriving instance Show PipelineViewportDepthClampControlCreateInfoEXT

instance ToCStruct PipelineViewportDepthClampControlCreateInfoEXT where
  withCStruct :: forall b.
PipelineViewportDepthClampControlCreateInfoEXT
-> (Ptr PipelineViewportDepthClampControlCreateInfoEXT -> IO b)
-> IO b
withCStruct PipelineViewportDepthClampControlCreateInfoEXT
x Ptr PipelineViewportDepthClampControlCreateInfoEXT -> IO b
f = Int
-> (Ptr PipelineViewportDepthClampControlCreateInfoEXT -> IO b)
-> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
32 ((Ptr PipelineViewportDepthClampControlCreateInfoEXT -> IO b)
 -> IO b)
-> (Ptr PipelineViewportDepthClampControlCreateInfoEXT -> IO b)
-> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr PipelineViewportDepthClampControlCreateInfoEXT
p -> Ptr PipelineViewportDepthClampControlCreateInfoEXT
-> PipelineViewportDepthClampControlCreateInfoEXT -> IO b -> IO b
forall b.
Ptr PipelineViewportDepthClampControlCreateInfoEXT
-> PipelineViewportDepthClampControlCreateInfoEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PipelineViewportDepthClampControlCreateInfoEXT
p PipelineViewportDepthClampControlCreateInfoEXT
x (Ptr PipelineViewportDepthClampControlCreateInfoEXT -> IO b
f Ptr PipelineViewportDepthClampControlCreateInfoEXT
p)
  pokeCStruct :: forall b.
Ptr PipelineViewportDepthClampControlCreateInfoEXT
-> PipelineViewportDepthClampControlCreateInfoEXT -> IO b -> IO b
pokeCStruct Ptr PipelineViewportDepthClampControlCreateInfoEXT
p PipelineViewportDepthClampControlCreateInfoEXT{"depthClampRange" ::: Maybe DepthClampRangeEXT
DepthClampModeEXT
depthClampMode :: PipelineViewportDepthClampControlCreateInfoEXT -> DepthClampModeEXT
depthClampRange :: PipelineViewportDepthClampControlCreateInfoEXT
-> "depthClampRange" ::: Maybe DepthClampRangeEXT
depthClampMode :: DepthClampModeEXT
depthClampRange :: "depthClampRange" ::: Maybe DepthClampRangeEXT
..} IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
    IO () -> ContT b IO ()
forall (m :: * -> *) a. Monad m => m a -> ContT b m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineViewportDepthClampControlCreateInfoEXT
p Ptr PipelineViewportDepthClampControlCreateInfoEXT
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PIPELINE_VIEWPORT_DEPTH_CLAMP_CONTROL_CREATE_INFO_EXT)
    IO () -> ContT b IO ()
forall (m :: * -> *) a. Monad m => m a -> ContT b m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineViewportDepthClampControlCreateInfoEXT
p Ptr PipelineViewportDepthClampControlCreateInfoEXT
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    IO () -> ContT b IO ()
forall (m :: * -> *) a. Monad m => m a -> ContT b m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr DepthClampModeEXT -> DepthClampModeEXT -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineViewportDepthClampControlCreateInfoEXT
p Ptr PipelineViewportDepthClampControlCreateInfoEXT
-> Int -> Ptr DepthClampModeEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr DepthClampModeEXT)) (DepthClampModeEXT
depthClampMode)
    pDepthClampRange'' <- case ("depthClampRange" ::: Maybe DepthClampRangeEXT
depthClampRange) of
      "depthClampRange" ::: Maybe DepthClampRangeEXT
Nothing -> Ptr DepthClampRangeEXT -> ContT b IO (Ptr DepthClampRangeEXT)
forall a. a -> ContT b IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Ptr DepthClampRangeEXT
forall a. Ptr a
nullPtr
      Just DepthClampRangeEXT
j -> ((Ptr DepthClampRangeEXT -> IO b) -> IO b)
-> ContT b IO (Ptr DepthClampRangeEXT)
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr DepthClampRangeEXT -> IO b) -> IO b)
 -> ContT b IO (Ptr DepthClampRangeEXT))
-> ((Ptr DepthClampRangeEXT -> IO b) -> IO b)
-> ContT b IO (Ptr DepthClampRangeEXT)
forall a b. (a -> b) -> a -> b
$ DepthClampRangeEXT -> (Ptr DepthClampRangeEXT -> IO b) -> IO b
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
forall b.
DepthClampRangeEXT -> (Ptr DepthClampRangeEXT -> IO b) -> IO b
withCStruct (DepthClampRangeEXT
j)
    lift $ poke ((p `plusPtr` 24 :: Ptr (Ptr DepthClampRangeEXT))) pDepthClampRange''
    lift $ f
  cStructSize :: Int
cStructSize = Int
32
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b.
Ptr PipelineViewportDepthClampControlCreateInfoEXT -> IO b -> IO b
pokeZeroCStruct Ptr PipelineViewportDepthClampControlCreateInfoEXT
p IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineViewportDepthClampControlCreateInfoEXT
p Ptr PipelineViewportDepthClampControlCreateInfoEXT
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PIPELINE_VIEWPORT_DEPTH_CLAMP_CONTROL_CREATE_INFO_EXT)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineViewportDepthClampControlCreateInfoEXT
p Ptr PipelineViewportDepthClampControlCreateInfoEXT
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr DepthClampModeEXT -> DepthClampModeEXT -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineViewportDepthClampControlCreateInfoEXT
p Ptr PipelineViewportDepthClampControlCreateInfoEXT
-> Int -> Ptr DepthClampModeEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr DepthClampModeEXT)) (DepthClampModeEXT
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct PipelineViewportDepthClampControlCreateInfoEXT where
  peekCStruct :: Ptr PipelineViewportDepthClampControlCreateInfoEXT
-> IO PipelineViewportDepthClampControlCreateInfoEXT
peekCStruct Ptr PipelineViewportDepthClampControlCreateInfoEXT
p = do
    depthClampMode <- forall a. Storable a => Ptr a -> IO a
peek @DepthClampModeEXT ((Ptr PipelineViewportDepthClampControlCreateInfoEXT
p Ptr PipelineViewportDepthClampControlCreateInfoEXT
-> Int -> Ptr DepthClampModeEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr DepthClampModeEXT))
    pDepthClampRange <- peek @(Ptr DepthClampRangeEXT) ((p `plusPtr` 24 :: Ptr (Ptr DepthClampRangeEXT)))
    pDepthClampRange' <- maybePeek (\Ptr DepthClampRangeEXT
j -> forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @DepthClampRangeEXT (Ptr DepthClampRangeEXT
j)) pDepthClampRange
    pure $ PipelineViewportDepthClampControlCreateInfoEXT
             depthClampMode pDepthClampRange'

instance Zero PipelineViewportDepthClampControlCreateInfoEXT where
  zero :: PipelineViewportDepthClampControlCreateInfoEXT
zero = DepthClampModeEXT
-> ("depthClampRange" ::: Maybe DepthClampRangeEXT)
-> PipelineViewportDepthClampControlCreateInfoEXT
PipelineViewportDepthClampControlCreateInfoEXT
           DepthClampModeEXT
forall a. Zero a => a
zero
           "depthClampRange" ::: Maybe DepthClampRangeEXT
forall a. Maybe a
Nothing


-- | VkDepthClampRangeEXT - Structure specifying a depth clamp range
--
-- == Valid Usage
--
-- -   #VUID-VkDepthClampRangeEXT-pDepthClampRange-00999# @minDepthClamp@
--     /must/ be less than or equal to @maxDepthClamp@
--
-- -   #VUID-VkDepthClampRangeEXT-pDepthClampRange-09648# If the
--     @VK_EXT_depth_range_unrestricted@ extension is not enabled,
--     @minDepthClamp@ /must/ be greater than or equal to @0.0@
--
-- -   #VUID-VkDepthClampRangeEXT-pDepthClampRange-09649# If the
--     @VK_EXT_depth_range_unrestricted@ extension is not enabled,
--     @maxDepthClamp@ /must/ be less than or equal to @1.0@
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_depth_clamp_control VK_EXT_depth_clamp_control>,
-- 'PipelineViewportDepthClampControlCreateInfoEXT',
-- 'cmdSetDepthClampRangeEXT'
data DepthClampRangeEXT = DepthClampRangeEXT
  { -- | @minDepthClamp@ sets zmin in the depth clamp range of the viewport.
    DepthClampRangeEXT -> Float
minDepthClamp :: Float
  , -- | @maxDepthClamp@ sets zmax in the depth clamp range of the viewport.
    DepthClampRangeEXT -> Float
maxDepthClamp :: Float
  }
  deriving (Typeable, DepthClampRangeEXT -> DepthClampRangeEXT -> Bool
(DepthClampRangeEXT -> DepthClampRangeEXT -> Bool)
-> (DepthClampRangeEXT -> DepthClampRangeEXT -> Bool)
-> Eq DepthClampRangeEXT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DepthClampRangeEXT -> DepthClampRangeEXT -> Bool
== :: DepthClampRangeEXT -> DepthClampRangeEXT -> Bool
$c/= :: DepthClampRangeEXT -> DepthClampRangeEXT -> Bool
/= :: DepthClampRangeEXT -> DepthClampRangeEXT -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (DepthClampRangeEXT)
#endif
deriving instance Show DepthClampRangeEXT

instance ToCStruct DepthClampRangeEXT where
  withCStruct :: forall b.
DepthClampRangeEXT -> (Ptr DepthClampRangeEXT -> IO b) -> IO b
withCStruct DepthClampRangeEXT
x Ptr DepthClampRangeEXT -> IO b
f = Int -> (Ptr DepthClampRangeEXT -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
8 ((Ptr DepthClampRangeEXT -> IO b) -> IO b)
-> (Ptr DepthClampRangeEXT -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr DepthClampRangeEXT
p -> Ptr DepthClampRangeEXT -> DepthClampRangeEXT -> IO b -> IO b
forall b.
Ptr DepthClampRangeEXT -> DepthClampRangeEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr DepthClampRangeEXT
p DepthClampRangeEXT
x (Ptr DepthClampRangeEXT -> IO b
f Ptr DepthClampRangeEXT
p)
  pokeCStruct :: forall b.
Ptr DepthClampRangeEXT -> DepthClampRangeEXT -> IO b -> IO b
pokeCStruct Ptr DepthClampRangeEXT
p DepthClampRangeEXT{Float
minDepthClamp :: DepthClampRangeEXT -> Float
maxDepthClamp :: DepthClampRangeEXT -> Float
minDepthClamp :: Float
maxDepthClamp :: Float
..} IO b
f = do
    Ptr CFloat -> CFloat -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DepthClampRangeEXT
p Ptr DepthClampRangeEXT -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr CFloat)) (Float -> CFloat
CFloat (Float
minDepthClamp))
    Ptr CFloat -> CFloat -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DepthClampRangeEXT
p Ptr DepthClampRangeEXT -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4 :: Ptr CFloat)) (Float -> CFloat
CFloat (Float
maxDepthClamp))
    IO b
f
  cStructSize :: Int
cStructSize = Int
8
  cStructAlignment :: Int
cStructAlignment = Int
4
  pokeZeroCStruct :: forall b. Ptr DepthClampRangeEXT -> IO b -> IO b
pokeZeroCStruct Ptr DepthClampRangeEXT
p IO b
f = do
    Ptr CFloat -> CFloat -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DepthClampRangeEXT
p Ptr DepthClampRangeEXT -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr CFloat)) (Float -> CFloat
CFloat (Float
forall a. Zero a => a
zero))
    Ptr CFloat -> CFloat -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DepthClampRangeEXT
p Ptr DepthClampRangeEXT -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4 :: Ptr CFloat)) (Float -> CFloat
CFloat (Float
forall a. Zero a => a
zero))
    IO b
f

instance FromCStruct DepthClampRangeEXT where
  peekCStruct :: Ptr DepthClampRangeEXT -> IO DepthClampRangeEXT
peekCStruct Ptr DepthClampRangeEXT
p = do
    minDepthClamp <- forall a. Storable a => Ptr a -> IO a
peek @CFloat ((Ptr DepthClampRangeEXT
p Ptr DepthClampRangeEXT -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr CFloat))
    maxDepthClamp <- peek @CFloat ((p `plusPtr` 4 :: Ptr CFloat))
    pure $ DepthClampRangeEXT
             (coerce @CFloat @Float minDepthClamp)
             (coerce @CFloat @Float maxDepthClamp)

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

instance Zero DepthClampRangeEXT where
  zero :: DepthClampRangeEXT
zero = Float -> Float -> DepthClampRangeEXT
DepthClampRangeEXT
           Float
forall a. Zero a => a
zero
           Float
forall a. Zero a => a
zero


-- | VkDepthClampModeEXT - Modes that determine the depth clamp range
--
-- = Description
--
-- -   'DEPTH_CLAMP_MODE_VIEWPORT_RANGE_EXT' specifies that the depth clamp
--     range follows the viewport depth range. The depth clamp range of
--     each viewport will implicitly be set to zmin = min(n,f) and zmax =
--     max(n,f), where n and f are the @minDepth@ and @maxDepth@ depth
--     range values of the viewport.
--
-- -   'DEPTH_CLAMP_MODE_USER_DEFINED_RANGE_EXT' specifies that a single
--     user-defined depth clamp range will be used for all viewports. The
--     user-defined depth clamp range is defined by the @minDepthClamp@ and
--     @maxDepthClamp@ members of 'DepthClampRangeEXT'.
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_depth_clamp_control VK_EXT_depth_clamp_control>,
-- 'PipelineViewportDepthClampControlCreateInfoEXT',
-- 'cmdSetDepthClampRangeEXT'
newtype DepthClampModeEXT = DepthClampModeEXT Int32
  deriving newtype (DepthClampModeEXT -> DepthClampModeEXT -> Bool
(DepthClampModeEXT -> DepthClampModeEXT -> Bool)
-> (DepthClampModeEXT -> DepthClampModeEXT -> Bool)
-> Eq DepthClampModeEXT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DepthClampModeEXT -> DepthClampModeEXT -> Bool
== :: DepthClampModeEXT -> DepthClampModeEXT -> Bool
$c/= :: DepthClampModeEXT -> DepthClampModeEXT -> Bool
/= :: DepthClampModeEXT -> DepthClampModeEXT -> Bool
Eq, Eq DepthClampModeEXT
Eq DepthClampModeEXT =>
(DepthClampModeEXT -> DepthClampModeEXT -> Ordering)
-> (DepthClampModeEXT -> DepthClampModeEXT -> Bool)
-> (DepthClampModeEXT -> DepthClampModeEXT -> Bool)
-> (DepthClampModeEXT -> DepthClampModeEXT -> Bool)
-> (DepthClampModeEXT -> DepthClampModeEXT -> Bool)
-> (DepthClampModeEXT -> DepthClampModeEXT -> DepthClampModeEXT)
-> (DepthClampModeEXT -> DepthClampModeEXT -> DepthClampModeEXT)
-> Ord DepthClampModeEXT
DepthClampModeEXT -> DepthClampModeEXT -> Bool
DepthClampModeEXT -> DepthClampModeEXT -> Ordering
DepthClampModeEXT -> DepthClampModeEXT -> DepthClampModeEXT
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
$ccompare :: DepthClampModeEXT -> DepthClampModeEXT -> Ordering
compare :: DepthClampModeEXT -> DepthClampModeEXT -> Ordering
$c< :: DepthClampModeEXT -> DepthClampModeEXT -> Bool
< :: DepthClampModeEXT -> DepthClampModeEXT -> Bool
$c<= :: DepthClampModeEXT -> DepthClampModeEXT -> Bool
<= :: DepthClampModeEXT -> DepthClampModeEXT -> Bool
$c> :: DepthClampModeEXT -> DepthClampModeEXT -> Bool
> :: DepthClampModeEXT -> DepthClampModeEXT -> Bool
$c>= :: DepthClampModeEXT -> DepthClampModeEXT -> Bool
>= :: DepthClampModeEXT -> DepthClampModeEXT -> Bool
$cmax :: DepthClampModeEXT -> DepthClampModeEXT -> DepthClampModeEXT
max :: DepthClampModeEXT -> DepthClampModeEXT -> DepthClampModeEXT
$cmin :: DepthClampModeEXT -> DepthClampModeEXT -> DepthClampModeEXT
min :: DepthClampModeEXT -> DepthClampModeEXT -> DepthClampModeEXT
Ord, Ptr DepthClampModeEXT -> IO DepthClampModeEXT
Ptr DepthClampModeEXT -> Int -> IO DepthClampModeEXT
Ptr DepthClampModeEXT -> Int -> DepthClampModeEXT -> IO ()
Ptr DepthClampModeEXT -> DepthClampModeEXT -> IO ()
DepthClampModeEXT -> Int
(DepthClampModeEXT -> Int)
-> (DepthClampModeEXT -> Int)
-> (Ptr DepthClampModeEXT -> Int -> IO DepthClampModeEXT)
-> (Ptr DepthClampModeEXT -> Int -> DepthClampModeEXT -> IO ())
-> (forall b. Ptr b -> Int -> IO DepthClampModeEXT)
-> (forall b. Ptr b -> Int -> DepthClampModeEXT -> IO ())
-> (Ptr DepthClampModeEXT -> IO DepthClampModeEXT)
-> (Ptr DepthClampModeEXT -> DepthClampModeEXT -> IO ())
-> Storable DepthClampModeEXT
forall b. Ptr b -> Int -> IO DepthClampModeEXT
forall b. Ptr b -> Int -> DepthClampModeEXT -> 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
$csizeOf :: DepthClampModeEXT -> Int
sizeOf :: DepthClampModeEXT -> Int
$calignment :: DepthClampModeEXT -> Int
alignment :: DepthClampModeEXT -> Int
$cpeekElemOff :: Ptr DepthClampModeEXT -> Int -> IO DepthClampModeEXT
peekElemOff :: Ptr DepthClampModeEXT -> Int -> IO DepthClampModeEXT
$cpokeElemOff :: Ptr DepthClampModeEXT -> Int -> DepthClampModeEXT -> IO ()
pokeElemOff :: Ptr DepthClampModeEXT -> Int -> DepthClampModeEXT -> IO ()
$cpeekByteOff :: forall b. Ptr b -> Int -> IO DepthClampModeEXT
peekByteOff :: forall b. Ptr b -> Int -> IO DepthClampModeEXT
$cpokeByteOff :: forall b. Ptr b -> Int -> DepthClampModeEXT -> IO ()
pokeByteOff :: forall b. Ptr b -> Int -> DepthClampModeEXT -> IO ()
$cpeek :: Ptr DepthClampModeEXT -> IO DepthClampModeEXT
peek :: Ptr DepthClampModeEXT -> IO DepthClampModeEXT
$cpoke :: Ptr DepthClampModeEXT -> DepthClampModeEXT -> IO ()
poke :: Ptr DepthClampModeEXT -> DepthClampModeEXT -> IO ()
Storable, DepthClampModeEXT
DepthClampModeEXT -> Zero DepthClampModeEXT
forall a. a -> Zero a
$czero :: DepthClampModeEXT
zero :: DepthClampModeEXT
Zero)

-- No documentation found for Nested "VkDepthClampModeEXT" "VK_DEPTH_CLAMP_MODE_VIEWPORT_RANGE_EXT"
pattern $mDEPTH_CLAMP_MODE_VIEWPORT_RANGE_EXT :: forall {r}. DepthClampModeEXT -> ((# #) -> r) -> ((# #) -> r) -> r
$bDEPTH_CLAMP_MODE_VIEWPORT_RANGE_EXT :: DepthClampModeEXT
DEPTH_CLAMP_MODE_VIEWPORT_RANGE_EXT = DepthClampModeEXT 0

-- No documentation found for Nested "VkDepthClampModeEXT" "VK_DEPTH_CLAMP_MODE_USER_DEFINED_RANGE_EXT"
pattern $mDEPTH_CLAMP_MODE_USER_DEFINED_RANGE_EXT :: forall {r}. DepthClampModeEXT -> ((# #) -> r) -> ((# #) -> r) -> r
$bDEPTH_CLAMP_MODE_USER_DEFINED_RANGE_EXT :: DepthClampModeEXT
DEPTH_CLAMP_MODE_USER_DEFINED_RANGE_EXT = DepthClampModeEXT 1

{-# COMPLETE
  DEPTH_CLAMP_MODE_VIEWPORT_RANGE_EXT
  , DEPTH_CLAMP_MODE_USER_DEFINED_RANGE_EXT ::
    DepthClampModeEXT
  #-}

conNameDepthClampModeEXT :: String
conNameDepthClampModeEXT :: String
conNameDepthClampModeEXT = String
"DepthClampModeEXT"

enumPrefixDepthClampModeEXT :: String
enumPrefixDepthClampModeEXT :: String
enumPrefixDepthClampModeEXT = String
"DEPTH_CLAMP_MODE_"

showTableDepthClampModeEXT :: [(DepthClampModeEXT, String)]
showTableDepthClampModeEXT :: [(DepthClampModeEXT, String)]
showTableDepthClampModeEXT =
  [
    ( DepthClampModeEXT
DEPTH_CLAMP_MODE_VIEWPORT_RANGE_EXT
    , String
"VIEWPORT_RANGE_EXT"
    )
  ,
    ( DepthClampModeEXT
DEPTH_CLAMP_MODE_USER_DEFINED_RANGE_EXT
    , String
"USER_DEFINED_RANGE_EXT"
    )
  ]

instance Show DepthClampModeEXT where
  showsPrec :: Int -> DepthClampModeEXT -> ShowS
showsPrec =
    String
-> [(DepthClampModeEXT, String)]
-> String
-> (DepthClampModeEXT -> Int32)
-> (Int32 -> ShowS)
-> Int
-> DepthClampModeEXT
-> ShowS
forall a i.
Eq a =>
String
-> [(a, String)]
-> String
-> (a -> i)
-> (i -> ShowS)
-> Int
-> a
-> ShowS
enumShowsPrec
      String
enumPrefixDepthClampModeEXT
      [(DepthClampModeEXT, String)]
showTableDepthClampModeEXT
      String
conNameDepthClampModeEXT
      (\(DepthClampModeEXT Int32
x) -> Int32
x)
      (Int -> Int32 -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec Int
11)

instance Read DepthClampModeEXT where
  readPrec :: ReadPrec DepthClampModeEXT
readPrec =
    String
-> [(DepthClampModeEXT, String)]
-> String
-> (Int32 -> DepthClampModeEXT)
-> ReadPrec DepthClampModeEXT
forall i a.
Read i =>
String -> [(a, String)] -> String -> (i -> a) -> ReadPrec a
enumReadPrec
      String
enumPrefixDepthClampModeEXT
      [(DepthClampModeEXT, String)]
showTableDepthClampModeEXT
      String
conNameDepthClampModeEXT
      Int32 -> DepthClampModeEXT
DepthClampModeEXT

type EXT_DEPTH_CLAMP_CONTROL_SPEC_VERSION = 1

-- No documentation found for TopLevel "VK_EXT_DEPTH_CLAMP_CONTROL_SPEC_VERSION"
pattern EXT_DEPTH_CLAMP_CONTROL_SPEC_VERSION :: forall a . Integral a => a
pattern $mEXT_DEPTH_CLAMP_CONTROL_SPEC_VERSION :: forall {r} {a}.
Integral a =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
$bEXT_DEPTH_CLAMP_CONTROL_SPEC_VERSION :: forall a. Integral a => a
EXT_DEPTH_CLAMP_CONTROL_SPEC_VERSION = 1


type EXT_DEPTH_CLAMP_CONTROL_EXTENSION_NAME = "VK_EXT_depth_clamp_control"

-- No documentation found for TopLevel "VK_EXT_DEPTH_CLAMP_CONTROL_EXTENSION_NAME"
pattern EXT_DEPTH_CLAMP_CONTROL_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $mEXT_DEPTH_CLAMP_CONTROL_EXTENSION_NAME :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
$bEXT_DEPTH_CLAMP_CONTROL_EXTENSION_NAME :: forall a. (Eq a, IsString a) => a
EXT_DEPTH_CLAMP_CONTROL_EXTENSION_NAME = "VK_EXT_depth_clamp_control"