{-# language CPP #-}
-- No documentation found for Chapter "PromotedStreamingTransfers'"
module Vulkan.Core14.PromotedStreamingTransfers'  ( copyMemoryToImage
                                                  , copyImageToMemory
                                                  , copyImageToImage
                                                  , transitionImageLayout
                                                  , PhysicalDeviceHostImageCopyFeatures(..)
                                                  , PhysicalDeviceHostImageCopyProperties(..)
                                                  , MemoryToImageCopy(..)
                                                  , ImageToMemoryCopy(..)
                                                  , CopyMemoryToImageInfo(..)
                                                  , CopyImageToMemoryInfo(..)
                                                  , CopyImageToImageInfo(..)
                                                  , HostImageLayoutTransitionInfo(..)
                                                  , SubresourceHostMemcpySize(..)
                                                  , HostImageCopyDevicePerformanceQuery(..)
                                                  , StructureType(..)
                                                  , ImageUsageFlagBits(..)
                                                  , ImageUsageFlags
                                                  , HostImageCopyFlagBits(..)
                                                  , HostImageCopyFlags
                                                  , FormatFeatureFlagBits2(..)
                                                  , FormatFeatureFlags2
                                                  ) where

import Vulkan.CStruct.Utils (FixedArray)
import Vulkan.Internal.Utils (traceAroundEvent)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Foreign.Marshal.Alloc (allocaBytes)
import GHC.Base (when)
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.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.Word (Word8)
import Data.ByteString (ByteString)
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.CStruct.Utils (peekByteStringFromSizedVectorPtr)
import Vulkan.CStruct.Utils (pokeFixedLengthByteString)
import Vulkan.NamedType ((:::))
import Vulkan.Core10.FundamentalTypes (Bool32)
import Vulkan.Core10.Handles (Device)
import Vulkan.Core10.Handles (Device(..))
import Vulkan.Core10.Handles (Device(Device))
import Vulkan.Dynamic (DeviceCmds(pVkCopyImageToImage))
import Vulkan.Dynamic (DeviceCmds(pVkCopyImageToMemory))
import Vulkan.Dynamic (DeviceCmds(pVkCopyMemoryToImage))
import Vulkan.Dynamic (DeviceCmds(pVkTransitionImageLayout))
import Vulkan.Core10.FundamentalTypes (DeviceSize)
import Vulkan.Core10.Handles (Device_T)
import Vulkan.Core10.FundamentalTypes (Extent3D)
import Vulkan.Core14.Enums.HostImageCopyFlagBits (HostImageCopyFlags)
import Vulkan.Core10.Handles (Image)
import Vulkan.Core13.Promoted_From_VK_KHR_copy_commands2 (ImageCopy2)
import Vulkan.Core10.Enums.ImageLayout (ImageLayout)
import Vulkan.Core10.CommandBufferBuilding (ImageSubresourceLayers)
import Vulkan.Core10.ImageView (ImageSubresourceRange)
import Vulkan.Core10.FundamentalTypes (Offset3D)
import Vulkan.Core10.Enums.Result (Result)
import Vulkan.Core10.Enums.Result (Result(..))
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Core10.APIConstants (UUID_SIZE)
import Vulkan.Exception (VulkanException(..))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_COPY_IMAGE_TO_IMAGE_INFO))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_COPY_IMAGE_TO_MEMORY_INFO))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_COPY_MEMORY_TO_IMAGE_INFO))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_HOST_IMAGE_COPY_DEVICE_PERFORMANCE_QUERY))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_HOST_IMAGE_LAYOUT_TRANSITION_INFO))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_IMAGE_TO_MEMORY_COPY))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_MEMORY_TO_IMAGE_COPY))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_FEATURES))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_PROPERTIES))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_SUBRESOURCE_HOST_MEMCPY_SIZE))
import Vulkan.Core10.Enums.Result (Result(SUCCESS))
import Vulkan.Core13.Enums.FormatFeatureFlags2 (FormatFeatureFlagBits2(..))
import Vulkan.Core13.Enums.FormatFeatureFlags2 (FormatFeatureFlags2)
import Vulkan.Core14.Enums.HostImageCopyFlagBits (HostImageCopyFlagBits(..))
import Vulkan.Core14.Enums.HostImageCopyFlagBits (HostImageCopyFlags)
import Vulkan.Core10.Enums.ImageUsageFlagBits (ImageUsageFlagBits(..))
import Vulkan.Core10.Enums.ImageUsageFlagBits (ImageUsageFlags)
import Vulkan.Core10.Enums.StructureType (StructureType(..))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkCopyMemoryToImage
  :: FunPtr (Ptr Device_T -> Ptr CopyMemoryToImageInfo -> IO Result) -> Ptr Device_T -> Ptr CopyMemoryToImageInfo -> IO Result

-- | vkCopyMemoryToImage - Copy data from host memory into an image
--
-- = Description
--
-- This command is functionally similar to
-- 'Vulkan.Core13.Promoted_From_VK_KHR_copy_commands2.cmdCopyBufferToImage2',
-- except it is executed on the host and reads from host memory instead of
-- a buffer. The memory of @pCopyMemoryToImageInfo->dstImage@ is accessed
-- by the host as if
-- <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#memory-coherent coherent>.
--
-- Because queue submissions
-- <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#synchronization-submission-host-writes automatically make host memory visible to the device>,
-- there would not be a need for a memory barrier before using the results
-- of this copy operation on the device.
--
-- == Return Codes
--
-- [<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#fundamentals-successcodes Success>]
--
--     -   'Vulkan.Core10.Enums.Result.SUCCESS'
--
-- [<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#fundamentals-errorcodes Failure>]
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_INITIALIZATION_FAILED'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_MEMORY_MAP_FAILED'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_OUT_OF_DEVICE_MEMORY'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_OUT_OF_HOST_MEMORY'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_UNKNOWN'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_VALIDATION_FAILED'
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_host_image_copy VK_EXT_host_image_copy>,
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_VERSION_1_4 VK_VERSION_1_4>,
-- 'CopyMemoryToImageInfo', 'Vulkan.Core10.Handles.Device'
copyMemoryToImage :: forall io
                   . (MonadIO io)
                  => -- | @device@ is the device which owns @pCopyMemoryToImageInfo->dstImage@.
                     --
                     -- #VUID-vkCopyMemoryToImage-device-parameter# @device@ /must/ be a valid
                     -- 'Vulkan.Core10.Handles.Device' handle
                     Device
                  -> -- | @pCopyMemoryToImageInfo@ is a pointer to a 'CopyMemoryToImageInfo'
                     -- structure describing the copy parameters.
                     --
                     -- #VUID-vkCopyMemoryToImage-pCopyMemoryToImageInfo-parameter#
                     -- @pCopyMemoryToImageInfo@ /must/ be a valid pointer to a valid
                     -- 'CopyMemoryToImageInfo' structure
                     CopyMemoryToImageInfo
                  -> io ()
copyMemoryToImage :: forall (io :: * -> *).
MonadIO io =>
Device -> CopyMemoryToImageInfo -> io ()
copyMemoryToImage Device
device CopyMemoryToImageInfo
copyMemoryToImageInfo = 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 vkCopyMemoryToImagePtr :: FunPtr (Ptr Device_T -> Ptr CopyMemoryToImageInfo -> IO Result)
vkCopyMemoryToImagePtr = DeviceCmds
-> FunPtr (Ptr Device_T -> Ptr CopyMemoryToImageInfo -> IO Result)
pVkCopyMemoryToImage (case Device
device of Device{DeviceCmds
deviceCmds :: DeviceCmds
deviceCmds :: Device -> 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 Device_T -> Ptr CopyMemoryToImageInfo -> IO Result)
vkCopyMemoryToImagePtr FunPtr (Ptr Device_T -> Ptr CopyMemoryToImageInfo -> IO Result)
-> FunPtr (Ptr Device_T -> Ptr CopyMemoryToImageInfo -> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr (Ptr Device_T -> Ptr CopyMemoryToImageInfo -> IO Result)
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 vkCopyMemoryToImage is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkCopyMemoryToImage' :: Ptr Device_T -> Ptr CopyMemoryToImageInfo -> IO Result
vkCopyMemoryToImage' = FunPtr (Ptr Device_T -> Ptr CopyMemoryToImageInfo -> IO Result)
-> Ptr Device_T -> Ptr CopyMemoryToImageInfo -> IO Result
mkVkCopyMemoryToImage FunPtr (Ptr Device_T -> Ptr CopyMemoryToImageInfo -> IO Result)
vkCopyMemoryToImagePtr
  pCopyMemoryToImageInfo <- ((Ptr CopyMemoryToImageInfo -> IO ()) -> IO ())
-> ContT () IO (Ptr CopyMemoryToImageInfo)
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr CopyMemoryToImageInfo -> IO ()) -> IO ())
 -> ContT () IO (Ptr CopyMemoryToImageInfo))
-> ((Ptr CopyMemoryToImageInfo -> IO ()) -> IO ())
-> ContT () IO (Ptr CopyMemoryToImageInfo)
forall a b. (a -> b) -> a -> b
$ CopyMemoryToImageInfo
-> (Ptr CopyMemoryToImageInfo -> IO ()) -> IO ()
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
forall b.
CopyMemoryToImageInfo
-> (Ptr CopyMemoryToImageInfo -> IO b) -> IO b
withCStruct (CopyMemoryToImageInfo
copyMemoryToImageInfo)
  r <- lift $ traceAroundEvent "vkCopyMemoryToImage" (vkCopyMemoryToImage'
                                                        (deviceHandle (device))
                                                        pCopyMemoryToImageInfo)
  lift $ when (r < SUCCESS) (throwIO (VulkanException r))


foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkCopyImageToMemory
  :: FunPtr (Ptr Device_T -> Ptr CopyImageToMemoryInfo -> IO Result) -> Ptr Device_T -> Ptr CopyImageToMemoryInfo -> IO Result

-- | vkCopyImageToMemory - Copy image data into host memory
--
-- = Description
--
-- This command is functionally similar to
-- 'Vulkan.Core13.Promoted_From_VK_KHR_copy_commands2.cmdCopyImageToBuffer2',
-- except it is executed on the host and writes to host memory instead of a
-- buffer. The memory of @pCopyImageToMemoryInfo->srcImage@ is accessed by
-- the host as if
-- <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#memory-coherent coherent>.
--
-- If the device has written to the image memory, it is not automatically
-- made available to the host. Before this copy command can be called, a
-- memory barrier for this image /must/ have been issued on the device with
-- the second
-- <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#synchronization-dependencies-scopes synchronization scope>
-- including
-- 'Vulkan.Core10.Enums.PipelineStageFlagBits.PIPELINE_STAGE_HOST_BIT' and
-- 'Vulkan.Core10.Enums.AccessFlagBits.ACCESS_HOST_READ_BIT'.
--
-- == Return Codes
--
-- [<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#fundamentals-successcodes Success>]
--
--     -   'Vulkan.Core10.Enums.Result.SUCCESS'
--
-- [<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#fundamentals-errorcodes Failure>]
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_INITIALIZATION_FAILED'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_MEMORY_MAP_FAILED'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_OUT_OF_DEVICE_MEMORY'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_OUT_OF_HOST_MEMORY'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_UNKNOWN'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_VALIDATION_FAILED'
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_host_image_copy VK_EXT_host_image_copy>,
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_VERSION_1_4 VK_VERSION_1_4>,
-- 'CopyImageToMemoryInfo', 'Vulkan.Core10.Handles.Device'
copyImageToMemory :: forall io
                   . (MonadIO io)
                  => -- | @device@ is the device which owns @pCopyImageToMemoryInfo->srcImage@.
                     --
                     -- #VUID-vkCopyImageToMemory-device-parameter# @device@ /must/ be a valid
                     -- 'Vulkan.Core10.Handles.Device' handle
                     Device
                  -> -- | @pCopyImageToMemoryInfo@ is a pointer to a 'CopyImageToMemoryInfo'
                     -- structure describing the copy parameters.
                     --
                     -- #VUID-vkCopyImageToMemory-pCopyImageToMemoryInfo-parameter#
                     -- @pCopyImageToMemoryInfo@ /must/ be a valid pointer to a valid
                     -- 'CopyImageToMemoryInfo' structure
                     CopyImageToMemoryInfo
                  -> io ()
copyImageToMemory :: forall (io :: * -> *).
MonadIO io =>
Device -> CopyImageToMemoryInfo -> io ()
copyImageToMemory Device
device CopyImageToMemoryInfo
copyImageToMemoryInfo = 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 vkCopyImageToMemoryPtr :: FunPtr (Ptr Device_T -> Ptr CopyImageToMemoryInfo -> IO Result)
vkCopyImageToMemoryPtr = DeviceCmds
-> FunPtr (Ptr Device_T -> Ptr CopyImageToMemoryInfo -> IO Result)
pVkCopyImageToMemory (case Device
device of Device{DeviceCmds
deviceCmds :: Device -> DeviceCmds
deviceCmds :: 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 Device_T -> Ptr CopyImageToMemoryInfo -> IO Result)
vkCopyImageToMemoryPtr FunPtr (Ptr Device_T -> Ptr CopyImageToMemoryInfo -> IO Result)
-> FunPtr (Ptr Device_T -> Ptr CopyImageToMemoryInfo -> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr (Ptr Device_T -> Ptr CopyImageToMemoryInfo -> IO Result)
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 vkCopyImageToMemory is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkCopyImageToMemory' :: Ptr Device_T -> Ptr CopyImageToMemoryInfo -> IO Result
vkCopyImageToMemory' = FunPtr (Ptr Device_T -> Ptr CopyImageToMemoryInfo -> IO Result)
-> Ptr Device_T -> Ptr CopyImageToMemoryInfo -> IO Result
mkVkCopyImageToMemory FunPtr (Ptr Device_T -> Ptr CopyImageToMemoryInfo -> IO Result)
vkCopyImageToMemoryPtr
  pCopyImageToMemoryInfo <- ((Ptr CopyImageToMemoryInfo -> IO ()) -> IO ())
-> ContT () IO (Ptr CopyImageToMemoryInfo)
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr CopyImageToMemoryInfo -> IO ()) -> IO ())
 -> ContT () IO (Ptr CopyImageToMemoryInfo))
-> ((Ptr CopyImageToMemoryInfo -> IO ()) -> IO ())
-> ContT () IO (Ptr CopyImageToMemoryInfo)
forall a b. (a -> b) -> a -> b
$ CopyImageToMemoryInfo
-> (Ptr CopyImageToMemoryInfo -> IO ()) -> IO ()
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
forall b.
CopyImageToMemoryInfo
-> (Ptr CopyImageToMemoryInfo -> IO b) -> IO b
withCStruct (CopyImageToMemoryInfo
copyImageToMemoryInfo)
  r <- lift $ traceAroundEvent "vkCopyImageToMemory" (vkCopyImageToMemory'
                                                        (deviceHandle (device))
                                                        pCopyImageToMemoryInfo)
  lift $ when (r < SUCCESS) (throwIO (VulkanException r))


foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkCopyImageToImage
  :: FunPtr (Ptr Device_T -> Ptr CopyImageToImageInfo -> IO Result) -> Ptr Device_T -> Ptr CopyImageToImageInfo -> IO Result

-- | vkCopyImageToImage - Copy image data using the host
--
-- = Description
--
-- This command is functionally similar to
-- 'Vulkan.Core13.Promoted_From_VK_KHR_copy_commands2.cmdCopyImage2',
-- except it is executed on the host. The memory of
-- @pCopyImageToImageInfo->srcImage@ and @pCopyImageToImageInfo->dstImage@
-- is accessed by the host as if
-- <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#memory-coherent coherent>.
--
-- If the device has written to the memory of
-- @pCopyImageToImageInfo->srcImage@, it is not automatically made
-- available to the host. Before this copy command can be called, a memory
-- barrier for this image /must/ have been issued on the device with the
-- second
-- <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#synchronization-dependencies-scopes synchronization scope>
-- including
-- 'Vulkan.Core10.Enums.PipelineStageFlagBits.PIPELINE_STAGE_HOST_BIT' and
-- 'Vulkan.Core10.Enums.AccessFlagBits.ACCESS_HOST_READ_BIT'.
--
-- Because queue submissions
-- <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#synchronization-submission-host-writes automatically make host memory visible to the device>,
-- there would not be a need for a memory barrier before using the results
-- of this copy operation in @pCopyMemoryToImageInfo->dstImage@ on the
-- device.
--
-- == Return Codes
--
-- [<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#fundamentals-successcodes Success>]
--
--     -   'Vulkan.Core10.Enums.Result.SUCCESS'
--
-- [<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#fundamentals-errorcodes Failure>]
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_INITIALIZATION_FAILED'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_MEMORY_MAP_FAILED'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_OUT_OF_DEVICE_MEMORY'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_OUT_OF_HOST_MEMORY'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_UNKNOWN'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_VALIDATION_FAILED'
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_host_image_copy VK_EXT_host_image_copy>,
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_VERSION_1_4 VK_VERSION_1_4>,
-- 'CopyImageToImageInfo', 'Vulkan.Core10.Handles.Device'
copyImageToImage :: forall io
                  . (MonadIO io)
                 => -- | @device@ is the device which owns @pCopyImageToImageInfo->srcImage@ and
                    -- @pCopyImageToImageInfo->dstImage@.
                    --
                    -- #VUID-vkCopyImageToImage-device-parameter# @device@ /must/ be a valid
                    -- 'Vulkan.Core10.Handles.Device' handle
                    Device
                 -> -- | @pCopyImageToImageInfo@ is a pointer to a 'CopyImageToImageInfo'
                    -- structure describing the copy parameters.
                    --
                    -- #VUID-vkCopyImageToImage-pCopyImageToImageInfo-parameter#
                    -- @pCopyImageToImageInfo@ /must/ be a valid pointer to a valid
                    -- 'CopyImageToImageInfo' structure
                    CopyImageToImageInfo
                 -> io ()
copyImageToImage :: forall (io :: * -> *).
MonadIO io =>
Device -> CopyImageToImageInfo -> io ()
copyImageToImage Device
device CopyImageToImageInfo
copyImageToImageInfo = 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 vkCopyImageToImagePtr :: FunPtr (Ptr Device_T -> Ptr CopyImageToImageInfo -> IO Result)
vkCopyImageToImagePtr = DeviceCmds
-> FunPtr (Ptr Device_T -> Ptr CopyImageToImageInfo -> IO Result)
pVkCopyImageToImage (case Device
device of Device{DeviceCmds
deviceCmds :: Device -> DeviceCmds
deviceCmds :: 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 Device_T -> Ptr CopyImageToImageInfo -> IO Result)
vkCopyImageToImagePtr FunPtr (Ptr Device_T -> Ptr CopyImageToImageInfo -> IO Result)
-> FunPtr (Ptr Device_T -> Ptr CopyImageToImageInfo -> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr (Ptr Device_T -> Ptr CopyImageToImageInfo -> IO Result)
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 vkCopyImageToImage is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkCopyImageToImage' :: Ptr Device_T -> Ptr CopyImageToImageInfo -> IO Result
vkCopyImageToImage' = FunPtr (Ptr Device_T -> Ptr CopyImageToImageInfo -> IO Result)
-> Ptr Device_T -> Ptr CopyImageToImageInfo -> IO Result
mkVkCopyImageToImage FunPtr (Ptr Device_T -> Ptr CopyImageToImageInfo -> IO Result)
vkCopyImageToImagePtr
  pCopyImageToImageInfo <- ((Ptr CopyImageToImageInfo -> IO ()) -> IO ())
-> ContT () IO (Ptr CopyImageToImageInfo)
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr CopyImageToImageInfo -> IO ()) -> IO ())
 -> ContT () IO (Ptr CopyImageToImageInfo))
-> ((Ptr CopyImageToImageInfo -> IO ()) -> IO ())
-> ContT () IO (Ptr CopyImageToImageInfo)
forall a b. (a -> b) -> a -> b
$ CopyImageToImageInfo
-> (Ptr CopyImageToImageInfo -> IO ()) -> IO ()
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
forall b.
CopyImageToImageInfo -> (Ptr CopyImageToImageInfo -> IO b) -> IO b
withCStruct (CopyImageToImageInfo
copyImageToImageInfo)
  r <- lift $ traceAroundEvent "vkCopyImageToImage" (vkCopyImageToImage'
                                                       (deviceHandle (device))
                                                       pCopyImageToImageInfo)
  lift $ when (r < SUCCESS) (throwIO (VulkanException r))


foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkTransitionImageLayout
  :: FunPtr (Ptr Device_T -> Word32 -> Ptr HostImageLayoutTransitionInfo -> IO Result) -> Ptr Device_T -> Word32 -> Ptr HostImageLayoutTransitionInfo -> IO Result

-- | vkTransitionImageLayout - Perform an image layout transition on the host
--
-- == Return Codes
--
-- [<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#fundamentals-successcodes Success>]
--
--     -   'Vulkan.Core10.Enums.Result.SUCCESS'
--
-- [<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#fundamentals-errorcodes Failure>]
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_INITIALIZATION_FAILED'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_MEMORY_MAP_FAILED'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_OUT_OF_DEVICE_MEMORY'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_OUT_OF_HOST_MEMORY'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_UNKNOWN'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_VALIDATION_FAILED'
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_host_image_copy VK_EXT_host_image_copy>,
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_VERSION_1_4 VK_VERSION_1_4>,
-- 'Vulkan.Core10.Handles.Device', 'HostImageLayoutTransitionInfo'
transitionImageLayout :: forall io
                       . (MonadIO io)
                      => -- | @device@ is the device which owns @pTransitions@[i].@image@.
                         --
                         -- #VUID-vkTransitionImageLayout-device-parameter# @device@ /must/ be a
                         -- valid 'Vulkan.Core10.Handles.Device' handle
                         Device
                      -> -- | @pTransitions@ is a pointer to an array of
                         -- 'HostImageLayoutTransitionInfo' structures specifying the image and
                         -- <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#resources-image-views subresource ranges>
                         -- within them to transition.
                         --
                         -- #VUID-vkTransitionImageLayout-pTransitions-parameter# @pTransitions@
                         -- /must/ be a valid pointer to an array of @transitionCount@ valid
                         -- 'HostImageLayoutTransitionInfo' structures
                         ("transitions" ::: Vector HostImageLayoutTransitionInfo)
                      -> io ()
transitionImageLayout :: forall (io :: * -> *).
MonadIO io =>
Device
-> ("transitions" ::: Vector HostImageLayoutTransitionInfo)
-> io ()
transitionImageLayout Device
device "transitions" ::: Vector HostImageLayoutTransitionInfo
transitions = 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 vkTransitionImageLayoutPtr :: FunPtr
  (Ptr Device_T
   -> Word32 -> Ptr HostImageLayoutTransitionInfo -> IO Result)
vkTransitionImageLayoutPtr = DeviceCmds
-> FunPtr
     (Ptr Device_T
      -> Word32 -> Ptr HostImageLayoutTransitionInfo -> IO Result)
pVkTransitionImageLayout (case Device
device of Device{DeviceCmds
deviceCmds :: Device -> DeviceCmds
deviceCmds :: 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 Device_T
   -> Word32 -> Ptr HostImageLayoutTransitionInfo -> IO Result)
vkTransitionImageLayoutPtr FunPtr
  (Ptr Device_T
   -> Word32 -> Ptr HostImageLayoutTransitionInfo -> IO Result)
-> FunPtr
     (Ptr Device_T
      -> Word32 -> Ptr HostImageLayoutTransitionInfo -> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr Device_T
   -> Word32 -> Ptr HostImageLayoutTransitionInfo -> IO Result)
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 vkTransitionImageLayout is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkTransitionImageLayout' :: Ptr Device_T
-> Word32 -> Ptr HostImageLayoutTransitionInfo -> IO Result
vkTransitionImageLayout' = FunPtr
  (Ptr Device_T
   -> Word32 -> Ptr HostImageLayoutTransitionInfo -> IO Result)
-> Ptr Device_T
-> Word32
-> Ptr HostImageLayoutTransitionInfo
-> IO Result
mkVkTransitionImageLayout FunPtr
  (Ptr Device_T
   -> Word32 -> Ptr HostImageLayoutTransitionInfo -> IO Result)
vkTransitionImageLayoutPtr
  pPTransitions <- ((Ptr HostImageLayoutTransitionInfo -> IO ()) -> IO ())
-> ContT () IO (Ptr HostImageLayoutTransitionInfo)
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr HostImageLayoutTransitionInfo -> IO ()) -> IO ())
 -> ContT () IO (Ptr HostImageLayoutTransitionInfo))
-> ((Ptr HostImageLayoutTransitionInfo -> IO ()) -> IO ())
-> ContT () IO (Ptr HostImageLayoutTransitionInfo)
forall a b. (a -> b) -> a -> b
$ forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes @HostImageLayoutTransitionInfo ((("transitions" ::: Vector HostImageLayoutTransitionInfo) -> Int
forall a. Vector a -> Int
Data.Vector.length ("transitions" ::: Vector HostImageLayoutTransitionInfo
transitions)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
56)
  lift $ Data.Vector.imapM_ (\Int
i HostImageLayoutTransitionInfo
e -> Ptr HostImageLayoutTransitionInfo
-> HostImageLayoutTransitionInfo -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr HostImageLayoutTransitionInfo
pPTransitions Ptr HostImageLayoutTransitionInfo
-> Int -> Ptr HostImageLayoutTransitionInfo
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
56 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr HostImageLayoutTransitionInfo) (HostImageLayoutTransitionInfo
e)) (transitions)
  r <- lift $ traceAroundEvent "vkTransitionImageLayout" (vkTransitionImageLayout'
                                                            (deviceHandle (device))
                                                            ((fromIntegral (Data.Vector.length $ (transitions)) :: Word32))
                                                            (pPTransitions))
  lift $ when (r < SUCCESS) (throwIO (VulkanException r))


-- | VkPhysicalDeviceHostImageCopyFeatures - Structure indicating support for
-- copies to or from images from host memory
--
-- = Members
--
-- This structure describes the following feature:
--
-- = Description
--
-- If the 'PhysicalDeviceHostImageCopyFeatures' 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
-- 'PhysicalDeviceHostImageCopyFeatures', 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_host_image_copy VK_EXT_host_image_copy>,
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_VERSION_1_4 VK_VERSION_1_4>,
-- 'Vulkan.Core10.FundamentalTypes.Bool32',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PhysicalDeviceHostImageCopyFeatures = PhysicalDeviceHostImageCopyFeatures
  { -- | #extension-features-hostImageCopy# @hostImageCopy@ indicates that the
    -- implementation supports copying from host memory to images using the
    -- 'copyMemoryToImage' command, copying from images to host memory using
    -- the 'copyImageToMemory' command, and copying between images using the
    -- 'copyImageToImage' command.
    PhysicalDeviceHostImageCopyFeatures -> Bool
hostImageCopy :: Bool }
  deriving (Typeable, PhysicalDeviceHostImageCopyFeatures
-> PhysicalDeviceHostImageCopyFeatures -> Bool
(PhysicalDeviceHostImageCopyFeatures
 -> PhysicalDeviceHostImageCopyFeatures -> Bool)
-> (PhysicalDeviceHostImageCopyFeatures
    -> PhysicalDeviceHostImageCopyFeatures -> Bool)
-> Eq PhysicalDeviceHostImageCopyFeatures
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PhysicalDeviceHostImageCopyFeatures
-> PhysicalDeviceHostImageCopyFeatures -> Bool
== :: PhysicalDeviceHostImageCopyFeatures
-> PhysicalDeviceHostImageCopyFeatures -> Bool
$c/= :: PhysicalDeviceHostImageCopyFeatures
-> PhysicalDeviceHostImageCopyFeatures -> Bool
/= :: PhysicalDeviceHostImageCopyFeatures
-> PhysicalDeviceHostImageCopyFeatures -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceHostImageCopyFeatures)
#endif
deriving instance Show PhysicalDeviceHostImageCopyFeatures

instance ToCStruct PhysicalDeviceHostImageCopyFeatures where
  withCStruct :: forall b.
PhysicalDeviceHostImageCopyFeatures
-> (Ptr PhysicalDeviceHostImageCopyFeatures -> IO b) -> IO b
withCStruct PhysicalDeviceHostImageCopyFeatures
x Ptr PhysicalDeviceHostImageCopyFeatures -> IO b
f = Int -> (Ptr PhysicalDeviceHostImageCopyFeatures -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
24 ((Ptr PhysicalDeviceHostImageCopyFeatures -> IO b) -> IO b)
-> (Ptr PhysicalDeviceHostImageCopyFeatures -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr PhysicalDeviceHostImageCopyFeatures
p -> Ptr PhysicalDeviceHostImageCopyFeatures
-> PhysicalDeviceHostImageCopyFeatures -> IO b -> IO b
forall b.
Ptr PhysicalDeviceHostImageCopyFeatures
-> PhysicalDeviceHostImageCopyFeatures -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceHostImageCopyFeatures
p PhysicalDeviceHostImageCopyFeatures
x (Ptr PhysicalDeviceHostImageCopyFeatures -> IO b
f Ptr PhysicalDeviceHostImageCopyFeatures
p)
  pokeCStruct :: forall b.
Ptr PhysicalDeviceHostImageCopyFeatures
-> PhysicalDeviceHostImageCopyFeatures -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceHostImageCopyFeatures
p PhysicalDeviceHostImageCopyFeatures{Bool
hostImageCopy :: PhysicalDeviceHostImageCopyFeatures -> Bool
hostImageCopy :: Bool
..} IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceHostImageCopyFeatures
p Ptr PhysicalDeviceHostImageCopyFeatures -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_FEATURES)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceHostImageCopyFeatures
p Ptr PhysicalDeviceHostImageCopyFeatures -> 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 PhysicalDeviceHostImageCopyFeatures
p Ptr PhysicalDeviceHostImageCopyFeatures -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
hostImageCopy))
    IO b
f
  cStructSize :: Int
cStructSize = Int
24
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b. Ptr PhysicalDeviceHostImageCopyFeatures -> IO b -> IO b
pokeZeroCStruct Ptr PhysicalDeviceHostImageCopyFeatures
p IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceHostImageCopyFeatures
p Ptr PhysicalDeviceHostImageCopyFeatures -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_FEATURES)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceHostImageCopyFeatures
p Ptr PhysicalDeviceHostImageCopyFeatures -> 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 PhysicalDeviceHostImageCopyFeatures
p Ptr PhysicalDeviceHostImageCopyFeatures -> 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 PhysicalDeviceHostImageCopyFeatures where
  peekCStruct :: Ptr PhysicalDeviceHostImageCopyFeatures
-> IO PhysicalDeviceHostImageCopyFeatures
peekCStruct Ptr PhysicalDeviceHostImageCopyFeatures
p = do
    hostImageCopy <- forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PhysicalDeviceHostImageCopyFeatures
p Ptr PhysicalDeviceHostImageCopyFeatures -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32))
    pure $ PhysicalDeviceHostImageCopyFeatures
             (bool32ToBool hostImageCopy)

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

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


