{-# language CPP #-}
-- | = Name
--
-- VK_NV_memory_decompression - device extension
--
-- = VK_NV_memory_decompression
--
-- [__Name String__]
--     @VK_NV_memory_decompression@
--
-- [__Extension Type__]
--     Device extension
--
-- [__Registered Extension Number__]
--     428
--
-- [__Revision__]
--     1
--
-- [__Ratification Status__]
--     Not ratified
--
-- [__Extension and Version Dependencies__]
--             
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_get_physical_device_properties2 VK_KHR_get_physical_device_properties2>
--              or
--             
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#versions-1.1 Vulkan Version 1.1>
--          and
--         
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_buffer_device_address VK_KHR_buffer_device_address>
--     or
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#versions-1.2 Vulkan Version 1.2>
--
-- [__Deprecation State__]
--
--     -   /Promoted/ to
--         <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_memory_decompression VK_EXT_memory_decompression>
--         extension
--
-- [__Contact__]
--
--     -   Vikram Kushwaha
--         <https://github.com/KhronosGroup/Vulkan-Docs/issues/new?body=[VK_NV_memory_decompression] @vkushwaha-nv%0A*Here describe the issue or question you have about the VK_NV_memory_decompression extension* >
--
-- == Other Extension Metadata
--
-- [__Last Modified Date__]
--     2022-01-31
--
-- [__Contributors__]
--
--     -   Vikram Kushwaha, NVIDIA
--
--     -   Jeff Bolz, NVIDIA
--
--     -   Christoph Kubisch, NVIDIA
--
--     -   Piers Daniell, NVIDIA
--
-- == Description
--
-- This extension adds support for performing memory to memory
-- decompression.
--
-- == New Commands
--
-- -   'cmdDecompressMemoryIndirectCountNV'
--
-- -   'cmdDecompressMemoryNV'
--
-- == New Structures
--
-- -   'DecompressMemoryRegionNV'
--
-- -   Extending
--     'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceFeatures2',
--     'Vulkan.Core10.Device.DeviceCreateInfo':
--
--     -   'PhysicalDeviceMemoryDecompressionFeaturesNV'
--
-- -   Extending
--     'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceProperties2':
--
--     -   'PhysicalDeviceMemoryDecompressionPropertiesNV'
--
-- == New Enums
--
-- -   'MemoryDecompressionMethodFlagBitsNV'
--
-- == New Bitmasks
--
-- -   'MemoryDecompressionMethodFlagsNV'
--
-- == New Enum Constants
--
-- -   'NV_MEMORY_DECOMPRESSION_EXTENSION_NAME'
--
-- -   'NV_MEMORY_DECOMPRESSION_SPEC_VERSION'
--
-- -   Extending 'Vulkan.Core10.Enums.StructureType.StructureType':
--
--     -   'STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_FEATURES_NV'
--
--     -   'STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_PROPERTIES_NV'
--
-- == Version History
--
-- -   Revision 1, 2022-01-31 (Vikram Kushwaha)
--
--     -   Initial draft
--
-- == See Also
--
-- No cross-references are available
--
-- == Document Notes
--
-- For more information, see the
-- <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#VK_NV_memory_decompression Vulkan Specification>.
--
-- This page is a generated document. Fixes and changes should be made to
-- the generator scripts, not directly.
module Vulkan.Extensions.VK_NV_memory_decompression  ( cmdDecompressMemoryNV
                                                     , cmdDecompressMemoryIndirectCountNV
                                                     , pattern STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_FEATURES_NV
                                                     , pattern STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_PROPERTIES_NV
                                                     , DecompressMemoryRegionNV(..)
                                                     , MemoryDecompressionMethodFlagsNV
                                                     , MemoryDecompressionMethodFlagBitsNV
                                                     , PhysicalDeviceMemoryDecompressionFeaturesNV
                                                     , PhysicalDeviceMemoryDecompressionPropertiesNV
                                                     , NV_MEMORY_DECOMPRESSION_SPEC_VERSION
                                                     , pattern NV_MEMORY_DECOMPRESSION_SPEC_VERSION
                                                     , NV_MEMORY_DECOMPRESSION_EXTENSION_NAME
                                                     , pattern NV_MEMORY_DECOMPRESSION_EXTENSION_NAME
                                                     , PhysicalDeviceMemoryDecompressionFeaturesEXT(..)
                                                     , PhysicalDeviceMemoryDecompressionPropertiesEXT(..)
                                                     , MemoryDecompressionMethodFlagBitsEXT(..)
                                                     , MemoryDecompressionMethodFlagsEXT
                                                     ) where

import Vulkan.Internal.Utils (traceAroundEvent)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Foreign.Marshal.Alloc (allocaBytes)
import GHC.IO (throwIO)
import GHC.Ptr (nullFunPtr)
import Foreign.Ptr (plusPtr)
import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Cont (evalContT)
import qualified Data.Vector (imapM_)
import qualified Data.Vector (length)
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Zero (Zero(..))
import Control.Monad.IO.Class (MonadIO)
import Data.String (IsString)
import Data.Typeable (Typeable)
import Foreign.Storable (Storable)
import Foreign.Storable (Storable(peek))
import Foreign.Storable (Storable(poke))
import qualified Foreign.Storable (Storable(..))
import GHC.Generics (Generic)
import GHC.IO.Exception (IOErrorType(..))
import GHC.IO.Exception (IOException(..))
import Foreign.Ptr (FunPtr)
import Foreign.Ptr (Ptr)
import Data.Word (Word32)
import Data.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Data.Vector (Vector)
import Vulkan.NamedType ((:::))
import Vulkan.Core10.Handles (CommandBuffer)
import Vulkan.Core10.Handles (CommandBuffer(..))
import Vulkan.Core10.Handles (CommandBuffer(CommandBuffer))
import Vulkan.Core10.Handles (CommandBuffer_T)
import Vulkan.Core10.FundamentalTypes (DeviceAddress)
import Vulkan.Dynamic (DeviceCmds(pVkCmdDecompressMemoryIndirectCountNV))
import Vulkan.Dynamic (DeviceCmds(pVkCmdDecompressMemoryNV))
import Vulkan.Core10.FundamentalTypes (DeviceSize)
import Vulkan.Extensions.VK_EXT_memory_decompression (MemoryDecompressionMethodFlagBitsEXT)
import Vulkan.Extensions.VK_EXT_memory_decompression (MemoryDecompressionMethodFlagsEXT)
import Vulkan.Extensions.VK_EXT_memory_decompression (PhysicalDeviceMemoryDecompressionFeaturesEXT)
import Vulkan.Extensions.VK_EXT_memory_decompression (PhysicalDeviceMemoryDecompressionPropertiesEXT)
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_FEATURES_EXT))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_PROPERTIES_EXT))
import Vulkan.Extensions.VK_EXT_memory_decompression (MemoryDecompressionMethodFlagBitsEXT(..))
import Vulkan.Extensions.VK_EXT_memory_decompression (MemoryDecompressionMethodFlagsEXT)
import Vulkan.Extensions.VK_EXT_memory_decompression (PhysicalDeviceMemoryDecompressionFeaturesEXT(..))
import Vulkan.Extensions.VK_EXT_memory_decompression (PhysicalDeviceMemoryDecompressionPropertiesEXT(..))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkCmdDecompressMemoryNV
  :: FunPtr (Ptr CommandBuffer_T -> Word32 -> Ptr DecompressMemoryRegionNV -> IO ()) -> Ptr CommandBuffer_T -> Word32 -> Ptr DecompressMemoryRegionNV -> IO ()

