{-# language CPP #-}
-- | = Name
--
-- XR_MSFT_controller_model - instance extension
--
-- = Specification
--
-- See
-- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XR_MSFT_controller_model  XR_MSFT_controller_model>
-- in the main specification for complete information.
--
-- = Registered Extension Number
--
-- 56
--
-- = Revision
--
-- 2
--
-- = Extension and Version Dependencies
--
-- -   Requires OpenXR 1.0
--
-- = See Also
--
-- 'MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT',
-- 'OpenXR.Core10.APIConstants.NULL_CONTROLLER_MODEL_KEY_MSFT',
-- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrControllerModelKeyMSFT >,
-- 'ControllerModelKeyStateMSFT', 'ControllerModelNodePropertiesMSFT',
-- 'ControllerModelNodeStateMSFT', 'ControllerModelPropertiesMSFT',
-- 'ControllerModelStateMSFT', 'getControllerModelKeyMSFT',
-- 'getControllerModelPropertiesMSFT', 'getControllerModelStateMSFT',
-- 'loadControllerModelMSFT'
--
-- = Document Notes
--
-- For more information, see the
-- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XR_MSFT_controller_model OpenXR Specification>
--
-- This page is a generated document. Fixes and changes should be made to
-- the generator scripts, not directly.
module OpenXR.Extensions.XR_MSFT_controller_model  ( getControllerModelKeyMSFT
                                                   , loadControllerModelMSFT
                                                   , getControllerModelPropertiesMSFT
                                                   , getControllerModelStateMSFT
                                                   , ControllerModelKeyMSFT(..)
                                                   , ControllerModelKeyStateMSFT(..)
                                                   , ControllerModelNodePropertiesMSFT(..)
                                                   , ControllerModelPropertiesMSFT(..)
                                                   , ControllerModelNodeStateMSFT(..)
                                                   , ControllerModelStateMSFT(..)
                                                   , MSFT_controller_model_SPEC_VERSION
                                                   , pattern MSFT_controller_model_SPEC_VERSION
                                                   , MSFT_CONTROLLER_MODEL_EXTENSION_NAME
                                                   , pattern MSFT_CONTROLLER_MODEL_EXTENSION_NAME
                                                   , MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT
                                                   , pattern MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT
                                                   , NULL_CONTROLLER_MODEL_KEY_MSFT
                                                   , pattern NULL_CONTROLLER_MODEL_KEY_MSFT
                                                   ) where

import OpenXR.CStruct.Utils (FixedArray)
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 GHC.Show (showParen)
import Numeric (showHex)
import Data.ByteString (packCString)
import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Cont (evalContT)
import Data.Vector (generateM)
import OpenXR.CStruct (FromCStruct)
import OpenXR.CStruct (FromCStruct(..))
import OpenXR.CStruct (ToCStruct)
import OpenXR.CStruct (ToCStruct(..))
import OpenXR.Zero (Zero)
import OpenXR.Zero (Zero(..))
import Control.Monad.IO.Class (MonadIO)
import Data.String (IsString)
import Data.Typeable (Typeable)
import Foreign.C.Types (CChar)
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.Word (Word32)
import Data.Word (Word64)
import Data.Word (Word8)
import Data.ByteString (ByteString)
import Data.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Data.Vector (Vector)
import OpenXR.CStruct.Utils (advancePtrBytes)
import OpenXR.CStruct.Utils (lowerArrayPtr)
import OpenXR.CStruct.Utils (pokeFixedLengthNullTerminatedByteString)
import OpenXR.NamedType ((:::))
import OpenXR.Dynamic (InstanceCmds(pXrGetControllerModelKeyMSFT))
import OpenXR.Dynamic (InstanceCmds(pXrGetControllerModelPropertiesMSFT))
import OpenXR.Dynamic (InstanceCmds(pXrGetControllerModelStateMSFT))
import OpenXR.Dynamic (InstanceCmds(pXrLoadControllerModelMSFT))
import OpenXR.Exception (OpenXrException(..))
import OpenXR.Core10.SemanticPaths (Path)
import OpenXR.Core10.SemanticPaths (Path(..))
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.Enums.StructureType (StructureType)
import OpenXR.Core10.Enums.Result (Result(SUCCESS))
import OpenXR.Core10.Enums.StructureType (StructureType(TYPE_CONTROLLER_MODEL_KEY_STATE_MSFT))
import OpenXR.Core10.Enums.StructureType (StructureType(TYPE_CONTROLLER_MODEL_NODE_PROPERTIES_MSFT))
import OpenXR.Core10.Enums.StructureType (StructureType(TYPE_CONTROLLER_MODEL_NODE_STATE_MSFT))
import OpenXR.Core10.Enums.StructureType (StructureType(TYPE_CONTROLLER_MODEL_PROPERTIES_MSFT))
import OpenXR.Core10.Enums.StructureType (StructureType(TYPE_CONTROLLER_MODEL_STATE_MSFT))
import OpenXR.Core10.APIConstants (NULL_CONTROLLER_MODEL_KEY_MSFT)
import OpenXR.Core10.APIConstants (pattern NULL_CONTROLLER_MODEL_KEY_MSFT)
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkXrGetControllerModelKeyMSFT
  :: FunPtr (Ptr Session_T -> Path -> Ptr ControllerModelKeyStateMSFT -> IO Result) -> Ptr Session_T -> Path -> Ptr ControllerModelKeyStateMSFT -> IO Result

-- | xrGetControllerModelKeyMSFT - Retrieve the model key for the controller
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-xrGetControllerModelKeyMSFT-extension-notenabled# The @@
--     extension /must/ be enabled prior to calling
--     'getControllerModelKeyMSFT'
--
-- -   #VUID-xrGetControllerModelKeyMSFT-session-parameter# @session@
--     /must/ be a valid 'OpenXR.Core10.Handles.Session' handle
--
-- -   #VUID-xrGetControllerModelKeyMSFT-controllerModelKeyState-parameter#
--     @controllerModelKeyState@ /must/ be a pointer to an
--     'ControllerModelKeyStateMSFT' structure
--
-- == Return Codes
--
-- [<https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#fundamentals-successcodes Success>]
--
--     -   'OpenXR.Core10.Enums.Result.SUCCESS'
--
-- [<https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#fundamentals-errorcodes Failure>]
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_INSTANCE_LOST'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_OUT_OF_MEMORY'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_FUNCTION_UNSUPPORTED'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_VALIDATION_FAILURE'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_CONTROLLER_MODEL_KEY_INVALID_MSFT'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_HANDLE_INVALID'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_SESSION_LOST'
--
--     -   'OpenXR.Core10.Enums.Result.SESSION_LOSS_PENDING'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_PATH_UNSUPPORTED'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_PATH_INVALID'
--
-- = See Also
--
-- 'ControllerModelKeyStateMSFT',
-- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrPath >,
-- 'OpenXR.Core10.Handles.Session'
getControllerModelKeyMSFT :: forall io
                           . (MonadIO io)
                          => -- | @session@ is the specified 'OpenXR.Core10.Handles.Session'.
                             Session
                          -> -- | @topLevelUserPath@ is the top level user path corresponding to the
                             -- controller render model being queried (e.g. \/user\/hand\/left or
                             -- \/user\/hand\/right).
                             ("topLevelUserPath" ::: Path)
                          -> io (ControllerModelKeyStateMSFT)
getControllerModelKeyMSFT :: Session
-> ("topLevelUserPath" ::: Path) -> io ControllerModelKeyStateMSFT
getControllerModelKeyMSFT session :: Session
session topLevelUserPath :: "topLevelUserPath" ::: Path
topLevelUserPath = IO ControllerModelKeyStateMSFT -> io ControllerModelKeyStateMSFT
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ControllerModelKeyStateMSFT -> io ControllerModelKeyStateMSFT)
-> (ContT
      ControllerModelKeyStateMSFT IO ControllerModelKeyStateMSFT
    -> IO ControllerModelKeyStateMSFT)
-> ContT ControllerModelKeyStateMSFT IO ControllerModelKeyStateMSFT
-> io ControllerModelKeyStateMSFT
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT ControllerModelKeyStateMSFT IO ControllerModelKeyStateMSFT
-> IO ControllerModelKeyStateMSFT
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT ControllerModelKeyStateMSFT IO ControllerModelKeyStateMSFT
 -> io ControllerModelKeyStateMSFT)
-> ContT ControllerModelKeyStateMSFT IO ControllerModelKeyStateMSFT
-> io ControllerModelKeyStateMSFT
forall a b. (a -> b) -> a -> b
$ do
  let xrGetControllerModelKeyMSFTPtr :: FunPtr
  (Ptr Session_T
   -> ("topLevelUserPath" ::: Path)
   -> Ptr ControllerModelKeyStateMSFT
   -> IO Result)
xrGetControllerModelKeyMSFTPtr = InstanceCmds
-> FunPtr
     (Ptr Session_T
      -> ("topLevelUserPath" ::: Path)
      -> Ptr ControllerModelKeyStateMSFT
      -> IO Result)
pXrGetControllerModelKeyMSFT (Session -> InstanceCmds
instanceCmds (Session
session :: Session))
  IO () -> ContT ControllerModelKeyStateMSFT IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT ControllerModelKeyStateMSFT IO ())
-> IO () -> ContT ControllerModelKeyStateMSFT IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr Session_T
   -> ("topLevelUserPath" ::: Path)
   -> Ptr ControllerModelKeyStateMSFT
   -> IO Result)
xrGetControllerModelKeyMSFTPtr FunPtr
  (Ptr Session_T
   -> ("topLevelUserPath" ::: Path)
   -> Ptr ControllerModelKeyStateMSFT
   -> IO Result)
-> FunPtr
     (Ptr Session_T
      -> ("topLevelUserPath" ::: Path)
      -> Ptr ControllerModelKeyStateMSFT
      -> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr Session_T
   -> ("topLevelUserPath" ::: Path)
   -> Ptr ControllerModelKeyStateMSFT
   -> 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 xrGetControllerModelKeyMSFT is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let xrGetControllerModelKeyMSFT' :: Ptr Session_T
-> ("topLevelUserPath" ::: Path)
-> Ptr ControllerModelKeyStateMSFT
-> IO Result
xrGetControllerModelKeyMSFT' = FunPtr
  (Ptr Session_T
   -> ("topLevelUserPath" ::: Path)
   -> Ptr ControllerModelKeyStateMSFT
   -> IO Result)
-> Ptr Session_T
-> ("topLevelUserPath" ::: Path)
-> Ptr ControllerModelKeyStateMSFT
-> IO Result
mkXrGetControllerModelKeyMSFT FunPtr
  (Ptr Session_T
   -> ("topLevelUserPath" ::: Path)
   -> Ptr ControllerModelKeyStateMSFT
   -> IO Result)
xrGetControllerModelKeyMSFTPtr
  Ptr ControllerModelKeyStateMSFT
pControllerModelKeyState <- ((Ptr ControllerModelKeyStateMSFT
  -> IO ControllerModelKeyStateMSFT)
 -> IO ControllerModelKeyStateMSFT)
-> ContT
     ControllerModelKeyStateMSFT IO (Ptr ControllerModelKeyStateMSFT)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (forall b.
ToCStruct ControllerModelKeyStateMSFT =>
(Ptr ControllerModelKeyStateMSFT -> IO b) -> IO b
forall a b. ToCStruct a => (Ptr a -> IO b) -> IO b
withZeroCStruct @ControllerModelKeyStateMSFT)
  Result
r <- IO Result -> ContT ControllerModelKeyStateMSFT IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result -> ContT ControllerModelKeyStateMSFT IO Result)
-> IO Result -> ContT ControllerModelKeyStateMSFT IO Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "xrGetControllerModelKeyMSFT" (Ptr Session_T
-> ("topLevelUserPath" ::: Path)
-> Ptr ControllerModelKeyStateMSFT
-> IO Result
xrGetControllerModelKeyMSFT' (Session -> Ptr Session_T
sessionHandle (Session
session)) ("topLevelUserPath" ::: Path
topLevelUserPath) (Ptr ControllerModelKeyStateMSFT
pControllerModelKeyState))
  IO () -> ContT ControllerModelKeyStateMSFT IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT ControllerModelKeyStateMSFT IO ())