-- | VkPhysicalDeviceHostImageCopyProperties - Structure enumerating image
-- layouts supported by an implementation for host memory copies
--
-- = Description
--
-- -   @copySrcLayoutCount@ is an integer related to the number of image
--     layouts for host copies from images available or queried, as
--     described below.
--
-- -   @pCopySrcLayouts@ is a pointer to an array of
--     'Vulkan.Core10.Enums.ImageLayout.ImageLayout' in which supported
--     image layouts for use with host copy operations from images are
--     returned.
--
-- -   @copyDstLayoutCount@ is an integer related to the number of image
--     layouts for host copies to images available or queried, as described
--     below.
--
-- -   @pCopyDstLayouts@ is a pointer to an array of
--     'Vulkan.Core10.Enums.ImageLayout.ImageLayout' in which supported
--     image layouts for use with host copy operations to images are
--     returned.
--
-- -   @optimalTilingLayoutUUID@ is an array of
--     'Vulkan.Core10.APIConstants.UUID_SIZE' @uint8_t@ values representing
--     a universally unique identifier for the implementation’s swizzling
--     layout of images created with
--     'Vulkan.Core10.Enums.ImageTiling.IMAGE_TILING_OPTIMAL'.
--
-- -   @identicalMemoryTypeRequirements@ indicates that specifying the
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_HOST_TRANSFER_BIT'
--     flag in 'Vulkan.Core10.Image.ImageCreateInfo'::@usage@ does not
--     affect the memory type requirements of the image.
--
-- If the 'PhysicalDeviceHostImageCopyProperties' 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.
--
-- If @pCopyDstLayouts@ is @NULL@, then the number of image layouts that
-- are supported in 'CopyMemoryToImageInfo'::@dstImageLayout@ and
-- 'CopyImageToImageInfo'::@dstImageLayout@ is returned in
-- @copyDstLayoutCount@. Otherwise, @copyDstLayoutCount@ /must/ be set by
-- the application to the number of elements in the @pCopyDstLayouts@
-- array, and on return is overwritten with the number of values actually
-- written to @pCopyDstLayouts@. If the value of @copyDstLayoutCount@ is
-- less than the number of image layouts that are supported, at most
-- @copyDstLayoutCount@ values will be written to @pCopyDstLayouts@. The
-- implementation /must/ include the
-- 'Vulkan.Core10.Enums.ImageLayout.IMAGE_LAYOUT_GENERAL' image layout in
-- @pCopyDstLayouts@. If the
-- <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#features-unifiedImageLayouts unifiedImageLayouts>
-- feature is supported, the implementation /must/ include all the image
-- layouts that are interchangeable with
-- 'Vulkan.Core10.Enums.ImageLayout.IMAGE_LAYOUT_GENERAL' in
-- @pCopyDstLayouts@.
--
-- If @pCopySrcLayouts@ is @NULL@, then the number of image layouts that
-- are supported in 'CopyImageToMemoryInfo'::@srcImageLayout@ and
-- 'CopyImageToImageInfo'::@srcImageLayout@ is returned in
-- @copySrcLayoutCount@. Otherwise, @copySrcLayoutCount@ /must/ be set by
-- the application to the number of elements in the @pCopySrcLayouts@
-- array, and on return is overwritten with the number of values actually
-- written to @pCopySrcLayouts@. If the value of @copySrcLayoutCount@ is
-- less than the number of image layouts that are supported, at most
-- @copySrcLayoutCount@ values will be written to @pCopySrcLayouts@. The
-- implementation /must/ include the
-- 'Vulkan.Core10.Enums.ImageLayout.IMAGE_LAYOUT_GENERAL' image layout in
-- @pCopySrcLayouts@. If the
-- <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#features-unifiedImageLayouts unifiedImageLayouts>
-- feature is supported, the implementation /must/ include all the image
-- layouts that are interchangeable with
-- 'Vulkan.Core10.Enums.ImageLayout.IMAGE_LAYOUT_GENERAL' in
-- @pCopySrcLayouts@.
--
-- The @optimalTilingLayoutUUID@ value can be used to ensure compatible
-- data layouts when using the
-- 'Vulkan.Core14.Enums.HostImageCopyFlagBits.HOST_IMAGE_COPY_MEMCPY_BIT'
-- flag in 'copyMemoryToImage' and 'copyImageToMemory'.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkPhysicalDeviceHostImageCopyProperties-sType-sType# @sType@
--     /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_PROPERTIES'
--
-- -   #VUID-VkPhysicalDeviceHostImageCopyProperties-pCopySrcLayouts-parameter#
--     If @copySrcLayoutCount@ is not @0@, and @pCopySrcLayouts@ is not
--     @NULL@, @pCopySrcLayouts@ /must/ be a valid pointer to an array of
--     @copySrcLayoutCount@ 'Vulkan.Core10.Enums.ImageLayout.ImageLayout'
--     values
--
-- -   #VUID-VkPhysicalDeviceHostImageCopyProperties-pCopyDstLayouts-parameter#
--     If @copyDstLayoutCount@ is not @0@, and @pCopyDstLayouts@ is not
--     @NULL@, @pCopyDstLayouts@ /must/ be a valid pointer to an array of
--     @copyDstLayoutCount@ 'Vulkan.Core10.Enums.ImageLayout.ImageLayout'
--     values
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_host_image_copy VK_EXT_host_image_copy>,
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_VERSION_1_4 VK_VERSION_1_4>,
-- 'Vulkan.Core10.FundamentalTypes.Bool32',
-- 'Vulkan.Core10.Enums.ImageLayout.ImageLayout',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PhysicalDeviceHostImageCopyProperties = PhysicalDeviceHostImageCopyProperties
  { -- No documentation found for Nested "VkPhysicalDeviceHostImageCopyProperties" "copySrcLayoutCount"
    PhysicalDeviceHostImageCopyProperties -> Word32
copySrcLayoutCount :: Word32
  , -- No documentation found for Nested "VkPhysicalDeviceHostImageCopyProperties" "pCopySrcLayouts"
    PhysicalDeviceHostImageCopyProperties -> Ptr ImageLayout
copySrcLayouts :: Ptr ImageLayout
  , -- No documentation found for Nested "VkPhysicalDeviceHostImageCopyProperties" "copyDstLayoutCount"
    PhysicalDeviceHostImageCopyProperties -> Word32
copyDstLayoutCount :: Word32
  , -- No documentation found for Nested "VkPhysicalDeviceHostImageCopyProperties" "pCopyDstLayouts"
    PhysicalDeviceHostImageCopyProperties -> Ptr ImageLayout
copyDstLayouts :: Ptr ImageLayout
  , -- No documentation found for Nested "VkPhysicalDeviceHostImageCopyProperties" "optimalTilingLayoutUUID"
    PhysicalDeviceHostImageCopyProperties -> ByteString
optimalTilingLayoutUUID :: ByteString
  , -- No documentation found for Nested "VkPhysicalDeviceHostImageCopyProperties" "identicalMemoryTypeRequirements"
    PhysicalDeviceHostImageCopyProperties -> Bool
identicalMemoryTypeRequirements :: Bool
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceHostImageCopyProperties)
#endif
deriving instance Show PhysicalDeviceHostImageCopyProperties

instance ToCStruct PhysicalDeviceHostImageCopyProperties where
  withCStruct :: forall b.
PhysicalDeviceHostImageCopyProperties
-> (Ptr PhysicalDeviceHostImageCopyProperties -> IO b) -> IO b
withCStruct PhysicalDeviceHostImageCopyProperties
x Ptr PhysicalDeviceHostImageCopyProperties -> IO b
f = Int -> (Ptr PhysicalDeviceHostImageCopyProperties -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
72 ((Ptr PhysicalDeviceHostImageCopyProperties -> IO b) -> IO b)
-> (Ptr PhysicalDeviceHostImageCopyProperties -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr PhysicalDeviceHostImageCopyProperties
p -> Ptr PhysicalDeviceHostImageCopyProperties
-> PhysicalDeviceHostImageCopyProperties -> IO b -> IO b
forall b.
Ptr PhysicalDeviceHostImageCopyProperties
-> PhysicalDeviceHostImageCopyProperties -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceHostImageCopyProperties
p PhysicalDeviceHostImageCopyProperties
x (Ptr PhysicalDeviceHostImageCopyProperties -> IO b
f Ptr PhysicalDeviceHostImageCopyProperties
p)
  pokeCStruct :: forall b.
Ptr PhysicalDeviceHostImageCopyProperties
-> PhysicalDeviceHostImageCopyProperties -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceHostImageCopyProperties
p PhysicalDeviceHostImageCopyProperties{Bool
Word32
Ptr ImageLayout
ByteString
copySrcLayoutCount :: PhysicalDeviceHostImageCopyProperties -> Word32
copySrcLayouts :: PhysicalDeviceHostImageCopyProperties -> Ptr ImageLayout
copyDstLayoutCount :: PhysicalDeviceHostImageCopyProperties -> Word32
copyDstLayouts :: PhysicalDeviceHostImageCopyProperties -> Ptr ImageLayout
optimalTilingLayoutUUID :: PhysicalDeviceHostImageCopyProperties -> ByteString
identicalMemoryTypeRequirements :: PhysicalDeviceHostImageCopyProperties -> Bool
copySrcLayoutCount :: Word32
copySrcLayouts :: Ptr ImageLayout
copyDstLayoutCount :: Word32
copyDstLayouts :: Ptr ImageLayout
optimalTilingLayoutUUID :: ByteString
identicalMemoryTypeRequirements :: Bool
..} IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceHostImageCopyProperties
p Ptr PhysicalDeviceHostImageCopyProperties
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_PROPERTIES)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceHostImageCopyProperties
p Ptr PhysicalDeviceHostImageCopyProperties -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceHostImageCopyProperties
p Ptr PhysicalDeviceHostImageCopyProperties -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32)) (Word32
copySrcLayoutCount)
    Ptr (Ptr ImageLayout) -> Ptr ImageLayout -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceHostImageCopyProperties
p Ptr PhysicalDeviceHostImageCopyProperties
-> Int -> Ptr (Ptr ImageLayout)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr ImageLayout))) (Ptr ImageLayout
copySrcLayouts)
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceHostImageCopyProperties
p Ptr PhysicalDeviceHostImageCopyProperties -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr Word32)) (Word32
copyDstLayoutCount)
    Ptr (Ptr ImageLayout) -> Ptr ImageLayout -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceHostImageCopyProperties
p Ptr PhysicalDeviceHostImageCopyProperties
-> Int -> Ptr (Ptr ImageLayout)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
40 :: Ptr (Ptr ImageLayout))) (Ptr ImageLayout
copyDstLayouts)
    Ptr (FixedArray UUID_SIZE Word8) -> ByteString -> IO ()
forall (n :: Nat).
KnownNat n =>
Ptr (FixedArray n Word8) -> ByteString -> IO ()
pokeFixedLengthByteString ((Ptr PhysicalDeviceHostImageCopyProperties
p Ptr PhysicalDeviceHostImageCopyProperties
-> Int -> Ptr (FixedArray UUID_SIZE Word8)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
48 :: Ptr (FixedArray UUID_SIZE Word8))) (ByteString
optimalTilingLayoutUUID)
    Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceHostImageCopyProperties
p Ptr PhysicalDeviceHostImageCopyProperties -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
64 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
identicalMemoryTypeRequirements))
    IO b
f
  cStructSize :: Int
cStructSize = Int
72
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b. Ptr PhysicalDeviceHostImageCopyProperties -> IO b -> IO b
pokeZeroCStruct Ptr PhysicalDeviceHostImageCopyProperties
p IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceHostImageCopyProperties
p Ptr PhysicalDeviceHostImageCopyProperties
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_PROPERTIES)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceHostImageCopyProperties
p Ptr PhysicalDeviceHostImageCopyProperties -> 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 PhysicalDeviceHostImageCopyProperties
p Ptr PhysicalDeviceHostImageCopyProperties -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
64 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
forall a. Zero a => a
zero))
    IO b
f

instance FromCStruct PhysicalDeviceHostImageCopyProperties where
  peekCStruct :: Ptr PhysicalDeviceHostImageCopyProperties
-> IO PhysicalDeviceHostImageCopyProperties
peekCStruct Ptr PhysicalDeviceHostImageCopyProperties
p = do
    copySrcLayoutCount <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr PhysicalDeviceHostImageCopyProperties
p Ptr PhysicalDeviceHostImageCopyProperties -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32))
    pCopySrcLayouts <- peek @(Ptr ImageLayout) ((p `plusPtr` 24 :: Ptr (Ptr ImageLayout)))
    copyDstLayoutCount <- peek @Word32 ((p `plusPtr` 32 :: Ptr Word32))
    pCopyDstLayouts <- peek @(Ptr ImageLayout) ((p `plusPtr` 40 :: Ptr (Ptr ImageLayout)))
    optimalTilingLayoutUUID <- peekByteStringFromSizedVectorPtr ((p `plusPtr` 48 :: Ptr (FixedArray UUID_SIZE Word8)))
    identicalMemoryTypeRequirements <- peek @Bool32 ((p `plusPtr` 64 :: Ptr Bool32))
    pure $ PhysicalDeviceHostImageCopyProperties
             copySrcLayoutCount
             pCopySrcLayouts
             copyDstLayoutCount
             pCopyDstLayouts
             optimalTilingLayoutUUID
             (bool32ToBool identicalMemoryTypeRequirements)

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

instance Zero PhysicalDeviceHostImageCopyProperties where
  zero :: PhysicalDeviceHostImageCopyProperties
zero = Word32
-> Ptr ImageLayout
-> Word32
-> Ptr ImageLayout
-> ByteString
-> Bool
-> PhysicalDeviceHostImageCopyProperties
PhysicalDeviceHostImageCopyProperties
           Word32
forall a. Zero a => a
zero
           Ptr ImageLayout
forall a. Zero a => a
zero
           Word32
forall a. Zero a => a
zero
           Ptr ImageLayout
forall a. Zero a => a
zero
           ByteString
forall a. Monoid a => a
mempty
           Bool
forall a. Zero a => a
zero


