{-# language CPP #-}
module Vulkan.Extensions.VK_EXT_buffer_device_address  ( pattern STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_ADDRESS_FEATURES_EXT
                                                       , pattern STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO_EXT
                                                       , pattern BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_EXT
                                                       , pattern BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_EXT
                                                       , pattern ERROR_INVALID_DEVICE_ADDRESS_EXT
                                                       , getBufferDeviceAddressEXT
                                                       , PhysicalDeviceBufferDeviceAddressFeaturesEXT(..)
                                                       , BufferDeviceAddressCreateInfoEXT(..)
                                                       , PhysicalDeviceBufferAddressFeaturesEXT
                                                       , BufferDeviceAddressInfoEXT
                                                       , EXT_BUFFER_DEVICE_ADDRESS_SPEC_VERSION
                                                       , pattern EXT_BUFFER_DEVICE_ADDRESS_SPEC_VERSION
                                                       , EXT_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME
                                                       , pattern EXT_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME
                                                       ) where

import Foreign.Marshal.Alloc (allocaBytesAligned)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import Data.String (IsString)
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.Core12.Promoted_From_VK_KHR_buffer_device_address (getBufferDeviceAddress)
import Vulkan.Core10.BaseType (Bool32)
import Vulkan.Core12.Promoted_From_VK_KHR_buffer_device_address (BufferDeviceAddressInfo)
import Vulkan.Core10.BaseType (DeviceAddress)
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.BufferCreateFlagBits (BufferCreateFlags)
import Vulkan.Core10.Enums.BufferCreateFlagBits (BufferCreateFlagBits(BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT))
import Vulkan.Core10.Enums.BufferUsageFlagBits (BufferUsageFlags)
import Vulkan.Core10.Enums.BufferUsageFlagBits (BufferUsageFlagBits(BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT))
import Vulkan.Core10.Enums.Result (Result(ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_CREATE_INFO_EXT))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_EXT))
-- No documentation found for TopLevel "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_ADDRESS_FEATURES_EXT"
pattern $bSTRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_ADDRESS_FEATURES_EXT :: StructureType
$mSTRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_ADDRESS_FEATURES_EXT :: forall r. StructureType -> (Void# -> r) -> (Void# -> r) -> r
STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_ADDRESS_FEATURES_EXT = STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_EXT


-- No documentation found for TopLevel "VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO_EXT"
pattern $bSTRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO_EXT :: StructureType
$mSTRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO_EXT :: forall r. StructureType -> (Void# -> r) -> (Void# -> r) -> r
STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO_EXT = STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO


-- No documentation found for TopLevel "VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_EXT"
pattern $bBUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_EXT :: BufferUsageFlagBits
$mBUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_EXT :: forall r. BufferUsageFlagBits -> (Void# -> r) -> (Void# -> r) -> r
BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_EXT = BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT


-- No documentation found for TopLevel "VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_EXT"
pattern $bBUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_EXT :: BufferCreateFlagBits
$mBUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_EXT :: forall r. BufferCreateFlagBits -> (Void# -> r) -> (Void# -> r) -> r
BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_EXT = BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT


-- No documentation found for TopLevel "VK_ERROR_INVALID_DEVICE_ADDRESS_EXT"
pattern $bERROR_INVALID_DEVICE_ADDRESS_EXT :: Result
$mERROR_INVALID_DEVICE_ADDRESS_EXT :: forall r. Result -> (Void# -> r) -> (Void# -> r) -> r
ERROR_INVALID_DEVICE_ADDRESS_EXT = ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS


-- No documentation found for TopLevel "vkGetBufferDeviceAddressEXT"
getBufferDeviceAddressEXT :: Device -> BufferDeviceAddressInfo -> io DeviceAddress
getBufferDeviceAddressEXT = Device -> BufferDeviceAddressInfo -> io DeviceAddress
forall (io :: * -> *).
MonadIO io =>
Device -> BufferDeviceAddressInfo -> io DeviceAddress
getBufferDeviceAddress


-- | VkPhysicalDeviceBufferDeviceAddressFeaturesEXT - Structure describing
-- buffer address features that can be supported by an implementation
--
-- = Members
--
-- The members of the 'PhysicalDeviceBufferDeviceAddressFeaturesEXT'
-- structure describe the following features:
--
-- = Description
--
-- If the 'PhysicalDeviceBufferDeviceAddressFeaturesEXT' 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 the feature is supported.
-- 'PhysicalDeviceBufferDeviceAddressFeaturesEXT' /can/ also be included in
-- the @pNext@ chain of 'Vulkan.Core10.Device.DeviceCreateInfo' to enable
-- features.
--
-- Note
--
-- The 'PhysicalDeviceBufferDeviceAddressFeaturesEXT' structure has the
-- same members as the
-- 'Vulkan.Core12.Promoted_From_VK_KHR_buffer_device_address.PhysicalDeviceBufferDeviceAddressFeatures'
-- structure, but the functionality indicated by the members is expressed
-- differently. The features indicated by the
-- 'Vulkan.Core12.Promoted_From_VK_KHR_buffer_device_address.PhysicalDeviceBufferDeviceAddressFeatures'
-- structure requires additional flags to be passed at memory allocation
-- time, and the capture and replay mechanism is built around opaque
-- capture addresses for buffer and memory objects.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- 'Vulkan.Core10.BaseType.Bool32',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PhysicalDeviceBufferDeviceAddressFeaturesEXT = PhysicalDeviceBufferDeviceAddressFeaturesEXT
  { -- | @bufferDeviceAddress@ indicates that the implementation supports
    -- accessing buffer memory in shaders as storage buffers via an address
    -- queried from 'getBufferDeviceAddressEXT'.
    PhysicalDeviceBufferDeviceAddressFeaturesEXT -> Bool
bufferDeviceAddress :: Bool
  , -- | @bufferDeviceAddressCaptureReplay@ indicates that the implementation
    -- supports saving and reusing buffer addresses, e.g. for trace capture and
    -- replay.
    PhysicalDeviceBufferDeviceAddressFeaturesEXT -> Bool
bufferDeviceAddressCaptureReplay :: Bool
  , -- | @bufferDeviceAddressMultiDevice@ indicates that the implementation
    -- supports the @bufferDeviceAddress@ feature for logical devices created
    -- with multiple physical devices. If this feature is not supported, buffer
    -- addresses /must/ not be queried on a logical device created with more
    -- than one physical device.
    PhysicalDeviceBufferDeviceAddressFeaturesEXT -> Bool
bufferDeviceAddressMultiDevice :: Bool
  }
  deriving (Typeable, PhysicalDeviceBufferDeviceAddressFeaturesEXT
-> PhysicalDeviceBufferDeviceAddressFeaturesEXT -> Bool
(PhysicalDeviceBufferDeviceAddressFeaturesEXT
 -> PhysicalDeviceBufferDeviceAddressFeaturesEXT -> Bool)
-> (PhysicalDeviceBufferDeviceAddressFeaturesEXT
    -> PhysicalDeviceBufferDeviceAddressFeaturesEXT -> Bool)
-> Eq PhysicalDeviceBufferDeviceAddressFeaturesEXT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhysicalDeviceBufferDeviceAddressFeaturesEXT
-> PhysicalDeviceBufferDeviceAddressFeaturesEXT -> Bool
$c/= :: PhysicalDeviceBufferDeviceAddressFeaturesEXT
-> PhysicalDeviceBufferDeviceAddressFeaturesEXT -> Bool
== :: PhysicalDeviceBufferDeviceAddressFeaturesEXT
-> PhysicalDeviceBufferDeviceAddressFeaturesEXT -> Bool
$c== :: PhysicalDeviceBufferDeviceAddressFeaturesEXT
-> PhysicalDeviceBufferDeviceAddressFeaturesEXT -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceBufferDeviceAddressFeaturesEXT)
#endif
deriving instance Show PhysicalDeviceBufferDeviceAddressFeaturesEXT

instance ToCStruct PhysicalDeviceBufferDeviceAddressFeaturesEXT where
  withCStruct :: PhysicalDeviceBufferDeviceAddressFeaturesEXT
-> (Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT -> IO b)
-> IO b
withCStruct x :: PhysicalDeviceBufferDeviceAddressFeaturesEXT
x f :: Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT -> IO b
f = Int
-> Int
-> (Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 32 8 ((Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT -> IO b)
 -> IO b)
-> (Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT -> IO b)
-> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
p -> Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
-> PhysicalDeviceBufferDeviceAddressFeaturesEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
p PhysicalDeviceBufferDeviceAddressFeaturesEXT
x (Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT -> IO b
f Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
p)
  pokeCStruct :: Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
-> PhysicalDeviceBufferDeviceAddressFeaturesEXT -> IO b -> IO b
pokeCStruct p :: Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
p PhysicalDeviceBufferDeviceAddressFeaturesEXT{..} f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
p Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_EXT)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
p Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
-> 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 PhysicalDeviceBufferDeviceAddressFeaturesEXT
p Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
-> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
bufferDeviceAddress))
    Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
p Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
-> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
bufferDeviceAddressCaptureReplay))
    Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
p Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
-> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
bufferDeviceAddressMultiDevice))
    IO b