-- | vkCmdDecompressMemoryNV - Decompress memory containing compressed data
--
-- = Description
--
-- Each region specified in @pDecompressMemoryRegions@ is decompressed from
-- the compressed to decompressed region based on the decompression method
-- specified in 'DecompressMemoryRegionNV'::@decompressionMethod@. If the
-- regions containing compressed and decompressed data overlap, the
-- decompression behavior is undefined.
--
-- == Valid Usage
--
-- -   #VUID-vkCmdDecompressMemoryNV-None-07684# The
--     <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#features-memoryDecompression memoryDecompression>
--     feature /must/ be enabled
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-vkCmdDecompressMemoryNV-commandBuffer-parameter#
--     @commandBuffer@ /must/ be a valid
--     'Vulkan.Core10.Handles.CommandBuffer' handle
--
-- -   #VUID-vkCmdDecompressMemoryNV-pDecompressMemoryRegions-parameter#
--     @pDecompressMemoryRegions@ /must/ be a valid pointer to an array of
--     @decompressRegionCount@ valid 'DecompressMemoryRegionNV' structures
--
-- -   #VUID-vkCmdDecompressMemoryNV-commandBuffer-recording#
--     @commandBuffer@ /must/ be in the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#commandbuffers-lifecycle recording state>
--
-- -   #VUID-vkCmdDecompressMemoryNV-commandBuffer-cmdpool# The
--     'Vulkan.Core10.Handles.CommandPool' that @commandBuffer@ was
--     allocated from /must/ support
--     'Vulkan.Core10.Enums.QueueFlagBits.QUEUE_COMPUTE_BIT', or
--     'Vulkan.Core10.Enums.QueueFlagBits.QUEUE_GRAPHICS_BIT' operations
--
-- -   #VUID-vkCmdDecompressMemoryNV-renderpass# This command /must/ only
--     be called outside of a render pass instance
--
-- -   #VUID-vkCmdDecompressMemoryNV-suspended# This command /must/ not be
--     called between suspended render pass instances
--
-- -   #VUID-vkCmdDecompressMemoryNV-videocoding# This command /must/ only
--     be called outside of a video coding scope
--
-- -   #VUID-vkCmdDecompressMemoryNV-decompressRegionCount-arraylength#
--     @decompressRegionCount@ /must/ be greater than @0@
--
-- == Host Synchronization
--
-- -   Host access to @commandBuffer@ /must/ be externally synchronized
--
-- -   Host access to the 'Vulkan.Core10.Handles.CommandPool' that
--     @commandBuffer@ was allocated from /must/ be externally synchronized
--
-- == Command Properties
--
-- \'
--
-- +----------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
-- | <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VkCommandBufferLevel Command Buffer Levels> | <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#vkCmdBeginRenderPass Render Pass Scope> | <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#vkCmdBeginVideoCodingKHR Video Coding Scope> | <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VkQueueFlagBits Supported Queue Types> | <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#fundamentals-queueoperation-command-types Command Type> |
-- +============================================================================================================================+========================================================================================================================+=============================================================================================================================+=======================================================================================================================+========================================================================================================================================+
-- | Primary                                                                                                                    | Outside                                                                                                                | Outside                                                                                                                     | VK_QUEUE_COMPUTE_BIT                                                                                                  | Action                                                                                                                                 |
-- | Secondary                                                                                                                  |                                                                                                                        |                                                                                                                             | VK_QUEUE_GRAPHICS_BIT                                                                                                 |                                                                                                                                        |
-- +----------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
--
-- == Conditional Rendering
--
-- vkCmdDecompressMemoryNV is not affected by
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#drawing-conditional-rendering conditional rendering>
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_NV_memory_decompression VK_NV_memory_decompression>,
-- 'Vulkan.Core10.Handles.CommandBuffer', 'DecompressMemoryRegionNV'
cmdDecompressMemoryNV :: forall io
                       . (MonadIO io)
                      => -- | @commandBuffer@ is the command buffer into which the command will be
                         -- recorded.
                         CommandBuffer
                      -> -- | @pDecompressMemoryRegions@ is a pointer to an array of
                         -- @decompressRegionCount@ 'DecompressMemoryRegionNV' structures specifying
                         -- decompression parameters.
                         ("decompressMemoryRegions" ::: Vector DecompressMemoryRegionNV)
                      -> io ()
