{-# language CPP #-}
module Vulkan.Extensions.VK_AMD_rasterization_order  ( PipelineRasterizationStateRasterizationOrderAMD(..)
                                                     , RasterizationOrderAMD( RASTERIZATION_ORDER_STRICT_AMD
                                                                            , RASTERIZATION_ORDER_RELAXED_AMD
                                                                            , ..
                                                                            )
                                                     , AMD_RASTERIZATION_ORDER_SPEC_VERSION
                                                     , pattern AMD_RASTERIZATION_ORDER_SPEC_VERSION
                                                     , AMD_RASTERIZATION_ORDER_EXTENSION_NAME
                                                     , pattern AMD_RASTERIZATION_ORDER_EXTENSION_NAME
                                                     ) where

import Foreign.Marshal.Alloc (allocaBytesAligned)
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 Text.ParserCombinators.ReadPrec ((+++))
import Text.ParserCombinators.ReadPrec (prec)
import Text.ParserCombinators.ReadPrec (step)
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 Data.Int (Int32)
import Foreign.Ptr (Ptr)
import GHC.Read (Read(readPrec))
import Text.Read.Lex (Lexeme(Ident))
import Data.Kind (Type)
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
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_PIPELINE_RASTERIZATION_STATE_RASTERIZATION_ORDER_AMD))
-- | VkPipelineRasterizationStateRasterizationOrderAMD - Structure defining
-- rasterization order for a graphics pipeline
--
-- == Valid Usage (Implicit)
--
-- If the @VK_AMD_rasterization_order@ device extension is not enabled or
-- the application does not request a particular rasterization order
-- through specifying a 'PipelineRasterizationStateRasterizationOrderAMD'
-- structure then the rasterization order used by the graphics pipeline
-- defaults to 'RASTERIZATION_ORDER_STRICT_AMD'.
--
-- = See Also
--
-- 'RasterizationOrderAMD',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PipelineRasterizationStateRasterizationOrderAMD = PipelineRasterizationStateRasterizationOrderAMD
  { -- | @rasterizationOrder@ /must/ be a valid 'RasterizationOrderAMD' value
    PipelineRasterizationStateRasterizationOrderAMD
-> RasterizationOrderAMD
rasterizationOrder :: RasterizationOrderAMD }
  deriving (Typeable)
deriving instance Show PipelineRasterizationStateRasterizationOrderAMD

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

instance FromCStruct PipelineRasterizationStateRasterizationOrderAMD where
  peekCStruct :: Ptr PipelineRasterizationStateRasterizationOrderAMD
-> IO PipelineRasterizationStateRasterizationOrderAMD
peekCStruct p :: Ptr PipelineRasterizationStateRasterizationOrderAMD
p = do
    RasterizationOrderAMD
rasterizationOrder <- Ptr RasterizationOrderAMD -> IO RasterizationOrderAMD
forall a. Storable a => Ptr a -> IO a
peek @RasterizationOrderAMD ((Ptr PipelineRasterizationStateRasterizationOrderAMD
p Ptr PipelineRasterizationStateRasterizationOrderAMD
-> Int -> Ptr RasterizationOrderAMD
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr RasterizationOrderAMD))
    PipelineRasterizationStateRasterizationOrderAMD
-> IO PipelineRasterizationStateRasterizationOrderAMD
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PipelineRasterizationStateRasterizationOrderAMD
 -> IO PipelineRasterizationStateRasterizationOrderAMD)
-> PipelineRasterizationStateRasterizationOrderAMD
-> IO PipelineRasterizationStateRasterizationOrderAMD
forall a b. (a -> b) -> a -> b
$ RasterizationOrderAMD
-> PipelineRasterizationStateRasterizationOrderAMD
PipelineRasterizationStateRasterizationOrderAMD
             RasterizationOrderAMD
rasterizationOrder

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

instance Zero PipelineRasterizationStateRasterizationOrderAMD where
  zero :: PipelineRasterizationStateRasterizationOrderAMD
