{-# language CPP #-}
-- | = Name
--
-- VK_EXT_custom_resolve - device extension
--
-- = VK_EXT_custom_resolve
--
-- [__Name String__]
--     @VK_EXT_custom_resolve@
--
-- [__Extension Type__]
--     Device extension
--
-- [__Registered Extension Number__]
--     629
--
-- [__Revision__]
--     1
--
-- [__Ratification Status__]
--     Ratified
--
-- [__Extension and Version Dependencies__]
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_get_physical_device_properties2 VK_KHR_get_physical_device_properties2>
--     or
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#versions-1.1 Vulkan Version 1.1>
--
-- [__API Interactions__]
--
--     -   Interacts with VK_VERSION_1_3
--
--     -   Interacts with VK_KHR_dynamic_rendering
--
-- [__Contact__]
--
--     -   Mike Blumenkrantz
--         <https://github.com/KhronosGroup/Vulkan-Docs/issues/new?body=[VK_EXT_custom_resolve] @zmike%0A*Here describe the issue or question you have about the VK_EXT_custom_resolve extension* >
--
-- [__Extension Proposal__]
--     <https://github.com/KhronosGroup/Vulkan-Docs/tree/main/proposals/VK_EXT_custom_resolve.adoc VK_EXT_custom_resolve>
--
-- == Other Extension Metadata
--
-- [__Last Modified Date__]
--     2025-05-13
--
-- [__IP Status__]
--     No known IP claims.
--
-- [__Interactions and External Dependencies__]
--
--     -   This extension interacts with @VK_KHR_dynamic_rendering@
--
--     -   This extension interacts with
--         @VK_EXT_dynamic_rendering_unused_attachments@
--
--     -   This extension interacts with @VK_EXT_fragment_density_map@
--
--     -   This extension interacts with @VK_EXT_graphics_pipeline_library@
--
--     -   This extension interacts with @VK_EXT_shader_object@
--
-- [__Contributors__]
--
--     -   Mike Blumenkrantz, Valve
--
--     -   Connor Abbott, Valve
--
--     -   Samuel Pitoiset, Valve
--
--     -   Matthew Netsch, Qualcomm
--
--     -   Jan-Harald Fredriksen, ARM
--
--     -   Ting Wei, ARM
--
--     -   Ricardo Garcia, Igalia
--
--     -   Spencer Fricke, LunarG
--
--     -   Piers Daniell, Nvidia
--
-- == Description
--
-- This extension provides functionality for using shaders to resolve
-- multisample rendering attachments.
--
-- It builds upon mechanics introduced by
-- VK_QCOM_render_pass_shader_resolve, additionally adding support for
-- dynamic rendering.
--
-- == New Commands
--
-- If
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_dynamic_rendering VK_KHR_dynamic_rendering>
-- or
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#versions-1.3 Vulkan Version 1.3>
-- is supported:
--
-- -   'cmdBeginCustomResolveEXT'
--
-- == New Structures
--
-- -   Extending
--     'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceFeatures2',
--     'Vulkan.Core10.Device.DeviceCreateInfo':
--
--     -   'PhysicalDeviceCustomResolveFeaturesEXT'
--
-- If
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_dynamic_rendering VK_KHR_dynamic_rendering>
-- or
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#versions-1.3 Vulkan Version 1.3>
-- is supported:
--
-- -   'BeginCustomResolveInfoEXT'
--
-- -   Extending
--     'Vulkan.Core10.GraphicsPipeline.GraphicsPipelineCreateInfo',
--     'Vulkan.Core10.CommandBuffer.CommandBufferInheritanceInfo',
--     'Vulkan.Extensions.VK_EXT_shader_object.ShaderCreateInfoEXT':
--
--     -   'CustomResolveCreateInfoEXT'
--
-- == New Enum Constants
--
-- -   'EXT_CUSTOM_RESOLVE_EXTENSION_NAME'
--
-- -   'EXT_CUSTOM_RESOLVE_SPEC_VERSION'
--
-- -   Extending 'Vulkan.Core10.Enums.StructureType.StructureType':
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_RESOLVE_FEATURES_EXT'
--
-- -   Extending
--     'Vulkan.Core10.Enums.SubpassDescriptionFlagBits.SubpassDescriptionFlagBits':
--
--     -   'Vulkan.Core10.Enums.SubpassDescriptionFlagBits.SUBPASS_DESCRIPTION_CUSTOM_RESOLVE_BIT_EXT'
--
--     -   'Vulkan.Core10.Enums.SubpassDescriptionFlagBits.SUBPASS_DESCRIPTION_FRAGMENT_REGION_BIT_EXT'
--
-- If
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_dynamic_rendering VK_KHR_dynamic_rendering>
-- or
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#versions-1.3 Vulkan Version 1.3>
-- is supported:
--
-- -   Extending 'Vulkan.Core13.Enums.RenderingFlagBits.RenderingFlagBits':
--
--     -   'Vulkan.Core13.Enums.RenderingFlagBits.RENDERING_CUSTOM_RESOLVE_BIT_EXT'
--
--     -   'Vulkan.Core13.Enums.RenderingFlagBits.RENDERING_FRAGMENT_REGION_BIT_EXT'
--
-- -   Extending
--     'Vulkan.Core12.Enums.ResolveModeFlagBits.ResolveModeFlagBits':
--
--     -   'Vulkan.Core12.Enums.ResolveModeFlagBits.RESOLVE_MODE_CUSTOM_BIT_EXT'
--
-- -   Extending 'Vulkan.Core10.Enums.StructureType.StructureType':
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_BEGIN_CUSTOM_RESOLVE_INFO_EXT'
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_CUSTOM_RESOLVE_CREATE_INFO_EXT'
--
-- == Issues
--
-- 1) How will this work with shader objects?
--
-- Some vendors emit an epilog at the end of the FS that stores each
-- color\/depth\/stencil attachment to the appropriate tilebuffer location,
-- and to do that they need to know the layout of the tilebuffer which
-- depends on the attachment formats\/sample counts. We agreed that for
-- shader object the FS epilog is emitted dynamically when the draw
-- happens.
--
-- == Version History
--
-- -   Revision 1, 2025-05-13 (Mike Blumenkrantz)
--
--     -   Initial draft
--
-- == See Also
--
-- No cross-references are available
--
-- == Document Notes
--
-- For more information, see the
-- <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#VK_EXT_custom_resolve Vulkan Specification>.
--
-- This page is a generated document. Fixes and changes should be made to
-- the generator scripts, not directly.
module Vulkan.Extensions.VK_EXT_custom_resolve  ( cmdBeginCustomResolveEXT
                                                , BeginCustomResolveInfoEXT(..)
                                                , PhysicalDeviceCustomResolveFeaturesEXT(..)
                                                , CustomResolveCreateInfoEXT(..)
                                                , EXT_CUSTOM_RESOLVE_SPEC_VERSION
                                                , pattern EXT_CUSTOM_RESOLVE_SPEC_VERSION
                                                , EXT_CUSTOM_RESOLVE_EXTENSION_NAME
                                                , pattern EXT_CUSTOM_RESOLVE_EXTENSION_NAME
                                                ) where

