{-# language CPP #-}
-- No documentation found for Chapter "Promoted_From_VK_KHR_depth_stencil_resolve"
module Vulkan.Core12.Promoted_From_VK_KHR_depth_stencil_resolve  ( PhysicalDeviceDepthStencilResolveProperties(..)
                                                                 , SubpassDescriptionDepthStencilResolve(..)
                                                                 , StructureType(..)
                                                                 , ResolveModeFlagBits(..)
                                                                 , ResolveModeFlags
                                                                 ) where

import Foreign.Marshal.Alloc (allocaBytes)
import Foreign.Marshal.Utils (maybePeek)
import GHC.Ptr (castPtr)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Cont (evalContT)
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Zero (Zero(..))
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 Control.Monad.Trans.Cont (ContT(..))
import Vulkan.Core10.FundamentalTypes (bool32ToBool)
import Vulkan.Core10.FundamentalTypes (boolToBool32)
import Vulkan.CStruct.Extends (forgetExtensions)
import Vulkan.CStruct.Extends (peekSomeCStruct)
import Vulkan.CStruct.Extends (withSomeCStruct)
import Vulkan.Core12.Promoted_From_VK_KHR_create_renderpass2 (AttachmentReference2)
import Vulkan.Core10.FundamentalTypes (Bool32)
import Vulkan.Core12.Enums.ResolveModeFlagBits (ResolveModeFlagBits)
import Vulkan.Core12.Enums.ResolveModeFlagBits (ResolveModeFlags)
import Vulkan.CStruct.Extends (SomeStruct)
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE))
import Vulkan.Core12.Enums.ResolveModeFlagBits (ResolveModeFlagBits(..))
import Vulkan.Core12.Enums.ResolveModeFlagBits (ResolveModeFlags)
import Vulkan.Core10.Enums.StructureType (StructureType(..))
-- | VkPhysicalDeviceDepthStencilResolveProperties - Structure describing
-- depth\/stencil resolve properties that can be supported by an
-- implementation
--
-- = Description
--
-- If the 'PhysicalDeviceDepthStencilResolveProperties' structure is
-- included in the @pNext@ chain of the
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceProperties2'
-- structure passed to
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.getPhysicalDeviceProperties2',
-- it is filled in with each corresponding implementation-dependent
-- property.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_depth_stencil_resolve VK_KHR_depth_stencil_resolve>,
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_VERSION_1_2 VK_VERSION_1_2>,
-- 'Vulkan.Core10.FundamentalTypes.Bool32',
-- 'Vulkan.Core12.Enums.ResolveModeFlagBits.ResolveModeFlags',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PhysicalDeviceDepthStencilResolveProperties = PhysicalDeviceDepthStencilResolveProperties
  { -- | #extension-features-depthResolveModes# @supportedDepthResolveModes@ is a
    -- bitmask of 'Vulkan.Core12.Enums.ResolveModeFlagBits.ResolveModeFlagBits'
    -- indicating the set of supported depth resolve modes.
    -- 'Vulkan.Core12.Enums.ResolveModeFlagBits.RESOLVE_MODE_SAMPLE_ZERO_BIT'
    -- /must/ be included in the set but implementations /may/ support
    -- additional modes.
    PhysicalDeviceDepthStencilResolveProperties -> ResolveModeFlags
supportedDepthResolveModes :: ResolveModeFlags
  , -- | #extension-features-stencilResolveModes# @supportedStencilResolveModes@
    -- is a bitmask of
    -- 'Vulkan.Core12.Enums.ResolveModeFlagBits.ResolveModeFlagBits' indicating
    -- the set of supported stencil resolve modes.
    -- 'Vulkan.Core12.Enums.ResolveModeFlagBits.RESOLVE_MODE_SAMPLE_ZERO_BIT'
    -- /must/ be included in the set but implementations /may/ support
    -- additional modes.
    -- 'Vulkan.Core12.Enums.ResolveModeFlagBits.RESOLVE_MODE_AVERAGE_BIT'
    -- /must/ not be included in the set.
    PhysicalDeviceDepthStencilResolveProperties -> ResolveModeFlags
supportedStencilResolveModes :: ResolveModeFlags
  , -- | #extension-features-independentResolveNone# @independentResolveNone@ is
    -- 'Vulkan.Core10.FundamentalTypes.TRUE' if the implementation supports
    -- setting the depth and stencil resolve modes to different values when one
    -- of those modes is
    -- 'Vulkan.Core12.Enums.ResolveModeFlagBits.RESOLVE_MODE_NONE'. Otherwise
    -- the implementation only supports setting both modes to the same value.
    PhysicalDeviceDepthStencilResolveProperties -> Bool
independentResolveNone :: Bool
  , -- | #extension-features-independentResolve# @independentResolve@ is
    -- 'Vulkan.Core10.FundamentalTypes.TRUE' if the implementation supports all
    -- combinations of the supported depth and stencil resolve modes, including
    -- setting either depth or stencil resolve mode to
    -- 'Vulkan.Core12.Enums.ResolveModeFlagBits.RESOLVE_MODE_NONE'. An
    -- implementation that supports @independentResolve@ /must/ also support
    -- @independentResolveNone@.
    PhysicalDeviceDepthStencilResolveProperties -> Bool
independentResolve :: Bool
  }
  deriving (Typeable, PhysicalDeviceDepthStencilResolveProperties
-> PhysicalDeviceDepthStencilResolveProperties -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhysicalDeviceDepthStencilResolveProperties
-> PhysicalDeviceDepthStencilResolveProperties -> Bool
$c/= :: PhysicalDeviceDepthStencilResolveProperties
-> PhysicalDeviceDepthStencilResolveProperties -> Bool
== :: PhysicalDeviceDepthStencilResolveProperties
-> PhysicalDeviceDepthStencilResolveProperties -> Bool
$c== :: PhysicalDeviceDepthStencilResolveProperties
-> PhysicalDeviceDepthStencilResolveProperties -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceDepthStencilResolveProperties)
#endif
deriving instance Show PhysicalDeviceDepthStencilResolveProperties

