{-# language CPP #-}
module Vulkan.Extensions.VK_EXT_discard_rectangles  ( cmdSetDiscardRectangleEXT
                                                    , PhysicalDeviceDiscardRectanglePropertiesEXT(..)
                                                    , PipelineDiscardRectangleStateCreateInfoEXT(..)
                                                    , PipelineDiscardRectangleStateCreateFlagsEXT(..)
                                                    , DiscardRectangleModeEXT( DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT
                                                                             , DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT
                                                                             , ..
                                                                             )
                                                    , EXT_DISCARD_RECTANGLES_SPEC_VERSION
                                                    , pattern EXT_DISCARD_RECTANGLES_SPEC_VERSION
                                                    , EXT_DISCARD_RECTANGLES_EXTENSION_NAME
                                                    , pattern EXT_DISCARD_RECTANGLES_EXTENSION_NAME
                                                    ) where

import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Foreign.Marshal.Alloc (allocaBytesAligned)
import GHC.IO (throwIO)
import GHC.Ptr (nullFunPtr)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import GHC.Read (choose)
import GHC.Read (expectP)
import GHC.Read (parens)
import GHC.Show (showParen)
import GHC.Show (showString)
import GHC.Show (showsPrec)
import Numeric (showHex)
import Text.ParserCombinators.ReadPrec ((+++))
import Text.ParserCombinators.ReadPrec (prec)
import Text.ParserCombinators.ReadPrec (step)
import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Cont (evalContT)
import Data.Vector (generateM)
import qualified Data.Vector (imapM_)
import qualified Data.Vector (length)
import qualified Data.Vector (null)
import Control.Monad.IO.Class (MonadIO)
import Data.Bits (Bits)
import Data.String (IsString)
import Data.Typeable (Typeable)
import Foreign.Storable (Storable)
import Foreign.Storable (Storable(peek))
import Foreign.Storable (Storable(poke))
import qualified Foreign.Storable (Storable(..))
import GHC.Generics (Generic)
import GHC.IO.Exception (IOErrorType(..))
import GHC.IO.Exception (IOException(..))
import Data.Int (Int32)
import Foreign.Ptr (FunPtr)
import Foreign.Ptr (Ptr)
import GHC.Read (Read(readPrec))
import Data.Word (Word32)
import Text.Read.Lex (Lexeme(Ident))
import Data.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Data.Vector (Vector)
import Vulkan.CStruct.Utils (advancePtrBytes)
import Vulkan.NamedType ((:::))
import Vulkan.Core10.Handles (CommandBuffer)
import Vulkan.Core10.Handles (CommandBuffer(..))
import Vulkan.Core10.Handles (CommandBuffer_T)
import Vulkan.Dynamic (DeviceCmds(pVkCmdSetDiscardRectangleEXT))
import Vulkan.Core10.BaseType (Flags)
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.Core10.CommandBufferBuilding (Rect2D)
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Zero (Zero)
import Vulkan.Zero (Zero(..))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_DISCARD_RECTANGLE_PROPERTIES_EXT))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PIPELINE_DISCARD_RECTANGLE_STATE_CREATE_INFO_EXT))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkCmdSetDiscardRectangleEXT
  :: FunPtr (Ptr CommandBuffer_T -> Word32 -> Word32 -> Ptr Rect2D -> IO ()) -> Ptr CommandBuffer_T -> Word32 -> Word32 -> Ptr Rect2D -> IO ()

-- | vkCmdSetDiscardRectangleEXT - Set discard rectangles dynamically
--
-- = Description
--
-- The discard rectangle taken from element i of @pDiscardRectangles@
-- replace the current state for the discard rectangle at index
-- @firstDiscardRectangle@ + i, for i in [0, @discardRectangleCount@).
--
-- This command sets the state for a given draw when the graphics pipeline
-- is created with
-- 'Vulkan.Core10.Enums.DynamicState.DYNAMIC_STATE_DISCARD_RECTANGLE_EXT'
-- set in
-- 'Vulkan.Core10.Pipeline.PipelineDynamicStateCreateInfo'::@pDynamicStates@.
--
-- == Valid Usage
--
-- -   The sum of @firstDiscardRectangle@ and @discardRectangleCount@
--     /must/ be less than or equal to
--     'PhysicalDeviceDiscardRectanglePropertiesEXT'::@maxDiscardRectangles@
--
-- -   The @x@ and @y@ member of @offset@ in each
--     'Vulkan.Core10.CommandBufferBuilding.Rect2D' element of
--     @pDiscardRectangles@ /must/ be greater than or equal to @0@
--
-- -   Evaluation of (@offset.x@ + @extent.width@) in each
--     'Vulkan.Core10.CommandBufferBuilding.Rect2D' element of
--     @pDiscardRectangles@ /must/ not cause a signed integer addition
--     overflow
--
-- -   Evaluation of (@offset.y@ + @extent.height@) in each
--     'Vulkan.Core10.CommandBufferBuilding.Rect2D' element of
--     @pDiscardRectangles@ /must/ not cause a signed integer addition
--     overflow
--
-- == Valid Usage (Implicit)
--
-- -   @commandBuffer@ /must/ be a valid
--     'Vulkan.Core10.Handles.CommandBuffer' handle
--
-- -   @pDiscardRectangles@ /must/ be a valid pointer to an array of
--     @discardRectangleCount@ 'Vulkan.Core10.CommandBufferBuilding.Rect2D'
--     structures
--
-- -   @commandBuffer@ /must/ be in the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#commandbuffers-lifecycle recording state>
--
-- -   The 'Vulkan.Core10.Handles.CommandPool' that @commandBuffer@ was
--     allocated from /must/ support graphics operations
--
-- -   @discardRectangleCount@ /must/ be greater than @0@
--
-- == 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#VkQueueFlagBits Supported Queue Types> | <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#synchronization-pipeline-stages-types Pipeline Type> |
-- +============================================================================================================================+========================================================================================================================+=======================================================================================================================+=====================================================================================================================================+
-- | Primary                                                                                                                    | Both                                                                                                                   | Graphics                                                                                                              |                                                                                                                                     |
-- | Secondary                                                                                                                  |                                                                                                                        |                                                                                                                       |                                                                                                                                     |
-- +----------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+
--
-- = See Also
--
-- 'Vulkan.Core10.Handles.CommandBuffer',
-- 'Vulkan.Core10.CommandBufferBuilding.Rect2D'
cmdSetDiscardRectangleEXT :: forall io
                           . (MonadIO io)
                          => -- | @commandBuffer@ is the command buffer into which the command will be
                             -- recorded.
                             CommandBuffer
                          -> -- | @firstDiscardRectangle@ is the index of the first discard rectangle
                             -- whose state is updated by the command.
                             ("firstDiscardRectangle" ::: Word32)
                          -> -- | @pDiscardRectangles@ is a pointer to an array of
                             -- 'Vulkan.Core10.CommandBufferBuilding.Rect2D' structures specifying
                             -- discard rectangles.
                             ("discardRectangles" ::: Vector Rect2D)
                          -> io ()
cmdSetDiscardRectangleEXT :: CommandBuffer
-> ("firstDiscardRectangle" ::: Word32)
-> ("discardRectangles" ::: Vector Rect2D)
-> io ()
cmdSetDiscardRectangleEXT commandBuffer :: CommandBuffer
commandBuffer firstDiscardRectangle :: "firstDiscardRectangle" ::: Word32
firstDiscardRectangle discardRectangles :: "discardRectangles" ::: Vector Rect2D
discardRectangles = IO () -> io ()
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 vkCmdSetDiscardRectangleEXTPtr :: FunPtr
  (Ptr CommandBuffer_T
   -> ("firstDiscardRectangle" ::: Word32)
   -> ("firstDiscardRectangle" ::: Word32)
   -> ("pDiscardRectangles" ::: Ptr Rect2D)
   -> IO ())
vkCmdSetDiscardRectangleEXTPtr = DeviceCmds
-> FunPtr
     (Ptr CommandBuffer_T
      -> ("firstDiscardRectangle" ::: Word32)
      -> ("firstDiscardRectangle" ::: Word32)
      -> ("pDiscardRectangles" ::: Ptr Rect2D)
      -> IO ())
pVkCmdSetDiscardRectangleEXT (CommandBuffer -> DeviceCmds
deviceCmds (CommandBuffer
commandBuffer :: CommandBuffer))
  IO () -> ContT () IO ()
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
   -> ("firstDiscardRectangle" ::: Word32)
   -> ("firstDiscardRectangle" ::: Word32)
   -> ("pDiscardRectangles" ::: Ptr Rect2D)
   -> IO ())
vkCmdSetDiscardRectangleEXTPtr FunPtr
  (Ptr CommandBuffer_T
   -> ("firstDiscardRectangle" ::: Word32)
   -> ("firstDiscardRectangle" ::: Word32)
   -> ("pDiscardRectangles" ::: Ptr Rect2D)
   -> IO ())