f
  cStructSize :: Int
cStructSize = 32
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT -> IO b -> IO b
pokeZeroCStruct p :: Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
p Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_EXT)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
p Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
-> 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 PhysicalDeviceBufferDeviceAddressFeaturesEXT
p Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
-> 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 PhysicalDeviceBufferDeviceAddressFeaturesEXT
p Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
-> 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))
    Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
p Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
-> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
forall a. Zero a => a
zero))
    IO b
f

instance FromCStruct PhysicalDeviceBufferDeviceAddressFeaturesEXT where
  peekCStruct :: Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
-> IO PhysicalDeviceBufferDeviceAddressFeaturesEXT
peekCStruct p :: Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
p = do
    Bool32
bufferDeviceAddress <- Ptr Bool32 -> IO Bool32
forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
p Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
-> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Bool32))
    Bool32
bufferDeviceAddressCaptureReplay <- Ptr Bool32 -> IO Bool32
forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
p Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
-> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Bool32))
    Bool32
bufferDeviceAddressMultiDevice <- Ptr Bool32 -> IO Bool32
forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
p Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
-> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr Bool32))
    PhysicalDeviceBufferDeviceAddressFeaturesEXT
-> IO PhysicalDeviceBufferDeviceAddressFeaturesEXT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PhysicalDeviceBufferDeviceAddressFeaturesEXT
 -> IO PhysicalDeviceBufferDeviceAddressFeaturesEXT)