-> IO () -> ContT ControllerModelKeyStateMSFT 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))
  ControllerModelKeyStateMSFT
controllerModelKeyState <- IO ControllerModelKeyStateMSFT
-> ContT ControllerModelKeyStateMSFT IO ControllerModelKeyStateMSFT
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ControllerModelKeyStateMSFT
 -> ContT
      ControllerModelKeyStateMSFT IO ControllerModelKeyStateMSFT)
-> IO ControllerModelKeyStateMSFT
-> ContT ControllerModelKeyStateMSFT IO ControllerModelKeyStateMSFT
forall a b. (a -> b) -> a -> b
$ Ptr ControllerModelKeyStateMSFT -> IO ControllerModelKeyStateMSFT
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @ControllerModelKeyStateMSFT Ptr ControllerModelKeyStateMSFT
pControllerModelKeyState
  ControllerModelKeyStateMSFT
-> ContT ControllerModelKeyStateMSFT IO ControllerModelKeyStateMSFT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ControllerModelKeyStateMSFT
 -> ContT
      ControllerModelKeyStateMSFT IO ControllerModelKeyStateMSFT)
-> ControllerModelKeyStateMSFT
-> ContT ControllerModelKeyStateMSFT IO ControllerModelKeyStateMSFT
forall a b. (a -> b) -> a -> b
$ (ControllerModelKeyStateMSFT
controllerModelKeyState)


foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkXrLoadControllerModelMSFT
  :: FunPtr (Ptr Session_T -> ControllerModelKeyMSFT -> Word32 -> Ptr Word32 -> Ptr Word8 -> IO Result) -> Ptr Session_T -> ControllerModelKeyMSFT -> Word32 -> Ptr Word32 -> Ptr Word8 -> IO Result

-- | xrLoadControllerModelMSFT - Load controller render model
--
-- == Parameter Descriptions
--
-- -   @session@ is the specified 'OpenXR.Core10.Handles.Session'.
--
-- -   @modelKey@ is the model key corresponding to the controller render
--     model being queried.
--
-- -   @bufferCapacityInput@ is the capacity of the @buffer@ array, or 0 to
--     indicate a request to retrieve the required capacity.
--
-- -   @bufferCountOutput@ filled in by the runtime with the count of
--     elements in @buffer@ array, or returns the required capacity in the
--     case that @bufferCapacityInput@ is 0.
--
-- -   @buffer@ is a pointer to an application-allocated array of the model
--     for the device that will be filled with the @uint8_t@ values by the
--     runtime. It /can/ be @NULL@ if @bufferCapacityInput@ is 0.
--
-- -   See
--     <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#buffer-size-parameters Buffer Size Parameters>
--     chapter for a detailed description of retrieving the required
--     @buffer@ size.
--
-- = Description
--
-- The 'loadControllerModelMSFT' function /may/ be a slow operation and
-- therefore /should/ be invoked from a non-timing critical thread.
--
-- If the input @modelKey@ is invalid, i.e. it is
-- 'OpenXR.Core10.APIConstants.NULL_CONTROLLER_MODEL_KEY_MSFT' or not a key
-- returned from 'ControllerModelKeyStateMSFT', the runtime /must/ return
-- 'OpenXR.Core10.Enums.Result.ERROR_CONTROLLER_MODEL_KEY_INVALID_MSFT'.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-xrLoadControllerModelMSFT-extension-notenabled# The @@
--     extension /must/ be enabled prior to calling
--     'loadControllerModelMSFT'
--
-- -   #VUID-xrLoadControllerModelMSFT-session-parameter# @session@ /must/
--     be a valid 'OpenXR.Core10.Handles.Session' handle
--
-- -   #VUID-xrLoadControllerModelMSFT-bufferCountOutput-parameter#
--     @bufferCountOutput@ /must/ be a pointer to a @uint32_t@ value
--
-- -   #VUID-xrLoadControllerModelMSFT-buffer-parameter# If
--     @bufferCapacityInput@ is not @0@, @buffer@ /must/ be a pointer to an
--     array of @bufferCapacityInput@ @uint8_t@ values
--
-- == Return Codes
--
-- [<https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#fundamentals-successcodes Success>]
--
--     -   'OpenXR.Core10.Enums.Result.SUCCESS'
--
-- [<https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#fundamentals-errorcodes Failure>]
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_INSTANCE_LOST'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_OUT_OF_MEMORY'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_FUNCTION_UNSUPPORTED'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_VALIDATION_FAILURE'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_SIZE_INSUFFICIENT'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_CONTROLLER_MODEL_KEY_INVALID_MSFT'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_HANDLE_INVALID'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_SESSION_LOST'
--
--     -   'OpenXR.Core10.Enums.Result.SESSION_LOSS_PENDING'
--
-- = See Also
--
-- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrControllerModelKeyMSFT >,
-- 'OpenXR.Core10.Handles.Session'
loadControllerModelMSFT :: forall io
                         . (MonadIO io)
                        => -- No documentation found for Nested "xrLoadControllerModelMSFT" "session"
                           Session
                        -> -- No documentation found for Nested "xrLoadControllerModelMSFT" "modelKey"
                           ControllerModelKeyMSFT
                        -> io (("buffer" ::: Vector Word8))
loadControllerModelMSFT :: Session -> ControllerModelKeyMSFT -> io ("buffer" ::: Vector Word8)
loadControllerModelMSFT session :: Session
session modelKey :: ControllerModelKeyMSFT
modelKey = IO ("buffer" ::: Vector Word8) -> io ("buffer" ::: Vector Word8)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ("buffer" ::: Vector Word8) -> io ("buffer" ::: Vector Word8))
-> (ContT
      ("buffer" ::: Vector Word8) IO ("buffer" ::: Vector Word8)
    -> IO ("buffer" ::: Vector Word8))
-> ContT ("buffer" ::: Vector Word8) IO ("buffer" ::: Vector Word8)
-> io ("buffer" ::: Vector Word8)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT ("buffer" ::: Vector Word8) IO ("buffer" ::: Vector Word8)
-> IO ("buffer" ::: Vector Word8)
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT ("buffer" ::: Vector Word8) IO ("buffer" ::: Vector Word8)
 -> io ("buffer" ::: Vector Word8))
-> ContT ("buffer" ::: Vector Word8) IO ("buffer" ::: Vector Word8)
-> io ("buffer" ::: Vector Word8)
forall a b. (a -> b) -> a -> b
$ do
  let xrLoadControllerModelMSFTPtr :: FunPtr
  (Ptr Session_T
   -> ControllerModelKeyMSFT
   -> ("bufferCapacityInput" ::: Word32)
   -> ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
   -> ("buffer" ::: Ptr Word8)
   -> IO Result)
xrLoadControllerModelMSFTPtr = InstanceCmds
-> FunPtr
     (Ptr Session_T
      -> ControllerModelKeyMSFT
      -> ("bufferCapacityInput" ::: Word32)
      -> ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
      -> ("buffer" ::: Ptr Word8)
      -> IO Result)
pXrLoadControllerModelMSFT (Session -> InstanceCmds
instanceCmds (Session
session :: Session))
  IO () -> ContT ("buffer" ::: Vector Word8) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT ("buffer" ::: Vector Word8) IO ())
-> IO () -> ContT ("buffer" ::: Vector Word8) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr Session_T
   -> ControllerModelKeyMSFT
   -> ("bufferCapacityInput" ::: Word32)
   -> ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
   -> ("buffer" ::: Ptr Word8)
   -> IO Result)
xrLoadControllerModelMSFTPtr FunPtr
  (Ptr Session_T
   -> ControllerModelKeyMSFT
   -> ("bufferCapacityInput" ::: Word32)
   -> ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
   -> ("buffer" ::: Ptr Word8)
   -> IO Result)
-> FunPtr
     (Ptr Session_T
      -> ControllerModelKeyMSFT
      -> ("bufferCapacityInput" ::: Word32)
      -> ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
      -> ("buffer" ::: Ptr Word8)
      -> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr Session_T
   -> ControllerModelKeyMSFT
   -> ("bufferCapacityInput" ::: Word32)
   -> ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
   -> ("buffer" ::: Ptr Word8)
   -> 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 xrLoadControllerModelMSFT is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let xrLoadControllerModelMSFT' :: Ptr Session_T
-> ControllerModelKeyMSFT
-> ("bufferCapacityInput" ::: Word32)
-> ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
-> ("buffer" ::: Ptr Word8)
-> IO Result
xrLoadControllerModelMSFT' = FunPtr
  (Ptr Session_T
   -> ControllerModelKeyMSFT
   -> ("bufferCapacityInput" ::: Word32)
   -> ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
   -> ("buffer" ::: Ptr Word8)
   -> IO Result)
-> Ptr Session_T
-> ControllerModelKeyMSFT
-> ("bufferCapacityInput" ::: Word32)
-> ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
-> ("buffer" ::: Ptr Word8)
-> IO Result
mkXrLoadControllerModelMSFT FunPtr
  (Ptr Session_T
   -> ControllerModelKeyMSFT
   -> ("bufferCapacityInput" ::: Word32)
   -> ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
   -> ("buffer" ::: Ptr Word8)
   -> IO Result)
xrLoadControllerModelMSFTPtr
  let session' :: Ptr Session_T
session' = Session -> Ptr Session_T
sessionHandle (Session
session)
  "bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32)
pBufferCountOutput <- ((("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
  -> IO ("buffer" ::: Vector Word8))
 -> IO ("buffer" ::: Vector Word8))
-> ContT
     ("buffer" ::: Vector Word8)
     IO
     ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
   -> IO ("buffer" ::: Vector Word8))
  -> IO ("buffer" ::: Vector Word8))
 -> ContT
      ("buffer" ::: Vector Word8)
      IO
      ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32)))
-> ((("bufferCountOutput"
      ::: Ptr ("bufferCapacityInput" ::: Word32))
     -> IO ("buffer" ::: Vector Word8))
    -> IO ("buffer" ::: Vector Word8))