cmdDecompressMemoryNV :: forall (io :: * -> *).
MonadIO io =>
CommandBuffer
-> ("decompressMemoryRegions" ::: Vector DecompressMemoryRegionNV)
-> io ()
cmdDecompressMemoryNV CommandBuffer
commandBuffer
                        "decompressMemoryRegions" ::: Vector DecompressMemoryRegionNV
decompressMemoryRegions = 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 vkCmdDecompressMemoryNVPtr :: FunPtr
  (Ptr CommandBuffer_T
   -> Word32 -> Ptr DecompressMemoryRegionNV -> IO ())
vkCmdDecompressMemoryNVPtr = DeviceCmds
-> FunPtr
     (Ptr CommandBuffer_T
      -> Word32 -> Ptr DecompressMemoryRegionNV -> IO ())
pVkCmdDecompressMemoryNV (case CommandBuffer
commandBuffer of CommandBuffer{DeviceCmds
deviceCmds :: DeviceCmds
deviceCmds :: CommandBuffer -> DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
  IO () -> ContT () IO ()
forall (m :: * -> *) a. Monad m => m a -> ContT () m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT () IO ()) -> IO () -> ContT () IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr CommandBuffer_T
   -> Word32 -> Ptr DecompressMemoryRegionNV -> IO ())
vkCmdDecompressMemoryNVPtr FunPtr
  (Ptr CommandBuffer_T
   -> Word32 -> Ptr DecompressMemoryRegionNV -> IO ())
-> FunPtr
     (Ptr CommandBuffer_T
      -> Word32 -> Ptr DecompressMemoryRegionNV -> IO ())
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr CommandBuffer_T
   -> Word32 -> Ptr DecompressMemoryRegionNV -> IO ())
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
    IOException -> IO ()
forall e a. (HasCallStack, Exception e) => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"The function pointer for vkCmdDecompressMemoryNV is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkCmdDecompressMemoryNV' :: Ptr CommandBuffer_T
-> Word32 -> Ptr DecompressMemoryRegionNV -> IO ()
vkCmdDecompressMemoryNV' = FunPtr
  (Ptr CommandBuffer_T
   -> Word32 -> Ptr DecompressMemoryRegionNV -> IO ())
-> Ptr CommandBuffer_T
-> Word32
-> Ptr DecompressMemoryRegionNV
-> IO ()
mkVkCmdDecompressMemoryNV FunPtr
  (Ptr CommandBuffer_T
   -> Word32 -> Ptr DecompressMemoryRegionNV -> IO ())
vkCmdDecompressMemoryNVPtr
  pPDecompressMemoryRegions <- ((Ptr DecompressMemoryRegionNV -> IO ()) -> IO ())
-> ContT () IO (Ptr DecompressMemoryRegionNV)
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr DecompressMemoryRegionNV -> IO ()) -> IO ())
 -> ContT () IO (Ptr DecompressMemoryRegionNV))
-> ((Ptr DecompressMemoryRegionNV -> IO ()) -> IO ())
-> ContT () IO (Ptr DecompressMemoryRegionNV)
forall a b. (a -> b) -> a -> b
$ forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes @DecompressMemoryRegionNV ((("decompressMemoryRegions" ::: Vector DecompressMemoryRegionNV)
-> Int
forall a. Vector a -> Int
Data.Vector.length ("decompressMemoryRegions" ::: Vector DecompressMemoryRegionNV
decompressMemoryRegions)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
40)
  lift $ Data.Vector.imapM_ (\Int
i DecompressMemoryRegionNV
e -> Ptr DecompressMemoryRegionNV -> DecompressMemoryRegionNV -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr DecompressMemoryRegionNV
pPDecompressMemoryRegions Ptr DecompressMemoryRegionNV -> Int -> Ptr DecompressMemoryRegionNV
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
40 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr DecompressMemoryRegionNV) (DecompressMemoryRegionNV
e)) (decompressMemoryRegions)
  lift $ traceAroundEvent "vkCmdDecompressMemoryNV" (vkCmdDecompressMemoryNV'
                                                       (commandBufferHandle (commandBuffer))
                                                       ((fromIntegral (Data.Vector.length $ (decompressMemoryRegions)) :: Word32))
                                                       (pPDecompressMemoryRegions))
  pure $ ()


foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkCmdDecompressMemoryIndirectCountNV
  :: FunPtr (Ptr CommandBuffer_T -> DeviceAddress -> DeviceAddress -> Word32 -> IO ()) -> Ptr CommandBuffer_T -> DeviceAddress -> DeviceAddress -> Word32 -> IO ()