-> PhysicalDeviceBufferDeviceAddressFeaturesEXT
-> IO PhysicalDeviceBufferDeviceAddressFeaturesEXT
forall a b. (a -> b) -> a -> b
$ Bool
-> Bool -> Bool -> PhysicalDeviceBufferDeviceAddressFeaturesEXT
PhysicalDeviceBufferDeviceAddressFeaturesEXT
             (Bool32 -> Bool
bool32ToBool Bool32
bufferDeviceAddress) (Bool32 -> Bool
bool32ToBool Bool32
bufferDeviceAddressCaptureReplay) (Bool32 -> Bool
bool32ToBool Bool32
bufferDeviceAddressMultiDevice)

instance Storable PhysicalDeviceBufferDeviceAddressFeaturesEXT where
  sizeOf :: PhysicalDeviceBufferDeviceAddressFeaturesEXT -> Int
sizeOf ~PhysicalDeviceBufferDeviceAddressFeaturesEXT
_ = 32
  alignment :: PhysicalDeviceBufferDeviceAddressFeaturesEXT -> Int
alignment ~PhysicalDeviceBufferDeviceAddressFeaturesEXT
_ = 8
  peek :: Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
-> IO PhysicalDeviceBufferDeviceAddressFeaturesEXT
peek = Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
-> IO PhysicalDeviceBufferDeviceAddressFeaturesEXT
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
  poke :: Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
-> PhysicalDeviceBufferDeviceAddressFeaturesEXT -> IO ()
poke ptr :: Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
ptr poked :: PhysicalDeviceBufferDeviceAddressFeaturesEXT
poked = Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
-> PhysicalDeviceBufferDeviceAddressFeaturesEXT -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
ptr PhysicalDeviceBufferDeviceAddressFeaturesEXT
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())

instance Zero PhysicalDeviceBufferDeviceAddressFeaturesEXT where
  zero :: PhysicalDeviceBufferDeviceAddressFeaturesEXT
zero = Bool
-> Bool -> Bool -> PhysicalDeviceBufferDeviceAddressFeaturesEXT
PhysicalDeviceBufferDeviceAddressFeaturesEXT
           Bool
forall a. Zero a => a
zero
           Bool
forall a. Zero a => a
zero
           Bool
forall a. Zero a => a
zero


