{-# language CPP #-}
-- No documentation found for Chapter "ViewConfigurations"
module OpenXR.Core10.ViewConfigurations  ( enumerateViewConfigurations
                                         , getViewConfigurationProperties
                                         , enumerateViewConfigurationViews
                                         , ViewConfigurationView(..)
                                         , ViewConfigurationProperties(..)
                                         ) where

import OpenXR.Internal.Utils (traceAroundEvent)
import Control.Exception.Base (bracket)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Data.Typeable (eqT)
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 (castPtr)
import GHC.Ptr (nullFunPtr)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Cont (evalContT)
import Data.Vector (generateM)
import OpenXR.CStruct (FromCStruct)
import OpenXR.CStruct (FromCStruct(..))
import OpenXR.CStruct (ToCStruct)
import OpenXR.CStruct (ToCStruct(..))
import OpenXR.Zero (Zero(..))
import Control.Monad.IO.Class (MonadIO)
import Data.Type.Equality ((:~:)(Refl))
import Data.Typeable (Typeable)
import Foreign.Storable (Storable)
import Foreign.Storable (Storable(peek))
import Foreign.Storable (Storable(poke))
import qualified Foreign.Storable (Storable(..))
import GHC.Generics (Generic)
import GHC.IO.Exception (IOErrorType(..))
import GHC.IO.Exception (IOException(..))
import Foreign.Ptr (FunPtr)
import Foreign.Ptr (Ptr)
import Data.Word (Word32)
import Data.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Data.Vector (Vector)
import OpenXR.CStruct.Utils (advancePtrBytes)
import OpenXR.Core10.FundamentalTypes (bool32ToBool)
import OpenXR.Core10.FundamentalTypes (boolToBool32)
import OpenXR.CStruct.Extends (forgetExtensions)
import OpenXR.NamedType ((:::))
import OpenXR.Core10.FundamentalTypes (Bool32)
import OpenXR.CStruct.Extends (Chain)
import OpenXR.CStruct.Extends (Extends)
import OpenXR.CStruct.Extends (Extendss)
import OpenXR.CStruct.Extends (Extensible(..))
import OpenXR.Core10.Handles (Instance)
import OpenXR.Core10.Handles (Instance(..))
import OpenXR.Dynamic (InstanceCmds(pXrEnumerateViewConfigurationViews))
import OpenXR.Dynamic (InstanceCmds(pXrEnumerateViewConfigurations))
import OpenXR.Dynamic (InstanceCmds(pXrGetViewConfigurationProperties))
import OpenXR.Core10.Handles (Instance_T)
import OpenXR.Exception (OpenXrException(..))
import OpenXR.CStruct.Extends (PeekChain)
import OpenXR.CStruct.Extends (PeekChain(..))
import OpenXR.CStruct.Extends (PokeChain)
import OpenXR.CStruct.Extends (PokeChain(..))
import OpenXR.Core10.Enums.Result (Result)
import OpenXR.Core10.Enums.Result (Result(..))
import OpenXR.CStruct.Extends (SomeStruct)
import OpenXR.Core10.Enums.StructureType (StructureType)
import OpenXR.Core10.Device (SystemId)
import OpenXR.Core10.Device (SystemId(..))
import {-# SOURCE #-} OpenXR.Extensions.XR_EXT_view_configuration_depth_range (ViewConfigurationDepthRangeEXT)
import OpenXR.Core10.Enums.ViewConfigurationType (ViewConfigurationType)
import OpenXR.Core10.Enums.ViewConfigurationType (ViewConfigurationType(..))
import {-# SOURCE #-} OpenXR.Extensions.XR_EPIC_view_configuration_fov (ViewConfigurationViewFovEPIC)
import OpenXR.Core10.Enums.Result (Result(SUCCESS))
import OpenXR.Core10.Enums.StructureType (StructureType(TYPE_VIEW_CONFIGURATION_PROPERTIES))
import OpenXR.Core10.Enums.StructureType (StructureType(TYPE_VIEW_CONFIGURATION_VIEW))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkXrEnumerateViewConfigurations
  :: FunPtr (Ptr Instance_T -> SystemId -> Word32 -> Ptr Word32 -> Ptr ViewConfigurationType -> IO Result) -> Ptr Instance_T -> SystemId -> Word32 -> Ptr Word32 -> Ptr ViewConfigurationType -> IO Result

-- | xrEnumerateViewConfigurations - Enumerates supported view configurations
--
-- == Parameter Descriptions
--
-- -   @instance@ is the instance from which @systemId@ was retrieved.
--
-- -   @systemId@ is the
--     <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrSystemId >
--     whose view configurations will be enumerated.
--
-- -   @viewConfigurationsTypeCapacityInput@ is the capacity of the
--     @viewConfigurations@ array, or 0 to indicate a request to retrieve
--     the required capacity.
--
-- -   @viewConfigurationsTypeCountOutput@ is a pointer to the count of
--     @viewConfigurations@ written, or a pointer to the required capacity
--     in the case that @viewConfigurationsTypeCapacityInput@ is 0.
--
-- -   @viewConfigurationsTypes@ is a pointer to an array of
--     'OpenXR.Core10.Enums.ViewConfigurationType.ViewConfigurationType'
--     values, but /can/ be @NULL@ if @viewConfigurationsTypeCapacityInput@
--     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
--     @viewConfigurations@ size.
--
-- = Description
--
-- 'enumerateViewConfigurations' enumerates the view configuration types
-- supported by the
-- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrSystemId >.
-- The supported set for that system /must/ not change during the lifetime
-- of its 'OpenXR.Core10.Handles.Instance'. The returned list of primary
-- view configurations /should/ be in order from what the runtime
-- considered highest to lowest user preference. Thus the first enumerated
-- view configuration type /should/ be the one the runtime prefers the
-- application to use if possible.
--
-- Runtimes /must/ always return identical buffer contents from this
-- enumeration for the given @systemId@ and for the lifetime of the
-- instance.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-xrEnumerateViewConfigurations-instance-parameter# @instance@
--     /must/ be a valid 'OpenXR.Core10.Handles.Instance' handle
--
-- -   #VUID-xrEnumerateViewConfigurations-viewConfigurationTypeCountOutput-parameter#
--     @viewConfigurationTypeCountOutput@ /must/ be a pointer to a
--     @uint32_t@ value
--
-- -   #VUID-xrEnumerateViewConfigurations-viewConfigurationTypes-parameter#
--     If @viewConfigurationTypeCapacityInput@ is not @0@,
--     @viewConfigurationTypes@ /must/ be a pointer to an array of
--     @viewConfigurationTypeCapacityInput@
--     'OpenXR.Core10.Enums.ViewConfigurationType.ViewConfigurationType'
--     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_RUNTIME_FAILURE'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_HANDLE_INVALID'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_SYSTEM_INVALID'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_VALIDATION_FAILURE'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_SIZE_INSUFFICIENT'
--
-- = See Also
--
-- 'OpenXR.Core10.Handles.Instance',
-- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrSystemId >,
-- 'OpenXR.Core10.Enums.ViewConfigurationType.ViewConfigurationType'
enumerateViewConfigurations :: forall io
                             . (MonadIO io)
                            => -- No documentation found for Nested "xrEnumerateViewConfigurations" "instance"
                               Instance
                            -> -- No documentation found for Nested "xrEnumerateViewConfigurations" "systemId"
                               SystemId
                            -> io (("viewConfigurationTypes" ::: Vector ViewConfigurationType))
enumerateViewConfigurations :: Instance
-> SystemId
-> io ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
enumerateViewConfigurations instance' :: Instance
instance' systemId :: SystemId
systemId = IO ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
-> io ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
 -> io ("viewConfigurationTypes" ::: Vector ViewConfigurationType))
-> (ContT
      ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
      IO
      ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
    -> IO ("viewConfigurationTypes" ::: Vector ViewConfigurationType))
-> ContT
     ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
     IO
     ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
-> io ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT
  ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
  IO
  ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
-> IO ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT
   ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
   IO
   ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
 -> io ("viewConfigurationTypes" ::: Vector ViewConfigurationType))
-> ContT
     ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
     IO
     ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
-> io ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
forall a b. (a -> b) -> a -> b
$ do
  let xrEnumerateViewConfigurationsPtr :: FunPtr
  (Ptr Instance_T
   -> SystemId
   -> ("viewConfigurationTypeCapacityInput" ::: Word32)
   -> ("viewConfigurationTypeCountOutput"
       ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
   -> ("viewConfigurationTypes" ::: Ptr ViewConfigurationType)
   -> IO Result)
xrEnumerateViewConfigurationsPtr = InstanceCmds
-> FunPtr
     (Ptr Instance_T
      -> SystemId
      -> ("viewConfigurationTypeCapacityInput" ::: Word32)
      -> ("viewConfigurationTypeCountOutput"
          ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
      -> ("viewConfigurationTypes" ::: Ptr ViewConfigurationType)
      -> IO Result)
pXrEnumerateViewConfigurations (Instance -> InstanceCmds
instanceCmds (Instance
instance' :: Instance))
  IO ()
-> ContT
     ("viewConfigurationTypes" ::: Vector ViewConfigurationType) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ()
 -> ContT
      ("viewConfigurationTypes" ::: Vector ViewConfigurationType) IO ())
-> IO ()
-> ContT
     ("viewConfigurationTypes" ::: Vector ViewConfigurationType) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr Instance_T
   -> SystemId
   -> ("viewConfigurationTypeCapacityInput" ::: Word32)
   -> ("viewConfigurationTypeCountOutput"
       ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
   -> ("viewConfigurationTypes" ::: Ptr ViewConfigurationType)
   -> IO Result)
xrEnumerateViewConfigurationsPtr FunPtr
  (Ptr Instance_T
   -> SystemId
   -> ("viewConfigurationTypeCapacityInput" ::: Word32)
   -> ("viewConfigurationTypeCountOutput"
       ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
   -> ("viewConfigurationTypes" ::: Ptr ViewConfigurationType)
   -> IO Result)
-> FunPtr
     (Ptr Instance_T
      -> SystemId
      -> ("viewConfigurationTypeCapacityInput" ::: Word32)
      -> ("viewConfigurationTypeCountOutput"
          ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
      -> ("viewConfigurationTypes" ::: Ptr ViewConfigurationType)
      -> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr Instance_T
   -> SystemId
   -> ("viewConfigurationTypeCapacityInput" ::: Word32)
   -> ("viewConfigurationTypeCountOutput"
       ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
   -> ("viewConfigurationTypes" ::: Ptr ViewConfigurationType)
   -> 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 xrEnumerateViewConfigurations is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let xrEnumerateViewConfigurations' :: Ptr Instance_T
-> SystemId
-> ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ("viewConfigurationTypeCountOutput"
    ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
-> ("viewConfigurationTypes" ::: Ptr ViewConfigurationType)
-> IO Result
xrEnumerateViewConfigurations' = FunPtr
  (Ptr Instance_T
   -> SystemId
   -> ("viewConfigurationTypeCapacityInput" ::: Word32)
   -> ("viewConfigurationTypeCountOutput"
       ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
   -> ("viewConfigurationTypes" ::: Ptr ViewConfigurationType)
   -> IO Result)
-> Ptr Instance_T
-> SystemId
-> ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ("viewConfigurationTypeCountOutput"
    ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
-> ("viewConfigurationTypes" ::: Ptr ViewConfigurationType)
-> IO Result
mkXrEnumerateViewConfigurations FunPtr
  (Ptr Instance_T
   -> SystemId
   -> ("viewConfigurationTypeCapacityInput" ::: Word32)
   -> ("viewConfigurationTypeCountOutput"
       ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
   -> ("viewConfigurationTypes" ::: Ptr ViewConfigurationType)
   -> IO Result)
xrEnumerateViewConfigurationsPtr
  let instance'' :: Ptr Instance_T
instance'' = Instance -> Ptr Instance_T
instanceHandle (Instance
instance')
  "viewConfigurationTypeCountOutput"
::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32)
pViewConfigurationTypeCountOutput <- ((("viewConfigurationTypeCountOutput"
   ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
  -> IO ("viewConfigurationTypes" ::: Vector ViewConfigurationType))
 -> IO ("viewConfigurationTypes" ::: Vector ViewConfigurationType))
-> ContT
     ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
     IO
     ("viewConfigurationTypeCountOutput"
      ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("viewConfigurationTypeCountOutput"
    ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
   -> IO ("viewConfigurationTypes" ::: Vector ViewConfigurationType))
  -> IO ("viewConfigurationTypes" ::: Vector ViewConfigurationType))
 -> ContT
      ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
      IO
      ("viewConfigurationTypeCountOutput"
       ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32)))
-> ((("viewConfigurationTypeCountOutput"
      ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
     -> IO ("viewConfigurationTypes" ::: Vector ViewConfigurationType))
    -> IO ("viewConfigurationTypes" ::: Vector ViewConfigurationType))
-> ContT
     ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
     IO
     ("viewConfigurationTypeCountOutput"
      ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
forall a b. (a -> b) -> a -> b
$ IO
  ("viewConfigurationTypeCountOutput"
   ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
-> (("viewConfigurationTypeCountOutput"
     ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
    -> IO ())
-> (("viewConfigurationTypeCountOutput"
     ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
    -> IO ("viewConfigurationTypes" ::: Vector ViewConfigurationType))
-> IO ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int
-> IO
     ("viewConfigurationTypeCountOutput"
      ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
forall a. Int -> IO (Ptr a)
callocBytes @Word32 4) ("viewConfigurationTypeCountOutput"
 ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
-> IO ()
forall a. Ptr a -> IO ()
free
  Result
r <- IO Result
-> ContT
     ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
     IO
     Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result
 -> ContT
      ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
      IO
      Result)
-> IO Result
-> ContT
     ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
     IO
     Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "xrEnumerateViewConfigurations" (Ptr Instance_T
-> SystemId
-> ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ("viewConfigurationTypeCountOutput"
    ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
-> ("viewConfigurationTypes" ::: Ptr ViewConfigurationType)
-> IO Result
xrEnumerateViewConfigurations' Ptr Instance_T
instance'' (SystemId
systemId) (0) ("viewConfigurationTypeCountOutput"
::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32)
pViewConfigurationTypeCountOutput) ("viewConfigurationTypes" ::: Ptr ViewConfigurationType
forall a. Ptr a
nullPtr))
  IO ()
-> ContT
     ("viewConfigurationTypes" ::: Vector ViewConfigurationType) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ()
 -> ContT
      ("viewConfigurationTypes" ::: Vector ViewConfigurationType) IO ())
-> IO ()
-> ContT
     ("viewConfigurationTypes" ::: Vector ViewConfigurationType) 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))
  "viewConfigurationTypeCapacityInput" ::: Word32
viewConfigurationTypeCountOutput <- IO ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ContT
     ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
     IO
     ("viewConfigurationTypeCapacityInput" ::: Word32)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ("viewConfigurationTypeCapacityInput" ::: Word32)
 -> ContT
      ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
      IO
      ("viewConfigurationTypeCapacityInput" ::: Word32))
-> IO ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ContT
     ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
     IO
     ("viewConfigurationTypeCapacityInput" ::: Word32)
forall a b. (a -> b) -> a -> b
$ ("viewConfigurationTypeCountOutput"
 ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
-> IO ("viewConfigurationTypeCapacityInput" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 "viewConfigurationTypeCountOutput"
::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32)
pViewConfigurationTypeCountOutput
  "viewConfigurationTypes" ::: Ptr ViewConfigurationType
pViewConfigurationTypes <- ((("viewConfigurationTypes" ::: Ptr ViewConfigurationType)
  -> IO ("viewConfigurationTypes" ::: Vector ViewConfigurationType))
 -> IO ("viewConfigurationTypes" ::: Vector ViewConfigurationType))
-> ContT
     ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
     IO
     ("viewConfigurationTypes" ::: Ptr ViewConfigurationType)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("viewConfigurationTypes" ::: Ptr ViewConfigurationType)
   -> IO ("viewConfigurationTypes" ::: Vector ViewConfigurationType))
  -> IO ("viewConfigurationTypes" ::: Vector ViewConfigurationType))
 -> ContT
      ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
      IO
      ("viewConfigurationTypes" ::: Ptr ViewConfigurationType))
-> ((("viewConfigurationTypes" ::: Ptr ViewConfigurationType)
     -> IO ("viewConfigurationTypes" ::: Vector ViewConfigurationType))
    -> IO ("viewConfigurationTypes" ::: Vector ViewConfigurationType))
-> ContT
     ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
     IO
     ("viewConfigurationTypes" ::: Ptr ViewConfigurationType)
forall a b. (a -> b) -> a -> b
$ IO ("viewConfigurationTypes" ::: Ptr ViewConfigurationType)
-> (("viewConfigurationTypes" ::: Ptr ViewConfigurationType)
    -> IO ())
-> (("viewConfigurationTypes" ::: Ptr ViewConfigurationType)
    -> IO ("viewConfigurationTypes" ::: Vector ViewConfigurationType))
-> IO ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int -> IO ("viewConfigurationTypes" ::: Ptr ViewConfigurationType)
forall a. Int -> IO (Ptr a)
callocBytes @ViewConfigurationType ((("viewConfigurationTypeCapacityInput" ::: Word32) -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral ("viewConfigurationTypeCapacityInput" ::: Word32
viewConfigurationTypeCountOutput)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* 4)) ("viewConfigurationTypes" ::: Ptr ViewConfigurationType) -> IO ()
forall a. Ptr a -> IO ()
free
  Result
r' <- IO Result
-> ContT
     ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
     IO
     Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result
 -> ContT
      ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
      IO
      Result)
-> IO Result
-> ContT
     ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
     IO
     Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "xrEnumerateViewConfigurations" (Ptr Instance_T
-> SystemId
-> ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ("viewConfigurationTypeCountOutput"
    ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
-> ("viewConfigurationTypes" ::: Ptr ViewConfigurationType)
-> IO Result
xrEnumerateViewConfigurations' Ptr Instance_T
instance'' (SystemId
systemId) (("viewConfigurationTypeCapacityInput" ::: Word32
viewConfigurationTypeCountOutput)) ("viewConfigurationTypeCountOutput"
::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32)
pViewConfigurationTypeCountOutput) ("viewConfigurationTypes" ::: Ptr ViewConfigurationType
pViewConfigurationTypes))
  IO ()
-> ContT
     ("viewConfigurationTypes" ::: Vector ViewConfigurationType) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ()
 -> ContT
      ("viewConfigurationTypes" ::: Vector ViewConfigurationType) IO ())
-> IO ()
-> ContT
     ("viewConfigurationTypes" ::: Vector ViewConfigurationType) 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'))
  "viewConfigurationTypeCapacityInput" ::: Word32
viewConfigurationTypeCountOutput' <- IO ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ContT
     ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
     IO
     ("viewConfigurationTypeCapacityInput" ::: Word32)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ("viewConfigurationTypeCapacityInput" ::: Word32)
 -> ContT
      ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
      IO
      ("viewConfigurationTypeCapacityInput" ::: Word32))
-> IO ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ContT
     ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
     IO
     ("viewConfigurationTypeCapacityInput" ::: Word32)
forall a b. (a -> b) -> a -> b
$ ("viewConfigurationTypeCountOutput"
 ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
-> IO ("viewConfigurationTypeCapacityInput" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 "viewConfigurationTypeCountOutput"
::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32)
pViewConfigurationTypeCountOutput
  "viewConfigurationTypes" ::: Vector ViewConfigurationType
viewConfigurationTypes' <- IO ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
-> ContT
     ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
     IO
     ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
 -> ContT
      ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
      IO
      ("viewConfigurationTypes" ::: Vector ViewConfigurationType))
-> IO ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
-> ContT
     ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
     IO
     ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
forall a b. (a -> b) -> a -> b
$ Int
-> (Int -> IO ViewConfigurationType)
-> IO ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM (("viewConfigurationTypeCapacityInput" ::: Word32) -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral ("viewConfigurationTypeCapacityInput" ::: Word32
viewConfigurationTypeCountOutput')) (\i :: Int
i -> ("viewConfigurationTypes" ::: Ptr ViewConfigurationType)
-> IO ViewConfigurationType
forall a. Storable a => Ptr a -> IO a
peek @ViewConfigurationType (("viewConfigurationTypes" ::: Ptr ViewConfigurationType
pViewConfigurationTypes ("viewConfigurationTypes" ::: Ptr ViewConfigurationType)
-> Int -> "viewConfigurationTypes" ::: Ptr ViewConfigurationType
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (4 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr ViewConfigurationType)))
  ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
-> ContT
     ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
     IO
     ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (("viewConfigurationTypes" ::: Vector ViewConfigurationType)
 -> ContT
      ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
      IO
      ("viewConfigurationTypes" ::: Vector ViewConfigurationType))
-> ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
-> ContT
     ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
     IO
     ("viewConfigurationTypes" ::: Vector ViewConfigurationType)
forall a b. (a -> b) -> a -> b
$ ("viewConfigurationTypes" ::: Vector ViewConfigurationType
viewConfigurationTypes')


foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkXrGetViewConfigurationProperties
  :: FunPtr (Ptr Instance_T -> SystemId -> ViewConfigurationType -> Ptr ViewConfigurationProperties -> IO Result) -> Ptr Instance_T -> SystemId -> ViewConfigurationType -> Ptr ViewConfigurationProperties -> IO Result

-- | xrGetViewConfigurationProperties - Gets information for a view
-- configuration
--
-- == Parameter Descriptions
--
-- = Description
--
-- 'getViewConfigurationProperties' queries properties of an individual
-- view configuration. Applications /must/ use one of the supported view
-- configuration types returned by 'enumerateViewConfigurations'. If
-- @viewConfigurationType@ is not supported by this
-- 'OpenXR.Core10.Handles.Instance' the runtime /must/ return
-- 'OpenXR.Core10.Enums.Result.ERROR_VIEW_CONFIGURATION_TYPE_UNSUPPORTED'.
--
-- == 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_RUNTIME_FAILURE'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_HANDLE_INVALID'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_SYSTEM_INVALID'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_VALIDATION_FAILURE'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_VIEW_CONFIGURATION_TYPE_UNSUPPORTED'
--
-- = See Also
--
-- 'OpenXR.Core10.Handles.Instance',
-- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrSystemId >,
-- 'ViewConfigurationProperties',
-- 'OpenXR.Core10.Enums.ViewConfigurationType.ViewConfigurationType'
getViewConfigurationProperties :: forall io
                                . (MonadIO io)
                               => -- | @instance@ is the instance from which @systemId@ was retrieved.
                                  --
                                  -- #VUID-xrGetViewConfigurationProperties-instance-parameter# @instance@
                                  -- /must/ be a valid 'OpenXR.Core10.Handles.Instance' handle
                                  Instance
                               -> -- | @systemId@ is the
                                  -- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrSystemId >
                                  -- whose view configuration is being queried.
                                  SystemId
                               -> -- | @viewConfigurationType@ is the
                                  -- 'OpenXR.Core10.Enums.ViewConfigurationType.ViewConfigurationType' of the
                                  -- configuration to get.
                                  --
                                  -- #VUID-xrGetViewConfigurationProperties-viewConfigurationType-parameter#
                                  -- @viewConfigurationType@ /must/ be a valid
                                  -- 'OpenXR.Core10.Enums.ViewConfigurationType.ViewConfigurationType' value
                                  ViewConfigurationType
                               -> io (ViewConfigurationProperties)
getViewConfigurationProperties :: Instance
-> SystemId
-> ViewConfigurationType
-> io ViewConfigurationProperties
getViewConfigurationProperties instance' :: Instance
instance' systemId :: SystemId
systemId viewConfigurationType :: ViewConfigurationType
viewConfigurationType = IO ViewConfigurationProperties -> io ViewConfigurationProperties
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ViewConfigurationProperties -> io ViewConfigurationProperties)
-> (ContT
      ViewConfigurationProperties IO ViewConfigurationProperties
    -> IO ViewConfigurationProperties)
-> ContT ViewConfigurationProperties IO ViewConfigurationProperties
-> io ViewConfigurationProperties
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT ViewConfigurationProperties IO ViewConfigurationProperties
-> IO ViewConfigurationProperties
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT ViewConfigurationProperties IO ViewConfigurationProperties
 -> io ViewConfigurationProperties)
-> ContT ViewConfigurationProperties IO ViewConfigurationProperties
-> io ViewConfigurationProperties
forall a b. (a -> b) -> a -> b
$ do
  let xrGetViewConfigurationPropertiesPtr :: FunPtr
  (Ptr Instance_T
   -> SystemId
   -> ViewConfigurationType
   -> Ptr ViewConfigurationProperties
   -> IO Result)
xrGetViewConfigurationPropertiesPtr = InstanceCmds
-> FunPtr
     (Ptr Instance_T
      -> SystemId
      -> ViewConfigurationType
      -> Ptr ViewConfigurationProperties
      -> IO Result)
pXrGetViewConfigurationProperties (Instance -> InstanceCmds
instanceCmds (Instance
instance' :: Instance))
  IO () -> ContT ViewConfigurationProperties IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT ViewConfigurationProperties IO ())
-> IO () -> ContT ViewConfigurationProperties IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr Instance_T
   -> SystemId
   -> ViewConfigurationType
   -> Ptr ViewConfigurationProperties
   -> IO Result)
xrGetViewConfigurationPropertiesPtr FunPtr
  (Ptr Instance_T
   -> SystemId
   -> ViewConfigurationType
   -> Ptr ViewConfigurationProperties
   -> IO Result)
-> FunPtr
     (Ptr Instance_T
      -> SystemId
      -> ViewConfigurationType
      -> Ptr ViewConfigurationProperties
      -> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr Instance_T
   -> SystemId
   -> ViewConfigurationType
   -> Ptr ViewConfigurationProperties
   -> 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 xrGetViewConfigurationProperties is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let xrGetViewConfigurationProperties' :: Ptr Instance_T
-> SystemId
-> ViewConfigurationType
-> Ptr ViewConfigurationProperties
-> IO Result
xrGetViewConfigurationProperties' = FunPtr
  (Ptr Instance_T
   -> SystemId
   -> ViewConfigurationType
   -> Ptr ViewConfigurationProperties
   -> IO Result)
-> Ptr Instance_T
-> SystemId
-> ViewConfigurationType
-> Ptr ViewConfigurationProperties
-> IO Result
mkXrGetViewConfigurationProperties FunPtr
  (Ptr Instance_T
   -> SystemId
   -> ViewConfigurationType
   -> Ptr ViewConfigurationProperties
   -> IO Result)
xrGetViewConfigurationPropertiesPtr
  Ptr ViewConfigurationProperties
pConfigurationProperties <- ((Ptr ViewConfigurationProperties
  -> IO ViewConfigurationProperties)
 -> IO ViewConfigurationProperties)
-> ContT
     ViewConfigurationProperties IO (Ptr ViewConfigurationProperties)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (forall b.
ToCStruct ViewConfigurationProperties =>
(Ptr ViewConfigurationProperties -> IO b) -> IO b
forall a b. ToCStruct a => (Ptr a -> IO b) -> IO b
withZeroCStruct @ViewConfigurationProperties)
  Result
r <- IO Result -> ContT ViewConfigurationProperties IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result -> ContT ViewConfigurationProperties IO Result)
-> IO Result -> ContT ViewConfigurationProperties IO Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "xrGetViewConfigurationProperties" (Ptr Instance_T
-> SystemId
-> ViewConfigurationType
-> Ptr ViewConfigurationProperties
-> IO Result
xrGetViewConfigurationProperties' (Instance -> Ptr Instance_T
instanceHandle (Instance
instance')) (SystemId
systemId) (ViewConfigurationType
viewConfigurationType) (Ptr ViewConfigurationProperties
pConfigurationProperties))
  IO () -> ContT ViewConfigurationProperties IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT ViewConfigurationProperties IO ())
-> IO () -> ContT ViewConfigurationProperties 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))
  ViewConfigurationProperties
configurationProperties <- IO ViewConfigurationProperties
-> ContT ViewConfigurationProperties IO ViewConfigurationProperties
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ViewConfigurationProperties
 -> ContT
      ViewConfigurationProperties IO ViewConfigurationProperties)
-> IO ViewConfigurationProperties
-> ContT ViewConfigurationProperties IO ViewConfigurationProperties
forall a b. (a -> b) -> a -> b
$ Ptr ViewConfigurationProperties -> IO ViewConfigurationProperties
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @ViewConfigurationProperties Ptr ViewConfigurationProperties
pConfigurationProperties
  ViewConfigurationProperties
-> ContT ViewConfigurationProperties IO ViewConfigurationProperties
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ViewConfigurationProperties
 -> ContT
      ViewConfigurationProperties IO ViewConfigurationProperties)
-> ViewConfigurationProperties
-> ContT ViewConfigurationProperties IO ViewConfigurationProperties
forall a b. (a -> b) -> a -> b
$ (ViewConfigurationProperties
configurationProperties)


foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkXrEnumerateViewConfigurationViews
  :: FunPtr (Ptr Instance_T -> SystemId -> ViewConfigurationType -> Word32 -> Ptr Word32 -> Ptr (SomeStruct ViewConfigurationView) -> IO Result) -> Ptr Instance_T -> SystemId -> ViewConfigurationType -> Word32 -> Ptr Word32 -> Ptr (SomeStruct ViewConfigurationView) -> IO Result

-- | xrEnumerateViewConfigurationViews - Gets view configuration views
--
-- == Parameter Descriptions
--
-- = Description
--
-- Each 'OpenXR.Core10.Enums.ViewConfigurationType.ViewConfigurationType'
-- defines the number of views associated with it. Applications can query
-- more details of each view element using
-- 'enumerateViewConfigurationViews'. If the supplied
-- @viewConfigurationType@ is not supported by this
-- 'OpenXR.Core10.Handles.Instance' and
-- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrSystemId >,
-- the runtime /must/ return
-- 'OpenXR.Core10.Enums.Result.ERROR_VIEW_CONFIGURATION_TYPE_UNSUPPORTED'.
--
-- Runtimes /must/ always return identical buffer contents from this
-- enumeration for the given @systemId@ and @viewConfigurationType@ for the
-- lifetime of the instance.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-xrEnumerateViewConfigurationViews-instance-parameter#
--     @instance@ /must/ be a valid 'OpenXR.Core10.Handles.Instance' handle
--
-- -   #VUID-xrEnumerateViewConfigurationViews-viewConfigurationType-parameter#
--     @viewConfigurationType@ /must/ be a valid
--     'OpenXR.Core10.Enums.ViewConfigurationType.ViewConfigurationType'
--     value
--
-- -   #VUID-xrEnumerateViewConfigurationViews-viewCountOutput-parameter#
--     @viewCountOutput@ /must/ be a pointer to a @uint32_t@ value
--
-- -   #VUID-xrEnumerateViewConfigurationViews-views-parameter# If
--     @viewCapacityInput@ is not @0@, @views@ /must/ be a pointer to an
--     array of @viewCapacityInput@ 'ViewConfigurationView' structures
--
-- == 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_RUNTIME_FAILURE'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_HANDLE_INVALID'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_SYSTEM_INVALID'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_VALIDATION_FAILURE'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_VIEW_CONFIGURATION_TYPE_UNSUPPORTED'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_SIZE_INSUFFICIENT'
--
-- = See Also
--
-- 'OpenXR.Core10.Handles.Instance',
-- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrSystemId >,
-- 'OpenXR.Core10.Enums.ViewConfigurationType.ViewConfigurationType',
-- 'ViewConfigurationView', 'getViewConfigurationProperties'
enumerateViewConfigurationViews :: forall a io
                                 . (Extendss ViewConfigurationView a, PokeChain a, PeekChain a, MonadIO io)
                                => -- | @instance@ is the instance from which @systemId@ was retrieved.
                                   Instance
                                -> -- | @systemId@ is the
                                   -- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrSystemId >
                                   -- whose view configuration is being queried.
                                   SystemId
                                -> -- | @viewConfigurationType@ is the
                                   -- 'OpenXR.Core10.Enums.ViewConfigurationType.ViewConfigurationType' of the
                                   -- configuration to get.
                                   ViewConfigurationType
                                -> io (("views" ::: Vector (ViewConfigurationView a)))
enumerateViewConfigurationViews :: Instance
-> SystemId
-> ViewConfigurationType
-> io ("views" ::: Vector (ViewConfigurationView a))
enumerateViewConfigurationViews instance' :: Instance
instance' systemId :: SystemId
systemId viewConfigurationType :: ViewConfigurationType
viewConfigurationType = IO ("views" ::: Vector (ViewConfigurationView a))
-> io ("views" ::: Vector (ViewConfigurationView a))
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ("views" ::: Vector (ViewConfigurationView a))
 -> io ("views" ::: Vector (ViewConfigurationView a)))
-> (ContT
      ("views" ::: Vector (ViewConfigurationView a))
      IO
      ("views" ::: Vector (ViewConfigurationView a))
    -> IO ("views" ::: Vector (ViewConfigurationView a)))
-> ContT
     ("views" ::: Vector (ViewConfigurationView a))
     IO
     ("views" ::: Vector (ViewConfigurationView a))
-> io ("views" ::: Vector (ViewConfigurationView a))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT
  ("views" ::: Vector (ViewConfigurationView a))
  IO
  ("views" ::: Vector (ViewConfigurationView a))
-> IO ("views" ::: Vector (ViewConfigurationView a))
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT
   ("views" ::: Vector (ViewConfigurationView a))
   IO
   ("views" ::: Vector (ViewConfigurationView a))
 -> io ("views" ::: Vector (ViewConfigurationView a)))
-> ContT
     ("views" ::: Vector (ViewConfigurationView a))
     IO
     ("views" ::: Vector (ViewConfigurationView a))
-> io ("views" ::: Vector (ViewConfigurationView a))
forall a b. (a -> b) -> a -> b
$ do
  let xrEnumerateViewConfigurationViewsPtr :: FunPtr
  (Ptr Instance_T
   -> SystemId
   -> ViewConfigurationType
   -> ("viewConfigurationTypeCapacityInput" ::: Word32)
   -> ("viewConfigurationTypeCountOutput"
       ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
   -> ("views" ::: Ptr (SomeStruct ViewConfigurationView))
   -> IO Result)
xrEnumerateViewConfigurationViewsPtr = InstanceCmds
-> FunPtr
     (Ptr Instance_T
      -> SystemId
      -> ViewConfigurationType
      -> ("viewConfigurationTypeCapacityInput" ::: Word32)
      -> ("viewConfigurationTypeCountOutput"
          ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
      -> ("views" ::: Ptr (SomeStruct ViewConfigurationView))
      -> IO Result)
pXrEnumerateViewConfigurationViews (Instance -> InstanceCmds
instanceCmds (Instance
instance' :: Instance))
  IO () -> ContT ("views" ::: Vector (ViewConfigurationView a)) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ()
 -> ContT ("views" ::: Vector (ViewConfigurationView a)) IO ())
-> IO ()
-> ContT ("views" ::: Vector (ViewConfigurationView a)) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr Instance_T
   -> SystemId
   -> ViewConfigurationType
   -> ("viewConfigurationTypeCapacityInput" ::: Word32)
   -> ("viewConfigurationTypeCountOutput"
       ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
   -> ("views" ::: Ptr (SomeStruct ViewConfigurationView))
   -> IO Result)
xrEnumerateViewConfigurationViewsPtr FunPtr
  (Ptr Instance_T
   -> SystemId
   -> ViewConfigurationType
   -> ("viewConfigurationTypeCapacityInput" ::: Word32)
   -> ("viewConfigurationTypeCountOutput"
       ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
   -> ("views" ::: Ptr (SomeStruct ViewConfigurationView))
   -> IO Result)
-> FunPtr
     (Ptr Instance_T
      -> SystemId
      -> ViewConfigurationType
      -> ("viewConfigurationTypeCapacityInput" ::: Word32)
      -> ("viewConfigurationTypeCountOutput"
          ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
      -> ("views" ::: Ptr (SomeStruct ViewConfigurationView))
      -> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr Instance_T
   -> SystemId
   -> ViewConfigurationType
   -> ("viewConfigurationTypeCapacityInput" ::: Word32)
   -> ("viewConfigurationTypeCountOutput"
       ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
   -> ("views" ::: Ptr (SomeStruct ViewConfigurationView))
   -> 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 xrEnumerateViewConfigurationViews is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let xrEnumerateViewConfigurationViews' :: Ptr Instance_T
-> SystemId
-> ViewConfigurationType
-> ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ("viewConfigurationTypeCountOutput"
    ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
-> ("views" ::: Ptr (SomeStruct ViewConfigurationView))
-> IO Result
xrEnumerateViewConfigurationViews' = FunPtr
  (Ptr Instance_T
   -> SystemId
   -> ViewConfigurationType
   -> ("viewConfigurationTypeCapacityInput" ::: Word32)
   -> ("viewConfigurationTypeCountOutput"
       ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
   -> ("views" ::: Ptr (SomeStruct ViewConfigurationView))
   -> IO Result)
-> Ptr Instance_T
-> SystemId
-> ViewConfigurationType
-> ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ("viewConfigurationTypeCountOutput"
    ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
-> ("views" ::: Ptr (SomeStruct ViewConfigurationView))
-> IO Result
mkXrEnumerateViewConfigurationViews FunPtr
  (Ptr Instance_T
   -> SystemId
   -> ViewConfigurationType
   -> ("viewConfigurationTypeCapacityInput" ::: Word32)
   -> ("viewConfigurationTypeCountOutput"
       ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
   -> ("views" ::: Ptr (SomeStruct ViewConfigurationView))
   -> IO Result)
xrEnumerateViewConfigurationViewsPtr
  let instance'' :: Ptr Instance_T
instance'' = Instance -> Ptr Instance_T
instanceHandle (Instance
instance')
  "viewConfigurationTypeCountOutput"
::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32)
pViewCountOutput <- ((("viewConfigurationTypeCountOutput"
   ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
  -> IO ("views" ::: Vector (ViewConfigurationView a)))
 -> IO ("views" ::: Vector (ViewConfigurationView a)))
-> ContT
     ("views" ::: Vector (ViewConfigurationView a))
     IO
     ("viewConfigurationTypeCountOutput"
      ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("viewConfigurationTypeCountOutput"
    ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
   -> IO ("views" ::: Vector (ViewConfigurationView a)))
  -> IO ("views" ::: Vector (ViewConfigurationView a)))
 -> ContT
      ("views" ::: Vector (ViewConfigurationView a))
      IO
      ("viewConfigurationTypeCountOutput"
       ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32)))
-> ((("viewConfigurationTypeCountOutput"
      ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
     -> IO ("views" ::: Vector (ViewConfigurationView a)))
    -> IO ("views" ::: Vector (ViewConfigurationView a)))
-> ContT
     ("views" ::: Vector (ViewConfigurationView a))
     IO
     ("viewConfigurationTypeCountOutput"
      ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
forall a b. (a -> b) -> a -> b
$ IO
  ("viewConfigurationTypeCountOutput"
   ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
-> (("viewConfigurationTypeCountOutput"
     ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
    -> IO ())
-> (("viewConfigurationTypeCountOutput"
     ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
    -> IO ("views" ::: Vector (ViewConfigurationView a)))
-> IO ("views" ::: Vector (ViewConfigurationView a))
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int
-> IO
     ("viewConfigurationTypeCountOutput"
      ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
forall a. Int -> IO (Ptr a)
callocBytes @Word32 4) ("viewConfigurationTypeCountOutput"
 ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
-> IO ()
forall a. Ptr a -> IO ()
free
  Result
r <- IO Result
-> ContT ("views" ::: Vector (ViewConfigurationView a)) IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result
 -> ContT ("views" ::: Vector (ViewConfigurationView a)) IO Result)
-> IO Result
-> ContT ("views" ::: Vector (ViewConfigurationView a)) IO Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "xrEnumerateViewConfigurationViews" (Ptr Instance_T
-> SystemId
-> ViewConfigurationType
-> ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ("viewConfigurationTypeCountOutput"
    ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
-> ("views" ::: Ptr (SomeStruct ViewConfigurationView))
-> IO Result
xrEnumerateViewConfigurationViews' Ptr Instance_T
instance'' (SystemId
systemId) (ViewConfigurationType
viewConfigurationType) (0) ("viewConfigurationTypeCountOutput"
::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32)
pViewCountOutput) (Ptr (ViewConfigurationView Any)
-> "views" ::: Ptr (SomeStruct ViewConfigurationView)
forall (a :: [*] -> *) (es :: [*]).
Ptr (a es) -> Ptr (SomeStruct a)
forgetExtensions (Ptr (ViewConfigurationView Any)
forall a. Ptr a
nullPtr)))
  IO () -> ContT ("views" ::: Vector (ViewConfigurationView a)) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ()
 -> ContT ("views" ::: Vector (ViewConfigurationView a)) IO ())
-> IO ()
-> ContT ("views" ::: Vector (ViewConfigurationView a)) 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))
  "viewConfigurationTypeCapacityInput" ::: Word32
viewCountOutput <- IO ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ContT
     ("views" ::: Vector (ViewConfigurationView a))
     IO
     ("viewConfigurationTypeCapacityInput" ::: Word32)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ("viewConfigurationTypeCapacityInput" ::: Word32)
 -> ContT
      ("views" ::: Vector (ViewConfigurationView a))
      IO
      ("viewConfigurationTypeCapacityInput" ::: Word32))
-> IO ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ContT
     ("views" ::: Vector (ViewConfigurationView a))
     IO
     ("viewConfigurationTypeCapacityInput" ::: Word32)
forall a b. (a -> b) -> a -> b
$ ("viewConfigurationTypeCountOutput"
 ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
-> IO ("viewConfigurationTypeCapacityInput" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 "viewConfigurationTypeCountOutput"
::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32)
pViewCountOutput
  Ptr (ViewConfigurationView a)
pViews <- ((Ptr (ViewConfigurationView a)
  -> IO ("views" ::: Vector (ViewConfigurationView a)))
 -> IO ("views" ::: Vector (ViewConfigurationView a)))
-> ContT
     ("views" ::: Vector (ViewConfigurationView a))
     IO
     (Ptr (ViewConfigurationView a))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (ViewConfigurationView a)
   -> IO ("views" ::: Vector (ViewConfigurationView a)))
  -> IO ("views" ::: Vector (ViewConfigurationView a)))
 -> ContT
      ("views" ::: Vector (ViewConfigurationView a))
      IO
      (Ptr (ViewConfigurationView a)))
-> ((Ptr (ViewConfigurationView a)
     -> IO ("views" ::: Vector (ViewConfigurationView a)))
    -> IO ("views" ::: Vector (ViewConfigurationView a)))
-> ContT
     ("views" ::: Vector (ViewConfigurationView a))
     IO
     (Ptr (ViewConfigurationView a))
forall a b. (a -> b) -> a -> b
$ IO (Ptr (ViewConfigurationView a))
-> (Ptr (ViewConfigurationView a) -> IO ())
-> (Ptr (ViewConfigurationView a)
    -> IO ("views" ::: Vector (ViewConfigurationView a)))
-> IO ("views" ::: Vector (ViewConfigurationView a))
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int -> IO (Ptr (ViewConfigurationView a))
forall a. Int -> IO (Ptr a)
callocBytes @(ViewConfigurationView _) ((("viewConfigurationTypeCapacityInput" ::: Word32) -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral ("viewConfigurationTypeCapacityInput" ::: Word32
viewCountOutput)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* 40)) Ptr (ViewConfigurationView a) -> IO ()
forall a. Ptr a -> IO ()
free
  [()]
_ <- (Int -> ContT ("views" ::: Vector (ViewConfigurationView a)) IO ())
-> [Int]
-> ContT ("views" ::: Vector (ViewConfigurationView a)) IO [()]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse (\i :: Int
i -> ((() -> IO ("views" ::: Vector (ViewConfigurationView a)))
 -> IO ("views" ::: Vector (ViewConfigurationView a)))
-> ContT ("views" ::: Vector (ViewConfigurationView a)) IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO ("views" ::: Vector (ViewConfigurationView a)))
  -> IO ("views" ::: Vector (ViewConfigurationView a)))
 -> ContT ("views" ::: Vector (ViewConfigurationView a)) IO ())
-> ((() -> IO ("views" ::: Vector (ViewConfigurationView a)))
    -> IO ("views" ::: Vector (ViewConfigurationView a)))
-> ContT ("views" ::: Vector (ViewConfigurationView a)) IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (ViewConfigurationView a)
-> IO ("views" ::: Vector (ViewConfigurationView a))
-> IO ("views" ::: Vector (ViewConfigurationView a))
forall a b. ToCStruct a => Ptr a -> IO b -> IO b
pokeZeroCStruct (Ptr (ViewConfigurationView a)
pViews Ptr (ViewConfigurationView a)
-> Int -> Ptr (ViewConfigurationView a)
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
i Int -> Int -> Int
forall a. Num a => a -> a -> a
* 40) :: Ptr (ViewConfigurationView _)) (IO ("views" ::: Vector (ViewConfigurationView a))
 -> IO ("views" ::: Vector (ViewConfigurationView a)))
-> ((() -> IO ("views" ::: Vector (ViewConfigurationView a)))
    -> IO ("views" ::: Vector (ViewConfigurationView a)))
-> (() -> IO ("views" ::: Vector (ViewConfigurationView a)))
-> IO ("views" ::: Vector (ViewConfigurationView a))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO ("views" ::: Vector (ViewConfigurationView a)))
-> () -> IO ("views" ::: Vector (ViewConfigurationView a))
forall a b. (a -> b) -> a -> b
$ ())) [0..(("viewConfigurationTypeCapacityInput" ::: Word32) -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral ("viewConfigurationTypeCapacityInput" ::: Word32
viewCountOutput)) Int -> Int -> Int
forall a. Num a => a -> a -> a
- 1]
  Result
r' <- IO Result
-> ContT ("views" ::: Vector (ViewConfigurationView a)) IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result
 -> ContT ("views" ::: Vector (ViewConfigurationView a)) IO Result)
-> IO Result
-> ContT ("views" ::: Vector (ViewConfigurationView a)) IO Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "xrEnumerateViewConfigurationViews" (Ptr Instance_T
-> SystemId
-> ViewConfigurationType
-> ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ("viewConfigurationTypeCountOutput"
    ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
-> ("views" ::: Ptr (SomeStruct ViewConfigurationView))
-> IO Result
xrEnumerateViewConfigurationViews' Ptr Instance_T
instance'' (SystemId
systemId) (ViewConfigurationType
viewConfigurationType) (("viewConfigurationTypeCapacityInput" ::: Word32
viewCountOutput)) ("viewConfigurationTypeCountOutput"
::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32)
pViewCountOutput) (Ptr (ViewConfigurationView a)
-> "views" ::: Ptr (SomeStruct ViewConfigurationView)
forall (a :: [*] -> *) (es :: [*]).
Ptr (a es) -> Ptr (SomeStruct a)
forgetExtensions ((Ptr (ViewConfigurationView a)
pViews))))
  IO () -> ContT ("views" ::: Vector (ViewConfigurationView a)) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ()
 -> ContT ("views" ::: Vector (ViewConfigurationView a)) IO ())
-> IO ()
-> ContT ("views" ::: Vector (ViewConfigurationView a)) 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'))
  "viewConfigurationTypeCapacityInput" ::: Word32
viewCountOutput' <- IO ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ContT
     ("views" ::: Vector (ViewConfigurationView a))
     IO
     ("viewConfigurationTypeCapacityInput" ::: Word32)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ("viewConfigurationTypeCapacityInput" ::: Word32)
 -> ContT
      ("views" ::: Vector (ViewConfigurationView a))
      IO
      ("viewConfigurationTypeCapacityInput" ::: Word32))
-> IO ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ContT
     ("views" ::: Vector (ViewConfigurationView a))
     IO
     ("viewConfigurationTypeCapacityInput" ::: Word32)
forall a b. (a -> b) -> a -> b
$ ("viewConfigurationTypeCountOutput"
 ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
-> IO ("viewConfigurationTypeCapacityInput" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 "viewConfigurationTypeCountOutput"
::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32)
pViewCountOutput
  "views" ::: Vector (ViewConfigurationView a)
views' <- IO ("views" ::: Vector (ViewConfigurationView a))
-> ContT
     ("views" ::: Vector (ViewConfigurationView a))
     IO
     ("views" ::: Vector (ViewConfigurationView a))
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ("views" ::: Vector (ViewConfigurationView a))
 -> ContT
      ("views" ::: Vector (ViewConfigurationView a))
      IO
      ("views" ::: Vector (ViewConfigurationView a)))
-> IO ("views" ::: Vector (ViewConfigurationView a))
-> ContT
     ("views" ::: Vector (ViewConfigurationView a))
     IO
     ("views" ::: Vector (ViewConfigurationView a))
forall a b. (a -> b) -> a -> b
$ Int
-> (Int -> IO (ViewConfigurationView a))
-> IO ("views" ::: Vector (ViewConfigurationView a))
forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM (("viewConfigurationTypeCapacityInput" ::: Word32) -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral ("viewConfigurationTypeCapacityInput" ::: Word32
viewCountOutput')) (\i :: Int
i -> Ptr (ViewConfigurationView a) -> IO (ViewConfigurationView a)
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @(ViewConfigurationView _) (((Ptr (ViewConfigurationView a)
pViews) Ptr (ViewConfigurationView a)
-> Int -> Ptr (ViewConfigurationView a)
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (40 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr (ViewConfigurationView _))))
  ("views" ::: Vector (ViewConfigurationView a))
-> ContT
     ("views" ::: Vector (ViewConfigurationView a))
     IO
     ("views" ::: Vector (ViewConfigurationView a))
forall (f :: * -> *) a. Applicative f => a -> f a
pure (("views" ::: Vector (ViewConfigurationView a))
 -> ContT
      ("views" ::: Vector (ViewConfigurationView a))
      IO
      ("views" ::: Vector (ViewConfigurationView a)))
-> ("views" ::: Vector (ViewConfigurationView a))
-> ContT
     ("views" ::: Vector (ViewConfigurationView a))
     IO
     ("views" ::: Vector (ViewConfigurationView a))
forall a b. (a -> b) -> a -> b
$ ("views" ::: Vector (ViewConfigurationView a)
views')


-- | XrViewConfigurationView - Individual view configuration
--
-- == Member Descriptions
--
-- = Description
--
-- See 'OpenXR.Core10.OtherTypes.SwapchainSubImage' for more information
-- about @imageRect@ values, and 'OpenXR.Core10.Image.SwapchainCreateInfo'
-- for more information about creating swapchains appropriately sized to
-- support those @imageRect@ values.
--
-- The array of 'ViewConfigurationView' returned by the runtime /must/
-- adhere to the rules defined in
-- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#view_configuration_type >,
-- such as the count and association to the left and right eyes.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- 'OpenXR.Core10.Enums.StructureType.StructureType',
-- 'ViewConfigurationProperties',
-- 'OpenXR.Core10.Enums.ViewConfigurationType.ViewConfigurationType',
-- 'enumerateViewConfigurationViews'
data ViewConfigurationView (es :: [Type]) = ViewConfigurationView
  { -- | @next@ is @NULL@ or a pointer to the next structure in a structure
    -- chain. No such structures are defined in core OpenXR.
    --
    -- #VUID-XrViewConfigurationView-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:
    -- 'OpenXR.Extensions.XR_EXT_view_configuration_depth_range.ViewConfigurationDepthRangeEXT',
    -- 'OpenXR.Extensions.XR_EPIC_view_configuration_fov.ViewConfigurationViewFovEPIC'
    ViewConfigurationView es -> Chain es
next :: Chain es
  , -- | @recommendedImageRectWidth@ is the optimal width of @imageRect@ to use
    -- when rendering this view into a swapchain.
    ViewConfigurationView es
-> "viewConfigurationTypeCapacityInput" ::: Word32
recommendedImageRectWidth :: Word32
  , -- | @maxImageRectWidth@ is the maximum width of @imageRect@ supported when
    -- rendering this view into a swapchain.
    ViewConfigurationView es
-> "viewConfigurationTypeCapacityInput" ::: Word32
maxImageRectWidth :: Word32
  , -- | @recommendedImageRectHeight@ is the optimal height of @imageRect@ to use
    -- when rendering this view into a swapchain.
    ViewConfigurationView es
-> "viewConfigurationTypeCapacityInput" ::: Word32
recommendedImageRectHeight :: Word32
  , -- | @maxImageRectHeight@ is the maximum height of @imageRect@ supported when
    -- rendering this view into a swapchain.
    ViewConfigurationView es
-> "viewConfigurationTypeCapacityInput" ::: Word32
maxImageRectHeight :: Word32
  , -- | @recommendedSwapchainSampleCount@ is the recommended number of sub-data
    -- element samples to create for each swapchain image that will be rendered
    -- into for this view.
    ViewConfigurationView es
-> "viewConfigurationTypeCapacityInput" ::: Word32
recommendedSwapchainSampleCount :: Word32
  , -- | @maxSwapchainSampleCount@ is the maximum number of sub-data element
    -- samples supported for swapchain images that will be rendered into for
    -- this view.
    ViewConfigurationView es
-> "viewConfigurationTypeCapacityInput" ::: Word32
maxSwapchainSampleCount :: Word32
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ViewConfigurationView (es :: [Type]))
#endif
deriving instance Show (Chain es) => Show (ViewConfigurationView es)

instance Extensible ViewConfigurationView where
  extensibleTypeName :: String
extensibleTypeName = "ViewConfigurationView"
  setNext :: ViewConfigurationView ds -> Chain es -> ViewConfigurationView es
setNext x :: ViewConfigurationView ds
x next :: Chain es
next = ViewConfigurationView ds
x{$sel:next:ViewConfigurationView :: Chain es
next = Chain es
next}
  getNext :: ViewConfigurationView es -> Chain es
getNext ViewConfigurationView{..} = Chain es
next
  extends :: forall e b proxy. Typeable e => proxy e -> (Extends ViewConfigurationView e => b) -> Maybe b
  extends :: proxy e -> (Extends ViewConfigurationView e => b) -> Maybe b
extends _ f :: Extends ViewConfigurationView e => b
f
    | Just Refl <- (Typeable e, Typeable ViewConfigurationViewFovEPIC) =>
Maybe (e :~: ViewConfigurationViewFovEPIC)
forall k (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
eqT @e @ViewConfigurationViewFovEPIC = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends ViewConfigurationView e => b
f
    | Just Refl <- (Typeable e, Typeable ViewConfigurationDepthRangeEXT) =>
Maybe (e :~: ViewConfigurationDepthRangeEXT)
forall k (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
eqT @e @ViewConfigurationDepthRangeEXT = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends ViewConfigurationView e => b
f
    | Bool
otherwise = Maybe b
forall a. Maybe a
Nothing

instance (Extendss ViewConfigurationView es, PokeChain es) => ToCStruct (ViewConfigurationView es) where
  withCStruct :: ViewConfigurationView es
-> (Ptr (ViewConfigurationView es) -> IO b) -> IO b
withCStruct x :: ViewConfigurationView es
x f :: Ptr (ViewConfigurationView es) -> IO b
f = Int -> Int -> (Ptr (ViewConfigurationView es) -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 40 8 ((Ptr (ViewConfigurationView es) -> IO b) -> IO b)
-> (Ptr (ViewConfigurationView es) -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr (ViewConfigurationView es)
p -> Ptr (ViewConfigurationView es)
-> ViewConfigurationView es -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr (ViewConfigurationView es)
p ViewConfigurationView es
x (Ptr (ViewConfigurationView es) -> IO b
f Ptr (ViewConfigurationView es)
p)
  pokeCStruct :: Ptr (ViewConfigurationView es)
-> ViewConfigurationView es -> IO b -> IO b
pokeCStruct p :: Ptr (ViewConfigurationView es)
p ViewConfigurationView{..} f :: IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (ViewConfigurationView es)
p Ptr (ViewConfigurationView es) -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
TYPE_VIEW_CONFIGURATION_VIEW)
    Ptr ()
next'' <- (Ptr (Chain es) -> Ptr ())
-> ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Ptr (Chain es) -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr (ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ()))
-> (((Ptr (Chain es) -> IO b) -> IO b)
    -> ContT b IO (Ptr (Chain es)))
-> ((Ptr (Chain es) -> IO b) -> IO b)
-> ContT b IO (Ptr ())
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr (Chain es))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ()))
-> ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ Chain es -> (Ptr (Chain es) -> IO b) -> IO b
forall (es :: [*]) a.
PokeChain es =>
Chain es -> (Ptr (Chain es) -> IO a) -> IO a
withChain (Chain es
next)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (ViewConfigurationView es)
p Ptr (ViewConfigurationView es) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) Ptr ()
next''
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ ("viewConfigurationTypeCountOutput"
 ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
-> ("viewConfigurationTypeCapacityInput" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (ViewConfigurationView es)
p Ptr (ViewConfigurationView es)
-> Int
-> "viewConfigurationTypeCountOutput"
   ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Word32)) ("viewConfigurationTypeCapacityInput" ::: Word32
recommendedImageRectWidth)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ ("viewConfigurationTypeCountOutput"
 ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
-> ("viewConfigurationTypeCapacityInput" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (ViewConfigurationView es)
p Ptr (ViewConfigurationView es)
-> Int
-> "viewConfigurationTypeCountOutput"
   ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Word32)) ("viewConfigurationTypeCapacityInput" ::: Word32
maxImageRectWidth)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ ("viewConfigurationTypeCountOutput"
 ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
-> ("viewConfigurationTypeCapacityInput" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (ViewConfigurationView es)
p Ptr (ViewConfigurationView es)
-> Int
-> "viewConfigurationTypeCountOutput"
   ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr Word32)) ("viewConfigurationTypeCapacityInput" ::: Word32
recommendedImageRectHeight)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ ("viewConfigurationTypeCountOutput"
 ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
-> ("viewConfigurationTypeCapacityInput" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (ViewConfigurationView es)
p Ptr (ViewConfigurationView es)
-> Int
-> "viewConfigurationTypeCountOutput"
   ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 28 :: Ptr Word32)) ("viewConfigurationTypeCapacityInput" ::: Word32
maxImageRectHeight)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ ("viewConfigurationTypeCountOutput"
 ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
-> ("viewConfigurationTypeCapacityInput" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (ViewConfigurationView es)
p Ptr (ViewConfigurationView es)
-> Int
-> "viewConfigurationTypeCountOutput"
   ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr Word32)) ("viewConfigurationTypeCapacityInput" ::: Word32
recommendedSwapchainSampleCount)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ ("viewConfigurationTypeCountOutput"
 ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
-> ("viewConfigurationTypeCapacityInput" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (ViewConfigurationView es)
p Ptr (ViewConfigurationView es)
-> Int
-> "viewConfigurationTypeCountOutput"
   ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 36 :: Ptr Word32)) ("viewConfigurationTypeCapacityInput" ::: Word32
maxSwapchainSampleCount)
    IO b -> ContT b IO b
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO b -> ContT b IO b) -> IO b -> ContT b IO b
forall a b. (a -> b) -> a -> b
$ IO b
f
  cStructSize :: Int
cStructSize = 40
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr (ViewConfigurationView es) -> IO b -> IO b
pokeZeroCStruct p :: Ptr (ViewConfigurationView es)
p f :: IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (ViewConfigurationView es)
p Ptr (ViewConfigurationView es) -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
TYPE_VIEW_CONFIGURATION_VIEW)
    Ptr ()
