{-# 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 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(..))
-- No documentation found for TopLevel "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES"
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


-- | VkPhysicalDeviceVariablePointersFeatures - Structure describing variable
-- pointers features that can be supported by an implementation
--
-- = Members
--
-- The members of the 'PhysicalDeviceVariablePointersFeatures' structure
-- describe the following features:
--
-- = Description
--
-- -   @variablePointersStorageBuffer@ specifies whether the implementation
--     supports the SPIR-V @VariablePointersStorageBuffer@ capability. When
--     this feature is not enabled, shader modules /must/ not declare the
--     @SPV_KHR_variable_pointers@ extension or the
--     @VariablePointersStorageBuffer@ capability.
--
-- -   @variablePointers@ specifies whether the implementation supports the
--     SPIR-V @VariablePointers@ capability. When this feature is not
--     enabled, shader modules /must/ not declare the @VariablePointers@
--     capability.
--
-- If the 'PhysicalDeviceVariablePointersFeatures' 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.
-- 'PhysicalDeviceVariablePointersFeatures' /can/ also be included in the
-- @pNext@ chain of 'Vulkan.Core10.Device.DeviceCreateInfo' to enable the
-- features.
--
-- == Valid Usage
--
-- -   If @variablePointers@ is enabled then
--     @variablePointersStorageBuffer@ /must/ also be enabled
--
-- == Valid Usage (Implicit)
--
-- -   @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES'
--
-- = See Also
--
-- 'Vulkan.Core10.BaseType.Bool32',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PhysicalDeviceVariablePointersFeatures = PhysicalDeviceVariablePointersFeatures
  { -- No documentation found for Nested "VkPhysicalDeviceVariablePointersFeatures" "variablePointersStorageBuffer"
    PhysicalDeviceVariablePointersFeatures -> Bool
variablePointersStorageBuffer :: Bool
  , -- No documentation found for Nested "VkPhysicalDeviceVariablePointersFeatures" "variablePointers"
    PhysicalDeviceVariablePointersFeatures -> Bool
variablePointers :: Bool
  }
  deriving (Typeable)
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


-- No documentation found for TopLevel "VkPhysicalDeviceVariablePointerFeatures"
type PhysicalDeviceVariablePointerFeatures = PhysicalDeviceVariablePointersFeatures