-- | vkCmdDecompressMemoryIndirectCountNV - Indirect decompress data between
-- memory regions
--
-- = Description
--
-- Each region specified in @indirectCommandsAddress@ is decompressed from
-- the source to destination region based on the specified
-- @decompressionMethod@.
--
-- == Valid Usage
--
-- -   #VUID-vkCmdDecompressMemoryIndirectCountNV-None-07692# The
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#features-memoryDecompression memoryDecompression>
--     feature /must/ be enabled
--
-- -   #VUID-vkCmdDecompressMemoryIndirectCountNV-indirectCommandsAddress-07694#
--     @indirectCommandsAddress@ /must/ be a device address allocated to
--     the application from a buffer created with the
--     'Vulkan.Core10.Enums.BufferUsageFlagBits.BUFFER_USAGE_INDIRECT_BUFFER_BIT'
--     usage flag set
--
-- -   #VUID-vkCmdDecompressMemoryIndirectCountNV-indirectCommandsAddress-07695#
--     @indirectCommandsAddress@ /must/ be a multiple of @4@
--
-- -   #VUID-vkCmdDecompressMemoryIndirectCountNV-indirectCommandsCountAddress-07697#
--     @indirectCommandsCountAddress@ /must/ be a device address allocated
--     to the application from a buffer created with the
--     'Vulkan.Core10.Enums.BufferUsageFlagBits.BUFFER_USAGE_INDIRECT_BUFFER_BIT'
--     usage flag set
--
-- -   #VUID-vkCmdDecompressMemoryIndirectCountNV-indirectCommandsCountAddress-07698#
--     @indirectCommandsCountAddress@ /must/ be a multiple of @4@
--
-- -   #VUID-vkCmdDecompressMemoryIndirectCountNV-indirectCommandsCountAddress-07699#
--     The count stored in @indirectCommandsCountAddress@ /must/ be less
--     than or equal to
--     'Vulkan.Extensions.VK_EXT_memory_decompression.PhysicalDeviceMemoryDecompressionPropertiesEXT'::@maxDecompressionIndirectCount@
--
-- -   #VUID-vkCmdDecompressMemoryIndirectCountNV-indirectCommandsAddress-11794#
--     All device addresses between @indirectCommandsAddress@ and
--     @indirectCommandsAddress@ + (@stride@ × (count stored in
--     @indirectCommandsCountAddress@)) - 1 /must/ be in the buffer device
--     address range of the same buffer
--
-- -   #VUID-vkCmdDecompressMemoryIndirectCountNV-stride-11770# @stride@
--     /must/ be a multiple of @4@ and /must/ be greater than or equal to
--     sizeof('DecompressMemoryRegionNV')
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-vkCmdDecompressMemoryIndirectCountNV-commandBuffer-parameter#
--     @commandBuffer@ /must/ be a valid
--     'Vulkan.Core10.Handles.CommandBuffer' handle
--
-- -   #VUID-vkCmdDecompressMemoryIndirectCountNV-indirectCommandsAddress-parameter#
--     @indirectCommandsAddress@ /must/ be a valid
--     'Vulkan.Core10.FundamentalTypes.DeviceAddress' value
--
-- -   #VUID-vkCmdDecompressMemoryIndirectCountNV-indirectCommandsCountAddress-parameter#
--     @indirectCommandsCountAddress@ /must/ be a valid
--     'Vulkan.Core10.FundamentalTypes.DeviceAddress' value
--
-- -   #VUID-vkCmdDecompressMemoryIndirectCountNV-commandBuffer-recording#
--     @commandBuffer@ /must/ be in the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#commandbuffers-lifecycle recording state>
--
-- -   #VUID-vkCmdDecompressMemoryIndirectCountNV-commandBuffer-cmdpool#
--     The 'Vulkan.Core10.Handles.CommandPool' that @commandBuffer@ was
--     allocated from /must/ support
--     'Vulkan.Core10.Enums.QueueFlagBits.QUEUE_COMPUTE_BIT', or
--     'Vulkan.Core10.Enums.QueueFlagBits.QUEUE_GRAPHICS_BIT' operations
--
-- -   #VUID-vkCmdDecompressMemoryIndirectCountNV-renderpass# This command
--     /must/ only be called outside of a render pass instance
--
-- -   #VUID-vkCmdDecompressMemoryIndirectCountNV-suspended# This command
--     /must/ not be called between suspended render pass instances
--
-- -   #VUID-vkCmdDecompressMemoryIndirectCountNV-videocoding# This command
--     /must/ only be called outside of a video coding scope
--
-- == Host Synchronization
--
-- -   Host access to @commandBuffer@ /must/ be externally synchronized
--
-- -   Host access to the 'Vulkan.Core10.Handles.CommandPool' that
--     @commandBuffer@ was allocated from /must/ be externally synchronized
--
-- == Command Properties
--
-- \'
--
-- +----------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
-- | <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VkCommandBufferLevel Command Buffer Levels> | <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#vkCmdBeginRenderPass Render Pass Scope> | <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#vkCmdBeginVideoCodingKHR Video Coding Scope> | <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VkQueueFlagBits Supported Queue Types> | <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#fundamentals-queueoperation-command-types Command Type> |
-- +============================================================================================================================+========================================================================================================================+=============================================================================================================================+=======================================================================================================================+========================================================================================================================================+
-- | Primary                                                                                                                    | Outside                                                                                                                | Outside                                                                                                                     | VK_QUEUE_COMPUTE_BIT                                                                                                  | Action                                                                                                                                 |
-- | Secondary                                                                                                                  |                                                                                                                        |                                                                                                                             | VK_QUEUE_GRAPHICS_BIT                                                                                                 |                                                                                                                                        |
-- +----------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
--
-- == Conditional Rendering
--
-- vkCmdDecompressMemoryIndirectCountNV is not affected by
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#drawing-conditional-rendering conditional rendering>
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_NV_memory_decompression VK_NV_memory_decompression>,
-- 'Vulkan.Core10.Handles.CommandBuffer',
-- 'Vulkan.Core10.FundamentalTypes.DeviceAddress'
cmdDecompressMemoryIndirectCountNV :: forall io
                                    . (MonadIO io)
                                   => -- | @commandBuffer@ is the command buffer into which the command will be
                                      -- recorded.
                                      CommandBuffer
                                   -> -- | @indirectCommandsAddress@ is the device address containing decompression
                                      -- parameters laid out as an array of 'DecompressMemoryRegionNV'
                                      -- structures.
                                      ("indirectCommandsAddress" ::: DeviceAddress)
                                   -> -- | @indirectCommandsCountAddress@ is the device address containing a 32-bit
                                      -- integer value specifying the decompression count.
                                      ("indirectCommandsCountAddress" ::: DeviceAddress)
                                   -> -- | @stride@ is the byte stride between successive sets of decompression
                                      -- parameters located starting from @indirectCommandsAddress@.
                                      ("stride" ::: Word32)
                                   -> io ()
