{-# language CPP #-}
module Vulkan.Extensions.VK_QCOM_multiview_per_view_render_areas ( PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM(..)
, MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM(..)
, QCOM_MULTIVIEW_PER_VIEW_RENDER_AREAS_SPEC_VERSION
, pattern QCOM_MULTIVIEW_PER_VIEW_RENDER_AREAS_SPEC_VERSION
, QCOM_MULTIVIEW_PER_VIEW_RENDER_AREAS_EXTENSION_NAME
, pattern QCOM_MULTIVIEW_PER_VIEW_RENDER_AREAS_EXTENSION_NAME
) where
import Foreign.Marshal.Alloc (allocaBytes)
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 Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.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.Word (Word32)
import Data.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Data.Vector (Vector)
import Vulkan.CStruct.Utils (advancePtrBytes)
import Vulkan.Core10.FundamentalTypes (bool32ToBool)
import Vulkan.Core10.FundamentalTypes (boolToBool32)
import Vulkan.Core10.FundamentalTypes (Bool32)
import Vulkan.Core10.FundamentalTypes (Rect2D)
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_MULTIVIEW_PER_VIEW_RENDER_AREAS_RENDER_PASS_BEGIN_INFO_QCOM))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_RENDER_AREAS_FEATURES_QCOM))
data PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM = PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
{
PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM -> Bool
multiviewPerViewRenderAreas :: Bool }
deriving (Typeable, PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
-> PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
-> PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM -> Bool
$c/= :: PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
-> PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM -> Bool
== :: PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
-> PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM -> Bool
$c== :: PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
-> PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM)
#endif
deriving instance Show PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
instance ToCStruct PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM where
withCStruct :: forall b.
PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
-> (Ptr PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
-> IO b)
-> IO b
withCStruct PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
x Ptr PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
24 forall a b. (a -> b) -> a -> b
$ \Ptr PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
p PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
x (Ptr PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM -> IO b
f Ptr PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
p)
pokeCStruct :: forall b.
Ptr PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
-> PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
-> IO b
-> IO b
pokeCStruct Ptr PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
p PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM{Bool
multiviewPerViewRenderAreas :: Bool
$sel:multiviewPerViewRenderAreas:PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM :: PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM -> Bool
..} IO b
f = do
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_RENDER_AREAS_FEATURES_QCOM)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
multiviewPerViewRenderAreas))
IO b
f
cStructSize :: Int
cStructSize = Int
24
cStructAlignment :: Int
cStructAlignment = Int
8
pokeZeroCStruct :: forall b.
Ptr PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
-> IO b -> IO b
pokeZeroCStruct Ptr PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
p IO b
f = do
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_RENDER_AREAS_FEATURES_QCOM)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (forall a. Zero a => a
zero))
IO b
f
instance FromCStruct PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM where
peekCStruct :: Ptr PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
-> IO PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
peekCStruct Ptr PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
p = do
Bool32
multiviewPerViewRenderAreas <- forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32))
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Bool -> PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
(Bool32 -> Bool
bool32ToBool Bool32
multiviewPerViewRenderAreas)
instance Storable PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM where
sizeOf :: PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM -> Int
sizeOf ~PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
_ = Int
24
alignment :: PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM -> Int
alignment ~PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
_ = Int
8
peek :: Ptr PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
-> IO PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
peek = forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: Ptr PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
-> PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM -> IO ()
poke Ptr PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
ptr PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
poked = forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
ptr PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
poked (forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM where
zero :: PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
zero = Bool -> PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
forall a. Zero a => a
zero
data MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM = MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM
{
MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM -> Vector Rect2D
perViewRenderAreas :: Vector Rect2D }
deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM)
#endif
deriving instance Show MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM
instance ToCStruct MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM where
withCStruct :: forall b.
MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM
-> (Ptr MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM -> IO b)
-> IO b
withCStruct MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM
x Ptr MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
32 forall a b. (a -> b) -> a -> b
$ \Ptr MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM
p MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM
x (Ptr MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM -> IO b
f Ptr MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM
p)
pokeCStruct :: forall b.
Ptr MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM
-> MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM
-> IO b
-> IO b
pokeCStruct Ptr MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM
p MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM{Vector Rect2D
perViewRenderAreas :: Vector Rect2D
$sel:perViewRenderAreas:MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM :: MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM -> Vector Rect2D
..} IO b
f = forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT forall a b. (a -> b) -> a -> b
$ do
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_MULTIVIEW_PER_VIEW_RENDER_AREAS_RENDER_PASS_BEGIN_INFO_QCOM)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32)) ((forall a b. (Integral a, Num b) => a -> b
fromIntegral (forall a. Vector a -> Int
Data.Vector.length forall a b. (a -> b) -> a -> b
$ (Vector Rect2D
perViewRenderAreas)) :: Word32))
Ptr Rect2D
pPPerViewRenderAreas' <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT forall a b. (a -> b) -> a -> b
$ forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes @Rect2D ((forall a. Vector a -> Int
Data.Vector.length (Vector Rect2D
perViewRenderAreas)) forall a. Num a => a -> a -> a
* Int
16)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\Int
i Rect2D
e -> forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Rect2D
pPPerViewRenderAreas' forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
16 forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Rect2D) (Rect2D
e)) (Vector Rect2D
perViewRenderAreas)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr Rect2D))) (Ptr Rect2D
pPPerViewRenderAreas')
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ IO b
f
cStructSize :: Int
cStructSize = Int
32
cStructAlignment :: Int
cStructAlignment = Int
8
pokeZeroCStruct :: forall b.
Ptr MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM
-> IO b -> IO b
pokeZeroCStruct Ptr MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM
p IO b
f = do
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_MULTIVIEW_PER_VIEW_RENDER_AREAS_RENDER_PASS_BEGIN_INFO_QCOM)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
IO b
f
instance FromCStruct MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM where
peekCStruct :: Ptr MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM
-> IO MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM
peekCStruct Ptr MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM
p = do
Word32
perViewRenderAreaCount <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32))
Ptr Rect2D
pPerViewRenderAreas <- forall a. Storable a => Ptr a -> IO a
peek @(Ptr Rect2D) ((Ptr MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr Rect2D)))
Vector Rect2D
pPerViewRenderAreas' <- forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM (forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
perViewRenderAreaCount) (\Int
i -> forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @Rect2D ((Ptr Rect2D
pPerViewRenderAreas forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
16 forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Rect2D)))
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Vector Rect2D -> MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM
MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM
Vector Rect2D
pPerViewRenderAreas'
instance Zero MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM where
zero :: MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM
zero = Vector Rect2D -> MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM
MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM
forall a. Monoid a => a
mempty
type QCOM_MULTIVIEW_PER_VIEW_RENDER_AREAS_SPEC_VERSION = 1
pattern QCOM_MULTIVIEW_PER_VIEW_RENDER_AREAS_SPEC_VERSION :: forall a . Integral a => a
pattern $bQCOM_MULTIVIEW_PER_VIEW_RENDER_AREAS_SPEC_VERSION :: forall a. Integral a => a
$mQCOM_MULTIVIEW_PER_VIEW_RENDER_AREAS_SPEC_VERSION :: forall {r} {a}.
Integral a =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
QCOM_MULTIVIEW_PER_VIEW_RENDER_AREAS_SPEC_VERSION = 1
type QCOM_MULTIVIEW_PER_VIEW_RENDER_AREAS_EXTENSION_NAME = "VK_QCOM_multiview_per_view_render_areas"
pattern QCOM_MULTIVIEW_PER_VIEW_RENDER_AREAS_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bQCOM_MULTIVIEW_PER_VIEW_RENDER_AREAS_EXTENSION_NAME :: forall a. (Eq a, IsString a) => a
$mQCOM_MULTIVIEW_PER_VIEW_RENDER_AREAS_EXTENSION_NAME :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
QCOM_MULTIVIEW_PER_VIEW_RENDER_AREAS_EXTENSION_NAME = "VK_QCOM_multiview_per_view_render_areas"