import Vulkan.Internal.Utils (traceAroundEvent)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Foreign.Marshal.Alloc (allocaBytes)
import GHC.IO (throwIO)
import GHC.Ptr (nullFunPtr)
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 Control.Monad.IO.Class (MonadIO)
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 (FunPtr)
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.NamedType ((:::))
import Vulkan.Core10.FundamentalTypes (Bool32)
import Vulkan.Core10.Handles (CommandBuffer)
import Vulkan.Core10.Handles (CommandBuffer(..))
import Vulkan.Core10.Handles (CommandBuffer(CommandBuffer))
import Vulkan.Core10.Handles (CommandBuffer_T)
import Vulkan.Dynamic (DeviceCmds(pVkCmdBeginCustomResolveEXT))
import Vulkan.Core10.Enums.Format (Format)
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_BEGIN_CUSTOM_RESOLVE_INFO_EXT))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_CUSTOM_RESOLVE_CREATE_INFO_EXT))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_RESOLVE_FEATURES_EXT))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkCmdBeginCustomResolveEXT
  :: FunPtr (Ptr CommandBuffer_T -> Ptr BeginCustomResolveInfoEXT -> IO ()) -> Ptr CommandBuffer_T -> Ptr BeginCustomResolveInfoEXT -> IO ()

-- | vkCmdBeginCustomResolveEXT - Begins a shader resolve operation
--
-- = Description
--
-- Following this call, any @resolveImageView@ with @resolveMode@ set to
-- 'Vulkan.Core12.Enums.ResolveModeFlagBits.RESOLVE_MODE_CUSTOM_BIT_EXT'
-- will be written by outputs which would otherwise have written to the
-- @imageView@ image until the end of the current render pass instance.
--
-- Following this call, the fragment area /may/ be reduced to (1,1) if a
-- fragment density map is attached. If this occurs, reads of input
-- attachments mapped to a color, depth, or stencil attachment return the
-- value for the original larger fragment containing the smaller fragment.
-- Reads of input attachments not mapped to a color, depth, or stencil
-- attachment use the new fragment area.
--
-- Because the content of any depth\/stencil resolve attachment as well as
-- any color resolve attachment is undefined at the beginning of a resolve
-- operation, any depth testing, stencil testing, or blending operation
-- which sources these undefined values also has undefined result value.
--
-- During a custom resolve pass, multiple fragment invocations writing to
-- the same (x, y, layer, view, sample) coordinate, i.e. overdraw, will
-- produce undefined behavior.
--
-- Implementations are allowed to implement custom resolve attachment
-- writes through other mechanisms than framebuffer attachment writes,
-- which would normally obey rules of rasterization order.
--
-- == Valid Usage
--
-- -   #VUID-vkCmdBeginCustomResolveEXT-commandBuffer-11517# The current
--     render pass instance /must/ have been started or resumed by
--     'Vulkan.Core13.Promoted_From_VK_KHR_dynamic_rendering.cmdBeginRendering'
--     in this @commandBuffer@
--
-- -   #VUID-vkCmdBeginCustomResolveEXT-None-11518#
--     'cmdBeginCustomResolveEXT' /must/ not have already been recorded in
--     the current render pass instance
--
-- -   #VUID-vkCmdBeginCustomResolveEXT-None-11519# The current render pass
--     instance /must/ have specified
--     'Vulkan.Core13.Enums.RenderingFlagBits.RENDERING_CUSTOM_RESOLVE_BIT_EXT'
--
-- -   #VUID-vkCmdBeginCustomResolveEXT-None-11520# The current render pass
--     instance /must/ not have specified
--     'Vulkan.Core13.Enums.RenderingFlagBits.RENDERING_SUSPENDING_BIT'
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-vkCmdBeginCustomResolveEXT-commandBuffer-parameter#
--     @commandBuffer@ /must/ be a valid
--     'Vulkan.Core10.Handles.CommandBuffer' handle
--
-- -   #VUID-vkCmdBeginCustomResolveEXT-pBeginCustomResolveInfo-parameter#
--     If @pBeginCustomResolveInfo@ is not @NULL@,
--     @pBeginCustomResolveInfo@ /must/ be a valid pointer to a valid
--     'BeginCustomResolveInfoEXT' structure
--
-- -   #VUID-vkCmdBeginCustomResolveEXT-commandBuffer-recording#
--     @commandBuffer@ /must/ be in the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#commandbuffers-lifecycle recording state>
--
-- -   #VUID-vkCmdBeginCustomResolveEXT-commandBuffer-cmdpool# The
--     'Vulkan.Core10.Handles.CommandPool' that @commandBuffer@ was
--     allocated from /must/ support
--     'Vulkan.Core10.Enums.QueueFlagBits.QUEUE_GRAPHICS_BIT' operations
--
-- -   #VUID-vkCmdBeginCustomResolveEXT-renderpass# This command /must/
--     only be called inside of a render pass instance
--
-- -   #VUID-vkCmdBeginCustomResolveEXT-suspended# This command /must/ not
--     be called between suspended render pass instances
--
-- -   #VUID-vkCmdBeginCustomResolveEXT-videocoding# This command /must/
--     only be called outside of a video coding scope
--
-- == Host Synchronization
--
-- -   Host access to @commandBuffer@ /must/ be externally synchronized
--
-- -   Host access to the 'Vulkan.Core10.Handles.CommandPool' that
--     @commandBuffer@ was allocated from /must/ be externally synchronized
--
-- == Command Properties
--
-- \'
--
-- +----------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
-- | <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VkCommandBufferLevel Command Buffer Levels> | <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#vkCmdBeginRenderPass Render Pass Scope> | <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#vkCmdBeginVideoCodingKHR Video Coding Scope> | <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VkQueueFlagBits Supported Queue Types> | <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#fundamentals-queueoperation-command-types Command Type> |
-- +============================================================================================================================+========================================================================================================================+=============================================================================================================================+=======================================================================================================================+========================================================================================================================================+
-- | Primary                                                                                                                    | Inside                                                                                                                 | Outside                                                                                                                     | VK_QUEUE_GRAPHICS_BIT                                                                                                 | Action                                                                                                                                 |
-- | Secondary                                                                                                                  |                                                                                                                        |                                                                                                                             |                                                                                                                       |                                                                                                                                        |
-- +----------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
--
-- == Conditional Rendering
--
-- vkCmdBeginCustomResolveEXT is affected by
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#drawing-conditional-rendering conditional rendering>
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_custom_resolve VK_EXT_custom_resolve>,
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_dynamic_rendering VK_KHR_dynamic_rendering>,
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_VERSION_1_3 VK_VERSION_1_3>,
-- 'BeginCustomResolveInfoEXT', 'Vulkan.Core10.Handles.CommandBuffer'
cmdBeginCustomResolveEXT :: forall io
                          . (MonadIO io)
                         => -- | @commandBuffer@ is the command buffer in which to record the command.
                            CommandBuffer
                         -> -- | @pBeginCustomResolveInfo@ is an optional struct with which to extend
                            -- functionality.
                            ("beginCustomResolveInfo" ::: Maybe BeginCustomResolveInfoEXT)
                         -> io ()