cmdDecompressMemoryIndirectCountNV :: forall (io :: * -> *).
MonadIO io =>
CommandBuffer
-> ("indirectCommandsAddress" ::: DeviceAddress)
-> ("indirectCommandsAddress" ::: DeviceAddress)
-> Word32
-> io ()
cmdDecompressMemoryIndirectCountNV CommandBuffer
commandBuffer
                                     "indirectCommandsAddress" ::: DeviceAddress
indirectCommandsAddress
                                     "indirectCommandsAddress" ::: DeviceAddress
indirectCommandsCountAddress
                                     Word32
stride = IO () -> io ()
forall a. IO a -> io a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> io ()) -> IO () -> io ()
forall a b. (a -> b) -> a -> b
$ do
  let vkCmdDecompressMemoryIndirectCountNVPtr :: FunPtr
  (Ptr CommandBuffer_T
   -> ("indirectCommandsAddress" ::: DeviceAddress)
   -> ("indirectCommandsAddress" ::: DeviceAddress)
   -> Word32
   -> IO ())
vkCmdDecompressMemoryIndirectCountNVPtr = DeviceCmds
-> FunPtr
     (Ptr CommandBuffer_T
      -> ("indirectCommandsAddress" ::: DeviceAddress)
      -> ("indirectCommandsAddress" ::: DeviceAddress)
      -> Word32
      -> IO ())
pVkCmdDecompressMemoryIndirectCountNV (case CommandBuffer
commandBuffer of CommandBuffer{DeviceCmds
deviceCmds :: CommandBuffer -> DeviceCmds
deviceCmds :: DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
  Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr CommandBuffer_T
   -> ("indirectCommandsAddress" ::: DeviceAddress)
   -> ("indirectCommandsAddress" ::: DeviceAddress)
   -> Word32
   -> IO ())
vkCmdDecompressMemoryIndirectCountNVPtr FunPtr
  (Ptr CommandBuffer_T
   -> ("indirectCommandsAddress" ::: DeviceAddress)
   -> ("indirectCommandsAddress" ::: DeviceAddress)
   -> Word32
   -> IO ())
-> FunPtr
     (Ptr CommandBuffer_T
      -> ("indirectCommandsAddress" ::: DeviceAddress)
      -> ("indirectCommandsAddress" ::: DeviceAddress)
      -> Word32
      -> IO ())
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr CommandBuffer_T
   -> ("indirectCommandsAddress" ::: DeviceAddress)
   -> ("indirectCommandsAddress" ::: DeviceAddress)
   -> Word32
   -> IO ())
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
    IOException -> IO ()
forall e a. (HasCallStack, Exception e) => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"The function pointer for vkCmdDecompressMemoryIndirectCountNV is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkCmdDecompressMemoryIndirectCountNV' :: Ptr CommandBuffer_T
-> ("indirectCommandsAddress" ::: DeviceAddress)
-> ("indirectCommandsAddress" ::: DeviceAddress)
-> Word32
-> IO ()
vkCmdDecompressMemoryIndirectCountNV' = FunPtr
  (Ptr CommandBuffer_T
   -> ("indirectCommandsAddress" ::: DeviceAddress)
   -> ("indirectCommandsAddress" ::: DeviceAddress)
   -> Word32
   -> IO ())
-> Ptr CommandBuffer_T
-> ("indirectCommandsAddress" ::: DeviceAddress)
-> ("indirectCommandsAddress" ::: DeviceAddress)
-> Word32
-> IO ()
mkVkCmdDecompressMemoryIndirectCountNV FunPtr
  (Ptr CommandBuffer_T
   -> ("indirectCommandsAddress" ::: DeviceAddress)
   -> ("indirectCommandsAddress" ::: DeviceAddress)
   -> Word32
   -> IO ())
vkCmdDecompressMemoryIndirectCountNVPtr
  String -> IO () -> IO ()
forall a. String -> IO a -> IO a
traceAroundEvent String
"vkCmdDecompressMemoryIndirectCountNV" (Ptr CommandBuffer_T
-> ("indirectCommandsAddress" ::: DeviceAddress)
-> ("indirectCommandsAddress" ::: DeviceAddress)
-> Word32
-> IO ()
vkCmdDecompressMemoryIndirectCountNV'
                                                             (CommandBuffer -> Ptr CommandBuffer_T
commandBufferHandle (CommandBuffer
commandBuffer))
                                                             ("indirectCommandsAddress" ::: DeviceAddress
indirectCommandsAddress)
                                                             ("indirectCommandsAddress" ::: DeviceAddress
indirectCommandsCountAddress)
                                                             (Word32
stride))
  () -> IO ()
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (() -> IO ()) -> () -> IO ()
forall a b. (a -> b) -> a -> b
$ ()


