{-# language CPP #-}
module Graphics.Vulkan.Extensions.VK_EXT_validation_features ( ValidationFeaturesEXT(..)
, ValidationFeatureEnableEXT( VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT
, VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT
, VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT
, ..
)
, ValidationFeatureDisableEXT( VALIDATION_FEATURE_DISABLE_ALL_EXT
, VALIDATION_FEATURE_DISABLE_SHADERS_EXT
, VALIDATION_FEATURE_DISABLE_THREAD_SAFETY_EXT
, VALIDATION_FEATURE_DISABLE_API_PARAMETERS_EXT
, VALIDATION_FEATURE_DISABLE_OBJECT_LIFETIMES_EXT
, VALIDATION_FEATURE_DISABLE_CORE_CHECKS_EXT
, VALIDATION_FEATURE_DISABLE_UNIQUE_HANDLES_EXT
, ..
)
, EXT_VALIDATION_FEATURES_SPEC_VERSION
, pattern EXT_VALIDATION_FEATURES_SPEC_VERSION
, EXT_VALIDATION_FEATURES_EXTENSION_NAME
, pattern EXT_VALIDATION_FEATURES_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 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 Data.String (IsString)
import Data.Typeable (Typeable)
import Foreign.Storable (Storable)
import Foreign.Storable (Storable(peek))
import Foreign.Storable (Storable(poke))
import Data.Int (Int32)
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 Graphics.Vulkan.CStruct.Utils (advancePtrBytes)
import Graphics.Vulkan.CStruct (FromCStruct)
import Graphics.Vulkan.CStruct (FromCStruct(..))
import Graphics.Vulkan.Core10.Enums.StructureType (StructureType)
import Graphics.Vulkan.CStruct (ToCStruct)
import Graphics.Vulkan.CStruct (ToCStruct(..))
import Graphics.Vulkan.Zero (Zero)
import Graphics.Vulkan.Zero (Zero(..))
import Graphics.Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_VALIDATION_FEATURES_EXT))
data ValidationFeaturesEXT = ValidationFeaturesEXT
{
enabledValidationFeatures :: Vector ValidationFeatureEnableEXT
,
disabledValidationFeatures :: Vector ValidationFeatureDisableEXT
}
deriving (Typeable)
deriving instance Show ValidationFeaturesEXT
instance ToCStruct ValidationFeaturesEXT where
withCStruct x f = allocaBytesAligned 48 8 $ \p -> pokeCStruct p x (f p)
pokeCStruct p ValidationFeaturesEXT{..} f = evalContT $ do
lift $ poke ((p `plusPtr` 0 :: Ptr StructureType)) (STRUCTURE_TYPE_VALIDATION_FEATURES_EXT)
lift $ poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) (nullPtr)
lift $ poke ((p `plusPtr` 16 :: Ptr Word32)) ((fromIntegral (Data.Vector.length $ (enabledValidationFeatures)) :: Word32))
pPEnabledValidationFeatures' <- ContT $ allocaBytesAligned @ValidationFeatureEnableEXT ((Data.Vector.length (enabledValidationFeatures)) * 4) 4
lift $ Data.Vector.imapM_ (\i e -> poke (pPEnabledValidationFeatures' `plusPtr` (4 * (i)) :: Ptr ValidationFeatureEnableEXT) (e)) (enabledValidationFeatures)
lift $ poke ((p `plusPtr` 24 :: Ptr (Ptr ValidationFeatureEnableEXT))) (pPEnabledValidationFeatures')
lift $ poke ((p `plusPtr` 32 :: Ptr Word32)) ((fromIntegral (Data.Vector.length $ (disabledValidationFeatures)) :: Word32))
pPDisabledValidationFeatures' <- ContT $ allocaBytesAligned @ValidationFeatureDisableEXT ((Data.Vector.length (disabledValidationFeatures)) * 4) 4
lift $ Data.Vector.imapM_ (\i e -> poke (pPDisabledValidationFeatures' `plusPtr` (4 * (i)) :: Ptr ValidationFeatureDisableEXT) (e)) (disabledValidationFeatures)
lift $ poke ((p `plusPtr` 40 :: Ptr (Ptr ValidationFeatureDisableEXT))) (pPDisabledValidationFeatures')
lift $ f
cStructSize = 48
cStructAlignment = 8
pokeZeroCStruct p f = evalContT $ do
lift $ poke ((p `plusPtr` 0 :: Ptr StructureType)) (STRUCTURE_TYPE_VALIDATION_FEATURES_EXT)
lift $ poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) (nullPtr)
pPEnabledValidationFeatures' <- ContT $ allocaBytesAligned @ValidationFeatureEnableEXT ((Data.Vector.length (mempty)) * 4) 4
lift $ Data.Vector.imapM_ (\i e -> poke (pPEnabledValidationFeatures' `plusPtr` (4 * (i)) :: Ptr ValidationFeatureEnableEXT) (e)) (mempty)
lift $ poke ((p `plusPtr` 24 :: Ptr (Ptr ValidationFeatureEnableEXT))) (pPEnabledValidationFeatures')
pPDisabledValidationFeatures' <- ContT $ allocaBytesAligned @ValidationFeatureDisableEXT ((Data.Vector.length (mempty)) * 4) 4
lift $ Data.Vector.imapM_ (\i e -> poke (pPDisabledValidationFeatures' `plusPtr` (4 * (i)) :: Ptr ValidationFeatureDisableEXT) (e)) (mempty)
lift $ poke ((p `plusPtr` 40 :: Ptr (Ptr ValidationFeatureDisableEXT))) (pPDisabledValidationFeatures')
lift $ f
instance FromCStruct ValidationFeaturesEXT where
peekCStruct p = do
enabledValidationFeatureCount <- peek @Word32 ((p `plusPtr` 16 :: Ptr Word32))
pEnabledValidationFeatures <- peek @(Ptr ValidationFeatureEnableEXT) ((p `plusPtr` 24 :: Ptr (Ptr ValidationFeatureEnableEXT)))
pEnabledValidationFeatures' <- generateM (fromIntegral enabledValidationFeatureCount) (\i -> peek @ValidationFeatureEnableEXT ((pEnabledValidationFeatures `advancePtrBytes` (4 * (i)) :: Ptr ValidationFeatureEnableEXT)))
disabledValidationFeatureCount <- peek @Word32 ((p `plusPtr` 32 :: Ptr Word32))
pDisabledValidationFeatures <- peek @(Ptr ValidationFeatureDisableEXT) ((p `plusPtr` 40 :: Ptr (Ptr ValidationFeatureDisableEXT)))
pDisabledValidationFeatures' <- generateM (fromIntegral disabledValidationFeatureCount) (\i -> peek @ValidationFeatureDisableEXT ((pDisabledValidationFeatures `advancePtrBytes` (4 * (i)) :: Ptr ValidationFeatureDisableEXT)))
pure $ ValidationFeaturesEXT
pEnabledValidationFeatures' pDisabledValidationFeatures'
instance Zero ValidationFeaturesEXT where
zero = ValidationFeaturesEXT
mempty
mempty
newtype ValidationFeatureEnableEXT = ValidationFeatureEnableEXT Int32
deriving newtype (Eq, Ord, Storable, Zero)
pattern VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT = ValidationFeatureEnableEXT 0
pattern VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT = ValidationFeatureEnableEXT 1
pattern VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT = ValidationFeatureEnableEXT 2
{-# complete VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT,
VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT,
VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT :: ValidationFeatureEnableEXT #-}
instance Show ValidationFeatureEnableEXT where
showsPrec p = \case
VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT -> showString "VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT"
VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT -> showString "VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT"
VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT -> showString "VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT"
ValidationFeatureEnableEXT x -> showParen (p >= 11) (showString "ValidationFeatureEnableEXT " . showsPrec 11 x)
instance Read ValidationFeatureEnableEXT where
readPrec = parens (choose [("VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT", pure VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT)
, ("VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT", pure VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT)
, ("VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT", pure VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT)]
+++
prec 10 (do
expectP (Ident "ValidationFeatureEnableEXT")
v <- step readPrec
pure (ValidationFeatureEnableEXT v)))
newtype ValidationFeatureDisableEXT = ValidationFeatureDisableEXT Int32
deriving newtype (Eq, Ord, Storable, Zero)
pattern VALIDATION_FEATURE_DISABLE_ALL_EXT = ValidationFeatureDisableEXT 0
pattern VALIDATION_FEATURE_DISABLE_SHADERS_EXT = ValidationFeatureDisableEXT 1
pattern VALIDATION_FEATURE_DISABLE_THREAD_SAFETY_EXT = ValidationFeatureDisableEXT 2
pattern VALIDATION_FEATURE_DISABLE_API_PARAMETERS_EXT = ValidationFeatureDisableEXT 3
pattern VALIDATION_FEATURE_DISABLE_OBJECT_LIFETIMES_EXT = ValidationFeatureDisableEXT 4
pattern VALIDATION_FEATURE_DISABLE_CORE_CHECKS_EXT = ValidationFeatureDisableEXT 5
pattern VALIDATION_FEATURE_DISABLE_UNIQUE_HANDLES_EXT = ValidationFeatureDisableEXT 6
{-# complete VALIDATION_FEATURE_DISABLE_ALL_EXT,
VALIDATION_FEATURE_DISABLE_SHADERS_EXT,
VALIDATION_FEATURE_DISABLE_THREAD_SAFETY_EXT,
VALIDATION_FEATURE_DISABLE_API_PARAMETERS_EXT,
VALIDATION_FEATURE_DISABLE_OBJECT_LIFETIMES_EXT,
VALIDATION_FEATURE_DISABLE_CORE_CHECKS_EXT,
VALIDATION_FEATURE_DISABLE_UNIQUE_HANDLES_EXT :: ValidationFeatureDisableEXT #-}
instance Show ValidationFeatureDisableEXT where
showsPrec p = \case
VALIDATION_FEATURE_DISABLE_ALL_EXT -> showString "VALIDATION_FEATURE_DISABLE_ALL_EXT"
VALIDATION_FEATURE_DISABLE_SHADERS_EXT -> showString "VALIDATION_FEATURE_DISABLE_SHADERS_EXT"
VALIDATION_FEATURE_DISABLE_THREAD_SAFETY_EXT -> showString "VALIDATION_FEATURE_DISABLE_THREAD_SAFETY_EXT"
VALIDATION_FEATURE_DISABLE_API_PARAMETERS_EXT -> showString "VALIDATION_FEATURE_DISABLE_API_PARAMETERS_EXT"
VALIDATION_FEATURE_DISABLE_OBJECT_LIFETIMES_EXT -> showString "VALIDATION_FEATURE_DISABLE_OBJECT_LIFETIMES_EXT"
VALIDATION_FEATURE_DISABLE_CORE_CHECKS_EXT -> showString "VALIDATION_FEATURE_DISABLE_CORE_CHECKS_EXT"
VALIDATION_FEATURE_DISABLE_UNIQUE_HANDLES_EXT -> showString "VALIDATION_FEATURE_DISABLE_UNIQUE_HANDLES_EXT"
ValidationFeatureDisableEXT x -> showParen (p >= 11) (showString "ValidationFeatureDisableEXT " . showsPrec 11 x)
instance Read ValidationFeatureDisableEXT where
readPrec = parens (choose [("VALIDATION_FEATURE_DISABLE_ALL_EXT", pure VALIDATION_FEATURE_DISABLE_ALL_EXT)
, ("VALIDATION_FEATURE_DISABLE_SHADERS_EXT", pure VALIDATION_FEATURE_DISABLE_SHADERS_EXT)
, ("VALIDATION_FEATURE_DISABLE_THREAD_SAFETY_EXT", pure VALIDATION_FEATURE_DISABLE_THREAD_SAFETY_EXT)
, ("VALIDATION_FEATURE_DISABLE_API_PARAMETERS_EXT", pure VALIDATION_FEATURE_DISABLE_API_PARAMETERS_EXT)
, ("VALIDATION_FEATURE_DISABLE_OBJECT_LIFETIMES_EXT", pure VALIDATION_FEATURE_DISABLE_OBJECT_LIFETIMES_EXT)
, ("VALIDATION_FEATURE_DISABLE_CORE_CHECKS_EXT", pure VALIDATION_FEATURE_DISABLE_CORE_CHECKS_EXT)
, ("VALIDATION_FEATURE_DISABLE_UNIQUE_HANDLES_EXT", pure VALIDATION_FEATURE_DISABLE_UNIQUE_HANDLES_EXT)]
+++
prec 10 (do
expectP (Ident "ValidationFeatureDisableEXT")
v <- step readPrec
pure (ValidationFeatureDisableEXT v)))
type EXT_VALIDATION_FEATURES_SPEC_VERSION = 2
pattern EXT_VALIDATION_FEATURES_SPEC_VERSION :: forall a . Integral a => a
pattern EXT_VALIDATION_FEATURES_SPEC_VERSION = 2
type EXT_VALIDATION_FEATURES_EXTENSION_NAME = "VK_EXT_validation_features"
pattern EXT_VALIDATION_FEATURES_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern EXT_VALIDATION_FEATURES_EXTENSION_NAME = "VK_EXT_validation_features"