{-# language CPP #-}
module Vulkan.Extensions.VK_KHR_shader_terminate_invocation  ( PhysicalDeviceShaderTerminateInvocationFeaturesKHR(..)
                                                             , KHR_SHADER_TERMINATE_INVOCATION_SPEC_VERSION
                                                             , pattern KHR_SHADER_TERMINATE_INVOCATION_SPEC_VERSION
                                                             , KHR_SHADER_TERMINATE_INVOCATION_EXTENSION_NAME
                                                             , pattern KHR_SHADER_TERMINATE_INVOCATION_EXTENSION_NAME
                                                             ) where

import Foreign.Marshal.Alloc (allocaBytesAligned)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
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 GHC.Generics (Generic)
import Foreign.Ptr (Ptr)
import Data.Kind (Type)
import Vulkan.Core10.FundamentalTypes (bool32ToBool)
import Vulkan.Core10.FundamentalTypes (boolToBool32)
import Vulkan.Core10.FundamentalTypes (Bool32)
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.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TERMINATE_INVOCATION_FEATURES_KHR))
-- | VkPhysicalDeviceShaderTerminateInvocationFeaturesKHR - Structure
-- describing support for the SPIR-V @SPV_KHR_terminate_invocation@
-- extension
--
-- = Members
--
-- The members of the 'PhysicalDeviceShaderTerminateInvocationFeaturesKHR'
-- structure describe the following feature:
--
-- = Description
--
-- If the 'PhysicalDeviceShaderTerminateInvocationFeaturesKHR' structure is
-- included in the @pNext@ chain of
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceFeatures2',
-- it is filled with a value indicating whether the feature is supported.
-- 'PhysicalDeviceShaderTerminateInvocationFeaturesKHR' /can/ also be
-- included in the @pNext@ chain of 'Vulkan.Core10.Device.DeviceCreateInfo'
-- to enable the features.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- 'Vulkan.Core10.FundamentalTypes.Bool32',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PhysicalDeviceShaderTerminateInvocationFeaturesKHR = PhysicalDeviceShaderTerminateInvocationFeaturesKHR
  { -- | @shaderTerminateInvocation@ specifies whether the implementation
    -- supports SPIR-V modules that use the @SPV_KHR_terminate_invocation@
    -- extension.
    PhysicalDeviceShaderTerminateInvocationFeaturesKHR -> Bool
shaderTerminateInvocation :: Bool }
  deriving (Typeable, PhysicalDeviceShaderTerminateInvocationFeaturesKHR
-> PhysicalDeviceShaderTerminateInvocationFeaturesKHR -> Bool
(PhysicalDeviceShaderTerminateInvocationFeaturesKHR
 -> PhysicalDeviceShaderTerminateInvocationFeaturesKHR -> Bool)
-> (PhysicalDeviceShaderTerminateInvocationFeaturesKHR
    -> PhysicalDeviceShaderTerminateInvocationFeaturesKHR -> Bool)
-> Eq PhysicalDeviceShaderTerminateInvocationFeaturesKHR
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhysicalDeviceShaderTerminateInvocationFeaturesKHR
-> PhysicalDeviceShaderTerminateInvocationFeaturesKHR -> Bool
$c/= :: PhysicalDeviceShaderTerminateInvocationFeaturesKHR
-> PhysicalDeviceShaderTerminateInvocationFeaturesKHR -> Bool
== :: PhysicalDeviceShaderTerminateInvocationFeaturesKHR
-> PhysicalDeviceShaderTerminateInvocationFeaturesKHR -> Bool
$c== :: PhysicalDeviceShaderTerminateInvocationFeaturesKHR
-> PhysicalDeviceShaderTerminateInvocationFeaturesKHR -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceShaderTerminateInvocationFeaturesKHR)
#endif
deriving instance Show PhysicalDeviceShaderTerminateInvocationFeaturesKHR

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

instance FromCStruct PhysicalDeviceShaderTerminateInvocationFeaturesKHR where
  peekCStruct :: Ptr PhysicalDeviceShaderTerminateInvocationFeaturesKHR
-> IO PhysicalDeviceShaderTerminateInvocationFeaturesKHR
peekCStruct p :: Ptr PhysicalDeviceShaderTerminateInvocationFeaturesKHR
p = do
    Bool32
shaderTerminateInvocation <- Ptr Bool32 -> IO Bool32
forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PhysicalDeviceShaderTerminateInvocationFeaturesKHR
p Ptr PhysicalDeviceShaderTerminateInvocationFeaturesKHR
-> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Bool32))
    PhysicalDeviceShaderTerminateInvocationFeaturesKHR
-> IO PhysicalDeviceShaderTerminateInvocationFeaturesKHR
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PhysicalDeviceShaderTerminateInvocationFeaturesKHR
 -> IO PhysicalDeviceShaderTerminateInvocationFeaturesKHR)
-> PhysicalDeviceShaderTerminateInvocationFeaturesKHR
-> IO PhysicalDeviceShaderTerminateInvocationFeaturesKHR
forall a b. (a -> b) -> a -> b
$ Bool -> PhysicalDeviceShaderTerminateInvocationFeaturesKHR
PhysicalDeviceShaderTerminateInvocationFeaturesKHR
             (Bool32 -> Bool
bool32ToBool Bool32
shaderTerminateInvocation)

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

instance Zero PhysicalDeviceShaderTerminateInvocationFeaturesKHR where
  zero :: PhysicalDeviceShaderTerminateInvocationFeaturesKHR
zero = Bool -> PhysicalDeviceShaderTerminateInvocationFeaturesKHR
PhysicalDeviceShaderTerminateInvocationFeaturesKHR
           Bool
forall a. Zero a => a
zero


type KHR_SHADER_TERMINATE_INVOCATION_SPEC_VERSION = 1

-- No documentation found for TopLevel "VK_KHR_SHADER_TERMINATE_INVOCATION_SPEC_VERSION"
pattern KHR_SHADER_TERMINATE_INVOCATION_SPEC_VERSION :: forall a . Integral a => a
pattern $bKHR_SHADER_TERMINATE_INVOCATION_SPEC_VERSION :: a
$mKHR_SHADER_TERMINATE_INVOCATION_SPEC_VERSION :: forall r a. Integral a => a -> (Void# -> r) -> (Void# -> r) -> r
KHR_SHADER_TERMINATE_INVOCATION_SPEC_VERSION = 1


type KHR_SHADER_TERMINATE_INVOCATION_EXTENSION_NAME = "VK_KHR_shader_terminate_invocation"

-- No documentation found for TopLevel "VK_KHR_SHADER_TERMINATE_INVOCATION_EXTENSION_NAME"
pattern KHR_SHADER_TERMINATE_INVOCATION_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bKHR_SHADER_TERMINATE_INVOCATION_EXTENSION_NAME :: a
$mKHR_SHADER_TERMINATE_INVOCATION_EXTENSION_NAME :: forall r a.
(Eq a, IsString a) =>
a -> (Void# -> r) -> (Void# -> r) -> r
KHR_SHADER_TERMINATE_INVOCATION_EXTENSION_NAME = "VK_KHR_shader_terminate_invocation"