-- | VkMemoryToImageCopy - Structure specifying a host memory to image copy
-- operation
--
-- = Description
--
-- This structure is functionally similar to
-- 'Vulkan.Core13.Promoted_From_VK_KHR_copy_commands2.BufferImageCopy2',
-- except it defines host memory as the source of copy instead of a buffer.
-- In particular, the same data packing rules and restrictions as that
-- structure apply here as well.
--
-- == Valid Usage
--
-- -   #VUID-VkMemoryToImageCopy-pHostPointer-09061# @pHostPointer@ /must/
--     point to memory that is large enough to contain all memory locations
--     that are accessed according to
--     <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#copies-buffers-images-addressing Buffer and Image Addressing>,
--     for each element of @pRegions@
--
-- -   #VUID-VkMemoryToImageCopy-pRegions-09062# The union of all source
--     regions, and the union of all destination regions, specified by the
--     elements of @pRegions@, /must/ not overlap in memory
--
-- -   #VUID-VkMemoryToImageCopy-memoryRowLength-09101# @memoryRowLength@
--     /must/ be @0@, or greater than or equal to the @width@ member of
--     @imageExtent@
--
-- -   #VUID-VkMemoryToImageCopy-memoryImageHeight-09102#
--     @memoryImageHeight@ /must/ be @0@, or greater than or equal to the
--     @height@ member of @imageExtent@
--
-- -   #VUID-VkMemoryToImageCopy-aspectMask-09103# The @aspectMask@ member
--     of @imageSubresource@ /must/ only have a single bit set
--
-- -   #VUID-VkMemoryToImageCopy-imageExtent-06659# @imageExtent.width@
--     /must/ not be 0
--
-- -   #VUID-VkMemoryToImageCopy-imageExtent-06660# @imageExtent.height@
--     /must/ not be 0
--
-- -   #VUID-VkMemoryToImageCopy-imageExtent-06661# @imageExtent.depth@
--     /must/ not be 0
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkMemoryToImageCopy-sType-sType# @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_MEMORY_TO_IMAGE_COPY'
--
-- -   #VUID-VkMemoryToImageCopy-pNext-pNext# @pNext@ /must/ be @NULL@
--
-- -   #VUID-VkMemoryToImageCopy-pHostPointer-parameter# @pHostPointer@
--     /must/ be a pointer value
--
-- -   #VUID-VkMemoryToImageCopy-imageSubresource-parameter#
--     @imageSubresource@ /must/ be a valid
--     'Vulkan.Core10.CommandBufferBuilding.ImageSubresourceLayers'
--     structure
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_host_image_copy VK_EXT_host_image_copy>,
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_VERSION_1_4 VK_VERSION_1_4>,
-- 'CopyMemoryToImageInfo', 'Vulkan.Core10.FundamentalTypes.Extent3D',
-- 'Vulkan.Core10.CommandBufferBuilding.ImageSubresourceLayers',
-- 'Vulkan.Core10.FundamentalTypes.Offset3D',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data MemoryToImageCopy = MemoryToImageCopy
  { -- | @pHostPointer@ is the host memory address which is the source of the
    -- copy.
    MemoryToImageCopy -> Ptr ()
hostPointer :: Ptr ()
  , -- | @memoryRowLength@ and @memoryImageHeight@ specify in texels a subregion
    -- of a larger two- or three-dimensional image in host memory, and control
    -- the addressing calculations. If either of these values is zero, that
    -- aspect of the host memory is considered to be tightly packed according
    -- to the @imageExtent@.
    MemoryToImageCopy -> Word32
memoryRowLength :: Word32
  , -- No documentation found for Nested "VkMemoryToImageCopy" "memoryImageHeight"
    MemoryToImageCopy -> Word32
memoryImageHeight :: Word32
  , -- | @imageSubresource@ is a
    -- 'Vulkan.Core10.CommandBufferBuilding.ImageSubresourceLayers' used to
    -- specify the specific image subresources of the image used for the source
    -- or destination image data.
    MemoryToImageCopy -> ImageSubresourceLayers
imageSubresource :: ImageSubresourceLayers
  , -- | @imageOffset@ selects the initial @x@, @y@, @z@ offsets in texels of the
    -- sub-region of the destination image data.
    MemoryToImageCopy -> Offset3D
imageOffset :: Offset3D
  , -- | @imageExtent@ is the size in texels of the image to copy in @width@,
    -- @height@ and @depth@.
    MemoryToImageCopy -> Extent3D
imageExtent :: Extent3D
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (MemoryToImageCopy)
#endif
deriving instance Show MemoryToImageCopy

instance ToCStruct MemoryToImageCopy where
  withCStruct :: forall b.
MemoryToImageCopy -> (Ptr MemoryToImageCopy -> IO b) -> IO b
withCStruct MemoryToImageCopy
x Ptr MemoryToImageCopy -> IO b
f = Int -> (Ptr MemoryToImageCopy -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
72 ((Ptr MemoryToImageCopy -> IO b) -> IO b)
-> (Ptr MemoryToImageCopy -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr MemoryToImageCopy
p -> Ptr MemoryToImageCopy -> MemoryToImageCopy -> IO b -> IO b
forall b.
Ptr MemoryToImageCopy -> MemoryToImageCopy -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr MemoryToImageCopy
p MemoryToImageCopy
x (Ptr MemoryToImageCopy -> IO b
f Ptr MemoryToImageCopy
p)
  pokeCStruct :: forall b.
Ptr MemoryToImageCopy -> MemoryToImageCopy -> IO b -> IO b
pokeCStruct Ptr MemoryToImageCopy
p MemoryToImageCopy{Word32
Ptr ()
Offset3D
Extent3D
ImageSubresourceLayers
hostPointer :: MemoryToImageCopy -> Ptr ()
memoryRowLength :: MemoryToImageCopy -> Word32
memoryImageHeight :: MemoryToImageCopy -> Word32
imageSubresource :: MemoryToImageCopy -> ImageSubresourceLayers
imageOffset :: MemoryToImageCopy -> Offset3D
imageExtent :: MemoryToImageCopy -> Extent3D
hostPointer :: Ptr ()
memoryRowLength :: Word32
memoryImageHeight :: Word32
imageSubresource :: ImageSubresourceLayers
imageOffset :: Offset3D
imageExtent :: Extent3D
..} IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr MemoryToImageCopy
p Ptr MemoryToImageCopy -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_MEMORY_TO_IMAGE_COPY)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr MemoryToImageCopy
p Ptr MemoryToImageCopy -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr MemoryToImageCopy
p Ptr MemoryToImageCopy -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr (Ptr ()))) (Ptr ()
hostPointer)
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr MemoryToImageCopy
p Ptr MemoryToImageCopy -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Word32)) (Word32
memoryRowLength)
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr MemoryToImageCopy
p Ptr MemoryToImageCopy -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr Word32)) (Word32
memoryImageHeight)
    Ptr ImageSubresourceLayers -> ImageSubresourceLayers -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr MemoryToImageCopy
p Ptr MemoryToImageCopy -> Int -> Ptr ImageSubresourceLayers
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr ImageSubresourceLayers)) (ImageSubresourceLayers
imageSubresource)
    Ptr Offset3D -> Offset3D -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr MemoryToImageCopy
p Ptr MemoryToImageCopy -> Int -> Ptr Offset3D
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
48 :: Ptr Offset3D)) (Offset3D
imageOffset)
    Ptr Extent3D -> Extent3D -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr MemoryToImageCopy
p Ptr MemoryToImageCopy -> Int -> Ptr Extent3D
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
60 :: Ptr Extent3D)) (Extent3D
imageExtent)
    IO b
f
  cStructSize :: Int
cStructSize = Int
72
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b. Ptr MemoryToImageCopy -> IO b -> IO b
pokeZeroCStruct Ptr MemoryToImageCopy
p IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr MemoryToImageCopy
p Ptr MemoryToImageCopy -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_MEMORY_TO_IMAGE_COPY)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr MemoryToImageCopy
p Ptr MemoryToImageCopy -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr MemoryToImageCopy
p Ptr MemoryToImageCopy -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr (Ptr ()))) (Ptr ()
forall a. Zero a => a
zero)
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr MemoryToImageCopy
p Ptr MemoryToImageCopy -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr MemoryToImageCopy
p Ptr MemoryToImageCopy -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
    Ptr ImageSubresourceLayers -> ImageSubresourceLayers -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr MemoryToImageCopy
p Ptr MemoryToImageCopy -> Int -> Ptr ImageSubresourceLayers
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr ImageSubresourceLayers)) (ImageSubresourceLayers
forall a. Zero a => a
zero)
    Ptr Offset3D -> Offset3D -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr MemoryToImageCopy
p Ptr MemoryToImageCopy -> Int -> Ptr Offset3D
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
48 :: Ptr Offset3D)) (Offset3D
forall a. Zero a => a
zero)
    Ptr Extent3D -> Extent3D -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr MemoryToImageCopy
p Ptr MemoryToImageCopy -> Int -> Ptr Extent3D
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
60 :: Ptr Extent3D)) (Extent3D
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct MemoryToImageCopy where
  peekCStruct :: Ptr MemoryToImageCopy -> IO MemoryToImageCopy
peekCStruct Ptr MemoryToImageCopy
p = do
    pHostPointer <- forall a. Storable a => Ptr a -> IO a
peek @(Ptr ()) ((Ptr MemoryToImageCopy
p Ptr MemoryToImageCopy -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr (Ptr ())))
    memoryRowLength <- peek @Word32 ((p `plusPtr` 24 :: Ptr Word32))
    memoryImageHeight <- peek @Word32 ((p `plusPtr` 28 :: Ptr Word32))
    imageSubresource <- peekCStruct @ImageSubresourceLayers ((p `plusPtr` 32 :: Ptr ImageSubresourceLayers))
    imageOffset <- peekCStruct @Offset3D ((p `plusPtr` 48 :: Ptr Offset3D))
    imageExtent <- peekCStruct @Extent3D ((p `plusPtr` 60 :: Ptr Extent3D))
    pure $ MemoryToImageCopy
             pHostPointer
             memoryRowLength
             memoryImageHeight
             imageSubresource
             imageOffset
             imageExtent

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

instance Zero MemoryToImageCopy where
  zero :: MemoryToImageCopy
zero = Ptr ()
-> Word32
-> Word32
-> ImageSubresourceLayers
-> Offset3D
-> Extent3D
-> MemoryToImageCopy
MemoryToImageCopy
           Ptr ()
forall a. Zero a => a
zero
           Word32
forall a. Zero a => a
zero
           Word32
forall a. Zero a => a
zero
           ImageSubresourceLayers
forall a. Zero a => a
zero
           Offset3D
forall a. Zero a => a
zero
           Extent3D
forall a. Zero a => a
zero


-- | VkImageToMemoryCopy - Structure specifying an image to host memory copy
-- operation
--
-- = Description
--
-- This structure is functionally similar to
-- 'Vulkan.Core13.Promoted_From_VK_KHR_copy_commands2.BufferImageCopy2',
-- except it defines host memory as the target of copy instead of a buffer.
-- In particular, the same data packing rules and restrictions as that
-- structure apply here as well.
--
-- == Valid Usage
--
-- -   #VUID-VkImageToMemoryCopy-pHostPointer-09066# @pHostPointer@ /must/
--     point to memory that is large enough to contain all memory locations
--     that are accessed according to
--     <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#copies-buffers-images-addressing Buffer and Image Addressing>,
--     for each element of @pRegions@
--
-- -   #VUID-VkImageToMemoryCopy-pRegions-09067# The union of all source
--     regions, and the union of all destination regions, specified by the
--     elements of @pRegions@, /must/ not overlap in memory
--
-- -   #VUID-VkImageToMemoryCopy-memoryRowLength-09101# @memoryRowLength@
--     /must/ be @0@, or greater than or equal to the @width@ member of
--     @imageExtent@
--
-- -   #VUID-VkImageToMemoryCopy-memoryImageHeight-09102#
--     @memoryImageHeight@ /must/ be @0@, or greater than or equal to the
--     @height@ member of @imageExtent@
--
-- -   #VUID-VkImageToMemoryCopy-aspectMask-09103# The @aspectMask@ member
--     of @imageSubresource@ /must/ only have a single bit set
--
-- -   #VUID-VkImageToMemoryCopy-imageExtent-06659# @imageExtent.width@
--     /must/ not be 0
--
-- -   #VUID-VkImageToMemoryCopy-imageExtent-06660# @imageExtent.height@
--     /must/ not be 0
--
-- -   #VUID-VkImageToMemoryCopy-imageExtent-06661# @imageExtent.depth@
--     /must/ not be 0
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkImageToMemoryCopy-sType-sType# @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_IMAGE_TO_MEMORY_COPY'
--
-- -   #VUID-VkImageToMemoryCopy-pNext-pNext# @pNext@ /must/ be @NULL@
--
-- -   #VUID-VkImageToMemoryCopy-pHostPointer-parameter# @pHostPointer@
--     /must/ be a pointer value
--
-- -   #VUID-VkImageToMemoryCopy-imageSubresource-parameter#
--     @imageSubresource@ /must/ be a valid
--     'Vulkan.Core10.CommandBufferBuilding.ImageSubresourceLayers'
--     structure
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_host_image_copy VK_EXT_host_image_copy>,
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_VERSION_1_4 VK_VERSION_1_4>,
-- 'CopyImageToMemoryInfo', 'Vulkan.Core10.FundamentalTypes.Extent3D',
-- 'Vulkan.Core10.CommandBufferBuilding.ImageSubresourceLayers',
-- 'Vulkan.Core10.FundamentalTypes.Offset3D',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data ImageToMemoryCopy = ImageToMemoryCopy
  { -- | @pHostPointer@ is the host memory address which is the destination of
    -- the copy.
    ImageToMemoryCopy -> Ptr ()
hostPointer :: Ptr ()
  , -- | @memoryRowLength@ and @memoryImageHeight@ specify in texels a subregion
    -- of a larger two- or three-dimensional image in host memory, and control
    -- the addressing calculations. If either of these values is zero, that
    -- aspect of the host memory is considered to be tightly packed according
    -- to the @imageExtent@.
    ImageToMemoryCopy -> Word32
memoryRowLength :: Word32
  , -- No documentation found for Nested "VkImageToMemoryCopy" "memoryImageHeight"
    ImageToMemoryCopy -> Word32
memoryImageHeight :: Word32
  , -- | @imageSubresource@ is a
    -- 'Vulkan.Core10.CommandBufferBuilding.ImageSubresourceLayers' used to
    -- specify the specific image subresources of the image used for the source
    -- or destination image data.
    ImageToMemoryCopy -> ImageSubresourceLayers
imageSubresource :: ImageSubresourceLayers
  , -- | @imageOffset@ selects the initial @x@, @y@, @z@ offsets in texels of the
    -- sub-region of the source image data.
    ImageToMemoryCopy -> Offset3D
imageOffset :: Offset3D
  , -- | @imageExtent@ is the size in texels of the image to copy in @width@,
    -- @height@ and @depth@.
    ImageToMemoryCopy -> Extent3D
imageExtent :: Extent3D
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ImageToMemoryCopy)
#endif
deriving instance Show ImageToMemoryCopy

instance ToCStruct ImageToMemoryCopy where
  withCStruct :: forall b.
ImageToMemoryCopy -> (Ptr ImageToMemoryCopy -> IO b) -> IO b
withCStruct ImageToMemoryCopy
x Ptr ImageToMemoryCopy -> IO b
f = Int -> (Ptr ImageToMemoryCopy -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
72 ((Ptr ImageToMemoryCopy -> IO b) -> IO b)
-> (Ptr ImageToMemoryCopy -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr ImageToMemoryCopy
p -> Ptr ImageToMemoryCopy -> ImageToMemoryCopy -> IO b -> IO b
forall b.
Ptr ImageToMemoryCopy -> ImageToMemoryCopy -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr ImageToMemoryCopy
p ImageToMemoryCopy
x (Ptr ImageToMemoryCopy -> IO b
f Ptr ImageToMemoryCopy
p)
  pokeCStruct :: forall b.
Ptr ImageToMemoryCopy -> ImageToMemoryCopy -> IO b -> IO b
pokeCStruct Ptr ImageToMemoryCopy
p ImageToMemoryCopy{Word32
Ptr ()
Offset3D
Extent3D
ImageSubresourceLayers
hostPointer :: ImageToMemoryCopy -> Ptr ()
memoryRowLength :: ImageToMemoryCopy -> Word32
memoryImageHeight :: ImageToMemoryCopy -> Word32
imageSubresource :: ImageToMemoryCopy -> ImageSubresourceLayers
imageOffset :: ImageToMemoryCopy -> Offset3D
imageExtent :: ImageToMemoryCopy -> Extent3D
hostPointer :: Ptr ()
memoryRowLength :: Word32
memoryImageHeight :: Word32
imageSubresource :: ImageSubresourceLayers
imageOffset :: Offset3D
imageExtent :: Extent3D
..} IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageToMemoryCopy
p Ptr ImageToMemoryCopy -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IMAGE_TO_MEMORY_COPY)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageToMemoryCopy
p Ptr ImageToMemoryCopy -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageToMemoryCopy
p Ptr ImageToMemoryCopy -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr (Ptr ()))) (Ptr ()
hostPointer)
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageToMemoryCopy
p Ptr ImageToMemoryCopy -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Word32)) (Word32
memoryRowLength)
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageToMemoryCopy
p Ptr ImageToMemoryCopy -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr Word32)) (Word32
memoryImageHeight)
    Ptr ImageSubresourceLayers -> ImageSubresourceLayers -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageToMemoryCopy
p Ptr ImageToMemoryCopy -> Int -> Ptr ImageSubresourceLayers
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr ImageSubresourceLayers)) (ImageSubresourceLayers
imageSubresource)
    Ptr Offset3D -> Offset3D -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageToMemoryCopy
p Ptr ImageToMemoryCopy -> Int -> Ptr Offset3D
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
48 :: Ptr Offset3D)) (Offset3D
imageOffset)
    Ptr Extent3D -> Extent3D -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageToMemoryCopy
p Ptr ImageToMemoryCopy -> Int -> Ptr Extent3D
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
60 :: Ptr Extent3D)) (Extent3D
imageExtent)
    IO b
f
  cStructSize :: Int
cStructSize = Int
72
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b. Ptr ImageToMemoryCopy -> IO b -> IO b
pokeZeroCStruct Ptr ImageToMemoryCopy
p IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageToMemoryCopy
p Ptr ImageToMemoryCopy -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IMAGE_TO_MEMORY_COPY)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageToMemoryCopy
p Ptr ImageToMemoryCopy -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageToMemoryCopy
p Ptr ImageToMemoryCopy -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr (Ptr ()))) (Ptr ()
forall a. Zero a => a
zero)
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageToMemoryCopy
p Ptr ImageToMemoryCopy -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageToMemoryCopy
p Ptr ImageToMemoryCopy -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
    Ptr ImageSubresourceLayers -> ImageSubresourceLayers -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageToMemoryCopy
p Ptr ImageToMemoryCopy -> Int -> Ptr ImageSubresourceLayers
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr ImageSubresourceLayers)) (ImageSubresourceLayers
forall a. Zero a => a
zero)
    Ptr Offset3D -> Offset3D -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageToMemoryCopy
p Ptr ImageToMemoryCopy -> Int -> Ptr Offset3D
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
48 :: Ptr Offset3D)) (Offset3D
forall a. Zero a => a
zero)
    Ptr Extent3D -> Extent3D -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageToMemoryCopy
p Ptr ImageToMemoryCopy -> Int -> Ptr Extent3D
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
60 :: Ptr Extent3D)) (Extent3D
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct ImageToMemoryCopy where
  peekCStruct :: Ptr ImageToMemoryCopy -> IO ImageToMemoryCopy
peekCStruct Ptr ImageToMemoryCopy
p = do
    pHostPointer <- forall a. Storable a => Ptr a -> IO a
peek @(Ptr ()) ((Ptr ImageToMemoryCopy
p Ptr ImageToMemoryCopy -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr (Ptr ())))
    memoryRowLength <- peek @Word32 ((p `plusPtr` 24 :: Ptr Word32))
    memoryImageHeight <- peek @Word32 ((p `plusPtr` 28 :: Ptr Word32))
    imageSubresource <- peekCStruct @ImageSubresourceLayers ((p `plusPtr` 32 :: Ptr ImageSubresourceLayers))
    imageOffset <- peekCStruct @Offset3D ((p `plusPtr` 48 :: Ptr Offset3D))
    imageExtent <- peekCStruct @Extent3D ((p `plusPtr` 60 :: Ptr Extent3D))
    pure $ ImageToMemoryCopy
             pHostPointer
             memoryRowLength
             memoryImageHeight
             imageSubresource
             imageOffset
             imageExtent

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

instance Zero ImageToMemoryCopy where
  zero :: ImageToMemoryCopy
zero = Ptr ()
-> Word32
-> Word32
-> ImageSubresourceLayers
-> Offset3D
-> Extent3D
-> ImageToMemoryCopy
ImageToMemoryCopy
           Ptr ()
forall a. Zero a => a
zero
           Word32
forall a. Zero a => a
zero
           Word32
forall a. Zero a => a
zero
           ImageSubresourceLayers
forall a. Zero a => a
zero
           Offset3D
forall a. Zero a => a
zero
           Extent3D
forall a. Zero a => a
zero


-- | VkCopyMemoryToImageInfo - Structure specifying parameters of host memory
-- to image copy command
--
-- = Description
--
-- 'copyMemoryToImage' does not check whether the device memory associated
-- with @dstImage@ is currently in use before performing the copy. The
-- application /must/ guarantee that any previously submitted command that
-- reads from or writes to the copy regions has completed before the host
-- performs the copy.
--
-- Copy regions for the image /must/ be aligned to a multiple of the texel
-- block extent in each dimension, except at the edges of the image, where
-- region extents /must/ match the edge of the image.
--
-- == Valid Usage
--
-- -   #VUID-VkCopyMemoryToImageInfo-dstImage-09109# If @dstImage@ is
--     sparse then all memory ranges accessed by the copy command /must/ be
--     bound as described in
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#sparsememory-resource-binding Binding Resource Memory>
--
-- -   #VUID-VkCopyMemoryToImageInfo-dstImage-09111# If the stencil aspect
--     of @dstImage@ is accessed, and @dstImage@ was not created with
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VkImageStencilUsageCreateInfo separate stencil usage>,
--     @dstImage@ /must/ have been created with the
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_HOST_TRANSFER_BIT'
--     usage flag set
--
-- -   #VUID-VkCopyMemoryToImageInfo-dstImage-09112# If the stencil aspect
--     of @dstImage@ is accessed, and @dstImage@ was created with
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VkImageStencilUsageCreateInfo separate stencil usage>,
--     @dstImage@ /must/ have been created with the
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_HOST_TRANSFER_BIT'
--     usage flag set
--
-- -   #VUID-VkCopyMemoryToImageInfo-dstImage-09113# If non-stencil aspects
--     of @dstImage@ are accessed, @dstImage@ /must/ have been created with
--     the
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_HOST_TRANSFER_BIT'
--     usage flag set
--
-- -   #VUID-VkCopyMemoryToImageInfo-imageOffset-09114# If @flags@ contains
--     'Vulkan.Core14.Enums.HostImageCopyFlagBits.HOST_IMAGE_COPY_MEMCPY_BIT',
--     the @x@, @y@, and @z@ members of the @imageOffset@ member of each
--     element of @pRegions@ /must/ be @0@
--
-- -   #VUID-VkCopyMemoryToImageInfo-dstImage-09115# If @flags@ contains
--     'Vulkan.Core14.Enums.HostImageCopyFlagBits.HOST_IMAGE_COPY_MEMCPY_BIT',
--     the @imageExtent@ member of each element of @pRegions@ /must/ equal
--     the extents of @dstImage@ identified by @imageSubresource@
--
-- -   #VUID-VkCopyMemoryToImageInfo-dstImage-07966# If @dstImage@ is
--     non-sparse then the image or each specified /disjoint/ plane /must/
--     be bound completely and contiguously to a single
--     'Vulkan.Core10.Handles.DeviceMemory' object
--
-- -   #VUID-VkCopyMemoryToImageInfo-imageSubresource-07967# The
--     @imageSubresource.mipLevel@ member of each element of @pRegions@
--     /must/ be less than the @mipLevels@ specified in
--     'Vulkan.Core10.Image.ImageCreateInfo' when @dstImage@ was created
--
-- -   #VUID-VkCopyMemoryToImageInfo-imageSubresource-07968# If
--     @imageSubresource.layerCount@ is not
--     'Vulkan.Core10.APIConstants.REMAINING_ARRAY_LAYERS',
--     @imageSubresource.baseArrayLayer@ + @imageSubresource.layerCount@ of
--     each element of @pRegions@ /must/ be less than or equal to the
--     @arrayLayers@ specified in 'Vulkan.Core10.Image.ImageCreateInfo'
--     when @dstImage@ was created
--
-- -   #VUID-VkCopyMemoryToImageInfo-dstImage-07969# @dstImage@ /must/ not
--     have been created with @flags@ containing
--     'Vulkan.Core10.Enums.ImageCreateFlagBits.IMAGE_CREATE_SUBSAMPLED_BIT_EXT'
--
-- -   #VUID-VkCopyMemoryToImageInfo-imageSubresource-07971# For each
--     element of @pRegions@, @imageOffset.x@ and (@imageExtent.width@ +
--     @imageOffset.x@) /must/ both be greater than or equal to @0@ and
--     less than or equal to the width of the specified @imageSubresource@
--     of @dstImage@
--
-- -   #VUID-VkCopyMemoryToImageInfo-imageSubresource-07972# For each
--     element of @pRegions@, @imageOffset.y@ and (@imageExtent.height@ +
--     @imageOffset.y@) /must/ both be greater than or equal to @0@ and
--     less than or equal to the height of the specified @imageSubresource@
--     of @dstImage@
--
-- -   #VUID-VkCopyMemoryToImageInfo-dstImage-07973# @dstImage@ /must/ have
--     a sample count equal to
--     'Vulkan.Core10.Enums.SampleCountFlagBits.SAMPLE_COUNT_1_BIT'
--
-- -   #VUID-VkCopyMemoryToImageInfo-dstImage-07979# If @dstImage@ is of
--     type 'Vulkan.Core10.Enums.ImageType.IMAGE_TYPE_1D', then for each
--     element of @pRegions@, @imageOffset.y@ /must/ be @0@ and
--     @imageExtent.height@ /must/ be @1@
--
-- -   #VUID-VkCopyMemoryToImageInfo-imageOffset-09104# For each element of
--     @pRegions@, @imageOffset.z@ and (@imageExtent.depth@ +
--     @imageOffset.z@) /must/ both be greater than or equal to @0@ and
--     less than or equal to the depth of the specified @imageSubresource@
--     of @dstImage@
--
-- -   #VUID-VkCopyMemoryToImageInfo-dstImage-07980# If @dstImage@ is of
--     type 'Vulkan.Core10.Enums.ImageType.IMAGE_TYPE_1D' or
--     'Vulkan.Core10.Enums.ImageType.IMAGE_TYPE_2D', then for each element
--     of @pRegions@, @imageOffset.z@ /must/ be @0@ and @imageExtent.depth@
--     /must/ be @1@
--
-- -   #VUID-VkCopyMemoryToImageInfo-dstImage-07274# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_IDENTITY_BIT_KHR'
--     or
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_270_BIT_KHR',
--     @imageOffset.x@ /must/ be a multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent width>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @dstImage@
--
-- -   #VUID-VkCopyMemoryToImageInfo-imageOffset-10051# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_180_BIT_KHR'
--     or
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_90_BIT_KHR',
--     and @imageOffset.x@ does not equal the width of the subresource
--     specified by @imageSubresource@, @imageOffset.x@ /must/ be a
--     multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent width>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @dstImage@
--
-- -   #VUID-VkCopyMemoryToImageInfo-dstImage-07275# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_IDENTITY_BIT_KHR'
--     or
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_90_BIT_KHR',
--     @imageOffset.y@ /must/ be a multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent height>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @dstImage@
--
-- -   #VUID-VkCopyMemoryToImageInfo-imageOffset-10052# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_270_BIT_KHR'
--     or
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_180_BIT_KHR',
--     and @imageOffset.y@ does not equal the height of the subresource
--     specified by @imageSubresource@, @imageOffset.y@ /must/ be a
--     multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent height>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @dstImage@
--
-- -   #VUID-VkCopyMemoryToImageInfo-dstImage-07276# For each element of
--     @pRegions@, @imageOffset.z@ /must/ be a multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent depth>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @dstImage@
--
-- -   #VUID-VkCopyMemoryToImageInfo-dstImage-00207# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_IDENTITY_BIT_KHR',
--     the sum of @imageOffset.x@ and @extent.width@ does not equal the
--     width of the subresource specified by @imageSubresource@,
--     @extent.width@ /must/ be a multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent width>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @dstImage@
--
-- -   #VUID-VkCopyMemoryToImageInfo-imageOffset-10053# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_90_BIT_KHR',
--     the difference of @imageOffset.x@ and @extent.height@ /must/ be a
--     multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent width>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @dstImage@
--
-- -   #VUID-VkCopyMemoryToImageInfo-imageOffset-10054# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_180_BIT_KHR',
--     the difference of @imageOffset.x@ and @extent.width@ /must/ be a
--     multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent width>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @dstImage@
--
-- -   #VUID-VkCopyMemoryToImageInfo-imageOffset-10055# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_270_BIT_KHR',
--     the sum of @imageOffset.x@ and @extent.height@ does not equal the
--     width of the subresource specified by @imageSubresource@,
--     @extent.height@ /must/ be a multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent width>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @dstImage@
--
-- -   #VUID-VkCopyMemoryToImageInfo-dstImage-00208# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_IDENTITY_BIT_KHR',
--     and the sum of @imageOffset.y@ and @extent.height@ does not equal
--     the height of the subresource specified by @imageSubresource@,
--     @extent.height@ /must/ be a multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent height>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @dstImage@
--
-- -   #VUID-VkCopyMemoryToImageInfo-imageOffset-10056# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_90_BIT_KHR',
--     the sum of @imageOffset.y@ and @extent.width@ does not equal the
--     height of the subresource specified by @imageSubresource@,
--     @extent.width@ /must/ be a multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent height>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @dstImage@
--
-- -   #VUID-VkCopyMemoryToImageInfo-imageOffset-10057# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_180_BIT_KHR',
--     the difference of @imageOffset.y@ and @extent.height@ /must/ be a
--     multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent height>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @dstImage@
--
-- -   #VUID-VkCopyMemoryToImageInfo-imageOffset-10058# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_270_BIT_KHR',
--     the difference of @imageOffset.y@ and @extent.width@ /must/ be a
--     multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent height>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @dstImage@
--
-- -   #VUID-VkCopyMemoryToImageInfo-dstImage-00209# For each element of
--     @pRegions@, if the sum of @imageOffset.z@ and @extent.depth@ does
--     not equal the depth of the subresource specified by
--     @srcSubresource@, @extent.depth@ /must/ be a multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent depth>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @dstImage@
--
-- -   #VUID-VkCopyMemoryToImageInfo-imageSubresource-09105# For each
--     element of @pRegions@, @imageSubresource.aspectMask@ /must/ specify
--     aspects present in @dstImage@
--
-- -   #VUID-VkCopyMemoryToImageInfo-dstImage-07981# If @dstImage@ has a
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-multiplanar multi-planar format>,
--     then for each element of @pRegions@, @imageSubresource.aspectMask@
--     /must/ be a single valid
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-multiplanar-image-aspect multi-planar aspect mask>
--     bit
--
-- -   #VUID-VkCopyMemoryToImageInfo-dstImage-07983# If @dstImage@ is of
--     type 'Vulkan.Core10.Enums.ImageType.IMAGE_TYPE_3D', for each element
--     of @pRegions@, @imageSubresource.baseArrayLayer@ /must/ be @0@ and
--     @imageSubresource.layerCount@ /must/ be @1@
--
-- -   #VUID-VkCopyMemoryToImageInfo-memoryRowLength-09106# For each
--     element of @pRegions@, @memoryRowLength@ /must/ be a multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent width>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @dstImage@
--
-- -   #VUID-VkCopyMemoryToImageInfo-memoryImageHeight-09107# For each
--     element of @pRegions@, @memoryImageHeight@ /must/ be a multiple of
--     the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent height>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @dstImage@
--
-- -   #VUID-VkCopyMemoryToImageInfo-memoryRowLength-09108# For each
--     element of @pRegions@, @memoryRowLength@ divided by the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent width>
--     and then multiplied by the texel block size of @dstImage@ /must/ be
--     less than or equal to 231-1
--
-- -   #VUID-VkCopyMemoryToImageInfo-dstImageLayout-09059# @dstImageLayout@
--     /must/ specify the current layout of the image subresources of
--     @dstImage@ specified in @pRegions@
--
-- -   #VUID-VkCopyMemoryToImageInfo-dstImageLayout-09060# @dstImageLayout@
--     /must/ be one of the image layouts returned in
--     'PhysicalDeviceHostImageCopyProperties'::@pCopyDstLayouts@
--
-- -   #VUID-VkCopyMemoryToImageInfo-flags-09393# If @flags@ includes
--     'Vulkan.Core14.Enums.HostImageCopyFlagBits.HOST_IMAGE_COPY_MEMCPY_BIT',
--     for each region in @pRegions@, @memoryRowLength@ and
--     @memoryImageHeight@ /must/ both be 0
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkCopyMemoryToImageInfo-sType-sType# @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_COPY_MEMORY_TO_IMAGE_INFO'
--
-- -   #VUID-VkCopyMemoryToImageInfo-pNext-pNext# @pNext@ /must/ be @NULL@
--
-- -   #VUID-VkCopyMemoryToImageInfo-flags-parameter# @flags@ /must/ be a
--     valid combination of
--     'Vulkan.Core14.Enums.HostImageCopyFlagBits.HostImageCopyFlagBits'
--     values
--
-- -   #VUID-VkCopyMemoryToImageInfo-dstImage-parameter# @dstImage@ /must/
--     be a valid 'Vulkan.Core10.Handles.Image' handle
--
-- -   #VUID-VkCopyMemoryToImageInfo-dstImageLayout-parameter#
--     @dstImageLayout@ /must/ be a valid
--     'Vulkan.Core10.Enums.ImageLayout.ImageLayout' value
--
-- -   #VUID-VkCopyMemoryToImageInfo-pRegions-parameter# @pRegions@ /must/
--     be a valid pointer to an array of @regionCount@ valid
--     'MemoryToImageCopy' structures
--
-- -   #VUID-VkCopyMemoryToImageInfo-regionCount-arraylength# @regionCount@
--     /must/ be greater than @0@
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_host_image_copy VK_EXT_host_image_copy>,
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_VERSION_1_4 VK_VERSION_1_4>,
-- 'Vulkan.Core14.Enums.HostImageCopyFlagBits.HostImageCopyFlags',
-- 'Vulkan.Core10.Handles.Image',
-- 'Vulkan.Core10.Enums.ImageLayout.ImageLayout', 'MemoryToImageCopy',
-- 'Vulkan.Core10.Enums.StructureType.StructureType', 'copyMemoryToImage',
-- 'copyMemoryToImage'
data CopyMemoryToImageInfo = CopyMemoryToImageInfo
  { -- | @flags@ is a bitmask of
    -- 'Vulkan.Core14.Enums.HostImageCopyFlagBits.HostImageCopyFlagBits' values
    -- describing additional copy parameters.
    CopyMemoryToImageInfo -> HostImageCopyFlags
flags :: HostImageCopyFlags
  , -- | @dstImage@ is the destination image.
    CopyMemoryToImageInfo -> Image
dstImage :: Image
  , -- | @dstImageLayout@ is the layout of the destination image subresources for
    -- the copy.
    CopyMemoryToImageInfo -> ImageLayout
dstImageLayout :: ImageLayout
  , -- | @pRegions@ is a pointer to an array of 'MemoryToImageCopy' structures
    -- specifying the regions to copy.
    CopyMemoryToImageInfo -> Vector MemoryToImageCopy
regions :: Vector MemoryToImageCopy
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (CopyMemoryToImageInfo)
#endif
deriving instance Show CopyMemoryToImageInfo

instance ToCStruct CopyMemoryToImageInfo where
  withCStruct :: forall b.
CopyMemoryToImageInfo
-> (Ptr CopyMemoryToImageInfo -> IO b) -> IO b
withCStruct CopyMemoryToImageInfo
x Ptr CopyMemoryToImageInfo -> IO b
f = Int -> (Ptr CopyMemoryToImageInfo -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
48 ((Ptr CopyMemoryToImageInfo -> IO b) -> IO b)
-> (Ptr CopyMemoryToImageInfo -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr CopyMemoryToImageInfo
p -> Ptr CopyMemoryToImageInfo -> CopyMemoryToImageInfo -> IO b -> IO b
forall b.
Ptr CopyMemoryToImageInfo -> CopyMemoryToImageInfo -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr CopyMemoryToImageInfo
p CopyMemoryToImageInfo
x (Ptr CopyMemoryToImageInfo -> IO b
f Ptr CopyMemoryToImageInfo
p)
  pokeCStruct :: forall b.
Ptr CopyMemoryToImageInfo -> CopyMemoryToImageInfo -> IO b -> IO b
pokeCStruct Ptr CopyMemoryToImageInfo
p CopyMemoryToImageInfo{Vector MemoryToImageCopy
HostImageCopyFlags
ImageLayout
Image
flags :: CopyMemoryToImageInfo -> HostImageCopyFlags
dstImage :: CopyMemoryToImageInfo -> Image
dstImageLayout :: CopyMemoryToImageInfo -> ImageLayout
regions :: CopyMemoryToImageInfo -> Vector MemoryToImageCopy
flags :: HostImageCopyFlags
dstImage :: Image
dstImageLayout :: ImageLayout
regions :: Vector MemoryToImageCopy
..} 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 CopyMemoryToImageInfo
p Ptr CopyMemoryToImageInfo -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_COPY_MEMORY_TO_IMAGE_INFO)
    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 CopyMemoryToImageInfo
p Ptr CopyMemoryToImageInfo -> 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 HostImageCopyFlags -> HostImageCopyFlags -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyMemoryToImageInfo
p Ptr CopyMemoryToImageInfo -> Int -> Ptr HostImageCopyFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr HostImageCopyFlags)) (HostImageCopyFlags
flags)
    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 Image -> Image -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyMemoryToImageInfo
p Ptr CopyMemoryToImageInfo -> Int -> Ptr Image
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Image)) (Image
dstImage)
    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 ImageLayout -> ImageLayout -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyMemoryToImageInfo
p Ptr CopyMemoryToImageInfo -> Int -> Ptr ImageLayout
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr ImageLayout)) (ImageLayout
dstImageLayout)
    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 CopyMemoryToImageInfo
p Ptr CopyMemoryToImageInfo -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
36 :: Ptr Word32)) ((Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Vector MemoryToImageCopy -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector MemoryToImageCopy -> Int)
-> Vector MemoryToImageCopy -> Int
forall a b. (a -> b) -> a -> b
$ (Vector MemoryToImageCopy
regions)) :: Word32))
    pPRegions' <- ((Ptr MemoryToImageCopy -> IO b) -> IO b)
-> ContT b IO (Ptr MemoryToImageCopy)
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr MemoryToImageCopy -> IO b) -> IO b)
 -> ContT b IO (Ptr MemoryToImageCopy))
-> ((Ptr MemoryToImageCopy -> IO b) -> IO b)
-> ContT b IO (Ptr MemoryToImageCopy)
forall a b. (a -> b) -> a -> b
$ forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes @MemoryToImageCopy ((Vector MemoryToImageCopy -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector MemoryToImageCopy
regions)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
72)
    lift $ Data.Vector.imapM_ (\Int
i MemoryToImageCopy
e -> Ptr MemoryToImageCopy -> MemoryToImageCopy -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr MemoryToImageCopy
pPRegions' Ptr MemoryToImageCopy -> Int -> Ptr MemoryToImageCopy
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
72 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr MemoryToImageCopy) (MemoryToImageCopy
e)) (regions)
    lift $ poke ((p `plusPtr` 40 :: Ptr (Ptr MemoryToImageCopy))) (pPRegions')
    lift $ f
  cStructSize :: Int
cStructSize = Int
48
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b. Ptr CopyMemoryToImageInfo -> IO b -> IO b
pokeZeroCStruct Ptr CopyMemoryToImageInfo
p IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyMemoryToImageInfo
p Ptr CopyMemoryToImageInfo -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_COPY_MEMORY_TO_IMAGE_INFO)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyMemoryToImageInfo
p Ptr CopyMemoryToImageInfo -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Image -> Image -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyMemoryToImageInfo
p Ptr CopyMemoryToImageInfo -> Int -> Ptr Image
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Image)) (Image
forall a. Zero a => a
zero)
    Ptr ImageLayout -> ImageLayout -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyMemoryToImageInfo
p Ptr CopyMemoryToImageInfo -> Int -> Ptr ImageLayout
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr ImageLayout)) (ImageLayout
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct CopyMemoryToImageInfo where
  peekCStruct :: Ptr CopyMemoryToImageInfo -> IO CopyMemoryToImageInfo
peekCStruct Ptr CopyMemoryToImageInfo
p = do
    flags <- forall a. Storable a => Ptr a -> IO a
peek @HostImageCopyFlags ((Ptr CopyMemoryToImageInfo
p Ptr CopyMemoryToImageInfo -> Int -> Ptr HostImageCopyFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr HostImageCopyFlags))
    dstImage <- peek @Image ((p `plusPtr` 24 :: Ptr Image))
    dstImageLayout <- peek @ImageLayout ((p `plusPtr` 32 :: Ptr ImageLayout))
    regionCount <- peek @Word32 ((p `plusPtr` 36 :: Ptr Word32))
    pRegions <- peek @(Ptr MemoryToImageCopy) ((p `plusPtr` 40 :: Ptr (Ptr MemoryToImageCopy)))
    pRegions' <- generateM (fromIntegral regionCount) (\Int
i -> forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @MemoryToImageCopy ((Ptr MemoryToImageCopy
pRegions Ptr MemoryToImageCopy -> Int -> Ptr MemoryToImageCopy
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
72 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr MemoryToImageCopy)))
    pure $ CopyMemoryToImageInfo
             flags dstImage dstImageLayout pRegions'

instance Zero CopyMemoryToImageInfo where
  zero :: CopyMemoryToImageInfo
zero = HostImageCopyFlags
-> Image
-> ImageLayout
-> Vector MemoryToImageCopy
-> CopyMemoryToImageInfo
CopyMemoryToImageInfo
           HostImageCopyFlags
forall a. Zero a => a
zero
           Image
forall a. Zero a => a
zero
           ImageLayout
forall a. Zero a => a
zero
           Vector MemoryToImageCopy
forall a. Monoid a => a
mempty