-> FunPtr
     (Ptr CommandBuffer_T
      -> ("firstDiscardRectangle" ::: Word32)
      -> ("firstDiscardRectangle" ::: Word32)
      -> ("pDiscardRectangles" ::: Ptr Rect2D)
      -> IO ())
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr CommandBuffer_T
   -> ("firstDiscardRectangle" ::: Word32)
   -> ("firstDiscardRectangle" ::: Word32)
   -> ("pDiscardRectangles" ::: Ptr Rect2D)
   -> IO ())
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
    IOException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument "" "The function pointer for vkCmdSetDiscardRectangleEXT is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkCmdSetDiscardRectangleEXT' :: Ptr CommandBuffer_T
-> ("firstDiscardRectangle" ::: Word32)
-> ("firstDiscardRectangle" ::: Word32)
-> ("pDiscardRectangles" ::: Ptr Rect2D)
-> IO ()
vkCmdSetDiscardRectangleEXT' = FunPtr
  (Ptr CommandBuffer_T
   -> ("firstDiscardRectangle" ::: Word32)
   -> ("firstDiscardRectangle" ::: Word32)
   -> ("pDiscardRectangles" ::: Ptr Rect2D)
   -> IO ())
-> Ptr CommandBuffer_T
-> ("firstDiscardRectangle" ::: Word32)
-> ("firstDiscardRectangle" ::: Word32)
-> ("pDiscardRectangles" ::: Ptr Rect2D)
-> IO ()
mkVkCmdSetDiscardRectangleEXT FunPtr
  (Ptr CommandBuffer_T
   -> ("firstDiscardRectangle" ::: Word32)
   -> ("firstDiscardRectangle" ::: Word32)
   -> ("pDiscardRectangles" ::: Ptr Rect2D)
   -> IO ())
vkCmdSetDiscardRectangleEXTPtr
  "pDiscardRectangles" ::: Ptr Rect2D
pPDiscardRectangles <- ((("pDiscardRectangles" ::: Ptr Rect2D) -> IO ()) -> IO ())
-> ContT () IO ("pDiscardRectangles" ::: Ptr Rect2D)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pDiscardRectangles" ::: Ptr Rect2D) -> IO ()) -> IO ())
 -> ContT () IO ("pDiscardRectangles" ::: Ptr Rect2D))
-> ((("pDiscardRectangles" ::: Ptr Rect2D) -> IO ()) -> IO ())
-> ContT () IO ("pDiscardRectangles" ::: Ptr Rect2D)
forall a b. (a -> b) -> a -> b
$ Int
-> Int -> (("pDiscardRectangles" ::: Ptr Rect2D) -> IO ()) -> IO ()
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned @Rect2D ((("discardRectangles" ::: Vector Rect2D) -> Int
forall a. Vector a -> Int
Data.Vector.length ("discardRectangles" ::: Vector Rect2D
discardRectangles)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* 16) 4
  (Int -> Rect2D -> ContT () IO ())
-> ("discardRectangles" ::: Vector Rect2D) -> ContT () IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\i :: Int
i e :: Rect2D
e -> ((() -> IO ()) -> IO ()) -> ContT () IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO ()) -> IO ()) -> ContT () IO ())
-> ((() -> IO ()) -> IO ()) -> ContT () IO ()
forall a b. (a -> b) -> a -> b
$ ("pDiscardRectangles" ::: Ptr Rect2D) -> Rect2D -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct ("pDiscardRectangles" ::: Ptr Rect2D
pPDiscardRectangles ("pDiscardRectangles" ::: Ptr Rect2D)
-> Int -> "pDiscardRectangles" ::: Ptr Rect2D
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (16 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Rect2D) (Rect2D
e) (IO () -> IO ())
-> ((() -> IO ()) -> IO ()) -> (() -> IO ()) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO ()) -> () -> IO ()
forall a b. (a -> b) -> a -> b
$ ())) ("discardRectangles" ::: Vector Rect2D
discardRectangles)
  IO () -> ContT () IO ()
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
$ Ptr CommandBuffer_T
-> ("firstDiscardRectangle" ::: Word32)
-> ("firstDiscardRectangle" ::: Word32)
-> ("pDiscardRectangles" ::: Ptr Rect2D)
-> IO ()
vkCmdSetDiscardRectangleEXT' (CommandBuffer -> Ptr CommandBuffer_T
commandBufferHandle (CommandBuffer
commandBuffer)) ("firstDiscardRectangle" ::: Word32
firstDiscardRectangle) ((Int -> "firstDiscardRectangle" ::: Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (("discardRectangles" ::: Vector Rect2D) -> Int
forall a. Vector a -> Int
Data.Vector.length (("discardRectangles" ::: Vector Rect2D) -> Int)
-> ("discardRectangles" ::: Vector Rect2D) -> Int
forall a b. (a -> b) -> a -> b
$ ("discardRectangles" ::: Vector Rect2D
discardRectangles)) :: Word32)) ("pDiscardRectangles" ::: Ptr Rect2D
pPDiscardRectangles)
  () -> ContT () IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure (() -> ContT () IO ()) -> () -> ContT () IO ()
forall a b. (a -> b) -> a -> b
$ ()


-- | VkPhysicalDeviceDiscardRectanglePropertiesEXT - Structure describing
-- discard rectangle limits that can be supported by an implementation
--
-- = Members
--
-- The members of the 'PhysicalDeviceDiscardRectanglePropertiesEXT'
-- structure describe the following implementation-dependent limits:
--
-- = Description
--
-- If the 'PhysicalDeviceDiscardRectanglePropertiesEXT' structure is
-- included in the @pNext@ chain of
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceProperties2',
-- it is filled with the implementation-dependent limits.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PhysicalDeviceDiscardRectanglePropertiesEXT = PhysicalDeviceDiscardRectanglePropertiesEXT
  { -- | @maxDiscardRectangles@ is the maximum number of active discard
    -- rectangles that /can/ be specified.
    PhysicalDeviceDiscardRectanglePropertiesEXT
-> "firstDiscardRectangle" ::: Word32
maxDiscardRectangles :: Word32 }
  deriving (Typeable, PhysicalDeviceDiscardRectanglePropertiesEXT
-> PhysicalDeviceDiscardRectanglePropertiesEXT -> Bool
(PhysicalDeviceDiscardRectanglePropertiesEXT
 -> PhysicalDeviceDiscardRectanglePropertiesEXT -> Bool)
-> (PhysicalDeviceDiscardRectanglePropertiesEXT
    -> PhysicalDeviceDiscardRectanglePropertiesEXT -> Bool)
-> Eq PhysicalDeviceDiscardRectanglePropertiesEXT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhysicalDeviceDiscardRectanglePropertiesEXT
-> PhysicalDeviceDiscardRectanglePropertiesEXT -> Bool
$c/= :: PhysicalDeviceDiscardRectanglePropertiesEXT
-> PhysicalDeviceDiscardRectanglePropertiesEXT -> Bool
== :: PhysicalDeviceDiscardRectanglePropertiesEXT
-> PhysicalDeviceDiscardRectanglePropertiesEXT -> Bool
$c== :: PhysicalDeviceDiscardRectanglePropertiesEXT
-> PhysicalDeviceDiscardRectanglePropertiesEXT -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceDiscardRectanglePropertiesEXT)
#endif
deriving instance Show PhysicalDeviceDiscardRectanglePropertiesEXT

instance ToCStruct PhysicalDeviceDiscardRectanglePropertiesEXT where
  withCStruct :: PhysicalDeviceDiscardRectanglePropertiesEXT
-> (Ptr PhysicalDeviceDiscardRectanglePropertiesEXT -> IO b)
-> IO b
withCStruct x :: PhysicalDeviceDiscardRectanglePropertiesEXT
x f :: Ptr PhysicalDeviceDiscardRectanglePropertiesEXT -> IO b
f = Int
-> Int
-> (Ptr PhysicalDeviceDiscardRectanglePropertiesEXT -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 24 8 ((Ptr PhysicalDeviceDiscardRectanglePropertiesEXT -> IO b) -> IO b)
-> (Ptr PhysicalDeviceDiscardRectanglePropertiesEXT -> IO b)
-> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr PhysicalDeviceDiscardRectanglePropertiesEXT
p -> Ptr PhysicalDeviceDiscardRectanglePropertiesEXT
-> PhysicalDeviceDiscardRectanglePropertiesEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceDiscardRectanglePropertiesEXT
p PhysicalDeviceDiscardRectanglePropertiesEXT
x (Ptr PhysicalDeviceDiscardRectanglePropertiesEXT -> IO b
f Ptr PhysicalDeviceDiscardRectanglePropertiesEXT
p)
  pokeCStruct :: Ptr PhysicalDeviceDiscardRectanglePropertiesEXT
-> PhysicalDeviceDiscardRectanglePropertiesEXT -> IO b -> IO b
pokeCStruct p :: Ptr PhysicalDeviceDiscardRectanglePropertiesEXT
p PhysicalDeviceDiscardRectanglePropertiesEXT{..} f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceDiscardRectanglePropertiesEXT
p Ptr PhysicalDeviceDiscardRectanglePropertiesEXT
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_DISCARD_RECTANGLE_PROPERTIES_EXT)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceDiscardRectanglePropertiesEXT
p Ptr PhysicalDeviceDiscardRectanglePropertiesEXT
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr ("firstDiscardRectangle" ::: Word32)
-> ("firstDiscardRectangle" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceDiscardRectanglePropertiesEXT
p Ptr PhysicalDeviceDiscardRectanglePropertiesEXT
-> Int -> Ptr ("firstDiscardRectangle" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Word32)) ("firstDiscardRectangle" ::: Word32
maxDiscardRectangles)
    IO b
