{-# language CPP #-}
module Vulkan.Core12.Promoted_From_VK_KHR_shader_subgroup_extended_types  ( PhysicalDeviceShaderSubgroupExtendedTypesFeatures(..)
                                                                          , StructureType(..)
                                                                          ) where

import Foreign.Marshal.Alloc (allocaBytesAligned)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
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_SUBGROUP_EXTENDED_TYPES_FEATURES))
import Vulkan.Core10.Enums.StructureType (StructureType(..))
-- | VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures - Structure
-- describing the extended types subgroups support feature for an
-- implementation
--
-- = Members
--
-- The members of the 'PhysicalDeviceShaderSubgroupExtendedTypesFeatures'
-- structure describe the following features:
--
-- = Description
--
-- If the 'PhysicalDeviceShaderSubgroupExtendedTypesFeatures' structure is
-- included in the @pNext@ chain of
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceFeatures2',
-- it is filled with values indicating whether each feature is supported.
-- 'PhysicalDeviceShaderSubgroupExtendedTypesFeatures' /can/ also be
-- included in the @pNext@ chain of 'Vulkan.Core10.Device.DeviceCreateInfo'
-- to enable features.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- 'Vulkan.Core10.FundamentalTypes.Bool32',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PhysicalDeviceShaderSubgroupExtendedTypesFeatures = PhysicalDeviceShaderSubgroupExtendedTypesFeatures
  { -- | @shaderSubgroupExtendedTypes@ is a boolean that specifies whether
    -- subgroup operations can use 8-bit integer, 16-bit integer, 64-bit
    -- integer, 16-bit floating-point, and vectors of these types in
    -- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#shaders-group-operations group operations>
    -- with
    -- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#shaders-scope-subgroup subgroup scope>if
    -- the implementation supports the types.
    PhysicalDeviceShaderSubgroupExtendedTypesFeatures -> Bool
shaderSubgroupExtendedTypes :: Bool }
  deriving (Typeable, PhysicalDeviceShaderSubgroupExtendedTypesFeatures
-> PhysicalDeviceShaderSubgroupExtendedTypesFeatures -> Bool
(PhysicalDeviceShaderSubgroupExtendedTypesFeatures
 -> PhysicalDeviceShaderSubgroupExtendedTypesFeatures -> Bool)
-> (PhysicalDeviceShaderSubgroupExtendedTypesFeatures
    -> PhysicalDeviceShaderSubgroupExtendedTypesFeatures -> Bool)
-> Eq PhysicalDeviceShaderSubgroupExtendedTypesFeatures
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhysicalDeviceShaderSubgroupExtendedTypesFeatures
-> PhysicalDeviceShaderSubgroupExtendedTypesFeatures -> Bool
$c/= :: PhysicalDeviceShaderSubgroupExtendedTypesFeatures
-> PhysicalDeviceShaderSubgroupExtendedTypesFeatures -> Bool
== :: PhysicalDeviceShaderSubgroupExtendedTypesFeatures
-> PhysicalDeviceShaderSubgroupExtendedTypesFeatures -> Bool
$c== :: PhysicalDeviceShaderSubgroupExtendedTypesFeatures
-> PhysicalDeviceShaderSubgroupExtendedTypesFeatures -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceShaderSubgroupExtendedTypesFeatures)
#endif
deriving instance Show PhysicalDeviceShaderSubgroupExtendedTypesFeatures

instance ToCStruct PhysicalDeviceShaderSubgroupExtendedTypesFeatures where
  withCStruct :: PhysicalDeviceShaderSubgroupExtendedTypesFeatures
