{-# language CPP #-}
-- | = Name
--
-- VK_QCOM_multiview_per_view_render_areas - device extension
--
-- == VK_QCOM_multiview_per_view_render_areas
--
-- [__Name String__]
--     @VK_QCOM_multiview_per_view_render_areas@
--
-- [__Extension Type__]
--     Device extension
--
-- [__Registered Extension Number__]
--     511
--
-- [__Revision__]
--     1
--
-- [__Ratification Status__]
--     Not ratified
--
-- [__Extension and Version Dependencies__; __Contact__]
--
--     -   Jeff Leger
--         <https://github.com/KhronosGroup/Vulkan-Docs/issues/new?body=[VK_QCOM_multiview_per_view_render_areas] @jackohound%0A*Here describe the issue or question you have about the VK_QCOM_multiview_per_view_render_areas extension* >
--
-- == Other Extension Metadata
--
-- [__Last Modified Date__]
--     2023-01-10
--
-- [__IP Status__]
--     No known IP claims.
--
-- [__Interactions and External Dependencies__]
--
--     -   This extension interacts with @VK_KHR_dynamic_rendering@
--
--     -   This extension interacts with @VK_QCOM_render_pass_transform@
--
-- [__Contributors__]
--
--     -   Jeff Leger, Qualcomm
--
--     -   Jonathan Tinkham, Qualcomm
--
--     -   Jonathan Wicks, Qualcomm
--
-- == Description
--
-- Certain use cases (e.g., side-by-side VR rendering) use multiview and
-- render to distinct regions of the framebuffer for each view. On some
-- implementations, there may be a performance benefit for providing
-- per-view render areas to the implementation. Such per-view render areas
-- can be used by the implementation to reduce the pixels that are affected
-- by attachment load, store, and multisample resolve operations.
--
-- The extension enables a multiview render pass instance to define
-- per-view render areas. For each view of a multiview render pass
-- instance, only those pixels in the per-view render area are affected by
-- load, store and resolve operations.
--
-- == New Structures
--
-- -   Extending
--     'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceFeatures2',
--     'Vulkan.Core10.Device.DeviceCreateInfo':
--
--     -   'PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM'
--
-- -   Extending 'Vulkan.Core10.CommandBufferBuilding.RenderPassBeginInfo',
--     'Vulkan.Core13.Promoted_From_VK_KHR_dynamic_rendering.RenderingInfo':
--
--     -   'MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM'
--
-- == New Enum Constants
--
-- -   'QCOM_MULTIVIEW_PER_VIEW_RENDER_AREAS_EXTENSION_NAME'
--
-- -   'QCOM_MULTIVIEW_PER_VIEW_RENDER_AREAS_SPEC_VERSION'
--
-- -   Extending 'Vulkan.Core10.Enums.StructureType.StructureType':
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_MULTIVIEW_PER_VIEW_RENDER_AREAS_RENDER_PASS_BEGIN_INFO_QCOM'
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_RENDER_AREAS_FEATURES_QCOM'
--
-- == Issues
--
-- 1) Do the per-view @renderAreas@ interact with
-- 'Vulkan.Core10.Pass.getRenderAreaGranularity' ?
--
-- __RESOLVED__: There is no change. The granularity returned by
-- 'Vulkan.Core10.Pass.getRenderAreaGranularity' also applies to the
-- per-view @renderAreas@.
--
-- 2) How does this extension interact with
-- @VK_QCOM_render_pass_transform@?
--
-- __RESOLVED__: When @VK_QCOM_render_pass_transform@ is enabled, the
-- application provides render area in non-rotated coordinates which is
-- rotated by the implementation to the rotated coordinate system. When
-- this extension is used in combination with
-- @VK_QCOM_render_pass_transform@, then the @renderArea@ provided in
-- 'Vulkan.Core13.Promoted_From_VK_KHR_dynamic_rendering.RenderingInfo'::@renderArea@,
-- 'Vulkan.Core10.CommandBufferBuilding.RenderPassBeginInfo'::@renderArea@,
-- or
-- 'Vulkan.Extensions.VK_QCOM_render_pass_transform.CommandBufferInheritanceRenderPassTransformInfoQCOM'::@renderArea@
-- is rotated by the implementation. The per-view render areas are not
-- rotated.
--
-- 3) How does this extension interact with
-- @VK_QCOM_multiview_per_view_viewports@
--
-- __RESOLVED__: There is no direct interaction. The per-view viewports and
-- the per-view renderAreas are orthogonal features.
--
-- 4) When a per-view @renderArea@ is specified, must multiview rendering
-- for each view of a multiview render pass be contained within the
-- per-view @renderArea@?
--
-- __RESOLVED__: Yes, and the @VK_QCOM_multiview_per_view_viewports@ may
-- help here since it provides per-view scissors.
--
-- 5) When per-view render areas are specified, what purpose if any do
-- 'Vulkan.Core10.CommandBufferBuilding.RenderPassBeginInfo'::@renderArea@
-- and
-- 'Vulkan.Core13.Promoted_From_VK_KHR_dynamic_rendering.RenderingInfo'::@renderArea@
-- serve?
--
-- __RESOLVED__: The per-view @renderArea@ effectively overrides the
-- per-renderpass @renderArea@. The per-view @renderArea@ defines the
-- regions of the attachments that are effected by load, store, and
-- multisample resolve operations. A valid implementation could ignore the
-- per-renderpass @renderArea@. However, as an aid to the implementation,
-- the application must set the per-renderpass @renderArea@ to an area that
-- is at least as large as the union of all the per-view render areas.
-- Pixels that are within the per-renderpass @renderArea@ but not within
-- any per-view render area must not be affected by load, store, or
-- multisample resolve operations.
--
-- == Version History
--
-- -   Revision 1, 2023-01-10 (Jeff Leger)
--
-- == See Also
--
-- 'MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM',
-- 'PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM'
--
-- == Document Notes
--
-- For more information, see the
-- <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VK_QCOM_multiview_per_view_render_areas Vulkan Specification>
--
-- This page is a generated document. Fixes and changes should be made to
-- the generator scripts, not directly.
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))
-- | VkPhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM - Structure
-- describing multiview per view render areas features that can be
-- supported by an implementation
--
-- = Members
--
-- This structure describes the following features:
--
-- = Description
--
-- If the 'PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM' structure
-- is included in the @pNext@ chain of the
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceFeatures2'
-- structure passed to
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.getPhysicalDeviceFeatures2',
-- it is filled in to indicate whether each corresponding feature is
-- supported. 'PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM' /can/
-- also be used in the @pNext@ chain of
-- 'Vulkan.Core10.Device.DeviceCreateInfo' to selectively enable these
-- features.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_QCOM_multiview_per_view_render_areas VK_QCOM_multiview_per_view_render_areas>,
-- 'Vulkan.Core10.FundamentalTypes.Bool32',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM = PhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM
  { -- | #features-multiview-per-view-render-areas# @multiviewPerViewRenderAreas@
    -- indicates that the implementation supports multiview per-view render
    -- areas.
    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


-- | VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM - Set the multiview
-- per view render areas for a render pass instance
--
-- = Description
--
-- If @perViewRenderAreaCount@ is not zero, then the elements of
-- @pPerViewRenderAreas@ override the value of
-- 'Vulkan.Core10.CommandBufferBuilding.RenderPassBeginInfo'::@renderArea@
-- or
-- 'Vulkan.Core13.Promoted_From_VK_KHR_dynamic_rendering.RenderingInfo'::@renderArea@
-- and define per-view render areas for the individual views of a multiview
-- render pass. The render area for the view with /view index/ @i@ is
-- specified by @pPerViewRenderAreas@[i].
--
-- The per-view render areas define per-view regions of attachments that
-- are loaded, stored, and resolved according to the @loadOp@, @storeOp@,
-- and @resolveMode@ values of the render pass instance. When per-view
-- render areas are defined, the value of
-- 'Vulkan.Core10.CommandBufferBuilding.RenderPassBeginInfo'::@renderArea@
-- or
-- 'Vulkan.Core13.Promoted_From_VK_KHR_dynamic_rendering.RenderingInfo'::@renderArea@
-- /must/ be set to a render area that includes the union of all per-view
-- render areas, /may/ be used by the implementation for optimizations, but
-- does not affect loads, stores, or resolves.
--
-- If this structure is present and if @perViewRenderAreaCount@ is not
-- zero, then @perViewRenderAreaCount@ /must/ be at least least one greater
-- than the most significant bit set in any any element of
-- 'Vulkan.Core11.Promoted_From_VK_KHR_multiview.RenderPassMultiviewCreateInfo'::@pViewMasks@.
-- or
-- 'Vulkan.Core13.Promoted_From_VK_KHR_dynamic_rendering.RenderingInfo'::@viewMask@
--
-- If this structure is not present or if @perViewRenderAreaCount@ is zero,
-- 'Vulkan.Core10.CommandBufferBuilding.RenderPassBeginInfo'::@renderArea@
-- or
-- 'Vulkan.Core13.Promoted_From_VK_KHR_dynamic_rendering.RenderingInfo'::@renderArea@
-- is used for all views.
--
-- == Valid Usage
--
-- -   #VUID-VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM-offset-07861#
--     The @offset.x@ member of any element of @pPerViewRenderAreas@ /must/
--     be greater than or equal to 0
--
-- -   #VUID-VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM-offset-07862#
--     The @offset.y@ member of any element of @pPerViewRenderAreas@ /must/
--     be greater than or equal to 0
--
-- -   #VUID-VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM-offset-07863#
--     The sum of the @offset.x@ and @extent.width@ members of any element
--     of @pPerViewRenderAreas@ /must/ be less than or equal to
--     <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#limits-maxFramebufferWidth maxFramebufferWidth>
--
-- -   #VUID-VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM-offset-07864#
--     The sum of the @offset.y@ and @extent.height@ members of any element
--     of @pPerViewRenderAreas@ /must/ be less than or equal to
--     <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#limits-maxFramebufferHeight maxFramebufferHeight>
--
-- -   #VUID-VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM-pNext-07865#
--     If this structure is in the @pNext@ chain of
--     'Vulkan.Core10.CommandBufferBuilding.RenderPassBeginInfo' and if the
--     render pass object included an element in
--     'Vulkan.Core11.Promoted_From_VK_KHR_multiview.RenderPassMultiviewCreateInfo'::@pViewMasks@
--     that set bit @n@, then @perViewRenderAreaCount@ /must/ be at least
--     equal to @n+1@.
--
-- -   #VUID-VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM-pNext-07866#
--     If this structure is in the @pNext@ chain of
--     'Vulkan.Core13.Promoted_From_VK_KHR_dynamic_rendering.RenderingInfo'
--     and if
--     'Vulkan.Core13.Promoted_From_VK_KHR_dynamic_rendering.RenderingInfo'::@viewMask@
--     set bit @n@, then @perViewRenderAreaCount@ /must/ be at least equal
--     to @n+1@.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM-sType-sType#
--     @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_MULTIVIEW_PER_VIEW_RENDER_AREAS_RENDER_PASS_BEGIN_INFO_QCOM'
--
-- -   #VUID-VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM-pPerViewRenderAreas-parameter#
--     If @perViewRenderAreaCount@ is not @0@, @pPerViewRenderAreas@ /must/
--     be a valid pointer to an array of @perViewRenderAreaCount@
--     'Vulkan.Core10.FundamentalTypes.Rect2D' structures
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_QCOM_multiview_per_view_render_areas VK_QCOM_multiview_per_view_render_areas>,
-- 'Vulkan.Core10.FundamentalTypes.Rect2D',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM = MultiviewPerViewRenderAreasRenderPassBeginInfoQCOM
  { -- | @pPerViewRenderAreas@ is a pointer to an array of
    -- 'Vulkan.Core10.FundamentalTypes.Rect2D' structures defining the render
    -- area for each view.
    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

-- No documentation found for TopLevel "VK_QCOM_MULTIVIEW_PER_VIEW_RENDER_AREAS_SPEC_VERSION"
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"

-- No documentation found for TopLevel "VK_QCOM_MULTIVIEW_PER_VIEW_RENDER_AREAS_EXTENSION_NAME"
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"