{-# language CPP #-}
-- | = Name
--
-- VK_NV_inherited_viewport_scissor - device extension
--
-- == VK_NV_inherited_viewport_scissor
--
-- [__Name String__]
--     @VK_NV_inherited_viewport_scissor@
--
-- [__Extension Type__]
--     Device extension
--
-- [__Registered Extension Number__]
--     279
--
-- [__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_get_physical_device_properties2 VK_KHR_get_physical_device_properties2>
--
-- [__Contact__]
--
--     -   David Zhao Akeley
--         <https://github.com/KhronosGroup/Vulkan-Docs/issues/new?body=[VK_NV_inherited_viewport_scissor] @akeley98%0A*Here describe the issue or question you have about the VK_NV_inherited_viewport_scissor extension* >
--
-- == Other Extension Metadata
--
-- [__Last Modified Date__]
--     2021-02-04
--
-- [__Contributors__]
--
--     -   David Zhao Akeley, NVIDIA
--
--     -   Jeff Bolz, NVIDIA
--
--     -   Piers Daniell, NVIDIA
--
--     -   Christoph Kubisch, NVIDIA
--
-- == Description
--
-- This extension adds the ability for a secondary command buffer to
-- inherit the dynamic viewport and scissor state from a primary command
-- buffer, or a previous secondary command buffer executed within the same
-- 'Vulkan.Core10.CommandBufferBuilding.cmdExecuteCommands' call. It
-- addresses a frequent scenario in applications that deal with window
-- resizing and want to improve utilization of re-usable secondary command
-- buffers. The functionality is provided through
-- 'CommandBufferInheritanceViewportScissorInfoNV'. Viewport inheritance is
-- effectively limited to the 2D rectangle; secondary command buffers must
-- re-specify the inherited depth range values.
--
-- == New Structures
--
-- -   Extending
--     'Vulkan.Core10.CommandBuffer.CommandBufferInheritanceInfo':
--
--     -   'CommandBufferInheritanceViewportScissorInfoNV'
--
-- -   Extending
--     'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceFeatures2',
--     'Vulkan.Core10.Device.DeviceCreateInfo':
--
--     -   'PhysicalDeviceInheritedViewportScissorFeaturesNV'
--
-- == New Enum Constants
--
-- -   'NV_INHERITED_VIEWPORT_SCISSOR_EXTENSION_NAME'
--
-- -   'NV_INHERITED_VIEWPORT_SCISSOR_SPEC_VERSION'
--
-- -   Extending 'Vulkan.Core10.Enums.StructureType.StructureType':
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_VIEWPORT_SCISSOR_INFO_NV'
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_PHYSICAL_DEVICE_INHERITED_VIEWPORT_SCISSOR_FEATURES_NV'
--
-- == Issues
--
-- (1) Why are viewport depth values configured in the
-- 'CommandBufferInheritanceViewportScissorInfoNV' struct, rather than by a
-- @vkCmd…​@ function?
--
-- __DISCUSSION__:
--
-- We considered both adding a new @vkCmdSetViewportDepthNV@ function, and
-- modifying 'Vulkan.Core10.CommandBufferBuilding.cmdSetViewport' to ignore
-- the @x@, @y@, @width@, and @height@ values when called with a secondary
-- command buffer that activates this extension.
--
-- The primary design considerations for this extension are debuggability
-- and easy integration into existing applications. The main issue with
-- adding a new @vkCmdSetViewportDepthNV@ function is reducing
-- ease-of-integration. A new function pointer will have to be loaded, but
-- more importantly, a new function would require changes to be supported
-- in graphics debuggers; this would delay widespread adoption of the
-- extension.
--
-- The proposal to modify
-- 'Vulkan.Core10.CommandBufferBuilding.cmdSetViewport' would avoid these
-- issues. However, we expect that the intent of applications using this
-- extension is to have the viewport values used for drawing exactly match
-- the inherited values; thus, it would be better for debuggability if no
-- function for modifying the viewport depth alone is provided. By
-- specifying viewport depth values when starting secondary command buffer
-- recording, and requiring the specified depth values to match the
-- inherited depth values, we allow for validation layers that flag depth
-- changes as errors.
--
-- This design also better matches the hardware model. In fact, there is no
-- need to re-execute a depth-setting command. The graphics device retains
-- the viewport depth state; it is the CPU-side state of
-- 'Vulkan.Core10.Handles.CommandBuffer' that must be re-initialized.
--
-- (2) Why are viewport depth values specified as a partial
-- 'Vulkan.Core10.Pipeline.Viewport' struct, rather than a leaner
-- depth-only struct?
--
-- __DISCUSSION__:
--
-- We considered adding a new @VkViewportDepthNV@ struct containing only
-- @minDepth@ and @maxDepth@. However, as application developers would need
-- to maintain both a @VK_NV_inherited_viewport_scissor@ code path and a
-- fallback code path (at least in the short term), we ultimately chose to
-- continue using the existing 'Vulkan.Core10.Pipeline.Viewport' structure.
-- Doing so would allow application developers to reuse the same
-- 'Vulkan.Core10.Pipeline.Viewport' array for both code paths, rather than
-- constructing separate @VkViewportDepthNV@ and
-- 'Vulkan.Core10.Pipeline.Viewport' arrays for each code path.
--
-- == Version History
--
-- -   Revision 1, 2020-02-04 (David Zhao Akeley)
--
--     -   Internal revisions
--
-- == See Also
--
-- 'CommandBufferInheritanceViewportScissorInfoNV',
-- 'PhysicalDeviceInheritedViewportScissorFeaturesNV'
--
-- == Document Notes
--
-- For more information, see the
-- <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VK_NV_inherited_viewport_scissor Vulkan Specification>
--
-- This page is a generated document. Fixes and changes should be made to
-- the generator scripts, not directly.
module Vulkan.Extensions.VK_NV_inherited_viewport_scissor  ( PhysicalDeviceInheritedViewportScissorFeaturesNV(..)
                                                           , CommandBufferInheritanceViewportScissorInfoNV(..)
                                                           , NV_INHERITED_VIEWPORT_SCISSOR_SPEC_VERSION
                                                           , pattern NV_INHERITED_VIEWPORT_SCISSOR_SPEC_VERSION
                                                           , NV_INHERITED_VIEWPORT_SCISSOR_EXTENSION_NAME
                                                           , pattern NV_INHERITED_VIEWPORT_SCISSOR_EXTENSION_NAME
                                                           ) where

import Foreign.Marshal.Alloc (allocaBytes)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
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 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 Foreign.Ptr (Ptr)
import Data.Word (Word32)
import Data.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Vulkan.Core10.FundamentalTypes (bool32ToBool)
import Vulkan.Core10.FundamentalTypes (boolToBool32)
import Vulkan.Core10.FundamentalTypes (Bool32)
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Core10.Pipeline (Viewport)
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_VIEWPORT_SCISSOR_INFO_NV))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_INHERITED_VIEWPORT_SCISSOR_FEATURES_NV))
-- | VkPhysicalDeviceInheritedViewportScissorFeaturesNV - Structure
-- describing the viewport scissor inheritance behavior for an
-- implementation
--
-- = Members
--
-- This structure describes the following feature:
--
-- = Description
--
-- If the 'PhysicalDeviceInheritedViewportScissorFeaturesNV' 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. 'PhysicalDeviceInheritedViewportScissorFeaturesNV' /can/ also
-- be used in the @pNext@ chain of 'Vulkan.Core10.Device.DeviceCreateInfo'
-- to selectively enable these features.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_NV_inherited_viewport_scissor VK_NV_inherited_viewport_scissor>,
-- 'Vulkan.Core10.FundamentalTypes.Bool32',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PhysicalDeviceInheritedViewportScissorFeaturesNV = PhysicalDeviceInheritedViewportScissorFeaturesNV
  { -- | #features-inheritedViewportScissor2D# @inheritedViewportScissor2D@
    -- indicates whether secondary command buffers can inherit most of the
    -- dynamic state affected by
    -- 'Vulkan.Core10.Enums.DynamicState.DYNAMIC_STATE_VIEWPORT_WITH_COUNT',
    -- 'Vulkan.Core10.Enums.DynamicState.DYNAMIC_STATE_SCISSOR_WITH_COUNT',
    -- 'Vulkan.Core10.Enums.DynamicState.DYNAMIC_STATE_DISCARD_RECTANGLE_EXT',
    -- 'Vulkan.Core10.Enums.DynamicState.DYNAMIC_STATE_DISCARD_RECTANGLE_ENABLE_EXT',
    -- 'Vulkan.Core10.Enums.DynamicState.DYNAMIC_STATE_DISCARD_RECTANGLE_MODE_EXT',
    -- 'Vulkan.Core10.Enums.DynamicState.DYNAMIC_STATE_VIEWPORT' or
    -- 'Vulkan.Core10.Enums.DynamicState.DYNAMIC_STATE_SCISSOR', from a primary
    -- command buffer.
    PhysicalDeviceInheritedViewportScissorFeaturesNV -> Bool
inheritedViewportScissor2D :: Bool }
  deriving (Typeable, PhysicalDeviceInheritedViewportScissorFeaturesNV
-> PhysicalDeviceInheritedViewportScissorFeaturesNV -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhysicalDeviceInheritedViewportScissorFeaturesNV
-> PhysicalDeviceInheritedViewportScissorFeaturesNV -> Bool
$c/= :: PhysicalDeviceInheritedViewportScissorFeaturesNV
-> PhysicalDeviceInheritedViewportScissorFeaturesNV -> Bool
== :: PhysicalDeviceInheritedViewportScissorFeaturesNV
-> PhysicalDeviceInheritedViewportScissorFeaturesNV -> Bool
$c== :: PhysicalDeviceInheritedViewportScissorFeaturesNV
-> PhysicalDeviceInheritedViewportScissorFeaturesNV -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceInheritedViewportScissorFeaturesNV)
#endif
deriving instance Show PhysicalDeviceInheritedViewportScissorFeaturesNV