-> ContT
     ("buffer" ::: Vector Word8)
     IO
     ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
forall a b. (a -> b) -> a -> b
$ IO ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
-> (("bufferCountOutput"
     ::: Ptr ("bufferCapacityInput" ::: Word32))
    -> IO ())
-> (("bufferCountOutput"
     ::: Ptr ("bufferCapacityInput" ::: Word32))
    -> IO ("buffer" ::: Vector Word8))
-> IO ("buffer" ::: Vector Word8)
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int
-> IO
     ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
forall a. Int -> IO (Ptr a)
callocBytes @Word32 4) ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
-> IO ()
forall a. Ptr a -> IO ()
free
  Result
r <- IO Result -> ContT ("buffer" ::: Vector Word8) IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result -> ContT ("buffer" ::: Vector Word8) IO Result)
-> IO Result -> ContT ("buffer" ::: Vector Word8) IO Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "xrLoadControllerModelMSFT" (Ptr Session_T
-> ControllerModelKeyMSFT
-> ("bufferCapacityInput" ::: Word32)
-> ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
-> ("buffer" ::: Ptr Word8)
-> IO Result
xrLoadControllerModelMSFT' Ptr Session_T
session' (ControllerModelKeyMSFT
modelKey) (0) ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32)
pBufferCountOutput) ("buffer" ::: Ptr Word8
forall a. Ptr a
nullPtr))
  IO () -> ContT ("buffer" ::: Vector Word8) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT ("buffer" ::: Vector Word8) IO ())
-> IO () -> ContT ("buffer" ::: Vector Word8) 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))
  "bufferCapacityInput" ::: Word32
bufferCountOutput <- IO ("bufferCapacityInput" ::: Word32)
-> ContT
     ("buffer" ::: Vector Word8) IO ("bufferCapacityInput" ::: Word32)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ("bufferCapacityInput" ::: Word32)
 -> ContT
      ("buffer" ::: Vector Word8) IO ("bufferCapacityInput" ::: Word32))
-> IO ("bufferCapacityInput" ::: Word32)
-> ContT
     ("buffer" ::: Vector Word8) IO ("bufferCapacityInput" ::: Word32)
forall a b. (a -> b) -> a -> b
$ ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
-> IO ("bufferCapacityInput" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 "bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32)
pBufferCountOutput
  "buffer" ::: Ptr Word8
pBuffer <- ((("buffer" ::: Ptr Word8) -> IO ("buffer" ::: Vector Word8))
 -> IO ("buffer" ::: Vector Word8))
-> ContT ("buffer" ::: Vector Word8) IO ("buffer" ::: Ptr Word8)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("buffer" ::: Ptr Word8) -> IO ("buffer" ::: Vector Word8))
  -> IO ("buffer" ::: Vector Word8))
 -> ContT ("buffer" ::: Vector Word8) IO ("buffer" ::: Ptr Word8))
-> ((("buffer" ::: Ptr Word8) -> IO ("buffer" ::: Vector Word8))
    -> IO ("buffer" ::: Vector Word8))
-> ContT ("buffer" ::: Vector Word8) IO ("buffer" ::: Ptr Word8)
forall a b. (a -> b) -> a -> b
$ IO ("buffer" ::: Ptr Word8)
-> (("buffer" ::: Ptr Word8) -> IO ())
-> (("buffer" ::: Ptr Word8) -> IO ("buffer" ::: Vector Word8))
-> IO ("buffer" ::: Vector Word8)
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int -> IO ("buffer" ::: Ptr Word8)
forall a. Int -> IO (Ptr a)
callocBytes @Word8 (("bufferCapacityInput" ::: Word32) -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral ("bufferCapacityInput" ::: Word32
bufferCountOutput))) ("buffer" ::: Ptr Word8) -> IO ()
forall a. Ptr a -> IO ()
free
  Result
r' <- IO Result -> ContT ("buffer" ::: Vector Word8) IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result -> ContT ("buffer" ::: Vector Word8) IO Result)
-> IO Result -> ContT ("buffer" ::: Vector Word8) IO Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "xrLoadControllerModelMSFT" (Ptr Session_T
-> ControllerModelKeyMSFT
-> ("bufferCapacityInput" ::: Word32)
-> ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
-> ("buffer" ::: Ptr Word8)
-> IO Result
xrLoadControllerModelMSFT' Ptr Session_T
session' (ControllerModelKeyMSFT
modelKey) (("bufferCapacityInput" ::: Word32
bufferCountOutput)) ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32)
pBufferCountOutput) ("buffer" ::: Ptr Word8
pBuffer))
  IO () -> ContT ("buffer" ::: Vector Word8) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT ("buffer" ::: Vector Word8) IO ())
-> IO () -> ContT ("buffer" ::: Vector Word8) 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'))
  "bufferCapacityInput" ::: Word32
bufferCountOutput' <- IO ("bufferCapacityInput" ::: Word32)
-> ContT
     ("buffer" ::: Vector Word8) IO ("bufferCapacityInput" ::: Word32)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ("bufferCapacityInput" ::: Word32)
 -> ContT
      ("buffer" ::: Vector Word8) IO ("bufferCapacityInput" ::: Word32))
-> IO ("bufferCapacityInput" ::: Word32)
-> ContT
     ("buffer" ::: Vector Word8) IO ("bufferCapacityInput" ::: Word32)
forall a b. (a -> b) -> a -> b
$ ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
-> IO ("bufferCapacityInput" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 "bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32)
pBufferCountOutput
  "buffer" ::: Vector Word8
buffer' <- IO ("buffer" ::: Vector Word8)
-> ContT ("buffer" ::: Vector Word8) IO ("buffer" ::: Vector Word8)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ("buffer" ::: Vector Word8)
 -> ContT
      ("buffer" ::: Vector Word8) IO ("buffer" ::: Vector Word8))
-> IO ("buffer" ::: Vector Word8)
-> ContT ("buffer" ::: Vector Word8) IO ("buffer" ::: Vector Word8)
forall a b. (a -> b) -> a -> b
$ Int -> (Int -> IO Word8) -> IO ("buffer" ::: Vector Word8)
forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM (("bufferCapacityInput" ::: Word32) -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral ("bufferCapacityInput" ::: Word32
bufferCountOutput')) (\i :: Int
i -> ("buffer" ::: Ptr Word8) -> IO Word8
forall a. Storable a => Ptr a -> IO a
peek @Word8 (("buffer" ::: Ptr Word8
pBuffer ("buffer" ::: Ptr Word8) -> Int -> "buffer" ::: Ptr Word8
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (1 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Word8)))
  ("buffer" ::: Vector Word8)
-> ContT ("buffer" ::: Vector Word8) IO ("buffer" ::: Vector Word8)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (("buffer" ::: Vector Word8)
 -> ContT
      ("buffer" ::: Vector Word8) IO ("buffer" ::: Vector Word8))
-> ("buffer" ::: Vector Word8)
-> ContT ("buffer" ::: Vector Word8) IO ("buffer" ::: Vector Word8)
forall a b. (a -> b) -> a -> b
$ ("buffer" ::: Vector Word8
buffer')


foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkXrGetControllerModelPropertiesMSFT
  :: FunPtr (Ptr Session_T -> ControllerModelKeyMSFT -> Ptr ControllerModelPropertiesMSFT -> IO Result) -> Ptr Session_T -> ControllerModelKeyMSFT -> Ptr ControllerModelPropertiesMSFT -> IO Result

-- | xrGetControllerModelPropertiesMSFT - Get controller model properties
--
-- == Parameter Descriptions
--
-- = Description
--
-- The runtime /must/ return the same data in
-- 'ControllerModelPropertiesMSFT' for a valid @modelKey@. Therefore, the
-- application /can/ cache the returned 'ControllerModelPropertiesMSFT'
-- using @modelKey@ and reuse the data for each frame.
--
-- If the input @modelKey@ is invalid, i.e. it is
-- 'OpenXR.Core10.APIConstants.NULL_CONTROLLER_MODEL_KEY_MSFT' or not a key
-- returned from 'ControllerModelKeyStateMSFT', the runtime /must/ return
-- 'OpenXR.Core10.Enums.Result.ERROR_CONTROLLER_MODEL_KEY_INVALID_MSFT'.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-xrGetControllerModelPropertiesMSFT-extension-notenabled# The
--     @@ extension /must/ be enabled prior to calling
--     'getControllerModelPropertiesMSFT'
--
-- -   #VUID-xrGetControllerModelPropertiesMSFT-session-parameter#
--     @session@ /must/ be a valid 'OpenXR.Core10.Handles.Session' handle
--
-- -   #VUID-xrGetControllerModelPropertiesMSFT-properties-parameter#
--     @properties@ /must/ be a pointer to an
--     'ControllerModelPropertiesMSFT' structure
--
-- == Return Codes
--
-- [<https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#fundamentals-successcodes Success>]
--
--     -   'OpenXR.Core10.Enums.Result.SUCCESS'
--
-- [<https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#fundamentals-errorcodes Failure>]
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_INSTANCE_LOST'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_OUT_OF_MEMORY'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_FUNCTION_UNSUPPORTED'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_VALIDATION_FAILURE'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_CONTROLLER_MODEL_KEY_INVALID_MSFT'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_HANDLE_INVALID'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_SESSION_LOST'
--
--     -   'OpenXR.Core10.Enums.Result.SESSION_LOSS_PENDING'
--
-- = See Also
--
-- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrControllerModelKeyMSFT >,
-- 'ControllerModelPropertiesMSFT', 'OpenXR.Core10.Handles.Session'
getControllerModelPropertiesMSFT :: forall io
                                  . (MonadIO io)
                                 => -- | @session@ is the specified 'OpenXR.Core10.Handles.Session'.
                                    Session
                                 -> -- | @modelKey@ is a valid model key obtained from
                                    -- 'ControllerModelKeyStateMSFT'
                                    ControllerModelKeyMSFT
                                 -> io (ControllerModelPropertiesMSFT)
getControllerModelPropertiesMSFT :: Session
-> ControllerModelKeyMSFT -> io ControllerModelPropertiesMSFT
getControllerModelPropertiesMSFT session :: Session
session modelKey :: ControllerModelKeyMSFT
modelKey = IO ControllerModelPropertiesMSFT
-> io ControllerModelPropertiesMSFT
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ControllerModelPropertiesMSFT
 -> io ControllerModelPropertiesMSFT)
-> (ContT
      ControllerModelPropertiesMSFT IO ControllerModelPropertiesMSFT
    -> IO ControllerModelPropertiesMSFT)
-> ContT
     ControllerModelPropertiesMSFT IO ControllerModelPropertiesMSFT
-> io ControllerModelPropertiesMSFT
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT
  ControllerModelPropertiesMSFT IO ControllerModelPropertiesMSFT
-> IO ControllerModelPropertiesMSFT
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT
   ControllerModelPropertiesMSFT IO ControllerModelPropertiesMSFT
 -> io ControllerModelPropertiesMSFT)
-> ContT
     ControllerModelPropertiesMSFT IO ControllerModelPropertiesMSFT
-> io ControllerModelPropertiesMSFT
forall a b. (a -> b) -> a -> b
$ do
  let xrGetControllerModelPropertiesMSFTPtr :: FunPtr
  (Ptr Session_T
   -> ControllerModelKeyMSFT
   -> Ptr ControllerModelPropertiesMSFT
   -> IO Result)
xrGetControllerModelPropertiesMSFTPtr = InstanceCmds
-> FunPtr
     (Ptr Session_T
      -> ControllerModelKeyMSFT
      -> Ptr ControllerModelPropertiesMSFT
      -> IO Result)
pXrGetControllerModelPropertiesMSFT (Session -> InstanceCmds
instanceCmds (Session
session :: Session))
  IO () -> ContT ControllerModelPropertiesMSFT IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT ControllerModelPropertiesMSFT IO ())
-> IO () -> ContT ControllerModelPropertiesMSFT IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr Session_T
   -> ControllerModelKeyMSFT
   -> Ptr ControllerModelPropertiesMSFT
   -> IO Result)
xrGetControllerModelPropertiesMSFTPtr FunPtr
  (Ptr Session_T
   -> ControllerModelKeyMSFT
   -> Ptr ControllerModelPropertiesMSFT
   -> IO Result)
-> FunPtr
     (Ptr Session_T
      -> ControllerModelKeyMSFT
      -> Ptr ControllerModelPropertiesMSFT
      -> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr Session_T
   -> ControllerModelKeyMSFT
   -> Ptr ControllerModelPropertiesMSFT
   -> 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 xrGetControllerModelPropertiesMSFT is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let xrGetControllerModelPropertiesMSFT' :: Ptr Session_T
-> ControllerModelKeyMSFT
-> Ptr ControllerModelPropertiesMSFT
-> IO Result
xrGetControllerModelPropertiesMSFT' = FunPtr
  (Ptr Session_T
   -> ControllerModelKeyMSFT
   -> Ptr ControllerModelPropertiesMSFT
   -> IO Result)
-> Ptr Session_T
-> ControllerModelKeyMSFT
-> Ptr ControllerModelPropertiesMSFT
-> IO Result
mkXrGetControllerModelPropertiesMSFT FunPtr
  (Ptr Session_T
   -> ControllerModelKeyMSFT
   -> Ptr ControllerModelPropertiesMSFT
   -> IO Result)
xrGetControllerModelPropertiesMSFTPtr
  Ptr ControllerModelPropertiesMSFT
pProperties <- ((Ptr ControllerModelPropertiesMSFT
  -> IO ControllerModelPropertiesMSFT)
 -> IO ControllerModelPropertiesMSFT)
-> ContT
     ControllerModelPropertiesMSFT
     IO
     (Ptr ControllerModelPropertiesMSFT)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (forall b.
ToCStruct ControllerModelPropertiesMSFT =>
(Ptr ControllerModelPropertiesMSFT -> IO b) -> IO b
forall a b. ToCStruct a => (Ptr a -> IO b) -> IO b
withZeroCStruct @ControllerModelPropertiesMSFT)
  Result
r <- IO Result -> ContT ControllerModelPropertiesMSFT IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result -> ContT ControllerModelPropertiesMSFT IO Result)
-> IO Result -> ContT ControllerModelPropertiesMSFT IO Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "xrGetControllerModelPropertiesMSFT" (Ptr Session_T
-> ControllerModelKeyMSFT
-> Ptr ControllerModelPropertiesMSFT
-> IO Result
xrGetControllerModelPropertiesMSFT' (Session -> Ptr Session_T
sessionHandle (Session
session)) (ControllerModelKeyMSFT
modelKey) (Ptr ControllerModelPropertiesMSFT
pProperties))
  IO () -> ContT ControllerModelPropertiesMSFT IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT ControllerModelPropertiesMSFT IO ())