cmdBeginCustomResolveEXT :: forall (io :: * -> *).
MonadIO io =>
CommandBuffer
-> ("beginCustomResolveInfo" ::: Maybe BeginCustomResolveInfoEXT)
-> io ()
cmdBeginCustomResolveEXT CommandBuffer
commandBuffer
                           "beginCustomResolveInfo" ::: Maybe BeginCustomResolveInfoEXT
beginCustomResolveInfo = IO () -> io ()
forall a. IO a -> io a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> io ())
-> (ContT () IO () -> IO ()) -> ContT () IO () -> io ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT () IO () -> IO ()
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT () IO () -> io ()) -> ContT () IO () -> io ()
forall a b. (a -> b) -> a -> b
$ do
  let vkCmdBeginCustomResolveEXTPtr :: FunPtr
  (Ptr CommandBuffer_T -> Ptr BeginCustomResolveInfoEXT -> IO ())
vkCmdBeginCustomResolveEXTPtr = DeviceCmds
-> FunPtr
     (Ptr CommandBuffer_T -> Ptr BeginCustomResolveInfoEXT -> IO ())
pVkCmdBeginCustomResolveEXT (case CommandBuffer
commandBuffer of CommandBuffer{DeviceCmds
deviceCmds :: DeviceCmds
deviceCmds :: CommandBuffer -> DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
  IO () -> ContT () IO ()
forall (m :: * -> *) a. Monad m => m a -> ContT () m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT () IO ()) -> IO () -> ContT () IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr CommandBuffer_T -> Ptr BeginCustomResolveInfoEXT -> IO ())
vkCmdBeginCustomResolveEXTPtr FunPtr
  (Ptr CommandBuffer_T -> Ptr BeginCustomResolveInfoEXT -> IO ())
-> FunPtr
     (Ptr CommandBuffer_T -> Ptr BeginCustomResolveInfoEXT -> IO ())
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr CommandBuffer_T -> Ptr BeginCustomResolveInfoEXT -> IO ())
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
    IOException -> IO ()