pNext' <- (Ptr (Chain es) -> Ptr ())
-> ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Ptr (Chain es) -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr (ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ()))
-> (((Ptr (Chain es) -> IO b) -> IO b)
    -> ContT b IO (Ptr (Chain es)))
-> ((Ptr (Chain es) -> IO b) -> IO b)
-> ContT b IO (Ptr ())
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr (Chain es))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ()))
-> ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ forall a. PokeChain es => (Ptr (Chain es) -> IO a) -> IO a
forall (es :: [*]) a.
PokeChain es =>
(Ptr (Chain es) -> IO a) -> IO a
withZeroChain @es
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (ViewConfigurationView es)
p Ptr (ViewConfigurationView es) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) Ptr ()
pNext'
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ ("viewConfigurationTypeCountOutput"
 ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
-> ("viewConfigurationTypeCapacityInput" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (ViewConfigurationView es)
p Ptr (ViewConfigurationView es)
-> Int
-> "viewConfigurationTypeCountOutput"
   ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Word32)) ("viewConfigurationTypeCapacityInput" ::: Word32
forall a. Zero a => a
zero)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ ("viewConfigurationTypeCountOutput"
 ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
-> ("viewConfigurationTypeCapacityInput" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (ViewConfigurationView es)
p Ptr (ViewConfigurationView es)
-> Int
-> "viewConfigurationTypeCountOutput"
   ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Word32)) ("viewConfigurationTypeCapacityInput" ::: Word32
forall a. Zero a => a
zero)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ ("viewConfigurationTypeCountOutput"
 ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
-> ("viewConfigurationTypeCapacityInput" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (ViewConfigurationView es)
p Ptr (ViewConfigurationView es)
-> Int
-> "viewConfigurationTypeCountOutput"
   ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr Word32)) ("viewConfigurationTypeCapacityInput" ::: Word32
forall a. Zero a => a
zero)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ ("viewConfigurationTypeCountOutput"
 ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
-> ("viewConfigurationTypeCapacityInput" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (ViewConfigurationView es)
p Ptr (ViewConfigurationView es)
-> Int
-> "viewConfigurationTypeCountOutput"
   ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 28 :: Ptr Word32)) ("viewConfigurationTypeCapacityInput" ::: Word32
forall a. Zero a => a
zero)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ ("viewConfigurationTypeCountOutput"
 ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
-> ("viewConfigurationTypeCapacityInput" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (ViewConfigurationView es)
p Ptr (ViewConfigurationView es)
-> Int
-> "viewConfigurationTypeCountOutput"
   ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr Word32)) ("viewConfigurationTypeCapacityInput" ::: Word32
forall a. Zero a => a
zero)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ ("viewConfigurationTypeCountOutput"
 ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
-> ("viewConfigurationTypeCapacityInput" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (ViewConfigurationView es)
p Ptr (ViewConfigurationView es)
-> Int
-> "viewConfigurationTypeCountOutput"
   ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 36 :: Ptr Word32)) ("viewConfigurationTypeCapacityInput" ::: Word32
forall a. Zero a => a
zero)
    IO b -> ContT b IO b
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO b -> ContT b IO b) -> IO b -> ContT b IO b
forall a b. (a -> b) -> a -> b
$ IO b
f