-> IO () -> ContT ControllerModelPropertiesMSFT 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))
  ControllerModelPropertiesMSFT
properties <- IO ControllerModelPropertiesMSFT
-> ContT
     ControllerModelPropertiesMSFT IO ControllerModelPropertiesMSFT
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ControllerModelPropertiesMSFT
 -> ContT
      ControllerModelPropertiesMSFT IO ControllerModelPropertiesMSFT)
-> IO ControllerModelPropertiesMSFT
-> ContT
     ControllerModelPropertiesMSFT IO ControllerModelPropertiesMSFT
forall a b. (a -> b) -> a -> b
$ Ptr ControllerModelPropertiesMSFT
-> IO ControllerModelPropertiesMSFT
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @ControllerModelPropertiesMSFT Ptr ControllerModelPropertiesMSFT
pProperties
  ControllerModelPropertiesMSFT
-> ContT
     ControllerModelPropertiesMSFT IO ControllerModelPropertiesMSFT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ControllerModelPropertiesMSFT
 -> ContT
      ControllerModelPropertiesMSFT IO ControllerModelPropertiesMSFT)
-> ControllerModelPropertiesMSFT
-> ContT
     ControllerModelPropertiesMSFT IO ControllerModelPropertiesMSFT
forall a b. (a -> b) -> a -> b
$ (ControllerModelPropertiesMSFT
properties)


foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkXrGetControllerModelStateMSFT
  :: FunPtr (Ptr Session_T -> ControllerModelKeyMSFT -> Ptr ControllerModelStateMSFT -> IO Result) -> Ptr Session_T -> ControllerModelKeyMSFT -> Ptr ControllerModelStateMSFT -> IO Result

-- | xrGetControllerModelStateMSFT - Get controller model state
--
-- == Parameter Descriptions
--
-- = Description
--
-- The runtime /may/ return different state for a model key after each call
-- to 'OpenXR.Core10.Input.syncActions', which represents the latest state
-- of the user interactions.
--
-- If the input @modelKey@ is invalid, i.e. it is
-- 'OpenXR.Core10.APIConstants.NULL_CONTROLLER_MODEL_KEY_MSFT' or not a key
-- returned from 'ControllerModelKeyStateMSFT', the runtime /must/ return
-- 'OpenXR.Core10.Enums.Result.ERROR_CONTROLLER_MODEL_KEY_INVALID_MSFT'.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-xrGetControllerModelStateMSFT-extension-notenabled# The @@
--     extension /must/ be enabled prior to calling
--     'getControllerModelStateMSFT'
--
-- -   #VUID-xrGetControllerModelStateMSFT-session-parameter# @session@
--     /must/ be a valid 'OpenXR.Core10.Handles.Session' handle
--
-- -   #VUID-xrGetControllerModelStateMSFT-state-parameter# @state@ /must/
--     be a pointer to an 'ControllerModelStateMSFT' structure
--
-- == Return Codes
--
-- [<https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#fundamentals-successcodes Success>]
--
--     -   'OpenXR.Core10.Enums.Result.SUCCESS'
--
-- [<https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#fundamentals-errorcodes Failure>]
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_INSTANCE_LOST'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_OUT_OF_MEMORY'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_FUNCTION_UNSUPPORTED'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_VALIDATION_FAILURE'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_CONTROLLER_MODEL_KEY_INVALID_MSFT'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_HANDLE_INVALID'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_SESSION_LOST'
--
--     -   'OpenXR.Core10.Enums.Result.SESSION_LOSS_PENDING'
--
-- = See Also
--
-- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrControllerModelKeyMSFT >,
-- 'ControllerModelStateMSFT', 'OpenXR.Core10.Handles.Session'
getControllerModelStateMSFT :: forall io
                             . (MonadIO io)
                            => -- | @session@ is the specified 'OpenXR.Core10.Handles.Session'.
                               Session
                            -> -- | @modelKey@ is the model key corresponding to the controller model being
                               -- queried.
                               ControllerModelKeyMSFT
                            -> io (ControllerModelStateMSFT)
getControllerModelStateMSFT :: Session -> ControllerModelKeyMSFT -> io ControllerModelStateMSFT
getControllerModelStateMSFT session :: Session
session modelKey :: ControllerModelKeyMSFT
modelKey = IO ControllerModelStateMSFT -> io ControllerModelStateMSFT
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ControllerModelStateMSFT -> io ControllerModelStateMSFT)
-> (ContT ControllerModelStateMSFT IO ControllerModelStateMSFT
    -> IO ControllerModelStateMSFT)
-> ContT ControllerModelStateMSFT IO ControllerModelStateMSFT
-> io ControllerModelStateMSFT
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT ControllerModelStateMSFT IO ControllerModelStateMSFT
-> IO ControllerModelStateMSFT
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT ControllerModelStateMSFT IO ControllerModelStateMSFT
 -> io ControllerModelStateMSFT)
-> ContT ControllerModelStateMSFT IO ControllerModelStateMSFT
-> io ControllerModelStateMSFT
forall a b. (a -> b) -> a -> b
$ do
  let xrGetControllerModelStateMSFTPtr :: FunPtr
  (Ptr Session_T
   -> ControllerModelKeyMSFT
   -> Ptr ControllerModelStateMSFT
   -> IO Result)
xrGetControllerModelStateMSFTPtr = InstanceCmds
-> FunPtr
     (Ptr Session_T
      -> ControllerModelKeyMSFT
      -> Ptr ControllerModelStateMSFT
      -> IO Result)
pXrGetControllerModelStateMSFT (Session -> InstanceCmds
instanceCmds (Session
session :: Session))
  IO () -> ContT ControllerModelStateMSFT IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT ControllerModelStateMSFT IO ())
-> IO () -> ContT ControllerModelStateMSFT IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr Session_T
   -> ControllerModelKeyMSFT
   -> Ptr ControllerModelStateMSFT
   -> IO Result)
xrGetControllerModelStateMSFTPtr FunPtr
  (Ptr Session_T
   -> ControllerModelKeyMSFT
   -> Ptr ControllerModelStateMSFT
   -> IO Result)
-> FunPtr
     (Ptr Session_T
      -> ControllerModelKeyMSFT
      -> Ptr ControllerModelStateMSFT
      -> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr Session_T
   -> ControllerModelKeyMSFT
   -> Ptr ControllerModelStateMSFT
   -> 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 xrGetControllerModelStateMSFT is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let xrGetControllerModelStateMSFT' :: Ptr Session_T
-> ControllerModelKeyMSFT
-> Ptr ControllerModelStateMSFT
-> IO Result
xrGetControllerModelStateMSFT' = FunPtr
  (Ptr Session_T
   -> ControllerModelKeyMSFT
   -> Ptr ControllerModelStateMSFT
   -> IO Result)
-> Ptr Session_T
-> ControllerModelKeyMSFT
-> Ptr ControllerModelStateMSFT
-> IO Result
mkXrGetControllerModelStateMSFT FunPtr
  (Ptr Session_T
   -> ControllerModelKeyMSFT
   -> Ptr ControllerModelStateMSFT
   -> IO Result)
xrGetControllerModelStateMSFTPtr
  Ptr ControllerModelStateMSFT
pState <- ((Ptr ControllerModelStateMSFT -> IO ControllerModelStateMSFT)
 -> IO ControllerModelStateMSFT)
-> ContT ControllerModelStateMSFT IO (Ptr ControllerModelStateMSFT)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (forall b.
ToCStruct ControllerModelStateMSFT =>
(Ptr ControllerModelStateMSFT -> IO b) -> IO b
forall a b. ToCStruct a => (Ptr a -> IO b) -> IO b
withZeroCStruct @ControllerModelStateMSFT)
  Result
r <- IO Result -> ContT ControllerModelStateMSFT IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result -> ContT ControllerModelStateMSFT IO Result)
-> IO Result -> ContT ControllerModelStateMSFT IO Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "xrGetControllerModelStateMSFT" (Ptr Session_T
-> ControllerModelKeyMSFT
-> Ptr ControllerModelStateMSFT
-> IO Result
xrGetControllerModelStateMSFT' (Session -> Ptr Session_T
sessionHandle (Session
session)) (ControllerModelKeyMSFT
modelKey) (Ptr ControllerModelStateMSFT
pState))
  IO () -> ContT ControllerModelStateMSFT IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT ControllerModelStateMSFT IO ())
