{-# language CPP #-}
-- | = Name
--
-- XR_KHR_binding_modification - instance extension
--
-- = Specification
--
-- See
-- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XR_KHR_binding_modification  XR_KHR_binding_modification>
-- in the main specification for complete information.
--
-- = Registered Extension Number
--
-- 121
--
-- = Revision
--
-- 1
--
-- = Extension and Version Dependencies
--
-- -   Requires OpenXR 1.0
--
-- = See Also
--
-- 'BindingModificationBaseHeaderKHR', 'BindingModificationsKHR'
--
-- = Document Notes
--
-- For more information, see the
-- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XR_KHR_binding_modification OpenXR Specification>
--
-- This page is a generated document. Fixes and changes should be made to
-- the generator scripts, not directly.
module OpenXR.Extensions.XR_KHR_binding_modification  ( BindingModificationsKHR(..)
                                                      , BindingModificationBaseHeaderKHR(..)
                                                      , KHR_binding_modification_SPEC_VERSION
                                                      , pattern KHR_binding_modification_SPEC_VERSION
                                                      , KHR_BINDING_MODIFICATION_EXTENSION_NAME
                                                      , pattern KHR_BINDING_MODIFICATION_EXTENSION_NAME
                                                      ) where

import Control.Monad (unless)
import Foreign.Marshal.Alloc (allocaBytesAligned)
import GHC.IO (throwIO)
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 qualified Data.Vector (imapM_)
import qualified Data.Vector (length)
import qualified Data.Vector (null)
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 GHC.IO.Exception (IOErrorType(..))
import GHC.IO.Exception (IOException(..))
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.Enums.StructureType (StructureType)
import OpenXR.Core10.Enums.StructureType (StructureType(TYPE_BINDING_MODIFICATIONS_KHR))
-- | XrBindingModificationsKHR - Suggested bindings with binding modification
-- details
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-XrBindingModificationsKHR-extension-notenabled# The @@
--     extension /must/ be enabled prior to using 'BindingModificationsKHR'
--
-- -   #VUID-XrBindingModificationsKHR-type-type# @type@ /must/ be
--     'OpenXR.Core10.Enums.StructureType.TYPE_BINDING_MODIFICATIONS_KHR'
--
-- -   #VUID-XrBindingModificationsKHR-next-next# @next@ /must/ be @NULL@
--     or a valid pointer to the
--     <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#valid-usage-for-structure-pointer-chains next structure in a structure chain>
--
-- -   #VUID-XrBindingModificationsKHR-bindingModifications-parameter# If
--     @bindingModificationCount@ is not @0@, @bindingModifications@ /must/
--     be a pointer to an array of @bindingModificationCount@ valid
--     'BindingModificationBaseHeaderKHR'-based structures
--
-- = See Also
--
-- 'BindingModificationBaseHeaderKHR',
-- 'OpenXR.Core10.Enums.StructureType.StructureType',
-- 'OpenXR.Core10.Input.suggestInteractionProfileBindings'
data BindingModificationsKHR = BindingModificationsKHR
  { -- | @bindingModificationCount@ is the number of binding modifications in the
    -- array pointed to by @bindingModifications@.
    BindingModificationsKHR -> Word32
bindingModificationCount :: Word32
  , -- | @bindingModifications@ is a pointer to an array of pointers to binding
    -- modification structures based on 'BindingModificationBaseHeaderKHR',
    -- that define all of the application’s suggested binding modifications for
    -- the specified interaction profile.
    BindingModificationsKHR -> Vector BindingModificationBaseHeaderKHR
bindingModifications :: Vector BindingModificationBaseHeaderKHR
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (BindingModificationsKHR)
#endif
deriving instance Show BindingModificationsKHR

instance ToCStruct BindingModificationsKHR where
  withCStruct :: BindingModificationsKHR
-> (Ptr BindingModificationsKHR -> IO b) -> IO b
withCStruct x :: BindingModificationsKHR
x f :: Ptr BindingModificationsKHR -> IO b
f = Int -> Int -> (Ptr BindingModificationsKHR -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 32 8 ((Ptr BindingModificationsKHR -> IO b) -> IO b)
-> (Ptr BindingModificationsKHR -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr BindingModificationsKHR
p -> Ptr BindingModificationsKHR
-> BindingModificationsKHR -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr BindingModificationsKHR
p BindingModificationsKHR
x (Ptr BindingModificationsKHR -> IO b
f Ptr BindingModificationsKHR
p)
  pokeCStruct :: Ptr BindingModificationsKHR
-> BindingModificationsKHR -> IO b -> IO b
pokeCStruct p :: Ptr BindingModificationsKHR
p BindingModificationsKHR{..} 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 BindingModificationsKHR
p Ptr BindingModificationsKHR -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
TYPE_BINDING_MODIFICATIONS_KHR)
    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 BindingModificationsKHR
p Ptr BindingModificationsKHR -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    let bindingModificationsLength :: Int
bindingModificationsLength = Vector BindingModificationBaseHeaderKHR -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector BindingModificationBaseHeaderKHR -> Int)
-> Vector BindingModificationBaseHeaderKHR -> Int
forall a b. (a -> b) -> a -> b
$ (Vector BindingModificationBaseHeaderKHR
bindingModifications)
    Word32
bindingModificationCount'' <- IO Word32 -> ContT b IO Word32
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Word32 -> ContT b IO Word32) -> IO Word32 -> ContT b IO Word32
forall a b. (a -> b) -> a -> b
$ if (Word32
bindingModificationCount) Word32 -> Word32 -> Bool
forall a. Eq a => a -> a -> Bool
== 0
      then Word32 -> IO Word32
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Word32 -> IO Word32) -> Word32 -> IO Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
bindingModificationsLength
      else do
        Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
