{-# language CPP #-}
-- No documentation found for Chapter "Promoted_From_VK_KHR_variable_pointers"
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(..))
-- 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 -> ((# #) -> r) -> ((# #) -> 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
--
-- This structure describes the following features:
--
-- = Description
--
-- -   @sType@ is the type of this structure.
--
-- -   @pNext@ is @NULL@ or a pointer to a structure extending this
--     structure.
--
-- -   #extension-features-variablePointersStorageBuffer#
--     @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.
--
-- -   #extension-features-variablePointers# @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 the
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceFeatures2'
-- structure passed to
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.getPhysicalDeviceFeatures2',
-- it is filled in to indicate whether each corresponding feature is
-- supported. 'PhysicalDeviceVariablePointersFeatures' /can/ also be used
-- in the @pNext@ chain of 'Vulkan.Core10.Device.DeviceCreateInfo' to
-- selectively enable these features.
--
-- == Valid Usage
--
-- -   #VUID-VkPhysicalDeviceVariablePointersFeatures-variablePointers-01431#
--     If @variablePointers@ is enabled then
--     @variablePointersStorageBuffer@ /must/ also be enabled
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkPhysicalDeviceVariablePointersFeatures-sType-sType# @sType@
--     /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES'
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_variable_pointers VK_KHR_variable_pointers>,
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_VERSION_1_1 VK_VERSION_1_1>,
-- 'Vulkan.Core10.FundamentalTypes.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, 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


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