instance ToCStruct PhysicalDeviceInheritedViewportScissorFeaturesNV where
  withCStruct :: forall b.
PhysicalDeviceInheritedViewportScissorFeaturesNV
-> (Ptr PhysicalDeviceInheritedViewportScissorFeaturesNV -> IO b)
-> IO b
withCStruct PhysicalDeviceInheritedViewportScissorFeaturesNV
x Ptr PhysicalDeviceInheritedViewportScissorFeaturesNV -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
24 forall a b. (a -> b) -> a -> b
$ \Ptr PhysicalDeviceInheritedViewportScissorFeaturesNV
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceInheritedViewportScissorFeaturesNV
p PhysicalDeviceInheritedViewportScissorFeaturesNV
x (Ptr PhysicalDeviceInheritedViewportScissorFeaturesNV -> IO b
f Ptr PhysicalDeviceInheritedViewportScissorFeaturesNV
p)
  pokeCStruct :: forall b.
Ptr PhysicalDeviceInheritedViewportScissorFeaturesNV
-> PhysicalDeviceInheritedViewportScissorFeaturesNV -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceInheritedViewportScissorFeaturesNV
p PhysicalDeviceInheritedViewportScissorFeaturesNV{Bool
inheritedViewportScissor2D :: Bool
$sel:inheritedViewportScissor2D:PhysicalDeviceInheritedViewportScissorFeaturesNV :: PhysicalDeviceInheritedViewportScissorFeaturesNV -> Bool
..} IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceInheritedViewportScissorFeaturesNV
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_INHERITED_VIEWPORT_SCISSOR_FEATURES_NV)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceInheritedViewportScissorFeaturesNV
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 ((Ptr PhysicalDeviceInheritedViewportScissorFeaturesNV
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
inheritedViewportScissor2D))
    IO b