-> IO () -> ContT ControllerModelStateMSFT 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))
  ControllerModelStateMSFT
state <- IO ControllerModelStateMSFT
-> ContT ControllerModelStateMSFT IO ControllerModelStateMSFT
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ControllerModelStateMSFT
 -> ContT ControllerModelStateMSFT IO ControllerModelStateMSFT)
-> IO ControllerModelStateMSFT
-> ContT ControllerModelStateMSFT IO ControllerModelStateMSFT
forall a b. (a -> b) -> a -> b
$ Ptr ControllerModelStateMSFT -> IO ControllerModelStateMSFT
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @ControllerModelStateMSFT Ptr ControllerModelStateMSFT
pState
  ControllerModelStateMSFT
-> ContT ControllerModelStateMSFT IO ControllerModelStateMSFT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ControllerModelStateMSFT
 -> ContT ControllerModelStateMSFT IO ControllerModelStateMSFT)
-> ControllerModelStateMSFT
-> ContT ControllerModelStateMSFT IO ControllerModelStateMSFT
forall a b. (a -> b) -> a -> b
$ (ControllerModelStateMSFT
state)


-- | XrControllerModelKeyMSFT - Controller renderable model key
--
-- = Description
--
-- The controller model key used to retrieve the data for the renderable
-- controller model and associated properties and state.
--
-- = See Also
--
-- 'OpenXR.Core10.APIConstants.NULL_CONTROLLER_MODEL_KEY_MSFT',
-- 'ControllerModelKeyStateMSFT', 'getControllerModelPropertiesMSFT',
-- 'getControllerModelStateMSFT', 'loadControllerModelMSFT'
newtype ControllerModelKeyMSFT = ControllerModelKeyMSFT Word64
  deriving newtype (ControllerModelKeyMSFT -> ControllerModelKeyMSFT -> Bool
(ControllerModelKeyMSFT -> ControllerModelKeyMSFT -> Bool)
-> (ControllerModelKeyMSFT -> ControllerModelKeyMSFT -> Bool)
-> Eq ControllerModelKeyMSFT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ControllerModelKeyMSFT -> ControllerModelKeyMSFT -> Bool
$c/= :: ControllerModelKeyMSFT -> ControllerModelKeyMSFT -> Bool
== :: ControllerModelKeyMSFT -> ControllerModelKeyMSFT -> Bool
$c== :: ControllerModelKeyMSFT -> ControllerModelKeyMSFT -> Bool
Eq, Eq ControllerModelKeyMSFT
Eq ControllerModelKeyMSFT =>
(ControllerModelKeyMSFT -> ControllerModelKeyMSFT -> Ordering)
-> (ControllerModelKeyMSFT -> ControllerModelKeyMSFT -> Bool)
-> (ControllerModelKeyMSFT -> ControllerModelKeyMSFT -> Bool)
-> (ControllerModelKeyMSFT -> ControllerModelKeyMSFT -> Bool)
-> (ControllerModelKeyMSFT -> ControllerModelKeyMSFT -> Bool)
-> (ControllerModelKeyMSFT
    -> ControllerModelKeyMSFT -> ControllerModelKeyMSFT)
-> (ControllerModelKeyMSFT
    -> ControllerModelKeyMSFT -> ControllerModelKeyMSFT)
-> Ord ControllerModelKeyMSFT
ControllerModelKeyMSFT -> ControllerModelKeyMSFT -> Bool
ControllerModelKeyMSFT -> ControllerModelKeyMSFT -> Ordering
ControllerModelKeyMSFT
-> ControllerModelKeyMSFT -> ControllerModelKeyMSFT
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 :: ControllerModelKeyMSFT
-> ControllerModelKeyMSFT -> ControllerModelKeyMSFT
$cmin :: ControllerModelKeyMSFT
-> ControllerModelKeyMSFT -> ControllerModelKeyMSFT
max :: ControllerModelKeyMSFT
-> ControllerModelKeyMSFT -> ControllerModelKeyMSFT
$cmax :: ControllerModelKeyMSFT
-> ControllerModelKeyMSFT -> ControllerModelKeyMSFT
>= :: ControllerModelKeyMSFT -> ControllerModelKeyMSFT -> Bool
$c>= :: ControllerModelKeyMSFT -> ControllerModelKeyMSFT -> Bool
> :: ControllerModelKeyMSFT -> ControllerModelKeyMSFT -> Bool
$c> :: ControllerModelKeyMSFT -> ControllerModelKeyMSFT -> Bool
<= :: ControllerModelKeyMSFT -> ControllerModelKeyMSFT -> Bool
$c<= :: ControllerModelKeyMSFT -> ControllerModelKeyMSFT -> Bool
< :: ControllerModelKeyMSFT -> ControllerModelKeyMSFT -> Bool
$c< :: ControllerModelKeyMSFT -> ControllerModelKeyMSFT -> Bool
compare :: ControllerModelKeyMSFT -> ControllerModelKeyMSFT -> Ordering
$ccompare :: ControllerModelKeyMSFT -> ControllerModelKeyMSFT -> Ordering
$cp1Ord :: Eq ControllerModelKeyMSFT
Ord, Ptr b -> Int -> IO ControllerModelKeyMSFT
Ptr b -> Int -> ControllerModelKeyMSFT -> IO ()
Ptr ControllerModelKeyMSFT -> IO ControllerModelKeyMSFT
Ptr ControllerModelKeyMSFT -> Int -> IO ControllerModelKeyMSFT
Ptr ControllerModelKeyMSFT
-> Int -> ControllerModelKeyMSFT -> IO ()
Ptr ControllerModelKeyMSFT -> ControllerModelKeyMSFT -> IO ()
ControllerModelKeyMSFT -> Int
(ControllerModelKeyMSFT -> Int)
-> (ControllerModelKeyMSFT -> Int)
-> (Ptr ControllerModelKeyMSFT -> Int -> IO ControllerModelKeyMSFT)
-> (Ptr ControllerModelKeyMSFT
    -> Int -> ControllerModelKeyMSFT -> IO ())
-> (forall b. Ptr b -> Int -> IO ControllerModelKeyMSFT)
-> (forall b. Ptr b -> Int -> ControllerModelKeyMSFT -> IO ())
-> (Ptr ControllerModelKeyMSFT -> IO ControllerModelKeyMSFT)
-> (Ptr ControllerModelKeyMSFT -> ControllerModelKeyMSFT -> IO ())
-> Storable ControllerModelKeyMSFT
forall b. Ptr b -> Int -> IO ControllerModelKeyMSFT
forall b. Ptr b -> Int -> ControllerModelKeyMSFT -> 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 :: Ptr ControllerModelKeyMSFT -> ControllerModelKeyMSFT -> IO ()
$cpoke :: Ptr ControllerModelKeyMSFT -> ControllerModelKeyMSFT -> IO ()
peek :: Ptr ControllerModelKeyMSFT -> IO ControllerModelKeyMSFT
$cpeek :: Ptr ControllerModelKeyMSFT -> IO ControllerModelKeyMSFT
pokeByteOff :: Ptr b -> Int -> ControllerModelKeyMSFT -> IO ()
$cpokeByteOff :: forall b. Ptr b -> Int -> ControllerModelKeyMSFT -> IO ()
peekByteOff :: Ptr b -> Int -> IO ControllerModelKeyMSFT
$cpeekByteOff :: forall b. Ptr b -> Int -> IO ControllerModelKeyMSFT
pokeElemOff :: Ptr ControllerModelKeyMSFT
-> Int -> ControllerModelKeyMSFT -> IO ()
$cpokeElemOff :: Ptr ControllerModelKeyMSFT
-> Int -> ControllerModelKeyMSFT -> IO ()
peekElemOff :: Ptr ControllerModelKeyMSFT -> Int -> IO ControllerModelKeyMSFT
$cpeekElemOff :: Ptr ControllerModelKeyMSFT -> Int -> IO ControllerModelKeyMSFT
alignment :: ControllerModelKeyMSFT -> Int
$calignment :: ControllerModelKeyMSFT -> Int
sizeOf :: ControllerModelKeyMSFT -> Int
$csizeOf :: ControllerModelKeyMSFT -> Int
Storable, ControllerModelKeyMSFT
ControllerModelKeyMSFT -> Zero ControllerModelKeyMSFT
forall a. a -> Zero a
zero :: ControllerModelKeyMSFT
$czero :: ControllerModelKeyMSFT
Zero)
instance Show ControllerModelKeyMSFT where
  showsPrec :: Int -> ControllerModelKeyMSFT -> ShowS
showsPrec p :: Int
p (ControllerModelKeyMSFT x :: Word64
x) = Bool -> ShowS -> ShowS
showParen (Int
p Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= 11) (String -> ShowS
showString "ControllerModelKeyMSFT 0x" ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word64 -> ShowS
forall a. (Integral a, Show a) => a -> ShowS
showHex Word64
x)