forall e a. (HasCallStack, 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 String
"" String
"The function pointer for vkCmdBeginCustomResolveEXT is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkCmdBeginCustomResolveEXT' :: Ptr CommandBuffer_T -> Ptr BeginCustomResolveInfoEXT -> IO ()
vkCmdBeginCustomResolveEXT' = FunPtr
  (Ptr CommandBuffer_T -> Ptr BeginCustomResolveInfoEXT -> IO ())
-> Ptr CommandBuffer_T -> Ptr BeginCustomResolveInfoEXT -> IO ()
mkVkCmdBeginCustomResolveEXT FunPtr
  (Ptr CommandBuffer_T -> Ptr BeginCustomResolveInfoEXT -> IO ())
vkCmdBeginCustomResolveEXTPtr
  pBeginCustomResolveInfo <- case ("beginCustomResolveInfo" ::: Maybe BeginCustomResolveInfoEXT
beginCustomResolveInfo) of
    "beginCustomResolveInfo" ::: Maybe BeginCustomResolveInfoEXT
Nothing -> Ptr BeginCustomResolveInfoEXT
-> ContT () IO (Ptr BeginCustomResolveInfoEXT)
forall a. a -> ContT () IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Ptr BeginCustomResolveInfoEXT
forall a. Ptr a
nullPtr
    Just BeginCustomResolveInfoEXT
j -> ((Ptr BeginCustomResolveInfoEXT -> IO ()) -> IO ())
-> ContT () IO (Ptr BeginCustomResolveInfoEXT)
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr BeginCustomResolveInfoEXT -> IO ()) -> IO ())
 -> ContT () IO (Ptr BeginCustomResolveInfoEXT))
-> ((Ptr BeginCustomResolveInfoEXT -> IO ()) -> IO ())
-> ContT () IO (Ptr BeginCustomResolveInfoEXT)
forall a b. (a -> b) -> a -> b
$ BeginCustomResolveInfoEXT
-> (Ptr BeginCustomResolveInfoEXT -> IO ()) -> IO ()
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
forall b.
BeginCustomResolveInfoEXT
-> (Ptr BeginCustomResolveInfoEXT -> IO b) -> IO b
withCStruct (BeginCustomResolveInfoEXT
j)
  lift $ traceAroundEvent "vkCmdBeginCustomResolveEXT" (vkCmdBeginCustomResolveEXT'
                                                          (commandBufferHandle (commandBuffer))
                                                          pBeginCustomResolveInfo)
  pure $ ()


-- | VkBeginCustomResolveInfoEXT - Structure specifying shader resolve
-- information
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_custom_resolve VK_EXT_custom_resolve>,
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_dynamic_rendering VK_KHR_dynamic_rendering>,
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_VERSION_1_3 VK_VERSION_1_3>,
-- 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'cmdBeginCustomResolveEXT'
data BeginCustomResolveInfoEXT = BeginCustomResolveInfoEXT
  {}
  deriving (Typeable, BeginCustomResolveInfoEXT -> BeginCustomResolveInfoEXT -> Bool
(BeginCustomResolveInfoEXT -> BeginCustomResolveInfoEXT -> Bool)
-> (BeginCustomResolveInfoEXT -> BeginCustomResolveInfoEXT -> Bool)
-> Eq BeginCustomResolveInfoEXT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BeginCustomResolveInfoEXT -> BeginCustomResolveInfoEXT -> Bool
== :: BeginCustomResolveInfoEXT -> BeginCustomResolveInfoEXT -> Bool
$c/= :: BeginCustomResolveInfoEXT -> BeginCustomResolveInfoEXT -> Bool
/= :: BeginCustomResolveInfoEXT -> BeginCustomResolveInfoEXT -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (BeginCustomResolveInfoEXT)
#endif
deriving instance Show BeginCustomResolveInfoEXT

instance ToCStruct BeginCustomResolveInfoEXT where
  withCStruct :: forall b.
BeginCustomResolveInfoEXT
-> (Ptr BeginCustomResolveInfoEXT -> IO b) -> IO b
withCStruct BeginCustomResolveInfoEXT
x Ptr BeginCustomResolveInfoEXT -> IO b
f = Int -> (Ptr BeginCustomResolveInfoEXT -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
16 ((Ptr BeginCustomResolveInfoEXT -> IO b) -> IO b)
-> (Ptr BeginCustomResolveInfoEXT -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr BeginCustomResolveInfoEXT
p -> Ptr BeginCustomResolveInfoEXT
-> BeginCustomResolveInfoEXT -> IO b -> IO b
forall b.
Ptr BeginCustomResolveInfoEXT
-> BeginCustomResolveInfoEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr BeginCustomResolveInfoEXT
p BeginCustomResolveInfoEXT
x (Ptr BeginCustomResolveInfoEXT -> IO b
f Ptr BeginCustomResolveInfoEXT
p)
  pokeCStruct :: forall b.
Ptr BeginCustomResolveInfoEXT
-> BeginCustomResolveInfoEXT -> IO b -> IO b
pokeCStruct Ptr BeginCustomResolveInfoEXT
p BeginCustomResolveInfoEXT
BeginCustomResolveInfoEXT IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr BeginCustomResolveInfoEXT
p Ptr BeginCustomResolveInfoEXT -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_BEGIN_CUSTOM_RESOLVE_INFO_EXT)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr BeginCustomResolveInfoEXT
p Ptr BeginCustomResolveInfoEXT -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    IO b
f
  cStructSize :: Int
cStructSize = Int
16
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b. Ptr BeginCustomResolveInfoEXT -> IO b -> IO b
pokeZeroCStruct Ptr BeginCustomResolveInfoEXT
p IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr BeginCustomResolveInfoEXT
p Ptr BeginCustomResolveInfoEXT -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_BEGIN_CUSTOM_RESOLVE_INFO_EXT)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr BeginCustomResolveInfoEXT
p Ptr BeginCustomResolveInfoEXT -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    IO b
f

instance FromCStruct BeginCustomResolveInfoEXT where
  peekCStruct :: Ptr BeginCustomResolveInfoEXT -> IO BeginCustomResolveInfoEXT
peekCStruct Ptr BeginCustomResolveInfoEXT
_ = BeginCustomResolveInfoEXT -> IO BeginCustomResolveInfoEXT
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BeginCustomResolveInfoEXT -> IO BeginCustomResolveInfoEXT)
-> BeginCustomResolveInfoEXT -> IO BeginCustomResolveInfoEXT
forall a b. (a -> b) -> a -> b
$ BeginCustomResolveInfoEXT
BeginCustomResolveInfoEXT
                           

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

