{-# language CPP #-}
module Vulkan.Core11.Originally_Based_On_VK_KHR_subgroup ( PhysicalDeviceSubgroupProperties(..)
, StructureType(..)
, SubgroupFeatureFlagBits(..)
, SubgroupFeatureFlags
) where
import Foreign.Marshal.Alloc (allocaBytes)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Zero (Zero(..))
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.Word (Word32)
import Data.Kind (Type)
import Vulkan.Core10.FundamentalTypes (bool32ToBool)
import Vulkan.Core10.FundamentalTypes (boolToBool32)
import Vulkan.Core10.FundamentalTypes (Bool32)
import Vulkan.Core10.Enums.ShaderStageFlagBits (ShaderStageFlags)
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Core11.Enums.SubgroupFeatureFlagBits (SubgroupFeatureFlags)
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES))
import Vulkan.Core10.Enums.StructureType (StructureType(..))
import Vulkan.Core11.Enums.SubgroupFeatureFlagBits (SubgroupFeatureFlagBits(..))
import Vulkan.Core11.Enums.SubgroupFeatureFlagBits (SubgroupFeatureFlags)
data PhysicalDeviceSubgroupProperties = PhysicalDeviceSubgroupProperties
{
PhysicalDeviceSubgroupProperties -> Word32
subgroupSize :: Word32
,
PhysicalDeviceSubgroupProperties -> ShaderStageFlags
supportedStages :: ShaderStageFlags
,
PhysicalDeviceSubgroupProperties -> SubgroupFeatureFlags
supportedOperations :: SubgroupFeatureFlags
,
PhysicalDeviceSubgroupProperties -> Bool
quadOperationsInAllStages :: Bool
}
deriving (Typeable, PhysicalDeviceSubgroupProperties
-> PhysicalDeviceSubgroupProperties -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhysicalDeviceSubgroupProperties
-> PhysicalDeviceSubgroupProperties -> Bool
$c/= :: PhysicalDeviceSubgroupProperties
-> PhysicalDeviceSubgroupProperties -> Bool
== :: PhysicalDeviceSubgroupProperties
-> PhysicalDeviceSubgroupProperties -> Bool
$c== :: PhysicalDeviceSubgroupProperties
-> PhysicalDeviceSubgroupProperties -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceSubgroupProperties)
#endif
deriving instance Show PhysicalDeviceSubgroupProperties
instance ToCStruct PhysicalDeviceSubgroupProperties where
withCStruct :: forall b.
PhysicalDeviceSubgroupProperties
-> (Ptr PhysicalDeviceSubgroupProperties -> IO b) -> IO b
withCStruct PhysicalDeviceSubgroupProperties
x Ptr PhysicalDeviceSubgroupProperties -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
32 forall a b. (a -> b) -> a -> b
$ \Ptr PhysicalDeviceSubgroupProperties
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceSubgroupProperties
p PhysicalDeviceSubgroupProperties
x (Ptr PhysicalDeviceSubgroupProperties -> IO b
f Ptr PhysicalDeviceSubgroupProperties
p)
pokeCStruct :: forall b.
Ptr PhysicalDeviceSubgroupProperties
-> PhysicalDeviceSubgroupProperties -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceSubgroupProperties
p PhysicalDeviceSubgroupProperties{Bool
Word32
ShaderStageFlags
SubgroupFeatureFlags
quadOperationsInAllStages :: Bool
supportedOperations :: SubgroupFeatureFlags
supportedStages :: ShaderStageFlags
subgroupSize :: Word32
$sel:quadOperationsInAllStages:PhysicalDeviceSubgroupProperties :: PhysicalDeviceSubgroupProperties -> Bool
$sel:supportedOperations:PhysicalDeviceSubgroupProperties :: PhysicalDeviceSubgroupProperties -> SubgroupFeatureFlags
$sel:supportedStages:PhysicalDeviceSubgroupProperties :: PhysicalDeviceSubgroupProperties -> ShaderStageFlags
$sel:subgroupSize:PhysicalDeviceSubgroupProperties :: PhysicalDeviceSubgroupProperties -> Word32
..} IO b
f = do
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceSubgroupProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceSubgroupProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceSubgroupProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32)) (Word32
subgroupSize)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceSubgroupProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr ShaderStageFlags)) (ShaderStageFlags
supportedStages)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceSubgroupProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr SubgroupFeatureFlags)) (SubgroupFeatureFlags
supportedOperations)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceSubgroupProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
quadOperationsInAllStages))
IO b
f
cStructSize :: Int
cStructSize = Int
32
cStructAlignment :: Int
cStructAlignment = Int
8
pokeZeroCStruct :: forall b. Ptr PhysicalDeviceSubgroupProperties -> IO b -> IO b
pokeZeroCStruct Ptr PhysicalDeviceSubgroupProperties
p IO b
f = do
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceSubgroupProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceSubgroupProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceSubgroupProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32)) (forall a. Zero a => a
zero)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceSubgroupProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr ShaderStageFlags)) (forall a. Zero a => a
zero)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceSubgroupProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr SubgroupFeatureFlags)) (forall a. Zero a => a
zero)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceSubgroupProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (forall a. Zero a => a
zero))
IO b
f
instance FromCStruct PhysicalDeviceSubgroupProperties where
peekCStruct :: Ptr PhysicalDeviceSubgroupProperties
-> IO PhysicalDeviceSubgroupProperties
peekCStruct Ptr PhysicalDeviceSubgroupProperties
p = do
Word32
subgroupSize <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr PhysicalDeviceSubgroupProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32))
ShaderStageFlags
supportedStages <- forall a. Storable a => Ptr a -> IO a
peek @ShaderStageFlags ((Ptr PhysicalDeviceSubgroupProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr ShaderStageFlags))
SubgroupFeatureFlags
supportedOperations <- forall a. Storable a => Ptr a -> IO a
peek @SubgroupFeatureFlags ((Ptr PhysicalDeviceSubgroupProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr SubgroupFeatureFlags))
Bool32
quadOperationsInAllStages <- forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PhysicalDeviceSubgroupProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr Bool32))
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Word32
-> ShaderStageFlags
-> SubgroupFeatureFlags
-> Bool
-> PhysicalDeviceSubgroupProperties
PhysicalDeviceSubgroupProperties
Word32
subgroupSize
ShaderStageFlags
supportedStages
SubgroupFeatureFlags
supportedOperations
(Bool32 -> Bool
bool32ToBool Bool32
quadOperationsInAllStages)
instance Storable PhysicalDeviceSubgroupProperties where
sizeOf :: PhysicalDeviceSubgroupProperties -> Int
sizeOf ~PhysicalDeviceSubgroupProperties
_ = Int
32
alignment :: PhysicalDeviceSubgroupProperties -> Int
alignment ~PhysicalDeviceSubgroupProperties
_ = Int
8
peek :: Ptr PhysicalDeviceSubgroupProperties
-> IO PhysicalDeviceSubgroupProperties
peek = forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: Ptr PhysicalDeviceSubgroupProperties
-> PhysicalDeviceSubgroupProperties -> IO ()
poke Ptr PhysicalDeviceSubgroupProperties
ptr PhysicalDeviceSubgroupProperties
poked = forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceSubgroupProperties
ptr PhysicalDeviceSubgroupProperties
poked (forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero PhysicalDeviceSubgroupProperties where
zero :: PhysicalDeviceSubgroupProperties
zero = Word32
-> ShaderStageFlags
-> SubgroupFeatureFlags
-> Bool
-> PhysicalDeviceSubgroupProperties
PhysicalDeviceSubgroupProperties
forall a. Zero a => a
zero
forall a. Zero a => a
zero
forall a. Zero a => a
zero
forall a. Zero a => a
zero