-- | XrControllerModelKeyStateMSFT - The model key state for a controller
--
-- == Parameter Descriptions
--
-- = Description
--
-- The @modelKey@ value for the session represents a unique controller
-- model that can be retrieved from 'loadControllerModelMSFT' function.
-- Therefore, the application /can/ use @modelKey@ to cache the returned
-- data from 'loadControllerModelMSFT' for the session.
--
-- A @modelKey@ value of
-- 'OpenXR.Core10.APIConstants.NULL_CONTROLLER_MODEL_KEY_MSFT', represents
-- an invalid model key and indicates there is no controller model yet
-- available. The application /should/ keep calling
-- 'getControllerModelKeyMSFT' because the model /may/ become available at
-- a later point.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-XrControllerModelKeyStateMSFT-extension-notenabled# The @@
--     extension /must/ be enabled prior to using
--     'ControllerModelKeyStateMSFT'
--
-- -   #VUID-XrControllerModelKeyStateMSFT-type-type# @type@ /must/ be
--     'OpenXR.Core10.Enums.StructureType.TYPE_CONTROLLER_MODEL_KEY_STATE_MSFT'
--
-- -   #VUID-XrControllerModelKeyStateMSFT-next-next# @next@ /must/ be
--     @NULL@ or a valid pointer to the
--     <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#valid-usage-for-structure-pointer-chains next structure in a structure chain>
--
-- = See Also
--
-- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrControllerModelKeyMSFT >,
-- 'OpenXR.Core10.Enums.StructureType.StructureType',
-- 'getControllerModelKeyMSFT'
data ControllerModelKeyStateMSFT = ControllerModelKeyStateMSFT
  { -- | @modelKey@ is the model key corresponding to the controller render model
    -- being queried.
    ControllerModelKeyStateMSFT -> ControllerModelKeyMSFT
modelKey :: ControllerModelKeyMSFT }
  deriving (Typeable, ControllerModelKeyStateMSFT -> ControllerModelKeyStateMSFT -> Bool
(ControllerModelKeyStateMSFT
 -> ControllerModelKeyStateMSFT -> Bool)
-> (ControllerModelKeyStateMSFT
    -> ControllerModelKeyStateMSFT -> Bool)
-> Eq ControllerModelKeyStateMSFT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ControllerModelKeyStateMSFT -> ControllerModelKeyStateMSFT -> Bool
$c/= :: ControllerModelKeyStateMSFT -> ControllerModelKeyStateMSFT -> Bool
== :: ControllerModelKeyStateMSFT -> ControllerModelKeyStateMSFT -> Bool
$c== :: ControllerModelKeyStateMSFT -> ControllerModelKeyStateMSFT -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ControllerModelKeyStateMSFT)
#endif
deriving instance Show ControllerModelKeyStateMSFT

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

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

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

instance Zero ControllerModelKeyStateMSFT where
  zero :: ControllerModelKeyStateMSFT
zero = ControllerModelKeyMSFT -> ControllerModelKeyStateMSFT
ControllerModelKeyStateMSFT
           ControllerModelKeyMSFT
forall a. Zero a => a
zero


-- | XrControllerModelNodePropertiesMSFT - Describes the controller model
-- node properties
--
-- == Parameter Descriptions
--
-- = Description
--
-- The node can be located in the glTF node hierarchy by finding the
-- node(s) with the matching node name and parent node name. If the
-- @parentNodeName@ is empty, the matching will be solely based on the
-- @nodeName@.
--
-- If there are multiple nodes in the glTF file matches the condition
-- above, the first matching node using depth-first traversal in the glTF
-- scene /should/ be animated and the rest /should/ be ignored.
--
-- The runtime /must/ not return any @nodeName@ or @parentName@ that
-- doesn’t match any gltTF nodes in the corresponding controller model.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-XrControllerModelNodePropertiesMSFT-extension-notenabled# The
--     @@ extension /must/ be enabled prior to using
--     'ControllerModelNodePropertiesMSFT'
--
-- -   #VUID-XrControllerModelNodePropertiesMSFT-type-type# @type@ /must/
--     be
--     'OpenXR.Core10.Enums.StructureType.TYPE_CONTROLLER_MODEL_NODE_PROPERTIES_MSFT'
--
-- -   #VUID-XrControllerModelNodePropertiesMSFT-next-next# @next@ /must/
--     be @NULL@ or a valid pointer to the
--     <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#valid-usage-for-structure-pointer-chains next structure in a structure chain>
--
-- -   #VUID-XrControllerModelNodePropertiesMSFT-parentNodeName-parameter#
--     @parentNodeName@ /must/ be a null-terminated UTF-8 string whose
--     length is less than or equal to
--     XR_MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT
--
-- -   #VUID-XrControllerModelNodePropertiesMSFT-nodeName-parameter#
--     @nodeName@ /must/ be a null-terminated UTF-8 string whose length is
--     less than or equal to XR_MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT
--
-- = See Also
--
-- 'ControllerModelPropertiesMSFT',
-- 'OpenXR.Core10.Enums.StructureType.StructureType',
-- 'getControllerModelPropertiesMSFT', 'loadControllerModelMSFT'
data ControllerModelNodePropertiesMSFT = ControllerModelNodePropertiesMSFT
  { -- | @parentNodeName@ is the name of the parent node in the provided glTF
    -- file. The parent name /may/ be empty if it should not be used to locate
    -- this node.
    ControllerModelNodePropertiesMSFT -> ByteString
parentNodeName :: ByteString
  , -- | @nodeName@ is the name of this node in the provided glTF file.
    ControllerModelNodePropertiesMSFT -> ByteString
nodeName :: ByteString
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ControllerModelNodePropertiesMSFT)
#endif
deriving instance Show ControllerModelNodePropertiesMSFT

instance ToCStruct ControllerModelNodePropertiesMSFT where
  withCStruct :: ControllerModelNodePropertiesMSFT
-> (Ptr ControllerModelNodePropertiesMSFT -> IO b) -> IO b
withCStruct x :: ControllerModelNodePropertiesMSFT
x f :: Ptr ControllerModelNodePropertiesMSFT -> IO b
f = Int
-> Int -> (Ptr ControllerModelNodePropertiesMSFT -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 144 8 ((Ptr ControllerModelNodePropertiesMSFT -> IO b) -> IO b)
-> (Ptr ControllerModelNodePropertiesMSFT -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr ControllerModelNodePropertiesMSFT
p -> Ptr ControllerModelNodePropertiesMSFT
-> ControllerModelNodePropertiesMSFT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr ControllerModelNodePropertiesMSFT
p ControllerModelNodePropertiesMSFT
x (Ptr ControllerModelNodePropertiesMSFT -> IO b
f Ptr ControllerModelNodePropertiesMSFT
p)
  pokeCStruct :: Ptr ControllerModelNodePropertiesMSFT
-> ControllerModelNodePropertiesMSFT -> IO b -> IO b
pokeCStruct p :: Ptr ControllerModelNodePropertiesMSFT
p ControllerModelNodePropertiesMSFT{..} f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ControllerModelNodePropertiesMSFT
p Ptr ControllerModelNodePropertiesMSFT -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
TYPE_CONTROLLER_MODEL_NODE_PROPERTIES_MSFT)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ControllerModelNodePropertiesMSFT
p Ptr ControllerModelNodePropertiesMSFT -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr (FixedArray MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT CChar)
-> ByteString -> IO ()
forall (n :: Nat).
KnownNat n =>
Ptr (FixedArray n CChar) -> ByteString -> IO ()
pokeFixedLengthNullTerminatedByteString ((Ptr ControllerModelNodePropertiesMSFT
p Ptr ControllerModelNodePropertiesMSFT
-> Int
-> Ptr (FixedArray MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT CChar)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr (FixedArray MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT CChar))) (ByteString
parentNodeName)
    Ptr (FixedArray MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT CChar)
-> ByteString -> IO ()
forall (n :: Nat).
KnownNat n =>
Ptr (FixedArray n CChar) -> ByteString -> IO ()
pokeFixedLengthNullTerminatedByteString ((Ptr ControllerModelNodePropertiesMSFT
p Ptr ControllerModelNodePropertiesMSFT
-> Int
-> Ptr (FixedArray MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT CChar)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 80 :: Ptr (FixedArray MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT CChar))) (ByteString
nodeName)
    IO b
f
  cStructSize :: Int
cStructSize = 144
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr ControllerModelNodePropertiesMSFT -> IO b -> IO b
pokeZeroCStruct p :: Ptr ControllerModelNodePropertiesMSFT
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ControllerModelNodePropertiesMSFT
p Ptr ControllerModelNodePropertiesMSFT -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
TYPE_CONTROLLER_MODEL_NODE_PROPERTIES_MSFT)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ControllerModelNodePropertiesMSFT
p Ptr ControllerModelNodePropertiesMSFT -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr (FixedArray MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT CChar)
-> ByteString -> IO ()
forall (n :: Nat).
KnownNat n =>
Ptr (FixedArray n CChar) -> ByteString -> IO ()
pokeFixedLengthNullTerminatedByteString ((Ptr ControllerModelNodePropertiesMSFT
p Ptr ControllerModelNodePropertiesMSFT
-> Int
-> Ptr (FixedArray MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT CChar)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr (FixedArray MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT CChar))) (ByteString
forall a. Monoid a => a
mempty)
    Ptr (FixedArray MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT CChar)
-> ByteString -> IO ()
forall (n :: Nat).
KnownNat n =>
Ptr (FixedArray n CChar) -> ByteString -> IO ()
pokeFixedLengthNullTerminatedByteString ((Ptr ControllerModelNodePropertiesMSFT
p Ptr ControllerModelNodePropertiesMSFT
-> Int
-> Ptr (FixedArray MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT CChar)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 80 :: Ptr (FixedArray MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT CChar))) (ByteString
forall a. Monoid a => a
mempty)
    IO b
f

instance FromCStruct ControllerModelNodePropertiesMSFT where
  peekCStruct :: Ptr ControllerModelNodePropertiesMSFT
-> IO ControllerModelNodePropertiesMSFT
peekCStruct p :: Ptr ControllerModelNodePropertiesMSFT
p = do
    ByteString
parentNodeName <- CString -> IO ByteString
packCString (Ptr (FixedArray MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT CChar)
-> CString
forall a (n :: Nat). Ptr (FixedArray n a) -> Ptr a
lowerArrayPtr ((Ptr ControllerModelNodePropertiesMSFT
p Ptr ControllerModelNodePropertiesMSFT
-> Int
-> Ptr (FixedArray MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT CChar)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr (FixedArray MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT CChar))))
    ByteString
nodeName <- CString -> IO ByteString
packCString (Ptr (FixedArray MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT CChar)
-> CString
forall a (n :: Nat). Ptr (FixedArray n a) -> Ptr a
lowerArrayPtr ((Ptr ControllerModelNodePropertiesMSFT
p Ptr ControllerModelNodePropertiesMSFT
-> Int
-> Ptr (FixedArray MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT CChar)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 80 :: Ptr (FixedArray MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT CChar))))
    ControllerModelNodePropertiesMSFT
-> IO ControllerModelNodePropertiesMSFT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ControllerModelNodePropertiesMSFT
 -> IO ControllerModelNodePropertiesMSFT)
-> ControllerModelNodePropertiesMSFT
-> IO ControllerModelNodePropertiesMSFT
forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString -> ControllerModelNodePropertiesMSFT
ControllerModelNodePropertiesMSFT
             ByteString
parentNodeName ByteString
nodeName

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

instance Zero ControllerModelNodePropertiesMSFT where
  zero :: ControllerModelNodePropertiesMSFT
zero = ByteString -> ByteString -> ControllerModelNodePropertiesMSFT
ControllerModelNodePropertiesMSFT
           ByteString
forall a. Monoid a => a
mempty
           ByteString
forall a. Monoid a => a
mempty