instance (Extendss ViewConfigurationView es, PeekChain es) => FromCStruct (ViewConfigurationView es) where
  peekCStruct :: Ptr (ViewConfigurationView es) -> IO (ViewConfigurationView es)
peekCStruct p :: Ptr (ViewConfigurationView es)
p = do
    Ptr ()
next <- Ptr (Ptr ()) -> IO (Ptr ())
forall a. Storable a => Ptr a -> IO a
peek @(Ptr ()) ((Ptr (ViewConfigurationView es)
p Ptr (ViewConfigurationView es) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ())))
    Chain es
next' <- Ptr (Chain es) -> IO (Chain es)
forall (es :: [*]). PeekChain es => Ptr (Chain es) -> IO (Chain es)
peekChain (Ptr () -> Ptr (Chain es)
forall a b. Ptr a -> Ptr b
castPtr Ptr ()
next)
    "viewConfigurationTypeCapacityInput" ::: Word32
recommendedImageRectWidth <- ("viewConfigurationTypeCountOutput"
 ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
-> IO ("viewConfigurationTypeCapacityInput" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr (ViewConfigurationView es)
p Ptr (ViewConfigurationView es)
-> Int
-> "viewConfigurationTypeCountOutput"
   ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Word32))
    "viewConfigurationTypeCapacityInput" ::: Word32