bindingModificationsLength Word32 -> Word32 -> Bool
forall a. Eq a => a -> a -> Bool
== (Word32
bindingModificationCount) Bool -> Bool -> Bool
|| Int
bindingModificationsLength Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== 0) (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 "" "bindingModifications must be empty or have 'bindingModificationCount' elements" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
        Word32 -> IO Word32
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Word32
bindingModificationCount)
    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 Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr BindingModificationsKHR
p Ptr BindingModificationsKHR -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Word32)) (Word32
bindingModificationCount'')
    Ptr (Ptr BindingModificationBaseHeaderKHR)
bindingModifications'' <- if Vector BindingModificationBaseHeaderKHR -> Bool
forall a. Vector a -> Bool
Data.Vector.null (Vector BindingModificationBaseHeaderKHR
bindingModifications)
      then Ptr (Ptr BindingModificationBaseHeaderKHR)
-> ContT b IO (Ptr (Ptr BindingModificationBaseHeaderKHR))
forall (f :: * -> *) a. Applicative f => a -> f a
pure Ptr (Ptr BindingModificationBaseHeaderKHR)
forall a. Ptr a
nullPtr
      else do
        Ptr (Ptr BindingModificationBaseHeaderKHR)
pBindingModifications <- ((Ptr (Ptr BindingModificationBaseHeaderKHR) -> IO b) -> IO b)
-> ContT b IO (Ptr (Ptr BindingModificationBaseHeaderKHR))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (Ptr BindingModificationBaseHeaderKHR) -> IO b) -> IO b)
 -> ContT b IO (Ptr (Ptr BindingModificationBaseHeaderKHR)))
-> ((Ptr (Ptr BindingModificationBaseHeaderKHR) -> IO b) -> IO b)
-> ContT b IO (Ptr (Ptr BindingModificationBaseHeaderKHR))
forall a b. (a -> b) -> a -> b
$ Int
-> Int
-> (Ptr (Ptr BindingModificationBaseHeaderKHR) -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned @(Ptr BindingModificationBaseHeaderKHR) (((Vector BindingModificationBaseHeaderKHR -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector BindingModificationBaseHeaderKHR
bindingModifications))) Int -> Int -> Int
forall a. Num a => a -> a -> a
* 8) 8
        (Int -> BindingModificationBaseHeaderKHR -> ContT b IO ())
-> Vector BindingModificationBaseHeaderKHR -> ContT b IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\i :: Int
i e :: BindingModificationBaseHeaderKHR
e -> do
          Ptr BindingModificationBaseHeaderKHR
bindingModifications' <- ((Ptr BindingModificationBaseHeaderKHR -> IO b) -> IO b)
-> ContT b IO (Ptr BindingModificationBaseHeaderKHR)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr BindingModificationBaseHeaderKHR -> IO b) -> IO b)
 -> ContT b IO (Ptr BindingModificationBaseHeaderKHR))
-> ((Ptr BindingModificationBaseHeaderKHR -> IO b) -> IO b)
-> ContT b IO (Ptr BindingModificationBaseHeaderKHR)
forall a b. (a -> b) -> a -> b
$ BindingModificationBaseHeaderKHR
-> (Ptr BindingModificationBaseHeaderKHR -> IO b) -> IO b
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (BindingModificationBaseHeaderKHR
e)
          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 BindingModificationBaseHeaderKHR)
-> Ptr BindingModificationBaseHeaderKHR -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr (Ptr BindingModificationBaseHeaderKHR)
pBindingModifications Ptr (Ptr BindingModificationBaseHeaderKHR)
-> Int -> Ptr (Ptr BindingModificationBaseHeaderKHR)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr (Ptr BindingModificationBaseHeaderKHR)) Ptr BindingModificationBaseHeaderKHR
bindingModifications') ((Vector BindingModificationBaseHeaderKHR
bindingModifications))
        Ptr (Ptr BindingModificationBaseHeaderKHR)
