{-# language CPP #-}
module Graphics.Vulkan.Core11.Promoted_From_VK_KHR_external_fence_capabilities ( getPhysicalDeviceExternalFenceProperties
, PhysicalDeviceExternalFenceInfo(..)
, ExternalFenceProperties(..)
, StructureType(..)
, ExternalFenceHandleTypeFlagBits(..)
, ExternalFenceHandleTypeFlags
, ExternalFenceFeatureFlagBits(..)
, ExternalFenceFeatureFlags
) 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.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Graphics.Vulkan.Core11.Enums.ExternalFenceFeatureFlagBits (ExternalFenceFeatureFlags)
import Graphics.Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits (ExternalFenceHandleTypeFlagBits)
import Graphics.Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits (ExternalFenceHandleTypeFlags)
import Graphics.Vulkan.CStruct (FromCStruct)
import Graphics.Vulkan.CStruct (FromCStruct(..))
import Graphics.Vulkan.Dynamic (InstanceCmds(pVkGetPhysicalDeviceExternalFenceProperties))
import Graphics.Vulkan.Core10.Handles (PhysicalDevice)
import Graphics.Vulkan.Core10.Handles (PhysicalDevice(..))
import Graphics.Vulkan.Core10.Handles (PhysicalDevice_T)
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_EXTERNAL_FENCE_PROPERTIES))
import Graphics.Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO))
import Graphics.Vulkan.Core11.Enums.ExternalFenceFeatureFlagBits (ExternalFenceFeatureFlagBits(..))
import Graphics.Vulkan.Core11.Enums.ExternalFenceFeatureFlagBits (ExternalFenceFeatureFlags)
import Graphics.Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits (ExternalFenceHandleTypeFlagBits(..))
import Graphics.Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits (ExternalFenceHandleTypeFlags)
import Graphics.Vulkan.Core10.Enums.StructureType (StructureType(..))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkGetPhysicalDeviceExternalFenceProperties
:: FunPtr (Ptr PhysicalDevice_T -> Ptr PhysicalDeviceExternalFenceInfo -> Ptr ExternalFenceProperties -> IO ()) -> Ptr PhysicalDevice_T -> Ptr PhysicalDeviceExternalFenceInfo -> Ptr ExternalFenceProperties -> IO ()
getPhysicalDeviceExternalFenceProperties :: forall io . MonadIO io => PhysicalDevice -> PhysicalDeviceExternalFenceInfo -> io (ExternalFenceProperties)
getPhysicalDeviceExternalFenceProperties physicalDevice externalFenceInfo = liftIO . evalContT $ do
let vkGetPhysicalDeviceExternalFenceProperties' = mkVkGetPhysicalDeviceExternalFenceProperties (pVkGetPhysicalDeviceExternalFenceProperties (instanceCmds (physicalDevice :: PhysicalDevice)))
pExternalFenceInfo <- ContT $ withCStruct (externalFenceInfo)
pPExternalFenceProperties <- ContT (withZeroCStruct @ExternalFenceProperties)
lift $ vkGetPhysicalDeviceExternalFenceProperties' (physicalDeviceHandle (physicalDevice)) pExternalFenceInfo (pPExternalFenceProperties)
pExternalFenceProperties <- lift $ peekCStruct @ExternalFenceProperties pPExternalFenceProperties
pure $ (pExternalFenceProperties)
data PhysicalDeviceExternalFenceInfo = PhysicalDeviceExternalFenceInfo
{
handleType :: ExternalFenceHandleTypeFlagBits }
deriving (Typeable)
deriving instance Show PhysicalDeviceExternalFenceInfo
instance ToCStruct PhysicalDeviceExternalFenceInfo where
withCStruct x f = allocaBytesAligned 24 8 $ \p -> pokeCStruct p x (f p)
pokeCStruct p PhysicalDeviceExternalFenceInfo{..} f = do
poke ((p `plusPtr` 0 :: Ptr StructureType)) (STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO)
poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) (nullPtr)
poke ((p `plusPtr` 16 :: Ptr ExternalFenceHandleTypeFlagBits)) (handleType)
f
cStructSize = 24
cStructAlignment = 8
pokeZeroCStruct p f = do
poke ((p `plusPtr` 0 :: Ptr StructureType)) (STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO)
poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) (nullPtr)
poke ((p `plusPtr` 16 :: Ptr ExternalFenceHandleTypeFlagBits)) (zero)
f
instance FromCStruct PhysicalDeviceExternalFenceInfo where
peekCStruct p = do
handleType <- peek @ExternalFenceHandleTypeFlagBits ((p `plusPtr` 16 :: Ptr ExternalFenceHandleTypeFlagBits))
pure $ PhysicalDeviceExternalFenceInfo
handleType
instance Storable PhysicalDeviceExternalFenceInfo where
sizeOf ~_ = 24
alignment ~_ = 8
peek = peekCStruct
poke ptr poked = pokeCStruct ptr poked (pure ())
instance Zero PhysicalDeviceExternalFenceInfo where
zero = PhysicalDeviceExternalFenceInfo
zero
data ExternalFenceProperties = ExternalFenceProperties
{
exportFromImportedHandleTypes :: ExternalFenceHandleTypeFlags
,
compatibleHandleTypes :: ExternalFenceHandleTypeFlags
,
externalFenceFeatures :: ExternalFenceFeatureFlags
}
deriving (Typeable)
deriving instance Show ExternalFenceProperties
instance ToCStruct ExternalFenceProperties where
withCStruct x f = allocaBytesAligned 32 8 $ \p -> pokeCStruct p x (f p)
pokeCStruct p ExternalFenceProperties{..} f = do
poke ((p `plusPtr` 0 :: Ptr StructureType)) (STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES)
poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) (nullPtr)
poke ((p `plusPtr` 16 :: Ptr ExternalFenceHandleTypeFlags)) (exportFromImportedHandleTypes)
poke ((p `plusPtr` 20 :: Ptr ExternalFenceHandleTypeFlags)) (compatibleHandleTypes)
poke ((p `plusPtr` 24 :: Ptr ExternalFenceFeatureFlags)) (externalFenceFeatures)
f
cStructSize = 32
cStructAlignment = 8
pokeZeroCStruct p f = do
poke ((p `plusPtr` 0 :: Ptr StructureType)) (STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES)
poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) (nullPtr)
poke ((p `plusPtr` 16 :: Ptr ExternalFenceHandleTypeFlags)) (zero)
poke ((p `plusPtr` 20 :: Ptr ExternalFenceHandleTypeFlags)) (zero)
f
instance FromCStruct ExternalFenceProperties where
peekCStruct p = do
exportFromImportedHandleTypes <- peek @ExternalFenceHandleTypeFlags ((p `plusPtr` 16 :: Ptr ExternalFenceHandleTypeFlags))
compatibleHandleTypes <- peek @ExternalFenceHandleTypeFlags ((p `plusPtr` 20 :: Ptr ExternalFenceHandleTypeFlags))
externalFenceFeatures <- peek @ExternalFenceFeatureFlags ((p `plusPtr` 24 :: Ptr ExternalFenceFeatureFlags))
pure $ ExternalFenceProperties
exportFromImportedHandleTypes compatibleHandleTypes externalFenceFeatures
instance Storable ExternalFenceProperties where
sizeOf ~_ = 32
alignment ~_ = 8
peek = peekCStruct
poke ptr poked = pokeCStruct ptr poked (pure ())
instance Zero ExternalFenceProperties where
zero = ExternalFenceProperties
zero
zero
zero