f
  cStructSize :: Int
cStructSize = 24
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr PhysicalDeviceDiscardRectanglePropertiesEXT -> IO b -> IO b
pokeZeroCStruct p :: Ptr PhysicalDeviceDiscardRectanglePropertiesEXT
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceDiscardRectanglePropertiesEXT
p Ptr PhysicalDeviceDiscardRectanglePropertiesEXT
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_DISCARD_RECTANGLE_PROPERTIES_EXT)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceDiscardRectanglePropertiesEXT
p Ptr PhysicalDeviceDiscardRectanglePropertiesEXT
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr ("firstDiscardRectangle" ::: Word32)
-> ("firstDiscardRectangle" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceDiscardRectanglePropertiesEXT
p Ptr PhysicalDeviceDiscardRectanglePropertiesEXT
-> Int -> Ptr ("firstDiscardRectangle" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Word32)) ("firstDiscardRectangle" ::: Word32
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct PhysicalDeviceDiscardRectanglePropertiesEXT where
  peekCStruct :: Ptr PhysicalDeviceDiscardRectanglePropertiesEXT
-> IO PhysicalDeviceDiscardRectanglePropertiesEXT
peekCStruct p :: Ptr PhysicalDeviceDiscardRectanglePropertiesEXT
p = do
    "firstDiscardRectangle" ::: Word32
maxDiscardRectangles <- Ptr ("firstDiscardRectangle" ::: Word32)
-> IO ("firstDiscardRectangle" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr PhysicalDeviceDiscardRectanglePropertiesEXT
p Ptr PhysicalDeviceDiscardRectanglePropertiesEXT
-> Int -> Ptr ("firstDiscardRectangle" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Word32))
    PhysicalDeviceDiscardRectanglePropertiesEXT
-> IO PhysicalDeviceDiscardRectanglePropertiesEXT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PhysicalDeviceDiscardRectanglePropertiesEXT
 -> IO PhysicalDeviceDiscardRectanglePropertiesEXT)
-> PhysicalDeviceDiscardRectanglePropertiesEXT
-> IO PhysicalDeviceDiscardRectanglePropertiesEXT
forall a b. (a -> b) -> a -> b
$ ("firstDiscardRectangle" ::: Word32)
-> PhysicalDeviceDiscardRectanglePropertiesEXT
PhysicalDeviceDiscardRectanglePropertiesEXT
             "firstDiscardRectangle" ::: Word32
maxDiscardRectangles

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

instance Zero PhysicalDeviceDiscardRectanglePropertiesEXT where
  zero :: PhysicalDeviceDiscardRectanglePropertiesEXT
zero = ("firstDiscardRectangle" ::: Word32)
-> PhysicalDeviceDiscardRectanglePropertiesEXT
PhysicalDeviceDiscardRectanglePropertiesEXT
           "firstDiscardRectangle" ::: Word32
forall a. Zero a => a
zero


-- | VkPipelineDiscardRectangleStateCreateInfoEXT - Structure specifying
-- discard rectangle
--
-- = Description
--
-- If the
-- 'Vulkan.Core10.Enums.DynamicState.DYNAMIC_STATE_DISCARD_RECTANGLE_EXT'
-- dynamic state is enabled for a pipeline, the @pDiscardRectangles@ member
-- is ignored.
--
-- When this structure is included in the @pNext@ chain of
-- 'Vulkan.Core10.Pipeline.GraphicsPipelineCreateInfo', it defines
-- parameters of the discard rectangle test. If this structure is not
-- included in the @pNext@ chain, it is equivalent to specifying this
-- structure with a @discardRectangleCount@ of @0@.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- 'DiscardRectangleModeEXT',
-- 'PipelineDiscardRectangleStateCreateFlagsEXT',
-- 'Vulkan.Core10.CommandBufferBuilding.Rect2D',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PipelineDiscardRectangleStateCreateInfoEXT = PipelineDiscardRectangleStateCreateInfoEXT
  { -- | @flags@ is reserved for future use.
    --
    -- @flags@ /must/ be @0@
    PipelineDiscardRectangleStateCreateInfoEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT
flags :: PipelineDiscardRectangleStateCreateFlagsEXT
  , -- | @discardRectangleMode@ is a 'DiscardRectangleModeEXT' value determining
    -- whether the discard rectangle test is inclusive or exclusive.
    --
    -- @discardRectangleMode@ /must/ be a valid 'DiscardRectangleModeEXT' value
    PipelineDiscardRectangleStateCreateInfoEXT
-> DiscardRectangleModeEXT
discardRectangleMode :: DiscardRectangleModeEXT
  , -- | @discardRectangleCount@ is the number of discard rectangles to use.
    --
    -- @discardRectangleCount@ /must/ be less than or equal to
    -- 'PhysicalDeviceDiscardRectanglePropertiesEXT'::@maxDiscardRectangles@
    PipelineDiscardRectangleStateCreateInfoEXT
-> "firstDiscardRectangle" ::: Word32
discardRectangleCount :: Word32
  , -- | @pDiscardRectangles@ is a pointer to an array of
    -- 'Vulkan.Core10.CommandBufferBuilding.Rect2D' structures defining discard
    -- rectangles.
    PipelineDiscardRectangleStateCreateInfoEXT
-> "discardRectangles" ::: Vector Rect2D
discardRectangles :: Vector Rect2D
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PipelineDiscardRectangleStateCreateInfoEXT)
#endif
deriving instance Show PipelineDiscardRectangleStateCreateInfoEXT

instance ToCStruct PipelineDiscardRectangleStateCreateInfoEXT where
  withCStruct :: PipelineDiscardRectangleStateCreateInfoEXT
-> (Ptr PipelineDiscardRectangleStateCreateInfoEXT -> IO b) -> IO b
withCStruct x :: PipelineDiscardRectangleStateCreateInfoEXT
x f :: Ptr PipelineDiscardRectangleStateCreateInfoEXT -> IO b
f = Int
-> Int
-> (Ptr PipelineDiscardRectangleStateCreateInfoEXT -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 40 8 ((Ptr PipelineDiscardRectangleStateCreateInfoEXT -> IO b) -> IO b)
-> (Ptr PipelineDiscardRectangleStateCreateInfoEXT -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr PipelineDiscardRectangleStateCreateInfoEXT
p -> Ptr PipelineDiscardRectangleStateCreateInfoEXT
-> PipelineDiscardRectangleStateCreateInfoEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PipelineDiscardRectangleStateCreateInfoEXT
p PipelineDiscardRectangleStateCreateInfoEXT
x (Ptr PipelineDiscardRectangleStateCreateInfoEXT -> IO b
f Ptr PipelineDiscardRectangleStateCreateInfoEXT
p)
  pokeCStruct :: Ptr PipelineDiscardRectangleStateCreateInfoEXT
-> PipelineDiscardRectangleStateCreateInfoEXT -> IO b -> IO b
pokeCStruct p :: Ptr PipelineDiscardRectangleStateCreateInfoEXT
p PipelineDiscardRectangleStateCreateInfoEXT{..} f :: 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 (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 PipelineDiscardRectangleStateCreateInfoEXT
p Ptr PipelineDiscardRectangleStateCreateInfoEXT
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PIPELINE_DISCARD_RECTANGLE_STATE_CREATE_INFO_EXT)
    IO () -> ContT b IO ()
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 PipelineDiscardRectangleStateCreateInfoEXT
p Ptr PipelineDiscardRectangleStateCreateInfoEXT
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    IO () -> ContT b IO ()
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 PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineDiscardRectangleStateCreateInfoEXT
p Ptr PipelineDiscardRectangleStateCreateInfoEXT
-> Int -> Ptr PipelineDiscardRectangleStateCreateFlagsEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr PipelineDiscardRectangleStateCreateFlagsEXT)) (PipelineDiscardRectangleStateCreateFlagsEXT
flags)
    IO () -> ContT b IO ()
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 DiscardRectangleModeEXT -> DiscardRectangleModeEXT -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineDiscardRectangleStateCreateInfoEXT
p Ptr PipelineDiscardRectangleStateCreateInfoEXT
-> Int -> Ptr DiscardRectangleModeEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr DiscardRectangleModeEXT)) (DiscardRectangleModeEXT
discardRectangleMode)
    let pDiscardRectanglesLength :: Int