-- | VkCopyImageToMemoryInfo - Structure specifying parameters of an image to
-- host memory copy command
--
-- = Description
--
-- 'copyImageToMemory' does not check whether the device memory associated
-- with @srcImage@ is currently in use before performing the copy. The
-- application /must/ guarantee that any previously submitted command that
-- writes to the copy regions has completed before the host performs the
-- copy.
--
-- Copy regions for the image /must/ be aligned to a multiple of the texel
-- block extent in each dimension, except at the edges of the image, where
-- region extents /must/ match the edge of the image.
--
-- == Valid Usage
--
-- -   #VUID-VkCopyImageToMemoryInfo-srcImage-09109# If @srcImage@ is
--     sparse then all memory ranges accessed by the copy command /must/ be
--     bound as described in
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#sparsememory-resource-binding Binding Resource Memory>
--
-- -   #VUID-VkCopyImageToMemoryInfo-srcImage-09111# If the stencil aspect
--     of @srcImage@ is accessed, and @srcImage@ was not created with
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VkImageStencilUsageCreateInfo separate stencil usage>,
--     @srcImage@ /must/ have been created with the
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_HOST_TRANSFER_BIT'
--     usage flag set
--
-- -   #VUID-VkCopyImageToMemoryInfo-srcImage-09112# If the stencil aspect
--     of @srcImage@ is accessed, and @srcImage@ was created with
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VkImageStencilUsageCreateInfo separate stencil usage>,
--     @srcImage@ /must/ have been created with the
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_HOST_TRANSFER_BIT'
--     usage flag set
--
-- -   #VUID-VkCopyImageToMemoryInfo-srcImage-09113# If non-stencil aspects
--     of @srcImage@ are accessed, @srcImage@ /must/ have been created with
--     the
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_HOST_TRANSFER_BIT'
--     usage flag set
--
-- -   #VUID-VkCopyImageToMemoryInfo-imageOffset-09114# If @flags@ contains
--     'Vulkan.Core14.Enums.HostImageCopyFlagBits.HOST_IMAGE_COPY_MEMCPY_BIT',
--     the @x@, @y@, and @z@ members of the @imageOffset@ member of each
--     element of @pRegions@ /must/ be @0@
--
-- -   #VUID-VkCopyImageToMemoryInfo-srcImage-09115# If @flags@ contains
--     'Vulkan.Core14.Enums.HostImageCopyFlagBits.HOST_IMAGE_COPY_MEMCPY_BIT',
--     the @imageExtent@ member of each element of @pRegions@ /must/ equal
--     the extents of @srcImage@ identified by @imageSubresource@
--
-- -   #VUID-VkCopyImageToMemoryInfo-srcImage-07966# If @srcImage@ is
--     non-sparse then the image or each specified /disjoint/ plane /must/
--     be bound completely and contiguously to a single
--     'Vulkan.Core10.Handles.DeviceMemory' object
--
-- -   #VUID-VkCopyImageToMemoryInfo-imageSubresource-07967# The
--     @imageSubresource.mipLevel@ member of each element of @pRegions@
--     /must/ be less than the @mipLevels@ specified in
--     'Vulkan.Core10.Image.ImageCreateInfo' when @srcImage@ was created
--
-- -   #VUID-VkCopyImageToMemoryInfo-imageSubresource-07968# If
--     @imageSubresource.layerCount@ is not
--     'Vulkan.Core10.APIConstants.REMAINING_ARRAY_LAYERS',
--     @imageSubresource.baseArrayLayer@ + @imageSubresource.layerCount@ of
--     each element of @pRegions@ /must/ be less than or equal to the
--     @arrayLayers@ specified in 'Vulkan.Core10.Image.ImageCreateInfo'
--     when @srcImage@ was created
--
-- -   #VUID-VkCopyImageToMemoryInfo-srcImage-07969# @srcImage@ /must/ not
--     have been created with @flags@ containing
--     'Vulkan.Core10.Enums.ImageCreateFlagBits.IMAGE_CREATE_SUBSAMPLED_BIT_EXT'
--
-- -   #VUID-VkCopyImageToMemoryInfo-imageSubresource-07971# For each
--     element of @pRegions@, @imageOffset.x@ and (@imageExtent.width@ +
--     @imageOffset.x@) /must/ both be greater than or equal to @0@ and
--     less than or equal to the width of the specified @imageSubresource@
--     of @srcImage@
--
-- -   #VUID-VkCopyImageToMemoryInfo-imageSubresource-07972# For each
--     element of @pRegions@, @imageOffset.y@ and (@imageExtent.height@ +
--     @imageOffset.y@) /must/ both be greater than or equal to @0@ and
--     less than or equal to the height of the specified @imageSubresource@
--     of @srcImage@
--
-- -   #VUID-VkCopyImageToMemoryInfo-srcImage-07973# @srcImage@ /must/ have
--     a sample count equal to
--     'Vulkan.Core10.Enums.SampleCountFlagBits.SAMPLE_COUNT_1_BIT'
--
-- -   #VUID-VkCopyImageToMemoryInfo-srcImage-07979# If @srcImage@ is of
--     type 'Vulkan.Core10.Enums.ImageType.IMAGE_TYPE_1D', then for each
--     element of @pRegions@, @imageOffset.y@ /must/ be @0@ and
--     @imageExtent.height@ /must/ be @1@
--
-- -   #VUID-VkCopyImageToMemoryInfo-imageOffset-09104# For each element of
--     @pRegions@, @imageOffset.z@ and (@imageExtent.depth@ +
--     @imageOffset.z@) /must/ both be greater than or equal to @0@ and
--     less than or equal to the depth of the specified @imageSubresource@
--     of @srcImage@
--
-- -   #VUID-VkCopyImageToMemoryInfo-srcImage-07980# If @srcImage@ is of
--     type 'Vulkan.Core10.Enums.ImageType.IMAGE_TYPE_1D' or
--     'Vulkan.Core10.Enums.ImageType.IMAGE_TYPE_2D', then for each element
--     of @pRegions@, @imageOffset.z@ /must/ be @0@ and @imageExtent.depth@
--     /must/ be @1@
--
-- -   #VUID-VkCopyImageToMemoryInfo-srcImage-07274# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_IDENTITY_BIT_KHR'
--     or
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_270_BIT_KHR',
--     @imageOffset.x@ /must/ be a multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent width>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @srcImage@
--
-- -   #VUID-VkCopyImageToMemoryInfo-imageOffset-10051# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_180_BIT_KHR'
--     or
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_90_BIT_KHR',
--     and @imageOffset.x@ does not equal the width of the subresource
--     specified by @imageSubresource@, @imageOffset.x@ /must/ be a
--     multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent width>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @srcImage@
--
-- -   #VUID-VkCopyImageToMemoryInfo-srcImage-07275# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_IDENTITY_BIT_KHR'
--     or
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_90_BIT_KHR',
--     @imageOffset.y@ /must/ be a multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent height>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @srcImage@
--
-- -   #VUID-VkCopyImageToMemoryInfo-imageOffset-10052# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_270_BIT_KHR'
--     or
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_180_BIT_KHR',
--     and @imageOffset.y@ does not equal the height of the subresource
--     specified by @imageSubresource@, @imageOffset.y@ /must/ be a
--     multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent height>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @srcImage@
--
-- -   #VUID-VkCopyImageToMemoryInfo-srcImage-07276# For each element of
--     @pRegions@, @imageOffset.z@ /must/ be a multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent depth>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @srcImage@
--
-- -   #VUID-VkCopyImageToMemoryInfo-srcImage-00207# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_IDENTITY_BIT_KHR',
--     the sum of @imageOffset.x@ and @extent.width@ does not equal the
--     width of the subresource specified by @imageSubresource@,
--     @extent.width@ /must/ be a multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent width>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @srcImage@
--
-- -   #VUID-VkCopyImageToMemoryInfo-imageOffset-10053# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_90_BIT_KHR',
--     the difference of @imageOffset.x@ and @extent.height@ /must/ be a
--     multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent width>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @srcImage@
--
-- -   #VUID-VkCopyImageToMemoryInfo-imageOffset-10054# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_180_BIT_KHR',
--     the difference of @imageOffset.x@ and @extent.width@ /must/ be a
--     multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent width>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @srcImage@
--
-- -   #VUID-VkCopyImageToMemoryInfo-imageOffset-10055# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_270_BIT_KHR',
--     the sum of @imageOffset.x@ and @extent.height@ does not equal the
--     width of the subresource specified by @imageSubresource@,
--     @extent.height@ /must/ be a multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent width>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @srcImage@
--
-- -   #VUID-VkCopyImageToMemoryInfo-srcImage-00208# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_IDENTITY_BIT_KHR',
--     and the sum of @imageOffset.y@ and @extent.height@ does not equal
--     the height of the subresource specified by @imageSubresource@,
--     @extent.height@ /must/ be a multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent height>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @srcImage@
--
-- -   #VUID-VkCopyImageToMemoryInfo-imageOffset-10056# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_90_BIT_KHR',
--     the sum of @imageOffset.y@ and @extent.width@ does not equal the
--     height of the subresource specified by @imageSubresource@,
--     @extent.width@ /must/ be a multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent height>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @srcImage@
--
-- -   #VUID-VkCopyImageToMemoryInfo-imageOffset-10057# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_180_BIT_KHR',
--     the difference of @imageOffset.y@ and @extent.height@ /must/ be a
--     multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent height>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @srcImage@
--
-- -   #VUID-VkCopyImageToMemoryInfo-imageOffset-10058# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_270_BIT_KHR',
--     the difference of @imageOffset.y@ and @extent.width@ /must/ be a
--     multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent height>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @srcImage@
--
-- -   #VUID-VkCopyImageToMemoryInfo-srcImage-00209# For each element of
--     @pRegions@, if the sum of @imageOffset.z@ and @extent.depth@ does
--     not equal the depth of the subresource specified by
--     @srcSubresource@, @extent.depth@ /must/ be a multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent depth>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @srcImage@
--
-- -   #VUID-VkCopyImageToMemoryInfo-imageSubresource-09105# For each
--     element of @pRegions@, @imageSubresource.aspectMask@ /must/ specify
--     aspects present in @srcImage@
--
-- -   #VUID-VkCopyImageToMemoryInfo-srcImage-07981# If @srcImage@ has a
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-multiplanar multi-planar format>,
--     then for each element of @pRegions@, @imageSubresource.aspectMask@
--     /must/ be a single valid
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-multiplanar-image-aspect multi-planar aspect mask>
--     bit
--
-- -   #VUID-VkCopyImageToMemoryInfo-srcImage-07983# If @srcImage@ is of
--     type 'Vulkan.Core10.Enums.ImageType.IMAGE_TYPE_3D', for each element
--     of @pRegions@, @imageSubresource.baseArrayLayer@ /must/ be @0@ and
--     @imageSubresource.layerCount@ /must/ be @1@
--
-- -   #VUID-VkCopyImageToMemoryInfo-memoryRowLength-09106# For each
--     element of @pRegions@, @memoryRowLength@ /must/ be a multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent width>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @srcImage@
--
-- -   #VUID-VkCopyImageToMemoryInfo-memoryImageHeight-09107# For each
--     element of @pRegions@, @memoryImageHeight@ /must/ be a multiple of
--     the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent height>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @srcImage@
--
-- -   #VUID-VkCopyImageToMemoryInfo-memoryRowLength-09108# For each
--     element of @pRegions@, @memoryRowLength@ divided by the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent width>
--     and then multiplied by the texel block size of @srcImage@ /must/ be
--     less than or equal to 231-1
--
-- -   #VUID-VkCopyImageToMemoryInfo-srcImageLayout-09064# @srcImageLayout@
--     /must/ specify the current layout of the image subresources of
--     @srcImage@ specified in @pRegions@
--
-- -   #VUID-VkCopyImageToMemoryInfo-srcImageLayout-09065# @srcImageLayout@
--     /must/ be one of the image layouts returned in
--     'PhysicalDeviceHostImageCopyProperties'::@pCopySrcLayouts@
--
-- -   #VUID-VkCopyImageToMemoryInfo-flags-09394# If @flags@ includes
--     'Vulkan.Core14.Enums.HostImageCopyFlagBits.HOST_IMAGE_COPY_MEMCPY_BIT',
--     for each region in @pRegions@, @memoryRowLength@ and
--     @memoryImageHeight@ /must/ both be 0
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkCopyImageToMemoryInfo-sType-sType# @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_COPY_IMAGE_TO_MEMORY_INFO'
--
-- -   #VUID-VkCopyImageToMemoryInfo-pNext-pNext# @pNext@ /must/ be @NULL@
--
-- -   #VUID-VkCopyImageToMemoryInfo-flags-parameter# @flags@ /must/ be a
--     valid combination of
--     'Vulkan.Core14.Enums.HostImageCopyFlagBits.HostImageCopyFlagBits'
--     values
--
-- -   #VUID-VkCopyImageToMemoryInfo-srcImage-parameter# @srcImage@ /must/
--     be a valid 'Vulkan.Core10.Handles.Image' handle
--
-- -   #VUID-VkCopyImageToMemoryInfo-srcImageLayout-parameter#
--     @srcImageLayout@ /must/ be a valid
--     'Vulkan.Core10.Enums.ImageLayout.ImageLayout' value
--
-- -   #VUID-VkCopyImageToMemoryInfo-pRegions-parameter# @pRegions@ /must/
--     be a valid pointer to an array of @regionCount@ valid
--     'ImageToMemoryCopy' structures
--
-- -   #VUID-VkCopyImageToMemoryInfo-regionCount-arraylength# @regionCount@
--     /must/ be greater than @0@
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_host_image_copy VK_EXT_host_image_copy>,
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_VERSION_1_4 VK_VERSION_1_4>,
-- 'Vulkan.Core14.Enums.HostImageCopyFlagBits.HostImageCopyFlags',
-- 'Vulkan.Core10.Handles.Image',
-- 'Vulkan.Core10.Enums.ImageLayout.ImageLayout', 'ImageToMemoryCopy',
-- 'Vulkan.Core10.Enums.StructureType.StructureType', 'copyImageToMemory',
-- 'copyImageToMemory'
data CopyImageToMemoryInfo = CopyImageToMemoryInfo
  { -- | @flags@ is a bitmask of
    -- 'Vulkan.Core14.Enums.HostImageCopyFlagBits.HostImageCopyFlagBits' values
    -- describing additional copy parameters.
    CopyImageToMemoryInfo -> HostImageCopyFlags
flags :: HostImageCopyFlags
  , -- | @srcImage@ is the source image.
    CopyImageToMemoryInfo -> Image
srcImage :: Image
  , -- | @srcImageLayout@ is the layout of the source image subresources for the
    -- copy.
    CopyImageToMemoryInfo -> ImageLayout
srcImageLayout :: ImageLayout
  , -- | @pRegions@ is a pointer to an array of 'ImageToMemoryCopy' structures
    -- specifying the regions to copy.
    CopyImageToMemoryInfo -> Vector ImageToMemoryCopy
regions :: Vector ImageToMemoryCopy
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (CopyImageToMemoryInfo)
#endif
deriving instance Show CopyImageToMemoryInfo

instance ToCStruct CopyImageToMemoryInfo where
  withCStruct :: forall b.
CopyImageToMemoryInfo
-> (Ptr CopyImageToMemoryInfo -> IO b) -> IO b
withCStruct CopyImageToMemoryInfo
x Ptr CopyImageToMemoryInfo -> IO b
f = Int -> (Ptr CopyImageToMemoryInfo -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
48 ((Ptr CopyImageToMemoryInfo -> IO b) -> IO b)
-> (Ptr CopyImageToMemoryInfo -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr CopyImageToMemoryInfo
p -> Ptr CopyImageToMemoryInfo -> CopyImageToMemoryInfo -> IO b -> IO b
forall b.
Ptr CopyImageToMemoryInfo -> CopyImageToMemoryInfo -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr CopyImageToMemoryInfo
p CopyImageToMemoryInfo
x (Ptr CopyImageToMemoryInfo -> IO b
f Ptr CopyImageToMemoryInfo
p)
  pokeCStruct :: forall b.
Ptr CopyImageToMemoryInfo -> CopyImageToMemoryInfo -> IO b -> IO b
pokeCStruct Ptr CopyImageToMemoryInfo
p CopyImageToMemoryInfo{Vector ImageToMemoryCopy
HostImageCopyFlags
ImageLayout
Image
flags :: CopyImageToMemoryInfo -> HostImageCopyFlags
srcImage :: CopyImageToMemoryInfo -> Image
srcImageLayout :: CopyImageToMemoryInfo -> ImageLayout
regions :: CopyImageToMemoryInfo -> Vector ImageToMemoryCopy
flags :: HostImageCopyFlags
srcImage :: Image
srcImageLayout :: ImageLayout
regions :: Vector ImageToMemoryCopy
..} 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 CopyImageToMemoryInfo
p Ptr CopyImageToMemoryInfo -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_COPY_IMAGE_TO_MEMORY_INFO)
    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 CopyImageToMemoryInfo
p Ptr CopyImageToMemoryInfo -> 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 HostImageCopyFlags -> HostImageCopyFlags -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyImageToMemoryInfo
p Ptr CopyImageToMemoryInfo -> Int -> Ptr HostImageCopyFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr HostImageCopyFlags)) (HostImageCopyFlags
flags)
    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 Image -> Image -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyImageToMemoryInfo
p Ptr CopyImageToMemoryInfo -> Int -> Ptr Image
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Image)) (Image
srcImage)
    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 ImageLayout -> ImageLayout -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyImageToMemoryInfo
p Ptr CopyImageToMemoryInfo -> Int -> Ptr ImageLayout
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr ImageLayout)) (ImageLayout
srcImageLayout)
    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 CopyImageToMemoryInfo
p Ptr CopyImageToMemoryInfo -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
36 :: Ptr Word32)) ((Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Vector ImageToMemoryCopy -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector ImageToMemoryCopy -> Int)
-> Vector ImageToMemoryCopy -> Int
forall a b. (a -> b) -> a -> b
$ (Vector ImageToMemoryCopy
regions)) :: Word32))
    pPRegions' <- ((Ptr ImageToMemoryCopy -> IO b) -> IO b)
-> ContT b IO (Ptr ImageToMemoryCopy)
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr ImageToMemoryCopy -> IO b) -> IO b)
 -> ContT b IO (Ptr ImageToMemoryCopy))
-> ((Ptr ImageToMemoryCopy -> IO b) -> IO b)
-> ContT b IO (Ptr ImageToMemoryCopy)
forall a b. (a -> b) -> a -> b
$ forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes @ImageToMemoryCopy ((Vector ImageToMemoryCopy -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector ImageToMemoryCopy
regions)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
72)
    lift $ Data.Vector.imapM_ (\Int
i ImageToMemoryCopy
e -> Ptr ImageToMemoryCopy -> ImageToMemoryCopy -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr ImageToMemoryCopy
pPRegions' Ptr ImageToMemoryCopy -> Int -> Ptr ImageToMemoryCopy
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
72 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr ImageToMemoryCopy) (ImageToMemoryCopy
e)) (regions)
    lift $ poke ((p `plusPtr` 40 :: Ptr (Ptr ImageToMemoryCopy))) (pPRegions')
    lift $ f
  cStructSize :: Int
cStructSize = Int
48
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b. Ptr CopyImageToMemoryInfo -> IO b -> IO b
pokeZeroCStruct Ptr CopyImageToMemoryInfo
p IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyImageToMemoryInfo
p Ptr CopyImageToMemoryInfo -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_COPY_IMAGE_TO_MEMORY_INFO)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyImageToMemoryInfo
p Ptr CopyImageToMemoryInfo -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Image -> Image -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyImageToMemoryInfo
p Ptr CopyImageToMemoryInfo -> Int -> Ptr Image
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Image)) (Image
forall a. Zero a => a
zero)
    Ptr ImageLayout -> ImageLayout -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyImageToMemoryInfo
p Ptr CopyImageToMemoryInfo -> Int -> Ptr ImageLayout
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr ImageLayout)) (ImageLayout
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct CopyImageToMemoryInfo where
  peekCStruct :: Ptr CopyImageToMemoryInfo -> IO CopyImageToMemoryInfo
peekCStruct Ptr CopyImageToMemoryInfo
p = do
    flags <- forall a. Storable a => Ptr a -> IO a
peek @HostImageCopyFlags ((Ptr CopyImageToMemoryInfo
p Ptr CopyImageToMemoryInfo -> Int -> Ptr HostImageCopyFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr HostImageCopyFlags))
    srcImage <- peek @Image ((p `plusPtr` 24 :: Ptr Image))
    srcImageLayout <- peek @ImageLayout ((p `plusPtr` 32 :: Ptr ImageLayout))
    regionCount <- peek @Word32 ((p `plusPtr` 36 :: Ptr Word32))
    pRegions <- peek @(Ptr ImageToMemoryCopy) ((p `plusPtr` 40 :: Ptr (Ptr ImageToMemoryCopy)))
    pRegions' <- generateM (fromIntegral regionCount) (\Int
i -> forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @ImageToMemoryCopy ((Ptr ImageToMemoryCopy
pRegions Ptr ImageToMemoryCopy -> Int -> Ptr ImageToMemoryCopy
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
72 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr ImageToMemoryCopy)))
    pure $ CopyImageToMemoryInfo
             flags srcImage srcImageLayout pRegions'

instance Zero CopyImageToMemoryInfo where
  zero :: CopyImageToMemoryInfo
zero = HostImageCopyFlags
-> Image
-> ImageLayout
-> Vector ImageToMemoryCopy
-> CopyImageToMemoryInfo
CopyImageToMemoryInfo
           HostImageCopyFlags
forall a. Zero a => a
zero
           Image
forall a. Zero a => a
zero
           ImageLayout
forall a. Zero a => a
zero
           Vector ImageToMemoryCopy
forall a. Monoid a => a
mempty