instance ToCStruct PhysicalDeviceDepthStencilResolveProperties where
  withCStruct :: forall b.
PhysicalDeviceDepthStencilResolveProperties
-> (Ptr PhysicalDeviceDepthStencilResolveProperties -> IO b)
-> IO b
withCStruct PhysicalDeviceDepthStencilResolveProperties
x Ptr PhysicalDeviceDepthStencilResolveProperties -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
32 forall a b. (a -> b) -> a -> b
$ \Ptr PhysicalDeviceDepthStencilResolveProperties
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceDepthStencilResolveProperties
p PhysicalDeviceDepthStencilResolveProperties
x (Ptr PhysicalDeviceDepthStencilResolveProperties -> IO b
f Ptr PhysicalDeviceDepthStencilResolveProperties
p)
  pokeCStruct :: forall b.
Ptr PhysicalDeviceDepthStencilResolveProperties
-> PhysicalDeviceDepthStencilResolveProperties -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceDepthStencilResolveProperties
p PhysicalDeviceDepthStencilResolveProperties{Bool
ResolveModeFlags
independentResolve :: Bool
independentResolveNone :: Bool
supportedStencilResolveModes :: ResolveModeFlags
supportedDepthResolveModes :: ResolveModeFlags
$sel:independentResolve:PhysicalDeviceDepthStencilResolveProperties :: PhysicalDeviceDepthStencilResolveProperties -> Bool
$sel:independentResolveNone:PhysicalDeviceDepthStencilResolveProperties :: PhysicalDeviceDepthStencilResolveProperties -> Bool
$sel:supportedStencilResolveModes:PhysicalDeviceDepthStencilResolveProperties :: PhysicalDeviceDepthStencilResolveProperties -> ResolveModeFlags
$sel:supportedDepthResolveModes:PhysicalDeviceDepthStencilResolveProperties :: PhysicalDeviceDepthStencilResolveProperties -> ResolveModeFlags
..} IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceDepthStencilResolveProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceDepthStencilResolveProperties
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 PhysicalDeviceDepthStencilResolveProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr ResolveModeFlags)) (ResolveModeFlags
supportedDepthResolveModes)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceDepthStencilResolveProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr ResolveModeFlags)) (ResolveModeFlags
supportedStencilResolveModes)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceDepthStencilResolveProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
independentResolveNone))
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceDepthStencilResolveProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
independentResolve))
    IO b