zero = RasterizationOrderAMD
-> PipelineRasterizationStateRasterizationOrderAMD
PipelineRasterizationStateRasterizationOrderAMD
           RasterizationOrderAMD
forall a. Zero a => a
zero


-- | VkRasterizationOrderAMD - Specify rasterization order for a graphics
-- pipeline
--
-- = See Also
--
-- 'PipelineRasterizationStateRasterizationOrderAMD'
newtype RasterizationOrderAMD = RasterizationOrderAMD Int32
  deriving newtype (RasterizationOrderAMD -> RasterizationOrderAMD -> Bool
(RasterizationOrderAMD -> RasterizationOrderAMD -> Bool)
-> (RasterizationOrderAMD -> RasterizationOrderAMD -> Bool)
-> Eq RasterizationOrderAMD
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RasterizationOrderAMD -> RasterizationOrderAMD -> Bool
$c/= :: RasterizationOrderAMD -> RasterizationOrderAMD -> Bool
== :: RasterizationOrderAMD -> RasterizationOrderAMD -> Bool
$c== :: RasterizationOrderAMD -> RasterizationOrderAMD -> Bool
Eq, Eq RasterizationOrderAMD
Eq RasterizationOrderAMD =>
(RasterizationOrderAMD -> RasterizationOrderAMD -> Ordering)
-> (RasterizationOrderAMD -> RasterizationOrderAMD -> Bool)
-> (RasterizationOrderAMD -> RasterizationOrderAMD -> Bool)
-> (RasterizationOrderAMD -> RasterizationOrderAMD -> Bool)
-> (RasterizationOrderAMD -> RasterizationOrderAMD -> Bool)
-> (RasterizationOrderAMD
    -> RasterizationOrderAMD -> RasterizationOrderAMD)
-> (RasterizationOrderAMD
    -> RasterizationOrderAMD -> RasterizationOrderAMD)
-> Ord RasterizationOrderAMD
RasterizationOrderAMD -> RasterizationOrderAMD -> Bool
RasterizationOrderAMD -> RasterizationOrderAMD -> Ordering
RasterizationOrderAMD
-> RasterizationOrderAMD -> RasterizationOrderAMD
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 :: RasterizationOrderAMD
-> RasterizationOrderAMD -> RasterizationOrderAMD
$cmin :: RasterizationOrderAMD
-> RasterizationOrderAMD -> RasterizationOrderAMD
max :: RasterizationOrderAMD
-> RasterizationOrderAMD -> RasterizationOrderAMD
$cmax :: RasterizationOrderAMD
-> RasterizationOrderAMD -> RasterizationOrderAMD
>= :: RasterizationOrderAMD -> RasterizationOrderAMD -> Bool
$c>= :: RasterizationOrderAMD -> RasterizationOrderAMD -> Bool
> :: RasterizationOrderAMD -> RasterizationOrderAMD -> Bool
$c> :: RasterizationOrderAMD -> RasterizationOrderAMD -> Bool
<= :: RasterizationOrderAMD -> RasterizationOrderAMD -> Bool
$c<= :: RasterizationOrderAMD -> RasterizationOrderAMD -> Bool
< :: RasterizationOrderAMD -> RasterizationOrderAMD -> Bool
$c< :: RasterizationOrderAMD -> RasterizationOrderAMD -> Bool
compare :: RasterizationOrderAMD -> RasterizationOrderAMD -> Ordering
$ccompare :: RasterizationOrderAMD -> RasterizationOrderAMD -> Ordering
$cp1Ord :: Eq RasterizationOrderAMD
Ord, Ptr b -> Int -> IO RasterizationOrderAMD
Ptr b -> Int -> RasterizationOrderAMD -> IO ()
Ptr RasterizationOrderAMD -> IO RasterizationOrderAMD
Ptr RasterizationOrderAMD -> Int -> IO RasterizationOrderAMD
Ptr RasterizationOrderAMD -> Int -> RasterizationOrderAMD -> IO ()
Ptr RasterizationOrderAMD -> RasterizationOrderAMD -> IO ()
RasterizationOrderAMD -> Int
(RasterizationOrderAMD -> Int)
-> (RasterizationOrderAMD -> Int)
-> (Ptr RasterizationOrderAMD -> Int -> IO RasterizationOrderAMD)
-> (Ptr RasterizationOrderAMD
    -> Int -> RasterizationOrderAMD -> IO ())
-> (forall b. Ptr b -> Int -> IO RasterizationOrderAMD)
-> (forall b. Ptr b -> Int -> RasterizationOrderAMD -> IO ())
-> (Ptr RasterizationOrderAMD -> IO RasterizationOrderAMD)
-> (Ptr RasterizationOrderAMD -> RasterizationOrderAMD -> IO ())
-> Storable RasterizationOrderAMD
forall b. Ptr b -> Int -> IO RasterizationOrderAMD
forall b. Ptr b -> Int -> RasterizationOrderAMD -> 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 RasterizationOrderAMD -> RasterizationOrderAMD -> IO ()
$cpoke :: Ptr RasterizationOrderAMD -> RasterizationOrderAMD -> IO ()
peek :: Ptr RasterizationOrderAMD -> IO RasterizationOrderAMD
$cpeek :: Ptr RasterizationOrderAMD -> IO RasterizationOrderAMD
pokeByteOff :: Ptr b -> Int -> RasterizationOrderAMD -> IO ()
$cpokeByteOff :: forall b. Ptr b -> Int -> RasterizationOrderAMD -> IO ()
peekByteOff :: Ptr b -> Int -> IO RasterizationOrderAMD
$cpeekByteOff :: forall b. Ptr b -> Int -> IO RasterizationOrderAMD
pokeElemOff :: Ptr RasterizationOrderAMD -> Int -> RasterizationOrderAMD -> IO ()
$cpokeElemOff :: Ptr RasterizationOrderAMD -> Int -> RasterizationOrderAMD -> IO ()
peekElemOff :: Ptr RasterizationOrderAMD -> Int -> IO RasterizationOrderAMD
$cpeekElemOff :: Ptr RasterizationOrderAMD -> Int -> IO RasterizationOrderAMD
alignment :: RasterizationOrderAMD -> Int
$calignment :: RasterizationOrderAMD -> Int
sizeOf :: RasterizationOrderAMD -> Int
$csizeOf :: RasterizationOrderAMD -> Int
Storable, RasterizationOrderAMD
RasterizationOrderAMD -> Zero RasterizationOrderAMD
forall a. a -> Zero a
zero :: RasterizationOrderAMD
$czero :: RasterizationOrderAMD
Zero)

