{-# language CPP #-}
module Vulkan.Extensions.VK_EXT_validation_flags ( ValidationFlagsEXT(..)
, ValidationCheckEXT( VALIDATION_CHECK_ALL_EXT
, VALIDATION_CHECK_SHADERS_EXT
, ..
)
, EXT_VALIDATION_FLAGS_SPEC_VERSION
, pattern EXT_VALIDATION_FLAGS_SPEC_VERSION
, EXT_VALIDATION_FLAGS_EXTENSION_NAME
, pattern EXT_VALIDATION_FLAGS_EXTENSION_NAME
) where
import Vulkan.Internal.Utils (enumReadPrec)
import Vulkan.Internal.Utils (enumShowsPrec)
import Foreign.Marshal.Alloc (allocaBytes)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import GHC.Show (showsPrec)
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 Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Zero (Zero)
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 GHC.Generics (Generic)
import Data.Int (Int32)
import Foreign.Ptr (Ptr)
import GHC.Read (Read(readPrec))
import GHC.Show (Show(showsPrec))
import Data.Word (Word32)
import Data.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Data.Vector (Vector)
import Vulkan.CStruct.Utils (advancePtrBytes)
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_VALIDATION_FLAGS_EXT))
data ValidationFlagsEXT = ValidationFlagsEXT
{
ValidationFlagsEXT -> Vector ValidationCheckEXT
disabledValidationChecks :: Vector ValidationCheckEXT }
deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ValidationFlagsEXT)
#endif
deriving instance Show ValidationFlagsEXT
instance ToCStruct ValidationFlagsEXT where
withCStruct :: ValidationFlagsEXT -> (Ptr ValidationFlagsEXT -> IO b) -> IO b
withCStruct ValidationFlagsEXT
x Ptr ValidationFlagsEXT -> IO b
f = Int -> (Ptr ValidationFlagsEXT -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
32 ((Ptr ValidationFlagsEXT -> IO b) -> IO b)
-> (Ptr ValidationFlagsEXT -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr ValidationFlagsEXT
p -> Ptr ValidationFlagsEXT -> ValidationFlagsEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr ValidationFlagsEXT
p ValidationFlagsEXT
x (Ptr ValidationFlagsEXT -> IO b
f Ptr ValidationFlagsEXT
p)
pokeCStruct :: Ptr ValidationFlagsEXT -> ValidationFlagsEXT -> IO b -> IO b
pokeCStruct Ptr ValidationFlagsEXT
p ValidationFlagsEXT{Vector ValidationCheckEXT
disabledValidationChecks :: Vector ValidationCheckEXT
$sel:disabledValidationChecks:ValidationFlagsEXT :: ValidationFlagsEXT -> Vector ValidationCheckEXT
..} 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 ValidationFlagsEXT
p Ptr ValidationFlagsEXT -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_VALIDATION_FLAGS_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 ValidationFlagsEXT
p Ptr ValidationFlagsEXT -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
IO () -> ContT b IO ()
forall (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 Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ValidationFlagsEXT
p Ptr ValidationFlagsEXT -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32)) ((Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Vector ValidationCheckEXT -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector ValidationCheckEXT -> Int)
-> Vector ValidationCheckEXT -> Int
forall a b. (a -> b) -> a -> b
$ (Vector ValidationCheckEXT
disabledValidationChecks)) :: Word32))
Ptr ValidationCheckEXT
pPDisabledValidationChecks' <- ((Ptr ValidationCheckEXT -> IO b) -> IO b)
-> ContT b IO (Ptr ValidationCheckEXT)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr ValidationCheckEXT -> IO b) -> IO b)
-> ContT b IO (Ptr ValidationCheckEXT))
-> ((Ptr ValidationCheckEXT -> IO b) -> IO b)
-> ContT b IO (Ptr ValidationCheckEXT)
forall a b. (a -> b) -> a -> b
$ Int -> (Ptr ValidationCheckEXT -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes @ValidationCheckEXT ((Vector ValidationCheckEXT -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector ValidationCheckEXT
disabledValidationChecks)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
4)
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
$ (Int -> ValidationCheckEXT -> IO ())
-> Vector ValidationCheckEXT -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\Int
i ValidationCheckEXT
e -> Ptr ValidationCheckEXT -> ValidationCheckEXT -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr ValidationCheckEXT
pPDisabledValidationChecks' Ptr ValidationCheckEXT -> Int -> Ptr ValidationCheckEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
4 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr ValidationCheckEXT) (ValidationCheckEXT
e)) (Vector ValidationCheckEXT
disabledValidationChecks)
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 ValidationCheckEXT) -> Ptr ValidationCheckEXT -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ValidationFlagsEXT
p Ptr ValidationFlagsEXT -> Int -> Ptr (Ptr ValidationCheckEXT)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr ValidationCheckEXT))) (Ptr ValidationCheckEXT
pPDisabledValidationChecks')
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 = Int
32
cStructAlignment :: Int
cStructAlignment = Int
8
pokeZeroCStruct :: Ptr ValidationFlagsEXT -> IO b -> IO b
pokeZeroCStruct Ptr ValidationFlagsEXT
p IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ValidationFlagsEXT
p Ptr ValidationFlagsEXT -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_VALIDATION_FLAGS_EXT)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ValidationFlagsEXT
p Ptr ValidationFlagsEXT -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
IO b
f
instance FromCStruct ValidationFlagsEXT where
peekCStruct :: Ptr ValidationFlagsEXT -> IO ValidationFlagsEXT
peekCStruct Ptr ValidationFlagsEXT
p = do
Word32
disabledValidationCheckCount <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr ValidationFlagsEXT
p Ptr ValidationFlagsEXT -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32))
Ptr ValidationCheckEXT
pDisabledValidationChecks <- Ptr (Ptr ValidationCheckEXT) -> IO (Ptr ValidationCheckEXT)
forall a. Storable a => Ptr a -> IO a
peek @(Ptr ValidationCheckEXT) ((Ptr ValidationFlagsEXT
p Ptr ValidationFlagsEXT -> Int -> Ptr (Ptr ValidationCheckEXT)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr ValidationCheckEXT)))
Vector ValidationCheckEXT
pDisabledValidationChecks' <- Int
-> (Int -> IO ValidationCheckEXT) -> IO (Vector ValidationCheckEXT)
forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM (Word32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
disabledValidationCheckCount) (\Int
i -> Ptr ValidationCheckEXT -> IO ValidationCheckEXT
forall a. Storable a => Ptr a -> IO a
peek @ValidationCheckEXT ((Ptr ValidationCheckEXT
pDisabledValidationChecks Ptr ValidationCheckEXT -> Int -> Ptr ValidationCheckEXT
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
4 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr ValidationCheckEXT)))
ValidationFlagsEXT -> IO ValidationFlagsEXT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ValidationFlagsEXT -> IO ValidationFlagsEXT)
-> ValidationFlagsEXT -> IO ValidationFlagsEXT
forall a b. (a -> b) -> a -> b
$ Vector ValidationCheckEXT -> ValidationFlagsEXT
ValidationFlagsEXT
Vector ValidationCheckEXT
pDisabledValidationChecks'
instance Zero ValidationFlagsEXT where
zero :: ValidationFlagsEXT
zero = Vector ValidationCheckEXT -> ValidationFlagsEXT
ValidationFlagsEXT
Vector ValidationCheckEXT
forall a. Monoid a => a
mempty
newtype ValidationCheckEXT = ValidationCheckEXT Int32
deriving newtype (ValidationCheckEXT -> ValidationCheckEXT -> Bool
(ValidationCheckEXT -> ValidationCheckEXT -> Bool)
-> (ValidationCheckEXT -> ValidationCheckEXT -> Bool)
-> Eq ValidationCheckEXT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ValidationCheckEXT -> ValidationCheckEXT -> Bool
$c/= :: ValidationCheckEXT -> ValidationCheckEXT -> Bool
== :: ValidationCheckEXT -> ValidationCheckEXT -> Bool
$c== :: ValidationCheckEXT -> ValidationCheckEXT -> Bool
Eq, Eq ValidationCheckEXT
Eq ValidationCheckEXT
-> (ValidationCheckEXT -> ValidationCheckEXT -> Ordering)
-> (ValidationCheckEXT -> ValidationCheckEXT -> Bool)
-> (ValidationCheckEXT -> ValidationCheckEXT -> Bool)
-> (ValidationCheckEXT -> ValidationCheckEXT -> Bool)
-> (ValidationCheckEXT -> ValidationCheckEXT -> Bool)
-> (ValidationCheckEXT -> ValidationCheckEXT -> ValidationCheckEXT)
-> (ValidationCheckEXT -> ValidationCheckEXT -> ValidationCheckEXT)
-> Ord ValidationCheckEXT
ValidationCheckEXT -> ValidationCheckEXT -> Bool
ValidationCheckEXT -> ValidationCheckEXT -> Ordering
ValidationCheckEXT -> ValidationCheckEXT -> ValidationCheckEXT
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 :: ValidationCheckEXT -> ValidationCheckEXT -> ValidationCheckEXT
$cmin :: ValidationCheckEXT -> ValidationCheckEXT -> ValidationCheckEXT
max :: ValidationCheckEXT -> ValidationCheckEXT -> ValidationCheckEXT
$cmax :: ValidationCheckEXT -> ValidationCheckEXT -> ValidationCheckEXT
>= :: ValidationCheckEXT -> ValidationCheckEXT -> Bool
$c>= :: ValidationCheckEXT -> ValidationCheckEXT -> Bool
> :: ValidationCheckEXT -> ValidationCheckEXT -> Bool
$c> :: ValidationCheckEXT -> ValidationCheckEXT -> Bool
<= :: ValidationCheckEXT -> ValidationCheckEXT -> Bool
$c<= :: ValidationCheckEXT -> ValidationCheckEXT -> Bool
< :: ValidationCheckEXT -> ValidationCheckEXT -> Bool
$c< :: ValidationCheckEXT -> ValidationCheckEXT -> Bool
compare :: ValidationCheckEXT -> ValidationCheckEXT -> Ordering
$ccompare :: ValidationCheckEXT -> ValidationCheckEXT -> Ordering
$cp1Ord :: Eq ValidationCheckEXT
Ord, Ptr b -> Int -> IO ValidationCheckEXT
Ptr b -> Int -> ValidationCheckEXT -> IO ()
Ptr ValidationCheckEXT -> IO ValidationCheckEXT
Ptr ValidationCheckEXT -> Int -> IO ValidationCheckEXT
Ptr ValidationCheckEXT -> Int -> ValidationCheckEXT -> IO ()
Ptr ValidationCheckEXT -> ValidationCheckEXT -> IO ()
ValidationCheckEXT -> Int
(ValidationCheckEXT -> Int)
-> (ValidationCheckEXT -> Int)
-> (Ptr ValidationCheckEXT -> Int -> IO ValidationCheckEXT)
-> (Ptr ValidationCheckEXT -> Int -> ValidationCheckEXT -> IO ())
-> (forall b. Ptr b -> Int -> IO ValidationCheckEXT)
-> (forall b. Ptr b -> Int -> ValidationCheckEXT -> IO ())
-> (Ptr ValidationCheckEXT -> IO ValidationCheckEXT)
-> (Ptr ValidationCheckEXT -> ValidationCheckEXT -> IO ())
-> Storable ValidationCheckEXT
forall b. Ptr b -> Int -> IO ValidationCheckEXT
forall b. Ptr b -> Int -> ValidationCheckEXT -> 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 ValidationCheckEXT -> ValidationCheckEXT -> IO ()
$cpoke :: Ptr ValidationCheckEXT -> ValidationCheckEXT -> IO ()
peek :: Ptr ValidationCheckEXT -> IO ValidationCheckEXT
$cpeek :: Ptr ValidationCheckEXT -> IO ValidationCheckEXT
pokeByteOff :: Ptr b -> Int -> ValidationCheckEXT -> IO ()
$cpokeByteOff :: forall b. Ptr b -> Int -> ValidationCheckEXT -> IO ()
peekByteOff :: Ptr b -> Int -> IO ValidationCheckEXT
$cpeekByteOff :: forall b. Ptr b -> Int -> IO ValidationCheckEXT
pokeElemOff :: Ptr ValidationCheckEXT -> Int -> ValidationCheckEXT -> IO ()
$cpokeElemOff :: Ptr ValidationCheckEXT -> Int -> ValidationCheckEXT -> IO ()
peekElemOff :: Ptr ValidationCheckEXT -> Int -> IO ValidationCheckEXT
$cpeekElemOff :: Ptr ValidationCheckEXT -> Int -> IO ValidationCheckEXT
alignment :: ValidationCheckEXT -> Int
$calignment :: ValidationCheckEXT -> Int
sizeOf :: ValidationCheckEXT -> Int
$csizeOf :: ValidationCheckEXT -> Int
Storable, ValidationCheckEXT
ValidationCheckEXT -> Zero ValidationCheckEXT
forall a. a -> Zero a
zero :: ValidationCheckEXT
$czero :: ValidationCheckEXT
Zero)
pattern $bVALIDATION_CHECK_ALL_EXT :: ValidationCheckEXT
$mVALIDATION_CHECK_ALL_EXT :: forall r. ValidationCheckEXT -> (Void# -> r) -> (Void# -> r) -> r
VALIDATION_CHECK_ALL_EXT = ValidationCheckEXT 0
pattern $bVALIDATION_CHECK_SHADERS_EXT :: ValidationCheckEXT
$mVALIDATION_CHECK_SHADERS_EXT :: forall r. ValidationCheckEXT -> (Void# -> r) -> (Void# -> r) -> r
VALIDATION_CHECK_SHADERS_EXT = ValidationCheckEXT 1
{-# complete VALIDATION_CHECK_ALL_EXT,
VALIDATION_CHECK_SHADERS_EXT :: ValidationCheckEXT #-}
conNameValidationCheckEXT :: String
conNameValidationCheckEXT :: String
conNameValidationCheckEXT = String
"ValidationCheckEXT"
enumPrefixValidationCheckEXT :: String
enumPrefixValidationCheckEXT :: String
enumPrefixValidationCheckEXT = String
"VALIDATION_CHECK_"
showTableValidationCheckEXT :: [(ValidationCheckEXT, String)]
showTableValidationCheckEXT :: [(ValidationCheckEXT, String)]
showTableValidationCheckEXT = [(ValidationCheckEXT
VALIDATION_CHECK_ALL_EXT, String
"ALL_EXT"), (ValidationCheckEXT
VALIDATION_CHECK_SHADERS_EXT, String
"SHADERS_EXT")]
instance Show ValidationCheckEXT where
showsPrec :: Int -> ValidationCheckEXT -> ShowS
showsPrec = String
-> [(ValidationCheckEXT, String)]
-> String
-> (ValidationCheckEXT -> Int32)
-> (Int32 -> ShowS)
-> Int
-> ValidationCheckEXT
-> ShowS
forall a i.
Eq a =>
String
-> [(a, String)]
-> String
-> (a -> i)
-> (i -> ShowS)
-> Int
-> a
-> ShowS
enumShowsPrec String
enumPrefixValidationCheckEXT
[(ValidationCheckEXT, String)]
showTableValidationCheckEXT
String
conNameValidationCheckEXT
(\(ValidationCheckEXT Int32
x) -> Int32
x)
(Int -> Int32 -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec Int
11)
instance Read ValidationCheckEXT where
readPrec :: ReadPrec ValidationCheckEXT
readPrec =
String
-> [(ValidationCheckEXT, String)]
-> String
-> (Int32 -> ValidationCheckEXT)
-> ReadPrec ValidationCheckEXT
forall i a.
Read i =>
String -> [(a, String)] -> String -> (i -> a) -> ReadPrec a
enumReadPrec String
enumPrefixValidationCheckEXT [(ValidationCheckEXT, String)]
showTableValidationCheckEXT String
conNameValidationCheckEXT Int32 -> ValidationCheckEXT
ValidationCheckEXT
type EXT_VALIDATION_FLAGS_SPEC_VERSION = 2
pattern EXT_VALIDATION_FLAGS_SPEC_VERSION :: forall a . Integral a => a
pattern $bEXT_VALIDATION_FLAGS_SPEC_VERSION :: a
$mEXT_VALIDATION_FLAGS_SPEC_VERSION :: forall r a. Integral a => a -> (Void# -> r) -> (Void# -> r) -> r
EXT_VALIDATION_FLAGS_SPEC_VERSION = 2
type EXT_VALIDATION_FLAGS_EXTENSION_NAME = "VK_EXT_validation_flags"
pattern EXT_VALIDATION_FLAGS_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bEXT_VALIDATION_FLAGS_EXTENSION_NAME :: a
$mEXT_VALIDATION_FLAGS_EXTENSION_NAME :: forall r a.
(Eq a, IsString a) =>
a -> (Void# -> r) -> (Void# -> r) -> r
EXT_VALIDATION_FLAGS_EXTENSION_NAME = "VK_EXT_validation_flags"