-- | VkBufferDeviceAddressCreateInfoEXT - Request a specific address for a
-- buffer
--
-- = Description
--
-- If @deviceAddress@ is zero, no specific address is requested.
--
-- If @deviceAddress@ is not zero, then it /must/ be an address retrieved
-- from an identically created buffer on the same implementation. The
-- buffer /must/ also be bound to an identically created
-- 'Vulkan.Core10.Handles.DeviceMemory' object.
--
-- If this structure is not present, it is as if @deviceAddress@ is zero.
--
-- Apps /should/ avoid creating buffers with app-provided addresses and
-- implementation-provided addresses in the same process, to reduce the
-- likelihood of 'ERROR_INVALID_DEVICE_ADDRESS_EXT' errors.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- 'Vulkan.Core10.BaseType.DeviceAddress',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data BufferDeviceAddressCreateInfoEXT = BufferDeviceAddressCreateInfoEXT
  { -- | @deviceAddress@ is the device address requested for the buffer.
    BufferDeviceAddressCreateInfoEXT -> DeviceAddress
deviceAddress :: DeviceAddress }
  deriving (Typeable, BufferDeviceAddressCreateInfoEXT
-> BufferDeviceAddressCreateInfoEXT -> Bool
(BufferDeviceAddressCreateInfoEXT
 -> BufferDeviceAddressCreateInfoEXT -> Bool)
-> (BufferDeviceAddressCreateInfoEXT
    -> BufferDeviceAddressCreateInfoEXT -> Bool)
-> Eq BufferDeviceAddressCreateInfoEXT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BufferDeviceAddressCreateInfoEXT
-> BufferDeviceAddressCreateInfoEXT -> Bool
$c/= :: BufferDeviceAddressCreateInfoEXT
-> BufferDeviceAddressCreateInfoEXT -> Bool
== :: BufferDeviceAddressCreateInfoEXT
-> BufferDeviceAddressCreateInfoEXT -> Bool
$c== :: BufferDeviceAddressCreateInfoEXT
-> BufferDeviceAddressCreateInfoEXT -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (BufferDeviceAddressCreateInfoEXT)
#endif
deriving instance Show BufferDeviceAddressCreateInfoEXT

instance ToCStruct BufferDeviceAddressCreateInfoEXT where
  withCStruct :: BufferDeviceAddressCreateInfoEXT
-> (Ptr BufferDeviceAddressCreateInfoEXT -> IO b) -> IO b
withCStruct x :: BufferDeviceAddressCreateInfoEXT
x f :: Ptr BufferDeviceAddressCreateInfoEXT -> IO b
f = Int
-> Int -> (Ptr BufferDeviceAddressCreateInfoEXT -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 24 8 ((Ptr BufferDeviceAddressCreateInfoEXT -> IO b) -> IO b)
-> (Ptr BufferDeviceAddressCreateInfoEXT -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr BufferDeviceAddressCreateInfoEXT
p -> Ptr BufferDeviceAddressCreateInfoEXT
-> BufferDeviceAddressCreateInfoEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr BufferDeviceAddressCreateInfoEXT
p BufferDeviceAddressCreateInfoEXT
x (Ptr BufferDeviceAddressCreateInfoEXT -> IO b
f Ptr BufferDeviceAddressCreateInfoEXT
p)
  pokeCStruct :: Ptr BufferDeviceAddressCreateInfoEXT
-> BufferDeviceAddressCreateInfoEXT -> IO b -> IO b
pokeCStruct p :: Ptr BufferDeviceAddressCreateInfoEXT
p BufferDeviceAddressCreateInfoEXT{..} f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr BufferDeviceAddressCreateInfoEXT
p Ptr BufferDeviceAddressCreateInfoEXT -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_CREATE_INFO_EXT)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr BufferDeviceAddressCreateInfoEXT
p Ptr BufferDeviceAddressCreateInfoEXT -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr DeviceAddress -> DeviceAddress -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr BufferDeviceAddressCreateInfoEXT
p Ptr BufferDeviceAddressCreateInfoEXT -> Int -> Ptr DeviceAddress
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr DeviceAddress)) (DeviceAddress
deviceAddress)
    IO b
f
  cStructSize :: Int