maxImageRectWidth <- ("viewConfigurationTypeCountOutput"
 ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
-> IO ("viewConfigurationTypeCapacityInput" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr (ViewConfigurationView es)
p Ptr (ViewConfigurationView es)
-> Int
-> "viewConfigurationTypeCountOutput"
   ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Word32))
    "viewConfigurationTypeCapacityInput" ::: Word32
recommendedImageRectHeight <- ("viewConfigurationTypeCountOutput"
 ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
-> IO ("viewConfigurationTypeCapacityInput" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr (ViewConfigurationView es)
p Ptr (ViewConfigurationView es)
-> Int
-> "viewConfigurationTypeCountOutput"
   ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr Word32))
    "viewConfigurationTypeCapacityInput" ::: Word32
maxImageRectHeight <- ("viewConfigurationTypeCountOutput"
 ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
-> IO ("viewConfigurationTypeCapacityInput" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr (ViewConfigurationView es)
p Ptr (ViewConfigurationView es)
-> Int
-> "viewConfigurationTypeCountOutput"
   ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 28 :: Ptr Word32))
    "viewConfigurationTypeCapacityInput" ::: Word32
recommendedSwapchainSampleCount <- ("viewConfigurationTypeCountOutput"
 ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
-> IO ("viewConfigurationTypeCapacityInput" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr (ViewConfigurationView es)
p Ptr (ViewConfigurationView es)
-> Int
-> "viewConfigurationTypeCountOutput"
   ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr Word32))
    "viewConfigurationTypeCapacityInput" ::: Word32