-- | VkCopyImageToImageInfo - Structure specifying parameters of an image to
-- image host copy command
--
-- = Description
--
-- 'copyImageToImage' does not check whether the device memory associated
-- with @srcImage@ or @dstImage@ is currently in use before performing the
-- copy. The application /must/ guarantee that any previously submitted
-- command that writes to the copy regions has completed before the host
-- performs the copy.
--
-- == Valid Usage
--
-- -   #VUID-VkCopyImageToImageInfo-srcImage-09069# @srcImage@ and
--     @dstImage@ /must/ have been created with identical image creation
--     parameters
--
-- -   #VUID-VkCopyImageToImageInfo-srcImage-09109# If @srcImage@ is sparse
--     then all memory ranges accessed by the copy command /must/ be bound
--     as described in
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#sparsememory-resource-binding Binding Resource Memory>
--
-- -   #VUID-VkCopyImageToImageInfo-srcImage-09111# If the stencil aspect
--     of @srcImage@ is accessed, and @srcImage@ was not created with
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VkImageStencilUsageCreateInfo separate stencil usage>,
--     @srcImage@ /must/ have been created with the
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_HOST_TRANSFER_BIT'
--     usage flag set
--
-- -   #VUID-VkCopyImageToImageInfo-srcImage-09112# If the stencil aspect
--     of @srcImage@ is accessed, and @srcImage@ was created with
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VkImageStencilUsageCreateInfo separate stencil usage>,
--     @srcImage@ /must/ have been created with the
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_HOST_TRANSFER_BIT'
--     usage flag set
--
-- -   #VUID-VkCopyImageToImageInfo-srcImage-09113# If non-stencil aspects
--     of @srcImage@ are accessed, @srcImage@ /must/ have been created with
--     the
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_HOST_TRANSFER_BIT'
--     usage flag set
--
-- -   #VUID-VkCopyImageToImageInfo-srcOffset-09114# If @flags@ contains
--     'Vulkan.Core14.Enums.HostImageCopyFlagBits.HOST_IMAGE_COPY_MEMCPY_BIT',
--     the @x@, @y@, and @z@ members of the @srcOffset@ member of each
--     element of @pRegions@ /must/ be @0@
--
-- -   #VUID-VkCopyImageToImageInfo-srcImage-09115# If @flags@ contains
--     'Vulkan.Core14.Enums.HostImageCopyFlagBits.HOST_IMAGE_COPY_MEMCPY_BIT',
--     the @extent@ member of each element of @pRegions@ /must/ equal the
--     extents of @srcImage@ identified by @srcSubresource@
--
-- -   #VUID-VkCopyImageToImageInfo-srcImage-07966# If @srcImage@ is
--     non-sparse then the image or each specified /disjoint/ plane /must/
--     be bound completely and contiguously to a single
--     'Vulkan.Core10.Handles.DeviceMemory' object
--
-- -   #VUID-VkCopyImageToImageInfo-srcSubresource-07967# The
--     @srcSubresource.mipLevel@ member of each element of @pRegions@
--     /must/ be less than the @mipLevels@ specified in
--     'Vulkan.Core10.Image.ImageCreateInfo' when @srcImage@ was created
--
-- -   #VUID-VkCopyImageToImageInfo-srcSubresource-07968# If
--     @srcSubresource.layerCount@ is not
--     'Vulkan.Core10.APIConstants.REMAINING_ARRAY_LAYERS',
--     @srcSubresource.baseArrayLayer@ + @srcSubresource.layerCount@ of
--     each element of @pRegions@ /must/ be less than or equal to the
--     @arrayLayers@ specified in 'Vulkan.Core10.Image.ImageCreateInfo'
--     when @srcImage@ was created
--
-- -   #VUID-VkCopyImageToImageInfo-srcImage-07969# @srcImage@ /must/ not
--     have been created with @flags@ containing
--     'Vulkan.Core10.Enums.ImageCreateFlagBits.IMAGE_CREATE_SUBSAMPLED_BIT_EXT'
--
-- -   #VUID-VkCopyImageToImageInfo-srcSubresource-07971# For each element
--     of @pRegions@, @srcOffset.x@ and (@extent.width@ + @srcOffset.x@)
--     /must/ both be greater than or equal to @0@ and less than or equal
--     to the width of the specified @srcSubresource@ of @srcImage@
--
-- -   #VUID-VkCopyImageToImageInfo-srcSubresource-07972# For each element
--     of @pRegions@, @srcOffset.y@ and (@extent.height@ + @srcOffset.y@)
--     /must/ both be greater than or equal to @0@ and less than or equal
--     to the height of the specified @srcSubresource@ of @srcImage@
--
-- -   #VUID-VkCopyImageToImageInfo-srcImage-07979# If @srcImage@ is of
--     type 'Vulkan.Core10.Enums.ImageType.IMAGE_TYPE_1D', then for each
--     element of @pRegions@, @srcOffset.y@ /must/ be @0@ and
--     @extent.height@ /must/ be @1@
--
-- -   #VUID-VkCopyImageToImageInfo-srcOffset-09104# For each element of
--     @pRegions@, @srcOffset.z@ and (@extent.depth@ + @srcOffset.z@)
--     /must/ both be greater than or equal to @0@ and less than or equal
--     to the depth of the specified @srcSubresource@ of @srcImage@
--
-- -   #VUID-VkCopyImageToImageInfo-srcImage-07980# If @srcImage@ is of
--     type 'Vulkan.Core10.Enums.ImageType.IMAGE_TYPE_1D' or
--     'Vulkan.Core10.Enums.ImageType.IMAGE_TYPE_2D', then for each element
--     of @pRegions@, @srcOffset.z@ /must/ be @0@ and @extent.depth@ /must/
--     be @1@
--
-- -   #VUID-VkCopyImageToImageInfo-srcImage-07274# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_IDENTITY_BIT_KHR'
--     or
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_270_BIT_KHR',
--     @srcOffset.x@ /must/ be a multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent width>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @srcImage@
--
-- -   #VUID-VkCopyImageToImageInfo-srcOffset-10051# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_180_BIT_KHR'
--     or
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_90_BIT_KHR',
--     and @srcOffset.x@ does not equal the width of the subresource
--     specified by @srcSubresource@, @srcOffset.x@ /must/ be a multiple of
--     the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent width>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @srcImage@
--
-- -   #VUID-VkCopyImageToImageInfo-srcImage-07275# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_IDENTITY_BIT_KHR'
--     or
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_90_BIT_KHR',
--     @srcOffset.y@ /must/ be a multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent height>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @srcImage@
--
-- -   #VUID-VkCopyImageToImageInfo-srcOffset-10052# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_270_BIT_KHR'
--     or
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_180_BIT_KHR',
--     and @srcOffset.y@ does not equal the height of the subresource
--     specified by @srcSubresource@, @srcOffset.y@ /must/ be a multiple of
--     the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent height>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @srcImage@
--
-- -   #VUID-VkCopyImageToImageInfo-srcImage-07276# For each element of
--     @pRegions@, @srcOffset.z@ /must/ be a multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent depth>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @srcImage@
--
-- -   #VUID-VkCopyImageToImageInfo-srcImage-00207# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_IDENTITY_BIT_KHR',
--     the sum of @srcOffset.x@ and @extent.width@ does not equal the width
--     of the subresource specified by @srcSubresource@, @extent.width@
--     /must/ be a multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent width>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @srcImage@
--
-- -   #VUID-VkCopyImageToImageInfo-srcOffset-10053# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_90_BIT_KHR',
--     the difference of @srcOffset.x@ and @extent.height@ /must/ be a
--     multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent width>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @srcImage@
--
-- -   #VUID-VkCopyImageToImageInfo-srcOffset-10054# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_180_BIT_KHR',
--     the difference of @srcOffset.x@ and @extent.width@ /must/ be a
--     multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent width>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @srcImage@
--
-- -   #VUID-VkCopyImageToImageInfo-srcOffset-10055# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_270_BIT_KHR',
--     the sum of @srcOffset.x@ and @extent.height@ does not equal the
--     width of the subresource specified by @srcSubresource@,
--     @extent.height@ /must/ be a multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent width>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @srcImage@
--
-- -   #VUID-VkCopyImageToImageInfo-srcImage-00208# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_IDENTITY_BIT_KHR',
--     and the sum of @srcOffset.y@ and @extent.height@ does not equal the
--     height of the subresource specified by @srcSubresource@,
--     @extent.height@ /must/ be a multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent height>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @srcImage@
--
-- -   #VUID-VkCopyImageToImageInfo-srcOffset-10056# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_90_BIT_KHR',
--     the sum of @srcOffset.y@ and @extent.width@ does not equal the
--     height of the subresource specified by @srcSubresource@,
--     @extent.width@ /must/ be a multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent height>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @srcImage@
--
-- -   #VUID-VkCopyImageToImageInfo-srcOffset-10057# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_180_BIT_KHR',
--     the difference of @srcOffset.y@ and @extent.height@ /must/ be a
--     multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent height>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @srcImage@
--
-- -   #VUID-VkCopyImageToImageInfo-srcOffset-10058# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_270_BIT_KHR',
--     the difference of @srcOffset.y@ and @extent.width@ /must/ be a
--     multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent height>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @srcImage@
--
-- -   #VUID-VkCopyImageToImageInfo-srcImage-00209# For each element of
--     @pRegions@, if the sum of @srcOffset.z@ and @extent.depth@ does not
--     equal the depth of the subresource specified by @srcSubresource@,
--     @extent.depth@ /must/ be a multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent depth>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @srcImage@
--
-- -   #VUID-VkCopyImageToImageInfo-srcSubresource-09105# For each element
--     of @pRegions@, @srcSubresource.aspectMask@ /must/ specify aspects
--     present in @srcImage@
--
-- -   #VUID-VkCopyImageToImageInfo-srcImage-07981# If @srcImage@ has a
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-multiplanar multi-planar format>,
--     then for each element of @pRegions@, @srcSubresource.aspectMask@
--     /must/ be a single valid
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-multiplanar-image-aspect multi-planar aspect mask>
--     bit
--
-- -   #VUID-VkCopyImageToImageInfo-srcImage-07983# If @srcImage@ is of
--     type 'Vulkan.Core10.Enums.ImageType.IMAGE_TYPE_3D', for each element
--     of @pRegions@, @srcSubresource.baseArrayLayer@ /must/ be @0@ and
--     @srcSubresource.layerCount@ /must/ be @1@
--
-- -   #VUID-VkCopyImageToImageInfo-dstImage-09109# If @dstImage@ is sparse
--     then all memory ranges accessed by the copy command /must/ be bound
--     as described in
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#sparsememory-resource-binding Binding Resource Memory>
--
-- -   #VUID-VkCopyImageToImageInfo-dstImage-09111# If the stencil aspect
--     of @dstImage@ is accessed, and @dstImage@ was not created with
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VkImageStencilUsageCreateInfo separate stencil usage>,
--     @dstImage@ /must/ have been created with the
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_HOST_TRANSFER_BIT'
--     usage flag set
--
-- -   #VUID-VkCopyImageToImageInfo-dstImage-09112# If the stencil aspect
--     of @dstImage@ is accessed, and @dstImage@ was created with
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VkImageStencilUsageCreateInfo separate stencil usage>,
--     @dstImage@ /must/ have been created with the
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_HOST_TRANSFER_BIT'
--     usage flag set
--
-- -   #VUID-VkCopyImageToImageInfo-dstImage-09113# If non-stencil aspects
--     of @dstImage@ are accessed, @dstImage@ /must/ have been created with
--     the
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_HOST_TRANSFER_BIT'
--     usage flag set
--
-- -   #VUID-VkCopyImageToImageInfo-dstOffset-09114# If @flags@ contains
--     'Vulkan.Core14.Enums.HostImageCopyFlagBits.HOST_IMAGE_COPY_MEMCPY_BIT',
--     the @x@, @y@, and @z@ members of the @dstOffset@ member of each
--     element of @pRegions@ /must/ be @0@
--
-- -   #VUID-VkCopyImageToImageInfo-dstImage-09115# If @flags@ contains
--     'Vulkan.Core14.Enums.HostImageCopyFlagBits.HOST_IMAGE_COPY_MEMCPY_BIT',
--     the @extent@ member of each element of @pRegions@ /must/ equal the
--     extents of @dstImage@ identified by @dstSubresource@
--
-- -   #VUID-VkCopyImageToImageInfo-dstImage-07966# If @dstImage@ is
--     non-sparse then the image or each specified /disjoint/ plane /must/
--     be bound completely and contiguously to a single
--     'Vulkan.Core10.Handles.DeviceMemory' object
--
-- -   #VUID-VkCopyImageToImageInfo-dstSubresource-07967# The
--     @dstSubresource.mipLevel@ member of each element of @pRegions@
--     /must/ be less than the @mipLevels@ specified in
--     'Vulkan.Core10.Image.ImageCreateInfo' when @dstImage@ was created
--
-- -   #VUID-VkCopyImageToImageInfo-dstSubresource-07968# If
--     @dstSubresource.layerCount@ is not
--     'Vulkan.Core10.APIConstants.REMAINING_ARRAY_LAYERS',
--     @dstSubresource.baseArrayLayer@ + @dstSubresource.layerCount@ of
--     each element of @pRegions@ /must/ be less than or equal to the
--     @arrayLayers@ specified in 'Vulkan.Core10.Image.ImageCreateInfo'
--     when @dstImage@ was created
--
-- -   #VUID-VkCopyImageToImageInfo-dstImage-07969# @dstImage@ /must/ not
--     have been created with @flags@ containing
--     'Vulkan.Core10.Enums.ImageCreateFlagBits.IMAGE_CREATE_SUBSAMPLED_BIT_EXT'
--
-- -   #VUID-VkCopyImageToImageInfo-dstSubresource-07971# For each element
--     of @pRegions@, @dstOffset.x@ and (@extent.width@ + @dstOffset.x@)
--     /must/ both be greater than or equal to @0@ and less than or equal
--     to the width of the specified @dstSubresource@ of @dstImage@
--
-- -   #VUID-VkCopyImageToImageInfo-dstSubresource-07972# For each element
--     of @pRegions@, @dstOffset.y@ and (@extent.height@ + @dstOffset.y@)
--     /must/ both be greater than or equal to @0@ and less than or equal
--     to the height of the specified @dstSubresource@ of @dstImage@
--
-- -   #VUID-VkCopyImageToImageInfo-dstImage-07979# If @dstImage@ is of
--     type 'Vulkan.Core10.Enums.ImageType.IMAGE_TYPE_1D', then for each
--     element of @pRegions@, @dstOffset.y@ /must/ be @0@ and
--     @extent.height@ /must/ be @1@
--
-- -   #VUID-VkCopyImageToImageInfo-dstOffset-09104# For each element of
--     @pRegions@, @dstOffset.z@ and (@extent.depth@ + @dstOffset.z@)
--     /must/ both be greater than or equal to @0@ and less than or equal
--     to the depth of the specified @dstSubresource@ of @dstImage@
--
-- -   #VUID-VkCopyImageToImageInfo-dstImage-07980# If @dstImage@ is of
--     type 'Vulkan.Core10.Enums.ImageType.IMAGE_TYPE_1D' or
--     'Vulkan.Core10.Enums.ImageType.IMAGE_TYPE_2D', then for each element
--     of @pRegions@, @dstOffset.z@ /must/ be @0@ and @extent.depth@ /must/
--     be @1@
--
-- -   #VUID-VkCopyImageToImageInfo-dstImage-07274# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_IDENTITY_BIT_KHR'
--     or
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_270_BIT_KHR',
--     @dstOffset.x@ /must/ be a multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent width>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @dstImage@
--
-- -   #VUID-VkCopyImageToImageInfo-dstOffset-10051# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_180_BIT_KHR'
--     or
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_90_BIT_KHR',
--     and @dstOffset.x@ does not equal the width of the subresource
--     specified by @dstSubresource@, @dstOffset.x@ /must/ be a multiple of
--     the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent width>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @dstImage@
--
-- -   #VUID-VkCopyImageToImageInfo-dstImage-07275# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_IDENTITY_BIT_KHR'
--     or
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_90_BIT_KHR',
--     @dstOffset.y@ /must/ be a multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent height>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @dstImage@
--
-- -   #VUID-VkCopyImageToImageInfo-dstOffset-10052# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_270_BIT_KHR'
--     or
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_180_BIT_KHR',
--     and @dstOffset.y@ does not equal the height of the subresource
--     specified by @dstSubresource@, @dstOffset.y@ /must/ be a multiple of
--     the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent height>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @dstImage@
--
-- -   #VUID-VkCopyImageToImageInfo-dstImage-07276# For each element of
--     @pRegions@, @dstOffset.z@ /must/ be a multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent depth>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @dstImage@
--
-- -   #VUID-VkCopyImageToImageInfo-dstImage-00207# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_IDENTITY_BIT_KHR',
--     the sum of @dstOffset.x@ and @extent.width@ does not equal the width
--     of the subresource specified by @dstSubresource@, @extent.width@
--     /must/ be a multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent width>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @dstImage@
--
-- -   #VUID-VkCopyImageToImageInfo-dstOffset-10053# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_90_BIT_KHR',
--     the difference of @dstOffset.x@ and @extent.height@ /must/ be a
--     multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent width>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @dstImage@
--
-- -   #VUID-VkCopyImageToImageInfo-dstOffset-10054# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_180_BIT_KHR',
--     the difference of @dstOffset.x@ and @extent.width@ /must/ be a
--     multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent width>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @dstImage@
--
-- -   #VUID-VkCopyImageToImageInfo-dstOffset-10055# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_270_BIT_KHR',
--     the sum of @dstOffset.x@ and @extent.height@ does not equal the
--     width of the subresource specified by @dstSubresource@,
--     @extent.height@ /must/ be a multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent width>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @dstImage@
--
-- -   #VUID-VkCopyImageToImageInfo-dstImage-00208# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_IDENTITY_BIT_KHR',
--     and the sum of @dstOffset.y@ and @extent.height@ does not equal the
--     height of the subresource specified by @dstSubresource@,
--     @extent.height@ /must/ be a multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent height>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @dstImage@
--
-- -   #VUID-VkCopyImageToImageInfo-dstOffset-10056# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_90_BIT_KHR',
--     the sum of @dstOffset.y@ and @extent.width@ does not equal the
--     height of the subresource specified by @dstSubresource@,
--     @extent.width@ /must/ be a multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent height>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @dstImage@
--
-- -   #VUID-VkCopyImageToImageInfo-dstOffset-10057# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_180_BIT_KHR',
--     the difference of @dstOffset.y@ and @extent.height@ /must/ be a
--     multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent height>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @dstImage@
--
-- -   #VUID-VkCopyImageToImageInfo-dstOffset-10058# For each element of
--     @pRegions@, if
--     'Vulkan.Extensions.VK_QCOM_rotated_copy_commands.CopyCommandTransformInfoQCOM'::@transform@
--     is equal to
--     'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_270_BIT_KHR',
--     the difference of @dstOffset.y@ and @extent.width@ /must/ be a
--     multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent height>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @dstImage@
--
-- -   #VUID-VkCopyImageToImageInfo-dstImage-00209# For each element of
--     @pRegions@, if the sum of @dstOffset.z@ and @extent.depth@ does not
--     equal the depth of the subresource specified by @srcSubresource@,
--     @extent.depth@ /must/ be a multiple of the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility-classes texel block extent depth>
--     of the 'Vulkan.Core10.Enums.Format.Format' of @dstImage@
--
-- -   #VUID-VkCopyImageToImageInfo-dstSubresource-09105# For each element
--     of @pRegions@, @dstSubresource.aspectMask@ /must/ specify aspects
--     present in @dstImage@
--
-- -   #VUID-VkCopyImageToImageInfo-dstImage-07981# If @dstImage@ has a
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-multiplanar multi-planar format>,
--     then for each element of @pRegions@, @dstSubresource.aspectMask@
--     /must/ be a single valid
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-multiplanar-image-aspect multi-planar aspect mask>
--     bit
--
-- -   #VUID-VkCopyImageToImageInfo-dstImage-07983# If @dstImage@ is of
--     type 'Vulkan.Core10.Enums.ImageType.IMAGE_TYPE_3D', for each element
--     of @pRegions@, @dstSubresource.baseArrayLayer@ /must/ be @0@ and
--     @dstSubresource.layerCount@ /must/ be @1@
--
-- -   #VUID-VkCopyImageToImageInfo-srcImageLayout-09070# @srcImageLayout@
--     /must/ specify the current layout of the image subresources of
--     @srcImage@ specified in @pRegions@
--
-- -   #VUID-VkCopyImageToImageInfo-dstImageLayout-09071# @dstImageLayout@
--     /must/ specify the current layout of the image subresources of
--     @dstImage@ specified in @pRegions@
--
-- -   #VUID-VkCopyImageToImageInfo-srcImageLayout-09072# @srcImageLayout@
--     /must/ be one of the image layouts returned in
--     'PhysicalDeviceHostImageCopyProperties'::@pCopySrcLayouts@
--
-- -   #VUID-VkCopyImageToImageInfo-dstImageLayout-09073# @dstImageLayout@
--     /must/ be one of the image layouts returned in
--     'PhysicalDeviceHostImageCopyProperties'::@pCopyDstLayouts@
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkCopyImageToImageInfo-sType-sType# @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_COPY_IMAGE_TO_IMAGE_INFO'
--
-- -   #VUID-VkCopyImageToImageInfo-pNext-pNext# @pNext@ /must/ be @NULL@
--
-- -   #VUID-VkCopyImageToImageInfo-flags-parameter# @flags@ /must/ be a
--     valid combination of
--     'Vulkan.Core14.Enums.HostImageCopyFlagBits.HostImageCopyFlagBits'
--     values
--
-- -   #VUID-VkCopyImageToImageInfo-srcImage-parameter# @srcImage@ /must/
--     be a valid 'Vulkan.Core10.Handles.Image' handle
--
-- -   #VUID-VkCopyImageToImageInfo-srcImageLayout-parameter#
--     @srcImageLayout@ /must/ be a valid
--     'Vulkan.Core10.Enums.ImageLayout.ImageLayout' value
--
-- -   #VUID-VkCopyImageToImageInfo-dstImage-parameter# @dstImage@ /must/
--     be a valid 'Vulkan.Core10.Handles.Image' handle
--
-- -   #VUID-VkCopyImageToImageInfo-dstImageLayout-parameter#
--     @dstImageLayout@ /must/ be a valid
--     'Vulkan.Core10.Enums.ImageLayout.ImageLayout' value
--
-- -   #VUID-VkCopyImageToImageInfo-pRegions-parameter# @pRegions@ /must/
--     be a valid pointer to an array of @regionCount@ valid
--     'Vulkan.Core13.Promoted_From_VK_KHR_copy_commands2.ImageCopy2'
--     structures
--
-- -   #VUID-VkCopyImageToImageInfo-regionCount-arraylength# @regionCount@
--     /must/ be greater than @0@
--
-- -   #VUID-VkCopyImageToImageInfo-commonparent# Both of @dstImage@, and
--     @srcImage@ /must/ have been created, allocated, or retrieved from
--     the same 'Vulkan.Core10.Handles.Device'
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_host_image_copy VK_EXT_host_image_copy>,
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_VERSION_1_4 VK_VERSION_1_4>,
-- 'Vulkan.Core14.Enums.HostImageCopyFlagBits.HostImageCopyFlags',
-- 'Vulkan.Core10.Handles.Image',
-- 'Vulkan.Core13.Promoted_From_VK_KHR_copy_commands2.ImageCopy2',
-- 'Vulkan.Core10.Enums.ImageLayout.ImageLayout',
-- 'Vulkan.Core10.Enums.StructureType.StructureType', 'copyImageToImage',
-- 'copyImageToImage'
data CopyImageToImageInfo = CopyImageToImageInfo
  { -- | @flags@ is a bitmask of
    -- 'Vulkan.Core14.Enums.HostImageCopyFlagBits.HostImageCopyFlagBits' values
    -- describing additional copy parameters.
    CopyImageToImageInfo -> HostImageCopyFlags
flags :: HostImageCopyFlags
  , -- | @srcImage@ is the source image.
    CopyImageToImageInfo -> Image
srcImage :: Image
  , -- | @srcImageLayout@ is the layout of the source image subresources for the
    -- copy.
    CopyImageToImageInfo -> ImageLayout
srcImageLayout :: ImageLayout
  , -- | @dstImage@ is the destination image.
    CopyImageToImageInfo -> Image
dstImage :: Image
  , -- | @dstImageLayout@ is the layout of the destination image subresources for
    -- the copy.
    CopyImageToImageInfo -> ImageLayout
dstImageLayout :: ImageLayout
  , -- | @pRegions@ is a pointer to an array of
    -- 'Vulkan.Core13.Promoted_From_VK_KHR_copy_commands2.ImageCopy2'
    -- structures specifying the regions to copy.
    CopyImageToImageInfo -> Vector ImageCopy2
regions :: Vector ImageCopy2
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (CopyImageToImageInfo)
#endif
deriving instance Show CopyImageToImageInfo

instance ToCStruct CopyImageToImageInfo where
  withCStruct :: forall b.
CopyImageToImageInfo -> (Ptr CopyImageToImageInfo -> IO b) -> IO b
withCStruct CopyImageToImageInfo
x Ptr CopyImageToImageInfo -> IO b
f = Int -> (Ptr CopyImageToImageInfo -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
64 ((Ptr CopyImageToImageInfo -> IO b) -> IO b)
-> (Ptr CopyImageToImageInfo -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr CopyImageToImageInfo
p -> Ptr CopyImageToImageInfo -> CopyImageToImageInfo -> IO b -> IO b
forall b.
Ptr CopyImageToImageInfo -> CopyImageToImageInfo -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr CopyImageToImageInfo
p CopyImageToImageInfo
x (Ptr CopyImageToImageInfo -> IO b
f Ptr CopyImageToImageInfo
p)
  pokeCStruct :: forall b.
Ptr CopyImageToImageInfo -> CopyImageToImageInfo -> IO b -> IO b
pokeCStruct Ptr CopyImageToImageInfo
p CopyImageToImageInfo{Vector ImageCopy2
HostImageCopyFlags
ImageLayout
Image
flags :: CopyImageToImageInfo -> HostImageCopyFlags
srcImage :: CopyImageToImageInfo -> Image
srcImageLayout :: CopyImageToImageInfo -> ImageLayout
dstImage :: CopyImageToImageInfo -> Image
dstImageLayout :: CopyImageToImageInfo -> ImageLayout
regions :: CopyImageToImageInfo -> Vector ImageCopy2
flags :: HostImageCopyFlags
srcImage :: Image
srcImageLayout :: ImageLayout
dstImage :: Image
dstImageLayout :: ImageLayout
regions :: Vector ImageCopy2
..} 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 CopyImageToImageInfo
p Ptr CopyImageToImageInfo -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_COPY_IMAGE_TO_IMAGE_INFO)
    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 CopyImageToImageInfo
p Ptr CopyImageToImageInfo -> 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 HostImageCopyFlags -> HostImageCopyFlags -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyImageToImageInfo
p Ptr CopyImageToImageInfo -> Int -> Ptr HostImageCopyFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr HostImageCopyFlags)) (HostImageCopyFlags
flags)
    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 Image -> Image -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyImageToImageInfo
p Ptr CopyImageToImageInfo -> Int -> Ptr Image
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Image)) (Image
srcImage)
    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 ImageLayout -> ImageLayout -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyImageToImageInfo
p Ptr CopyImageToImageInfo -> Int -> Ptr ImageLayout
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr ImageLayout)) (ImageLayout
srcImageLayout)
    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 Image -> Image -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyImageToImageInfo
p Ptr CopyImageToImageInfo -> Int -> Ptr Image
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
40 :: Ptr Image)) (Image
dstImage)
    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 ImageLayout -> ImageLayout -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyImageToImageInfo
p Ptr CopyImageToImageInfo -> Int -> Ptr ImageLayout
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
48 :: Ptr ImageLayout)) (ImageLayout
dstImageLayout)
    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 CopyImageToImageInfo
p Ptr CopyImageToImageInfo -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
52 :: Ptr Word32)) ((Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Vector ImageCopy2 -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector ImageCopy2 -> Int) -> Vector ImageCopy2 -> Int
forall a b. (a -> b) -> a -> b
$ (Vector ImageCopy2
regions)) :: Word32))
    pPRegions' <- ((Ptr ImageCopy2 -> IO b) -> IO b) -> ContT b IO (Ptr ImageCopy2)
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr ImageCopy2 -> IO b) -> IO b) -> ContT b IO (Ptr ImageCopy2))
-> ((Ptr ImageCopy2 -> IO b) -> IO b)
-> ContT b IO (Ptr ImageCopy2)
forall a b. (a -> b) -> a -> b
$ forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes @ImageCopy2 ((Vector ImageCopy2 -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector ImageCopy2
regions)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
88)
    lift $ Data.Vector.imapM_ (\Int
i ImageCopy2
e -> Ptr ImageCopy2 -> ImageCopy2 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr ImageCopy2
pPRegions' Ptr ImageCopy2 -> Int -> Ptr ImageCopy2
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
88 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr ImageCopy2) (ImageCopy2
e)) (regions)
    lift $ poke ((p `plusPtr` 56 :: Ptr (Ptr ImageCopy2))) (pPRegions')
    lift $ f
  cStructSize :: Int
cStructSize = Int
64
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b. Ptr CopyImageToImageInfo -> IO b -> IO b
pokeZeroCStruct Ptr CopyImageToImageInfo
p IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyImageToImageInfo
p Ptr CopyImageToImageInfo -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_COPY_IMAGE_TO_IMAGE_INFO)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyImageToImageInfo
p Ptr CopyImageToImageInfo -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Image -> Image -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyImageToImageInfo
p Ptr CopyImageToImageInfo -> Int -> Ptr Image
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Image)) (Image
forall a. Zero a => a
zero)
    Ptr ImageLayout -> ImageLayout -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyImageToImageInfo
p Ptr CopyImageToImageInfo -> Int -> Ptr ImageLayout
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr ImageLayout)) (ImageLayout
forall a. Zero a => a
zero)
    Ptr Image -> Image -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyImageToImageInfo
p Ptr CopyImageToImageInfo -> Int -> Ptr Image
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
40 :: Ptr Image)) (Image
forall a. Zero a => a
zero)
    Ptr ImageLayout -> ImageLayout -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyImageToImageInfo
p Ptr CopyImageToImageInfo -> Int -> Ptr ImageLayout
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
48 :: Ptr ImageLayout)) (ImageLayout
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct CopyImageToImageInfo where
  peekCStruct :: Ptr CopyImageToImageInfo -> IO CopyImageToImageInfo
peekCStruct Ptr CopyImageToImageInfo
p = do
    flags <- forall a. Storable a => Ptr a -> IO a
peek @HostImageCopyFlags ((Ptr CopyImageToImageInfo
p Ptr CopyImageToImageInfo -> Int -> Ptr HostImageCopyFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr HostImageCopyFlags))
    srcImage <- peek @Image ((p `plusPtr` 24 :: Ptr Image))
    srcImageLayout <- peek @ImageLayout ((p `plusPtr` 32 :: Ptr ImageLayout))
    dstImage <- peek @Image ((p `plusPtr` 40 :: Ptr Image))
    dstImageLayout <- peek @ImageLayout ((p `plusPtr` 48 :: Ptr ImageLayout))
    regionCount <- peek @Word32 ((p `plusPtr` 52 :: Ptr Word32))
    pRegions <- peek @(Ptr ImageCopy2) ((p `plusPtr` 56 :: Ptr (Ptr ImageCopy2)))
    pRegions' <- generateM (fromIntegral regionCount) (\Int
i -> forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @ImageCopy2 ((Ptr ImageCopy2
pRegions Ptr ImageCopy2 -> Int -> Ptr ImageCopy2
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
88 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr ImageCopy2)))
    pure $ CopyImageToImageInfo
             flags srcImage srcImageLayout dstImage dstImageLayout pRegions'

instance Zero CopyImageToImageInfo where
  zero :: CopyImageToImageInfo
zero = HostImageCopyFlags
-> Image
-> ImageLayout
-> Image
-> ImageLayout
-> Vector ImageCopy2
-> CopyImageToImageInfo
CopyImageToImageInfo
           HostImageCopyFlags
forall a. Zero a => a
zero
           Image
forall a. Zero a => a
zero
           ImageLayout
forall a. Zero a => a
zero
           Image
forall a. Zero a => a
zero
           ImageLayout
forall a. Zero a => a
zero
           Vector ImageCopy2
forall a. Monoid a => a
mempty


-- | VkHostImageLayoutTransitionInfo - Structure specifying the parameters of
-- a host-side image layout transition
--
-- = Description
--
-- 'transitionImageLayout' does not check whether the device memory
-- associated with an image is currently in use before performing the
-- layout transition. The application /must/ guarantee that any previously
-- submitted command that reads from or writes to this subresource has
-- completed before the host performs the layout transition. The memory of
-- @image@ is accessed by the host as if
-- <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#memory-coherent coherent>.
--
-- If @image@ is a 3D image created with
-- 'Vulkan.Core10.Enums.ImageCreateFlagBits.IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT'
-- and the
-- <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#features-maintenance9 maintenance9>
-- feature is enabled, the @baseArrayLayer@ and @layerCount@ members of
-- @subresourceRange@ specify the subset of slices of the 3D image affected
-- by the memory barrier, including the layout transition. Any slices of a
-- 3D image not included in @subresourceRange@ are not affected by the
-- memory barrier and remain in their existing layout.
--
-- Image layout transitions performed on the host do not require queue
-- family ownership transfers as the physical layout of the image will not
-- vary between queue families for the layouts supported by this function.
--
-- If the device has written to the image memory, it is not automatically
-- made available to the host. Before this command can be called, a memory
-- barrier for this image /must/ have been issued on the device with the
-- second
-- <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#synchronization-dependencies-scopes synchronization scope>
-- including
-- 'Vulkan.Core10.Enums.PipelineStageFlagBits.PIPELINE_STAGE_HOST_BIT' and
-- 'Vulkan.Core10.Enums.AccessFlagBits.ACCESS_HOST_READ_BIT'.
--
-- Because queue submissions
-- <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#synchronization-submission-host-writes automatically make host memory visible to the device>,
-- there would not be a need for a memory barrier before using the results
-- of this layout transition on the device.
--
-- == Valid Usage
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-image-09055# @image@ /must/
--     have been created with the
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_HOST_TRANSFER_BIT'
--     usage flag set
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-subresourceRange-01486#
--     @subresourceRange.baseMipLevel@ /must/ be less than the @mipLevels@
--     specified in 'Vulkan.Core10.Image.ImageCreateInfo' when @image@ was
--     created
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-subresourceRange-01724# If
--     @subresourceRange.levelCount@ is not
--     'Vulkan.Core10.APIConstants.REMAINING_MIP_LEVELS',
--     @subresourceRange.baseMipLevel@ + @subresourceRange.levelCount@
--     /must/ be less than or equal to the @mipLevels@ specified in
--     'Vulkan.Core10.Image.ImageCreateInfo' when @image@ was created
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-subresourceRange-01488# If
--     @image@ is not a 3D image or was created without
--     'Vulkan.Core10.Enums.ImageCreateFlagBits.IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT'
--     set, or the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#features-maintenance9 maintenance9>
--     feature is not enabled, @subresourceRange.baseArrayLayer@ /must/ be
--     less than the @arrayLayers@ specified in
--     'Vulkan.Core10.Image.ImageCreateInfo' when @image@ was created
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-maintenance9-10798# If the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#features-maintenance9 maintenance9>
--     feature is enabled and @image@ is a 3D image created with
--     'Vulkan.Core10.Enums.ImageCreateFlagBits.IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT'
--     set, @subresourceRange.baseArrayLayer@ /must/ be less than the depth
--     computed from @baseMipLevel@ and @extent.depth@ specified in
--     'Vulkan.Core10.Image.ImageCreateInfo' when @image@ was created,
--     according to the formula defined in
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#resources-image-mip-level-sizing Image Mip Level Sizing>
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-maintenance9-10799# If the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#features-maintenance9 maintenance9>
--     feature is enabled and @image@ is a 3D image created with
--     'Vulkan.Core10.Enums.ImageCreateFlagBits.IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT'
--     set and either @subresourceRange.baseArrayLayer@ is not equal to 0
--     or @subresourceRange.layerCount@ is not equal to
--     'Vulkan.Core10.APIConstants.REMAINING_ARRAY_LAYERS',
--     @subresourceRange.levelCount@ /must/ be 1
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-subresourceRange-01725# If
--     @image@ is not a 3D image or was created without
--     'Vulkan.Core10.Enums.ImageCreateFlagBits.IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT'
--     set, or the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#features-maintenance9 maintenance9>
--     feature is not enabled, and @subresourceRange.layerCount@ is not
--     'Vulkan.Core10.APIConstants.REMAINING_ARRAY_LAYERS',
--     @subresourceRange.baseArrayLayer@ + @subresourceRange.layerCount@
--     /must/ be less than or equal to the @arrayLayers@ specified in
--     'Vulkan.Core10.Image.ImageCreateInfo' when @image@ was created
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-maintenance9-10800# If the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#features-maintenance9 maintenance9>
--     feature is enabled, @subresourceRange.layerCount@ is not
--     'Vulkan.Core10.APIConstants.REMAINING_ARRAY_LAYERS', and @image@ is
--     a 3D image created with
--     'Vulkan.Core10.Enums.ImageCreateFlagBits.IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT'
--     set, @subresourceRange.baseArrayLayer@ +
--     @subresourceRange.layerCount@ /must/ be less than or equal to the
--     depth computed from @baseMipLevel@ and @extent.depth@ specified in
--     'Vulkan.Core10.Image.ImageCreateInfo' when @image@ was created,
--     according to the formula defined in
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#resources-image-mip-level-sizing Image Mip Level Sizing>
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-image-01932# If @image@ is
--     non-sparse then the image or each specified /disjoint/ plane /must/
--     be bound completely and contiguously to a single
--     'Vulkan.Core10.Handles.DeviceMemory' object
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-image-09241# If @image@ has a
--     color format that is single-plane, then the @aspectMask@ member of
--     @subresourceRange@ /must/ be
--     'Vulkan.Core10.Enums.ImageAspectFlagBits.IMAGE_ASPECT_COLOR_BIT'
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-image-09242# If @image@ has a
--     color format and is not /disjoint/, then the @aspectMask@ member of
--     @subresourceRange@ /must/ be
--     'Vulkan.Core10.Enums.ImageAspectFlagBits.IMAGE_ASPECT_COLOR_BIT'
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-image-01672# If @image@ has a
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-multiplanar multi-planar format>
--     and the image is /disjoint/, then the @aspectMask@ member of
--     @subresourceRange@ /must/ include at least one
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-multiplanar-image-aspect multi-planar aspect mask>
--     bit or
--     'Vulkan.Core10.Enums.ImageAspectFlagBits.IMAGE_ASPECT_COLOR_BIT'
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-image-03320# If @image@ has a
--     depth\/stencil format with both depth and stencil and the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#features-separateDepthStencilLayouts separateDepthStencilLayouts>
--     feature is not enabled, then the @aspectMask@ member of
--     @subresourceRange@ /must/ include both
--     'Vulkan.Core10.Enums.ImageAspectFlagBits.IMAGE_ASPECT_DEPTH_BIT' and
--     'Vulkan.Core10.Enums.ImageAspectFlagBits.IMAGE_ASPECT_STENCIL_BIT'
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-image-03319# If @image@ has a
--     depth\/stencil format with both depth and stencil and the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#features-separateDepthStencilLayouts separateDepthStencilLayouts>
--     feature is enabled, then the @aspectMask@ member of
--     @subresourceRange@ /must/ include either or both
--     'Vulkan.Core10.Enums.ImageAspectFlagBits.IMAGE_ASPECT_DEPTH_BIT' and
--     'Vulkan.Core10.Enums.ImageAspectFlagBits.IMAGE_ASPECT_STENCIL_BIT'
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-image-10749# If @image@ has a
--     depth-only format then the @aspectMask@ member of @subresourceRange@
--     /must/ be
--     'Vulkan.Core10.Enums.ImageAspectFlagBits.IMAGE_ASPECT_DEPTH_BIT'
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-image-10750# If @image@ has a
--     stencil-only format then the @aspectMask@ member of
--     @subresourceRange@ /must/ be
--     'Vulkan.Core10.Enums.ImageAspectFlagBits.IMAGE_ASPECT_STENCIL_BIT'
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-aspectMask-08702# If the
--     @aspectMask@ member of @subresourceRange@ includes
--     'Vulkan.Core10.Enums.ImageAspectFlagBits.IMAGE_ASPECT_DEPTH_BIT',
--     @oldLayout@ and @newLayout@ /must/ not be one of
--     'Vulkan.Core10.Enums.ImageLayout.IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL'
--     or
--     'Vulkan.Core10.Enums.ImageLayout.IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL'
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-aspectMask-08703# If the
--     @aspectMask@ member of @subresourceRange@ includes
--     'Vulkan.Core10.Enums.ImageAspectFlagBits.IMAGE_ASPECT_STENCIL_BIT',
--     @oldLayout@ and @newLayout@ /must/ not be one of
--     'Vulkan.Core10.Enums.ImageLayout.IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL'
--     or
--     'Vulkan.Core10.Enums.ImageLayout.IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL'
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-subresourceRange-09601#
--     @subresourceRange.aspectMask@ /must/ be valid for the @format@ the
--     @image@ was created with
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-oldLayout-01208# If
--     @oldLayout@ or @newLayout@ is
--     'Vulkan.Core10.Enums.ImageLayout.IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL'
--     then @image@ /must/ have been created with the
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_COLOR_ATTACHMENT_BIT'
--     usage flag set
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-oldLayout-01209# If
--     @oldLayout@ or @newLayout@ is
--     'Vulkan.Core10.Enums.ImageLayout.IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL'
--     then @image@ /must/ have been created with the
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT'
--     usage flag set
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-oldLayout-01210# If
--     @oldLayout@ or @newLayout@ is
--     'Vulkan.Core10.Enums.ImageLayout.IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL'
--     then @image@ /must/ have been created with the
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT'
--     usage flag set
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-oldLayout-01211# If
--     @oldLayout@ or @newLayout@ is
--     'Vulkan.Core10.Enums.ImageLayout.IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL'
--     then @image@ /must/ have been created with the
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_SAMPLED_BIT' or
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_INPUT_ATTACHMENT_BIT'
--     usage flag set
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-oldLayout-01212# If
--     @oldLayout@ or @newLayout@ is
--     'Vulkan.Core10.Enums.ImageLayout.IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL'
--     then @image@ /must/ have been created with the
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_TRANSFER_SRC_BIT'
--     usage flag set
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-oldLayout-01213# If
--     @oldLayout@ or @newLayout@ is
--     'Vulkan.Core10.Enums.ImageLayout.IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL'
--     then @image@ /must/ have been created with the
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_TRANSFER_DST_BIT'
--     usage flag set
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-oldLayout-10767# If the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#features-zeroInitializeDeviceMemory zeroInitializeDeviceMemory>
--     feature is not enabled, @oldLayout@ /must/ not be
--     'Vulkan.Core10.Enums.ImageLayout.IMAGE_LAYOUT_ZERO_INITIALIZED_EXT'
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-oldLayout-10768# If
--     @oldLayout@ is
--     'Vulkan.Core10.Enums.ImageLayout.IMAGE_LAYOUT_ZERO_INITIALIZED_EXT',
--     then all subresources /must/ be included in the barrier
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-oldLayout-01658# If
--     @oldLayout@ or @newLayout@ is
--     'Vulkan.Core10.Enums.ImageLayout.IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL'
--     then @image@ /must/ have been created with the
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT'
--     usage flag set
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-oldLayout-01659# If
--     @oldLayout@ or @newLayout@ is
--     'Vulkan.Core10.Enums.ImageLayout.IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL'
--     then @image@ /must/ have been created with the
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT'
--     usage flag set
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-srcQueueFamilyIndex-04065# If
--     @oldLayout@ or @newLayout@ is
--     'Vulkan.Core10.Enums.ImageLayout.IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL'
--     then @image@ /must/ have been created with at least one of the
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT',
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_SAMPLED_BIT', or
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_INPUT_ATTACHMENT_BIT'
--     usage flags set
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-srcQueueFamilyIndex-04066# If
--     @oldLayout@ or @newLayout@ is
--     'Vulkan.Core10.Enums.ImageLayout.IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL'
--     then @image@ /must/ have been created with the
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT'
--     usage flag set
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-srcQueueFamilyIndex-04067# If
--     @oldLayout@ or @newLayout@ is
--     'Vulkan.Core10.Enums.ImageLayout.IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL'
--     then @image@ /must/ have been created with at least one of the
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT',
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_SAMPLED_BIT', or
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_INPUT_ATTACHMENT_BIT'
--     usage flags set
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-srcQueueFamilyIndex-04068# If
--     @oldLayout@ or @newLayout@ is
--     'Vulkan.Core10.Enums.ImageLayout.IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL'
--     then @image@ /must/ have been created with the
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT'
--     usage flag set
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-synchronization2-07793# If the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#features-synchronization2 synchronization2>
--     feature is not enabled, @oldLayout@ /must/ not be
--     'Vulkan.Extensions.VK_KHR_synchronization2.IMAGE_LAYOUT_ATTACHMENT_OPTIMAL_KHR'
--     or
--     'Vulkan.Extensions.VK_KHR_synchronization2.IMAGE_LAYOUT_READ_ONLY_OPTIMAL_KHR'
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-synchronization2-07794# If the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#features-synchronization2 synchronization2>
--     feature is not enabled, @newLayout@ /must/ not be
--     'Vulkan.Extensions.VK_KHR_synchronization2.IMAGE_LAYOUT_ATTACHMENT_OPTIMAL_KHR'
--     or
--     'Vulkan.Extensions.VK_KHR_synchronization2.IMAGE_LAYOUT_READ_ONLY_OPTIMAL_KHR'
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-srcQueueFamilyIndex-03938# If
--     @oldLayout@ or @newLayout@ is
--     'Vulkan.Core10.Enums.ImageLayout.IMAGE_LAYOUT_ATTACHMENT_OPTIMAL',
--     @image@ /must/ have been created with the
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_COLOR_ATTACHMENT_BIT'
--     or
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT'
--     usage flag set
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-srcQueueFamilyIndex-03939# If
--     @oldLayout@ or @newLayout@ is
--     'Vulkan.Core10.Enums.ImageLayout.IMAGE_LAYOUT_READ_ONLY_OPTIMAL',
--     @image@ /must/ have been created with at least one of the
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT',
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_SAMPLED_BIT', or
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_INPUT_ATTACHMENT_BIT'
--     usage flags set
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-oldLayout-02088# If
--     @oldLayout@ or @newLayout@ is
--     'Vulkan.Core10.Enums.ImageLayout.IMAGE_LAYOUT_FRAGMENT_SHADING_RATE_ATTACHMENT_OPTIMAL_KHR'
--     then @image@ /must/ have been created with the
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR'
--     usage flag set
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-srcQueueFamilyIndex-07120# If
--     @oldLayout@ or @newLayout@ is
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VkImageLayout VK_IMAGE_LAYOUT_VIDEO_DECODE_SRC_KHR>
--     then @image@ /must/ have been created with the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VkImageUsageFlagBits VK_IMAGE_USAGE_VIDEO_DECODE_SRC_BIT_KHR>
--     usage flag set
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-srcQueueFamilyIndex-07121# If
--     @oldLayout@ or @newLayout@ is
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VkImageLayout VK_IMAGE_LAYOUT_VIDEO_DECODE_DST_KHR>
--     then @image@ /must/ have been created with the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VkImageUsageFlagBits VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR>
--     usage flag set
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-srcQueueFamilyIndex-07122# If
--     @oldLayout@ or @newLayout@ is
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VkImageLayout VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR>
--     then @image@ /must/ have been created with the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VkImageUsageFlagBits VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR>
--     usage flag set
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-srcQueueFamilyIndex-07123# If
--     @oldLayout@ or @newLayout@ is
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VkImageLayout VK_IMAGE_LAYOUT_VIDEO_ENCODE_SRC_KHR>
--     then @image@ /must/ have been created with the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VkImageUsageFlagBits VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR>
--     usage flag set
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-srcQueueFamilyIndex-07124# If
--     @oldLayout@ or @newLayout@ is
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VkImageLayout VK_IMAGE_LAYOUT_VIDEO_ENCODE_DST_KHR>
--     then @image@ /must/ have been created with the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VkImageUsageFlagBits VK_IMAGE_USAGE_VIDEO_ENCODE_DST_BIT_KHR>
--     usage flag set
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-srcQueueFamilyIndex-07125# If
--     @oldLayout@ or @newLayout@ is
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VkImageLayout VK_IMAGE_LAYOUT_VIDEO_ENCODE_DPB_KHR>
--     then @image@ /must/ have been created with the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VkImageUsageFlagBits VK_IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR>
--     usage flag set
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-srcQueueFamilyIndex-10287# If
--     @oldLayout@ or @newLayout@ is
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VkImageLayout VK_IMAGE_LAYOUT_VIDEO_ENCODE_QUANTIZATION_MAP_KHR>
--     then @image@ /must/ have been created with the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VkImageUsageFlagBits VK_IMAGE_USAGE_VIDEO_ENCODE_QUANTIZATION_DELTA_MAP_BIT_KHR>
--     or
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VkImageUsageFlagBits VK_IMAGE_USAGE_VIDEO_ENCODE_EMPHASIS_MAP_BIT_KHR>
--     usage flags set
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-srcQueueFamilyIndex-07006# If
--     @oldLayout@ or @newLayout@ is
--     'Vulkan.Core10.Enums.ImageLayout.IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT'
--     then @image@ /must/ have been created with either the
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_COLOR_ATTACHMENT_BIT'
--     or
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT'
--     usage flags set, and the
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_INPUT_ATTACHMENT_BIT'
--     or 'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_SAMPLED_BIT'
--     usage flags set, and the
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT'
--     usage flag set
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-attachmentFeedbackLoopLayout-07313#
--     If the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#features-attachmentFeedbackLoopLayout attachmentFeedbackLoopLayout>
--     feature is not enabled, @newLayout@ /must/ not be
--     'Vulkan.Core10.Enums.ImageLayout.IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT'
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-srcQueueFamilyIndex-09550# If
--     @oldLayout@ or @newLayout@ is
--     'Vulkan.Core10.Enums.ImageLayout.IMAGE_LAYOUT_RENDERING_LOCAL_READ'
--     then @image@ /must/ have been created with either the
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_STORAGE_BIT'
--     usage flag set, or with both the
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_INPUT_ATTACHMENT_BIT'
--     usage flag and either of the
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_COLOR_ATTACHMENT_BIT'
--     or
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT'
--     usage flags set
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-dynamicRenderingLocalRead-09551#
--     If the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#features-dynamicRenderingLocalRead dynamicRenderingLocalRead>
--     feature is not enabled, @oldLayout@ /must/ not be
--     'Vulkan.Core10.Enums.ImageLayout.IMAGE_LAYOUT_RENDERING_LOCAL_READ'
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-dynamicRenderingLocalRead-09552#
--     If the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#features-dynamicRenderingLocalRead dynamicRenderingLocalRead>
--     feature is not enabled, @newLayout@ /must/ not be
--     'Vulkan.Core10.Enums.ImageLayout.IMAGE_LAYOUT_RENDERING_LOCAL_READ'
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-oldLayout-09229# @oldLayout@
--     /must/ be either
--     'Vulkan.Core10.Enums.ImageLayout.IMAGE_LAYOUT_UNDEFINED' or the
--     current layout of the image subresources as specified in
--     @subresourceRange@
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-oldLayout-09230# If
--     @oldLayout@ is not
--     'Vulkan.Core10.Enums.ImageLayout.IMAGE_LAYOUT_UNDEFINED',
--     'Vulkan.Core10.Enums.ImageLayout.IMAGE_LAYOUT_ZERO_INITIALIZED_EXT',
--     or 'Vulkan.Core10.Enums.ImageLayout.IMAGE_LAYOUT_PREINITIALIZED', it
--     /must/ be one of the layouts in
--     'PhysicalDeviceHostImageCopyProperties'::@pCopySrcLayouts@
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-newLayout-09057# @newLayout@
--     /must/ be one of the layouts in
--     'PhysicalDeviceHostImageCopyProperties'::@pCopyDstLayouts@
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-sType-sType# @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_HOST_IMAGE_LAYOUT_TRANSITION_INFO'
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-pNext-pNext# @pNext@ /must/ be
--     @NULL@
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-image-parameter# @image@
--     /must/ be a valid 'Vulkan.Core10.Handles.Image' handle
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-oldLayout-parameter#
--     @oldLayout@ /must/ be a valid
--     'Vulkan.Core10.Enums.ImageLayout.ImageLayout' value
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-newLayout-parameter#
--     @newLayout@ /must/ be a valid
--     'Vulkan.Core10.Enums.ImageLayout.ImageLayout' value
--
-- -   #VUID-VkHostImageLayoutTransitionInfo-subresourceRange-parameter#
--     @subresourceRange@ /must/ be a valid
--     'Vulkan.Core10.ImageView.ImageSubresourceRange' structure
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_host_image_copy VK_EXT_host_image_copy>,
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_VERSION_1_4 VK_VERSION_1_4>,
-- 'Vulkan.Core10.Handles.Image',
-- 'Vulkan.Core10.Enums.ImageLayout.ImageLayout',
-- 'Vulkan.Core10.ImageView.ImageSubresourceRange',
-- 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'transitionImageLayout', 'transitionImageLayout'
data HostImageLayoutTransitionInfo = HostImageLayoutTransitionInfo
  { -- | @image@ is a handle to the image affected by this layout transition.
    HostImageLayoutTransitionInfo -> Image
image :: Image
  , -- | @oldLayout@ is the old layout in an
    -- <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#synchronization-image-layout-transitions image layout transition>.
    HostImageLayoutTransitionInfo -> ImageLayout
oldLayout :: ImageLayout
  , -- | @newLayout@ is the new layout in an
    -- <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#synchronization-image-layout-transitions image layout transition>.
    HostImageLayoutTransitionInfo -> ImageLayout
newLayout :: ImageLayout
  , -- | @subresourceRange@ describes the
    -- <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#resources-image-views image subresource range>
    -- within @image@ that is affected by this layout transition.
    HostImageLayoutTransitionInfo -> ImageSubresourceRange
subresourceRange :: ImageSubresourceRange
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (HostImageLayoutTransitionInfo)
#endif
deriving instance Show HostImageLayoutTransitionInfo

instance ToCStruct HostImageLayoutTransitionInfo where
  withCStruct :: forall b.
HostImageLayoutTransitionInfo
-> (Ptr HostImageLayoutTransitionInfo -> IO b) -> IO b
withCStruct HostImageLayoutTransitionInfo
x Ptr HostImageLayoutTransitionInfo -> IO b
f = Int -> (Ptr HostImageLayoutTransitionInfo -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
56 ((Ptr HostImageLayoutTransitionInfo -> IO b) -> IO b)
-> (Ptr HostImageLayoutTransitionInfo -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr HostImageLayoutTransitionInfo
p -> Ptr HostImageLayoutTransitionInfo
-> HostImageLayoutTransitionInfo -> IO b -> IO b
forall b.
Ptr HostImageLayoutTransitionInfo
-> HostImageLayoutTransitionInfo -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr HostImageLayoutTransitionInfo
p HostImageLayoutTransitionInfo
x (Ptr HostImageLayoutTransitionInfo -> IO b
f Ptr HostImageLayoutTransitionInfo
p)
  pokeCStruct :: forall b.
Ptr HostImageLayoutTransitionInfo
-> HostImageLayoutTransitionInfo -> IO b -> IO b
pokeCStruct Ptr HostImageLayoutTransitionInfo
p HostImageLayoutTransitionInfo{ImageLayout
Image
ImageSubresourceRange
image :: HostImageLayoutTransitionInfo -> Image
oldLayout :: HostImageLayoutTransitionInfo -> ImageLayout
newLayout :: HostImageLayoutTransitionInfo -> ImageLayout
subresourceRange :: HostImageLayoutTransitionInfo -> ImageSubresourceRange
image :: Image
oldLayout :: ImageLayout
newLayout :: ImageLayout
subresourceRange :: ImageSubresourceRange
..} IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HostImageLayoutTransitionInfo
p Ptr HostImageLayoutTransitionInfo -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_HOST_IMAGE_LAYOUT_TRANSITION_INFO)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HostImageLayoutTransitionInfo
p Ptr HostImageLayoutTransitionInfo -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Image -> Image -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HostImageLayoutTransitionInfo
p Ptr HostImageLayoutTransitionInfo -> Int -> Ptr Image
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Image)) (Image
image)
    Ptr ImageLayout -> ImageLayout -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HostImageLayoutTransitionInfo