pDiscardRectanglesLength = ("discardRectangles" ::: Vector Rect2D) -> Int
forall a. Vector a -> Int
Data.Vector.length (("discardRectangles" ::: Vector Rect2D) -> Int)
-> ("discardRectangles" ::: Vector Rect2D) -> Int
forall a b. (a -> b) -> a -> b
$ ("discardRectangles" ::: Vector Rect2D
discardRectangles)
    "firstDiscardRectangle" ::: Word32
discardRectangleCount'' <- IO ("firstDiscardRectangle" ::: Word32)
-> ContT b IO ("firstDiscardRectangle" ::: Word32)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ("firstDiscardRectangle" ::: Word32)
 -> ContT b IO ("firstDiscardRectangle" ::: Word32))
-> IO ("firstDiscardRectangle" ::: Word32)
-> ContT b IO ("firstDiscardRectangle" ::: Word32)
forall a b. (a -> b) -> a -> b
$ if ("firstDiscardRectangle" ::: Word32
discardRectangleCount) ("firstDiscardRectangle" ::: Word32)
-> ("firstDiscardRectangle" ::: Word32) -> Bool
forall a. Eq a => a -> a -> Bool
== 0
      then ("firstDiscardRectangle" ::: Word32)
-> IO ("firstDiscardRectangle" ::: Word32)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (("firstDiscardRectangle" ::: Word32)
 -> IO ("firstDiscardRectangle" ::: Word32))
-> ("firstDiscardRectangle" ::: Word32)
-> IO ("firstDiscardRectangle" ::: Word32)
forall a b. (a -> b) -> a -> b
$ Int -> "firstDiscardRectangle" ::: Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
pDiscardRectanglesLength
      else do
        Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Int -> "firstDiscardRectangle" ::: Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
pDiscardRectanglesLength ("firstDiscardRectangle" ::: Word32)
-> ("firstDiscardRectangle" ::: Word32) -> Bool
forall a. Eq a => a -> a -> Bool
== ("firstDiscardRectangle" ::: Word32
discardRectangleCount) Bool -> Bool -> Bool
|| Int
pDiscardRectanglesLength Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== 0) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
          IOException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument "" "pDiscardRectangles must be empty or have 'discardRectangleCount' elements" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
        ("firstDiscardRectangle" ::: Word32)
-> IO ("firstDiscardRectangle" ::: Word32)
forall (f :: * -> *) a. Applicative f => a -> f a
pure ("firstDiscardRectangle" ::: Word32
discardRectangleCount)
    IO () -> ContT b IO ()
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 ("firstDiscardRectangle" ::: Word32)
-> ("firstDiscardRectangle" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineDiscardRectangleStateCreateInfoEXT
p Ptr PipelineDiscardRectangleStateCreateInfoEXT
-> Int -> Ptr ("firstDiscardRectangle" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr Word32)) ("firstDiscardRectangle" ::: Word32
discardRectangleCount'')
    "pDiscardRectangles" ::: Ptr Rect2D
pDiscardRectangles'' <- if ("discardRectangles" ::: Vector Rect2D) -> Bool
forall a. Vector a -> Bool
Data.Vector.null ("discardRectangles" ::: Vector Rect2D
discardRectangles)
      then ("pDiscardRectangles" ::: Ptr Rect2D)
-> ContT b IO ("pDiscardRectangles" ::: Ptr Rect2D)
forall (f :: * -> *) a. Applicative f => a -> f a
pure "pDiscardRectangles" ::: Ptr Rect2D
forall a. Ptr a
nullPtr
      else do
        "pDiscardRectangles" ::: Ptr Rect2D
pPDiscardRectangles <- ((("pDiscardRectangles" ::: Ptr Rect2D) -> IO b) -> IO b)
-> ContT b IO ("pDiscardRectangles" ::: Ptr Rect2D)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pDiscardRectangles" ::: Ptr Rect2D) -> IO b) -> IO b)
 -> ContT b IO ("pDiscardRectangles" ::: Ptr Rect2D))
-> ((("pDiscardRectangles" ::: Ptr Rect2D) -> IO b) -> IO b)
-> ContT b IO ("pDiscardRectangles" ::: Ptr Rect2D)
forall a b. (a -> b) -> a -> b
$ Int
-> Int -> (("pDiscardRectangles" ::: Ptr Rect2D) -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned @Rect2D (((("discardRectangles" ::: Vector Rect2D) -> Int
forall a. Vector a -> Int
Data.Vector.length ("discardRectangles" ::: Vector Rect2D
discardRectangles))) Int -> Int -> Int
forall a. Num a => a -> a -> a
* 16) 4
        (Int -> Rect2D -> ContT b IO ())
-> ("discardRectangles" ::: Vector Rect2D) -> ContT b IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\i :: Int
i e :: Rect2D
e -> ((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ ("pDiscardRectangles" ::: Ptr Rect2D) -> Rect2D -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct ("pDiscardRectangles" ::: Ptr Rect2D
pPDiscardRectangles ("pDiscardRectangles" ::: Ptr Rect2D)
-> Int -> "pDiscardRectangles" ::: Ptr Rect2D
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (16 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Rect2D) (Rect2D
e) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())) (("discardRectangles" ::: Vector Rect2D
discardRectangles))
        ("pDiscardRectangles" ::: Ptr Rect2D)
-> ContT b IO ("pDiscardRectangles" ::: Ptr Rect2D)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (("pDiscardRectangles" ::: Ptr Rect2D)
 -> ContT b IO ("pDiscardRectangles" ::: Ptr Rect2D))
-> ("pDiscardRectangles" ::: Ptr Rect2D)
-> ContT b IO ("pDiscardRectangles" ::: Ptr Rect2D)
forall a b. (a -> b) -> a -> b
$ "pDiscardRectangles" ::: Ptr Rect2D
pPDiscardRectangles
    IO () -> ContT b IO ()
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 ("pDiscardRectangles" ::: Ptr Rect2D)
-> ("pDiscardRectangles" ::: Ptr Rect2D) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineDiscardRectangleStateCreateInfoEXT
p Ptr PipelineDiscardRectangleStateCreateInfoEXT
-> Int -> Ptr ("pDiscardRectangles" ::: Ptr Rect2D)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr (Ptr Rect2D))) "pDiscardRectangles" ::: Ptr Rect2D
pDiscardRectangles''
    IO b -> ContT b IO b
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO b -> ContT b IO b) -> IO b -> ContT b IO b
forall a b. (a -> b) -> a -> b
$ IO b
f
  cStructSize :: Int
