{-# 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 :: forall b.
ValidationFlagsEXT -> (Ptr ValidationFlagsEXT -> IO b) -> IO b
withCStruct ValidationFlagsEXT
x Ptr ValidationFlagsEXT -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
32 forall a b. (a -> b) -> a -> b
$ \Ptr ValidationFlagsEXT
p -> 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 :: forall b.
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 = forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT forall a b. (a -> b) -> a -> b
$ do
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ValidationFlagsEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_VALIDATION_FLAGS_EXT)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ValidationFlagsEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ValidationFlagsEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32)) ((forall a b. (Integral a, Num b) => a -> b
fromIntegral (forall a. Vector a -> Int
Data.Vector.length forall a b. (a -> b) -> a -> b
$ (Vector ValidationCheckEXT
disabledValidationChecks)) :: Word32))
Ptr ValidationCheckEXT
pPDisabledValidationChecks' <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT forall a b. (a -> b) -> a -> b
$ forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes @ValidationCheckEXT ((forall a. Vector a -> Int
Data.Vector.length (Vector ValidationCheckEXT
disabledValidationChecks)) forall a. Num a => a -> a -> a
* Int
4)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\Int
i ValidationCheckEXT
e -> forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr ValidationCheckEXT
pPDisabledValidationChecks' forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
4 forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr ValidationCheckEXT) (ValidationCheckEXT
e)) (Vector ValidationCheckEXT
disabledValidationChecks)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ValidationFlagsEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr ValidationCheckEXT))) (Ptr ValidationCheckEXT
pPDisabledValidationChecks')
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ IO b
f
cStructSize :: Int
cStructSize = Int
32
cStructAlignment :: Int
cStructAlignment = Int
8
pokeZeroCStruct :: forall b. Ptr ValidationFlagsEXT -> IO b -> IO b
pokeZeroCStruct Ptr ValidationFlagsEXT
p IO b
f = do
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ValidationFlagsEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_VALIDATION_FLAGS_EXT)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ValidationFlagsEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: 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 <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr ValidationFlagsEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32))
Ptr ValidationCheckEXT
pDisabledValidationChecks <- forall a. Storable a => Ptr a -> IO a
peek @(Ptr ValidationCheckEXT) ((Ptr ValidationFlagsEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr ValidationCheckEXT)))
Vector ValidationCheckEXT
pDisabledValidationChecks' <- forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM (forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
disabledValidationCheckCount) (\Int
i -> forall a. Storable a => Ptr a -> IO a
peek @ValidationCheckEXT ((Ptr ValidationCheckEXT
pDisabledValidationChecks forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
4 forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr ValidationCheckEXT)))
forall (f :: * -> *) a. Applicative f => a -> f a
pure 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
forall a. Monoid a => a
mempty
newtype ValidationCheckEXT = ValidationCheckEXT Int32
deriving newtype (ValidationCheckEXT -> ValidationCheckEXT -> Bool
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
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
Ord, Ptr ValidationCheckEXT -> IO ValidationCheckEXT
Ptr ValidationCheckEXT -> Int -> IO ValidationCheckEXT
Ptr ValidationCheckEXT -> Int -> ValidationCheckEXT -> IO ()
Ptr ValidationCheckEXT -> ValidationCheckEXT -> IO ()
ValidationCheckEXT -> Int
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 :: forall b. Ptr b -> Int -> ValidationCheckEXT -> IO ()
$cpokeByteOff :: forall b. Ptr b -> Int -> ValidationCheckEXT -> IO ()
peekByteOff :: forall b. 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
forall a. a -> Zero a
zero :: ValidationCheckEXT
$czero :: ValidationCheckEXT
Zero)
pattern $bVALIDATION_CHECK_ALL_EXT :: ValidationCheckEXT
$mVALIDATION_CHECK_ALL_EXT :: forall {r}. ValidationCheckEXT -> ((# #) -> r) -> ((# #) -> r) -> r
VALIDATION_CHECK_ALL_EXT = ValidationCheckEXT 0
pattern $bVALIDATION_CHECK_SHADERS_EXT :: ValidationCheckEXT
$mVALIDATION_CHECK_SHADERS_EXT :: forall {r}. ValidationCheckEXT -> ((# #) -> r) -> ((# #) -> 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 =
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)
(forall a. Show a => Int -> a -> ShowS
showsPrec Int
11)
instance Read ValidationCheckEXT where
readPrec :: ReadPrec ValidationCheckEXT
readPrec =
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 :: forall a. Integral a => a
$mEXT_VALIDATION_FLAGS_SPEC_VERSION :: forall {r} {a}.
Integral a =>
a -> ((# #) -> r) -> ((# #) -> 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 :: forall a. (Eq a, IsString a) => a
$mEXT_VALIDATION_FLAGS_EXTENSION_NAME :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
EXT_VALIDATION_FLAGS_EXTENSION_NAME = "VK_EXT_validation_flags"