{-# language CPP #-}
module Vulkan.Extensions.VK_EXT_calibrated_timestamps ( getPhysicalDeviceCalibrateableTimeDomainsEXT
, getCalibratedTimestampsEXT
, CalibratedTimestampInfoEXT(..)
, TimeDomainEXT( TIME_DOMAIN_DEVICE_EXT
, TIME_DOMAIN_CLOCK_MONOTONIC_EXT
, TIME_DOMAIN_CLOCK_MONOTONIC_RAW_EXT
, TIME_DOMAIN_QUERY_PERFORMANCE_COUNTER_EXT
, ..
)
, EXT_CALIBRATED_TIMESTAMPS_SPEC_VERSION
, pattern EXT_CALIBRATED_TIMESTAMPS_SPEC_VERSION
, EXT_CALIBRATED_TIMESTAMPS_EXTENSION_NAME
, pattern EXT_CALIBRATED_TIMESTAMPS_EXTENSION_NAME
) where
import Vulkan.Internal.Utils (enumReadPrec)
import Vulkan.Internal.Utils (enumShowsPrec)
import Vulkan.Internal.Utils (traceAroundEvent)
import Control.Exception.Base (bracket)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Foreign.Marshal.Alloc (allocaBytesAligned)
import Foreign.Marshal.Alloc (callocBytes)
import Foreign.Marshal.Alloc (free)
import GHC.Base (when)
import GHC.IO (throwIO)
import GHC.Ptr (nullFunPtr)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import GHC.Show (showsPrec)
import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Cont (evalContT)
import Data.Vector (generateM)
import qualified Data.Vector (imapM_)
import qualified Data.Vector (length)
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Zero (Zero)
import Vulkan.Zero (Zero(..))
import Control.Monad.IO.Class (MonadIO)
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 GHC.IO.Exception (IOErrorType(..))
import GHC.IO.Exception (IOException(..))
import Data.Int (Int32)
import Foreign.Ptr (FunPtr)
import Foreign.Ptr (Ptr)
import GHC.Read (Read(readPrec))
import GHC.Show (Show(showsPrec))
import Data.Word (Word32)
import Data.Word (Word64)
import Data.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Data.Vector (Vector)
import Vulkan.CStruct.Utils (advancePtrBytes)
import Vulkan.NamedType ((:::))
import Vulkan.Core10.Handles (Device)
import Vulkan.Core10.Handles (Device(..))
import Vulkan.Dynamic (DeviceCmds(pVkGetCalibratedTimestampsEXT))
import Vulkan.Core10.Handles (Device_T)
import Vulkan.Dynamic (InstanceCmds(pVkGetPhysicalDeviceCalibrateableTimeDomainsEXT))
import Vulkan.Core10.Handles (PhysicalDevice)
import Vulkan.Core10.Handles (PhysicalDevice(..))
import Vulkan.Core10.Handles (PhysicalDevice_T)
import Vulkan.Core10.Enums.Result (Result)
import Vulkan.Core10.Enums.Result (Result(..))
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Exception (VulkanException(..))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_CALIBRATED_TIMESTAMP_INFO_EXT))
import Vulkan.Core10.Enums.Result (Result(SUCCESS))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkGetPhysicalDeviceCalibrateableTimeDomainsEXT
:: FunPtr (Ptr PhysicalDevice_T -> Ptr Word32 -> Ptr TimeDomainEXT -> IO Result) -> Ptr PhysicalDevice_T -> Ptr Word32 -> Ptr TimeDomainEXT -> IO Result
getPhysicalDeviceCalibrateableTimeDomainsEXT :: forall io
. (MonadIO io)
=>
PhysicalDevice
-> io (Result, ("timeDomains" ::: Vector TimeDomainEXT))
getPhysicalDeviceCalibrateableTimeDomainsEXT :: PhysicalDevice
-> io (Result, "timeDomains" ::: Vector TimeDomainEXT)
getPhysicalDeviceCalibrateableTimeDomainsEXT physicalDevice :: PhysicalDevice
physicalDevice = IO (Result, "timeDomains" ::: Vector TimeDomainEXT)
-> io (Result, "timeDomains" ::: Vector TimeDomainEXT)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Result, "timeDomains" ::: Vector TimeDomainEXT)
-> io (Result, "timeDomains" ::: Vector TimeDomainEXT))
-> (ContT
(Result, "timeDomains" ::: Vector TimeDomainEXT)
IO
(Result, "timeDomains" ::: Vector TimeDomainEXT)
-> IO (Result, "timeDomains" ::: Vector TimeDomainEXT))
-> ContT
(Result, "timeDomains" ::: Vector TimeDomainEXT)
IO
(Result, "timeDomains" ::: Vector TimeDomainEXT)
-> io (Result, "timeDomains" ::: Vector TimeDomainEXT)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT
(Result, "timeDomains" ::: Vector TimeDomainEXT)
IO
(Result, "timeDomains" ::: Vector TimeDomainEXT)
-> IO (Result, "timeDomains" ::: Vector TimeDomainEXT)
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT
(Result, "timeDomains" ::: Vector TimeDomainEXT)
IO
(Result, "timeDomains" ::: Vector TimeDomainEXT)
-> io (Result, "timeDomains" ::: Vector TimeDomainEXT))
-> ContT
(Result, "timeDomains" ::: Vector TimeDomainEXT)
IO
(Result, "timeDomains" ::: Vector TimeDomainEXT)
-> io (Result, "timeDomains" ::: Vector TimeDomainEXT)
forall a b. (a -> b) -> a -> b
$ do
let vkGetPhysicalDeviceCalibrateableTimeDomainsEXTPtr :: FunPtr
(Ptr PhysicalDevice_T
-> ("pTimeDomainCount" ::: Ptr Word32)
-> ("pTimeDomains" ::: Ptr TimeDomainEXT)
-> IO Result)
vkGetPhysicalDeviceCalibrateableTimeDomainsEXTPtr = InstanceCmds
-> FunPtr
(Ptr PhysicalDevice_T
-> ("pTimeDomainCount" ::: Ptr Word32)
-> ("pTimeDomains" ::: Ptr TimeDomainEXT)
-> IO Result)
pVkGetPhysicalDeviceCalibrateableTimeDomainsEXT (PhysicalDevice -> InstanceCmds
instanceCmds (PhysicalDevice
physicalDevice :: PhysicalDevice))
IO ()
-> ContT (Result, "timeDomains" ::: Vector TimeDomainEXT) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ()
-> ContT (Result, "timeDomains" ::: Vector TimeDomainEXT) IO ())
-> IO ()
-> ContT (Result, "timeDomains" ::: Vector TimeDomainEXT) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
(Ptr PhysicalDevice_T
-> ("pTimeDomainCount" ::: Ptr Word32)
-> ("pTimeDomains" ::: Ptr TimeDomainEXT)
-> IO Result)
vkGetPhysicalDeviceCalibrateableTimeDomainsEXTPtr FunPtr
(Ptr PhysicalDevice_T
-> ("pTimeDomainCount" ::: Ptr Word32)
-> ("pTimeDomains" ::: Ptr TimeDomainEXT)
-> IO Result)
-> FunPtr
(Ptr PhysicalDevice_T
-> ("pTimeDomainCount" ::: Ptr Word32)
-> ("pTimeDomains" ::: Ptr TimeDomainEXT)
-> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
(Ptr PhysicalDevice_T
-> ("pTimeDomainCount" ::: Ptr Word32)
-> ("pTimeDomains" ::: Ptr TimeDomainEXT)
-> IO Result)
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
IOException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument "" "The function pointer for vkGetPhysicalDeviceCalibrateableTimeDomainsEXT is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
let vkGetPhysicalDeviceCalibrateableTimeDomainsEXT' :: Ptr PhysicalDevice_T
-> ("pTimeDomainCount" ::: Ptr Word32)
-> ("pTimeDomains" ::: Ptr TimeDomainEXT)
-> IO Result
vkGetPhysicalDeviceCalibrateableTimeDomainsEXT' = FunPtr
(Ptr PhysicalDevice_T
-> ("pTimeDomainCount" ::: Ptr Word32)
-> ("pTimeDomains" ::: Ptr TimeDomainEXT)
-> IO Result)
-> Ptr PhysicalDevice_T
-> ("pTimeDomainCount" ::: Ptr Word32)
-> ("pTimeDomains" ::: Ptr TimeDomainEXT)
-> IO Result
mkVkGetPhysicalDeviceCalibrateableTimeDomainsEXT FunPtr
(Ptr PhysicalDevice_T
-> ("pTimeDomainCount" ::: Ptr Word32)
-> ("pTimeDomains" ::: Ptr TimeDomainEXT)
-> IO Result)
vkGetPhysicalDeviceCalibrateableTimeDomainsEXTPtr
let physicalDevice' :: Ptr PhysicalDevice_T
physicalDevice' = PhysicalDevice -> Ptr PhysicalDevice_T
physicalDeviceHandle (PhysicalDevice
physicalDevice)
"pTimeDomainCount" ::: Ptr Word32
pPTimeDomainCount <- ((("pTimeDomainCount" ::: Ptr Word32)
-> IO (Result, "timeDomains" ::: Vector TimeDomainEXT))
-> IO (Result, "timeDomains" ::: Vector TimeDomainEXT))
-> ContT
(Result, "timeDomains" ::: Vector TimeDomainEXT)
IO
("pTimeDomainCount" ::: Ptr Word32)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pTimeDomainCount" ::: Ptr Word32)
-> IO (Result, "timeDomains" ::: Vector TimeDomainEXT))
-> IO (Result, "timeDomains" ::: Vector TimeDomainEXT))
-> ContT
(Result, "timeDomains" ::: Vector TimeDomainEXT)
IO
("pTimeDomainCount" ::: Ptr Word32))
-> ((("pTimeDomainCount" ::: Ptr Word32)
-> IO (Result, "timeDomains" ::: Vector TimeDomainEXT))
-> IO (Result, "timeDomains" ::: Vector TimeDomainEXT))
-> ContT
(Result, "timeDomains" ::: Vector TimeDomainEXT)
IO
("pTimeDomainCount" ::: Ptr Word32)
forall a b. (a -> b) -> a -> b
$ IO ("pTimeDomainCount" ::: Ptr Word32)
-> (("pTimeDomainCount" ::: Ptr Word32) -> IO ())
-> (("pTimeDomainCount" ::: Ptr Word32)
-> IO (Result, "timeDomains" ::: Vector TimeDomainEXT))
-> IO (Result, "timeDomains" ::: Vector TimeDomainEXT)
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int -> IO ("pTimeDomainCount" ::: Ptr Word32)
forall a. Int -> IO (Ptr a)
callocBytes @Word32 4) ("pTimeDomainCount" ::: Ptr Word32) -> IO ()
forall a. Ptr a -> IO ()
free
Result
r <- IO Result
-> ContT (Result, "timeDomains" ::: Vector TimeDomainEXT) IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result
-> ContT
(Result, "timeDomains" ::: Vector TimeDomainEXT) IO Result)
-> IO Result
-> ContT (Result, "timeDomains" ::: Vector TimeDomainEXT) IO Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "vkGetPhysicalDeviceCalibrateableTimeDomainsEXT" (Ptr PhysicalDevice_T
-> ("pTimeDomainCount" ::: Ptr Word32)
-> ("pTimeDomains" ::: Ptr TimeDomainEXT)
-> IO Result
vkGetPhysicalDeviceCalibrateableTimeDomainsEXT' Ptr PhysicalDevice_T
physicalDevice' ("pTimeDomainCount" ::: Ptr Word32
pPTimeDomainCount) ("pTimeDomains" ::: Ptr TimeDomainEXT
forall a. Ptr a
nullPtr))
IO ()
-> ContT (Result, "timeDomains" ::: Vector TimeDomainEXT) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ()
-> ContT (Result, "timeDomains" ::: Vector TimeDomainEXT) IO ())
-> IO ()
-> ContT (Result, "timeDomains" ::: Vector TimeDomainEXT) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Result
r Result -> Result -> Bool
forall a. Ord a => a -> a -> Bool
< Result
SUCCESS) (VulkanException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (Result -> VulkanException
VulkanException Result
r))
Word32
pTimeDomainCount <- IO Word32
-> ContT (Result, "timeDomains" ::: Vector TimeDomainEXT) IO Word32
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Word32
-> ContT
(Result, "timeDomains" ::: Vector TimeDomainEXT) IO Word32)
-> IO Word32
-> ContT (Result, "timeDomains" ::: Vector TimeDomainEXT) IO Word32
forall a b. (a -> b) -> a -> b
$ ("pTimeDomainCount" ::: Ptr Word32) -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 "pTimeDomainCount" ::: Ptr Word32
pPTimeDomainCount
"pTimeDomains" ::: Ptr TimeDomainEXT
pPTimeDomains <- ((("pTimeDomains" ::: Ptr TimeDomainEXT)
-> IO (Result, "timeDomains" ::: Vector TimeDomainEXT))
-> IO (Result, "timeDomains" ::: Vector TimeDomainEXT))
-> ContT
(Result, "timeDomains" ::: Vector TimeDomainEXT)
IO
("pTimeDomains" ::: Ptr TimeDomainEXT)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pTimeDomains" ::: Ptr TimeDomainEXT)
-> IO (Result, "timeDomains" ::: Vector TimeDomainEXT))
-> IO (Result, "timeDomains" ::: Vector TimeDomainEXT))
-> ContT
(Result, "timeDomains" ::: Vector TimeDomainEXT)
IO
("pTimeDomains" ::: Ptr TimeDomainEXT))
-> ((("pTimeDomains" ::: Ptr TimeDomainEXT)
-> IO (Result, "timeDomains" ::: Vector TimeDomainEXT))
-> IO (Result, "timeDomains" ::: Vector TimeDomainEXT))
-> ContT
(Result, "timeDomains" ::: Vector TimeDomainEXT)
IO
("pTimeDomains" ::: Ptr TimeDomainEXT)
forall a b. (a -> b) -> a -> b
$ IO ("pTimeDomains" ::: Ptr TimeDomainEXT)
-> (("pTimeDomains" ::: Ptr TimeDomainEXT) -> IO ())
-> (("pTimeDomains" ::: Ptr TimeDomainEXT)
-> IO (Result, "timeDomains" ::: Vector TimeDomainEXT))
-> IO (Result, "timeDomains" ::: Vector TimeDomainEXT)
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int -> IO ("pTimeDomains" ::: Ptr TimeDomainEXT)
forall a. Int -> IO (Ptr a)
callocBytes @TimeDomainEXT ((Word32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32
pTimeDomainCount)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* 4)) ("pTimeDomains" ::: Ptr TimeDomainEXT) -> IO ()
forall a. Ptr a -> IO ()
free
Result
r' <- IO Result
-> ContT (Result, "timeDomains" ::: Vector TimeDomainEXT) IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result
-> ContT
(Result, "timeDomains" ::: Vector TimeDomainEXT) IO Result)
-> IO Result
-> ContT (Result, "timeDomains" ::: Vector TimeDomainEXT) IO Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "vkGetPhysicalDeviceCalibrateableTimeDomainsEXT" (Ptr PhysicalDevice_T
-> ("pTimeDomainCount" ::: Ptr Word32)
-> ("pTimeDomains" ::: Ptr TimeDomainEXT)
-> IO Result
vkGetPhysicalDeviceCalibrateableTimeDomainsEXT' Ptr PhysicalDevice_T
physicalDevice' ("pTimeDomainCount" ::: Ptr Word32
pPTimeDomainCount) ("pTimeDomains" ::: Ptr TimeDomainEXT
pPTimeDomains))
IO ()
-> ContT (Result, "timeDomains" ::: Vector TimeDomainEXT) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ()
-> ContT (Result, "timeDomains" ::: Vector TimeDomainEXT) IO ())
-> IO ()
-> ContT (Result, "timeDomains" ::: Vector TimeDomainEXT) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Result
r' Result -> Result -> Bool
forall a. Ord a => a -> a -> Bool
< Result
SUCCESS) (VulkanException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (Result -> VulkanException
VulkanException Result
r'))
Word32
pTimeDomainCount' <- IO Word32
-> ContT (Result, "timeDomains" ::: Vector TimeDomainEXT) IO Word32
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Word32
-> ContT
(Result, "timeDomains" ::: Vector TimeDomainEXT) IO Word32)
-> IO Word32
-> ContT (Result, "timeDomains" ::: Vector TimeDomainEXT) IO Word32
forall a b. (a -> b) -> a -> b
$ ("pTimeDomainCount" ::: Ptr Word32) -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 "pTimeDomainCount" ::: Ptr Word32
pPTimeDomainCount
"timeDomains" ::: Vector TimeDomainEXT
pTimeDomains' <- IO ("timeDomains" ::: Vector TimeDomainEXT)
-> ContT
(Result, "timeDomains" ::: Vector TimeDomainEXT)
IO
("timeDomains" ::: Vector TimeDomainEXT)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ("timeDomains" ::: Vector TimeDomainEXT)
-> ContT
(Result, "timeDomains" ::: Vector TimeDomainEXT)
IO
("timeDomains" ::: Vector TimeDomainEXT))
-> IO ("timeDomains" ::: Vector TimeDomainEXT)
-> ContT
(Result, "timeDomains" ::: Vector TimeDomainEXT)
IO
("timeDomains" ::: Vector TimeDomainEXT)
forall a b. (a -> b) -> a -> b
$ Int
-> (Int -> IO TimeDomainEXT)
-> IO ("timeDomains" ::: Vector TimeDomainEXT)
forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM (Word32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32
pTimeDomainCount')) (\i :: Int
i -> ("pTimeDomains" ::: Ptr TimeDomainEXT) -> IO TimeDomainEXT
forall a. Storable a => Ptr a -> IO a
peek @TimeDomainEXT (("pTimeDomains" ::: Ptr TimeDomainEXT
pPTimeDomains ("pTimeDomains" ::: Ptr TimeDomainEXT)
-> Int -> "pTimeDomains" ::: Ptr TimeDomainEXT
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (4 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr TimeDomainEXT)))
(Result, "timeDomains" ::: Vector TimeDomainEXT)
-> ContT
(Result, "timeDomains" ::: Vector TimeDomainEXT)
IO
(Result, "timeDomains" ::: Vector TimeDomainEXT)
forall (f :: * -> *) a. Applicative f => a -> f a
pure ((Result, "timeDomains" ::: Vector TimeDomainEXT)
-> ContT
(Result, "timeDomains" ::: Vector TimeDomainEXT)
IO
(Result, "timeDomains" ::: Vector TimeDomainEXT))
-> (Result, "timeDomains" ::: Vector TimeDomainEXT)
-> ContT
(Result, "timeDomains" ::: Vector TimeDomainEXT)
IO
(Result, "timeDomains" ::: Vector TimeDomainEXT)
forall a b. (a -> b) -> a -> b
$ ((Result
r'), "timeDomains" ::: Vector TimeDomainEXT
pTimeDomains')
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkGetCalibratedTimestampsEXT
:: FunPtr (Ptr Device_T -> Word32 -> Ptr CalibratedTimestampInfoEXT -> Ptr Word64 -> Ptr Word64 -> IO Result) -> Ptr Device_T -> Word32 -> Ptr CalibratedTimestampInfoEXT -> Ptr Word64 -> Ptr Word64 -> IO Result
getCalibratedTimestampsEXT :: forall io
. (MonadIO io)
=>
Device
->
("timestampInfos" ::: Vector CalibratedTimestampInfoEXT)
-> io (("timestamps" ::: Vector Word64), ("maxDeviation" ::: Word64))
getCalibratedTimestampsEXT :: Device
-> ("timestampInfos" ::: Vector CalibratedTimestampInfoEXT)
-> io ("timestamps" ::: Vector Word64, Word64)
getCalibratedTimestampsEXT device :: Device
device timestampInfos :: "timestampInfos" ::: Vector CalibratedTimestampInfoEXT
timestampInfos = IO ("timestamps" ::: Vector Word64, Word64)
-> io ("timestamps" ::: Vector Word64, Word64)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ("timestamps" ::: Vector Word64, Word64)
-> io ("timestamps" ::: Vector Word64, Word64))
-> (ContT
("timestamps" ::: Vector Word64, Word64)
IO
("timestamps" ::: Vector Word64, Word64)
-> IO ("timestamps" ::: Vector Word64, Word64))
-> ContT
("timestamps" ::: Vector Word64, Word64)
IO
("timestamps" ::: Vector Word64, Word64)
-> io ("timestamps" ::: Vector Word64, Word64)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT
("timestamps" ::: Vector Word64, Word64)
IO
("timestamps" ::: Vector Word64, Word64)
-> IO ("timestamps" ::: Vector Word64, Word64)
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT
("timestamps" ::: Vector Word64, Word64)
IO
("timestamps" ::: Vector Word64, Word64)
-> io ("timestamps" ::: Vector Word64, Word64))
-> ContT
("timestamps" ::: Vector Word64, Word64)
IO
("timestamps" ::: Vector Word64, Word64)
-> io ("timestamps" ::: Vector Word64, Word64)
forall a b. (a -> b) -> a -> b
$ do
let vkGetCalibratedTimestampsEXTPtr :: FunPtr
(Ptr Device_T
-> Word32
-> ("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT)
-> ("pTimestamps" ::: Ptr Word64)
-> ("pTimestamps" ::: Ptr Word64)
-> IO Result)
vkGetCalibratedTimestampsEXTPtr = DeviceCmds
-> FunPtr
(Ptr Device_T
-> Word32
-> ("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT)
-> ("pTimestamps" ::: Ptr Word64)
-> ("pTimestamps" ::: Ptr Word64)
-> IO Result)
pVkGetCalibratedTimestampsEXT (Device -> DeviceCmds
deviceCmds (Device
device :: Device))
IO () -> ContT ("timestamps" ::: Vector Word64, Word64) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT ("timestamps" ::: Vector Word64, Word64) IO ())
-> IO () -> ContT ("timestamps" ::: Vector Word64, Word64) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
(Ptr Device_T
-> Word32
-> ("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT)
-> ("pTimestamps" ::: Ptr Word64)
-> ("pTimestamps" ::: Ptr Word64)
-> IO Result)
vkGetCalibratedTimestampsEXTPtr FunPtr
(Ptr Device_T
-> Word32
-> ("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT)
-> ("pTimestamps" ::: Ptr Word64)
-> ("pTimestamps" ::: Ptr Word64)
-> IO Result)
-> FunPtr
(Ptr Device_T
-> Word32
-> ("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT)
-> ("pTimestamps" ::: Ptr Word64)
-> ("pTimestamps" ::: Ptr Word64)
-> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
(Ptr Device_T
-> Word32
-> ("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT)
-> ("pTimestamps" ::: Ptr Word64)
-> ("pTimestamps" ::: Ptr Word64)
-> IO Result)
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
IOException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument "" "The function pointer for vkGetCalibratedTimestampsEXT is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
let vkGetCalibratedTimestampsEXT' :: Ptr Device_T
-> Word32
-> ("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT)
-> ("pTimestamps" ::: Ptr Word64)
-> ("pTimestamps" ::: Ptr Word64)
-> IO Result
vkGetCalibratedTimestampsEXT' = FunPtr
(Ptr Device_T
-> Word32
-> ("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT)
-> ("pTimestamps" ::: Ptr Word64)
-> ("pTimestamps" ::: Ptr Word64)
-> IO Result)
-> Ptr Device_T
-> Word32
-> ("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT)
-> ("pTimestamps" ::: Ptr Word64)
-> ("pTimestamps" ::: Ptr Word64)
-> IO Result
mkVkGetCalibratedTimestampsEXT FunPtr
(Ptr Device_T
-> Word32
-> ("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT)
-> ("pTimestamps" ::: Ptr Word64)
-> ("pTimestamps" ::: Ptr Word64)
-> IO Result)
vkGetCalibratedTimestampsEXTPtr
"pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT
pPTimestampInfos <- ((("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT)
-> IO ("timestamps" ::: Vector Word64, Word64))
-> IO ("timestamps" ::: Vector Word64, Word64))
-> ContT
("timestamps" ::: Vector Word64, Word64)
IO
("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT)
-> IO ("timestamps" ::: Vector Word64, Word64))
-> IO ("timestamps" ::: Vector Word64, Word64))
-> ContT
("timestamps" ::: Vector Word64, Word64)
IO
("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT))
-> ((("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT)
-> IO ("timestamps" ::: Vector Word64, Word64))
-> IO ("timestamps" ::: Vector Word64, Word64))
-> ContT
("timestamps" ::: Vector Word64, Word64)
IO
("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT)
forall a b. (a -> b) -> a -> b
$ Int
-> Int
-> (("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT)
-> IO ("timestamps" ::: Vector Word64, Word64))
-> IO ("timestamps" ::: Vector Word64, Word64)
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned @CalibratedTimestampInfoEXT ((("timestampInfos" ::: Vector CalibratedTimestampInfoEXT) -> Int
forall a. Vector a -> Int
Data.Vector.length ("timestampInfos" ::: Vector CalibratedTimestampInfoEXT
timestampInfos)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* 24) 8
IO () -> ContT ("timestamps" ::: Vector Word64, Word64) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT ("timestamps" ::: Vector Word64, Word64) IO ())
-> IO () -> ContT ("timestamps" ::: Vector Word64, Word64) IO ()
forall a b. (a -> b) -> a -> b
$ (Int -> CalibratedTimestampInfoEXT -> IO ())
-> ("timestampInfos" ::: Vector CalibratedTimestampInfoEXT)
-> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\i :: Int
i e :: CalibratedTimestampInfoEXT
e -> ("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT)
-> CalibratedTimestampInfoEXT -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT
pPTimestampInfos ("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT)
-> Int -> "pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (24 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr CalibratedTimestampInfoEXT) (CalibratedTimestampInfoEXT
e)) ("timestampInfos" ::: Vector CalibratedTimestampInfoEXT
timestampInfos)
"pTimestamps" ::: Ptr Word64
pPTimestamps <- ((("pTimestamps" ::: Ptr Word64)
-> IO ("timestamps" ::: Vector Word64, Word64))
-> IO ("timestamps" ::: Vector Word64, Word64))
-> ContT
("timestamps" ::: Vector Word64, Word64)
IO
("pTimestamps" ::: Ptr Word64)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pTimestamps" ::: Ptr Word64)
-> IO ("timestamps" ::: Vector Word64, Word64))
-> IO ("timestamps" ::: Vector Word64, Word64))
-> ContT
("timestamps" ::: Vector Word64, Word64)
IO
("pTimestamps" ::: Ptr Word64))
-> ((("pTimestamps" ::: Ptr Word64)
-> IO ("timestamps" ::: Vector Word64, Word64))
-> IO ("timestamps" ::: Vector Word64, Word64))
-> ContT
("timestamps" ::: Vector Word64, Word64)
IO
("pTimestamps" ::: Ptr Word64)
forall a b. (a -> b) -> a -> b
$ IO ("pTimestamps" ::: Ptr Word64)
-> (("pTimestamps" ::: Ptr Word64) -> IO ())
-> (("pTimestamps" ::: Ptr Word64)
-> IO ("timestamps" ::: Vector Word64, Word64))
-> IO ("timestamps" ::: Vector Word64, Word64)
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int -> IO ("pTimestamps" ::: Ptr Word64)
forall a. Int -> IO (Ptr a)
callocBytes @Word64 ((Word32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral ((Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (("timestampInfos" ::: Vector CalibratedTimestampInfoEXT) -> Int
forall a. Vector a -> Int
Data.Vector.length (("timestampInfos" ::: Vector CalibratedTimestampInfoEXT) -> Int)
-> ("timestampInfos" ::: Vector CalibratedTimestampInfoEXT) -> Int
forall a b. (a -> b) -> a -> b
$ ("timestampInfos" ::: Vector CalibratedTimestampInfoEXT
timestampInfos)) :: Word32))) Int -> Int -> Int
forall a. Num a => a -> a -> a
* 8)) ("pTimestamps" ::: Ptr Word64) -> IO ()
forall a. Ptr a -> IO ()
free
"pTimestamps" ::: Ptr Word64
pPMaxDeviation <- ((("pTimestamps" ::: Ptr Word64)
-> IO ("timestamps" ::: Vector Word64, Word64))
-> IO ("timestamps" ::: Vector Word64, Word64))
-> ContT
("timestamps" ::: Vector Word64, Word64)
IO
("pTimestamps" ::: Ptr Word64)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pTimestamps" ::: Ptr Word64)
-> IO ("timestamps" ::: Vector Word64, Word64))
-> IO ("timestamps" ::: Vector Word64, Word64))
-> ContT
("timestamps" ::: Vector Word64, Word64)
IO
("pTimestamps" ::: Ptr Word64))
-> ((("pTimestamps" ::: Ptr Word64)
-> IO ("timestamps" ::: Vector Word64, Word64))
-> IO ("timestamps" ::: Vector Word64, Word64))
-> ContT
("timestamps" ::: Vector Word64, Word64)
IO
("pTimestamps" ::: Ptr Word64)
forall a b. (a -> b) -> a -> b
$ IO ("pTimestamps" ::: Ptr Word64)
-> (("pTimestamps" ::: Ptr Word64) -> IO ())
-> (("pTimestamps" ::: Ptr Word64)
-> IO ("timestamps" ::: Vector Word64, Word64))
-> IO ("timestamps" ::: Vector Word64, Word64)
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int -> IO ("pTimestamps" ::: Ptr Word64)
forall a. Int -> IO (Ptr a)
callocBytes @Word64 8) ("pTimestamps" ::: Ptr Word64) -> IO ()
forall a. Ptr a -> IO ()
free
Result
r <- IO Result
-> ContT ("timestamps" ::: Vector Word64, Word64) IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result
-> ContT ("timestamps" ::: Vector Word64, Word64) IO Result)
-> IO Result
-> ContT ("timestamps" ::: Vector Word64, Word64) IO Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "vkGetCalibratedTimestampsEXT" (Ptr Device_T
-> Word32
-> ("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT)
-> ("pTimestamps" ::: Ptr Word64)
-> ("pTimestamps" ::: Ptr Word64)
-> IO Result
vkGetCalibratedTimestampsEXT' (Device -> Ptr Device_T
deviceHandle (Device
device)) ((Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (("timestampInfos" ::: Vector CalibratedTimestampInfoEXT) -> Int
forall a. Vector a -> Int
Data.Vector.length (("timestampInfos" ::: Vector CalibratedTimestampInfoEXT) -> Int)
-> ("timestampInfos" ::: Vector CalibratedTimestampInfoEXT) -> Int
forall a b. (a -> b) -> a -> b
$ ("timestampInfos" ::: Vector CalibratedTimestampInfoEXT
timestampInfos)) :: Word32)) ("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT
pPTimestampInfos) ("pTimestamps" ::: Ptr Word64
pPTimestamps) ("pTimestamps" ::: Ptr Word64
pPMaxDeviation))
IO () -> ContT ("timestamps" ::: Vector Word64, Word64) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT ("timestamps" ::: Vector Word64, Word64) IO ())
-> IO () -> ContT ("timestamps" ::: Vector Word64, Word64) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Result
r Result -> Result -> Bool
forall a. Ord a => a -> a -> Bool
< Result
SUCCESS) (VulkanException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (Result -> VulkanException
VulkanException Result
r))
"timestamps" ::: Vector Word64
pTimestamps <- IO ("timestamps" ::: Vector Word64)
-> ContT
("timestamps" ::: Vector Word64, Word64)
IO
("timestamps" ::: Vector Word64)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ("timestamps" ::: Vector Word64)
-> ContT
("timestamps" ::: Vector Word64, Word64)
IO
("timestamps" ::: Vector Word64))
-> IO ("timestamps" ::: Vector Word64)
-> ContT
("timestamps" ::: Vector Word64, Word64)
IO
("timestamps" ::: Vector Word64)
forall a b. (a -> b) -> a -> b
$ Int -> (Int -> IO Word64) -> IO ("timestamps" ::: Vector Word64)
forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM (Word32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral ((Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (("timestampInfos" ::: Vector CalibratedTimestampInfoEXT) -> Int
forall a. Vector a -> Int
Data.Vector.length (("timestampInfos" ::: Vector CalibratedTimestampInfoEXT) -> Int)
-> ("timestampInfos" ::: Vector CalibratedTimestampInfoEXT) -> Int
forall a b. (a -> b) -> a -> b
$ ("timestampInfos" ::: Vector CalibratedTimestampInfoEXT
timestampInfos)) :: Word32))) (\i :: Int
i -> ("pTimestamps" ::: Ptr Word64) -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek @Word64 (("pTimestamps" ::: Ptr Word64
pPTimestamps ("pTimestamps" ::: Ptr Word64)
-> Int -> "pTimestamps" ::: Ptr Word64
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Word64)))
Word64
pMaxDeviation <- IO Word64
-> ContT ("timestamps" ::: Vector Word64, Word64) IO Word64
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Word64
-> ContT ("timestamps" ::: Vector Word64, Word64) IO Word64)
-> IO Word64
-> ContT ("timestamps" ::: Vector Word64, Word64) IO Word64
forall a b. (a -> b) -> a -> b
$ ("pTimestamps" ::: Ptr Word64) -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek @Word64 "pTimestamps" ::: Ptr Word64
pPMaxDeviation
("timestamps" ::: Vector Word64, Word64)
-> ContT
("timestamps" ::: Vector Word64, Word64)
IO
("timestamps" ::: Vector Word64, Word64)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (("timestamps" ::: Vector Word64, Word64)
-> ContT
("timestamps" ::: Vector Word64, Word64)
IO
("timestamps" ::: Vector Word64, Word64))
-> ("timestamps" ::: Vector Word64, Word64)
-> ContT
("timestamps" ::: Vector Word64, Word64)
IO
("timestamps" ::: Vector Word64, Word64)
forall a b. (a -> b) -> a -> b
$ ("timestamps" ::: Vector Word64
pTimestamps, Word64
pMaxDeviation)
data CalibratedTimestampInfoEXT = CalibratedTimestampInfoEXT
{
CalibratedTimestampInfoEXT -> TimeDomainEXT
timeDomain :: TimeDomainEXT }
deriving (Typeable, CalibratedTimestampInfoEXT -> CalibratedTimestampInfoEXT -> Bool
(CalibratedTimestampInfoEXT -> CalibratedTimestampInfoEXT -> Bool)
-> (CalibratedTimestampInfoEXT
-> CalibratedTimestampInfoEXT -> Bool)
-> Eq CalibratedTimestampInfoEXT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CalibratedTimestampInfoEXT -> CalibratedTimestampInfoEXT -> Bool
$c/= :: CalibratedTimestampInfoEXT -> CalibratedTimestampInfoEXT -> Bool
== :: CalibratedTimestampInfoEXT -> CalibratedTimestampInfoEXT -> Bool
$c== :: CalibratedTimestampInfoEXT -> CalibratedTimestampInfoEXT -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (CalibratedTimestampInfoEXT)
#endif
deriving instance Show CalibratedTimestampInfoEXT
instance ToCStruct CalibratedTimestampInfoEXT where
withCStruct :: CalibratedTimestampInfoEXT
-> (("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT) -> IO b)
-> IO b
withCStruct x :: CalibratedTimestampInfoEXT
x f :: ("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT) -> IO b
f = Int
-> Int
-> (("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT) -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 24 8 ((("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT) -> IO b)
-> IO b)
-> (("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT) -> IO b)
-> IO b
forall a b. (a -> b) -> a -> b
$ \p :: "pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT
p -> ("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT)
-> CalibratedTimestampInfoEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT
p CalibratedTimestampInfoEXT
x (("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT) -> IO b
f "pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT
p)
pokeCStruct :: ("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT)
-> CalibratedTimestampInfoEXT -> IO b -> IO b
pokeCStruct p :: "pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT
p CalibratedTimestampInfoEXT{..} f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT
p ("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_CALIBRATED_TIMESTAMP_INFO_EXT)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT
p ("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
("pTimeDomains" ::: Ptr TimeDomainEXT) -> TimeDomainEXT -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT
p ("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT)
-> Int -> "pTimeDomains" ::: Ptr TimeDomainEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr TimeDomainEXT)) (TimeDomainEXT
timeDomain)
IO b
f
cStructSize :: Int
cStructSize = 24
cStructAlignment :: Int
cStructAlignment = 8
pokeZeroCStruct :: ("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT)
-> IO b -> IO b
pokeZeroCStruct p :: "pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT
p f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT
p ("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_CALIBRATED_TIMESTAMP_INFO_EXT)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT
p ("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
("pTimeDomains" ::: Ptr TimeDomainEXT) -> TimeDomainEXT -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT
p ("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT)
-> Int -> "pTimeDomains" ::: Ptr TimeDomainEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr TimeDomainEXT)) (TimeDomainEXT
forall a. Zero a => a
zero)
IO b
f
instance FromCStruct CalibratedTimestampInfoEXT where
peekCStruct :: ("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT)
-> IO CalibratedTimestampInfoEXT
peekCStruct p :: "pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT
p = do
TimeDomainEXT
timeDomain <- ("pTimeDomains" ::: Ptr TimeDomainEXT) -> IO TimeDomainEXT
forall a. Storable a => Ptr a -> IO a
peek @TimeDomainEXT (("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT
p ("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT)
-> Int -> "pTimeDomains" ::: Ptr TimeDomainEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr TimeDomainEXT))
CalibratedTimestampInfoEXT -> IO CalibratedTimestampInfoEXT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (CalibratedTimestampInfoEXT -> IO CalibratedTimestampInfoEXT)
-> CalibratedTimestampInfoEXT -> IO CalibratedTimestampInfoEXT
forall a b. (a -> b) -> a -> b
$ TimeDomainEXT -> CalibratedTimestampInfoEXT
CalibratedTimestampInfoEXT
TimeDomainEXT
timeDomain
instance Storable CalibratedTimestampInfoEXT where
sizeOf :: CalibratedTimestampInfoEXT -> Int
sizeOf ~CalibratedTimestampInfoEXT
_ = 24
alignment :: CalibratedTimestampInfoEXT -> Int
alignment ~CalibratedTimestampInfoEXT
_ = 8
peek :: ("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT)
-> IO CalibratedTimestampInfoEXT
peek = ("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT)
-> IO CalibratedTimestampInfoEXT
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: ("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT)
-> CalibratedTimestampInfoEXT -> IO ()
poke ptr :: "pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT
ptr poked :: CalibratedTimestampInfoEXT
poked = ("pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT)
-> CalibratedTimestampInfoEXT -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pTimestampInfos" ::: Ptr CalibratedTimestampInfoEXT
ptr CalibratedTimestampInfoEXT
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero CalibratedTimestampInfoEXT where
zero :: CalibratedTimestampInfoEXT
zero = TimeDomainEXT -> CalibratedTimestampInfoEXT
CalibratedTimestampInfoEXT
TimeDomainEXT
forall a. Zero a => a
zero
newtype TimeDomainEXT = TimeDomainEXT Int32
deriving newtype (TimeDomainEXT -> TimeDomainEXT -> Bool
(TimeDomainEXT -> TimeDomainEXT -> Bool)
-> (TimeDomainEXT -> TimeDomainEXT -> Bool) -> Eq TimeDomainEXT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TimeDomainEXT -> TimeDomainEXT -> Bool
$c/= :: TimeDomainEXT -> TimeDomainEXT -> Bool
== :: TimeDomainEXT -> TimeDomainEXT -> Bool
$c== :: TimeDomainEXT -> TimeDomainEXT -> Bool
Eq, Eq TimeDomainEXT
Eq TimeDomainEXT =>
(TimeDomainEXT -> TimeDomainEXT -> Ordering)
-> (TimeDomainEXT -> TimeDomainEXT -> Bool)
-> (TimeDomainEXT -> TimeDomainEXT -> Bool)
-> (TimeDomainEXT -> TimeDomainEXT -> Bool)
-> (TimeDomainEXT -> TimeDomainEXT -> Bool)
-> (TimeDomainEXT -> TimeDomainEXT -> TimeDomainEXT)
-> (TimeDomainEXT -> TimeDomainEXT -> TimeDomainEXT)
-> Ord TimeDomainEXT
TimeDomainEXT -> TimeDomainEXT -> Bool
TimeDomainEXT -> TimeDomainEXT -> Ordering
TimeDomainEXT -> TimeDomainEXT -> TimeDomainEXT
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: TimeDomainEXT -> TimeDomainEXT -> TimeDomainEXT
$cmin :: TimeDomainEXT -> TimeDomainEXT -> TimeDomainEXT
max :: TimeDomainEXT -> TimeDomainEXT -> TimeDomainEXT
$cmax :: TimeDomainEXT -> TimeDomainEXT -> TimeDomainEXT
>= :: TimeDomainEXT -> TimeDomainEXT -> Bool
$c>= :: TimeDomainEXT -> TimeDomainEXT -> Bool
> :: TimeDomainEXT -> TimeDomainEXT -> Bool
$c> :: TimeDomainEXT -> TimeDomainEXT -> Bool
<= :: TimeDomainEXT -> TimeDomainEXT -> Bool
$c<= :: TimeDomainEXT -> TimeDomainEXT -> Bool
< :: TimeDomainEXT -> TimeDomainEXT -> Bool
$c< :: TimeDomainEXT -> TimeDomainEXT -> Bool
compare :: TimeDomainEXT -> TimeDomainEXT -> Ordering
$ccompare :: TimeDomainEXT -> TimeDomainEXT -> Ordering
$cp1Ord :: Eq TimeDomainEXT
Ord, Ptr b -> Int -> IO TimeDomainEXT
Ptr b -> Int -> TimeDomainEXT -> IO ()
("pTimeDomains" ::: Ptr TimeDomainEXT) -> IO TimeDomainEXT
("pTimeDomains" ::: Ptr TimeDomainEXT) -> Int -> IO TimeDomainEXT
("pTimeDomains" ::: Ptr TimeDomainEXT)
-> Int -> TimeDomainEXT -> IO ()
("pTimeDomains" ::: Ptr TimeDomainEXT) -> TimeDomainEXT -> IO ()
TimeDomainEXT -> Int
(TimeDomainEXT -> Int)
-> (TimeDomainEXT -> Int)
-> (("pTimeDomains" ::: Ptr TimeDomainEXT)
-> Int -> IO TimeDomainEXT)
-> (("pTimeDomains" ::: Ptr TimeDomainEXT)
-> Int -> TimeDomainEXT -> IO ())
-> (forall b. Ptr b -> Int -> IO TimeDomainEXT)
-> (forall b. Ptr b -> Int -> TimeDomainEXT -> IO ())
-> (("pTimeDomains" ::: Ptr TimeDomainEXT) -> IO TimeDomainEXT)
-> (("pTimeDomains" ::: Ptr TimeDomainEXT)
-> TimeDomainEXT -> IO ())
-> Storable TimeDomainEXT
forall b. Ptr b -> Int -> IO TimeDomainEXT
forall b. Ptr b -> Int -> TimeDomainEXT -> IO ()
forall a.
(a -> Int)
-> (a -> Int)
-> (Ptr a -> Int -> IO a)
-> (Ptr a -> Int -> a -> IO ())
-> (forall b. Ptr b -> Int -> IO a)
-> (forall b. Ptr b -> Int -> a -> IO ())
-> (Ptr a -> IO a)
-> (Ptr a -> a -> IO ())
-> Storable a
poke :: ("pTimeDomains" ::: Ptr TimeDomainEXT) -> TimeDomainEXT -> IO ()
$cpoke :: ("pTimeDomains" ::: Ptr TimeDomainEXT) -> TimeDomainEXT -> IO ()
peek :: ("pTimeDomains" ::: Ptr TimeDomainEXT) -> IO TimeDomainEXT
$cpeek :: ("pTimeDomains" ::: Ptr TimeDomainEXT) -> IO TimeDomainEXT
pokeByteOff :: Ptr b -> Int -> TimeDomainEXT -> IO ()
$cpokeByteOff :: forall b. Ptr b -> Int -> TimeDomainEXT -> IO ()
peekByteOff :: Ptr b -> Int -> IO TimeDomainEXT
$cpeekByteOff :: forall b. Ptr b -> Int -> IO TimeDomainEXT
pokeElemOff :: ("pTimeDomains" ::: Ptr TimeDomainEXT)
-> Int -> TimeDomainEXT -> IO ()
$cpokeElemOff :: ("pTimeDomains" ::: Ptr TimeDomainEXT)
-> Int -> TimeDomainEXT -> IO ()
peekElemOff :: ("pTimeDomains" ::: Ptr TimeDomainEXT) -> Int -> IO TimeDomainEXT
$cpeekElemOff :: ("pTimeDomains" ::: Ptr TimeDomainEXT) -> Int -> IO TimeDomainEXT
alignment :: TimeDomainEXT -> Int
$calignment :: TimeDomainEXT -> Int
sizeOf :: TimeDomainEXT -> Int
$csizeOf :: TimeDomainEXT -> Int
Storable, TimeDomainEXT
TimeDomainEXT -> Zero TimeDomainEXT
forall a. a -> Zero a
zero :: TimeDomainEXT
$czero :: TimeDomainEXT
Zero)
pattern $bTIME_DOMAIN_DEVICE_EXT :: TimeDomainEXT
$mTIME_DOMAIN_DEVICE_EXT :: forall r. TimeDomainEXT -> (Void# -> r) -> (Void# -> r) -> r
TIME_DOMAIN_DEVICE_EXT = TimeDomainEXT 0
pattern $bTIME_DOMAIN_CLOCK_MONOTONIC_EXT :: TimeDomainEXT
$mTIME_DOMAIN_CLOCK_MONOTONIC_EXT :: forall r. TimeDomainEXT -> (Void# -> r) -> (Void# -> r) -> r
TIME_DOMAIN_CLOCK_MONOTONIC_EXT = TimeDomainEXT 1
pattern $bTIME_DOMAIN_CLOCK_MONOTONIC_RAW_EXT :: TimeDomainEXT
$mTIME_DOMAIN_CLOCK_MONOTONIC_RAW_EXT :: forall r. TimeDomainEXT -> (Void# -> r) -> (Void# -> r) -> r
TIME_DOMAIN_CLOCK_MONOTONIC_RAW_EXT = TimeDomainEXT 2
pattern $bTIME_DOMAIN_QUERY_PERFORMANCE_COUNTER_EXT :: TimeDomainEXT
$mTIME_DOMAIN_QUERY_PERFORMANCE_COUNTER_EXT :: forall r. TimeDomainEXT -> (Void# -> r) -> (Void# -> r) -> r
TIME_DOMAIN_QUERY_PERFORMANCE_COUNTER_EXT = TimeDomainEXT 3
{-# complete TIME_DOMAIN_DEVICE_EXT,
TIME_DOMAIN_CLOCK_MONOTONIC_EXT,
TIME_DOMAIN_CLOCK_MONOTONIC_RAW_EXT,
TIME_DOMAIN_QUERY_PERFORMANCE_COUNTER_EXT :: TimeDomainEXT #-}
conNameTimeDomainEXT :: String
conNameTimeDomainEXT :: String
conNameTimeDomainEXT = "TimeDomainEXT"
enumPrefixTimeDomainEXT :: String
enumPrefixTimeDomainEXT :: String
enumPrefixTimeDomainEXT = "TIME_DOMAIN_"
showTableTimeDomainEXT :: [(TimeDomainEXT, String)]
showTableTimeDomainEXT :: [(TimeDomainEXT, String)]
showTableTimeDomainEXT =
[ (TimeDomainEXT
TIME_DOMAIN_DEVICE_EXT , "DEVICE_EXT")
, (TimeDomainEXT
TIME_DOMAIN_CLOCK_MONOTONIC_EXT , "CLOCK_MONOTONIC_EXT")
, (TimeDomainEXT
TIME_DOMAIN_CLOCK_MONOTONIC_RAW_EXT , "CLOCK_MONOTONIC_RAW_EXT")
, (TimeDomainEXT
TIME_DOMAIN_QUERY_PERFORMANCE_COUNTER_EXT, "QUERY_PERFORMANCE_COUNTER_EXT")
]
instance Show TimeDomainEXT where
showsPrec :: Int -> TimeDomainEXT -> ShowS
showsPrec = String
-> [(TimeDomainEXT, String)]
-> String
-> (TimeDomainEXT -> Int32)
-> (Int32 -> ShowS)
-> Int
-> TimeDomainEXT
-> ShowS
forall a i.
Eq a =>
String
-> [(a, String)]
-> String
-> (a -> i)
-> (i -> ShowS)
-> Int
-> a
-> ShowS
enumShowsPrec String
enumPrefixTimeDomainEXT
[(TimeDomainEXT, String)]
showTableTimeDomainEXT
String
conNameTimeDomainEXT
(\(TimeDomainEXT x :: Int32
x) -> Int32
x)
(Int -> Int32 -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec 11)
instance Read TimeDomainEXT where
readPrec :: ReadPrec TimeDomainEXT
readPrec = String
-> [(TimeDomainEXT, String)]
-> String
-> (Int32 -> TimeDomainEXT)
-> ReadPrec TimeDomainEXT
forall i a.
Read i =>
String -> [(a, String)] -> String -> (i -> a) -> ReadPrec a
enumReadPrec String
enumPrefixTimeDomainEXT [(TimeDomainEXT, String)]
showTableTimeDomainEXT String
conNameTimeDomainEXT Int32 -> TimeDomainEXT
TimeDomainEXT
type EXT_CALIBRATED_TIMESTAMPS_SPEC_VERSION = 1
pattern EXT_CALIBRATED_TIMESTAMPS_SPEC_VERSION :: forall a . Integral a => a
pattern $bEXT_CALIBRATED_TIMESTAMPS_SPEC_VERSION :: a
$mEXT_CALIBRATED_TIMESTAMPS_SPEC_VERSION :: forall r a. Integral a => a -> (Void# -> r) -> (Void# -> r) -> r
EXT_CALIBRATED_TIMESTAMPS_SPEC_VERSION = 1
type EXT_CALIBRATED_TIMESTAMPS_EXTENSION_NAME = "VK_EXT_calibrated_timestamps"
pattern EXT_CALIBRATED_TIMESTAMPS_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bEXT_CALIBRATED_TIMESTAMPS_EXTENSION_NAME :: a
$mEXT_CALIBRATED_TIMESTAMPS_EXTENSION_NAME :: forall r a.
(Eq a, IsString a) =>
a -> (Void# -> r) -> (Void# -> r) -> r
EXT_CALIBRATED_TIMESTAMPS_EXTENSION_NAME = "VK_EXT_calibrated_timestamps"