cStructSize = 40
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr PipelineDiscardRectangleStateCreateInfoEXT -> IO b -> IO b
pokeZeroCStruct p :: Ptr PipelineDiscardRectangleStateCreateInfoEXT
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineDiscardRectangleStateCreateInfoEXT
p Ptr PipelineDiscardRectangleStateCreateInfoEXT
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PIPELINE_DISCARD_RECTANGLE_STATE_CREATE_INFO_EXT)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineDiscardRectangleStateCreateInfoEXT
p Ptr PipelineDiscardRectangleStateCreateInfoEXT
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr DiscardRectangleModeEXT -> DiscardRectangleModeEXT -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineDiscardRectangleStateCreateInfoEXT
p Ptr PipelineDiscardRectangleStateCreateInfoEXT
-> Int -> Ptr DiscardRectangleModeEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr DiscardRectangleModeEXT)) (DiscardRectangleModeEXT
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct PipelineDiscardRectangleStateCreateInfoEXT where
  peekCStruct :: Ptr PipelineDiscardRectangleStateCreateInfoEXT
-> IO PipelineDiscardRectangleStateCreateInfoEXT
peekCStruct p :: Ptr PipelineDiscardRectangleStateCreateInfoEXT
p = do
    PipelineDiscardRectangleStateCreateFlagsEXT
flags <- Ptr PipelineDiscardRectangleStateCreateFlagsEXT
-> IO PipelineDiscardRectangleStateCreateFlagsEXT
forall a. Storable a => Ptr a -> IO a
peek @PipelineDiscardRectangleStateCreateFlagsEXT ((Ptr PipelineDiscardRectangleStateCreateInfoEXT
p Ptr PipelineDiscardRectangleStateCreateInfoEXT
-> Int -> Ptr PipelineDiscardRectangleStateCreateFlagsEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr PipelineDiscardRectangleStateCreateFlagsEXT))
    DiscardRectangleModeEXT
discardRectangleMode <- Ptr DiscardRectangleModeEXT -> IO DiscardRectangleModeEXT
forall a. Storable a => Ptr a -> IO a
peek @DiscardRectangleModeEXT ((Ptr PipelineDiscardRectangleStateCreateInfoEXT
p Ptr PipelineDiscardRectangleStateCreateInfoEXT
-> Int -> Ptr DiscardRectangleModeEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr DiscardRectangleModeEXT))
    "firstDiscardRectangle" ::: Word32
discardRectangleCount <- Ptr ("firstDiscardRectangle" ::: Word32)
-> IO ("firstDiscardRectangle" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr PipelineDiscardRectangleStateCreateInfoEXT
p Ptr PipelineDiscardRectangleStateCreateInfoEXT
-> Int -> Ptr ("firstDiscardRectangle" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr Word32))
    "pDiscardRectangles" ::: Ptr Rect2D
pDiscardRectangles <- Ptr ("pDiscardRectangles" ::: Ptr Rect2D)
-> IO ("pDiscardRectangles" ::: Ptr Rect2D)
forall a. Storable a => Ptr a -> IO a
peek @(Ptr Rect2D) ((Ptr PipelineDiscardRectangleStateCreateInfoEXT
p Ptr PipelineDiscardRectangleStateCreateInfoEXT
-> Int -> Ptr ("pDiscardRectangles" ::: Ptr Rect2D)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr (Ptr Rect2D)))
    let pDiscardRectanglesLength :: Int
pDiscardRectanglesLength = if "pDiscardRectangles" ::: Ptr Rect2D
pDiscardRectangles ("pDiscardRectangles" ::: Ptr Rect2D)
-> ("pDiscardRectangles" ::: Ptr Rect2D) -> Bool
forall a. Eq a => a -> a -> Bool
== "pDiscardRectangles" ::: Ptr Rect2D
forall a. Ptr a
nullPtr then 0 else (("firstDiscardRectangle" ::: Word32) -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral "firstDiscardRectangle" ::: Word32
discardRectangleCount)
    "discardRectangles" ::: Vector Rect2D
pDiscardRectangles' <- Int
-> (Int -> IO Rect2D) -> IO ("discardRectangles" ::: Vector Rect2D)
forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM Int
pDiscardRectanglesLength (\i :: Int
i -> ("pDiscardRectangles" ::: Ptr Rect2D) -> IO Rect2D
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @Rect2D (("pDiscardRectangles" ::: Ptr Rect2D
pDiscardRectangles ("pDiscardRectangles" ::: Ptr Rect2D)
-> Int -> "pDiscardRectangles" ::: Ptr Rect2D
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (16 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Rect2D)))
    PipelineDiscardRectangleStateCreateInfoEXT
-> IO PipelineDiscardRectangleStateCreateInfoEXT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PipelineDiscardRectangleStateCreateInfoEXT
 -> IO PipelineDiscardRectangleStateCreateInfoEXT)
-> PipelineDiscardRectangleStateCreateInfoEXT
-> IO PipelineDiscardRectangleStateCreateInfoEXT
forall a b. (a -> b) -> a -> b
$ PipelineDiscardRectangleStateCreateFlagsEXT
-> DiscardRectangleModeEXT
-> ("firstDiscardRectangle" ::: Word32)
-> ("discardRectangles" ::: Vector Rect2D)
-> PipelineDiscardRectangleStateCreateInfoEXT
PipelineDiscardRectangleStateCreateInfoEXT
             PipelineDiscardRectangleStateCreateFlagsEXT
flags DiscardRectangleModeEXT
discardRectangleMode "firstDiscardRectangle" ::: Word32
discardRectangleCount "discardRectangles" ::: Vector Rect2D
pDiscardRectangles'

instance Zero PipelineDiscardRectangleStateCreateInfoEXT where
  zero :: PipelineDiscardRectangleStateCreateInfoEXT
zero = PipelineDiscardRectangleStateCreateFlagsEXT
-> DiscardRectangleModeEXT
-> ("firstDiscardRectangle" ::: Word32)
-> ("discardRectangles" ::: Vector Rect2D)
-> PipelineDiscardRectangleStateCreateInfoEXT
PipelineDiscardRectangleStateCreateInfoEXT
           PipelineDiscardRectangleStateCreateFlagsEXT
forall a. Zero a => a
zero
           DiscardRectangleModeEXT
forall a. Zero a => a
zero
           "firstDiscardRectangle" ::: Word32
forall a. Zero a => a
zero
           "discardRectangles" ::: Vector Rect2D
forall a. Monoid a => a
mempty


-- | VkPipelineDiscardRectangleStateCreateFlagsEXT - Reserved for future use
--
-- = Description
--
-- 'PipelineDiscardRectangleStateCreateFlagsEXT' is a bitmask type for
-- setting a mask, but is currently reserved for future use.
--
-- = See Also
--
-- 'PipelineDiscardRectangleStateCreateInfoEXT'
newtype PipelineDiscardRectangleStateCreateFlagsEXT = PipelineDiscardRectangleStateCreateFlagsEXT Flags
  deriving newtype (PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT -> Bool
(PipelineDiscardRectangleStateCreateFlagsEXT
 -> PipelineDiscardRectangleStateCreateFlagsEXT -> Bool)
-> (PipelineDiscardRectangleStateCreateFlagsEXT
    -> PipelineDiscardRectangleStateCreateFlagsEXT -> Bool)
-> Eq PipelineDiscardRectangleStateCreateFlagsEXT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT -> Bool
$c/= :: PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT -> Bool
== :: PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT -> Bool
$c== :: PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT -> Bool
Eq, Eq PipelineDiscardRectangleStateCreateFlagsEXT
Eq PipelineDiscardRectangleStateCreateFlagsEXT =>
(PipelineDiscardRectangleStateCreateFlagsEXT
 -> PipelineDiscardRectangleStateCreateFlagsEXT -> Ordering)
-> (PipelineDiscardRectangleStateCreateFlagsEXT
    -> PipelineDiscardRectangleStateCreateFlagsEXT -> Bool)
-> (PipelineDiscardRectangleStateCreateFlagsEXT
    -> PipelineDiscardRectangleStateCreateFlagsEXT -> Bool)
-> (PipelineDiscardRectangleStateCreateFlagsEXT
    -> PipelineDiscardRectangleStateCreateFlagsEXT -> Bool)
-> (PipelineDiscardRectangleStateCreateFlagsEXT
    -> PipelineDiscardRectangleStateCreateFlagsEXT -> Bool)
-> (PipelineDiscardRectangleStateCreateFlagsEXT
    -> PipelineDiscardRectangleStateCreateFlagsEXT
    -> PipelineDiscardRectangleStateCreateFlagsEXT)
-> (PipelineDiscardRectangleStateCreateFlagsEXT
    -> PipelineDiscardRectangleStateCreateFlagsEXT
    -> PipelineDiscardRectangleStateCreateFlagsEXT)
-> Ord PipelineDiscardRectangleStateCreateFlagsEXT
PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT -> Bool
PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT -> Ordering
PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT
$cmin :: PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT
max :: PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT
$cmax :: PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT
>= :: PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT -> Bool
$c>= :: PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT -> Bool
> :: PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT -> Bool
$c> :: PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT -> Bool
<= :: PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT -> Bool
$c<= :: PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT -> Bool
< :: PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT -> Bool
$c< :: PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT -> Bool
compare :: PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT -> Ordering
$ccompare :: PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT -> Ordering
$cp1Ord :: Eq PipelineDiscardRectangleStateCreateFlagsEXT
Ord, Ptr b -> Int -> IO PipelineDiscardRectangleStateCreateFlagsEXT
Ptr b
-> Int -> PipelineDiscardRectangleStateCreateFlagsEXT -> IO ()
Ptr PipelineDiscardRectangleStateCreateFlagsEXT
-> IO PipelineDiscardRectangleStateCreateFlagsEXT
Ptr PipelineDiscardRectangleStateCreateFlagsEXT
-> Int -> IO PipelineDiscardRectangleStateCreateFlagsEXT
Ptr PipelineDiscardRectangleStateCreateFlagsEXT
-> Int -> PipelineDiscardRectangleStateCreateFlagsEXT -> IO ()
Ptr PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT -> IO ()
PipelineDiscardRectangleStateCreateFlagsEXT -> Int
(PipelineDiscardRectangleStateCreateFlagsEXT -> Int)
-> (PipelineDiscardRectangleStateCreateFlagsEXT -> Int)
-> (Ptr PipelineDiscardRectangleStateCreateFlagsEXT
    -> Int -> IO PipelineDiscardRectangleStateCreateFlagsEXT)
-> (Ptr PipelineDiscardRectangleStateCreateFlagsEXT
    -> Int -> PipelineDiscardRectangleStateCreateFlagsEXT -> IO ())
-> (forall b.
    Ptr b -> Int -> IO PipelineDiscardRectangleStateCreateFlagsEXT)
-> (forall b.
    Ptr b
    -> Int -> PipelineDiscardRectangleStateCreateFlagsEXT -> IO ())
-> (Ptr PipelineDiscardRectangleStateCreateFlagsEXT
    -> IO PipelineDiscardRectangleStateCreateFlagsEXT)
-> (Ptr PipelineDiscardRectangleStateCreateFlagsEXT
    -> PipelineDiscardRectangleStateCreateFlagsEXT -> IO ())
-> Storable PipelineDiscardRectangleStateCreateFlagsEXT
forall b.
Ptr b -> Int -> IO PipelineDiscardRectangleStateCreateFlagsEXT
forall b.
Ptr b
-> Int -> PipelineDiscardRectangleStateCreateFlagsEXT -> IO ()
forall a.
(a -> Int)
-> (a -> Int)
-> (Ptr a -> Int -> IO a)
-> (Ptr a -> Int -> a -> IO ())
-> (forall b. Ptr b -> Int -> IO a)
-> (forall b. Ptr b -> Int -> a -> IO ())
-> (Ptr a -> IO a)
-> (Ptr a -> a -> IO ())
-> Storable a
poke :: Ptr PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT -> IO ()
$cpoke :: Ptr PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT -> IO ()
peek :: Ptr PipelineDiscardRectangleStateCreateFlagsEXT
-> IO PipelineDiscardRectangleStateCreateFlagsEXT
$cpeek :: Ptr PipelineDiscardRectangleStateCreateFlagsEXT
-> IO PipelineDiscardRectangleStateCreateFlagsEXT
pokeByteOff :: Ptr b
-> Int -> PipelineDiscardRectangleStateCreateFlagsEXT -> IO ()
$cpokeByteOff :: forall b.
Ptr b
-> Int -> PipelineDiscardRectangleStateCreateFlagsEXT -> IO ()
peekByteOff :: Ptr b -> Int -> IO PipelineDiscardRectangleStateCreateFlagsEXT
$cpeekByteOff :: forall b.
Ptr b -> Int -> IO PipelineDiscardRectangleStateCreateFlagsEXT
pokeElemOff :: Ptr PipelineDiscardRectangleStateCreateFlagsEXT
-> Int -> PipelineDiscardRectangleStateCreateFlagsEXT -> IO ()
$cpokeElemOff :: Ptr PipelineDiscardRectangleStateCreateFlagsEXT
-> Int -> PipelineDiscardRectangleStateCreateFlagsEXT -> IO ()
peekElemOff :: Ptr PipelineDiscardRectangleStateCreateFlagsEXT
-> Int -> IO PipelineDiscardRectangleStateCreateFlagsEXT
$cpeekElemOff :: Ptr PipelineDiscardRectangleStateCreateFlagsEXT
-> Int -> IO PipelineDiscardRectangleStateCreateFlagsEXT
alignment :: PipelineDiscardRectangleStateCreateFlagsEXT -> Int
$calignment :: PipelineDiscardRectangleStateCreateFlagsEXT -> Int
sizeOf :: PipelineDiscardRectangleStateCreateFlagsEXT -> Int
$csizeOf :: PipelineDiscardRectangleStateCreateFlagsEXT -> Int
Storable, PipelineDiscardRectangleStateCreateFlagsEXT
PipelineDiscardRectangleStateCreateFlagsEXT
-> Zero PipelineDiscardRectangleStateCreateFlagsEXT
forall a. a -> Zero a
zero :: PipelineDiscardRectangleStateCreateFlagsEXT
$czero :: PipelineDiscardRectangleStateCreateFlagsEXT
Zero, Eq PipelineDiscardRectangleStateCreateFlagsEXT
PipelineDiscardRectangleStateCreateFlagsEXT
Eq PipelineDiscardRectangleStateCreateFlagsEXT =>
(PipelineDiscardRectangleStateCreateFlagsEXT
 -> PipelineDiscardRectangleStateCreateFlagsEXT
 -> PipelineDiscardRectangleStateCreateFlagsEXT)
-> (PipelineDiscardRectangleStateCreateFlagsEXT
    -> PipelineDiscardRectangleStateCreateFlagsEXT
    -> PipelineDiscardRectangleStateCreateFlagsEXT)
-> (PipelineDiscardRectangleStateCreateFlagsEXT
    -> PipelineDiscardRectangleStateCreateFlagsEXT
    -> PipelineDiscardRectangleStateCreateFlagsEXT)
-> (PipelineDiscardRectangleStateCreateFlagsEXT
    -> PipelineDiscardRectangleStateCreateFlagsEXT)
-> (PipelineDiscardRectangleStateCreateFlagsEXT
    -> Int -> PipelineDiscardRectangleStateCreateFlagsEXT)
-> (PipelineDiscardRectangleStateCreateFlagsEXT
    -> Int -> PipelineDiscardRectangleStateCreateFlagsEXT)
-> PipelineDiscardRectangleStateCreateFlagsEXT
-> (Int -> PipelineDiscardRectangleStateCreateFlagsEXT)
-> (PipelineDiscardRectangleStateCreateFlagsEXT
    -> Int -> PipelineDiscardRectangleStateCreateFlagsEXT)
-> (PipelineDiscardRectangleStateCreateFlagsEXT
    -> Int -> PipelineDiscardRectangleStateCreateFlagsEXT)
-> (PipelineDiscardRectangleStateCreateFlagsEXT
    -> Int -> PipelineDiscardRectangleStateCreateFlagsEXT)
-> (PipelineDiscardRectangleStateCreateFlagsEXT -> Int -> Bool)
-> (PipelineDiscardRectangleStateCreateFlagsEXT -> Maybe Int)
-> (PipelineDiscardRectangleStateCreateFlagsEXT -> Int)
-> (PipelineDiscardRectangleStateCreateFlagsEXT -> Bool)
-> (PipelineDiscardRectangleStateCreateFlagsEXT
    -> Int -> PipelineDiscardRectangleStateCreateFlagsEXT)
-> (PipelineDiscardRectangleStateCreateFlagsEXT
    -> Int -> PipelineDiscardRectangleStateCreateFlagsEXT)
-> (PipelineDiscardRectangleStateCreateFlagsEXT
    -> Int -> PipelineDiscardRectangleStateCreateFlagsEXT)
-> (PipelineDiscardRectangleStateCreateFlagsEXT
    -> Int -> PipelineDiscardRectangleStateCreateFlagsEXT)
-> (PipelineDiscardRectangleStateCreateFlagsEXT
    -> Int -> PipelineDiscardRectangleStateCreateFlagsEXT)
-> (PipelineDiscardRectangleStateCreateFlagsEXT
    -> Int -> PipelineDiscardRectangleStateCreateFlagsEXT)
-> (PipelineDiscardRectangleStateCreateFlagsEXT -> Int)
-> Bits PipelineDiscardRectangleStateCreateFlagsEXT
Int -> PipelineDiscardRectangleStateCreateFlagsEXT
PipelineDiscardRectangleStateCreateFlagsEXT -> Bool
PipelineDiscardRectangleStateCreateFlagsEXT -> Int
PipelineDiscardRectangleStateCreateFlagsEXT -> Maybe Int
PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT
PipelineDiscardRectangleStateCreateFlagsEXT -> Int -> Bool
PipelineDiscardRectangleStateCreateFlagsEXT
-> Int -> PipelineDiscardRectangleStateCreateFlagsEXT
PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT
forall a.
Eq a =>
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> a
-> (Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> Bool)
-> (a -> Maybe Int)
-> (a -> Int)
-> (a -> Bool)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int)
-> Bits a
popCount :: PipelineDiscardRectangleStateCreateFlagsEXT -> Int
$cpopCount :: PipelineDiscardRectangleStateCreateFlagsEXT -> Int
rotateR :: PipelineDiscardRectangleStateCreateFlagsEXT
-> Int -> PipelineDiscardRectangleStateCreateFlagsEXT
$crotateR :: PipelineDiscardRectangleStateCreateFlagsEXT
-> Int -> PipelineDiscardRectangleStateCreateFlagsEXT
rotateL :: PipelineDiscardRectangleStateCreateFlagsEXT
-> Int -> PipelineDiscardRectangleStateCreateFlagsEXT
$crotateL :: PipelineDiscardRectangleStateCreateFlagsEXT
-> Int -> PipelineDiscardRectangleStateCreateFlagsEXT
unsafeShiftR :: PipelineDiscardRectangleStateCreateFlagsEXT
-> Int -> PipelineDiscardRectangleStateCreateFlagsEXT
$cunsafeShiftR :: PipelineDiscardRectangleStateCreateFlagsEXT
-> Int -> PipelineDiscardRectangleStateCreateFlagsEXT
shiftR :: PipelineDiscardRectangleStateCreateFlagsEXT
-> Int -> PipelineDiscardRectangleStateCreateFlagsEXT
$cshiftR :: PipelineDiscardRectangleStateCreateFlagsEXT
-> Int -> PipelineDiscardRectangleStateCreateFlagsEXT
unsafeShiftL :: PipelineDiscardRectangleStateCreateFlagsEXT
-> Int -> PipelineDiscardRectangleStateCreateFlagsEXT
$cunsafeShiftL :: PipelineDiscardRectangleStateCreateFlagsEXT
-> Int -> PipelineDiscardRectangleStateCreateFlagsEXT
shiftL :: PipelineDiscardRectangleStateCreateFlagsEXT
-> Int -> PipelineDiscardRectangleStateCreateFlagsEXT
$cshiftL :: PipelineDiscardRectangleStateCreateFlagsEXT
-> Int -> PipelineDiscardRectangleStateCreateFlagsEXT
isSigned :: PipelineDiscardRectangleStateCreateFlagsEXT -> Bool
$cisSigned :: PipelineDiscardRectangleStateCreateFlagsEXT -> Bool
bitSize :: PipelineDiscardRectangleStateCreateFlagsEXT -> Int
$cbitSize :: PipelineDiscardRectangleStateCreateFlagsEXT -> Int
bitSizeMaybe :: PipelineDiscardRectangleStateCreateFlagsEXT -> Maybe Int
$cbitSizeMaybe :: PipelineDiscardRectangleStateCreateFlagsEXT -> Maybe Int
testBit :: PipelineDiscardRectangleStateCreateFlagsEXT -> Int -> Bool
$ctestBit :: PipelineDiscardRectangleStateCreateFlagsEXT -> Int -> Bool
complementBit :: PipelineDiscardRectangleStateCreateFlagsEXT
-> Int -> PipelineDiscardRectangleStateCreateFlagsEXT
$ccomplementBit :: PipelineDiscardRectangleStateCreateFlagsEXT
-> Int -> PipelineDiscardRectangleStateCreateFlagsEXT
clearBit :: PipelineDiscardRectangleStateCreateFlagsEXT
-> Int -> PipelineDiscardRectangleStateCreateFlagsEXT
$cclearBit :: PipelineDiscardRectangleStateCreateFlagsEXT
-> Int -> PipelineDiscardRectangleStateCreateFlagsEXT
setBit :: PipelineDiscardRectangleStateCreateFlagsEXT
-> Int -> PipelineDiscardRectangleStateCreateFlagsEXT
$csetBit :: PipelineDiscardRectangleStateCreateFlagsEXT
-> Int -> PipelineDiscardRectangleStateCreateFlagsEXT
bit :: Int -> PipelineDiscardRectangleStateCreateFlagsEXT
$cbit :: Int -> PipelineDiscardRectangleStateCreateFlagsEXT
zeroBits :: PipelineDiscardRectangleStateCreateFlagsEXT
$czeroBits :: PipelineDiscardRectangleStateCreateFlagsEXT
rotate :: PipelineDiscardRectangleStateCreateFlagsEXT
-> Int -> PipelineDiscardRectangleStateCreateFlagsEXT
$crotate :: PipelineDiscardRectangleStateCreateFlagsEXT
-> Int -> PipelineDiscardRectangleStateCreateFlagsEXT
shift :: PipelineDiscardRectangleStateCreateFlagsEXT
-> Int -> PipelineDiscardRectangleStateCreateFlagsEXT
$cshift :: PipelineDiscardRectangleStateCreateFlagsEXT
-> Int -> PipelineDiscardRectangleStateCreateFlagsEXT
complement :: PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT
$ccomplement :: PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT
xor :: PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT
$cxor :: PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT
.|. :: PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT
$c.|. :: PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT
.&. :: PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT
$c.&. :: PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT
-> PipelineDiscardRectangleStateCreateFlagsEXT
$cp1Bits :: Eq PipelineDiscardRectangleStateCreateFlagsEXT
Bits)