f
  cStructSize :: Int
cStructSize = Int
32
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b.
Ptr PhysicalDeviceDepthStencilResolveProperties -> IO b -> IO b
pokeZeroCStruct Ptr PhysicalDeviceDepthStencilResolveProperties
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceDepthStencilResolveProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceDepthStencilResolveProperties
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 PhysicalDeviceDepthStencilResolveProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr ResolveModeFlags)) (forall a. Zero a => a
zero)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceDepthStencilResolveProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr ResolveModeFlags)) (forall a. Zero a => a
zero)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceDepthStencilResolveProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (forall a. Zero a => a
zero))
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceDepthStencilResolveProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (forall a. Zero a => a
zero))
    IO b
f

instance FromCStruct PhysicalDeviceDepthStencilResolveProperties where
  peekCStruct :: Ptr PhysicalDeviceDepthStencilResolveProperties
-> IO PhysicalDeviceDepthStencilResolveProperties
peekCStruct Ptr PhysicalDeviceDepthStencilResolveProperties
p = do
    ResolveModeFlags
supportedDepthResolveModes <- forall a. Storable a => Ptr a -> IO a
peek @ResolveModeFlags ((Ptr PhysicalDeviceDepthStencilResolveProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr ResolveModeFlags))
    ResolveModeFlags
supportedStencilResolveModes <- forall a. Storable a => Ptr a -> IO a
peek @ResolveModeFlags ((Ptr PhysicalDeviceDepthStencilResolveProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr ResolveModeFlags))
    Bool32
independentResolveNone <- forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PhysicalDeviceDepthStencilResolveProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Bool32))
    Bool32
independentResolve <- forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PhysicalDeviceDepthStencilResolveProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr Bool32))
    forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ ResolveModeFlags
-> ResolveModeFlags
-> Bool
-> Bool
-> PhysicalDeviceDepthStencilResolveProperties
PhysicalDeviceDepthStencilResolveProperties
             ResolveModeFlags
supportedDepthResolveModes
             ResolveModeFlags
supportedStencilResolveModes
             (Bool32 -> Bool
bool32ToBool Bool32
independentResolveNone)
             (Bool32 -> Bool
bool32ToBool Bool32
independentResolve)

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

instance Zero PhysicalDeviceDepthStencilResolveProperties where
  zero :: PhysicalDeviceDepthStencilResolveProperties
zero = ResolveModeFlags
-> ResolveModeFlags
-> Bool
-> Bool
-> PhysicalDeviceDepthStencilResolveProperties
PhysicalDeviceDepthStencilResolveProperties
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero


-- | VkSubpassDescriptionDepthStencilResolve - Structure specifying
-- depth\/stencil resolve operations for a subpass
--
-- = Description
--
-- If the @pNext@ chain of
-- 'Vulkan.Core12.Promoted_From_VK_KHR_create_renderpass2.SubpassDescription2'
-- includes a 'SubpassDescriptionDepthStencilResolve' structure, then that
-- structure describes
-- <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#renderpass-resolve-operations multisample resolve operations>
-- for the depth\/stencil attachment in a subpass. If this structure is not
-- included in the @pNext@ chain of
-- 'Vulkan.Core12.Promoted_From_VK_KHR_create_renderpass2.SubpassDescription2',
-- or if it is and either @pDepthStencilResolveAttachment@ is @NULL@ or its
-- attachment index is 'Vulkan.Core10.APIConstants.ATTACHMENT_UNUSED', it
-- indicates that no depth\/stencil resolve attachment will be used in the
-- subpass.
--
-- == Valid Usage
--
-- -   #VUID-VkSubpassDescriptionDepthStencilResolve-pDepthStencilResolveAttachment-03177#
--     If @pDepthStencilResolveAttachment@ is not @NULL@ and does not have
--     the value 'Vulkan.Core10.APIConstants.ATTACHMENT_UNUSED',
--     @pDepthStencilAttachment@ /must/ not be @NULL@ or have the value
--     'Vulkan.Core10.APIConstants.ATTACHMENT_UNUSED'
--
-- -   #VUID-VkSubpassDescriptionDepthStencilResolve-pDepthStencilResolveAttachment-03179#
--     If @pDepthStencilResolveAttachment@ is not @NULL@ and does not have
--     the value 'Vulkan.Core10.APIConstants.ATTACHMENT_UNUSED',
--     @pDepthStencilAttachment@ /must/ not have a sample count of
--     'Vulkan.Core10.Enums.SampleCountFlagBits.SAMPLE_COUNT_1_BIT'
--
-- -   #VUID-VkSubpassDescriptionDepthStencilResolve-pDepthStencilResolveAttachment-03180#
--     If @pDepthStencilResolveAttachment@ is not @NULL@ and does not have
--     the value 'Vulkan.Core10.APIConstants.ATTACHMENT_UNUSED',
--     @pDepthStencilResolveAttachment@ /must/ have a sample count of
--     'Vulkan.Core10.Enums.SampleCountFlagBits.SAMPLE_COUNT_1_BIT'
--
-- -   #VUID-VkSubpassDescriptionDepthStencilResolve-pDepthStencilResolveAttachment-02651#
--     If @pDepthStencilResolveAttachment@ is not @NULL@ and does not have
--     the value 'Vulkan.Core10.APIConstants.ATTACHMENT_UNUSED' then it
--     /must/ have an image format whose
--     <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#potential-format-features potential format features>
--     contain
--     'Vulkan.Core10.Enums.FormatFeatureFlagBits.FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT'
--
-- -   #VUID-VkSubpassDescriptionDepthStencilResolve-pDepthStencilResolveAttachment-03181#
--     If @pDepthStencilResolveAttachment@ is not @NULL@ and does not have
--     the value 'Vulkan.Core10.APIConstants.ATTACHMENT_UNUSED' and
--     'Vulkan.Core10.Enums.Format.Format' of
--     @pDepthStencilResolveAttachment@ has a depth component, then the
--     'Vulkan.Core10.Enums.Format.Format' of @pDepthStencilAttachment@
--     /must/ have a depth component with the same number of bits and
--     <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#formats-numericformat numeric format>
--
-- -   #VUID-VkSubpassDescriptionDepthStencilResolve-pDepthStencilResolveAttachment-03182#
--     If @pDepthStencilResolveAttachment@ is not @NULL@ and does not have
--     the value 'Vulkan.Core10.APIConstants.ATTACHMENT_UNUSED', and
--     'Vulkan.Core10.Enums.Format.Format' of
--     @pDepthStencilResolveAttachment@ has a stencil component, then the
--     'Vulkan.Core10.Enums.Format.Format' of @pDepthStencilAttachment@
--     /must/ have a stencil component with the same number of bits and
--     <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#formats-numericformat numeric format>
--
-- -   #VUID-VkSubpassDescriptionDepthStencilResolve-pDepthStencilResolveAttachment-03178#
--     If @pDepthStencilResolveAttachment@ is not @NULL@ and does not have
--     the value 'Vulkan.Core10.APIConstants.ATTACHMENT_UNUSED',
--     @depthResolveMode@ and @stencilResolveMode@ /must/ not both be
--     'Vulkan.Core12.Enums.ResolveModeFlagBits.RESOLVE_MODE_NONE'
--
-- -   #VUID-VkSubpassDescriptionDepthStencilResolve-depthResolveMode-03183#
--     If @pDepthStencilResolveAttachment@ is not @NULL@ and does not have
--     the value 'Vulkan.Core10.APIConstants.ATTACHMENT_UNUSED' and the
--     'Vulkan.Core10.Enums.Format.Format' of
--     @pDepthStencilResolveAttachment@ has a depth component, then the
--     value of @depthResolveMode@ /must/ be one of the bits set in
--     'PhysicalDeviceDepthStencilResolveProperties'::@supportedDepthResolveModes@
--     or 'Vulkan.Core12.Enums.ResolveModeFlagBits.RESOLVE_MODE_NONE'
--
-- -   #VUID-VkSubpassDescriptionDepthStencilResolve-stencilResolveMode-03184#
--     If @pDepthStencilResolveAttachment@ is not @NULL@ and does not have
--     the value 'Vulkan.Core10.APIConstants.ATTACHMENT_UNUSED' and the
--     'Vulkan.Core10.Enums.Format.Format' of
--     @pDepthStencilResolveAttachment@ has a stencil component, then the
--     value of @stencilResolveMode@ /must/ be one of the bits set in
--     'PhysicalDeviceDepthStencilResolveProperties'::@supportedStencilResolveModes@
--     or 'Vulkan.Core12.Enums.ResolveModeFlagBits.RESOLVE_MODE_NONE'
--
-- -   #VUID-VkSubpassDescriptionDepthStencilResolve-pDepthStencilResolveAttachment-03185#
--     If @pDepthStencilResolveAttachment@ is not @NULL@ and does not have
--     the value 'Vulkan.Core10.APIConstants.ATTACHMENT_UNUSED', the
--     'Vulkan.Core10.Enums.Format.Format' of
--     @pDepthStencilResolveAttachment@ has both depth and stencil
--     components,
--     'PhysicalDeviceDepthStencilResolveProperties'::@independentResolve@
--     is 'Vulkan.Core10.FundamentalTypes.FALSE', and
--     'PhysicalDeviceDepthStencilResolveProperties'::@independentResolveNone@
--     is 'Vulkan.Core10.FundamentalTypes.FALSE', then the values of
--     @depthResolveMode@ and @stencilResolveMode@ /must/ be identical
--
-- -   #VUID-VkSubpassDescriptionDepthStencilResolve-pDepthStencilResolveAttachment-03186#
--     If @pDepthStencilResolveAttachment@ is not @NULL@ and does not have
--     the value 'Vulkan.Core10.APIConstants.ATTACHMENT_UNUSED', the
--     'Vulkan.Core10.Enums.Format.Format' of
--     @pDepthStencilResolveAttachment@ has both depth and stencil
--     components,
--     'PhysicalDeviceDepthStencilResolveProperties'::@independentResolve@
--     is 'Vulkan.Core10.FundamentalTypes.FALSE' and
--     'PhysicalDeviceDepthStencilResolveProperties'::@independentResolveNone@
--     is 'Vulkan.Core10.FundamentalTypes.TRUE', then the values of
--     @depthResolveMode@ and @stencilResolveMode@ /must/ be identical or
--     one of them /must/ be
--     'Vulkan.Core12.Enums.ResolveModeFlagBits.RESOLVE_MODE_NONE'
--
-- -   #VUID-VkSubpassDescriptionDepthStencilResolve-pNext-06873# If the
--     @pNext@ chain of
--     'Vulkan.Core12.Promoted_From_VK_KHR_create_renderpass2.SubpassDescription2'
--     includes a
--     'Vulkan.Extensions.VK_EXT_multisampled_render_to_single_sampled.MultisampledRenderToSingleSampledInfoEXT'
--     structure, the @multisampledRenderToSingleSampledEnable@ field is
--     'Vulkan.Core10.FundamentalTypes.TRUE', and @pDepthStencilAttachment@
--     is not @NULL@ and does not have the value
--     'Vulkan.Core10.APIConstants.ATTACHMENT_UNUSED', @depthResolveMode@
--     and @stencilResolveMode@ /must/ not both be
--     'Vulkan.Core12.Enums.ResolveModeFlagBits.RESOLVE_MODE_NONE'
--
-- -   #VUID-VkSubpassDescriptionDepthStencilResolve-pNext-06874# If the
--     @pNext@ chain of
--     'Vulkan.Core12.Promoted_From_VK_KHR_create_renderpass2.SubpassDescription2'
--     includes a
--     'Vulkan.Extensions.VK_EXT_multisampled_render_to_single_sampled.MultisampledRenderToSingleSampledInfoEXT'
--     structure whose @multisampledRenderToSingleSampledEnable@ field is
--     'Vulkan.Core10.FundamentalTypes.TRUE', and @pDepthStencilAttachment@
--     is not @NULL@, does not have the value
--     'Vulkan.Core10.APIConstants.ATTACHMENT_UNUSED', and has a
--     'Vulkan.Core10.Enums.Format.Format' that has a depth component, then
--     the value of @depthResolveMode@ /must/ be one of the bits set in
--     'PhysicalDeviceDepthStencilResolveProperties'::@supportedDepthResolveModes@
--     or 'Vulkan.Core12.Enums.ResolveModeFlagBits.RESOLVE_MODE_NONE'
--
-- -   #VUID-VkSubpassDescriptionDepthStencilResolve-pNext-06875# If the
--     @pNext@ chain of
--     'Vulkan.Core12.Promoted_From_VK_KHR_create_renderpass2.SubpassDescription2'
--     includes a
--     'Vulkan.Extensions.VK_EXT_multisampled_render_to_single_sampled.MultisampledRenderToSingleSampledInfoEXT'
--     structure whose @multisampledRenderToSingleSampledEnable@ field is
--     'Vulkan.Core10.FundamentalTypes.TRUE', and @pDepthStencilAttachment@
--     is not @NULL@, does not have the value
--     'Vulkan.Core10.APIConstants.ATTACHMENT_UNUSED', and has a
--     'Vulkan.Core10.Enums.Format.Format' with a stencil component, then
--     the value of @stencilResolveMode@ /must/ be one of the bits set in
--     'PhysicalDeviceDepthStencilResolveProperties'::@supportedStencilResolveModes@
--     or 'Vulkan.Core12.Enums.ResolveModeFlagBits.RESOLVE_MODE_NONE'
--
-- -   #VUID-VkSubpassDescriptionDepthStencilResolve-pNext-06876# If the
--     @pNext@ chain of
--     'Vulkan.Core12.Promoted_From_VK_KHR_create_renderpass2.SubpassDescription2'
--     includes a
--     'Vulkan.Extensions.VK_EXT_multisampled_render_to_single_sampled.MultisampledRenderToSingleSampledInfoEXT'
--     structure whose @multisampledRenderToSingleSampledEnable@ field is
--     'Vulkan.Core10.FundamentalTypes.TRUE', @pDepthStencilAttachment@ is
--     not @NULL@, does not have the value
--     'Vulkan.Core10.APIConstants.ATTACHMENT_UNUSED', and has a
--     'Vulkan.Core10.Enums.Format.Format' with both depth and stencil
--     components, and both
--     'PhysicalDeviceDepthStencilResolveProperties'::@independentResolve@
--     and
--     'PhysicalDeviceDepthStencilResolveProperties'::@independentResolveNone@
--     are 'Vulkan.Core10.FundamentalTypes.FALSE', then the values of
--     @depthResolveMode@ and @stencilResolveMode@ /must/ be identical
--
-- -   #VUID-VkSubpassDescriptionDepthStencilResolve-pNext-06877# If the
--     @pNext@ chain of
--     'Vulkan.Core12.Promoted_From_VK_KHR_create_renderpass2.SubpassDescription2'
--     includes a
--     'Vulkan.Extensions.VK_EXT_multisampled_render_to_single_sampled.MultisampledRenderToSingleSampledInfoEXT'
--     structure whose @multisampledRenderToSingleSampledEnable@ field is
--     'Vulkan.Core10.FundamentalTypes.TRUE', @pDepthStencilAttachment@ is
--     not @NULL@, does not have the value
--     'Vulkan.Core10.APIConstants.ATTACHMENT_UNUSED', and has a
--     'Vulkan.Core10.Enums.Format.Format' with both depth and stencil
--     components,
--     'PhysicalDeviceDepthStencilResolveProperties'::@independentResolve@
--     is 'Vulkan.Core10.FundamentalTypes.FALSE', and
--     'PhysicalDeviceDepthStencilResolveProperties'::@independentResolveNone@
--     is 'Vulkan.Core10.FundamentalTypes.TRUE', then the values of
--     @depthResolveMode@ and @stencilResolveMode@ /must/ be identical or
--     one of them /must/ be
--     'Vulkan.Core12.Enums.ResolveModeFlagBits.RESOLVE_MODE_NONE'
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkSubpassDescriptionDepthStencilResolve-sType-sType# @sType@
--     /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE'
--
-- -   #VUID-VkSubpassDescriptionDepthStencilResolve-pDepthStencilResolveAttachment-parameter#
--     If @pDepthStencilResolveAttachment@ is not @NULL@,
--     @pDepthStencilResolveAttachment@ /must/ be a valid pointer to a
--     valid
--     'Vulkan.Core12.Promoted_From_VK_KHR_create_renderpass2.AttachmentReference2'
--     structure
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_depth_stencil_resolve VK_KHR_depth_stencil_resolve>,
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_VERSION_1_2 VK_VERSION_1_2>,
-- 'Vulkan.Core12.Promoted_From_VK_KHR_create_renderpass2.AttachmentReference2',
-- 'Vulkan.Core12.Enums.ResolveModeFlagBits.ResolveModeFlagBits',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data SubpassDescriptionDepthStencilResolve = SubpassDescriptionDepthStencilResolve
  { -- | @depthResolveMode@ is a
    -- 'Vulkan.Core12.Enums.ResolveModeFlagBits.ResolveModeFlagBits' value
    -- describing the depth resolve mode.
    SubpassDescriptionDepthStencilResolve -> ResolveModeFlags
depthResolveMode :: ResolveModeFlagBits
  , -- | @stencilResolveMode@ is a
    -- 'Vulkan.Core12.Enums.ResolveModeFlagBits.ResolveModeFlagBits' value
    -- describing the stencil resolve mode.
    SubpassDescriptionDepthStencilResolve -> ResolveModeFlags
stencilResolveMode :: ResolveModeFlagBits
  , -- | @pDepthStencilResolveAttachment@ is @NULL@ or a pointer to a
    -- 'Vulkan.Core12.Promoted_From_VK_KHR_create_renderpass2.AttachmentReference2'
    -- structure defining the depth\/stencil resolve attachment for this
    -- subpass and its layout.
    SubpassDescriptionDepthStencilResolve
-> Maybe (SomeStruct AttachmentReference2)
depthStencilResolveAttachment :: Maybe (SomeStruct AttachmentReference2)
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (SubpassDescriptionDepthStencilResolve)
#endif
deriving instance Show SubpassDescriptionDepthStencilResolve

instance ToCStruct SubpassDescriptionDepthStencilResolve where
  withCStruct :: forall b.
SubpassDescriptionDepthStencilResolve
-> (Ptr SubpassDescriptionDepthStencilResolve -> IO b) -> IO b
withCStruct SubpassDescriptionDepthStencilResolve
x Ptr SubpassDescriptionDepthStencilResolve -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
32 forall a b. (a -> b) -> a -> b
$ \Ptr SubpassDescriptionDepthStencilResolve
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr SubpassDescriptionDepthStencilResolve
p SubpassDescriptionDepthStencilResolve
x (Ptr SubpassDescriptionDepthStencilResolve -> IO b
f Ptr SubpassDescriptionDepthStencilResolve
p)
  pokeCStruct :: forall b.
Ptr SubpassDescriptionDepthStencilResolve
-> SubpassDescriptionDepthStencilResolve -> IO b -> IO b
pokeCStruct Ptr SubpassDescriptionDepthStencilResolve
p SubpassDescriptionDepthStencilResolve{Maybe (SomeStruct AttachmentReference2)
ResolveModeFlags
depthStencilResolveAttachment :: Maybe (SomeStruct AttachmentReference2)
stencilResolveMode :: ResolveModeFlags
depthResolveMode :: ResolveModeFlags
$sel:depthStencilResolveAttachment:SubpassDescriptionDepthStencilResolve :: SubpassDescriptionDepthStencilResolve
-> Maybe (SomeStruct AttachmentReference2)
$sel:stencilResolveMode:SubpassDescriptionDepthStencilResolve :: SubpassDescriptionDepthStencilResolve -> ResolveModeFlags
$sel:depthResolveMode:SubpassDescriptionDepthStencilResolve :: SubpassDescriptionDepthStencilResolve -> ResolveModeFlags
..} 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 SubpassDescriptionDepthStencilResolve
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE)
    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 SubpassDescriptionDepthStencilResolve
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 SubpassDescriptionDepthStencilResolve
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr ResolveModeFlagBits)) (ResolveModeFlags
depthResolveMode)
    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 SubpassDescriptionDepthStencilResolve
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr ResolveModeFlagBits)) (ResolveModeFlags
stencilResolveMode)
    Ptr (AttachmentReference2 '[])
pDepthStencilResolveAttachment'' <- case (Maybe (SomeStruct AttachmentReference2)
depthStencilResolveAttachment) of
      Maybe (SomeStruct AttachmentReference2)
Nothing -> forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a. Ptr a
nullPtr
      Just SomeStruct AttachmentReference2
j -> forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT @_ @_ @(Ptr (AttachmentReference2 '[])) forall a b. (a -> b) -> a -> b
$ \Ptr (AttachmentReference2 '[]) -> IO b
cont -> forall (a :: [*] -> *) b.
(forall (es :: [*]).
 (Extendss a es, PokeChain es) =>
 ToCStruct (a es)) =>
SomeStruct a
-> (forall (es :: [*]).
    (Extendss a es, PokeChain es) =>
    Ptr (a es) -> IO b)
-> IO b
withSomeCStruct @AttachmentReference2 (SomeStruct AttachmentReference2
j) (Ptr (AttachmentReference2 '[]) -> IO b
cont forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. Ptr a -> Ptr b
castPtr)
    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 SubpassDescriptionDepthStencilResolve
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr (AttachmentReference2 _)))) Ptr (AttachmentReference2 '[])
pDepthStencilResolveAttachment''
    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 SubpassDescriptionDepthStencilResolve -> IO b -> IO b
pokeZeroCStruct Ptr SubpassDescriptionDepthStencilResolve
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SubpassDescriptionDepthStencilResolve
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SubpassDescriptionDepthStencilResolve
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 SubpassDescriptionDepthStencilResolve
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr ResolveModeFlagBits)) (forall a. Zero a => a
zero)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SubpassDescriptionDepthStencilResolve
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr ResolveModeFlagBits)) (forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct SubpassDescriptionDepthStencilResolve where
  peekCStruct :: Ptr SubpassDescriptionDepthStencilResolve
-> IO SubpassDescriptionDepthStencilResolve
peekCStruct Ptr SubpassDescriptionDepthStencilResolve
p = do
    ResolveModeFlags
depthResolveMode <- forall a. Storable a => Ptr a -> IO a
peek @ResolveModeFlagBits ((Ptr SubpassDescriptionDepthStencilResolve
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr ResolveModeFlagBits))
    ResolveModeFlags
stencilResolveMode <- forall a. Storable a => Ptr a -> IO a
peek @ResolveModeFlagBits ((Ptr SubpassDescriptionDepthStencilResolve
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr ResolveModeFlagBits))
    Ptr (AttachmentReference2 Any)
pDepthStencilResolveAttachment <- forall a. Storable a => Ptr a -> IO a
peek @(Ptr (AttachmentReference2 _)) ((Ptr SubpassDescriptionDepthStencilResolve
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr (AttachmentReference2 _))))
    Maybe (SomeStruct AttachmentReference2)