-- | XrControllerModelPropertiesMSFT - Describes the properties of a
-- controller model
--
-- == Parameter Descriptions
--
-- -   @type@ is the 'OpenXR.Core10.Enums.StructureType.StructureType' of
--     this structure.
--
-- -   @next@ is @NULL@ or a pointer to the next structure in a structure
--     chain.
--
-- -   @nodeCapacityInput@ is the capacity of the @nodeProperties@ array,
--     or 0 to indicate a request to retrieve the required capacity.
--
-- -   @nodeCountOutput@ filled in by the runtime with the count of
--     elements in @nodeProperties@ array, or returns the required capacity
--     in the case that @nodeCapacityInput@ is 0.
--
-- -   @nodeProperties@ is a pointer to an application-allocated array that
--     will be filled with the 'ControllerModelNodePropertiesMSFT' values.
--     It /can/ be @NULL@ if @nodeCapacityInput@ is 0.
--
-- -   See
--     <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#buffer-size-parameters Buffer Size Parameters>
--     chapter for a detailed description of retrieving the required
--     @nodeProperties@ size.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-XrControllerModelPropertiesMSFT-extension-notenabled# The @@
--     extension /must/ be enabled prior to using
--     'ControllerModelPropertiesMSFT'
--
-- -   #VUID-XrControllerModelPropertiesMSFT-type-type# @type@ /must/ be
--     'OpenXR.Core10.Enums.StructureType.TYPE_CONTROLLER_MODEL_PROPERTIES_MSFT'
--
-- -   #VUID-XrControllerModelPropertiesMSFT-next-next# @next@ /must/ be
--     @NULL@ or a valid pointer to the
--     <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#valid-usage-for-structure-pointer-chains next structure in a structure chain>
--
-- -   #VUID-XrControllerModelPropertiesMSFT-nodeProperties-parameter# If
--     @nodeCapacityInput@ is not @0@, @nodeProperties@ /must/ be a pointer
--     to an array of @nodeCapacityInput@
--     'ControllerModelNodePropertiesMSFT' structures
--
-- = See Also
--
-- 'ControllerModelNodePropertiesMSFT',
-- 'OpenXR.Core10.Enums.StructureType.StructureType',
-- 'getControllerModelPropertiesMSFT', 'loadControllerModelMSFT'
data ControllerModelPropertiesMSFT = ControllerModelPropertiesMSFT
  { -- No documentation found for Nested "XrControllerModelPropertiesMSFT" "nodeCapacityInput"
    ControllerModelPropertiesMSFT -> "bufferCapacityInput" ::: Word32
nodeCapacityInput :: Word32
  , -- No documentation found for Nested "XrControllerModelPropertiesMSFT" "nodeCountOutput"
    ControllerModelPropertiesMSFT -> "bufferCapacityInput" ::: Word32
nodeCountOutput :: Word32
  , -- No documentation found for Nested "XrControllerModelPropertiesMSFT" "nodeProperties"
    ControllerModelPropertiesMSFT
-> Ptr ControllerModelNodePropertiesMSFT
nodeProperties :: Ptr ControllerModelNodePropertiesMSFT
  }
  deriving (Typeable, ControllerModelPropertiesMSFT
-> ControllerModelPropertiesMSFT -> Bool
(ControllerModelPropertiesMSFT
 -> ControllerModelPropertiesMSFT -> Bool)
-> (ControllerModelPropertiesMSFT
    -> ControllerModelPropertiesMSFT -> Bool)
-> Eq ControllerModelPropertiesMSFT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ControllerModelPropertiesMSFT
-> ControllerModelPropertiesMSFT -> Bool
$c/= :: ControllerModelPropertiesMSFT
-> ControllerModelPropertiesMSFT -> Bool
== :: ControllerModelPropertiesMSFT
-> ControllerModelPropertiesMSFT -> Bool
$c== :: ControllerModelPropertiesMSFT
-> ControllerModelPropertiesMSFT -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ControllerModelPropertiesMSFT)
#endif
deriving instance Show ControllerModelPropertiesMSFT

instance ToCStruct ControllerModelPropertiesMSFT where
  withCStruct :: ControllerModelPropertiesMSFT
-> (Ptr ControllerModelPropertiesMSFT -> IO b) -> IO b
withCStruct x :: ControllerModelPropertiesMSFT
x f :: Ptr ControllerModelPropertiesMSFT -> IO b
f = Int -> Int -> (Ptr ControllerModelPropertiesMSFT -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 32 8 ((Ptr ControllerModelPropertiesMSFT -> IO b) -> IO b)
-> (Ptr ControllerModelPropertiesMSFT -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr ControllerModelPropertiesMSFT
p -> Ptr ControllerModelPropertiesMSFT
-> ControllerModelPropertiesMSFT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr ControllerModelPropertiesMSFT
p ControllerModelPropertiesMSFT
x (Ptr ControllerModelPropertiesMSFT -> IO b
f Ptr ControllerModelPropertiesMSFT
p)
  pokeCStruct :: Ptr ControllerModelPropertiesMSFT
-> ControllerModelPropertiesMSFT -> IO b -> IO b
pokeCStruct p :: Ptr ControllerModelPropertiesMSFT
p ControllerModelPropertiesMSFT{..} f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ControllerModelPropertiesMSFT
p Ptr ControllerModelPropertiesMSFT -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
TYPE_CONTROLLER_MODEL_PROPERTIES_MSFT)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ControllerModelPropertiesMSFT
p Ptr ControllerModelPropertiesMSFT -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
-> ("bufferCapacityInput" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ControllerModelPropertiesMSFT
p Ptr ControllerModelPropertiesMSFT
-> Int
-> "bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Word32)) ("bufferCapacityInput" ::: Word32
nodeCapacityInput)
    ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
-> ("bufferCapacityInput" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ControllerModelPropertiesMSFT
p Ptr ControllerModelPropertiesMSFT
-> Int
-> "bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Word32)) ("bufferCapacityInput" ::: Word32
nodeCountOutput)
    Ptr (Ptr ControllerModelNodePropertiesMSFT)
-> Ptr ControllerModelNodePropertiesMSFT -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ControllerModelPropertiesMSFT
p Ptr ControllerModelPropertiesMSFT
-> Int -> Ptr (Ptr ControllerModelNodePropertiesMSFT)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr (Ptr ControllerModelNodePropertiesMSFT))) (Ptr ControllerModelNodePropertiesMSFT
nodeProperties)
    IO b
f
  cStructSize :: Int
cStructSize = 32
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr ControllerModelPropertiesMSFT -> IO b -> IO b
pokeZeroCStruct p :: Ptr ControllerModelPropertiesMSFT
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ControllerModelPropertiesMSFT
p Ptr ControllerModelPropertiesMSFT -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
TYPE_CONTROLLER_MODEL_PROPERTIES_MSFT)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ControllerModelPropertiesMSFT
p Ptr ControllerModelPropertiesMSFT -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    IO b
f

instance FromCStruct ControllerModelPropertiesMSFT where
  peekCStruct :: Ptr ControllerModelPropertiesMSFT
-> IO ControllerModelPropertiesMSFT
peekCStruct p :: Ptr ControllerModelPropertiesMSFT
p = do
    "bufferCapacityInput" ::: Word32
nodeCapacityInput <- ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
-> IO ("bufferCapacityInput" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr ControllerModelPropertiesMSFT
p Ptr ControllerModelPropertiesMSFT
-> Int
-> "bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Word32))
    "bufferCapacityInput" ::: Word32
nodeCountOutput <- ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
-> IO ("bufferCapacityInput" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr ControllerModelPropertiesMSFT
p Ptr ControllerModelPropertiesMSFT
-> Int
-> "bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Word32))
    Ptr ControllerModelNodePropertiesMSFT
nodeProperties <- Ptr (Ptr ControllerModelNodePropertiesMSFT)
-> IO (Ptr ControllerModelNodePropertiesMSFT)
forall a. Storable a => Ptr a -> IO a
peek @(Ptr ControllerModelNodePropertiesMSFT) ((Ptr ControllerModelPropertiesMSFT
p Ptr ControllerModelPropertiesMSFT
-> Int -> Ptr (Ptr ControllerModelNodePropertiesMSFT)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr (Ptr ControllerModelNodePropertiesMSFT)))
    ControllerModelPropertiesMSFT -> IO ControllerModelPropertiesMSFT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ControllerModelPropertiesMSFT -> IO ControllerModelPropertiesMSFT)
-> ControllerModelPropertiesMSFT
-> IO ControllerModelPropertiesMSFT
forall a b. (a -> b) -> a -> b
$ ("bufferCapacityInput" ::: Word32)
-> ("bufferCapacityInput" ::: Word32)
-> Ptr ControllerModelNodePropertiesMSFT
-> ControllerModelPropertiesMSFT
ControllerModelPropertiesMSFT
             "bufferCapacityInput" ::: Word32
nodeCapacityInput "bufferCapacityInput" ::: Word32
nodeCountOutput Ptr ControllerModelNodePropertiesMSFT
nodeProperties

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

instance Zero ControllerModelPropertiesMSFT where
  zero :: ControllerModelPropertiesMSFT
zero = ("bufferCapacityInput" ::: Word32)
-> ("bufferCapacityInput" ::: Word32)
-> Ptr ControllerModelNodePropertiesMSFT
-> ControllerModelPropertiesMSFT
ControllerModelPropertiesMSFT
           "bufferCapacityInput" ::: Word32
forall a. Zero a => a
zero
           "bufferCapacityInput" ::: Word32
forall a. Zero a => a
zero
           Ptr ControllerModelNodePropertiesMSFT
forall a. Zero a => a
zero


-- | XrControllerModelNodeStateMSFT - Describes the state of a node in a
-- controller model
--
-- == Parameter Descriptions
--
-- = Description
--
-- The state is corresponding to the glTF node identified by the @nodeName@
-- and @nodeParentName@ of the node property at the same array index in the
-- @nodeProperties@ in 'ControllerModelPropertiesMSFT'.
--
-- The @nodePose@ is based on the user’s interaction on the controller at
-- the latest 'OpenXR.Core10.Input.syncActions', represented as the
-- 'OpenXR.Core10.Space.Posef' of the node in it’s parent node space.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-XrControllerModelNodeStateMSFT-extension-notenabled# The @@
--     extension /must/ be enabled prior to using
--     'ControllerModelNodeStateMSFT'
--
-- -   #VUID-XrControllerModelNodeStateMSFT-type-type# @type@ /must/ be
--     'OpenXR.Core10.Enums.StructureType.TYPE_CONTROLLER_MODEL_NODE_STATE_MSFT'
--
-- -   #VUID-XrControllerModelNodeStateMSFT-next-next# @next@ /must/ be
--     @NULL@ or a valid pointer to the
--     <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#valid-usage-for-structure-pointer-chains next structure in a structure chain>
--
-- = See Also
--
-- 'ControllerModelStateMSFT', 'OpenXR.Core10.Space.Posef',
-- 'OpenXR.Core10.Enums.StructureType.StructureType',
-- 'getControllerModelStateMSFT'
data ControllerModelNodeStateMSFT = ControllerModelNodeStateMSFT
  { -- | @nodePose@ is an 'OpenXR.Core10.Space.Posef' of the node in its parent
    -- node space.
    ControllerModelNodeStateMSFT -> Posef
nodePose :: Posef }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ControllerModelNodeStateMSFT)
#endif
deriving instance Show ControllerModelNodeStateMSFT

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

instance FromCStruct ControllerModelNodeStateMSFT where
  peekCStruct :: Ptr ControllerModelNodeStateMSFT -> IO ControllerModelNodeStateMSFT
peekCStruct p :: Ptr ControllerModelNodeStateMSFT
p = do
    Posef