instance Show PipelineDiscardRectangleStateCreateFlagsEXT where
  showsPrec :: Int -> PipelineDiscardRectangleStateCreateFlagsEXT -> ShowS
showsPrec p :: Int
p = \case
    PipelineDiscardRectangleStateCreateFlagsEXT x :: "firstDiscardRectangle" ::: Word32
x -> Bool -> ShowS -> ShowS
showParen (Int
p Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= 11) (String -> ShowS
showString "PipelineDiscardRectangleStateCreateFlagsEXT 0x" ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ("firstDiscardRectangle" ::: Word32) -> ShowS
forall a. (Integral a, Show a) => a -> ShowS
showHex "firstDiscardRectangle" ::: Word32
x)

instance Read PipelineDiscardRectangleStateCreateFlagsEXT where
  readPrec :: ReadPrec PipelineDiscardRectangleStateCreateFlagsEXT
readPrec = ReadPrec PipelineDiscardRectangleStateCreateFlagsEXT
-> ReadPrec PipelineDiscardRectangleStateCreateFlagsEXT
forall a. ReadPrec a -> ReadPrec a
parens ([(String, ReadPrec PipelineDiscardRectangleStateCreateFlagsEXT)]
-> ReadPrec PipelineDiscardRectangleStateCreateFlagsEXT
forall a. [(String, ReadPrec a)] -> ReadPrec a
choose []
                     ReadPrec PipelineDiscardRectangleStateCreateFlagsEXT
-> ReadPrec PipelineDiscardRectangleStateCreateFlagsEXT
-> ReadPrec PipelineDiscardRectangleStateCreateFlagsEXT
forall a. ReadPrec a -> ReadPrec a -> ReadPrec a
+++
                     Int
-> ReadPrec PipelineDiscardRectangleStateCreateFlagsEXT
-> ReadPrec PipelineDiscardRectangleStateCreateFlagsEXT
forall a. Int -> ReadPrec a -> ReadPrec a
prec 10 (do
                       Lexeme -> ReadPrec ()
expectP (String -> Lexeme
Ident "PipelineDiscardRectangleStateCreateFlagsEXT")
                       "firstDiscardRectangle" ::: Word32
v <- ReadPrec ("firstDiscardRectangle" ::: Word32)
-> ReadPrec ("firstDiscardRectangle" ::: Word32)
forall a. ReadPrec a -> ReadPrec a
step ReadPrec ("firstDiscardRectangle" ::: Word32)
forall a. Read a => ReadPrec a
readPrec
                       PipelineDiscardRectangleStateCreateFlagsEXT
-> ReadPrec PipelineDiscardRectangleStateCreateFlagsEXT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (("firstDiscardRectangle" ::: Word32)
-> PipelineDiscardRectangleStateCreateFlagsEXT
PipelineDiscardRectangleStateCreateFlagsEXT "firstDiscardRectangle" ::: Word32
v)))