f
  cStructSize :: Int
cStructSize = Int
24
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b.
Ptr PhysicalDeviceInheritedViewportScissorFeaturesNV
-> IO b -> IO b
pokeZeroCStruct Ptr PhysicalDeviceInheritedViewportScissorFeaturesNV
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceInheritedViewportScissorFeaturesNV
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_INHERITED_VIEWPORT_SCISSOR_FEATURES_NV)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceInheritedViewportScissorFeaturesNV
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 ((Ptr PhysicalDeviceInheritedViewportScissorFeaturesNV
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (forall a. Zero a => a
zero))
    IO b
f

instance FromCStruct PhysicalDeviceInheritedViewportScissorFeaturesNV where
  peekCStruct :: Ptr PhysicalDeviceInheritedViewportScissorFeaturesNV
-> IO PhysicalDeviceInheritedViewportScissorFeaturesNV
peekCStruct Ptr PhysicalDeviceInheritedViewportScissorFeaturesNV
p = do
    Bool32
inheritedViewportScissor2D <- forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PhysicalDeviceInheritedViewportScissorFeaturesNV
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32))
    forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Bool -> PhysicalDeviceInheritedViewportScissorFeaturesNV
PhysicalDeviceInheritedViewportScissorFeaturesNV
             (Bool32 -> Bool
bool32ToBool Bool32
inheritedViewportScissor2D)

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

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