-> ContT b IO (Ptr (Ptr BindingModificationBaseHeaderKHR))
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Ptr (Ptr BindingModificationBaseHeaderKHR)
 -> ContT b IO (Ptr (Ptr BindingModificationBaseHeaderKHR)))
-> Ptr (Ptr BindingModificationBaseHeaderKHR)
-> ContT b IO (Ptr (Ptr BindingModificationBaseHeaderKHR))
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr BindingModificationBaseHeaderKHR)
pBindingModifications
    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 BindingModificationBaseHeaderKHR))
-> Ptr (Ptr BindingModificationBaseHeaderKHR) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr BindingModificationsKHR
p Ptr BindingModificationsKHR
-> Int -> Ptr (Ptr (Ptr BindingModificationBaseHeaderKHR))
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr (Ptr (Ptr BindingModificationBaseHeaderKHR)))) Ptr (Ptr BindingModificationBaseHeaderKHR)
bindingModifications''
    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 = 32
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr BindingModificationsKHR -> IO b -> IO b
pokeZeroCStruct p :: Ptr BindingModificationsKHR
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr BindingModificationsKHR
p Ptr BindingModificationsKHR -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
TYPE_BINDING_MODIFICATIONS_KHR)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr BindingModificationsKHR
p Ptr BindingModificationsKHR -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    IO b
f

instance FromCStruct BindingModificationsKHR where
  peekCStruct :: Ptr BindingModificationsKHR -> IO BindingModificationsKHR
peekCStruct p :: Ptr BindingModificationsKHR
p = do
    Word32
bindingModificationCount <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr BindingModificationsKHR
p Ptr BindingModificationsKHR -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Word32))
    Ptr (Ptr BindingModificationBaseHeaderKHR)
bindingModifications <- Ptr (Ptr (Ptr BindingModificationBaseHeaderKHR))
-> IO (Ptr (Ptr BindingModificationBaseHeaderKHR))
forall a. Storable a => Ptr a -> IO a
peek @(Ptr (Ptr BindingModificationBaseHeaderKHR)) ((Ptr BindingModificationsKHR
p Ptr BindingModificationsKHR
-> Int -> Ptr (Ptr (Ptr BindingModificationBaseHeaderKHR))
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr (Ptr (Ptr BindingModificationBaseHeaderKHR))))
    let bindingModificationsLength :: Int
bindingModificationsLength = if Ptr (Ptr BindingModificationBaseHeaderKHR)
bindingModifications Ptr (Ptr BindingModificationBaseHeaderKHR)
-> Ptr (Ptr BindingModificationBaseHeaderKHR) -> Bool
forall a. Eq a => a -> a -> Bool
== Ptr (Ptr BindingModificationBaseHeaderKHR)
forall a. Ptr a
nullPtr then 0 else (Word32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
bindingModificationCount)
    Vector BindingModificationBaseHeaderKHR
bindingModifications' <- Int
-> (Int -> IO BindingModificationBaseHeaderKHR)
-> IO (Vector BindingModificationBaseHeaderKHR)
forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM Int
bindingModificationsLength (\i :: Int
i -> FromCStruct BindingModificationBaseHeaderKHR =>
Ptr BindingModificationBaseHeaderKHR
-> IO BindingModificationBaseHeaderKHR
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @BindingModificationBaseHeaderKHR (Ptr BindingModificationBaseHeaderKHR
 -> IO BindingModificationBaseHeaderKHR)
-> IO (Ptr BindingModificationBaseHeaderKHR)
-> IO BindingModificationBaseHeaderKHR
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Ptr (Ptr BindingModificationBaseHeaderKHR)
-> IO (Ptr BindingModificationBaseHeaderKHR)
forall a. Storable a => Ptr a -> IO a
peek ((Ptr (Ptr BindingModificationBaseHeaderKHR)
bindingModifications Ptr (Ptr BindingModificationBaseHeaderKHR)
-> Int -> Ptr (Ptr BindingModificationBaseHeaderKHR)
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr (Ptr BindingModificationBaseHeaderKHR))))
    BindingModificationsKHR -> IO BindingModificationsKHR
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BindingModificationsKHR -> IO BindingModificationsKHR)
-> BindingModificationsKHR -> IO BindingModificationsKHR
forall a b. (a -> b) -> a -> b
$ Word32
-> Vector BindingModificationBaseHeaderKHR
-> BindingModificationsKHR
BindingModificationsKHR
             Word32
bindingModificationCount Vector BindingModificationBaseHeaderKHR
bindingModifications'

instance Zero BindingModificationsKHR where
  zero :: BindingModificationsKHR