-- | VkDiscardRectangleModeEXT - Specify the discard rectangle mode
--
-- = See Also
--
-- 'PipelineDiscardRectangleStateCreateInfoEXT'
newtype DiscardRectangleModeEXT = DiscardRectangleModeEXT Int32
  deriving newtype (DiscardRectangleModeEXT -> DiscardRectangleModeEXT -> Bool
(DiscardRectangleModeEXT -> DiscardRectangleModeEXT -> Bool)
-> (DiscardRectangleModeEXT -> DiscardRectangleModeEXT -> Bool)
-> Eq DiscardRectangleModeEXT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DiscardRectangleModeEXT -> DiscardRectangleModeEXT -> Bool
$c/= :: DiscardRectangleModeEXT -> DiscardRectangleModeEXT -> Bool
== :: DiscardRectangleModeEXT -> DiscardRectangleModeEXT -> Bool
$c== :: DiscardRectangleModeEXT -> DiscardRectangleModeEXT -> Bool
Eq, Eq DiscardRectangleModeEXT
Eq DiscardRectangleModeEXT =>
(DiscardRectangleModeEXT -> DiscardRectangleModeEXT -> Ordering)
-> (DiscardRectangleModeEXT -> DiscardRectangleModeEXT -> Bool)
-> (DiscardRectangleModeEXT -> DiscardRectangleModeEXT -> Bool)
-> (DiscardRectangleModeEXT -> DiscardRectangleModeEXT -> Bool)
-> (DiscardRectangleModeEXT -> DiscardRectangleModeEXT -> Bool)
-> (DiscardRectangleModeEXT
    -> DiscardRectangleModeEXT -> DiscardRectangleModeEXT)
-> (DiscardRectangleModeEXT
    -> DiscardRectangleModeEXT -> DiscardRectangleModeEXT)
-> Ord DiscardRectangleModeEXT
DiscardRectangleModeEXT -> DiscardRectangleModeEXT -> Bool
DiscardRectangleModeEXT -> DiscardRectangleModeEXT -> Ordering
DiscardRectangleModeEXT
-> DiscardRectangleModeEXT -> DiscardRectangleModeEXT
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: DiscardRectangleModeEXT
-> DiscardRectangleModeEXT -> DiscardRectangleModeEXT
$cmin :: DiscardRectangleModeEXT
-> DiscardRectangleModeEXT -> DiscardRectangleModeEXT
max :: DiscardRectangleModeEXT
-> DiscardRectangleModeEXT -> DiscardRectangleModeEXT
$cmax :: DiscardRectangleModeEXT
-> DiscardRectangleModeEXT -> DiscardRectangleModeEXT
>= :: DiscardRectangleModeEXT -> DiscardRectangleModeEXT -> Bool
$c>= :: DiscardRectangleModeEXT -> DiscardRectangleModeEXT -> Bool
> :: DiscardRectangleModeEXT -> DiscardRectangleModeEXT -> Bool
$c> :: DiscardRectangleModeEXT -> DiscardRectangleModeEXT -> Bool
<= :: DiscardRectangleModeEXT -> DiscardRectangleModeEXT -> Bool
$c<= :: DiscardRectangleModeEXT -> DiscardRectangleModeEXT -> Bool
< :: DiscardRectangleModeEXT -> DiscardRectangleModeEXT -> Bool
$c< :: DiscardRectangleModeEXT -> DiscardRectangleModeEXT -> Bool
compare :: DiscardRectangleModeEXT -> DiscardRectangleModeEXT -> Ordering
$ccompare :: DiscardRectangleModeEXT -> DiscardRectangleModeEXT -> Ordering
$cp1Ord :: Eq DiscardRectangleModeEXT
Ord, Ptr b -> Int -> IO DiscardRectangleModeEXT
Ptr b -> Int -> DiscardRectangleModeEXT -> IO ()
Ptr DiscardRectangleModeEXT -> IO DiscardRectangleModeEXT
Ptr DiscardRectangleModeEXT -> Int -> IO DiscardRectangleModeEXT
Ptr DiscardRectangleModeEXT
-> Int -> DiscardRectangleModeEXT -> IO ()
Ptr DiscardRectangleModeEXT -> DiscardRectangleModeEXT -> IO ()
DiscardRectangleModeEXT -> Int
(DiscardRectangleModeEXT -> Int)
-> (DiscardRectangleModeEXT -> Int)
-> (Ptr DiscardRectangleModeEXT
    -> Int -> IO DiscardRectangleModeEXT)
-> (Ptr DiscardRectangleModeEXT
    -> Int -> DiscardRectangleModeEXT -> IO ())
-> (forall b. Ptr b -> Int -> IO DiscardRectangleModeEXT)
-> (forall b. Ptr b -> Int -> DiscardRectangleModeEXT -> IO ())
-> (Ptr DiscardRectangleModeEXT -> IO DiscardRectangleModeEXT)
-> (Ptr DiscardRectangleModeEXT
    -> DiscardRectangleModeEXT -> IO ())
-> Storable DiscardRectangleModeEXT
forall b. Ptr b -> Int -> IO DiscardRectangleModeEXT
forall b. Ptr b -> Int -> DiscardRectangleModeEXT -> IO ()
forall a.
(a -> Int)
-> (a -> Int)
-> (Ptr a -> Int -> IO a)
-> (Ptr a -> Int -> a -> IO ())
-> (forall b. Ptr b -> Int -> IO a)
-> (forall b. Ptr b -> Int -> a -> IO ())
-> (Ptr a -> IO a)
-> (Ptr a -> a -> IO ())
-> Storable a
poke :: Ptr DiscardRectangleModeEXT -> DiscardRectangleModeEXT -> IO ()
$cpoke :: Ptr DiscardRectangleModeEXT -> DiscardRectangleModeEXT -> IO ()
peek :: Ptr DiscardRectangleModeEXT -> IO DiscardRectangleModeEXT
$cpeek :: Ptr DiscardRectangleModeEXT -> IO DiscardRectangleModeEXT
pokeByteOff :: Ptr b -> Int -> DiscardRectangleModeEXT -> IO ()
$cpokeByteOff :: forall b. Ptr b -> Int -> DiscardRectangleModeEXT -> IO ()
peekByteOff :: Ptr b -> Int -> IO DiscardRectangleModeEXT
$cpeekByteOff :: forall b. Ptr b -> Int -> IO DiscardRectangleModeEXT
pokeElemOff :: Ptr DiscardRectangleModeEXT
-> Int -> DiscardRectangleModeEXT -> IO ()
$cpokeElemOff :: Ptr DiscardRectangleModeEXT
-> Int -> DiscardRectangleModeEXT -> IO ()
peekElemOff :: Ptr DiscardRectangleModeEXT -> Int -> IO DiscardRectangleModeEXT
$cpeekElemOff :: Ptr DiscardRectangleModeEXT -> Int -> IO DiscardRectangleModeEXT
alignment :: DiscardRectangleModeEXT -> Int
$calignment :: DiscardRectangleModeEXT -> Int
sizeOf :: DiscardRectangleModeEXT -> Int
$csizeOf :: DiscardRectangleModeEXT -> Int
Storable, DiscardRectangleModeEXT
DiscardRectangleModeEXT -> Zero DiscardRectangleModeEXT
forall a. a -> Zero a
zero :: DiscardRectangleModeEXT
$czero :: DiscardRectangleModeEXT
Zero)

