{-# language CPP #-}
-- | = Name
--
-- VK_EXT_validation_flags - instance extension
--
-- == VK_EXT_validation_flags
--
-- [__Name String__]
--     @VK_EXT_validation_flags@
--
-- [__Extension Type__]
--     Instance extension
--
-- [__Registered Extension Number__]
--     62
--
-- [__Revision__]
--     2
--
-- [__Ratification Status__]
--     Not ratified
--
-- [__Extension and Version Dependencies__; __Deprecation State__]
--
--     -   /Deprecated/ by @VK_EXT_validation_features@ extension
--
-- [__Special Use__]
--
--     -   <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#extendingvulkan-compatibility-specialuse Debugging tools>
--
-- [__Contact__]
--
--     -   Tobin Ehlis
--         <https://github.com/KhronosGroup/Vulkan-Docs/issues/new?body=[VK_EXT_validation_flags] @tobine%0A*Here describe the issue or question you have about the VK_EXT_validation_flags extension* >
--
-- == Other Extension Metadata
--
-- [__Last Modified Date__]
--     2019-08-19
--
-- [__IP Status__]
--     No known IP claims.
--
-- [__Contributors__]
--
--     -   Tobin Ehlis, Google
--
--     -   Courtney Goeltzenleuchter, Google
--
-- == Description
--
-- This extension provides the 'ValidationFlagsEXT' struct that can be
-- included in the @pNext@ chain of the
-- 'Vulkan.Core10.DeviceInitialization.InstanceCreateInfo' structure passed
-- as the @pCreateInfo@ parameter of
-- 'Vulkan.Core10.DeviceInitialization.createInstance'. The structure
-- contains an array of 'ValidationCheckEXT' values that will be disabled
-- by the validation layers.
--
-- == Deprecation by @VK_EXT_validation_features@
--
-- Functionality in this extension is subsumed into the
-- @VK_EXT_validation_features@ extension.
--
-- == New Structures
--
-- -   Extending 'Vulkan.Core10.DeviceInitialization.InstanceCreateInfo':
--
--     -   'ValidationFlagsEXT'
--
-- == New Enums
--
-- -   'ValidationCheckEXT'
--
-- == New Enum Constants
--
-- -   'EXT_VALIDATION_FLAGS_EXTENSION_NAME'
--
-- -   'EXT_VALIDATION_FLAGS_SPEC_VERSION'
--
-- -   Extending 'Vulkan.Core10.Enums.StructureType.StructureType':
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_VALIDATION_FLAGS_EXT'
--
-- == Version History
--
-- -   Revision 2, 2019-08-19 (Mark Lobodzinski)
--
--     -   Marked as deprecated
--
-- -   Revision 1, 2016-08-26 (Courtney Goeltzenleuchter)
--
--     -   Initial draft
--
-- == See Also
--
-- 'ValidationCheckEXT', 'ValidationFlagsEXT'
--
-- == Document Notes
--
-- For more information, see the
-- <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VK_EXT_validation_flags Vulkan Specification>
--
-- This page is a generated document. Fixes and changes should be made to
-- the generator scripts, not directly.
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))
-- | VkValidationFlagsEXT - Specify validation checks to disable for a Vulkan
-- instance
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_validation_flags VK_EXT_validation_flags>,
-- 'Vulkan.Core10.Enums.StructureType.StructureType', 'ValidationCheckEXT'
data ValidationFlagsEXT = ValidationFlagsEXT
  { -- | @pDisabledValidationChecks@ is a pointer to an array of
    -- 'ValidationCheckEXT' values specifying the validation checks to be
    -- disabled.
    --
    -- #VUID-VkValidationFlagsEXT-pDisabledValidationChecks-parameter#
    -- @pDisabledValidationChecks@ /must/ be a valid pointer to an array of
    -- @disabledValidationCheckCount@ valid 'ValidationCheckEXT' values
    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


-- | VkValidationCheckEXT - Specify validation checks to disable
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_validation_flags VK_EXT_validation_flags>,
-- 'ValidationFlagsEXT'
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)

-- | 'VALIDATION_CHECK_ALL_EXT' specifies that all validation checks are
-- disabled.
pattern $bVALIDATION_CHECK_ALL_EXT :: ValidationCheckEXT
$mVALIDATION_CHECK_ALL_EXT :: forall {r}. ValidationCheckEXT -> ((# #) -> r) -> ((# #) -> r) -> r
VALIDATION_CHECK_ALL_EXT = ValidationCheckEXT 0

-- | 'VALIDATION_CHECK_SHADERS_EXT' specifies that shader validation is
-- disabled.
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

-- No documentation found for TopLevel "VK_EXT_VALIDATION_FLAGS_SPEC_VERSION"
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"

-- No documentation found for TopLevel "VK_EXT_VALIDATION_FLAGS_EXTENSION_NAME"
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"