zero = Word32
-> Vector BindingModificationBaseHeaderKHR
-> BindingModificationsKHR
BindingModificationsKHR
           Word32
forall a. Zero a => a
zero
           Vector BindingModificationBaseHeaderKHR
forall a. Monoid a => a
mempty


-- | XrBindingModificationBaseHeaderKHR - Base struct for all binding
-- modifications
--
-- == Member Descriptions
--
-- = Description
--
-- The 'BindingModificationBaseHeaderKHR' is a base structure is overridden
-- by @XrBindingModification*@ child structures.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-XrBindingModificationBaseHeaderKHR-extension-notenabled# The
--     @@ extension /must/ be enabled prior to using
--     'BindingModificationBaseHeaderKHR'
--
-- -   #VUID-XrBindingModificationBaseHeaderKHR-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
--
-- 'BindingModificationsKHR',
-- 'OpenXR.Core10.Enums.StructureType.StructureType',
-- 'OpenXR.Core10.Input.suggestInteractionProfileBindings'
data BindingModificationBaseHeaderKHR = BindingModificationBaseHeaderKHR
  { -- | @type@ is the 'OpenXR.Core10.Enums.StructureType.StructureType' of this
    -- structure. This base structure itself has no associated
    -- 'OpenXR.Core10.Enums.StructureType.StructureType' value.
    BindingModificationBaseHeaderKHR -> StructureType
type' :: StructureType }
  deriving (Typeable, BindingModificationBaseHeaderKHR
-> BindingModificationBaseHeaderKHR -> Bool
(BindingModificationBaseHeaderKHR
 -> BindingModificationBaseHeaderKHR -> Bool)
-> (BindingModificationBaseHeaderKHR
    -> BindingModificationBaseHeaderKHR -> Bool)
-> Eq BindingModificationBaseHeaderKHR
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BindingModificationBaseHeaderKHR
-> BindingModificationBaseHeaderKHR -> Bool
$c/= :: BindingModificationBaseHeaderKHR
-> BindingModificationBaseHeaderKHR -> Bool
== :: BindingModificationBaseHeaderKHR
-> BindingModificationBaseHeaderKHR -> Bool
$c== :: BindingModificationBaseHeaderKHR
-> BindingModificationBaseHeaderKHR -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (BindingModificationBaseHeaderKHR)
#endif
deriving instance Show BindingModificationBaseHeaderKHR

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

instance FromCStruct BindingModificationBaseHeaderKHR where
  peekCStruct :: Ptr BindingModificationBaseHeaderKHR
-> IO BindingModificationBaseHeaderKHR
peekCStruct p :: Ptr BindingModificationBaseHeaderKHR
p = do
    StructureType
type' <- Ptr StructureType -> IO StructureType
forall a. Storable a => Ptr a -> IO a
peek @StructureType ((Ptr BindingModificationBaseHeaderKHR
p Ptr BindingModificationBaseHeaderKHR -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType))
    BindingModificationBaseHeaderKHR
-> IO BindingModificationBaseHeaderKHR
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BindingModificationBaseHeaderKHR
 -> IO BindingModificationBaseHeaderKHR)
-> BindingModificationBaseHeaderKHR
-> IO BindingModificationBaseHeaderKHR
forall a b. (a -> b) -> a -> b
$ StructureType -> BindingModificationBaseHeaderKHR
BindingModificationBaseHeaderKHR
             StructureType
type'

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

instance Zero BindingModificationBaseHeaderKHR where
  zero :: BindingModificationBaseHeaderKHR
zero = StructureType -> BindingModificationBaseHeaderKHR
BindingModificationBaseHeaderKHR
           StructureType
forall a. Zero a => a
zero


type KHR_binding_modification_SPEC_VERSION = 1

-- No documentation found for TopLevel "XR_KHR_binding_modification_SPEC_VERSION"
pattern KHR_binding_modification_SPEC_VERSION :: forall a . Integral a => a
pattern $bKHR_binding_modification_SPEC_VERSION :: a
$mKHR_binding_modification_SPEC_VERSION :: forall r a. Integral a => a -> (Void# -> r) -> (Void# -> r) -> r
KHR_binding_modification_SPEC_VERSION = 1


type KHR_BINDING_MODIFICATION_EXTENSION_NAME = "XR_KHR_binding_modification"

-- No documentation found for TopLevel "XR_KHR_BINDING_MODIFICATION_EXTENSION_NAME"
pattern KHR_BINDING_MODIFICATION_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bKHR_BINDING_MODIFICATION_EXTENSION_NAME :: a
$mKHR_BINDING_MODIFICATION_EXTENSION_NAME :: forall r a.
(Eq a, IsString a) =>
a -> (Void# -> r) -> (Void# -> r) -> r
KHR_BINDING_MODIFICATION_EXTENSION_NAME = "XR_KHR_binding_modification"