-> (Ptr PhysicalDeviceShaderSubgroupExtendedTypesFeatures -> IO b)
-> IO b
withCStruct x :: PhysicalDeviceShaderSubgroupExtendedTypesFeatures
x f :: Ptr PhysicalDeviceShaderSubgroupExtendedTypesFeatures -> IO b
f = Int
-> Int
-> (Ptr PhysicalDeviceShaderSubgroupExtendedTypesFeatures -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 24 8 ((Ptr PhysicalDeviceShaderSubgroupExtendedTypesFeatures -> IO b)
 -> IO b)
-> (Ptr PhysicalDeviceShaderSubgroupExtendedTypesFeatures -> IO b)
-> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr PhysicalDeviceShaderSubgroupExtendedTypesFeatures
p -> Ptr PhysicalDeviceShaderSubgroupExtendedTypesFeatures
-> PhysicalDeviceShaderSubgroupExtendedTypesFeatures
-> IO b
-> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceShaderSubgroupExtendedTypesFeatures
p PhysicalDeviceShaderSubgroupExtendedTypesFeatures
x (Ptr PhysicalDeviceShaderSubgroupExtendedTypesFeatures -> IO b
f Ptr PhysicalDeviceShaderSubgroupExtendedTypesFeatures
p)
  pokeCStruct :: Ptr PhysicalDeviceShaderSubgroupExtendedTypesFeatures
-> PhysicalDeviceShaderSubgroupExtendedTypesFeatures
-> IO b
-> IO b
pokeCStruct p :: Ptr PhysicalDeviceShaderSubgroupExtendedTypesFeatures
p PhysicalDeviceShaderSubgroupExtendedTypesFeatures{..} f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceShaderSubgroupExtendedTypesFeatures
p Ptr PhysicalDeviceShaderSubgroupExtendedTypesFeatures
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_EXTENDED_TYPES_FEATURES)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceShaderSubgroupExtendedTypesFeatures
p Ptr PhysicalDeviceShaderSubgroupExtendedTypesFeatures
-> 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 PhysicalDeviceShaderSubgroupExtendedTypesFeatures
p Ptr PhysicalDeviceShaderSubgroupExtendedTypesFeatures
-> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
shaderSubgroupExtendedTypes))
    IO b
f
  cStructSize :: Int
cStructSize = 24
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr PhysicalDeviceShaderSubgroupExtendedTypesFeatures
-> IO b -> IO b
pokeZeroCStruct p :: Ptr PhysicalDeviceShaderSubgroupExtendedTypesFeatures
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceShaderSubgroupExtendedTypesFeatures
p Ptr PhysicalDeviceShaderSubgroupExtendedTypesFeatures
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_EXTENDED_TYPES_FEATURES)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceShaderSubgroupExtendedTypesFeatures
p Ptr PhysicalDeviceShaderSubgroupExtendedTypesFeatures
-> 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 PhysicalDeviceShaderSubgroupExtendedTypesFeatures
p Ptr PhysicalDeviceShaderSubgroupExtendedTypesFeatures
-> 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 PhysicalDeviceShaderSubgroupExtendedTypesFeatures where
  peekCStruct :: Ptr PhysicalDeviceShaderSubgroupExtendedTypesFeatures
-> IO PhysicalDeviceShaderSubgroupExtendedTypesFeatures
peekCStruct p :: Ptr PhysicalDeviceShaderSubgroupExtendedTypesFeatures
p = do
    Bool32
shaderSubgroupExtendedTypes <- Ptr Bool32 -> IO Bool32
forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PhysicalDeviceShaderSubgroupExtendedTypesFeatures
p Ptr PhysicalDeviceShaderSubgroupExtendedTypesFeatures
-> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Bool32))
    PhysicalDeviceShaderSubgroupExtendedTypesFeatures
-> IO PhysicalDeviceShaderSubgroupExtendedTypesFeatures
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PhysicalDeviceShaderSubgroupExtendedTypesFeatures
 -> IO PhysicalDeviceShaderSubgroupExtendedTypesFeatures)
-> PhysicalDeviceShaderSubgroupExtendedTypesFeatures
-> IO PhysicalDeviceShaderSubgroupExtendedTypesFeatures
forall a b. (a -> b) -> a -> b
$ Bool -> PhysicalDeviceShaderSubgroupExtendedTypesFeatures
PhysicalDeviceShaderSubgroupExtendedTypesFeatures
             (Bool32 -> Bool
bool32ToBool Bool32
shaderSubgroupExtendedTypes)

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

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