{-# language CPP #-}
module Graphics.Vulkan.Core12.Promoted_From_VK_KHR_buffer_device_address ( getBufferOpaqueCaptureAddress
, getBufferDeviceAddress
, getDeviceMemoryOpaqueCaptureAddress
, PhysicalDeviceBufferDeviceAddressFeatures(..)
, BufferDeviceAddressInfo(..)
, BufferOpaqueCaptureAddressCreateInfo(..)
, MemoryOpaqueCaptureAddressAllocateInfo(..)
, DeviceMemoryOpaqueCaptureAddressInfo(..)
, StructureType(..)
, Result(..)
, BufferUsageFlagBits(..)
, BufferUsageFlags
, BufferCreateFlagBits(..)
, BufferCreateFlags
, MemoryAllocateFlagBits(..)
, MemoryAllocateFlags
) where
import Control.Monad.IO.Class (liftIO)
import Foreign.Marshal.Alloc (allocaBytesAligned)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Cont (evalContT)
import Control.Monad.IO.Class (MonadIO)
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 (FunPtr)
import Foreign.Ptr (Ptr)
import Data.Word (Word64)
import Data.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Graphics.Vulkan.Core10.BaseType (bool32ToBool)
import Graphics.Vulkan.Core10.BaseType (boolToBool32)
import Graphics.Vulkan.Core10.BaseType (Bool32)
import Graphics.Vulkan.Core10.Handles (Buffer)
import Graphics.Vulkan.Core10.Handles (Device)
import Graphics.Vulkan.Core10.Handles (Device(..))
import Graphics.Vulkan.Core10.BaseType (DeviceAddress)
import Graphics.Vulkan.Dynamic (DeviceCmds(pVkGetBufferDeviceAddress))
import Graphics.Vulkan.Dynamic (DeviceCmds(pVkGetBufferOpaqueCaptureAddress))
import Graphics.Vulkan.Dynamic (DeviceCmds(pVkGetDeviceMemoryOpaqueCaptureAddress))
import Graphics.Vulkan.Core10.Handles (DeviceMemory)
import Graphics.Vulkan.Core10.Handles (Device_T)
import Graphics.Vulkan.CStruct (FromCStruct)
import Graphics.Vulkan.CStruct (FromCStruct(..))
import Graphics.Vulkan.Core10.Enums.StructureType (StructureType)
import Graphics.Vulkan.CStruct (ToCStruct)
import Graphics.Vulkan.CStruct (ToCStruct(..))
import Graphics.Vulkan.Zero (Zero(..))
import Graphics.Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO))
import Graphics.Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_BUFFER_OPAQUE_CAPTURE_ADDRESS_CREATE_INFO))
import Graphics.Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_DEVICE_MEMORY_OPAQUE_CAPTURE_ADDRESS_INFO))
import Graphics.Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_MEMORY_OPAQUE_CAPTURE_ADDRESS_ALLOCATE_INFO))
import Graphics.Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES))
import Graphics.Vulkan.Core10.Enums.BufferCreateFlagBits (BufferCreateFlagBits(..))
import Graphics.Vulkan.Core10.Enums.BufferCreateFlagBits (BufferCreateFlags)
import Graphics.Vulkan.Core10.Enums.BufferUsageFlagBits (BufferUsageFlagBits(..))
import Graphics.Vulkan.Core10.Enums.BufferUsageFlagBits (BufferUsageFlags)
import Graphics.Vulkan.Core11.Enums.MemoryAllocateFlagBits (MemoryAllocateFlagBits(..))
import Graphics.Vulkan.Core11.Enums.MemoryAllocateFlagBits (MemoryAllocateFlags)
import Graphics.Vulkan.Core10.Enums.Result (Result(..))
import Graphics.Vulkan.Core10.Enums.StructureType (StructureType(..))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkGetBufferOpaqueCaptureAddress
:: FunPtr (Ptr Device_T -> Ptr BufferDeviceAddressInfo -> IO Word64) -> Ptr Device_T -> Ptr BufferDeviceAddressInfo -> IO Word64
getBufferOpaqueCaptureAddress :: forall io . MonadIO io => Device -> BufferDeviceAddressInfo -> io (Word64)
getBufferOpaqueCaptureAddress device info = liftIO . evalContT $ do
let vkGetBufferOpaqueCaptureAddress' = mkVkGetBufferOpaqueCaptureAddress (pVkGetBufferOpaqueCaptureAddress (deviceCmds (device :: Device)))
pInfo <- ContT $ withCStruct (info)
r <- lift $ vkGetBufferOpaqueCaptureAddress' (deviceHandle (device)) pInfo
pure $ (r)
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkGetBufferDeviceAddress
:: FunPtr (Ptr Device_T -> Ptr BufferDeviceAddressInfo -> IO DeviceAddress) -> Ptr Device_T -> Ptr BufferDeviceAddressInfo -> IO DeviceAddress
getBufferDeviceAddress :: forall io . MonadIO io => Device -> BufferDeviceAddressInfo -> io (DeviceAddress)
getBufferDeviceAddress device info = liftIO . evalContT $ do
let vkGetBufferDeviceAddress' = mkVkGetBufferDeviceAddress (pVkGetBufferDeviceAddress (deviceCmds (device :: Device)))
pInfo <- ContT $ withCStruct (info)
r <- lift $ vkGetBufferDeviceAddress' (deviceHandle (device)) pInfo
pure $ (r)
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkGetDeviceMemoryOpaqueCaptureAddress
:: FunPtr (Ptr Device_T -> Ptr DeviceMemoryOpaqueCaptureAddressInfo -> IO Word64) -> Ptr Device_T -> Ptr DeviceMemoryOpaqueCaptureAddressInfo -> IO Word64
getDeviceMemoryOpaqueCaptureAddress :: forall io . MonadIO io => Device -> DeviceMemoryOpaqueCaptureAddressInfo -> io (Word64)
getDeviceMemoryOpaqueCaptureAddress device info = liftIO . evalContT $ do
let vkGetDeviceMemoryOpaqueCaptureAddress' = mkVkGetDeviceMemoryOpaqueCaptureAddress (pVkGetDeviceMemoryOpaqueCaptureAddress (deviceCmds (device :: Device)))
pInfo <- ContT $ withCStruct (info)
r <- lift $ vkGetDeviceMemoryOpaqueCaptureAddress' (deviceHandle (device)) pInfo
pure $ (r)
data PhysicalDeviceBufferDeviceAddressFeatures = PhysicalDeviceBufferDeviceAddressFeatures
{
bufferDeviceAddress :: Bool
,
bufferDeviceAddressCaptureReplay :: Bool
,
bufferDeviceAddressMultiDevice :: Bool
}
deriving (Typeable)
deriving instance Show PhysicalDeviceBufferDeviceAddressFeatures
instance ToCStruct PhysicalDeviceBufferDeviceAddressFeatures where
withCStruct x f = allocaBytesAligned 32 8 $ \p -> pokeCStruct p x (f p)
pokeCStruct p PhysicalDeviceBufferDeviceAddressFeatures{..} f = do
poke ((p `plusPtr` 0 :: Ptr StructureType)) (STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES)
poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) (nullPtr)
poke ((p `plusPtr` 16 :: Ptr Bool32)) (boolToBool32 (bufferDeviceAddress))
poke ((p `plusPtr` 20 :: Ptr Bool32)) (boolToBool32 (bufferDeviceAddressCaptureReplay))
poke ((p `plusPtr` 24 :: Ptr Bool32)) (boolToBool32 (bufferDeviceAddressMultiDevice))
f
cStructSize = 32
cStructAlignment = 8
pokeZeroCStruct p f = do
poke ((p `plusPtr` 0 :: Ptr StructureType)) (STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES)
poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) (nullPtr)
poke ((p `plusPtr` 16 :: Ptr Bool32)) (boolToBool32 (zero))
poke ((p `plusPtr` 20 :: Ptr Bool32)) (boolToBool32 (zero))
poke ((p `plusPtr` 24 :: Ptr Bool32)) (boolToBool32 (zero))
f
instance FromCStruct PhysicalDeviceBufferDeviceAddressFeatures where
peekCStruct p = do
bufferDeviceAddress <- peek @Bool32 ((p `plusPtr` 16 :: Ptr Bool32))
bufferDeviceAddressCaptureReplay <- peek @Bool32 ((p `plusPtr` 20 :: Ptr Bool32))
bufferDeviceAddressMultiDevice <- peek @Bool32 ((p `plusPtr` 24 :: Ptr Bool32))
pure $ PhysicalDeviceBufferDeviceAddressFeatures
(bool32ToBool bufferDeviceAddress) (bool32ToBool bufferDeviceAddressCaptureReplay) (bool32ToBool bufferDeviceAddressMultiDevice)
instance Storable PhysicalDeviceBufferDeviceAddressFeatures where
sizeOf ~_ = 32
alignment ~_ = 8
peek = peekCStruct
poke ptr poked = pokeCStruct ptr poked (pure ())
instance Zero PhysicalDeviceBufferDeviceAddressFeatures where
zero = PhysicalDeviceBufferDeviceAddressFeatures
zero
zero
zero
data BufferDeviceAddressInfo = BufferDeviceAddressInfo
{
buffer :: Buffer }
deriving (Typeable)
deriving instance Show BufferDeviceAddressInfo
instance ToCStruct BufferDeviceAddressInfo where
withCStruct x f = allocaBytesAligned 24 8 $ \p -> pokeCStruct p x (f p)
pokeCStruct p BufferDeviceAddressInfo{..} f = do
poke ((p `plusPtr` 0 :: Ptr StructureType)) (STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO)
poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) (nullPtr)
poke ((p `plusPtr` 16 :: Ptr Buffer)) (buffer)
f
cStructSize = 24
cStructAlignment = 8
pokeZeroCStruct p f = do
poke ((p `plusPtr` 0 :: Ptr StructureType)) (STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO)
poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) (nullPtr)
poke ((p `plusPtr` 16 :: Ptr Buffer)) (zero)
f
instance FromCStruct BufferDeviceAddressInfo where
peekCStruct p = do
buffer <- peek @Buffer ((p `plusPtr` 16 :: Ptr Buffer))
pure $ BufferDeviceAddressInfo
buffer
instance Storable BufferDeviceAddressInfo where
sizeOf ~_ = 24
alignment ~_ = 8
peek = peekCStruct
poke ptr poked = pokeCStruct ptr poked (pure ())
instance Zero BufferDeviceAddressInfo where
zero = BufferDeviceAddressInfo
zero
data BufferOpaqueCaptureAddressCreateInfo = BufferOpaqueCaptureAddressCreateInfo
{
opaqueCaptureAddress :: Word64 }
deriving (Typeable)
deriving instance Show BufferOpaqueCaptureAddressCreateInfo
instance ToCStruct BufferOpaqueCaptureAddressCreateInfo where
withCStruct x f = allocaBytesAligned 24 8 $ \p -> pokeCStruct p x (f p)
pokeCStruct p BufferOpaqueCaptureAddressCreateInfo{..} f = do
poke ((p `plusPtr` 0 :: Ptr StructureType)) (STRUCTURE_TYPE_BUFFER_OPAQUE_CAPTURE_ADDRESS_CREATE_INFO)
poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) (nullPtr)
poke ((p `plusPtr` 16 :: Ptr Word64)) (opaqueCaptureAddress)
f
cStructSize = 24
cStructAlignment = 8
pokeZeroCStruct p f = do
poke ((p `plusPtr` 0 :: Ptr StructureType)) (STRUCTURE_TYPE_BUFFER_OPAQUE_CAPTURE_ADDRESS_CREATE_INFO)
poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) (nullPtr)
poke ((p `plusPtr` 16 :: Ptr Word64)) (zero)
f
instance FromCStruct BufferOpaqueCaptureAddressCreateInfo where
peekCStruct p = do
opaqueCaptureAddress <- peek @Word64 ((p `plusPtr` 16 :: Ptr Word64))
pure $ BufferOpaqueCaptureAddressCreateInfo
opaqueCaptureAddress
instance Storable BufferOpaqueCaptureAddressCreateInfo where
sizeOf ~_ = 24
alignment ~_ = 8
peek = peekCStruct
poke ptr poked = pokeCStruct ptr poked (pure ())
instance Zero BufferOpaqueCaptureAddressCreateInfo where
zero = BufferOpaqueCaptureAddressCreateInfo
zero
data MemoryOpaqueCaptureAddressAllocateInfo = MemoryOpaqueCaptureAddressAllocateInfo
{
opaqueCaptureAddress :: Word64 }
deriving (Typeable)
deriving instance Show MemoryOpaqueCaptureAddressAllocateInfo
instance ToCStruct MemoryOpaqueCaptureAddressAllocateInfo where
withCStruct x f = allocaBytesAligned 24 8 $ \p -> pokeCStruct p x (f p)
pokeCStruct p MemoryOpaqueCaptureAddressAllocateInfo{..} f = do
poke ((p `plusPtr` 0 :: Ptr StructureType)) (STRUCTURE_TYPE_MEMORY_OPAQUE_CAPTURE_ADDRESS_ALLOCATE_INFO)
poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) (nullPtr)
poke ((p `plusPtr` 16 :: Ptr Word64)) (opaqueCaptureAddress)
f
cStructSize = 24
cStructAlignment = 8
pokeZeroCStruct p f = do
poke ((p `plusPtr` 0 :: Ptr StructureType)) (STRUCTURE_TYPE_MEMORY_OPAQUE_CAPTURE_ADDRESS_ALLOCATE_INFO)
poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) (nullPtr)
poke ((p `plusPtr` 16 :: Ptr Word64)) (zero)
f
instance FromCStruct MemoryOpaqueCaptureAddressAllocateInfo where
peekCStruct p = do
opaqueCaptureAddress <- peek @Word64 ((p `plusPtr` 16 :: Ptr Word64))
pure $ MemoryOpaqueCaptureAddressAllocateInfo
opaqueCaptureAddress
instance Storable MemoryOpaqueCaptureAddressAllocateInfo where
sizeOf ~_ = 24
alignment ~_ = 8
peek = peekCStruct
poke ptr poked = pokeCStruct ptr poked (pure ())
instance Zero MemoryOpaqueCaptureAddressAllocateInfo where
zero = MemoryOpaqueCaptureAddressAllocateInfo
zero
data DeviceMemoryOpaqueCaptureAddressInfo = DeviceMemoryOpaqueCaptureAddressInfo
{
memory :: DeviceMemory }
deriving (Typeable)
deriving instance Show DeviceMemoryOpaqueCaptureAddressInfo
instance ToCStruct DeviceMemoryOpaqueCaptureAddressInfo where
withCStruct x f = allocaBytesAligned 24 8 $ \p -> pokeCStruct p x (f p)
pokeCStruct p DeviceMemoryOpaqueCaptureAddressInfo{..} f = do
poke ((p `plusPtr` 0 :: Ptr StructureType)) (STRUCTURE_TYPE_DEVICE_MEMORY_OPAQUE_CAPTURE_ADDRESS_INFO)
poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) (nullPtr)
poke ((p `plusPtr` 16 :: Ptr DeviceMemory)) (memory)
f
cStructSize = 24
cStructAlignment = 8
pokeZeroCStruct p f = do
poke ((p `plusPtr` 0 :: Ptr StructureType)) (STRUCTURE_TYPE_DEVICE_MEMORY_OPAQUE_CAPTURE_ADDRESS_INFO)
poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) (nullPtr)
poke ((p `plusPtr` 16 :: Ptr DeviceMemory)) (zero)
f
instance FromCStruct DeviceMemoryOpaqueCaptureAddressInfo where
peekCStruct p = do
memory <- peek @DeviceMemory ((p `plusPtr` 16 :: Ptr DeviceMemory))
pure $ DeviceMemoryOpaqueCaptureAddressInfo
memory
instance Storable DeviceMemoryOpaqueCaptureAddressInfo where
sizeOf ~_ = 24
alignment ~_ = 8
peek = peekCStruct
poke ptr poked = pokeCStruct ptr poked (pure ())
instance Zero DeviceMemoryOpaqueCaptureAddressInfo where
zero = DeviceMemoryOpaqueCaptureAddressInfo
zero