{-# language CPP #-}
module OpenXR.Extensions.XR_KHR_android_thread_settings ( setAndroidApplicationThreadKHR
, AndroidThreadTypeKHR( ANDROID_THREAD_TYPE_APPLICATION_MAIN_KHR
, ANDROID_THREAD_TYPE_APPLICATION_WORKER_KHR
, ANDROID_THREAD_TYPE_RENDERER_MAIN_KHR
, ANDROID_THREAD_TYPE_RENDERER_WORKER_KHR
, ..
)
, KHR_android_thread_settings_SPEC_VERSION
, pattern KHR_android_thread_settings_SPEC_VERSION
, KHR_ANDROID_THREAD_SETTINGS_EXTENSION_NAME
, pattern KHR_ANDROID_THREAD_SETTINGS_EXTENSION_NAME
) where
import OpenXR.Internal.Utils (enumReadPrec)
import OpenXR.Internal.Utils (enumShowsPrec)
import OpenXR.Internal.Utils (traceAroundEvent)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import GHC.Base (when)
import GHC.IO (throwIO)
import GHC.Ptr (nullFunPtr)
import GHC.Show (showsPrec)
import OpenXR.Zero (Zero)
import Control.Monad.IO.Class (MonadIO)
import Data.String (IsString)
import Foreign.Storable (Storable)
import GHC.IO.Exception (IOErrorType(..))
import GHC.IO.Exception (IOException(..))
import Data.Int (Int32)
import Foreign.Ptr (FunPtr)
import Foreign.Ptr (Ptr)
import GHC.Read (Read(readPrec))
import GHC.Show (Show(showsPrec))
import Data.Word (Word32)
import OpenXR.NamedType ((:::))
import OpenXR.Dynamic (InstanceCmds(pXrSetAndroidApplicationThreadKHR))
import OpenXR.Exception (OpenXrException(..))
import OpenXR.Core10.Enums.Result (Result)
import OpenXR.Core10.Enums.Result (Result(..))
import OpenXR.Core10.Handles (Session)
import OpenXR.Core10.Handles (Session(..))
import OpenXR.Core10.Handles (Session_T)
import OpenXR.Core10.Enums.Result (Result(SUCCESS))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkXrSetAndroidApplicationThreadKHR
:: FunPtr (Ptr Session_T -> AndroidThreadTypeKHR -> Word32 -> IO Result) -> Ptr Session_T -> AndroidThreadTypeKHR -> Word32 -> IO Result
setAndroidApplicationThreadKHR :: forall io
. (MonadIO io)
=>
Session
->
AndroidThreadTypeKHR
->
("threadId" ::: Word32)
-> io (Result)
setAndroidApplicationThreadKHR :: Session
-> AndroidThreadTypeKHR -> ("threadId" ::: Word32) -> io Result
setAndroidApplicationThreadKHR session :: Session
session threadType :: AndroidThreadTypeKHR
threadType threadId :: "threadId" ::: Word32
threadId = IO Result -> io Result
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Result -> io Result) -> IO Result -> io Result
forall a b. (a -> b) -> a -> b
$ do
let xrSetAndroidApplicationThreadKHRPtr :: FunPtr
(Ptr Session_T
-> AndroidThreadTypeKHR -> ("threadId" ::: Word32) -> IO Result)
xrSetAndroidApplicationThreadKHRPtr = InstanceCmds
-> FunPtr
(Ptr Session_T
-> AndroidThreadTypeKHR -> ("threadId" ::: Word32) -> IO Result)
pXrSetAndroidApplicationThreadKHR (Session -> InstanceCmds
instanceCmds (Session
session :: Session))
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
(Ptr Session_T
-> AndroidThreadTypeKHR -> ("threadId" ::: Word32) -> IO Result)
xrSetAndroidApplicationThreadKHRPtr FunPtr
(Ptr Session_T
-> AndroidThreadTypeKHR -> ("threadId" ::: Word32) -> IO Result)
-> FunPtr
(Ptr Session_T
-> AndroidThreadTypeKHR -> ("threadId" ::: Word32) -> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
(Ptr Session_T
-> AndroidThreadTypeKHR -> ("threadId" ::: Word32) -> 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 xrSetAndroidApplicationThreadKHR is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
let xrSetAndroidApplicationThreadKHR' :: Ptr Session_T
-> AndroidThreadTypeKHR -> ("threadId" ::: Word32) -> IO Result
xrSetAndroidApplicationThreadKHR' = FunPtr
(Ptr Session_T
-> AndroidThreadTypeKHR -> ("threadId" ::: Word32) -> IO Result)
-> Ptr Session_T
-> AndroidThreadTypeKHR
-> ("threadId" ::: Word32)
-> IO Result
mkXrSetAndroidApplicationThreadKHR FunPtr
(Ptr Session_T
-> AndroidThreadTypeKHR -> ("threadId" ::: Word32) -> IO Result)
xrSetAndroidApplicationThreadKHRPtr
Result
r <- String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "xrSetAndroidApplicationThreadKHR" (Ptr Session_T
-> AndroidThreadTypeKHR -> ("threadId" ::: Word32) -> IO Result
xrSetAndroidApplicationThreadKHR' (Session -> Ptr Session_T
sessionHandle (Session
session)) (AndroidThreadTypeKHR
threadType) ("threadId" ::: Word32
threadId))
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))
Result -> IO Result
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Result -> IO Result) -> Result -> IO Result
forall a b. (a -> b) -> a -> b
$ (Result
r)
newtype AndroidThreadTypeKHR = AndroidThreadTypeKHR Int32
deriving newtype (AndroidThreadTypeKHR -> AndroidThreadTypeKHR -> Bool
(AndroidThreadTypeKHR -> AndroidThreadTypeKHR -> Bool)
-> (AndroidThreadTypeKHR -> AndroidThreadTypeKHR -> Bool)
-> Eq AndroidThreadTypeKHR
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AndroidThreadTypeKHR -> AndroidThreadTypeKHR -> Bool
$c/= :: AndroidThreadTypeKHR -> AndroidThreadTypeKHR -> Bool
== :: AndroidThreadTypeKHR -> AndroidThreadTypeKHR -> Bool
$c== :: AndroidThreadTypeKHR -> AndroidThreadTypeKHR -> Bool
Eq, Eq AndroidThreadTypeKHR
Eq AndroidThreadTypeKHR =>
(AndroidThreadTypeKHR -> AndroidThreadTypeKHR -> Ordering)
-> (AndroidThreadTypeKHR -> AndroidThreadTypeKHR -> Bool)
-> (AndroidThreadTypeKHR -> AndroidThreadTypeKHR -> Bool)
-> (AndroidThreadTypeKHR -> AndroidThreadTypeKHR -> Bool)
-> (AndroidThreadTypeKHR -> AndroidThreadTypeKHR -> Bool)
-> (AndroidThreadTypeKHR
-> AndroidThreadTypeKHR -> AndroidThreadTypeKHR)
-> (AndroidThreadTypeKHR
-> AndroidThreadTypeKHR -> AndroidThreadTypeKHR)
-> Ord AndroidThreadTypeKHR
AndroidThreadTypeKHR -> AndroidThreadTypeKHR -> Bool
AndroidThreadTypeKHR -> AndroidThreadTypeKHR -> Ordering
AndroidThreadTypeKHR
-> AndroidThreadTypeKHR -> AndroidThreadTypeKHR
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: AndroidThreadTypeKHR
-> AndroidThreadTypeKHR -> AndroidThreadTypeKHR
$cmin :: AndroidThreadTypeKHR
-> AndroidThreadTypeKHR -> AndroidThreadTypeKHR
max :: AndroidThreadTypeKHR
-> AndroidThreadTypeKHR -> AndroidThreadTypeKHR
$cmax :: AndroidThreadTypeKHR
-> AndroidThreadTypeKHR -> AndroidThreadTypeKHR
>= :: AndroidThreadTypeKHR -> AndroidThreadTypeKHR -> Bool
$c>= :: AndroidThreadTypeKHR -> AndroidThreadTypeKHR -> Bool
> :: AndroidThreadTypeKHR -> AndroidThreadTypeKHR -> Bool
$c> :: AndroidThreadTypeKHR -> AndroidThreadTypeKHR -> Bool
<= :: AndroidThreadTypeKHR -> AndroidThreadTypeKHR -> Bool
$c<= :: AndroidThreadTypeKHR -> AndroidThreadTypeKHR -> Bool
< :: AndroidThreadTypeKHR -> AndroidThreadTypeKHR -> Bool
$c< :: AndroidThreadTypeKHR -> AndroidThreadTypeKHR -> Bool
compare :: AndroidThreadTypeKHR -> AndroidThreadTypeKHR -> Ordering
$ccompare :: AndroidThreadTypeKHR -> AndroidThreadTypeKHR -> Ordering
$cp1Ord :: Eq AndroidThreadTypeKHR
Ord, Ptr b -> Int -> IO AndroidThreadTypeKHR
Ptr b -> Int -> AndroidThreadTypeKHR -> IO ()
Ptr AndroidThreadTypeKHR -> IO AndroidThreadTypeKHR
Ptr AndroidThreadTypeKHR -> Int -> IO AndroidThreadTypeKHR
Ptr AndroidThreadTypeKHR -> Int -> AndroidThreadTypeKHR -> IO ()
Ptr AndroidThreadTypeKHR -> AndroidThreadTypeKHR -> IO ()
AndroidThreadTypeKHR -> Int
(AndroidThreadTypeKHR -> Int)
-> (AndroidThreadTypeKHR -> Int)
-> (Ptr AndroidThreadTypeKHR -> Int -> IO AndroidThreadTypeKHR)
-> (Ptr AndroidThreadTypeKHR
-> Int -> AndroidThreadTypeKHR -> IO ())
-> (forall b. Ptr b -> Int -> IO AndroidThreadTypeKHR)
-> (forall b. Ptr b -> Int -> AndroidThreadTypeKHR -> IO ())
-> (Ptr AndroidThreadTypeKHR -> IO AndroidThreadTypeKHR)
-> (Ptr AndroidThreadTypeKHR -> AndroidThreadTypeKHR -> IO ())
-> Storable AndroidThreadTypeKHR
forall b. Ptr b -> Int -> IO AndroidThreadTypeKHR
forall b. Ptr b -> Int -> AndroidThreadTypeKHR -> IO ()
forall a.
(a -> Int)
-> (a -> Int)
-> (Ptr a -> Int -> IO a)
-> (Ptr a -> Int -> a -> IO ())
-> (forall b. Ptr b -> Int -> IO a)
-> (forall b. Ptr b -> Int -> a -> IO ())
-> (Ptr a -> IO a)
-> (Ptr a -> a -> IO ())
-> Storable a
poke :: Ptr AndroidThreadTypeKHR -> AndroidThreadTypeKHR -> IO ()
$cpoke :: Ptr AndroidThreadTypeKHR -> AndroidThreadTypeKHR -> IO ()
peek :: Ptr AndroidThreadTypeKHR -> IO AndroidThreadTypeKHR
$cpeek :: Ptr AndroidThreadTypeKHR -> IO AndroidThreadTypeKHR
pokeByteOff :: Ptr b -> Int -> AndroidThreadTypeKHR -> IO ()
$cpokeByteOff :: forall b. Ptr b -> Int -> AndroidThreadTypeKHR -> IO ()
peekByteOff :: Ptr b -> Int -> IO AndroidThreadTypeKHR
$cpeekByteOff :: forall b. Ptr b -> Int -> IO AndroidThreadTypeKHR
pokeElemOff :: Ptr AndroidThreadTypeKHR -> Int -> AndroidThreadTypeKHR -> IO ()
$cpokeElemOff :: Ptr AndroidThreadTypeKHR -> Int -> AndroidThreadTypeKHR -> IO ()
peekElemOff :: Ptr AndroidThreadTypeKHR -> Int -> IO AndroidThreadTypeKHR
$cpeekElemOff :: Ptr AndroidThreadTypeKHR -> Int -> IO AndroidThreadTypeKHR
alignment :: AndroidThreadTypeKHR -> Int
$calignment :: AndroidThreadTypeKHR -> Int
sizeOf :: AndroidThreadTypeKHR -> Int
$csizeOf :: AndroidThreadTypeKHR -> Int
Storable, AndroidThreadTypeKHR
AndroidThreadTypeKHR -> Zero AndroidThreadTypeKHR
forall a. a -> Zero a
zero :: AndroidThreadTypeKHR
$czero :: AndroidThreadTypeKHR
Zero)
pattern $bANDROID_THREAD_TYPE_APPLICATION_MAIN_KHR :: AndroidThreadTypeKHR
$mANDROID_THREAD_TYPE_APPLICATION_MAIN_KHR :: forall r. AndroidThreadTypeKHR -> (Void# -> r) -> (Void# -> r) -> r
ANDROID_THREAD_TYPE_APPLICATION_MAIN_KHR = AndroidThreadTypeKHR 1
pattern $bANDROID_THREAD_TYPE_APPLICATION_WORKER_KHR :: AndroidThreadTypeKHR
$mANDROID_THREAD_TYPE_APPLICATION_WORKER_KHR :: forall r. AndroidThreadTypeKHR -> (Void# -> r) -> (Void# -> r) -> r
ANDROID_THREAD_TYPE_APPLICATION_WORKER_KHR = AndroidThreadTypeKHR 2
pattern $bANDROID_THREAD_TYPE_RENDERER_MAIN_KHR :: AndroidThreadTypeKHR
$mANDROID_THREAD_TYPE_RENDERER_MAIN_KHR :: forall r. AndroidThreadTypeKHR -> (Void# -> r) -> (Void# -> r) -> r
ANDROID_THREAD_TYPE_RENDERER_MAIN_KHR = AndroidThreadTypeKHR 3
pattern $bANDROID_THREAD_TYPE_RENDERER_WORKER_KHR :: AndroidThreadTypeKHR
$mANDROID_THREAD_TYPE_RENDERER_WORKER_KHR :: forall r. AndroidThreadTypeKHR -> (Void# -> r) -> (Void# -> r) -> r
ANDROID_THREAD_TYPE_RENDERER_WORKER_KHR = AndroidThreadTypeKHR 4
{-# complete ANDROID_THREAD_TYPE_APPLICATION_MAIN_KHR,
ANDROID_THREAD_TYPE_APPLICATION_WORKER_KHR,
ANDROID_THREAD_TYPE_RENDERER_MAIN_KHR,
ANDROID_THREAD_TYPE_RENDERER_WORKER_KHR :: AndroidThreadTypeKHR #-}
conNameAndroidThreadTypeKHR :: String
conNameAndroidThreadTypeKHR :: String
conNameAndroidThreadTypeKHR = "AndroidThreadTypeKHR"
enumPrefixAndroidThreadTypeKHR :: String
enumPrefixAndroidThreadTypeKHR :: String
enumPrefixAndroidThreadTypeKHR = "ANDROID_THREAD_TYPE_"
showTableAndroidThreadTypeKHR :: [(AndroidThreadTypeKHR, String)]
showTableAndroidThreadTypeKHR :: [(AndroidThreadTypeKHR, String)]
showTableAndroidThreadTypeKHR =
[ (AndroidThreadTypeKHR
ANDROID_THREAD_TYPE_APPLICATION_MAIN_KHR , "APPLICATION_MAIN_KHR")
, (AndroidThreadTypeKHR
ANDROID_THREAD_TYPE_APPLICATION_WORKER_KHR, "APPLICATION_WORKER_KHR")
, (AndroidThreadTypeKHR
ANDROID_THREAD_TYPE_RENDERER_MAIN_KHR , "RENDERER_MAIN_KHR")
, (AndroidThreadTypeKHR
ANDROID_THREAD_TYPE_RENDERER_WORKER_KHR , "RENDERER_WORKER_KHR")
]
instance Show AndroidThreadTypeKHR where
showsPrec :: Int -> AndroidThreadTypeKHR -> ShowS
showsPrec = String
-> [(AndroidThreadTypeKHR, String)]
-> String
-> (AndroidThreadTypeKHR -> Int32)
-> (Int32 -> ShowS)
-> Int
-> AndroidThreadTypeKHR
-> ShowS
forall a i.
Eq a =>
String
-> [(a, String)]
-> String
-> (a -> i)
-> (i -> ShowS)
-> Int
-> a
-> ShowS
enumShowsPrec String
enumPrefixAndroidThreadTypeKHR
[(AndroidThreadTypeKHR, String)]
showTableAndroidThreadTypeKHR
String
conNameAndroidThreadTypeKHR
(\(AndroidThreadTypeKHR x :: Int32
x) -> Int32
x)
(Int -> Int32 -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec 11)
instance Read AndroidThreadTypeKHR where
readPrec :: ReadPrec AndroidThreadTypeKHR
readPrec = String
-> [(AndroidThreadTypeKHR, String)]
-> String
-> (Int32 -> AndroidThreadTypeKHR)
-> ReadPrec AndroidThreadTypeKHR
forall i a.
Read i =>
String -> [(a, String)] -> String -> (i -> a) -> ReadPrec a
enumReadPrec String
enumPrefixAndroidThreadTypeKHR
[(AndroidThreadTypeKHR, String)]
showTableAndroidThreadTypeKHR
String
conNameAndroidThreadTypeKHR
Int32 -> AndroidThreadTypeKHR
AndroidThreadTypeKHR
type KHR_android_thread_settings_SPEC_VERSION = 5
pattern KHR_android_thread_settings_SPEC_VERSION :: forall a . Integral a => a
pattern $bKHR_android_thread_settings_SPEC_VERSION :: a
$mKHR_android_thread_settings_SPEC_VERSION :: forall r a. Integral a => a -> (Void# -> r) -> (Void# -> r) -> r
KHR_android_thread_settings_SPEC_VERSION = 5
type KHR_ANDROID_THREAD_SETTINGS_EXTENSION_NAME = "XR_KHR_android_thread_settings"
pattern KHR_ANDROID_THREAD_SETTINGS_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bKHR_ANDROID_THREAD_SETTINGS_EXTENSION_NAME :: a
$mKHR_ANDROID_THREAD_SETTINGS_EXTENSION_NAME :: forall r a.
(Eq a, IsString a) =>
a -> (Void# -> r) -> (Void# -> r) -> r
KHR_ANDROID_THREAD_SETTINGS_EXTENSION_NAME = "XR_KHR_android_thread_settings"