instance Zero BeginCustomResolveInfoEXT where
  zero :: BeginCustomResolveInfoEXT
zero = BeginCustomResolveInfoEXT
BeginCustomResolveInfoEXT
           


-- | VkPhysicalDeviceCustomResolveFeaturesEXT - Structure indicating support
-- for shader resolves
--
-- = Members
--
-- This structure describes the following feature:
--
-- = Description
--
-- If the 'PhysicalDeviceCustomResolveFeaturesEXT' 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. If the application wishes to use a
-- 'Vulkan.Core10.Handles.Device' with any features described by
-- 'PhysicalDeviceCustomResolveFeaturesEXT', it /must/ add an instance of
-- the structure, with the desired feature members set to
-- 'Vulkan.Core10.FundamentalTypes.TRUE', to the @pNext@ chain of
-- 'Vulkan.Core10.Device.DeviceCreateInfo' when creating the
-- 'Vulkan.Core10.Handles.Device'.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_custom_resolve VK_EXT_custom_resolve>,
-- 'Vulkan.Core10.FundamentalTypes.Bool32',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PhysicalDeviceCustomResolveFeaturesEXT = PhysicalDeviceCustomResolveFeaturesEXT
  { -- | #features-customResolve# @customResolve@ specifies that the
    -- implementation supports render pass resolves using shaders.
    PhysicalDeviceCustomResolveFeaturesEXT -> Bool
customResolve :: Bool }
  deriving (Typeable, PhysicalDeviceCustomResolveFeaturesEXT
-> PhysicalDeviceCustomResolveFeaturesEXT -> Bool
(PhysicalDeviceCustomResolveFeaturesEXT
 -> PhysicalDeviceCustomResolveFeaturesEXT -> Bool)
-> (PhysicalDeviceCustomResolveFeaturesEXT
    -> PhysicalDeviceCustomResolveFeaturesEXT -> Bool)
-> Eq PhysicalDeviceCustomResolveFeaturesEXT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PhysicalDeviceCustomResolveFeaturesEXT
-> PhysicalDeviceCustomResolveFeaturesEXT -> Bool
== :: PhysicalDeviceCustomResolveFeaturesEXT
-> PhysicalDeviceCustomResolveFeaturesEXT -> Bool
$c/= :: PhysicalDeviceCustomResolveFeaturesEXT
-> PhysicalDeviceCustomResolveFeaturesEXT -> Bool
/= :: PhysicalDeviceCustomResolveFeaturesEXT
-> PhysicalDeviceCustomResolveFeaturesEXT -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceCustomResolveFeaturesEXT)
#endif
deriving instance Show PhysicalDeviceCustomResolveFeaturesEXT

instance ToCStruct PhysicalDeviceCustomResolveFeaturesEXT where
  withCStruct :: forall b.
PhysicalDeviceCustomResolveFeaturesEXT
-> (Ptr PhysicalDeviceCustomResolveFeaturesEXT -> IO b) -> IO b
withCStruct PhysicalDeviceCustomResolveFeaturesEXT
x Ptr PhysicalDeviceCustomResolveFeaturesEXT -> IO b
f = Int -> (Ptr PhysicalDeviceCustomResolveFeaturesEXT -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
24 ((Ptr PhysicalDeviceCustomResolveFeaturesEXT -> IO b) -> IO b)
-> (Ptr PhysicalDeviceCustomResolveFeaturesEXT -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr PhysicalDeviceCustomResolveFeaturesEXT
p -> Ptr PhysicalDeviceCustomResolveFeaturesEXT
-> PhysicalDeviceCustomResolveFeaturesEXT -> IO b -> IO b
forall b.
Ptr PhysicalDeviceCustomResolveFeaturesEXT
-> PhysicalDeviceCustomResolveFeaturesEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceCustomResolveFeaturesEXT
p PhysicalDeviceCustomResolveFeaturesEXT
x (Ptr PhysicalDeviceCustomResolveFeaturesEXT -> IO b
f Ptr PhysicalDeviceCustomResolveFeaturesEXT
p)
  pokeCStruct :: forall b.
Ptr PhysicalDeviceCustomResolveFeaturesEXT
-> PhysicalDeviceCustomResolveFeaturesEXT -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceCustomResolveFeaturesEXT
p PhysicalDeviceCustomResolveFeaturesEXT{Bool
customResolve :: PhysicalDeviceCustomResolveFeaturesEXT -> Bool
customResolve :: Bool
..} IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceCustomResolveFeaturesEXT
p Ptr PhysicalDeviceCustomResolveFeaturesEXT
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_RESOLVE_FEATURES_EXT)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceCustomResolveFeaturesEXT
p Ptr PhysicalDeviceCustomResolveFeaturesEXT -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceCustomResolveFeaturesEXT
p Ptr PhysicalDeviceCustomResolveFeaturesEXT -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
customResolve))
    IO b
f
  cStructSize :: Int
cStructSize = Int
24
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b.
Ptr PhysicalDeviceCustomResolveFeaturesEXT -> IO b -> IO b
pokeZeroCStruct Ptr PhysicalDeviceCustomResolveFeaturesEXT
p IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceCustomResolveFeaturesEXT
p Ptr PhysicalDeviceCustomResolveFeaturesEXT
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_RESOLVE_FEATURES_EXT)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceCustomResolveFeaturesEXT
p Ptr PhysicalDeviceCustomResolveFeaturesEXT -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceCustomResolveFeaturesEXT
p Ptr PhysicalDeviceCustomResolveFeaturesEXT -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
forall a. Zero a => a
zero))
    IO b