maxSwapchainSampleCount <- ("viewConfigurationTypeCountOutput"
 ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32))
-> IO ("viewConfigurationTypeCapacityInput" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr (ViewConfigurationView es)
p Ptr (ViewConfigurationView es)
-> Int
-> "viewConfigurationTypeCountOutput"
   ::: Ptr ("viewConfigurationTypeCapacityInput" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 36 :: Ptr Word32))
    ViewConfigurationView es -> IO (ViewConfigurationView es)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ViewConfigurationView es -> IO (ViewConfigurationView es))
-> ViewConfigurationView es -> IO (ViewConfigurationView es)
forall a b. (a -> b) -> a -> b
$ Chain es
-> ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ViewConfigurationView es
forall (es :: [*]).
Chain es
-> ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ViewConfigurationView es
ViewConfigurationView
             Chain es
next' "viewConfigurationTypeCapacityInput" ::: Word32
recommendedImageRectWidth "viewConfigurationTypeCapacityInput" ::: Word32
maxImageRectWidth "viewConfigurationTypeCapacityInput" ::: Word32
recommendedImageRectHeight "viewConfigurationTypeCapacityInput" ::: Word32
maxImageRectHeight "viewConfigurationTypeCapacityInput" ::: Word32
recommendedSwapchainSampleCount "viewConfigurationTypeCapacityInput" ::: Word32
maxSwapchainSampleCount