-- | 'RASTERIZATION_ORDER_STRICT_AMD' specifies that operations for each
-- primitive in a subpass /must/ occur in
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#drawing-primitive-order primitive order>.
pattern $bRASTERIZATION_ORDER_STRICT_AMD :: RasterizationOrderAMD
$mRASTERIZATION_ORDER_STRICT_AMD :: forall r.
RasterizationOrderAMD -> (Void# -> r) -> (Void# -> r) -> r
RASTERIZATION_ORDER_STRICT_AMD = RasterizationOrderAMD 0
-- | 'RASTERIZATION_ORDER_RELAXED_AMD' specifies that operations for each
-- primitive in a subpass /may/ not occur in
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#drawing-primitive-order primitive order>.
pattern $bRASTERIZATION_ORDER_RELAXED_AMD :: RasterizationOrderAMD
$mRASTERIZATION_ORDER_RELAXED_AMD :: forall r.
RasterizationOrderAMD -> (Void# -> r) -> (Void# -> r) -> r
RASTERIZATION_ORDER_RELAXED_AMD = RasterizationOrderAMD 1
{-# complete RASTERIZATION_ORDER_STRICT_AMD,
             RASTERIZATION_ORDER_RELAXED_AMD :: RasterizationOrderAMD #-}

instance Show RasterizationOrderAMD where
  showsPrec :: Int -> RasterizationOrderAMD -> ShowS
showsPrec p :: Int
p = \case
    RASTERIZATION_ORDER_STRICT_AMD -> String -> ShowS
showString "RASTERIZATION_ORDER_STRICT_AMD"
    RASTERIZATION_ORDER_RELAXED_AMD -> String -> ShowS
showString "RASTERIZATION_ORDER_RELAXED_AMD"
    RasterizationOrderAMD x :: Int32
x -> Bool -> ShowS -> ShowS
showParen (Int
p Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= 11) (String -> ShowS
showString "RasterizationOrderAMD " 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 RasterizationOrderAMD where
  readPrec :: ReadPrec RasterizationOrderAMD
readPrec = ReadPrec RasterizationOrderAMD -> ReadPrec RasterizationOrderAMD
forall a. ReadPrec a -> ReadPrec a
parens ([(String, ReadPrec RasterizationOrderAMD)]
-> ReadPrec RasterizationOrderAMD
forall a. [(String, ReadPrec a)] -> ReadPrec a
choose [("RASTERIZATION_ORDER_STRICT_AMD", RasterizationOrderAMD -> ReadPrec RasterizationOrderAMD
forall (f :: * -> *) a. Applicative f => a -> f a
pure RasterizationOrderAMD
RASTERIZATION_ORDER_STRICT_AMD)
                            , ("RASTERIZATION_ORDER_RELAXED_AMD", RasterizationOrderAMD -> ReadPrec RasterizationOrderAMD
forall (f :: * -> *) a. Applicative f => a -> f a
pure RasterizationOrderAMD
RASTERIZATION_ORDER_RELAXED_AMD)]
                     ReadPrec RasterizationOrderAMD
-> ReadPrec RasterizationOrderAMD -> ReadPrec RasterizationOrderAMD
forall a. ReadPrec a -> ReadPrec a -> ReadPrec a
+++
                     Int
-> ReadPrec RasterizationOrderAMD -> ReadPrec RasterizationOrderAMD
forall a. Int -> ReadPrec a -> ReadPrec a
prec 10 (do
                       Lexeme -> ReadPrec ()
expectP (String -> Lexeme
Ident "RasterizationOrderAMD")
                       Int32
v <- ReadPrec Int32 -> ReadPrec Int32
forall a. ReadPrec a -> ReadPrec a
step ReadPrec Int32
forall a. Read a => ReadPrec a
readPrec
                       RasterizationOrderAMD -> ReadPrec RasterizationOrderAMD
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Int32 -> RasterizationOrderAMD
RasterizationOrderAMD Int32
v)))


type AMD_RASTERIZATION_ORDER_SPEC_VERSION = 1

-- No documentation found for TopLevel "VK_AMD_RASTERIZATION_ORDER_SPEC_VERSION"
pattern AMD_RASTERIZATION_ORDER_SPEC_VERSION :: forall a . Integral a => a
pattern $bAMD_RASTERIZATION_ORDER_SPEC_VERSION :: a
$mAMD_RASTERIZATION_ORDER_SPEC_VERSION :: forall r a. Integral a => a -> (Void# -> r) -> (Void# -> r) -> r
AMD_RASTERIZATION_ORDER_SPEC_VERSION = 1


type AMD_RASTERIZATION_ORDER_EXTENSION_NAME = "VK_AMD_rasterization_order"

-- No documentation found for TopLevel "VK_AMD_RASTERIZATION_ORDER_EXTENSION_NAME"
pattern AMD_RASTERIZATION_ORDER_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bAMD_RASTERIZATION_ORDER_EXTENSION_NAME :: a
$mAMD_RASTERIZATION_ORDER_EXTENSION_NAME :: forall r a.
(Eq a, IsString a) =>
a -> (Void# -> r) -> (Void# -> r) -> r
AMD_RASTERIZATION_ORDER_EXTENSION_NAME = "VK_AMD_rasterization_order"