{-# language CPP #-}
module Vulkan.Core11.Promoted_From_VK_KHR_variable_pointers ( pattern STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES
, PhysicalDeviceVariablePointersFeatures(..)
, PhysicalDeviceVariablePointerFeatures
, StructureType(..)
) 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.Kind (Type)
import Vulkan.Core10.FundamentalTypes (bool32ToBool)
import Vulkan.Core10.FundamentalTypes (boolToBool32)
import Vulkan.Core10.FundamentalTypes (Bool32)
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES))
import Vulkan.Core10.Enums.StructureType (StructureType(..))
pattern $bSTRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES :: StructureType
$mSTRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES :: forall {r}. StructureType -> ((# #) -> r) -> ((# #) -> r) -> r
STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES = STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES
data PhysicalDeviceVariablePointersFeatures = PhysicalDeviceVariablePointersFeatures
{
:: Bool
,
PhysicalDeviceVariablePointersFeatures -> Bool
variablePointers :: Bool
}
deriving (Typeable, PhysicalDeviceVariablePointersFeatures
-> PhysicalDeviceVariablePointersFeatures -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhysicalDeviceVariablePointersFeatures
-> PhysicalDeviceVariablePointersFeatures -> Bool
$c/= :: PhysicalDeviceVariablePointersFeatures
-> PhysicalDeviceVariablePointersFeatures -> Bool
== :: PhysicalDeviceVariablePointersFeatures
-> PhysicalDeviceVariablePointersFeatures -> Bool
$c== :: PhysicalDeviceVariablePointersFeatures
-> PhysicalDeviceVariablePointersFeatures -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceVariablePointersFeatures)
#endif
deriving instance Show PhysicalDeviceVariablePointersFeatures
instance ToCStruct PhysicalDeviceVariablePointersFeatures where
withCStruct :: forall b.
PhysicalDeviceVariablePointersFeatures
-> (Ptr PhysicalDeviceVariablePointersFeatures -> IO b) -> IO b
withCStruct PhysicalDeviceVariablePointersFeatures
x Ptr PhysicalDeviceVariablePointersFeatures -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
24 forall a b. (a -> b) -> a -> b
$ \Ptr PhysicalDeviceVariablePointersFeatures
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceVariablePointersFeatures
p PhysicalDeviceVariablePointersFeatures
x (Ptr PhysicalDeviceVariablePointersFeatures -> IO b
f Ptr PhysicalDeviceVariablePointersFeatures
p)
pokeCStruct :: forall b.
Ptr PhysicalDeviceVariablePointersFeatures
-> PhysicalDeviceVariablePointersFeatures -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceVariablePointersFeatures
p PhysicalDeviceVariablePointersFeatures{Bool
variablePointers :: Bool
variablePointersStorageBuffer :: Bool
$sel:variablePointers:PhysicalDeviceVariablePointersFeatures :: PhysicalDeviceVariablePointersFeatures -> Bool
$sel:variablePointersStorageBuffer:PhysicalDeviceVariablePointersFeatures :: PhysicalDeviceVariablePointersFeatures -> Bool
..} IO b
f = do
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceVariablePointersFeatures
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceVariablePointersFeatures
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 PhysicalDeviceVariablePointersFeatures
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
variablePointersStorageBuffer))
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceVariablePointersFeatures
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
variablePointers))
IO b
f
cStructSize :: Int
cStructSize = Int
24
cStructAlignment :: Int
cStructAlignment = Int
8
pokeZeroCStruct :: forall b.
Ptr PhysicalDeviceVariablePointersFeatures -> IO b -> IO b
pokeZeroCStruct Ptr PhysicalDeviceVariablePointersFeatures
p IO b
f = do
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceVariablePointersFeatures
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceVariablePointersFeatures
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 PhysicalDeviceVariablePointersFeatures
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (forall a. Zero a => a
zero))
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceVariablePointersFeatures
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (forall a. Zero a => a
zero))
IO b
f
instance FromCStruct PhysicalDeviceVariablePointersFeatures where
peekCStruct :: Ptr PhysicalDeviceVariablePointersFeatures
-> IO PhysicalDeviceVariablePointersFeatures
peekCStruct Ptr PhysicalDeviceVariablePointersFeatures
p = do
Bool32
variablePointersStorageBuffer <- forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PhysicalDeviceVariablePointersFeatures
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32))
Bool32
variablePointers <- forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PhysicalDeviceVariablePointersFeatures
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Bool32))
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Bool -> Bool -> PhysicalDeviceVariablePointersFeatures
PhysicalDeviceVariablePointersFeatures
(Bool32 -> Bool
bool32ToBool Bool32
variablePointersStorageBuffer)
(Bool32 -> Bool
bool32ToBool Bool32
variablePointers)
instance Storable PhysicalDeviceVariablePointersFeatures where
sizeOf :: PhysicalDeviceVariablePointersFeatures -> Int
sizeOf ~PhysicalDeviceVariablePointersFeatures
_ = Int
24
alignment :: PhysicalDeviceVariablePointersFeatures -> Int
alignment ~PhysicalDeviceVariablePointersFeatures
_ = Int
8
peek :: Ptr PhysicalDeviceVariablePointersFeatures
-> IO PhysicalDeviceVariablePointersFeatures
peek = forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: Ptr PhysicalDeviceVariablePointersFeatures
-> PhysicalDeviceVariablePointersFeatures -> IO ()
poke Ptr PhysicalDeviceVariablePointersFeatures
ptr PhysicalDeviceVariablePointersFeatures
poked = forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceVariablePointersFeatures
ptr PhysicalDeviceVariablePointersFeatures
poked (forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero PhysicalDeviceVariablePointersFeatures where
zero :: PhysicalDeviceVariablePointersFeatures
zero = Bool -> Bool -> PhysicalDeviceVariablePointersFeatures
PhysicalDeviceVariablePointersFeatures
forall a. Zero a => a
zero
forall a. Zero a => a
zero
type PhysicalDeviceVariablePointerFeatures = PhysicalDeviceVariablePointersFeatures