f

instance FromCStruct PhysicalDeviceCustomResolveFeaturesEXT where
  peekCStruct :: Ptr PhysicalDeviceCustomResolveFeaturesEXT
-> IO PhysicalDeviceCustomResolveFeaturesEXT
peekCStruct Ptr PhysicalDeviceCustomResolveFeaturesEXT
p = do
    customResolve <- forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PhysicalDeviceCustomResolveFeaturesEXT
p Ptr PhysicalDeviceCustomResolveFeaturesEXT -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32))
    pure $ PhysicalDeviceCustomResolveFeaturesEXT
             (bool32ToBool customResolve)

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

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


-- | VkCustomResolveCreateInfoEXT - Structure specifying format info for
-- custom resolves
--
-- = Description
--
-- If the @pNext@ chain includes this structure for one of:
--
-- -   a 'Vulkan.Core10.GraphicsPipeline.GraphicsPipelineCreateInfo' for a
--     pipeline created without a 'Vulkan.Core10.Handles.RenderPass'
--
-- -   a 'Vulkan.Core10.CommandBuffer.CommandBufferInheritanceInfo' for a
--     secondary command buffer within a render pass instance begun with
--     'Vulkan.Core13.Promoted_From_VK_KHR_dynamic_rendering.cmdBeginRendering'.
--
-- it specifies the formats used in custom resolves within the same render
-- pass. It also specifies that the corresponding object will be used in a
-- render pass which contains a custom resolve operation.
--
-- If the @pNext@ chain includes this structure for a
-- 'Vulkan.Extensions.VK_EXT_shader_object.ShaderCreateInfoEXT' for a
-- fragment shader object, it only specifies that the fragment shader will
-- be used in a custom resolve operation.
--
-- If a graphics pipeline is created with a valid
-- 'Vulkan.Core10.Handles.RenderPass', parameters of this structure are
-- ignored.
--
-- If @customResolve@ is 'Vulkan.Core10.FundamentalTypes.FALSE', the
-- pipeline /can/ only be used outside the custom resolve section. If
-- @customResolve@ is 'Vulkan.Core10.FundamentalTypes.TRUE', the pipeline
-- /can/ only be used inside the custom resolve section.
--
-- When a dynamic render pass instance contains a custom resolve operation
-- and the
-- <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#features-dynamicRenderingUnusedAttachments dynamicRenderingUnusedAttachments>
-- feature is not enabled , all pipelines used to draw in such render pass
-- /must/ include this structure and have identical format information in
-- it. When a dynamic render pass does not contain a custom resolve
-- operation and the
-- <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#features-dynamicRenderingUnusedAttachments dynamicRenderingUnusedAttachments>
-- feature is not enabled , all pipelines used to draw in such render pass
-- /must/ not include this structure.
--
-- If the
-- <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#features-dynamicRenderingUnusedAttachments dynamicRenderingUnusedAttachments>
-- feature is enabled, then when this structure is not included in the
-- @pNext@ chain for
-- 'Vulkan.Core10.GraphicsPipeline.GraphicsPipelineCreateInfo',
-- @customResolve@ is 'Vulkan.Core10.FundamentalTypes.FALSE',
-- @colorAttachmentCount@ is @0@, and @depthAttachmentFormat@ and
-- @stencilAttachmentFormat@ are
-- 'Vulkan.Core10.Enums.Format.FORMAT_UNDEFINED'.
--
-- If @depthAttachmentFormat@, @stencilAttachmentFormat@, or any element of
-- @pColorAttachmentFormats@ is
-- 'Vulkan.Core10.Enums.Format.FORMAT_UNDEFINED', it indicates that the
-- corresponding attachment is unused within the resolve portion of the
-- render pass. Valid formats indicate that an attachment /can/ be used -
-- but it is still valid to set the attachment to @NULL@ when beginning
-- rendering.
--
-- When passed as a @pNext@ member to a
-- 'Vulkan.Extensions.VK_EXT_shader_object.ShaderCreateInfoEXT' struct for
-- use with fragment density maps, the @colorAttachmentCount@,
-- @pColorAttachmentFormats@, @depthAttachmentFormat@, and
-- @stencilAttachmentFormat@ members of this struct are ignored. When not
-- passed as a @pNext@ member, @customResolve@ is
-- 'Vulkan.Core10.FundamentalTypes.FALSE'.
--
-- == Valid Usage
--
-- -   #VUID-VkCustomResolveCreateInfoEXT-colorAttachmentCount-11507#
--     @colorAttachmentCount@ /must/ be less than or equal to
--     <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#limits-maxColorAttachments maxColorAttachments>
--
-- -   #VUID-VkCustomResolveCreateInfoEXT-depthAttachmentFormat-11508# If
--     @depthAttachmentFormat@ is not
--     'Vulkan.Core10.Enums.Format.FORMAT_UNDEFINED', it /must/ be a format
--     that includes a depth component
--
-- -   #VUID-VkCustomResolveCreateInfoEXT-depthAttachmentFormat-11509# If
--     @depthAttachmentFormat@ is not
--     'Vulkan.Core10.Enums.Format.FORMAT_UNDEFINED', it /must/ be a format
--     with
--     <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#potential-format-features potential format features>
--     that include
--     'Vulkan.Core10.Enums.FormatFeatureFlagBits.FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT'
--
-- -   #VUID-VkCustomResolveCreateInfoEXT-pColorAttachmentFormats-11510# If
--     any element of @pColorAttachmentFormats@ is not
--     'Vulkan.Core10.Enums.Format.FORMAT_UNDEFINED', it /must/ be a format
--     with
--     <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#potential-format-features potential format features>
--     that include
--     'Vulkan.Core10.Enums.FormatFeatureFlagBits.FORMAT_FEATURE_COLOR_ATTACHMENT_BIT'
--     , or
--     'Vulkan.Core13.Enums.FormatFeatureFlags2.FORMAT_FEATURE_2_LINEAR_COLOR_ATTACHMENT_BIT_NV'
--     if the
--     <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#features-linearColorAttachment linearColorAttachment>
--     feature is enabled
--
-- -   #VUID-VkCustomResolveCreateInfoEXT-stencilAttachmentFormat-11511# If
--     @stencilAttachmentFormat@ is not
--     'Vulkan.Core10.Enums.Format.FORMAT_UNDEFINED', it /must/ be a format
--     that includes a stencil aspect
--
-- -   #VUID-VkCustomResolveCreateInfoEXT-stencilAttachmentFormat-11512# If
--     @stencilAttachmentFormat@ is not
--     'Vulkan.Core10.Enums.Format.FORMAT_UNDEFINED', it /must/ be a format
--     with
--     <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#potential-format-features potential format features>
--     that include
--     'Vulkan.Core10.Enums.FormatFeatureFlagBits.FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT'
--
-- -   #VUID-VkCustomResolveCreateInfoEXT-depthAttachmentFormat-11513# If
--     @depthAttachmentFormat@ is not
--     'Vulkan.Core10.Enums.Format.FORMAT_UNDEFINED' and
--     @stencilAttachmentFormat@ is not
--     'Vulkan.Core10.Enums.Format.FORMAT_UNDEFINED',
--     @depthAttachmentFormat@ /must/ equal @stencilAttachmentFormat@
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkCustomResolveCreateInfoEXT-sType-sType# @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_CUSTOM_RESOLVE_CREATE_INFO_EXT'
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_custom_resolve VK_EXT_custom_resolve>,
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_dynamic_rendering VK_KHR_dynamic_rendering>,
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_VERSION_1_3 VK_VERSION_1_3>,
-- 'Vulkan.Core10.FundamentalTypes.Bool32',
-- 'Vulkan.Core10.Enums.Format.Format',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data CustomResolveCreateInfoEXT = CustomResolveCreateInfoEXT
  { -- | @customResolve@ indicates whether this pipeline will be used for a
    -- resolve operation.
    CustomResolveCreateInfoEXT -> Bool
customResolve :: Bool
  , -- | @pColorAttachmentFormats@ is a pointer to an array of
    -- 'Vulkan.Core10.Enums.Format.Format' values defining the format of color
    -- resolve attachments used in custom resolves in the same render pass.
    CustomResolveCreateInfoEXT -> Vector Format
colorAttachmentFormats :: Vector Format
  , -- | @depthAttachmentFormat@ is a 'Vulkan.Core10.Enums.Format.Format' value
    -- defining the format of the depth resolve attachment used in custom
    -- resolves in the same render pass.
    CustomResolveCreateInfoEXT -> Format
depthAttachmentFormat :: Format
  , -- | @stencilAttachmentFormat@ is a 'Vulkan.Core10.Enums.Format.Format' value
    -- defining the format of the stencil resolve attachment used in custom
    -- resolves in the same render pass.
    CustomResolveCreateInfoEXT -> Format
stencilAttachmentFormat :: Format
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (CustomResolveCreateInfoEXT)
#endif
deriving instance Show CustomResolveCreateInfoEXT

instance ToCStruct CustomResolveCreateInfoEXT where
  withCStruct :: forall b.
CustomResolveCreateInfoEXT
-> (Ptr CustomResolveCreateInfoEXT -> IO b) -> IO b
withCStruct CustomResolveCreateInfoEXT
x Ptr CustomResolveCreateInfoEXT -> IO b
f = Int -> (Ptr CustomResolveCreateInfoEXT -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
40 ((Ptr CustomResolveCreateInfoEXT -> IO b) -> IO b)
-> (Ptr CustomResolveCreateInfoEXT -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr CustomResolveCreateInfoEXT
p -> Ptr CustomResolveCreateInfoEXT
-> CustomResolveCreateInfoEXT -> IO b -> IO b
forall b.
Ptr CustomResolveCreateInfoEXT
-> CustomResolveCreateInfoEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr CustomResolveCreateInfoEXT
p CustomResolveCreateInfoEXT
x (Ptr CustomResolveCreateInfoEXT -> IO b
f Ptr CustomResolveCreateInfoEXT
p)
  pokeCStruct :: forall b.
Ptr CustomResolveCreateInfoEXT
-> CustomResolveCreateInfoEXT -> IO b -> IO b
pokeCStruct Ptr CustomResolveCreateInfoEXT
p CustomResolveCreateInfoEXT{Bool
Vector Format
Format
customResolve :: CustomResolveCreateInfoEXT -> Bool
colorAttachmentFormats :: CustomResolveCreateInfoEXT -> Vector Format
depthAttachmentFormat :: CustomResolveCreateInfoEXT -> Format
stencilAttachmentFormat :: CustomResolveCreateInfoEXT -> Format
customResolve :: Bool
colorAttachmentFormats :: Vector Format
depthAttachmentFormat :: Format
stencilAttachmentFormat :: Format
..} 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 (m :: * -> *) a. Monad m => m a -> ContT b m a
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 CustomResolveCreateInfoEXT
p Ptr CustomResolveCreateInfoEXT -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_CUSTOM_RESOLVE_CREATE_INFO_EXT)
    IO () -> ContT b IO ()
forall (m :: * -> *) a. Monad m => m a -> ContT b m a
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 CustomResolveCreateInfoEXT
p Ptr CustomResolveCreateInfoEXT -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    IO () -> ContT b IO ()
forall (m :: * -> *) a. Monad m => m a -> ContT b m a
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 Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CustomResolveCreateInfoEXT
p Ptr CustomResolveCreateInfoEXT -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
customResolve))
    IO () -> ContT b IO ()