pDepthStencilResolveAttachment' <- forall a b. (Ptr a -> IO b) -> Ptr a -> IO (Maybe b)
maybePeek (\Ptr (AttachmentReference2 Any)
j -> forall (a :: [*] -> *).
(Extensible a,
 forall (es :: [*]).
 (Extendss a es, PeekChain es) =>
 FromCStruct (a es)) =>
Ptr (SomeStruct a) -> IO (SomeStruct a)
peekSomeCStruct (forall (a :: [*] -> *) (es :: [*]).
Ptr (a es) -> Ptr (SomeStruct a)
forgetExtensions (Ptr (AttachmentReference2 Any)
j))) Ptr (AttachmentReference2 Any)
pDepthStencilResolveAttachment
    forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ ResolveModeFlags
-> ResolveModeFlags
-> Maybe (SomeStruct AttachmentReference2)
-> SubpassDescriptionDepthStencilResolve
SubpassDescriptionDepthStencilResolve
             ResolveModeFlags
depthResolveMode ResolveModeFlags
stencilResolveMode Maybe (SomeStruct AttachmentReference2)
pDepthStencilResolveAttachment'

instance Zero SubpassDescriptionDepthStencilResolve where
  zero :: SubpassDescriptionDepthStencilResolve
zero = ResolveModeFlags
-> ResolveModeFlags
-> Maybe (SomeStruct AttachmentReference2)
-> SubpassDescriptionDepthStencilResolve
SubpassDescriptionDepthStencilResolve
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero
           forall a. Maybe a
Nothing