p Ptr HostImageLayoutTransitionInfo -> Int -> Ptr ImageLayout
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr ImageLayout)) (ImageLayout
oldLayout)
    Ptr ImageLayout -> ImageLayout -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HostImageLayoutTransitionInfo
p Ptr HostImageLayoutTransitionInfo -> Int -> Ptr ImageLayout
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr ImageLayout)) (ImageLayout
newLayout)
    Ptr ImageSubresourceRange -> ImageSubresourceRange -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HostImageLayoutTransitionInfo
p Ptr HostImageLayoutTransitionInfo
-> Int -> Ptr ImageSubresourceRange
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr ImageSubresourceRange)) (ImageSubresourceRange
subresourceRange)
    IO b
f
  cStructSize :: Int
cStructSize = Int
56
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b. Ptr HostImageLayoutTransitionInfo -> IO b -> IO b
pokeZeroCStruct Ptr HostImageLayoutTransitionInfo
p IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HostImageLayoutTransitionInfo
p Ptr HostImageLayoutTransitionInfo -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_HOST_IMAGE_LAYOUT_TRANSITION_INFO)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HostImageLayoutTransitionInfo
p Ptr HostImageLayoutTransitionInfo -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Image -> Image -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HostImageLayoutTransitionInfo
p Ptr HostImageLayoutTransitionInfo -> Int -> Ptr Image
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Image)) (Image
forall a. Zero a => a
zero)
    Ptr ImageLayout -> ImageLayout -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HostImageLayoutTransitionInfo
p Ptr HostImageLayoutTransitionInfo -> Int -> Ptr ImageLayout
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr ImageLayout)) (ImageLayout
forall a. Zero a => a
zero)
    Ptr ImageLayout -> ImageLayout -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HostImageLayoutTransitionInfo
p Ptr HostImageLayoutTransitionInfo -> Int -> Ptr ImageLayout
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr ImageLayout)) (ImageLayout
forall a. Zero a => a
zero)
    Ptr ImageSubresourceRange -> ImageSubresourceRange -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HostImageLayoutTransitionInfo
p Ptr HostImageLayoutTransitionInfo
-> Int -> Ptr ImageSubresourceRange
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr ImageSubresourceRange)) (ImageSubresourceRange
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct HostImageLayoutTransitionInfo where
  peekCStruct :: Ptr HostImageLayoutTransitionInfo
-> IO HostImageLayoutTransitionInfo
peekCStruct Ptr HostImageLayoutTransitionInfo
p = do
    image <- forall a. Storable a => Ptr a -> IO a
peek @Image ((Ptr HostImageLayoutTransitionInfo
p Ptr HostImageLayoutTransitionInfo -> Int -> Ptr Image
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Image))
    oldLayout <- peek @ImageLayout ((p `plusPtr` 24 :: Ptr ImageLayout))
    newLayout <- peek @ImageLayout ((p `plusPtr` 28 :: Ptr ImageLayout))
    subresourceRange <- peekCStruct @ImageSubresourceRange ((p `plusPtr` 32 :: Ptr ImageSubresourceRange))
    pure $ HostImageLayoutTransitionInfo
             image oldLayout newLayout subresourceRange

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

instance Zero HostImageLayoutTransitionInfo where
  zero :: HostImageLayoutTransitionInfo
zero = Image
-> ImageLayout
-> ImageLayout
-> ImageSubresourceRange
-> HostImageLayoutTransitionInfo
HostImageLayoutTransitionInfo
           Image
forall a. Zero a => a
zero
           ImageLayout
forall a. Zero a => a
zero
           ImageLayout
forall a. Zero a => a
zero
           ImageSubresourceRange
forall a. Zero a => a
zero


-- | VkSubresourceHostMemcpySize - Memory size needed to copy to or from an
-- image on the host with VK_HOST_IMAGE_COPY_MEMCPY_BIT
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_host_image_copy VK_EXT_host_image_copy>,
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_VERSION_1_4 VK_VERSION_1_4>,
-- 'Vulkan.Core10.FundamentalTypes.DeviceSize',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data SubresourceHostMemcpySize = SubresourceHostMemcpySize
  { -- | @size@ is the size in bytes of the image subresource.
    SubresourceHostMemcpySize -> DeviceSize
size :: DeviceSize }
  deriving (Typeable, SubresourceHostMemcpySize -> SubresourceHostMemcpySize -> Bool
(SubresourceHostMemcpySize -> SubresourceHostMemcpySize -> Bool)
-> (SubresourceHostMemcpySize -> SubresourceHostMemcpySize -> Bool)
-> Eq SubresourceHostMemcpySize
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SubresourceHostMemcpySize -> SubresourceHostMemcpySize -> Bool
== :: SubresourceHostMemcpySize -> SubresourceHostMemcpySize -> Bool
$c/= :: SubresourceHostMemcpySize -> SubresourceHostMemcpySize -> Bool
/= :: SubresourceHostMemcpySize -> SubresourceHostMemcpySize -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (SubresourceHostMemcpySize)
#endif
deriving instance Show SubresourceHostMemcpySize

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

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

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

instance Zero SubresourceHostMemcpySize where
  zero :: SubresourceHostMemcpySize
zero = DeviceSize -> SubresourceHostMemcpySize
SubresourceHostMemcpySize
           DeviceSize
forall a. Zero a => a
zero


-- | VkHostImageCopyDevicePerformanceQuery - Struct containing information
-- about optimality of device access
--
-- = Description
--
-- The implementation /may/ return 'Vulkan.Core10.FundamentalTypes.FALSE'
-- in @optimalDeviceAccess@ if @identicalMemoryLayout@ is
-- 'Vulkan.Core10.FundamentalTypes.FALSE'. If @identicalMemoryLayout@ is
-- 'Vulkan.Core10.FundamentalTypes.TRUE', @optimalDeviceAccess@ /must/ be
-- 'Vulkan.Core10.FundamentalTypes.TRUE'.
--
-- The implementation /may/ return 'Vulkan.Core10.FundamentalTypes.TRUE' in
-- @optimalDeviceAccess@ while @identicalMemoryLayout@ is
-- 'Vulkan.Core10.FundamentalTypes.FALSE'. In this situation, any device
-- performance impact /should/ not be measurable.
--
-- If
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceImageFormatInfo2'::@format@
-- is a block-compressed format and
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.getPhysicalDeviceImageFormatProperties2'
-- returns 'Vulkan.Core10.Enums.Result.SUCCESS', the implementation /must/
-- return 'Vulkan.Core10.FundamentalTypes.TRUE' in @optimalDeviceAccess@.
--
-- Applications can make use of @optimalDeviceAccess@ to determine their
-- resource copying strategy. If a resource is expected to be accessed more
-- on device than on the host, and the implementation considers the
-- resource sub-optimally accessed, it is likely better to use device
-- copies instead.
--
-- Layout not being identical yet still considered optimal for device
-- access could happen if the implementation has different memory layout
-- patterns, some of which are easier to access on the host.
--
-- The most practical reason for @optimalDeviceAccess@ to be
-- 'Vulkan.Core10.FundamentalTypes.FALSE' is that host image access may
-- disable framebuffer compression where it would otherwise have been
-- enabled. This represents far more efficient host image access since no
-- compression algorithm is required to read or write to the image, but it
-- would impact device access performance. Some implementations may only
-- set @optimalDeviceAccess@ to 'Vulkan.Core10.FundamentalTypes.FALSE' if
-- certain conditions are met, such as specific image usage flags or
-- creation flags.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_host_image_copy VK_EXT_host_image_copy>,
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_VERSION_1_4 VK_VERSION_1_4>,
-- 'Vulkan.Core10.FundamentalTypes.Bool32',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data HostImageCopyDevicePerformanceQuery = HostImageCopyDevicePerformanceQuery
  { -- | @optimalDeviceAccess@ returns 'Vulkan.Core10.FundamentalTypes.TRUE' if
    -- use of host image copy has no adverse effect on device access
    -- performance, compared to an image that is created with exact same
    -- creation parameters, and bound to the same
    -- 'Vulkan.Core10.Handles.DeviceMemory', except that the
    -- 'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_HOST_TRANSFER_BIT'
    -- usage flag is replaced with
    -- 'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_TRANSFER_SRC_BIT'
    -- and
    -- 'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_TRANSFER_DST_BIT'.
    HostImageCopyDevicePerformanceQuery -> Bool
optimalDeviceAccess :: Bool
  , -- | @identicalMemoryLayout@ returns 'Vulkan.Core10.FundamentalTypes.TRUE' if
    -- use of host image copy has no impact on memory layout compared to an
    -- image that is created with exact same creation parameters, and bound to
    -- the same 'Vulkan.Core10.Handles.DeviceMemory', except that the
    -- 'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_HOST_TRANSFER_BIT'
    -- usage flag is replaced with
    -- 'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_TRANSFER_SRC_BIT'
    -- and
    -- 'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_TRANSFER_DST_BIT'.
    HostImageCopyDevicePerformanceQuery -> Bool
identicalMemoryLayout :: Bool
  }
  deriving (Typeable, HostImageCopyDevicePerformanceQuery
-> HostImageCopyDevicePerformanceQuery -> Bool
(HostImageCopyDevicePerformanceQuery
 -> HostImageCopyDevicePerformanceQuery -> Bool)
-> (HostImageCopyDevicePerformanceQuery
    -> HostImageCopyDevicePerformanceQuery -> Bool)
-> Eq HostImageCopyDevicePerformanceQuery
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: HostImageCopyDevicePerformanceQuery
-> HostImageCopyDevicePerformanceQuery -> Bool
== :: HostImageCopyDevicePerformanceQuery
-> HostImageCopyDevicePerformanceQuery -> Bool
$c/= :: HostImageCopyDevicePerformanceQuery
-> HostImageCopyDevicePerformanceQuery -> Bool
/= :: HostImageCopyDevicePerformanceQuery
-> HostImageCopyDevicePerformanceQuery -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (HostImageCopyDevicePerformanceQuery)
#endif
deriving instance Show HostImageCopyDevicePerformanceQuery

instance ToCStruct HostImageCopyDevicePerformanceQuery where
  withCStruct :: forall b.
HostImageCopyDevicePerformanceQuery
-> (Ptr HostImageCopyDevicePerformanceQuery -> IO b) -> IO b
withCStruct HostImageCopyDevicePerformanceQuery
x Ptr HostImageCopyDevicePerformanceQuery -> IO b
f = Int -> (Ptr HostImageCopyDevicePerformanceQuery -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
24 ((Ptr HostImageCopyDevicePerformanceQuery -> IO b) -> IO b)
-> (Ptr HostImageCopyDevicePerformanceQuery -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr HostImageCopyDevicePerformanceQuery
p -> Ptr HostImageCopyDevicePerformanceQuery
-> HostImageCopyDevicePerformanceQuery -> IO b -> IO b
forall b.
Ptr HostImageCopyDevicePerformanceQuery
-> HostImageCopyDevicePerformanceQuery -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr HostImageCopyDevicePerformanceQuery
p HostImageCopyDevicePerformanceQuery
x (Ptr HostImageCopyDevicePerformanceQuery -> IO b
f Ptr HostImageCopyDevicePerformanceQuery
p)
  pokeCStruct :: forall b.
Ptr HostImageCopyDevicePerformanceQuery
-> HostImageCopyDevicePerformanceQuery -> IO b -> IO b
pokeCStruct Ptr HostImageCopyDevicePerformanceQuery
p HostImageCopyDevicePerformanceQuery{Bool
optimalDeviceAccess :: HostImageCopyDevicePerformanceQuery -> Bool
identicalMemoryLayout :: HostImageCopyDevicePerformanceQuery -> Bool
optimalDeviceAccess :: Bool
identicalMemoryLayout :: Bool
..} IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HostImageCopyDevicePerformanceQuery
p Ptr HostImageCopyDevicePerformanceQuery -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_HOST_IMAGE_COPY_DEVICE_PERFORMANCE_QUERY)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HostImageCopyDevicePerformanceQuery
p Ptr HostImageCopyDevicePerformanceQuery -> 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 HostImageCopyDevicePerformanceQuery
p Ptr HostImageCopyDevicePerformanceQuery -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
optimalDeviceAccess))
    Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HostImageCopyDevicePerformanceQuery
p Ptr HostImageCopyDevicePerformanceQuery -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
identicalMemoryLayout))
    IO b
f
  cStructSize :: Int
cStructSize = Int
24
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b. Ptr HostImageCopyDevicePerformanceQuery -> IO b -> IO b
pokeZeroCStruct Ptr HostImageCopyDevicePerformanceQuery
p IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HostImageCopyDevicePerformanceQuery
p Ptr HostImageCopyDevicePerformanceQuery -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_HOST_IMAGE_COPY_DEVICE_PERFORMANCE_QUERY)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HostImageCopyDevicePerformanceQuery
p Ptr HostImageCopyDevicePerformanceQuery -> 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 HostImageCopyDevicePerformanceQuery
p Ptr HostImageCopyDevicePerformanceQuery -> 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 Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HostImageCopyDevicePerformanceQuery
p Ptr HostImageCopyDevicePerformanceQuery -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
forall a. Zero a => a
zero))
    IO b
f

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

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

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