{-# language CPP #-}
module OpenXR.Extensions.XR_KHR_composition_layer_depth ( CompositionLayerDepthInfoKHR(..)
, KHR_composition_layer_depth_SPEC_VERSION
, pattern KHR_composition_layer_depth_SPEC_VERSION
, KHR_COMPOSITION_LAYER_DEPTH_EXTENSION_NAME
, pattern KHR_COMPOSITION_LAYER_DEPTH_EXTENSION_NAME
) where
import Foreign.Marshal.Alloc (allocaBytesAligned)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import Data.Coerce (coerce)
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.C.Types (CFloat)
import Foreign.C.Types (CFloat(..))
import Foreign.C.Types (CFloat(CFloat))
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.OtherTypes (SwapchainSubImage)
import OpenXR.Core10.Enums.StructureType (StructureType(TYPE_COMPOSITION_LAYER_DEPTH_INFO_KHR))
data CompositionLayerDepthInfoKHR = CompositionLayerDepthInfoKHR
{
CompositionLayerDepthInfoKHR -> SwapchainSubImage
subImage :: SwapchainSubImage
,
CompositionLayerDepthInfoKHR -> Float
minDepth :: Float
,
CompositionLayerDepthInfoKHR -> Float
maxDepth :: Float
,
CompositionLayerDepthInfoKHR -> Float
nearZ :: Float
,
CompositionLayerDepthInfoKHR -> Float
farZ :: Float
}
deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (CompositionLayerDepthInfoKHR)
#endif
deriving instance Show CompositionLayerDepthInfoKHR
instance ToCStruct CompositionLayerDepthInfoKHR where
withCStruct :: CompositionLayerDepthInfoKHR
-> (Ptr CompositionLayerDepthInfoKHR -> IO b) -> IO b
withCStruct x :: CompositionLayerDepthInfoKHR
x f :: Ptr CompositionLayerDepthInfoKHR -> IO b
f = Int -> Int -> (Ptr CompositionLayerDepthInfoKHR -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 64 8 ((Ptr CompositionLayerDepthInfoKHR -> IO b) -> IO b)
-> (Ptr CompositionLayerDepthInfoKHR -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr CompositionLayerDepthInfoKHR
p -> Ptr CompositionLayerDepthInfoKHR
-> CompositionLayerDepthInfoKHR -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr CompositionLayerDepthInfoKHR
p CompositionLayerDepthInfoKHR
x (Ptr CompositionLayerDepthInfoKHR -> IO b
f Ptr CompositionLayerDepthInfoKHR
p)
pokeCStruct :: Ptr CompositionLayerDepthInfoKHR
-> CompositionLayerDepthInfoKHR -> IO b -> IO b
pokeCStruct p :: Ptr CompositionLayerDepthInfoKHR
p CompositionLayerDepthInfoKHR{..} f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CompositionLayerDepthInfoKHR
p Ptr CompositionLayerDepthInfoKHR -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
TYPE_COMPOSITION_LAYER_DEPTH_INFO_KHR)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CompositionLayerDepthInfoKHR
p Ptr CompositionLayerDepthInfoKHR -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
Ptr SwapchainSubImage -> SwapchainSubImage -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CompositionLayerDepthInfoKHR
p Ptr CompositionLayerDepthInfoKHR -> Int -> Ptr SwapchainSubImage
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr SwapchainSubImage)) (SwapchainSubImage
subImage)
Ptr CFloat -> CFloat -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CompositionLayerDepthInfoKHR
p Ptr CompositionLayerDepthInfoKHR -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 48 :: Ptr CFloat)) (Float -> CFloat
CFloat (Float
minDepth))
Ptr CFloat -> CFloat -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CompositionLayerDepthInfoKHR
p Ptr CompositionLayerDepthInfoKHR -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 52 :: Ptr CFloat)) (Float -> CFloat
CFloat (Float
maxDepth))
Ptr CFloat -> CFloat -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CompositionLayerDepthInfoKHR
p Ptr CompositionLayerDepthInfoKHR -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 56 :: Ptr CFloat)) (Float -> CFloat
CFloat (Float
nearZ))
Ptr CFloat -> CFloat -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CompositionLayerDepthInfoKHR
p Ptr CompositionLayerDepthInfoKHR -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 60 :: Ptr CFloat)) (Float -> CFloat
CFloat (Float
farZ))
IO b
f
cStructSize :: Int
cStructSize = 64
cStructAlignment :: Int
cStructAlignment = 8
pokeZeroCStruct :: Ptr CompositionLayerDepthInfoKHR -> IO b -> IO b
pokeZeroCStruct p :: Ptr CompositionLayerDepthInfoKHR
p f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CompositionLayerDepthInfoKHR
p Ptr CompositionLayerDepthInfoKHR -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
TYPE_COMPOSITION_LAYER_DEPTH_INFO_KHR)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CompositionLayerDepthInfoKHR
p Ptr CompositionLayerDepthInfoKHR -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
Ptr SwapchainSubImage -> SwapchainSubImage -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CompositionLayerDepthInfoKHR
p Ptr CompositionLayerDepthInfoKHR -> Int -> Ptr SwapchainSubImage
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr SwapchainSubImage)) (SwapchainSubImage
forall a. Zero a => a
zero)
Ptr CFloat -> CFloat -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CompositionLayerDepthInfoKHR
p Ptr CompositionLayerDepthInfoKHR -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 48 :: Ptr CFloat)) (Float -> CFloat
CFloat (Float
forall a. Zero a => a
zero))
Ptr CFloat -> CFloat -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CompositionLayerDepthInfoKHR
p Ptr CompositionLayerDepthInfoKHR -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 52 :: Ptr CFloat)) (Float -> CFloat
CFloat (Float
forall a. Zero a => a
zero))
Ptr CFloat -> CFloat -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CompositionLayerDepthInfoKHR
p Ptr CompositionLayerDepthInfoKHR -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 56 :: Ptr CFloat)) (Float -> CFloat
CFloat (Float
forall a. Zero a => a
zero))
Ptr CFloat -> CFloat -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CompositionLayerDepthInfoKHR
p Ptr CompositionLayerDepthInfoKHR -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 60 :: Ptr CFloat)) (Float -> CFloat
CFloat (Float
forall a. Zero a => a
zero))
IO b
f
instance FromCStruct CompositionLayerDepthInfoKHR where
peekCStruct :: Ptr CompositionLayerDepthInfoKHR -> IO CompositionLayerDepthInfoKHR
peekCStruct p :: Ptr CompositionLayerDepthInfoKHR
p = do
SwapchainSubImage
subImage <- Ptr SwapchainSubImage -> IO SwapchainSubImage
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @SwapchainSubImage ((Ptr CompositionLayerDepthInfoKHR
p Ptr CompositionLayerDepthInfoKHR -> Int -> Ptr SwapchainSubImage
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr SwapchainSubImage))
CFloat
minDepth <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek @CFloat ((Ptr CompositionLayerDepthInfoKHR
p Ptr CompositionLayerDepthInfoKHR -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 48 :: Ptr CFloat))
CFloat
maxDepth <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek @CFloat ((Ptr CompositionLayerDepthInfoKHR
p Ptr CompositionLayerDepthInfoKHR -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 52 :: Ptr CFloat))
CFloat
nearZ <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek @CFloat ((Ptr CompositionLayerDepthInfoKHR
p Ptr CompositionLayerDepthInfoKHR -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 56 :: Ptr CFloat))
CFloat
farZ <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek @CFloat ((Ptr CompositionLayerDepthInfoKHR
p Ptr CompositionLayerDepthInfoKHR -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 60 :: Ptr CFloat))
CompositionLayerDepthInfoKHR -> IO CompositionLayerDepthInfoKHR
forall (f :: * -> *) a. Applicative f => a -> f a
pure (CompositionLayerDepthInfoKHR -> IO CompositionLayerDepthInfoKHR)
-> CompositionLayerDepthInfoKHR -> IO CompositionLayerDepthInfoKHR
forall a b. (a -> b) -> a -> b
$ SwapchainSubImage
-> Float -> Float -> Float -> Float -> CompositionLayerDepthInfoKHR
CompositionLayerDepthInfoKHR
SwapchainSubImage
subImage (CFloat -> Float
forall a b. Coercible a b => a -> b
coerce @CFloat @Float CFloat
minDepth) (CFloat -> Float
forall a b. Coercible a b => a -> b
coerce @CFloat @Float CFloat
maxDepth) (CFloat -> Float
forall a b. Coercible a b => a -> b
coerce @CFloat @Float CFloat
nearZ) (CFloat -> Float
forall a b. Coercible a b => a -> b
coerce @CFloat @Float CFloat
farZ)
instance Storable CompositionLayerDepthInfoKHR where
sizeOf :: CompositionLayerDepthInfoKHR -> Int
sizeOf ~CompositionLayerDepthInfoKHR
_ = 64
alignment :: CompositionLayerDepthInfoKHR -> Int
alignment ~CompositionLayerDepthInfoKHR
_ = 8
peek :: Ptr CompositionLayerDepthInfoKHR -> IO CompositionLayerDepthInfoKHR
peek = Ptr CompositionLayerDepthInfoKHR -> IO CompositionLayerDepthInfoKHR
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: Ptr CompositionLayerDepthInfoKHR
-> CompositionLayerDepthInfoKHR -> IO ()
poke ptr :: Ptr CompositionLayerDepthInfoKHR
ptr poked :: CompositionLayerDepthInfoKHR
poked = Ptr CompositionLayerDepthInfoKHR
-> CompositionLayerDepthInfoKHR -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr CompositionLayerDepthInfoKHR
ptr CompositionLayerDepthInfoKHR
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero CompositionLayerDepthInfoKHR where
zero :: CompositionLayerDepthInfoKHR
zero = SwapchainSubImage
-> Float -> Float -> Float -> Float -> CompositionLayerDepthInfoKHR
CompositionLayerDepthInfoKHR
SwapchainSubImage
forall a. Zero a => a
zero
Float
forall a. Zero a => a
zero
Float
forall a. Zero a => a
zero
Float
forall a. Zero a => a
zero
Float
forall a. Zero a => a
zero
type KHR_composition_layer_depth_SPEC_VERSION = 5
pattern KHR_composition_layer_depth_SPEC_VERSION :: forall a . Integral a => a
pattern $bKHR_composition_layer_depth_SPEC_VERSION :: a
$mKHR_composition_layer_depth_SPEC_VERSION :: forall r a. Integral a => a -> (Void# -> r) -> (Void# -> r) -> r
KHR_composition_layer_depth_SPEC_VERSION = 5
type KHR_COMPOSITION_LAYER_DEPTH_EXTENSION_NAME = "XR_KHR_composition_layer_depth"
pattern KHR_COMPOSITION_LAYER_DEPTH_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bKHR_COMPOSITION_LAYER_DEPTH_EXTENSION_NAME :: a
$mKHR_COMPOSITION_LAYER_DEPTH_EXTENSION_NAME :: forall r a.
(Eq a, IsString a) =>
a -> (Void# -> r) -> (Void# -> r) -> r
KHR_COMPOSITION_LAYER_DEPTH_EXTENSION_NAME = "XR_KHR_composition_layer_depth"