instance es ~ '[] => Zero (ViewConfigurationView es) where
  zero :: ViewConfigurationView es
zero = Chain es
-> ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ViewConfigurationView es
forall (es :: [*]).
Chain es
-> ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ("viewConfigurationTypeCapacityInput" ::: Word32)
-> ViewConfigurationView es
ViewConfigurationView
           ()
           "viewConfigurationTypeCapacityInput" ::: Word32
forall a. Zero a => a
zero
           "viewConfigurationTypeCapacityInput" ::: Word32
forall a. Zero a => a
zero
           "viewConfigurationTypeCapacityInput" ::: Word32
forall a. Zero a => a
zero
           "viewConfigurationTypeCapacityInput" ::: Word32
forall a. Zero a => a
zero
           "viewConfigurationTypeCapacityInput" ::: Word32
forall a. Zero a => a
zero
           "viewConfigurationTypeCapacityInput" ::: Word32
forall a. Zero a => a
zero


-- | XrViewConfigurationProperties - Detailed configuration properties for an
-- XrViewConfigurationProperties
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrBool32 >,
-- 'OpenXR.Core10.Enums.StructureType.StructureType',
-- 'OpenXR.Core10.Enums.ViewConfigurationType.ViewConfigurationType',
-- 'ViewConfigurationView', 'getViewConfigurationProperties'
data ViewConfigurationProperties = ViewConfigurationProperties
  { -- | @viewConfigurationType@ is the
    -- 'OpenXR.Core10.Enums.ViewConfigurationType.ViewConfigurationType' of the
    -- configuration.
    --
    -- #VUID-XrViewConfigurationProperties-viewConfigurationType-parameter#
    -- @viewConfigurationType@ /must/ be a valid
    -- 'OpenXR.Core10.Enums.ViewConfigurationType.ViewConfigurationType' value
    ViewConfigurationProperties -> ViewConfigurationType
viewConfigurationType :: ViewConfigurationType
  , -- | @fovMutable@ indicates if the view field of view can be modified by the
    -- application.
    ViewConfigurationProperties -> Bool
fovMutable :: Bool
  }
  deriving (Typeable, ViewConfigurationProperties -> ViewConfigurationProperties -> Bool
(ViewConfigurationProperties
 -> ViewConfigurationProperties -> Bool)
-> (ViewConfigurationProperties
    -> ViewConfigurationProperties -> Bool)
-> Eq ViewConfigurationProperties
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ViewConfigurationProperties -> ViewConfigurationProperties -> Bool
$c/= :: ViewConfigurationProperties -> ViewConfigurationProperties -> Bool
== :: ViewConfigurationProperties -> ViewConfigurationProperties -> Bool
$c== :: ViewConfigurationProperties -> ViewConfigurationProperties -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ViewConfigurationProperties)
#endif
deriving instance Show ViewConfigurationProperties

