{-# language CPP #-}
module OpenXR.Extensions.XR_KHR_android_create_instance ( InstanceCreateInfoAndroidKHR(..)
, KHR_android_create_instance_SPEC_VERSION
, pattern KHR_android_create_instance_SPEC_VERSION
, KHR_ANDROID_CREATE_INSTANCE_EXTENSION_NAME
, pattern KHR_ANDROID_CREATE_INSTANCE_EXTENSION_NAME
) where
import Foreign.Marshal.Alloc (allocaBytesAligned)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import OpenXR.CStruct (FromCStruct)
import OpenXR.CStruct (FromCStruct(..))
import OpenXR.CStruct (ToCStruct)
import OpenXR.CStruct (ToCStruct(..))
import OpenXR.Zero (Zero(..))
import Data.String (IsString)
import Data.Typeable (Typeable)
import Foreign.Storable (Storable)
import Foreign.Storable (Storable(peek))
import Foreign.Storable (Storable(poke))
import qualified Foreign.Storable (Storable(..))
import GHC.Generics (Generic)
import Foreign.Ptr (Ptr)
import Data.Kind (Type)
import OpenXR.Core10.Enums.StructureType (StructureType)
import OpenXR.Core10.Enums.StructureType (StructureType(TYPE_INSTANCE_CREATE_INFO_ANDROID_KHR))
data InstanceCreateInfoAndroidKHR = InstanceCreateInfoAndroidKHR
{
InstanceCreateInfoAndroidKHR -> Ptr ()
applicationVM :: Ptr ()
,
InstanceCreateInfoAndroidKHR -> Ptr ()
applicationActivity :: Ptr ()
}
deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (InstanceCreateInfoAndroidKHR)
#endif
deriving instance Show InstanceCreateInfoAndroidKHR
instance ToCStruct InstanceCreateInfoAndroidKHR where
withCStruct :: InstanceCreateInfoAndroidKHR
-> (Ptr InstanceCreateInfoAndroidKHR -> IO b) -> IO b
withCStruct x :: InstanceCreateInfoAndroidKHR
x f :: Ptr InstanceCreateInfoAndroidKHR -> IO b
f = Int -> Int -> (Ptr InstanceCreateInfoAndroidKHR -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 32 8 ((Ptr InstanceCreateInfoAndroidKHR -> IO b) -> IO b)
-> (Ptr InstanceCreateInfoAndroidKHR -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr InstanceCreateInfoAndroidKHR
p -> Ptr InstanceCreateInfoAndroidKHR
-> InstanceCreateInfoAndroidKHR -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr InstanceCreateInfoAndroidKHR
p InstanceCreateInfoAndroidKHR
x (Ptr InstanceCreateInfoAndroidKHR -> IO b
f Ptr InstanceCreateInfoAndroidKHR
p)
pokeCStruct :: Ptr InstanceCreateInfoAndroidKHR
-> InstanceCreateInfoAndroidKHR -> IO b -> IO b
pokeCStruct p :: Ptr InstanceCreateInfoAndroidKHR
p InstanceCreateInfoAndroidKHR{..} f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr InstanceCreateInfoAndroidKHR
p Ptr InstanceCreateInfoAndroidKHR -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
TYPE_INSTANCE_CREATE_INFO_ANDROID_KHR)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr InstanceCreateInfoAndroidKHR
p Ptr InstanceCreateInfoAndroidKHR -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr InstanceCreateInfoAndroidKHR
p Ptr InstanceCreateInfoAndroidKHR -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr (Ptr ()))) (Ptr ()
applicationVM)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr InstanceCreateInfoAndroidKHR
p Ptr InstanceCreateInfoAndroidKHR -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr (Ptr ()))) (Ptr ()
applicationActivity)
IO b
f
cStructSize :: Int
cStructSize = 32
cStructAlignment :: Int
cStructAlignment = 8
pokeZeroCStruct :: Ptr InstanceCreateInfoAndroidKHR -> IO b -> IO b
pokeZeroCStruct p :: Ptr InstanceCreateInfoAndroidKHR
p f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr InstanceCreateInfoAndroidKHR
p Ptr InstanceCreateInfoAndroidKHR -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
TYPE_INSTANCE_CREATE_INFO_ANDROID_KHR)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr InstanceCreateInfoAndroidKHR
p Ptr InstanceCreateInfoAndroidKHR -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr InstanceCreateInfoAndroidKHR
p Ptr InstanceCreateInfoAndroidKHR -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr (Ptr ()))) (Ptr ()
forall a. Zero a => a
zero)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr InstanceCreateInfoAndroidKHR
p Ptr InstanceCreateInfoAndroidKHR -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr (Ptr ()))) (Ptr ()
forall a. Zero a => a
zero)
IO b
f
instance FromCStruct InstanceCreateInfoAndroidKHR where
peekCStruct :: Ptr InstanceCreateInfoAndroidKHR -> IO InstanceCreateInfoAndroidKHR
peekCStruct p :: Ptr InstanceCreateInfoAndroidKHR
p = do
Ptr ()
applicationVM <- Ptr (Ptr ()) -> IO (Ptr ())
forall a. Storable a => Ptr a -> IO a
peek @(Ptr ()) ((Ptr InstanceCreateInfoAndroidKHR
p Ptr InstanceCreateInfoAndroidKHR -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr (Ptr ())))
Ptr ()
applicationActivity <- Ptr (Ptr ()) -> IO (Ptr ())
forall a. Storable a => Ptr a -> IO a
peek @(Ptr ()) ((Ptr InstanceCreateInfoAndroidKHR
p Ptr InstanceCreateInfoAndroidKHR -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr (Ptr ())))
InstanceCreateInfoAndroidKHR -> IO InstanceCreateInfoAndroidKHR
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InstanceCreateInfoAndroidKHR -> IO InstanceCreateInfoAndroidKHR)
-> InstanceCreateInfoAndroidKHR -> IO InstanceCreateInfoAndroidKHR
forall a b. (a -> b) -> a -> b
$ Ptr () -> Ptr () -> InstanceCreateInfoAndroidKHR
InstanceCreateInfoAndroidKHR
Ptr ()
applicationVM Ptr ()
applicationActivity
instance Storable InstanceCreateInfoAndroidKHR where
sizeOf :: InstanceCreateInfoAndroidKHR -> Int
sizeOf ~InstanceCreateInfoAndroidKHR
_ = 32
alignment :: InstanceCreateInfoAndroidKHR -> Int
alignment ~InstanceCreateInfoAndroidKHR
_ = 8
peek :: Ptr InstanceCreateInfoAndroidKHR -> IO InstanceCreateInfoAndroidKHR
peek = Ptr InstanceCreateInfoAndroidKHR -> IO InstanceCreateInfoAndroidKHR
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: Ptr InstanceCreateInfoAndroidKHR
-> InstanceCreateInfoAndroidKHR -> IO ()
poke ptr :: Ptr InstanceCreateInfoAndroidKHR
ptr poked :: InstanceCreateInfoAndroidKHR
poked = Ptr InstanceCreateInfoAndroidKHR
-> InstanceCreateInfoAndroidKHR -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr InstanceCreateInfoAndroidKHR
ptr InstanceCreateInfoAndroidKHR
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero InstanceCreateInfoAndroidKHR where
zero :: InstanceCreateInfoAndroidKHR
zero = Ptr () -> Ptr () -> InstanceCreateInfoAndroidKHR
InstanceCreateInfoAndroidKHR
Ptr ()
forall a. Zero a => a
zero
Ptr ()
forall a. Zero a => a
zero
type KHR_android_create_instance_SPEC_VERSION = 3
pattern KHR_android_create_instance_SPEC_VERSION :: forall a . Integral a => a
pattern $bKHR_android_create_instance_SPEC_VERSION :: a
$mKHR_android_create_instance_SPEC_VERSION :: forall r a. Integral a => a -> (Void# -> r) -> (Void# -> r) -> r
KHR_android_create_instance_SPEC_VERSION = 3
type KHR_ANDROID_CREATE_INSTANCE_EXTENSION_NAME = "XR_KHR_android_create_instance"
pattern KHR_ANDROID_CREATE_INSTANCE_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bKHR_ANDROID_CREATE_INSTANCE_EXTENSION_NAME :: a
$mKHR_ANDROID_CREATE_INSTANCE_EXTENSION_NAME :: forall r a.
(Eq a, IsString a) =>
a -> (Void# -> r) -> (Void# -> r) -> r
KHR_ANDROID_CREATE_INSTANCE_EXTENSION_NAME = "XR_KHR_android_create_instance"