cStructSize = 24
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr BufferDeviceAddressCreateInfoEXT -> IO b -> IO b
pokeZeroCStruct p :: Ptr BufferDeviceAddressCreateInfoEXT
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr BufferDeviceAddressCreateInfoEXT
p Ptr BufferDeviceAddressCreateInfoEXT -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_CREATE_INFO_EXT)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr BufferDeviceAddressCreateInfoEXT
p Ptr BufferDeviceAddressCreateInfoEXT -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr DeviceAddress -> DeviceAddress -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr BufferDeviceAddressCreateInfoEXT
p Ptr BufferDeviceAddressCreateInfoEXT -> Int -> Ptr DeviceAddress
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr DeviceAddress)) (DeviceAddress
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct BufferDeviceAddressCreateInfoEXT where
  peekCStruct :: Ptr BufferDeviceAddressCreateInfoEXT
-> IO BufferDeviceAddressCreateInfoEXT
peekCStruct p :: Ptr BufferDeviceAddressCreateInfoEXT
p = do
    DeviceAddress
deviceAddress <- Ptr DeviceAddress -> IO DeviceAddress
forall a. Storable a => Ptr a -> IO a
peek @DeviceAddress ((Ptr BufferDeviceAddressCreateInfoEXT
p Ptr BufferDeviceAddressCreateInfoEXT -> Int -> Ptr DeviceAddress
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr DeviceAddress))
    BufferDeviceAddressCreateInfoEXT
-> IO BufferDeviceAddressCreateInfoEXT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BufferDeviceAddressCreateInfoEXT
 -> IO BufferDeviceAddressCreateInfoEXT)
-> BufferDeviceAddressCreateInfoEXT
-> IO BufferDeviceAddressCreateInfoEXT
forall a b. (a -> b) -> a -> b
$ DeviceAddress -> BufferDeviceAddressCreateInfoEXT
BufferDeviceAddressCreateInfoEXT
             DeviceAddress
deviceAddress

instance Storable BufferDeviceAddressCreateInfoEXT where
  sizeOf :: BufferDeviceAddressCreateInfoEXT -> Int
sizeOf ~BufferDeviceAddressCreateInfoEXT
_ = 24
  alignment :: BufferDeviceAddressCreateInfoEXT -> Int
alignment ~BufferDeviceAddressCreateInfoEXT
_ = 8
  peek :: Ptr BufferDeviceAddressCreateInfoEXT
-> IO BufferDeviceAddressCreateInfoEXT
peek = Ptr BufferDeviceAddressCreateInfoEXT
-> IO BufferDeviceAddressCreateInfoEXT
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
  poke :: Ptr BufferDeviceAddressCreateInfoEXT
-> BufferDeviceAddressCreateInfoEXT -> IO ()
poke ptr :: Ptr BufferDeviceAddressCreateInfoEXT
ptr poked :: BufferDeviceAddressCreateInfoEXT
poked = Ptr BufferDeviceAddressCreateInfoEXT
-> BufferDeviceAddressCreateInfoEXT -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr BufferDeviceAddressCreateInfoEXT
ptr BufferDeviceAddressCreateInfoEXT
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())

instance Zero BufferDeviceAddressCreateInfoEXT where
  zero :: BufferDeviceAddressCreateInfoEXT
zero = DeviceAddress -> BufferDeviceAddressCreateInfoEXT
BufferDeviceAddressCreateInfoEXT
           DeviceAddress
forall a. Zero a => a
zero


-- No documentation found for TopLevel "VkPhysicalDeviceBufferAddressFeaturesEXT"
type PhysicalDeviceBufferAddressFeaturesEXT = PhysicalDeviceBufferDeviceAddressFeaturesEXT


-- No documentation found for TopLevel "VkBufferDeviceAddressInfoEXT"
type BufferDeviceAddressInfoEXT = BufferDeviceAddressInfo


type EXT_BUFFER_DEVICE_ADDRESS_SPEC_VERSION = 2

-- No documentation found for TopLevel "VK_EXT_BUFFER_DEVICE_ADDRESS_SPEC_VERSION"
pattern EXT_BUFFER_DEVICE_ADDRESS_SPEC_VERSION :: forall a . Integral a => a
pattern $bEXT_BUFFER_DEVICE_ADDRESS_SPEC_VERSION :: a
$mEXT_BUFFER_DEVICE_ADDRESS_SPEC_VERSION :: forall r a. Integral a => a -> (Void# -> r) -> (Void# -> r) -> r
EXT_BUFFER_DEVICE_ADDRESS_SPEC_VERSION = 2


type EXT_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME = "VK_EXT_buffer_device_address"

-- No documentation found for TopLevel "VK_EXT_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME"
pattern EXT_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bEXT_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME :: a
$mEXT_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME :: forall r a.
(Eq a, IsString a) =>
a -> (Void# -> r) -> (Void# -> r) -> r
EXT_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME = "VK_EXT_buffer_device_address"