forall (m :: * -> *) a. Monad m => m a -> ContT b m a
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 CustomResolveCreateInfoEXT
p Ptr CustomResolveCreateInfoEXT -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Word32)) ((Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Vector Format -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector Format -> Int) -> Vector Format -> Int
forall a b. (a -> b) -> a -> b
$ (Vector Format
colorAttachmentFormats)) :: Word32))
    pPColorAttachmentFormats' <- ((Ptr Format -> IO b) -> IO b) -> ContT b IO (Ptr Format)
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr Format -> IO b) -> IO b) -> ContT b IO (Ptr Format))
-> ((Ptr Format -> IO b) -> IO b) -> ContT b IO (Ptr Format)
forall a b. (a -> b) -> a -> b
$ forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes @Format ((Vector Format -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector Format
colorAttachmentFormats)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
4)
    lift $ Data.Vector.imapM_ (\Int
i Format
e -> Ptr Format -> Format -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Format
pPColorAttachmentFormats' Ptr Format -> Int -> Ptr Format
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
4 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Format) (Format
e)) (colorAttachmentFormats)
    lift $ poke ((p `plusPtr` 24 :: Ptr (Ptr Format))) (pPColorAttachmentFormats')
    lift $ poke ((p `plusPtr` 32 :: Ptr Format)) (depthAttachmentFormat)
    lift $ poke ((p `plusPtr` 36 :: Ptr Format)) (stencilAttachmentFormat)
    lift $ f
  cStructSize :: Int
cStructSize = Int
40
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b. Ptr CustomResolveCreateInfoEXT -> IO b -> IO b
pokeZeroCStruct Ptr CustomResolveCreateInfoEXT
p IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CustomResolveCreateInfoEXT
p Ptr CustomResolveCreateInfoEXT -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_CUSTOM_RESOLVE_CREATE_INFO_EXT)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CustomResolveCreateInfoEXT
p Ptr CustomResolveCreateInfoEXT -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CustomResolveCreateInfoEXT
p Ptr CustomResolveCreateInfoEXT -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
forall a. Zero a => a
zero))
    Ptr Format -> Format -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CustomResolveCreateInfoEXT