instance ToCStruct ViewConfigurationProperties where
  withCStruct :: ViewConfigurationProperties
-> (Ptr ViewConfigurationProperties -> IO b) -> IO b
withCStruct x :: ViewConfigurationProperties
x f :: Ptr ViewConfigurationProperties -> IO b
f = Int -> Int -> (Ptr ViewConfigurationProperties -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 24 8 ((Ptr ViewConfigurationProperties -> IO b) -> IO b)
-> (Ptr ViewConfigurationProperties -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr ViewConfigurationProperties
p -> Ptr ViewConfigurationProperties
-> ViewConfigurationProperties -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr ViewConfigurationProperties
p ViewConfigurationProperties
x (Ptr ViewConfigurationProperties -> IO b
f Ptr ViewConfigurationProperties
p)
  pokeCStruct :: Ptr ViewConfigurationProperties
-> ViewConfigurationProperties -> IO b -> IO b
pokeCStruct p :: Ptr ViewConfigurationProperties
p ViewConfigurationProperties{..} f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ViewConfigurationProperties
p Ptr ViewConfigurationProperties -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
TYPE_VIEW_CONFIGURATION_PROPERTIES)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ViewConfigurationProperties
p Ptr ViewConfigurationProperties -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    ("viewConfigurationTypes" ::: Ptr ViewConfigurationType)
-> ViewConfigurationType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ViewConfigurationProperties
p Ptr ViewConfigurationProperties
-> Int -> "viewConfigurationTypes" ::: Ptr ViewConfigurationType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr ViewConfigurationType)) (ViewConfigurationType
viewConfigurationType)
    Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ViewConfigurationProperties
