{-# language CPP #-}
module OpenXR.Extensions.XR_MSFT_spatial_anchor ( createSpatialAnchorMSFT
, withSpatialAnchorMSFT
, createSpatialAnchorSpaceMSFT
, withSpatialAnchorSpaceMSFT
, destroySpatialAnchorMSFT
, SpatialAnchorCreateInfoMSFT(..)
, SpatialAnchorSpaceCreateInfoMSFT(..)
, MSFT_spatial_anchor_SPEC_VERSION
, pattern MSFT_spatial_anchor_SPEC_VERSION
, MSFT_SPATIAL_ANCHOR_EXTENSION_NAME
, pattern MSFT_SPATIAL_ANCHOR_EXTENSION_NAME
, SpatialAnchorMSFT(..)
) where
import OpenXR.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 Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Cont (evalContT)
import OpenXR.CStruct (FromCStruct)
import OpenXR.CStruct (FromCStruct(..))
import OpenXR.CStruct (ToCStruct)
import OpenXR.CStruct (ToCStruct(..))
import OpenXR.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 Foreign.Ptr (FunPtr)
import Foreign.Ptr (Ptr)
import Data.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import OpenXR.Core10.Space (destroySpace)
import OpenXR.Dynamic (InstanceCmds(pXrCreateSpatialAnchorMSFT))
import OpenXR.Dynamic (InstanceCmds(pXrCreateSpatialAnchorSpaceMSFT))
import OpenXR.Dynamic (InstanceCmds(pXrDestroySpatialAnchorMSFT))
import OpenXR.Exception (OpenXrException(..))
import OpenXR.Core10.Space (Posef)
import OpenXR.Core10.Enums.Result (Result)
import OpenXR.Core10.Enums.Result (Result(..))
import OpenXR.Core10.Handles (Session)
import OpenXR.Core10.Handles (Session(..))
import OpenXR.Core10.Handles (Session_T)
import OpenXR.Core10.Handles (Space)
import OpenXR.Core10.Handles (Space(Space))
import OpenXR.Core10.Handles (Space_T)
import OpenXR.Extensions.Handles (SpatialAnchorMSFT)
import OpenXR.Extensions.Handles (SpatialAnchorMSFT(..))
import OpenXR.Extensions.Handles (SpatialAnchorMSFT(SpatialAnchorMSFT))
import OpenXR.Extensions.Handles (SpatialAnchorMSFT_T)
import OpenXR.Core10.Enums.StructureType (StructureType)
import OpenXR.Core10.FundamentalTypes (Time)
import OpenXR.Core10.Enums.Result (Result(SUCCESS))
import OpenXR.Core10.Enums.StructureType (StructureType(TYPE_SPATIAL_ANCHOR_CREATE_INFO_MSFT))
import OpenXR.Core10.Enums.StructureType (StructureType(TYPE_SPATIAL_ANCHOR_SPACE_CREATE_INFO_MSFT))
import OpenXR.Extensions.Handles (SpatialAnchorMSFT(..))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkXrCreateSpatialAnchorMSFT
:: FunPtr (Ptr Session_T -> Ptr SpatialAnchorCreateInfoMSFT -> Ptr (Ptr SpatialAnchorMSFT_T) -> IO Result) -> Ptr Session_T -> Ptr SpatialAnchorCreateInfoMSFT -> Ptr (Ptr SpatialAnchorMSFT_T) -> IO Result
createSpatialAnchorMSFT :: forall io
. (MonadIO io)
=>
Session
->
SpatialAnchorCreateInfoMSFT
-> io (SpatialAnchorMSFT)
createSpatialAnchorMSFT :: Session -> SpatialAnchorCreateInfoMSFT -> io SpatialAnchorMSFT
createSpatialAnchorMSFT session :: Session
session createInfo :: SpatialAnchorCreateInfoMSFT
createInfo = IO SpatialAnchorMSFT -> io SpatialAnchorMSFT
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SpatialAnchorMSFT -> io SpatialAnchorMSFT)
-> (ContT SpatialAnchorMSFT IO SpatialAnchorMSFT
-> IO SpatialAnchorMSFT)
-> ContT SpatialAnchorMSFT IO SpatialAnchorMSFT
-> io SpatialAnchorMSFT
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT SpatialAnchorMSFT IO SpatialAnchorMSFT
-> IO SpatialAnchorMSFT
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT SpatialAnchorMSFT IO SpatialAnchorMSFT
-> io SpatialAnchorMSFT)
-> ContT SpatialAnchorMSFT IO SpatialAnchorMSFT
-> io SpatialAnchorMSFT
forall a b. (a -> b) -> a -> b
$ do
let cmds :: InstanceCmds
cmds = Session -> InstanceCmds
instanceCmds (Session
session :: Session)
let xrCreateSpatialAnchorMSFTPtr :: FunPtr
(Ptr Session_T
-> Ptr SpatialAnchorCreateInfoMSFT
-> ("anchor" ::: Ptr (Ptr SpatialAnchorMSFT_T))
-> IO Result)
xrCreateSpatialAnchorMSFTPtr = InstanceCmds
-> FunPtr
(Ptr Session_T
-> Ptr SpatialAnchorCreateInfoMSFT
-> ("anchor" ::: Ptr (Ptr SpatialAnchorMSFT_T))
-> IO Result)
pXrCreateSpatialAnchorMSFT InstanceCmds
cmds
IO () -> ContT SpatialAnchorMSFT IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT SpatialAnchorMSFT IO ())
-> IO () -> ContT SpatialAnchorMSFT IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
(Ptr Session_T
-> Ptr SpatialAnchorCreateInfoMSFT
-> ("anchor" ::: Ptr (Ptr SpatialAnchorMSFT_T))
-> IO Result)
xrCreateSpatialAnchorMSFTPtr FunPtr
(Ptr Session_T
-> Ptr SpatialAnchorCreateInfoMSFT
-> ("anchor" ::: Ptr (Ptr SpatialAnchorMSFT_T))
-> IO Result)
-> FunPtr
(Ptr Session_T
-> Ptr SpatialAnchorCreateInfoMSFT
-> ("anchor" ::: Ptr (Ptr SpatialAnchorMSFT_T))
-> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
(Ptr Session_T
-> Ptr SpatialAnchorCreateInfoMSFT
-> ("anchor" ::: Ptr (Ptr SpatialAnchorMSFT_T))
-> 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 xrCreateSpatialAnchorMSFT is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
let xrCreateSpatialAnchorMSFT' :: Ptr Session_T
-> Ptr SpatialAnchorCreateInfoMSFT
-> ("anchor" ::: Ptr (Ptr SpatialAnchorMSFT_T))
-> IO Result
xrCreateSpatialAnchorMSFT' = FunPtr
(Ptr Session_T
-> Ptr SpatialAnchorCreateInfoMSFT
-> ("anchor" ::: Ptr (Ptr SpatialAnchorMSFT_T))
-> IO Result)
-> Ptr Session_T
-> Ptr SpatialAnchorCreateInfoMSFT
-> ("anchor" ::: Ptr (Ptr SpatialAnchorMSFT_T))
-> IO Result
mkXrCreateSpatialAnchorMSFT FunPtr
(Ptr Session_T
-> Ptr SpatialAnchorCreateInfoMSFT
-> ("anchor" ::: Ptr (Ptr SpatialAnchorMSFT_T))
-> IO Result)
xrCreateSpatialAnchorMSFTPtr
Ptr SpatialAnchorCreateInfoMSFT
createInfo' <- ((Ptr SpatialAnchorCreateInfoMSFT -> IO SpatialAnchorMSFT)
-> IO SpatialAnchorMSFT)
-> ContT SpatialAnchorMSFT IO (Ptr SpatialAnchorCreateInfoMSFT)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr SpatialAnchorCreateInfoMSFT -> IO SpatialAnchorMSFT)
-> IO SpatialAnchorMSFT)
-> ContT SpatialAnchorMSFT IO (Ptr SpatialAnchorCreateInfoMSFT))
-> ((Ptr SpatialAnchorCreateInfoMSFT -> IO SpatialAnchorMSFT)
-> IO SpatialAnchorMSFT)
-> ContT SpatialAnchorMSFT IO (Ptr SpatialAnchorCreateInfoMSFT)
forall a b. (a -> b) -> a -> b
$ SpatialAnchorCreateInfoMSFT
-> (Ptr SpatialAnchorCreateInfoMSFT -> IO SpatialAnchorMSFT)
-> IO SpatialAnchorMSFT
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (SpatialAnchorCreateInfoMSFT
createInfo)
"anchor" ::: Ptr (Ptr SpatialAnchorMSFT_T)
pAnchor <- ((("anchor" ::: Ptr (Ptr SpatialAnchorMSFT_T))
-> IO SpatialAnchorMSFT)
-> IO SpatialAnchorMSFT)
-> ContT
SpatialAnchorMSFT IO ("anchor" ::: Ptr (Ptr SpatialAnchorMSFT_T))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("anchor" ::: Ptr (Ptr SpatialAnchorMSFT_T))
-> IO SpatialAnchorMSFT)
-> IO SpatialAnchorMSFT)
-> ContT
SpatialAnchorMSFT IO ("anchor" ::: Ptr (Ptr SpatialAnchorMSFT_T)))
-> ((("anchor" ::: Ptr (Ptr SpatialAnchorMSFT_T))
-> IO SpatialAnchorMSFT)
-> IO SpatialAnchorMSFT)
-> ContT
SpatialAnchorMSFT IO ("anchor" ::: Ptr (Ptr SpatialAnchorMSFT_T))
forall a b. (a -> b) -> a -> b
$ IO ("anchor" ::: Ptr (Ptr SpatialAnchorMSFT_T))
-> (("anchor" ::: Ptr (Ptr SpatialAnchorMSFT_T)) -> IO ())
-> (("anchor" ::: Ptr (Ptr SpatialAnchorMSFT_T))
-> IO SpatialAnchorMSFT)
-> IO SpatialAnchorMSFT
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int -> IO ("anchor" ::: Ptr (Ptr SpatialAnchorMSFT_T))
forall a. Int -> IO (Ptr a)
callocBytes @(Ptr SpatialAnchorMSFT_T) 8) ("anchor" ::: Ptr (Ptr SpatialAnchorMSFT_T)) -> IO ()
forall a. Ptr a -> IO ()
free
Result
r <- IO Result -> ContT SpatialAnchorMSFT IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result -> ContT SpatialAnchorMSFT IO Result)
-> IO Result -> ContT SpatialAnchorMSFT IO Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "xrCreateSpatialAnchorMSFT" (Ptr Session_T
-> Ptr SpatialAnchorCreateInfoMSFT
-> ("anchor" ::: Ptr (Ptr SpatialAnchorMSFT_T))
-> IO Result
xrCreateSpatialAnchorMSFT' (Session -> Ptr Session_T
sessionHandle (Session
session)) Ptr SpatialAnchorCreateInfoMSFT
createInfo' ("anchor" ::: Ptr (Ptr SpatialAnchorMSFT_T)
pAnchor))
IO () -> ContT SpatialAnchorMSFT IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT SpatialAnchorMSFT IO ())
-> IO () -> ContT SpatialAnchorMSFT 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) (OpenXrException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (Result -> OpenXrException
OpenXrException Result
r))
Ptr SpatialAnchorMSFT_T
anchor <- IO (Ptr SpatialAnchorMSFT_T)
-> ContT SpatialAnchorMSFT IO (Ptr SpatialAnchorMSFT_T)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO (Ptr SpatialAnchorMSFT_T)
-> ContT SpatialAnchorMSFT IO (Ptr SpatialAnchorMSFT_T))
-> IO (Ptr SpatialAnchorMSFT_T)
-> ContT SpatialAnchorMSFT IO (Ptr SpatialAnchorMSFT_T)
forall a b. (a -> b) -> a -> b
$ ("anchor" ::: Ptr (Ptr SpatialAnchorMSFT_T))
-> IO (Ptr SpatialAnchorMSFT_T)
forall a. Storable a => Ptr a -> IO a
peek @(Ptr SpatialAnchorMSFT_T) "anchor" ::: Ptr (Ptr SpatialAnchorMSFT_T)
pAnchor
SpatialAnchorMSFT -> ContT SpatialAnchorMSFT IO SpatialAnchorMSFT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (SpatialAnchorMSFT -> ContT SpatialAnchorMSFT IO SpatialAnchorMSFT)
-> SpatialAnchorMSFT
-> ContT SpatialAnchorMSFT IO SpatialAnchorMSFT
forall a b. (a -> b) -> a -> b
$ (((\h :: Ptr SpatialAnchorMSFT_T
h -> Ptr SpatialAnchorMSFT_T -> InstanceCmds -> SpatialAnchorMSFT
SpatialAnchorMSFT Ptr SpatialAnchorMSFT_T
h InstanceCmds
cmds ) Ptr SpatialAnchorMSFT_T
anchor))
withSpatialAnchorMSFT :: forall io r . MonadIO io => Session -> SpatialAnchorCreateInfoMSFT -> (io SpatialAnchorMSFT -> (SpatialAnchorMSFT -> io ()) -> r) -> r
withSpatialAnchorMSFT :: Session
-> SpatialAnchorCreateInfoMSFT
-> (io SpatialAnchorMSFT -> (SpatialAnchorMSFT -> io ()) -> r)
-> r
withSpatialAnchorMSFT session :: Session
session createInfo :: SpatialAnchorCreateInfoMSFT
createInfo b :: io SpatialAnchorMSFT -> (SpatialAnchorMSFT -> io ()) -> r
b =
io SpatialAnchorMSFT -> (SpatialAnchorMSFT -> io ()) -> r
b (Session -> SpatialAnchorCreateInfoMSFT -> io SpatialAnchorMSFT
forall (io :: * -> *).
MonadIO io =>
Session -> SpatialAnchorCreateInfoMSFT -> io SpatialAnchorMSFT
createSpatialAnchorMSFT Session
session SpatialAnchorCreateInfoMSFT
createInfo)
(\(SpatialAnchorMSFT
o0) -> SpatialAnchorMSFT -> io ()
forall (io :: * -> *). MonadIO io => SpatialAnchorMSFT -> io ()
destroySpatialAnchorMSFT SpatialAnchorMSFT
o0)
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkXrCreateSpatialAnchorSpaceMSFT
:: FunPtr (Ptr Session_T -> Ptr SpatialAnchorSpaceCreateInfoMSFT -> Ptr (Ptr Space_T) -> IO Result) -> Ptr Session_T -> Ptr SpatialAnchorSpaceCreateInfoMSFT -> Ptr (Ptr Space_T) -> IO Result
createSpatialAnchorSpaceMSFT :: forall io
. (MonadIO io)
=>
Session
->
SpatialAnchorSpaceCreateInfoMSFT
-> io (Space)
createSpatialAnchorSpaceMSFT :: Session -> SpatialAnchorSpaceCreateInfoMSFT -> io Space
createSpatialAnchorSpaceMSFT session :: Session
session createInfo :: SpatialAnchorSpaceCreateInfoMSFT
createInfo = IO Space -> io Space
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Space -> io Space)
-> (ContT Space IO Space -> IO Space)
-> ContT Space IO Space
-> io Space
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT Space IO Space -> IO Space
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT Space IO Space -> io Space)
-> ContT Space IO Space -> io Space
forall a b. (a -> b) -> a -> b
$ do
let cmds :: InstanceCmds
cmds = Session -> InstanceCmds
instanceCmds (Session
session :: Session)
let xrCreateSpatialAnchorSpaceMSFTPtr :: FunPtr
(Ptr Session_T
-> Ptr SpatialAnchorSpaceCreateInfoMSFT
-> ("space" ::: Ptr (Ptr Space_T))
-> IO Result)
xrCreateSpatialAnchorSpaceMSFTPtr = InstanceCmds
-> FunPtr
(Ptr Session_T
-> Ptr SpatialAnchorSpaceCreateInfoMSFT
-> ("space" ::: Ptr (Ptr Space_T))
-> IO Result)
pXrCreateSpatialAnchorSpaceMSFT InstanceCmds
cmds
IO () -> ContT Space IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT Space IO ()) -> IO () -> ContT Space IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
(Ptr Session_T
-> Ptr SpatialAnchorSpaceCreateInfoMSFT
-> ("space" ::: Ptr (Ptr Space_T))
-> IO Result)
xrCreateSpatialAnchorSpaceMSFTPtr FunPtr
(Ptr Session_T
-> Ptr SpatialAnchorSpaceCreateInfoMSFT
-> ("space" ::: Ptr (Ptr Space_T))
-> IO Result)
-> FunPtr
(Ptr Session_T
-> Ptr SpatialAnchorSpaceCreateInfoMSFT
-> ("space" ::: Ptr (Ptr Space_T))
-> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
(Ptr Session_T
-> Ptr SpatialAnchorSpaceCreateInfoMSFT
-> ("space" ::: Ptr (Ptr Space_T))
-> 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 xrCreateSpatialAnchorSpaceMSFT is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
let xrCreateSpatialAnchorSpaceMSFT' :: Ptr Session_T
-> Ptr SpatialAnchorSpaceCreateInfoMSFT
-> ("space" ::: Ptr (Ptr Space_T))
-> IO Result
xrCreateSpatialAnchorSpaceMSFT' = FunPtr
(Ptr Session_T
-> Ptr SpatialAnchorSpaceCreateInfoMSFT
-> ("space" ::: Ptr (Ptr Space_T))
-> IO Result)
-> Ptr Session_T
-> Ptr SpatialAnchorSpaceCreateInfoMSFT
-> ("space" ::: Ptr (Ptr Space_T))
-> IO Result
mkXrCreateSpatialAnchorSpaceMSFT FunPtr
(Ptr Session_T
-> Ptr SpatialAnchorSpaceCreateInfoMSFT
-> ("space" ::: Ptr (Ptr Space_T))
-> IO Result)
xrCreateSpatialAnchorSpaceMSFTPtr
Ptr SpatialAnchorSpaceCreateInfoMSFT
createInfo' <- ((Ptr SpatialAnchorSpaceCreateInfoMSFT -> IO Space) -> IO Space)
-> ContT Space IO (Ptr SpatialAnchorSpaceCreateInfoMSFT)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr SpatialAnchorSpaceCreateInfoMSFT -> IO Space) -> IO Space)
-> ContT Space IO (Ptr SpatialAnchorSpaceCreateInfoMSFT))
-> ((Ptr SpatialAnchorSpaceCreateInfoMSFT -> IO Space) -> IO Space)
-> ContT Space IO (Ptr SpatialAnchorSpaceCreateInfoMSFT)
forall a b. (a -> b) -> a -> b
$ SpatialAnchorSpaceCreateInfoMSFT
-> (Ptr SpatialAnchorSpaceCreateInfoMSFT -> IO Space) -> IO Space
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (SpatialAnchorSpaceCreateInfoMSFT
createInfo)
"space" ::: Ptr (Ptr Space_T)
pSpace <- ((("space" ::: Ptr (Ptr Space_T)) -> IO Space) -> IO Space)
-> ContT Space IO ("space" ::: Ptr (Ptr Space_T))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("space" ::: Ptr (Ptr Space_T)) -> IO Space) -> IO Space)
-> ContT Space IO ("space" ::: Ptr (Ptr Space_T)))
-> ((("space" ::: Ptr (Ptr Space_T)) -> IO Space) -> IO Space)
-> ContT Space IO ("space" ::: Ptr (Ptr Space_T))
forall a b. (a -> b) -> a -> b
$ IO ("space" ::: Ptr (Ptr Space_T))
-> (("space" ::: Ptr (Ptr Space_T)) -> IO ())
-> (("space" ::: Ptr (Ptr Space_T)) -> IO Space)
-> IO Space
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int -> IO ("space" ::: Ptr (Ptr Space_T))
forall a. Int -> IO (Ptr a)
callocBytes @(Ptr Space_T) 8) ("space" ::: Ptr (Ptr Space_T)) -> IO ()
forall a. Ptr a -> IO ()
free
Result
r <- IO Result -> ContT Space IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result -> ContT Space IO Result)
-> IO Result -> ContT Space IO Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "xrCreateSpatialAnchorSpaceMSFT" (Ptr Session_T
-> Ptr SpatialAnchorSpaceCreateInfoMSFT
-> ("space" ::: Ptr (Ptr Space_T))
-> IO Result
xrCreateSpatialAnchorSpaceMSFT' (Session -> Ptr Session_T
sessionHandle (Session
session)) Ptr SpatialAnchorSpaceCreateInfoMSFT
createInfo' ("space" ::: Ptr (Ptr Space_T)
pSpace))
IO () -> ContT Space IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT Space IO ()) -> IO () -> ContT Space 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) (OpenXrException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (Result -> OpenXrException
OpenXrException Result
r))
Ptr Space_T
space <- IO (Ptr Space_T) -> ContT Space IO (Ptr Space_T)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO (Ptr Space_T) -> ContT Space IO (Ptr Space_T))
-> IO (Ptr Space_T) -> ContT Space IO (Ptr Space_T)
forall a b. (a -> b) -> a -> b
$ ("space" ::: Ptr (Ptr Space_T)) -> IO (Ptr Space_T)
forall a. Storable a => Ptr a -> IO a
peek @(Ptr Space_T) "space" ::: Ptr (Ptr Space_T)
pSpace
Space -> ContT Space IO Space
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Space -> ContT Space IO Space) -> Space -> ContT Space IO Space
forall a b. (a -> b) -> a -> b
$ (((\h :: Ptr Space_T
h -> Ptr Space_T -> InstanceCmds -> Space
Space Ptr Space_T
h InstanceCmds
cmds ) Ptr Space_T
space))
withSpatialAnchorSpaceMSFT :: forall io r . MonadIO io => Session -> SpatialAnchorSpaceCreateInfoMSFT -> (io Space -> (Space -> io ()) -> r) -> r
withSpatialAnchorSpaceMSFT :: Session
-> SpatialAnchorSpaceCreateInfoMSFT
-> (io Space -> (Space -> io ()) -> r)
-> r
withSpatialAnchorSpaceMSFT session :: Session
session createInfo :: SpatialAnchorSpaceCreateInfoMSFT
createInfo b :: io Space -> (Space -> io ()) -> r
b =
io Space -> (Space -> io ()) -> r
b (Session -> SpatialAnchorSpaceCreateInfoMSFT -> io Space
forall (io :: * -> *).
MonadIO io =>
Session -> SpatialAnchorSpaceCreateInfoMSFT -> io Space
createSpatialAnchorSpaceMSFT Session
session SpatialAnchorSpaceCreateInfoMSFT
createInfo)
(\(Space
o0) -> Space -> io ()
forall (io :: * -> *). MonadIO io => Space -> io ()
destroySpace Space
o0)
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkXrDestroySpatialAnchorMSFT
:: FunPtr (Ptr SpatialAnchorMSFT_T -> IO Result) -> Ptr SpatialAnchorMSFT_T -> IO Result
destroySpatialAnchorMSFT :: forall io
. (MonadIO io)
=>
SpatialAnchorMSFT
-> io ()
destroySpatialAnchorMSFT :: SpatialAnchorMSFT -> io ()
destroySpatialAnchorMSFT anchor :: SpatialAnchorMSFT
anchor = IO () -> io ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> io ()) -> IO () -> io ()
forall a b. (a -> b) -> a -> b
$ do
let xrDestroySpatialAnchorMSFTPtr :: FunPtr (Ptr SpatialAnchorMSFT_T -> IO Result)
xrDestroySpatialAnchorMSFTPtr = InstanceCmds -> FunPtr (Ptr SpatialAnchorMSFT_T -> IO Result)
pXrDestroySpatialAnchorMSFT (SpatialAnchorMSFT -> InstanceCmds
instanceCmds (SpatialAnchorMSFT
anchor :: SpatialAnchorMSFT))
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr (Ptr SpatialAnchorMSFT_T -> IO Result)
xrDestroySpatialAnchorMSFTPtr FunPtr (Ptr SpatialAnchorMSFT_T -> IO Result)
-> FunPtr (Ptr SpatialAnchorMSFT_T -> IO Result) -> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr (Ptr SpatialAnchorMSFT_T -> 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 xrDestroySpatialAnchorMSFT is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
let xrDestroySpatialAnchorMSFT' :: Ptr SpatialAnchorMSFT_T -> IO Result
xrDestroySpatialAnchorMSFT' = FunPtr (Ptr SpatialAnchorMSFT_T -> IO Result)
-> Ptr SpatialAnchorMSFT_T -> IO Result
mkXrDestroySpatialAnchorMSFT FunPtr (Ptr SpatialAnchorMSFT_T -> IO Result)
xrDestroySpatialAnchorMSFTPtr
Result
r <- String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "xrDestroySpatialAnchorMSFT" (Ptr SpatialAnchorMSFT_T -> IO Result
xrDestroySpatialAnchorMSFT' (SpatialAnchorMSFT -> Ptr SpatialAnchorMSFT_T
spatialAnchorMSFTHandle (SpatialAnchorMSFT
anchor)))
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) (OpenXrException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (Result -> OpenXrException
OpenXrException Result
r))
data SpatialAnchorCreateInfoMSFT = SpatialAnchorCreateInfoMSFT
{
SpatialAnchorCreateInfoMSFT -> Ptr Space_T
space :: Ptr Space_T
,
SpatialAnchorCreateInfoMSFT -> Posef
pose :: Posef
,
SpatialAnchorCreateInfoMSFT -> Time
time :: Time
}
deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (SpatialAnchorCreateInfoMSFT)
#endif
deriving instance Show SpatialAnchorCreateInfoMSFT
instance ToCStruct SpatialAnchorCreateInfoMSFT where
withCStruct :: SpatialAnchorCreateInfoMSFT
-> (Ptr SpatialAnchorCreateInfoMSFT -> IO b) -> IO b
withCStruct x :: SpatialAnchorCreateInfoMSFT
x f :: Ptr SpatialAnchorCreateInfoMSFT -> IO b
f = Int -> Int -> (Ptr SpatialAnchorCreateInfoMSFT -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 64 8 ((Ptr SpatialAnchorCreateInfoMSFT -> IO b) -> IO b)
-> (Ptr SpatialAnchorCreateInfoMSFT -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr SpatialAnchorCreateInfoMSFT
p -> Ptr SpatialAnchorCreateInfoMSFT
-> SpatialAnchorCreateInfoMSFT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr SpatialAnchorCreateInfoMSFT
p SpatialAnchorCreateInfoMSFT
x (Ptr SpatialAnchorCreateInfoMSFT -> IO b
f Ptr SpatialAnchorCreateInfoMSFT
p)
pokeCStruct :: Ptr SpatialAnchorCreateInfoMSFT
-> SpatialAnchorCreateInfoMSFT -> IO b -> IO b
pokeCStruct p :: Ptr SpatialAnchorCreateInfoMSFT
p SpatialAnchorCreateInfoMSFT{..} f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SpatialAnchorCreateInfoMSFT
p Ptr SpatialAnchorCreateInfoMSFT -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
TYPE_SPATIAL_ANCHOR_CREATE_INFO_MSFT)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SpatialAnchorCreateInfoMSFT
p Ptr SpatialAnchorCreateInfoMSFT -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
("space" ::: Ptr (Ptr Space_T)) -> Ptr Space_T -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SpatialAnchorCreateInfoMSFT
p Ptr SpatialAnchorCreateInfoMSFT
-> Int -> "space" ::: Ptr (Ptr Space_T)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr (Ptr Space_T))) (Ptr Space_T
space)
Ptr Posef -> Posef -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SpatialAnchorCreateInfoMSFT
p Ptr SpatialAnchorCreateInfoMSFT -> Int -> Ptr Posef
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr Posef)) (Posef
pose)
Ptr Time -> Time -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SpatialAnchorCreateInfoMSFT
p Ptr SpatialAnchorCreateInfoMSFT -> Int -> Ptr Time
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 56 :: Ptr Time)) (Time
time)
IO b
f
cStructSize :: Int
cStructSize = 64
cStructAlignment :: Int
cStructAlignment = 8
pokeZeroCStruct :: Ptr SpatialAnchorCreateInfoMSFT -> IO b -> IO b
pokeZeroCStruct p :: Ptr SpatialAnchorCreateInfoMSFT
p f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SpatialAnchorCreateInfoMSFT
p Ptr SpatialAnchorCreateInfoMSFT -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
TYPE_SPATIAL_ANCHOR_CREATE_INFO_MSFT)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SpatialAnchorCreateInfoMSFT
p Ptr SpatialAnchorCreateInfoMSFT -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
("space" ::: Ptr (Ptr Space_T)) -> Ptr Space_T -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SpatialAnchorCreateInfoMSFT
p Ptr SpatialAnchorCreateInfoMSFT
-> Int -> "space" ::: Ptr (Ptr Space_T)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr (Ptr Space_T))) (Ptr Space_T
forall a. Zero a => a
zero)
Ptr Posef -> Posef -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SpatialAnchorCreateInfoMSFT
p Ptr SpatialAnchorCreateInfoMSFT -> Int -> Ptr Posef
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr Posef)) (Posef
forall a. Zero a => a
zero)
Ptr Time -> Time -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SpatialAnchorCreateInfoMSFT
p Ptr SpatialAnchorCreateInfoMSFT -> Int -> Ptr Time
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 56 :: Ptr Time)) (Time
forall a. Zero a => a
zero)
IO b
f
instance FromCStruct SpatialAnchorCreateInfoMSFT where
peekCStruct :: Ptr SpatialAnchorCreateInfoMSFT -> IO SpatialAnchorCreateInfoMSFT
peekCStruct p :: Ptr SpatialAnchorCreateInfoMSFT
p = do
Ptr Space_T
space <- ("space" ::: Ptr (Ptr Space_T)) -> IO (Ptr Space_T)
forall a. Storable a => Ptr a -> IO a
peek @(Ptr Space_T) ((Ptr SpatialAnchorCreateInfoMSFT
p Ptr SpatialAnchorCreateInfoMSFT
-> Int -> "space" ::: Ptr (Ptr Space_T)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr (Ptr Space_T)))
Posef
pose <- Ptr Posef -> IO Posef
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @Posef ((Ptr SpatialAnchorCreateInfoMSFT
p Ptr SpatialAnchorCreateInfoMSFT -> Int -> Ptr Posef
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr Posef))
Time
time <- Ptr Time -> IO Time
forall a. Storable a => Ptr a -> IO a
peek @Time ((Ptr SpatialAnchorCreateInfoMSFT
p Ptr SpatialAnchorCreateInfoMSFT -> Int -> Ptr Time
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 56 :: Ptr Time))
SpatialAnchorCreateInfoMSFT -> IO SpatialAnchorCreateInfoMSFT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (SpatialAnchorCreateInfoMSFT -> IO SpatialAnchorCreateInfoMSFT)
-> SpatialAnchorCreateInfoMSFT -> IO SpatialAnchorCreateInfoMSFT
forall a b. (a -> b) -> a -> b
$ Ptr Space_T -> Posef -> Time -> SpatialAnchorCreateInfoMSFT
SpatialAnchorCreateInfoMSFT
Ptr Space_T
space Posef
pose Time
time
instance Storable SpatialAnchorCreateInfoMSFT where
sizeOf :: SpatialAnchorCreateInfoMSFT -> Int
sizeOf ~SpatialAnchorCreateInfoMSFT
_ = 64
alignment :: SpatialAnchorCreateInfoMSFT -> Int
alignment ~SpatialAnchorCreateInfoMSFT
_ = 8
peek :: Ptr SpatialAnchorCreateInfoMSFT -> IO SpatialAnchorCreateInfoMSFT
peek = Ptr SpatialAnchorCreateInfoMSFT -> IO SpatialAnchorCreateInfoMSFT
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: Ptr SpatialAnchorCreateInfoMSFT
-> SpatialAnchorCreateInfoMSFT -> IO ()
poke ptr :: Ptr SpatialAnchorCreateInfoMSFT
ptr poked :: SpatialAnchorCreateInfoMSFT
poked = Ptr SpatialAnchorCreateInfoMSFT
-> SpatialAnchorCreateInfoMSFT -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr SpatialAnchorCreateInfoMSFT
ptr SpatialAnchorCreateInfoMSFT
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero SpatialAnchorCreateInfoMSFT where
zero :: SpatialAnchorCreateInfoMSFT
zero = Ptr Space_T -> Posef -> Time -> SpatialAnchorCreateInfoMSFT
SpatialAnchorCreateInfoMSFT
Ptr Space_T
forall a. Zero a => a
zero
Posef
forall a. Zero a => a
zero
Time
forall a. Zero a => a
zero
data SpatialAnchorSpaceCreateInfoMSFT = SpatialAnchorSpaceCreateInfoMSFT
{
SpatialAnchorSpaceCreateInfoMSFT -> Ptr SpatialAnchorMSFT_T
anchor :: Ptr SpatialAnchorMSFT_T
,
SpatialAnchorSpaceCreateInfoMSFT -> Posef
poseInAnchorSpace :: Posef
}
deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (SpatialAnchorSpaceCreateInfoMSFT)
#endif
deriving instance Show SpatialAnchorSpaceCreateInfoMSFT
instance ToCStruct SpatialAnchorSpaceCreateInfoMSFT where
withCStruct :: SpatialAnchorSpaceCreateInfoMSFT
-> (Ptr SpatialAnchorSpaceCreateInfoMSFT -> IO b) -> IO b
withCStruct x :: SpatialAnchorSpaceCreateInfoMSFT
x f :: Ptr SpatialAnchorSpaceCreateInfoMSFT -> IO b
f = Int
-> Int -> (Ptr SpatialAnchorSpaceCreateInfoMSFT -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 56 8 ((Ptr SpatialAnchorSpaceCreateInfoMSFT -> IO b) -> IO b)
-> (Ptr SpatialAnchorSpaceCreateInfoMSFT -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr SpatialAnchorSpaceCreateInfoMSFT
p -> Ptr SpatialAnchorSpaceCreateInfoMSFT
-> SpatialAnchorSpaceCreateInfoMSFT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr SpatialAnchorSpaceCreateInfoMSFT
p SpatialAnchorSpaceCreateInfoMSFT
x (Ptr SpatialAnchorSpaceCreateInfoMSFT -> IO b
f Ptr SpatialAnchorSpaceCreateInfoMSFT
p)
pokeCStruct :: Ptr SpatialAnchorSpaceCreateInfoMSFT
-> SpatialAnchorSpaceCreateInfoMSFT -> IO b -> IO b
pokeCStruct p :: Ptr SpatialAnchorSpaceCreateInfoMSFT
p SpatialAnchorSpaceCreateInfoMSFT{..} f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SpatialAnchorSpaceCreateInfoMSFT
p Ptr SpatialAnchorSpaceCreateInfoMSFT -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
TYPE_SPATIAL_ANCHOR_SPACE_CREATE_INFO_MSFT)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SpatialAnchorSpaceCreateInfoMSFT
p Ptr SpatialAnchorSpaceCreateInfoMSFT -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
("anchor" ::: Ptr (Ptr SpatialAnchorMSFT_T))
-> Ptr SpatialAnchorMSFT_T -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SpatialAnchorSpaceCreateInfoMSFT
p Ptr SpatialAnchorSpaceCreateInfoMSFT
-> Int -> "anchor" ::: Ptr (Ptr SpatialAnchorMSFT_T)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr (Ptr SpatialAnchorMSFT_T))) (Ptr SpatialAnchorMSFT_T
anchor)
Ptr Posef -> Posef -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SpatialAnchorSpaceCreateInfoMSFT
p Ptr SpatialAnchorSpaceCreateInfoMSFT -> Int -> Ptr Posef
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr Posef)) (Posef
poseInAnchorSpace)
IO b
f
cStructSize :: Int
cStructSize = 56
cStructAlignment :: Int
cStructAlignment = 8
pokeZeroCStruct :: Ptr SpatialAnchorSpaceCreateInfoMSFT -> IO b -> IO b
pokeZeroCStruct p :: Ptr SpatialAnchorSpaceCreateInfoMSFT
p f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SpatialAnchorSpaceCreateInfoMSFT
p Ptr SpatialAnchorSpaceCreateInfoMSFT -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
TYPE_SPATIAL_ANCHOR_SPACE_CREATE_INFO_MSFT)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SpatialAnchorSpaceCreateInfoMSFT
p Ptr SpatialAnchorSpaceCreateInfoMSFT -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
("anchor" ::: Ptr (Ptr SpatialAnchorMSFT_T))
-> Ptr SpatialAnchorMSFT_T -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SpatialAnchorSpaceCreateInfoMSFT
p Ptr SpatialAnchorSpaceCreateInfoMSFT
-> Int -> "anchor" ::: Ptr (Ptr SpatialAnchorMSFT_T)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr (Ptr SpatialAnchorMSFT_T))) (Ptr SpatialAnchorMSFT_T
forall a. Zero a => a
zero)
Ptr Posef -> Posef -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SpatialAnchorSpaceCreateInfoMSFT
p Ptr SpatialAnchorSpaceCreateInfoMSFT -> Int -> Ptr Posef
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr Posef)) (Posef
forall a. Zero a => a
zero)
IO b
f
instance FromCStruct SpatialAnchorSpaceCreateInfoMSFT where
peekCStruct :: Ptr SpatialAnchorSpaceCreateInfoMSFT
-> IO SpatialAnchorSpaceCreateInfoMSFT
peekCStruct p :: Ptr SpatialAnchorSpaceCreateInfoMSFT
p = do
Ptr SpatialAnchorMSFT_T
anchor <- ("anchor" ::: Ptr (Ptr SpatialAnchorMSFT_T))
-> IO (Ptr SpatialAnchorMSFT_T)
forall a. Storable a => Ptr a -> IO a
peek @(Ptr SpatialAnchorMSFT_T) ((Ptr SpatialAnchorSpaceCreateInfoMSFT
p Ptr SpatialAnchorSpaceCreateInfoMSFT
-> Int -> "anchor" ::: Ptr (Ptr SpatialAnchorMSFT_T)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr (Ptr SpatialAnchorMSFT_T)))
Posef
poseInAnchorSpace <- Ptr Posef -> IO Posef
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @Posef ((Ptr SpatialAnchorSpaceCreateInfoMSFT
p Ptr SpatialAnchorSpaceCreateInfoMSFT -> Int -> Ptr Posef
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr Posef))
SpatialAnchorSpaceCreateInfoMSFT
-> IO SpatialAnchorSpaceCreateInfoMSFT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (SpatialAnchorSpaceCreateInfoMSFT
-> IO SpatialAnchorSpaceCreateInfoMSFT)
-> SpatialAnchorSpaceCreateInfoMSFT
-> IO SpatialAnchorSpaceCreateInfoMSFT
forall a b. (a -> b) -> a -> b
$ Ptr SpatialAnchorMSFT_T
-> Posef -> SpatialAnchorSpaceCreateInfoMSFT
SpatialAnchorSpaceCreateInfoMSFT
Ptr SpatialAnchorMSFT_T
anchor Posef
poseInAnchorSpace
instance Storable SpatialAnchorSpaceCreateInfoMSFT where
sizeOf :: SpatialAnchorSpaceCreateInfoMSFT -> Int
sizeOf ~SpatialAnchorSpaceCreateInfoMSFT
_ = 56
alignment :: SpatialAnchorSpaceCreateInfoMSFT -> Int
alignment ~SpatialAnchorSpaceCreateInfoMSFT
_ = 8
peek :: Ptr SpatialAnchorSpaceCreateInfoMSFT
-> IO SpatialAnchorSpaceCreateInfoMSFT
peek = Ptr SpatialAnchorSpaceCreateInfoMSFT
-> IO SpatialAnchorSpaceCreateInfoMSFT
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: Ptr SpatialAnchorSpaceCreateInfoMSFT
-> SpatialAnchorSpaceCreateInfoMSFT -> IO ()
poke ptr :: Ptr SpatialAnchorSpaceCreateInfoMSFT
ptr poked :: SpatialAnchorSpaceCreateInfoMSFT
poked = Ptr SpatialAnchorSpaceCreateInfoMSFT
-> SpatialAnchorSpaceCreateInfoMSFT -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr SpatialAnchorSpaceCreateInfoMSFT
ptr SpatialAnchorSpaceCreateInfoMSFT
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero SpatialAnchorSpaceCreateInfoMSFT where
zero :: SpatialAnchorSpaceCreateInfoMSFT
zero = Ptr SpatialAnchorMSFT_T
-> Posef -> SpatialAnchorSpaceCreateInfoMSFT
SpatialAnchorSpaceCreateInfoMSFT
Ptr SpatialAnchorMSFT_T
forall a. Zero a => a
zero
Posef
forall a. Zero a => a
zero
type MSFT_spatial_anchor_SPEC_VERSION = 1
pattern MSFT_spatial_anchor_SPEC_VERSION :: forall a . Integral a => a
pattern $bMSFT_spatial_anchor_SPEC_VERSION :: a
$mMSFT_spatial_anchor_SPEC_VERSION :: forall r a. Integral a => a -> (Void# -> r) -> (Void# -> r) -> r
MSFT_spatial_anchor_SPEC_VERSION = 1
type MSFT_SPATIAL_ANCHOR_EXTENSION_NAME = "XR_MSFT_spatial_anchor"
pattern MSFT_SPATIAL_ANCHOR_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bMSFT_SPATIAL_ANCHOR_EXTENSION_NAME :: a
$mMSFT_SPATIAL_ANCHOR_EXTENSION_NAME :: forall r a.
(Eq a, IsString a) =>
a -> (Void# -> r) -> (Void# -> r) -> r
MSFT_SPATIAL_ANCHOR_EXTENSION_NAME = "XR_MSFT_spatial_anchor"