p Ptr CustomResolveCreateInfoEXT -> Int -> Ptr Format
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr Format)) (Format
forall a. Zero a => a
zero)
    Ptr Format -> Format -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CustomResolveCreateInfoEXT
p Ptr CustomResolveCreateInfoEXT -> Int -> Ptr Format
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
36 :: Ptr Format)) (Format
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct CustomResolveCreateInfoEXT where
  peekCStruct :: Ptr CustomResolveCreateInfoEXT -> IO CustomResolveCreateInfoEXT
peekCStruct Ptr CustomResolveCreateInfoEXT
p = do
    customResolve <- forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr CustomResolveCreateInfoEXT
p Ptr CustomResolveCreateInfoEXT -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32))
    colorAttachmentCount <- peek @Word32 ((p `plusPtr` 20 :: Ptr Word32))
    pColorAttachmentFormats <- peek @(Ptr Format) ((p `plusPtr` 24 :: Ptr (Ptr Format)))
    pColorAttachmentFormats' <- generateM (fromIntegral colorAttachmentCount) (\Int
i -> forall a. Storable a => Ptr a -> IO a
peek @Format ((Ptr Format
pColorAttachmentFormats Ptr Format -> Int -> Ptr Format
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
4 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Format)))
    depthAttachmentFormat <- peek @Format ((p `plusPtr` 32 :: Ptr Format))
    stencilAttachmentFormat <- peek @Format ((p `plusPtr` 36 :: Ptr Format))
    pure $ CustomResolveCreateInfoEXT
             (bool32ToBool customResolve)
             pColorAttachmentFormats'
             depthAttachmentFormat
             stencilAttachmentFormat

instance Zero CustomResolveCreateInfoEXT where
  zero :: CustomResolveCreateInfoEXT
zero = Bool
-> Vector Format -> Format -> Format -> CustomResolveCreateInfoEXT
CustomResolveCreateInfoEXT
           Bool
forall a. Zero a => a
zero
           Vector Format
forall a. Monoid a => a
mempty
           Format
forall a. Zero a => a
zero
           Format
forall a. Zero a => a
zero


type EXT_CUSTOM_RESOLVE_SPEC_VERSION = 1

-- No documentation found for TopLevel "VK_EXT_CUSTOM_RESOLVE_SPEC_VERSION"
pattern EXT_CUSTOM_RESOLVE_SPEC_VERSION :: forall a . Integral a => a
pattern $mEXT_CUSTOM_RESOLVE_SPEC_VERSION :: forall {r} {a}.
Integral a =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
$bEXT_CUSTOM_RESOLVE_SPEC_VERSION :: forall a. Integral a => a
EXT_CUSTOM_RESOLVE_SPEC_VERSION = 1


type EXT_CUSTOM_RESOLVE_EXTENSION_NAME = "VK_EXT_custom_resolve"

-- No documentation found for TopLevel "VK_EXT_CUSTOM_RESOLVE_EXTENSION_NAME"
pattern EXT_CUSTOM_RESOLVE_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $mEXT_CUSTOM_RESOLVE_EXTENSION_NAME :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
$bEXT_CUSTOM_RESOLVE_EXTENSION_NAME :: forall a. (Eq a, IsString a) => a
EXT_CUSTOM_RESOLVE_EXTENSION_NAME = "VK_EXT_custom_resolve"