p Ptr ViewConfigurationProperties -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
fovMutable))
    IO b
f
  cStructSize :: Int
cStructSize = 24
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr ViewConfigurationProperties -> IO b -> IO b
pokeZeroCStruct p :: Ptr ViewConfigurationProperties
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ViewConfigurationProperties
p Ptr ViewConfigurationProperties -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
TYPE_VIEW_CONFIGURATION_PROPERTIES)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ViewConfigurationProperties
p Ptr ViewConfigurationProperties -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    ("viewConfigurationTypes" ::: Ptr ViewConfigurationType)
-> ViewConfigurationType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ViewConfigurationProperties
p Ptr ViewConfigurationProperties
-> Int -> "viewConfigurationTypes" ::: Ptr ViewConfigurationType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr ViewConfigurationType)) (ViewConfigurationType
forall a. Zero a => a
zero)
    Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ViewConfigurationProperties
p Ptr ViewConfigurationProperties -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
forall a. Zero a => a
zero))
    IO b
f

instance FromCStruct ViewConfigurationProperties where
  peekCStruct :: Ptr ViewConfigurationProperties -> IO ViewConfigurationProperties
peekCStruct p :: Ptr ViewConfigurationProperties
p = do
    ViewConfigurationType
viewConfigurationType <- ("viewConfigurationTypes" ::: Ptr ViewConfigurationType)
-> IO ViewConfigurationType
forall a. Storable a => Ptr a -> IO a
peek @ViewConfigurationType ((Ptr ViewConfigurationProperties
p Ptr ViewConfigurationProperties
-> Int -> "viewConfigurationTypes" ::: Ptr ViewConfigurationType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr ViewConfigurationType))
    Bool32
fovMutable <- Ptr Bool32 -> IO Bool32
forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr ViewConfigurationProperties
p Ptr ViewConfigurationProperties -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Bool32))
    ViewConfigurationProperties -> IO ViewConfigurationProperties
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ViewConfigurationProperties -> IO ViewConfigurationProperties)
-> ViewConfigurationProperties -> IO ViewConfigurationProperties
forall a b. (a -> b) -> a -> b
$ ViewConfigurationType -> Bool -> ViewConfigurationProperties
ViewConfigurationProperties
             ViewConfigurationType
viewConfigurationType (Bool32 -> Bool
bool32ToBool Bool32
fovMutable)

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

instance Zero ViewConfigurationProperties where
  zero :: ViewConfigurationProperties
zero = ViewConfigurationType -> Bool -> ViewConfigurationProperties
ViewConfigurationProperties
           ViewConfigurationType
forall a. Zero a => a
zero
           Bool
forall a. Zero a => a
zero