-- No documentation found for TopLevel "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_FEATURES_NV"
pattern $mSTRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_FEATURES_NV :: forall {r}. StructureType -> ((# #) -> r) -> ((# #) -> r) -> r
$bSTRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_FEATURES_NV :: StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_FEATURES_NV = STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_FEATURES_EXT


-- No documentation found for TopLevel "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_PROPERTIES_NV"
pattern $mSTRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_PROPERTIES_NV :: forall {r}. StructureType -> ((# #) -> r) -> ((# #) -> r) -> r
$bSTRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_PROPERTIES_NV :: StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_PROPERTIES_NV = STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_PROPERTIES_EXT


-- | VkDecompressMemoryRegionNV - Structure specifying decompression region
-- parameters
--
-- == Valid Usage
--
-- -   #VUID-VkDecompressMemoryRegionNV-decompressionMethod-07690# The
--     @decompressionMethod@ /must/ have a single bit set
--
-- -   #VUID-VkDecompressMemoryRegionNV-srcAddress-07685# @srcAddress@
--     /must/ be 4 byte aligned
--
-- -   #VUID-VkDecompressMemoryRegionNV-srcAddress-07686# The memory range
--     defined by @srcAddress@ and @compressedSize@ /must/ be contained
--     within the size of the buffer bound to @srcAddress@, minus the
--     offset of @srcAddress@ from the base address of that buffer
--
-- -   #VUID-VkDecompressMemoryRegionNV-dstAddress-07687# @dstAddress@
--     /must/ be 4 byte aligned
--
-- -   #VUID-VkDecompressMemoryRegionNV-dstAddress-07688# The memory range
--     defined by @dstAddress@ and @decompressedSize@ /must/ be contained
--     within the size of the buffer bound to @dstAddress@, minus the
--     offset of @dstAddress@ from the base address of that buffer
--
-- -   #VUID-VkDecompressMemoryRegionNV-decompressedSize-07689#
--     @decompressedSize@ /must/ be large enough to hold the decompressed
--     data based on the @decompressionMethod@
--
-- -   #VUID-VkDecompressMemoryRegionNV-compressedSize-11795#
--     @compressedSize@ /must/ not be zero
--
-- -   #VUID-VkDecompressMemoryRegionNV-decompressedSize-11796#
--     @decompressedSize@ /must/ not be zero
--
-- -   #VUID-VkDecompressMemoryRegionNV-srcAddress-07691# The memory range
--     defined by @srcAddress@ and @compressedSize@ /must/ not overlap the
--     memory range defined by @dstAddress@ and @decompressedSize@
--
-- -   #VUID-VkDecompressMemoryRegionNV-decompressionMethod-09395# If
--     @decompressionMethod@ is
--     'Vulkan.Extensions.VK_EXT_memory_decompression.MEMORY_DECOMPRESSION_METHOD_GDEFLATE_1_0_BIT_EXT',
--     then @decompressedSize@ /must/ be less than or equal to 65536 bytes
--
-- -   #VUID-vkCmdDecompressMemoryNV-memoryDecompression-11766# The
--     <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#features-memoryDecompression memoryDecompression>
--     feature /must/ be enabled
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_NV_memory_decompression VK_NV_memory_decompression>,
-- 'Vulkan.Core10.FundamentalTypes.DeviceAddress',
-- 'Vulkan.Core10.FundamentalTypes.DeviceSize',
-- 'Vulkan.Extensions.VK_EXT_memory_decompression.MemoryDecompressionMethodFlagsEXT',
-- 'cmdDecompressMemoryNV'
data DecompressMemoryRegionNV = DecompressMemoryRegionNV
  { -- | @srcAddress@ is the address where compressed data is stored.
    DecompressMemoryRegionNV
-> "indirectCommandsAddress" ::: DeviceAddress
srcAddress :: DeviceAddress
  , -- | @dstAddress@ is the destination address where decompressed data will be
    -- written.
    DecompressMemoryRegionNV
-> "indirectCommandsAddress" ::: DeviceAddress
dstAddress :: DeviceAddress
  , -- | @compressedSize@ is the size of compressed data in bytes.
    DecompressMemoryRegionNV
-> "indirectCommandsAddress" ::: DeviceAddress
compressedSize :: DeviceSize
  , -- | @decompressedSize@ is the size of decompressed data in bytes.
    DecompressMemoryRegionNV
-> "indirectCommandsAddress" ::: DeviceAddress
decompressedSize :: DeviceSize
  , -- | @decompressionMethod@ is a bitmask of
    -- 'MemoryDecompressionMethodFlagBitsNV' with a single bit set specifying
    -- the method used to decompress data.
    DecompressMemoryRegionNV -> MemoryDecompressionMethodFlagsNV
decompressionMethod :: MemoryDecompressionMethodFlagsNV
  }
  deriving (Typeable, DecompressMemoryRegionNV -> DecompressMemoryRegionNV -> Bool
(DecompressMemoryRegionNV -> DecompressMemoryRegionNV -> Bool)
-> (DecompressMemoryRegionNV -> DecompressMemoryRegionNV -> Bool)
-> Eq DecompressMemoryRegionNV
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DecompressMemoryRegionNV -> DecompressMemoryRegionNV -> Bool
== :: DecompressMemoryRegionNV -> DecompressMemoryRegionNV -> Bool
$c/= :: DecompressMemoryRegionNV -> DecompressMemoryRegionNV -> Bool
/= :: DecompressMemoryRegionNV -> DecompressMemoryRegionNV -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (DecompressMemoryRegionNV)
#endif
deriving instance Show DecompressMemoryRegionNV

instance ToCStruct DecompressMemoryRegionNV where
  withCStruct :: forall b.
DecompressMemoryRegionNV
-> (Ptr DecompressMemoryRegionNV -> IO b) -> IO b
withCStruct DecompressMemoryRegionNV
x Ptr DecompressMemoryRegionNV -> IO b
f = Int -> (Ptr DecompressMemoryRegionNV -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
40 ((Ptr DecompressMemoryRegionNV -> IO b) -> IO b)
-> (Ptr DecompressMemoryRegionNV -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr DecompressMemoryRegionNV
p -> Ptr DecompressMemoryRegionNV
-> DecompressMemoryRegionNV -> IO b -> IO b
forall b.
Ptr DecompressMemoryRegionNV
-> DecompressMemoryRegionNV -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr DecompressMemoryRegionNV
p DecompressMemoryRegionNV
x (Ptr DecompressMemoryRegionNV -> IO b
f Ptr DecompressMemoryRegionNV
p)
  pokeCStruct :: forall b.
Ptr DecompressMemoryRegionNV
-> DecompressMemoryRegionNV -> IO b -> IO b
pokeCStruct Ptr DecompressMemoryRegionNV
p DecompressMemoryRegionNV{"indirectCommandsAddress" ::: DeviceAddress
MemoryDecompressionMethodFlagsNV
srcAddress :: DecompressMemoryRegionNV
-> "indirectCommandsAddress" ::: DeviceAddress
dstAddress :: DecompressMemoryRegionNV
-> "indirectCommandsAddress" ::: DeviceAddress
compressedSize :: DecompressMemoryRegionNV
-> "indirectCommandsAddress" ::: DeviceAddress
decompressedSize :: DecompressMemoryRegionNV
-> "indirectCommandsAddress" ::: DeviceAddress
decompressionMethod :: DecompressMemoryRegionNV -> MemoryDecompressionMethodFlagsNV
srcAddress :: "indirectCommandsAddress" ::: DeviceAddress
dstAddress :: "indirectCommandsAddress" ::: DeviceAddress
compressedSize :: "indirectCommandsAddress" ::: DeviceAddress
decompressedSize :: "indirectCommandsAddress" ::: DeviceAddress
decompressionMethod :: MemoryDecompressionMethodFlagsNV
..} IO b
f = do
    Ptr ("indirectCommandsAddress" ::: DeviceAddress)
-> ("indirectCommandsAddress" ::: DeviceAddress) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DecompressMemoryRegionNV
p Ptr DecompressMemoryRegionNV
-> Int -> Ptr ("indirectCommandsAddress" ::: DeviceAddress)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr DeviceAddress)) ("indirectCommandsAddress" ::: DeviceAddress
srcAddress)
    Ptr ("indirectCommandsAddress" ::: DeviceAddress)
-> ("indirectCommandsAddress" ::: DeviceAddress) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DecompressMemoryRegionNV
p Ptr DecompressMemoryRegionNV
-> Int -> Ptr ("indirectCommandsAddress" ::: DeviceAddress)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr DeviceAddress)) ("indirectCommandsAddress" ::: DeviceAddress
dstAddress)
    Ptr ("indirectCommandsAddress" ::: DeviceAddress)
-> ("indirectCommandsAddress" ::: DeviceAddress) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DecompressMemoryRegionNV
p Ptr DecompressMemoryRegionNV
-> Int -> Ptr ("indirectCommandsAddress" ::: DeviceAddress)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr DeviceSize)) ("indirectCommandsAddress" ::: DeviceAddress
compressedSize)
    Ptr ("indirectCommandsAddress" ::: DeviceAddress)
-> ("indirectCommandsAddress" ::: DeviceAddress) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DecompressMemoryRegionNV
p Ptr DecompressMemoryRegionNV
-> Int -> Ptr ("indirectCommandsAddress" ::: DeviceAddress)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr DeviceSize)) ("indirectCommandsAddress" ::: DeviceAddress
decompressedSize)
    Ptr MemoryDecompressionMethodFlagsNV