-- | VkCommandBufferInheritanceViewportScissorInfoNV - Structure specifying
-- command buffer inheritance information
--
-- = Description
--
-- If the @pNext@ chain of
-- 'Vulkan.Core10.CommandBuffer.CommandBufferInheritanceInfo' includes a
-- 'CommandBufferInheritanceViewportScissorInfoNV' structure, then that
-- structure controls whether a command buffer /can/ inherit the following
-- state from other command buffers:
--
-- -   'Vulkan.Core10.Enums.DynamicState.DYNAMIC_STATE_SCISSOR'
--
-- -   'Vulkan.Core10.Enums.DynamicState.DYNAMIC_STATE_SCISSOR_WITH_COUNT'
--
-- -   'Vulkan.Core10.Enums.DynamicState.DYNAMIC_STATE_DISCARD_RECTANGLE_EXT'
--
-- -   'Vulkan.Core10.Enums.DynamicState.DYNAMIC_STATE_DISCARD_RECTANGLE_ENABLE_EXT'
--
-- -   'Vulkan.Core10.Enums.DynamicState.DYNAMIC_STATE_DISCARD_RECTANGLE_MODE_EXT'
--
-- as well as the following state, with restrictions on inherited depth
-- values and viewport count:
--
-- -   'Vulkan.Core10.Enums.DynamicState.DYNAMIC_STATE_VIEWPORT'
--
-- -   'Vulkan.Core10.Enums.DynamicState.DYNAMIC_STATE_VIEWPORT_WITH_COUNT'
--
-- If @viewportScissor2D@ is 'Vulkan.Core10.FundamentalTypes.FALSE', then
-- the command buffer does not inherit the listed dynamic state, and
-- /should/ set this state itself. If this structure is not present, the
-- behavior is as if @viewportScissor2D@ is
-- 'Vulkan.Core10.FundamentalTypes.FALSE'.
--
-- If @viewportScissor2D@ is 'Vulkan.Core10.FundamentalTypes.TRUE', then
-- the listed dynamic state is inherited, and the command buffer /must/ not
-- set this state, except that the viewport and scissor count /may/ be set
-- by binding a graphics pipeline that does not specify this state as
-- dynamic.
--
-- Note
--
-- Due to this restriction, applications /should/ ensure either all or none
-- of the graphics pipelines bound in this secondary command buffer use
-- dynamic viewport\/scissor counts.
--
-- When the command buffer is executed as part of a the execution of a
-- 'Vulkan.Core10.CommandBufferBuilding.cmdExecuteCommands' command, the
-- inherited state (if enabled) is determined by the following procedure,
-- performed separately for each dynamic state, and separately for each
-- value for dynamic state that consists of multiple values (e.g. multiple
-- viewports).
--
-- -   With i being the index of the executed command buffer in the
--     @pCommandBuffers@ array of
--     'Vulkan.Core10.CommandBufferBuilding.cmdExecuteCommands', if i > 0
--     and any secondary command buffer from index 0 to i-1 modifies the
--     state, the inherited state is provisionally set to the final value
--     set by the last such secondary command buffer. Binding a graphics
--     pipeline defining the state statically is equivalent to setting the
--     state to an undefined value.
--
-- -   Otherwise, the tentatative inherited state is that of the primary
--     command buffer at the point the
--     'Vulkan.Core10.CommandBufferBuilding.cmdExecuteCommands' command was
--     recorded; if the state is undefined, then so is the provisional
--     inherited state.
--
-- -   If the provisional inherited state is an undefined value, then the
--     state is not inherited.
--
-- -   If the provisional inherited state is a viewport, with n being its
--     viewport index, then if n ≥ @viewportDepthCount@, or if either
--     'Vulkan.Core10.Pipeline.Viewport'::@minDepth@ or
--     'Vulkan.Core10.Pipeline.Viewport'::@maxDepth@ are not equal to the
--     respective values of the nth element of @pViewportDepths@, then the
--     state is not inherited.
--
-- -   If the provisional inherited state passes both checks, then it
--     becomes the actual inherited state.
--
-- Note
--
-- There is no support for inheriting dynamic state from a secondary
-- command buffer executed as part of a different
-- 'Vulkan.Core10.CommandBufferBuilding.cmdExecuteCommands' command.
--
-- == Valid Usage
--
-- -   #VUID-VkCommandBufferInheritanceViewportScissorInfoNV-viewportScissor2D-04782#
--     If the
--     <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#features-inheritedViewportScissor2D inheritedViewportScissor2D>
--     feature is not enabled, @viewportScissor2D@ /must/ be
--     'Vulkan.Core10.FundamentalTypes.FALSE'
--
-- -   #VUID-VkCommandBufferInheritanceViewportScissorInfoNV-viewportScissor2D-04783#
--     If the
--     <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#features-multiViewport multiViewport>
--     feature is not enabled and @viewportScissor2D@ is
--     'Vulkan.Core10.FundamentalTypes.TRUE', then @viewportDepthCount@
--     /must/ be @1@
--
-- -   #VUID-VkCommandBufferInheritanceViewportScissorInfoNV-viewportScissor2D-04784#
--     If @viewportScissor2D@ is 'Vulkan.Core10.FundamentalTypes.TRUE',
--     then @viewportDepthCount@ /must/ be greater than @0@
--
-- -   #VUID-VkCommandBufferInheritanceViewportScissorInfoNV-viewportScissor2D-04785#
--     If @viewportScissor2D@ is 'Vulkan.Core10.FundamentalTypes.TRUE',
--     then @pViewportDepths@ /must/ be a valid pointer to an array of
--     @viewportDepthCount@ valid 'Vulkan.Core10.Pipeline.Viewport'
--     structures, except any requirements on @x@, @y@, @width@, and
--     @height@ do not apply
--
-- -   #VUID-VkCommandBufferInheritanceViewportScissorInfoNV-viewportScissor2D-04786#
--     If @viewportScissor2D@ is 'Vulkan.Core10.FundamentalTypes.TRUE',
--     then the command buffer /must/ be recorded with the
--     'Vulkan.Core10.Enums.CommandBufferUsageFlagBits.COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT'
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkCommandBufferInheritanceViewportScissorInfoNV-sType-sType#
--     @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_VIEWPORT_SCISSOR_INFO_NV'
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_NV_inherited_viewport_scissor VK_NV_inherited_viewport_scissor>,
-- 'Vulkan.Core10.FundamentalTypes.Bool32',
-- 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'Vulkan.Core10.Pipeline.Viewport'
data CommandBufferInheritanceViewportScissorInfoNV = CommandBufferInheritanceViewportScissorInfoNV
  { -- | @viewportScissor2D@ specifies whether the listed dynamic state is
    -- inherited.
    CommandBufferInheritanceViewportScissorInfoNV -> Bool
viewportScissor2D :: Bool
  , -- | @viewportDepthCount@ specifies the maximum number of viewports to
    -- inherit. When @viewportScissor2D@ is
    -- 'Vulkan.Core10.FundamentalTypes.FALSE', the behavior is as if this value
    -- is zero.
    CommandBufferInheritanceViewportScissorInfoNV -> Word32
viewportDepthCount :: Word32
  , -- | @pViewportDepths@ is a pointer to a 'Vulkan.Core10.Pipeline.Viewport'
    -- structure specifying the expected depth range for each inherited
    -- viewport.
    CommandBufferInheritanceViewportScissorInfoNV -> Viewport
viewportDepths :: Viewport
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (CommandBufferInheritanceViewportScissorInfoNV)
#endif
deriving instance Show CommandBufferInheritanceViewportScissorInfoNV

instance ToCStruct CommandBufferInheritanceViewportScissorInfoNV where
  withCStruct :: forall b.
CommandBufferInheritanceViewportScissorInfoNV
-> (Ptr CommandBufferInheritanceViewportScissorInfoNV -> IO b)
-> IO b
withCStruct CommandBufferInheritanceViewportScissorInfoNV
x Ptr CommandBufferInheritanceViewportScissorInfoNV -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
32 forall a b. (a -> b) -> a -> b
$ \Ptr CommandBufferInheritanceViewportScissorInfoNV
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr CommandBufferInheritanceViewportScissorInfoNV
p CommandBufferInheritanceViewportScissorInfoNV
x (Ptr CommandBufferInheritanceViewportScissorInfoNV -> IO b
f Ptr CommandBufferInheritanceViewportScissorInfoNV
p)
  pokeCStruct :: forall b.
Ptr CommandBufferInheritanceViewportScissorInfoNV
-> CommandBufferInheritanceViewportScissorInfoNV -> IO b -> IO b
pokeCStruct Ptr CommandBufferInheritanceViewportScissorInfoNV
p CommandBufferInheritanceViewportScissorInfoNV{Bool
Word32
Viewport
viewportDepths :: Viewport
viewportDepthCount :: Word32
viewportScissor2D :: Bool
$sel:viewportDepths:CommandBufferInheritanceViewportScissorInfoNV :: CommandBufferInheritanceViewportScissorInfoNV -> Viewport
$sel:viewportDepthCount:CommandBufferInheritanceViewportScissorInfoNV :: CommandBufferInheritanceViewportScissorInfoNV -> Word32
$sel:viewportScissor2D:CommandBufferInheritanceViewportScissorInfoNV :: CommandBufferInheritanceViewportScissorInfoNV -> Bool
..} IO b
f = forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT forall a b. (a -> b) -> a -> b
$ do
    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 -> a -> IO ()
poke ((Ptr CommandBufferInheritanceViewportScissorInfoNV
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_VIEWPORT_SCISSOR_INFO_NV)
    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 -> a -> IO ()
poke ((Ptr CommandBufferInheritanceViewportScissorInfoNV
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    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 -> a -> IO ()
poke ((Ptr CommandBufferInheritanceViewportScissorInfoNV
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
viewportScissor2D))
    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 -> a -> IO ()
poke ((Ptr CommandBufferInheritanceViewportScissorInfoNV
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Word32)) (Word32
viewportDepthCount)
    Ptr Viewport
pViewportDepths'' <- 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 (Viewport
viewportDepths)
    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 -> a -> IO ()
poke ((Ptr CommandBufferInheritanceViewportScissorInfoNV
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr Viewport))) Ptr Viewport
pViewportDepths''
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ IO b
f
  cStructSize :: Int
cStructSize = Int
32
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b.
Ptr CommandBufferInheritanceViewportScissorInfoNV -> IO b -> IO b
pokeZeroCStruct Ptr CommandBufferInheritanceViewportScissorInfoNV
p IO b
f = forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT forall a b. (a -> b) -> a -> b
$ do
    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 -> a -> IO ()
poke ((Ptr CommandBufferInheritanceViewportScissorInfoNV
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_VIEWPORT_SCISSOR_INFO_NV)
    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 -> a -> IO ()
poke ((Ptr CommandBufferInheritanceViewportScissorInfoNV
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    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 -> a -> IO ()
poke ((Ptr CommandBufferInheritanceViewportScissorInfoNV
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (forall a. Zero a => a
zero))
    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 -> a -> IO ()
poke ((Ptr CommandBufferInheritanceViewportScissorInfoNV
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Word32)) (forall a. Zero a => a
zero)
    Ptr Viewport
pViewportDepths'' <- 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 (forall a. Zero a => a
zero)
    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 -> a -> IO ()
poke ((Ptr CommandBufferInheritanceViewportScissorInfoNV
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr Viewport))) Ptr Viewport
pViewportDepths''
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ IO b
f

instance FromCStruct CommandBufferInheritanceViewportScissorInfoNV where
  peekCStruct :: Ptr CommandBufferInheritanceViewportScissorInfoNV
-> IO CommandBufferInheritanceViewportScissorInfoNV
peekCStruct Ptr CommandBufferInheritanceViewportScissorInfoNV
p = do
    Bool32
viewportScissor2D <- forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr CommandBufferInheritanceViewportScissorInfoNV
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32))
    Word32
viewportDepthCount <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr CommandBufferInheritanceViewportScissorInfoNV
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Word32))
    Viewport
pViewportDepths <- forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @Viewport forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< forall a. Storable a => Ptr a -> IO a
peek ((Ptr CommandBufferInheritanceViewportScissorInfoNV
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr Viewport)))
    forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Bool
-> Word32
-> Viewport
-> CommandBufferInheritanceViewportScissorInfoNV
CommandBufferInheritanceViewportScissorInfoNV
             (Bool32 -> Bool
bool32ToBool Bool32
viewportScissor2D) Word32
viewportDepthCount Viewport
pViewportDepths

instance Zero CommandBufferInheritanceViewportScissorInfoNV where
  zero :: CommandBufferInheritanceViewportScissorInfoNV
zero = Bool
-> Word32
-> Viewport
-> CommandBufferInheritanceViewportScissorInfoNV
CommandBufferInheritanceViewportScissorInfoNV
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero


type NV_INHERITED_VIEWPORT_SCISSOR_SPEC_VERSION = 1

-- No documentation found for TopLevel "VK_NV_INHERITED_VIEWPORT_SCISSOR_SPEC_VERSION"
pattern NV_INHERITED_VIEWPORT_SCISSOR_SPEC_VERSION :: forall a . Integral a => a
pattern $bNV_INHERITED_VIEWPORT_SCISSOR_SPEC_VERSION :: forall a. Integral a => a
$mNV_INHERITED_VIEWPORT_SCISSOR_SPEC_VERSION :: forall {r} {a}.
Integral a =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
NV_INHERITED_VIEWPORT_SCISSOR_SPEC_VERSION = 1


type NV_INHERITED_VIEWPORT_SCISSOR_EXTENSION_NAME = "VK_NV_inherited_viewport_scissor"

-- No documentation found for TopLevel "VK_NV_INHERITED_VIEWPORT_SCISSOR_EXTENSION_NAME"
pattern NV_INHERITED_VIEWPORT_SCISSOR_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bNV_INHERITED_VIEWPORT_SCISSOR_EXTENSION_NAME :: forall a. (Eq a, IsString a) => a
$mNV_INHERITED_VIEWPORT_SCISSOR_EXTENSION_NAME :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
NV_INHERITED_VIEWPORT_SCISSOR_EXTENSION_NAME = "VK_NV_inherited_viewport_scissor"