{-# 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 (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.BaseType (bool32ToBool)
import Vulkan.Core10.BaseType (boolToBool32)
import Vulkan.Core10.BaseType (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_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 -> (Void# -> r) -> (Void# -> 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
(PhysicalDeviceVariablePointersFeatures
-> PhysicalDeviceVariablePointersFeatures -> Bool)
-> (PhysicalDeviceVariablePointersFeatures
-> PhysicalDeviceVariablePointersFeatures -> Bool)
-> Eq PhysicalDeviceVariablePointersFeatures
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 :: PhysicalDeviceVariablePointersFeatures
-> (Ptr PhysicalDeviceVariablePointersFeatures -> IO b) -> IO b
withCStruct x :: PhysicalDeviceVariablePointersFeatures
x f :: Ptr PhysicalDeviceVariablePointersFeatures -> IO b
f = Int
-> Int
-> (Ptr PhysicalDeviceVariablePointersFeatures -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 24 8 ((Ptr PhysicalDeviceVariablePointersFeatures -> IO b) -> IO b)
-> (Ptr PhysicalDeviceVariablePointersFeatures -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr PhysicalDeviceVariablePointersFeatures
p -> Ptr PhysicalDeviceVariablePointersFeatures
-> PhysicalDeviceVariablePointersFeatures -> IO b -> IO b
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 :: Ptr PhysicalDeviceVariablePointersFeatures
-> PhysicalDeviceVariablePointersFeatures -> IO b -> IO b
pokeCStruct p :: Ptr PhysicalDeviceVariablePointersFeatures
p PhysicalDeviceVariablePointersFeatures{..} f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceVariablePointersFeatures
p Ptr PhysicalDeviceVariablePointersFeatures
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceVariablePointersFeatures
p Ptr PhysicalDeviceVariablePointersFeatures -> 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 PhysicalDeviceVariablePointersFeatures
p Ptr PhysicalDeviceVariablePointersFeatures -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
variablePointersStorageBuffer))
Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceVariablePointersFeatures
p Ptr PhysicalDeviceVariablePointersFeatures -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
variablePointers))
IO b
f
cStructSize :: Int
cStructSize = 24
cStructAlignment :: Int
cStructAlignment = 8
pokeZeroCStruct :: Ptr PhysicalDeviceVariablePointersFeatures -> IO b -> IO b
pokeZeroCStruct p :: Ptr PhysicalDeviceVariablePointersFeatures
p f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceVariablePointersFeatures
p Ptr PhysicalDeviceVariablePointersFeatures
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceVariablePointersFeatures
p Ptr PhysicalDeviceVariablePointersFeatures -> 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 PhysicalDeviceVariablePointersFeatures
p Ptr PhysicalDeviceVariablePointersFeatures -> 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))
Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceVariablePointersFeatures
p Ptr PhysicalDeviceVariablePointersFeatures -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
forall a. Zero a => a
zero))
IO b
f
instance FromCStruct PhysicalDeviceVariablePointersFeatures where
peekCStruct :: Ptr PhysicalDeviceVariablePointersFeatures
-> IO PhysicalDeviceVariablePointersFeatures
peekCStruct p :: Ptr PhysicalDeviceVariablePointersFeatures
p = do
Bool32
variablePointersStorageBuffer <- Ptr Bool32 -> IO Bool32
forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PhysicalDeviceVariablePointersFeatures
p Ptr PhysicalDeviceVariablePointersFeatures -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Bool32))
Bool32
variablePointers <- Ptr Bool32 -> IO Bool32
forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PhysicalDeviceVariablePointersFeatures
p Ptr PhysicalDeviceVariablePointersFeatures -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Bool32))
PhysicalDeviceVariablePointersFeatures
-> IO PhysicalDeviceVariablePointersFeatures
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PhysicalDeviceVariablePointersFeatures
-> IO PhysicalDeviceVariablePointersFeatures)
-> PhysicalDeviceVariablePointersFeatures
-> IO PhysicalDeviceVariablePointersFeatures
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
_ = 24
alignment :: PhysicalDeviceVariablePointersFeatures -> Int
alignment ~PhysicalDeviceVariablePointersFeatures
_ = 8
peek :: Ptr PhysicalDeviceVariablePointersFeatures
-> IO PhysicalDeviceVariablePointersFeatures
peek = Ptr PhysicalDeviceVariablePointersFeatures
-> IO PhysicalDeviceVariablePointersFeatures
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: Ptr PhysicalDeviceVariablePointersFeatures
-> PhysicalDeviceVariablePointersFeatures -> IO ()
poke ptr :: Ptr PhysicalDeviceVariablePointersFeatures
ptr poked :: PhysicalDeviceVariablePointersFeatures
poked = Ptr PhysicalDeviceVariablePointersFeatures
-> PhysicalDeviceVariablePointersFeatures -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceVariablePointersFeatures
ptr PhysicalDeviceVariablePointersFeatures
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero PhysicalDeviceVariablePointersFeatures where
zero :: PhysicalDeviceVariablePointersFeatures
zero = Bool -> Bool -> PhysicalDeviceVariablePointersFeatures
PhysicalDeviceVariablePointersFeatures
Bool
forall a. Zero a => a
zero
Bool
forall a. Zero a => a
zero
type PhysicalDeviceVariablePointerFeatures = PhysicalDeviceVariablePointersFeatures