-> MemoryDecompressionMethodFlagsNV -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DecompressMemoryRegionNV
p Ptr DecompressMemoryRegionNV
-> Int -> Ptr MemoryDecompressionMethodFlagsNV
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr MemoryDecompressionMethodFlagsNV)) (MemoryDecompressionMethodFlagsNV
decompressionMethod)
    IO b
f
  cStructSize :: Int
cStructSize = Int
40
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b. Ptr DecompressMemoryRegionNV -> IO b -> IO b
pokeZeroCStruct Ptr DecompressMemoryRegionNV
p IO b
f = do
    Ptr ("indirectCommandsAddress" ::: DeviceAddress)
-> ("indirectCommandsAddress" ::: DeviceAddress) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DecompressMemoryRegionNV
p Ptr DecompressMemoryRegionNV
-> Int -> Ptr ("indirectCommandsAddress" ::: DeviceAddress)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr DeviceAddress)) ("indirectCommandsAddress" ::: DeviceAddress
forall a. Zero a => a
zero)
    Ptr ("indirectCommandsAddress" ::: DeviceAddress)
-> ("indirectCommandsAddress" ::: DeviceAddress) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DecompressMemoryRegionNV
p Ptr DecompressMemoryRegionNV
-> Int -> Ptr ("indirectCommandsAddress" ::: DeviceAddress)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr DeviceAddress)) ("indirectCommandsAddress" ::: DeviceAddress
forall a. Zero a => a
zero)
    Ptr ("indirectCommandsAddress" ::: DeviceAddress)