-- | 'DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT' specifies that the discard
-- rectangle test is inclusive.
pattern $bDISCARD_RECTANGLE_MODE_INCLUSIVE_EXT :: DiscardRectangleModeEXT
$mDISCARD_RECTANGLE_MODE_INCLUSIVE_EXT :: forall r.
DiscardRectangleModeEXT -> (Void# -> r) -> (Void# -> r) -> r
DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT = DiscardRectangleModeEXT 0
-- | 'DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT' specifies that the discard
-- rectangle test is exclusive.
pattern $bDISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT :: DiscardRectangleModeEXT
$mDISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT :: forall r.
DiscardRectangleModeEXT -> (Void# -> r) -> (Void# -> r) -> r
DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT = DiscardRectangleModeEXT 1
{-# complete DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT,
             DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT :: DiscardRectangleModeEXT #-}

instance Show DiscardRectangleModeEXT where
  showsPrec :: Int -> DiscardRectangleModeEXT -> ShowS
showsPrec p :: Int
p = \case
    DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT -> String -> ShowS
showString "DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT"
    DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT -> String -> ShowS
showString "DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT"
    DiscardRectangleModeEXT x :: Int32
x -> Bool -> ShowS -> ShowS
showParen (Int
p Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= 11) (String -> ShowS
showString "DiscardRectangleModeEXT " ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Int32 -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec 11 Int32
x)

instance Read DiscardRectangleModeEXT where
  readPrec :: ReadPrec DiscardRectangleModeEXT
readPrec = ReadPrec DiscardRectangleModeEXT
-> ReadPrec DiscardRectangleModeEXT
forall a. ReadPrec a -> ReadPrec a
parens ([(String, ReadPrec DiscardRectangleModeEXT)]
-> ReadPrec DiscardRectangleModeEXT
forall a. [(String, ReadPrec a)] -> ReadPrec a
choose [("DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT", DiscardRectangleModeEXT -> ReadPrec DiscardRectangleModeEXT
forall (f :: * -> *) a. Applicative f => a -> f a
pure DiscardRectangleModeEXT
DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT)
                            , ("DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT", DiscardRectangleModeEXT -> ReadPrec DiscardRectangleModeEXT
forall (f :: * -> *) a. Applicative f => a -> f a
pure DiscardRectangleModeEXT
DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT)]
                     ReadPrec DiscardRectangleModeEXT
-> ReadPrec DiscardRectangleModeEXT
-> ReadPrec DiscardRectangleModeEXT
forall a. ReadPrec a -> ReadPrec a -> ReadPrec a
+++
                     Int
-> ReadPrec DiscardRectangleModeEXT
-> ReadPrec DiscardRectangleModeEXT
forall a. Int -> ReadPrec a -> ReadPrec a
prec 10 (do
                       Lexeme -> ReadPrec ()
expectP (String -> Lexeme
Ident "DiscardRectangleModeEXT")
                       Int32
v <- ReadPrec Int32 -> ReadPrec Int32
forall a. ReadPrec a -> ReadPrec a
step ReadPrec Int32
forall a. Read a => ReadPrec a
readPrec
                       DiscardRectangleModeEXT -> ReadPrec DiscardRectangleModeEXT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Int32 -> DiscardRectangleModeEXT
DiscardRectangleModeEXT Int32
v)))


type EXT_DISCARD_RECTANGLES_SPEC_VERSION = 1

-- No documentation found for TopLevel "VK_EXT_DISCARD_RECTANGLES_SPEC_VERSION"
pattern EXT_DISCARD_RECTANGLES_SPEC_VERSION :: forall a . Integral a => a
pattern $bEXT_DISCARD_RECTANGLES_SPEC_VERSION :: a
$mEXT_DISCARD_RECTANGLES_SPEC_VERSION :: forall r a. Integral a => a -> (Void# -> r) -> (Void# -> r) -> r
EXT_DISCARD_RECTANGLES_SPEC_VERSION = 1


type EXT_DISCARD_RECTANGLES_EXTENSION_NAME = "VK_EXT_discard_rectangles"

-- No documentation found for TopLevel "VK_EXT_DISCARD_RECTANGLES_EXTENSION_NAME"
pattern EXT_DISCARD_RECTANGLES_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bEXT_DISCARD_RECTANGLES_EXTENSION_NAME :: a
$mEXT_DISCARD_RECTANGLES_EXTENSION_NAME :: forall r a.
(Eq a, IsString a) =>
a -> (Void# -> r) -> (Void# -> r) -> r
EXT_DISCARD_RECTANGLES_EXTENSION_NAME = "VK_EXT_discard_rectangles"