nodePose <- Ptr Posef -> IO Posef
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @Posef ((Ptr ControllerModelNodeStateMSFT
p Ptr ControllerModelNodeStateMSFT -> Int -> Ptr Posef
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Posef))
    ControllerModelNodeStateMSFT -> IO ControllerModelNodeStateMSFT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ControllerModelNodeStateMSFT -> IO ControllerModelNodeStateMSFT)
-> ControllerModelNodeStateMSFT -> IO ControllerModelNodeStateMSFT
forall a b. (a -> b) -> a -> b
$ Posef -> ControllerModelNodeStateMSFT
ControllerModelNodeStateMSFT
             Posef
nodePose

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

instance Zero ControllerModelNodeStateMSFT where
  zero :: ControllerModelNodeStateMSFT
zero = Posef -> ControllerModelNodeStateMSFT
ControllerModelNodeStateMSFT
           Posef
forall a. Zero a => a
zero


-- | XrControllerModelStateMSFT - Describes the state of a controller model
--
-- == Parameter Descriptions
--
-- -   @type@ is the 'OpenXR.Core10.Enums.StructureType.StructureType' of
--     this structure.
--
-- -   @next@ is @NULL@ or a pointer to the next structure in a structure
--     chain.
--
-- -   @nodeCapacityInput@ is the capacity of the @nodeStates@ array, or 0
--     to indicate a request to retrieve the required capacity.
--
-- -   @nodeCountOutput@ filled in by the runtime with the count of
--     elements in @nodeStates@ array, or returns the required capacity in
--     the case that @nodeCapacityInput@ is 0.
--
-- -   @nodeStates@ is a pointer to an application-allocated array that
--     will be filled with the 'ControllerModelNodeStateMSFT' values. It
--     /can/ be @NULL@ if @sourceCapacityInput@ is 0.
--
-- -   See
--     <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#buffer-size-parameters Buffer Size Parameters>
--     chapter for a detailed description of retrieving the required
--     @nodeStates@ size.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-XrControllerModelStateMSFT-extension-notenabled# The @@
--     extension /must/ be enabled prior to using
--     'ControllerModelStateMSFT'
--
-- -   #VUID-XrControllerModelStateMSFT-type-type# @type@ /must/ be
--     'OpenXR.Core10.Enums.StructureType.TYPE_CONTROLLER_MODEL_STATE_MSFT'
--
-- -   #VUID-XrControllerModelStateMSFT-next-next# @next@ /must/ be @NULL@
--     or a valid pointer to the
--     <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#valid-usage-for-structure-pointer-chains next structure in a structure chain>
--
-- -   #VUID-XrControllerModelStateMSFT-nodeStates-parameter# If
--     @nodeCapacityInput@ is not @0@, @nodeStates@ /must/ be a pointer to
--     an array of @nodeCapacityInput@ 'ControllerModelNodeStateMSFT'
--     structures
--
-- = See Also
--
-- 'ControllerModelNodeStateMSFT',
-- 'OpenXR.Core10.Enums.StructureType.StructureType',
-- 'getControllerModelStateMSFT'
data ControllerModelStateMSFT = ControllerModelStateMSFT
  { -- No documentation found for Nested "XrControllerModelStateMSFT" "nodeCapacityInput"
    ControllerModelStateMSFT -> "bufferCapacityInput" ::: Word32
nodeCapacityInput :: Word32
  , -- No documentation found for Nested "XrControllerModelStateMSFT" "nodeCountOutput"
    ControllerModelStateMSFT -> "bufferCapacityInput" ::: Word32
nodeCountOutput :: Word32
  , -- No documentation found for Nested "XrControllerModelStateMSFT" "nodeStates"
    ControllerModelStateMSFT -> Ptr ControllerModelNodeStateMSFT
nodeStates :: Ptr ControllerModelNodeStateMSFT
  }
  deriving (Typeable, ControllerModelStateMSFT -> ControllerModelStateMSFT -> Bool
(ControllerModelStateMSFT -> ControllerModelStateMSFT -> Bool)
-> (ControllerModelStateMSFT -> ControllerModelStateMSFT -> Bool)
-> Eq ControllerModelStateMSFT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ControllerModelStateMSFT -> ControllerModelStateMSFT -> Bool
$c/= :: ControllerModelStateMSFT -> ControllerModelStateMSFT -> Bool
== :: ControllerModelStateMSFT -> ControllerModelStateMSFT -> Bool
$c== :: ControllerModelStateMSFT -> ControllerModelStateMSFT -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ControllerModelStateMSFT)
#endif
deriving instance Show ControllerModelStateMSFT

instance ToCStruct ControllerModelStateMSFT where
  withCStruct :: ControllerModelStateMSFT
-> (Ptr ControllerModelStateMSFT -> IO b) -> IO b
withCStruct x :: ControllerModelStateMSFT
x f :: Ptr ControllerModelStateMSFT -> IO b
f = Int -> Int -> (Ptr ControllerModelStateMSFT -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 32 8 ((Ptr ControllerModelStateMSFT -> IO b) -> IO b)
-> (Ptr ControllerModelStateMSFT -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr ControllerModelStateMSFT
p -> Ptr ControllerModelStateMSFT
-> ControllerModelStateMSFT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr ControllerModelStateMSFT
p ControllerModelStateMSFT
x (Ptr ControllerModelStateMSFT -> IO b
f Ptr ControllerModelStateMSFT
p)
  pokeCStruct :: Ptr ControllerModelStateMSFT
-> ControllerModelStateMSFT -> IO b -> IO b
pokeCStruct p :: Ptr ControllerModelStateMSFT
p ControllerModelStateMSFT{..} f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ControllerModelStateMSFT
p Ptr ControllerModelStateMSFT -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
TYPE_CONTROLLER_MODEL_STATE_MSFT)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ControllerModelStateMSFT
p Ptr ControllerModelStateMSFT -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
-> ("bufferCapacityInput" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ControllerModelStateMSFT
p Ptr ControllerModelStateMSFT
-> Int
-> "bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Word32)) ("bufferCapacityInput" ::: Word32
nodeCapacityInput)
    ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
-> ("bufferCapacityInput" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ControllerModelStateMSFT
p Ptr ControllerModelStateMSFT
-> Int
-> "bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Word32)) ("bufferCapacityInput" ::: Word32
nodeCountOutput)
    Ptr (Ptr ControllerModelNodeStateMSFT)
-> Ptr ControllerModelNodeStateMSFT -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ControllerModelStateMSFT
p Ptr ControllerModelStateMSFT
-> Int -> Ptr (Ptr ControllerModelNodeStateMSFT)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr (Ptr ControllerModelNodeStateMSFT))) (Ptr ControllerModelNodeStateMSFT
nodeStates)
    IO b
f
  cStructSize :: Int
cStructSize = 32
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr ControllerModelStateMSFT -> IO b -> IO b
pokeZeroCStruct p :: Ptr ControllerModelStateMSFT
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ControllerModelStateMSFT
p Ptr ControllerModelStateMSFT -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
TYPE_CONTROLLER_MODEL_STATE_MSFT)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ControllerModelStateMSFT
p Ptr ControllerModelStateMSFT -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    IO b
f

instance FromCStruct ControllerModelStateMSFT where
  peekCStruct :: Ptr ControllerModelStateMSFT -> IO ControllerModelStateMSFT
peekCStruct p :: Ptr ControllerModelStateMSFT
p = do
    "bufferCapacityInput" ::: Word32
nodeCapacityInput <- ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
-> IO ("bufferCapacityInput" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr ControllerModelStateMSFT
p Ptr ControllerModelStateMSFT
-> Int
-> "bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Word32))
    "bufferCapacityInput" ::: Word32
nodeCountOutput <- ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
-> IO ("bufferCapacityInput" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr ControllerModelStateMSFT
p Ptr ControllerModelStateMSFT
-> Int
-> "bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Word32))
    Ptr ControllerModelNodeStateMSFT
nodeStates <- Ptr (Ptr ControllerModelNodeStateMSFT)
-> IO (Ptr ControllerModelNodeStateMSFT)
forall a. Storable a => Ptr a -> IO a
peek @(Ptr ControllerModelNodeStateMSFT) ((Ptr ControllerModelStateMSFT
p Ptr ControllerModelStateMSFT
-> Int -> Ptr (Ptr ControllerModelNodeStateMSFT)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr (Ptr ControllerModelNodeStateMSFT)))
    ControllerModelStateMSFT -> IO ControllerModelStateMSFT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ControllerModelStateMSFT -> IO ControllerModelStateMSFT)
-> ControllerModelStateMSFT -> IO ControllerModelStateMSFT
forall a b. (a -> b) -> a -> b
$ ("bufferCapacityInput" ::: Word32)
-> ("bufferCapacityInput" ::: Word32)
-> Ptr ControllerModelNodeStateMSFT
-> ControllerModelStateMSFT
ControllerModelStateMSFT
             "bufferCapacityInput" ::: Word32
nodeCapacityInput "bufferCapacityInput" ::: Word32
nodeCountOutput Ptr ControllerModelNodeStateMSFT
nodeStates

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

instance Zero ControllerModelStateMSFT where
  zero :: ControllerModelStateMSFT
zero = ("bufferCapacityInput" ::: Word32)
-> ("bufferCapacityInput" ::: Word32)
-> Ptr ControllerModelNodeStateMSFT
-> ControllerModelStateMSFT
ControllerModelStateMSFT
           "bufferCapacityInput" ::: Word32
forall a. Zero a => a
zero
           "bufferCapacityInput" ::: Word32
forall a. Zero a => a
zero
           Ptr ControllerModelNodeStateMSFT
forall a. Zero a => a
zero


type MSFT_controller_model_SPEC_VERSION = 2

-- No documentation found for TopLevel "XR_MSFT_controller_model_SPEC_VERSION"
pattern MSFT_controller_model_SPEC_VERSION :: forall a . Integral a => a
pattern $bMSFT_controller_model_SPEC_VERSION :: a
$mMSFT_controller_model_SPEC_VERSION :: forall r a. Integral a => a -> (Void# -> r) -> (Void# -> r) -> r
MSFT_controller_model_SPEC_VERSION = 2


type MSFT_CONTROLLER_MODEL_EXTENSION_NAME = "XR_MSFT_controller_model"

-- No documentation found for TopLevel "XR_MSFT_CONTROLLER_MODEL_EXTENSION_NAME"
pattern MSFT_CONTROLLER_MODEL_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bMSFT_CONTROLLER_MODEL_EXTENSION_NAME :: a
$mMSFT_CONTROLLER_MODEL_EXTENSION_NAME :: forall r a.
(Eq a, IsString a) =>
a -> (Void# -> r) -> (Void# -> r) -> r
MSFT_CONTROLLER_MODEL_EXTENSION_NAME = "XR_MSFT_controller_model"


type MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT = 64

-- No documentation found for TopLevel "XR_MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT"
pattern MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT :: forall a . Integral a => a
pattern $bMAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT :: a
$mMAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT :: forall r a. Integral a => a -> (Void# -> r) -> (Void# -> r) -> r
MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT = 64