-> ("indirectCommandsAddress" ::: DeviceAddress) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DecompressMemoryRegionNV
p Ptr DecompressMemoryRegionNV
-> Int -> Ptr ("indirectCommandsAddress" ::: DeviceAddress)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr DeviceSize)) ("indirectCommandsAddress" ::: DeviceAddress
forall a. Zero a => a
zero)
    Ptr ("indirectCommandsAddress" ::: DeviceAddress)
-> ("indirectCommandsAddress" ::: DeviceAddress) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DecompressMemoryRegionNV
p Ptr DecompressMemoryRegionNV
-> Int -> Ptr ("indirectCommandsAddress" ::: DeviceAddress)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr DeviceSize)) ("indirectCommandsAddress" ::: DeviceAddress
forall a. Zero a => a
zero)
    Ptr MemoryDecompressionMethodFlagsNV
-> MemoryDecompressionMethodFlagsNV -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DecompressMemoryRegionNV
p Ptr DecompressMemoryRegionNV
-> Int -> Ptr MemoryDecompressionMethodFlagsNV
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr MemoryDecompressionMethodFlagsNV)) (MemoryDecompressionMethodFlagsNV
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct DecompressMemoryRegionNV where
  peekCStruct :: Ptr DecompressMemoryRegionNV -> IO DecompressMemoryRegionNV
peekCStruct Ptr DecompressMemoryRegionNV
p = do
    srcAddress <- forall a. Storable a => Ptr a -> IO a
peek @DeviceAddress ((Ptr DecompressMemoryRegionNV
p Ptr DecompressMemoryRegionNV
-> Int -> Ptr ("indirectCommandsAddress" ::: DeviceAddress)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr DeviceAddress))
    dstAddress <- peek @DeviceAddress ((p `plusPtr` 8 :: Ptr DeviceAddress))
    compressedSize <- peek @DeviceSize ((p `plusPtr` 16 :: Ptr DeviceSize))
    decompressedSize <- peek @DeviceSize ((p `plusPtr` 24 :: Ptr DeviceSize))
    decompressionMethod <- peek @MemoryDecompressionMethodFlagsNV ((p `plusPtr` 32 :: Ptr MemoryDecompressionMethodFlagsNV))
    pure $ DecompressMemoryRegionNV
             srcAddress
             dstAddress
             compressedSize
             decompressedSize
             decompressionMethod

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

instance Zero DecompressMemoryRegionNV where
  zero :: DecompressMemoryRegionNV
zero = ("indirectCommandsAddress" ::: DeviceAddress)
-> ("indirectCommandsAddress" ::: DeviceAddress)
-> ("indirectCommandsAddress" ::: DeviceAddress)
-> ("indirectCommandsAddress" ::: DeviceAddress)
-> MemoryDecompressionMethodFlagsNV
-> DecompressMemoryRegionNV
DecompressMemoryRegionNV
           "indirectCommandsAddress" ::: DeviceAddress
forall a. Zero a => a
zero
           "indirectCommandsAddress" ::: DeviceAddress
forall a. Zero a => a
zero
           "indirectCommandsAddress" ::: DeviceAddress
forall a. Zero a => a
zero
           "indirectCommandsAddress" ::: DeviceAddress
forall a. Zero a => a
zero
           MemoryDecompressionMethodFlagsNV
forall a. Zero a => a
zero


-- No documentation found for TopLevel "VkMemoryDecompressionMethodFlagsNV"
type MemoryDecompressionMethodFlagsNV = MemoryDecompressionMethodFlagsEXT


-- No documentation found for TopLevel "VkMemoryDecompressionMethodFlagBitsNV"
type MemoryDecompressionMethodFlagBitsNV = MemoryDecompressionMethodFlagBitsEXT


-- No documentation found for TopLevel "VkPhysicalDeviceMemoryDecompressionFeaturesNV"
type PhysicalDeviceMemoryDecompressionFeaturesNV = PhysicalDeviceMemoryDecompressionFeaturesEXT


-- No documentation found for TopLevel "VkPhysicalDeviceMemoryDecompressionPropertiesNV"
type PhysicalDeviceMemoryDecompressionPropertiesNV = PhysicalDeviceMemoryDecompressionPropertiesEXT


type NV_MEMORY_DECOMPRESSION_SPEC_VERSION = 1

-- No documentation found for TopLevel "VK_NV_MEMORY_DECOMPRESSION_SPEC_VERSION"
pattern NV_MEMORY_DECOMPRESSION_SPEC_VERSION :: forall a . Integral a => a
pattern $mNV_MEMORY_DECOMPRESSION_SPEC_VERSION :: forall {r} {a}.
Integral a =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
$bNV_MEMORY_DECOMPRESSION_SPEC_VERSION :: forall a. Integral a => a
NV_MEMORY_DECOMPRESSION_SPEC_VERSION = 1


type NV_MEMORY_DECOMPRESSION_EXTENSION_NAME = "VK_NV_memory_decompression"

-- No documentation found for TopLevel "VK_NV_MEMORY_DECOMPRESSION_EXTENSION_NAME"
pattern NV_MEMORY_DECOMPRESSION_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $mNV_MEMORY_DECOMPRESSION_EXTENSION_NAME :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
$bNV_MEMORY_DECOMPRESSION_EXTENSION_NAME :: forall a. (Eq a, IsString a) => a
NV_MEMORY_DECOMPRESSION_EXTENSION_NAME = "VK_NV_memory_decompression"