{-# language CPP #-}
-- | = Name
--
-- VK_EXT_map_memory_placed - device extension
--
-- = VK_EXT_map_memory_placed
--
-- [__Name String__]
--     @VK_EXT_map_memory_placed@
--
-- [__Extension Type__]
--     Device extension
--
-- [__Registered Extension Number__]
--     273
--
-- [__Revision__]
--     1
--
-- [__Ratification Status__]
--     Ratified
--
-- [__Extension and Version Dependencies__]
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_map_memory2 VK_KHR_map_memory2>
--     or
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#versions-1.4 Vulkan Version 1.4>
--
-- [__Contact__]
--
--     -   Faith Ekstrand
--         <https://github.com/KhronosGroup/Vulkan-Docs/issues/new?body=[VK_EXT_map_memory_placed] @gfxstrand%0A*Here describe the issue or question you have about the VK_EXT_map_memory_placed extension* >
--
-- [__Extension Proposal__]
--     <https://github.com/KhronosGroup/Vulkan-Docs/tree/main/proposals/VK_EXT_map_memory_placed.adoc VK_EXT_map_memory_placed>
--
-- == Other Extension Metadata
--
-- [__Last Modified Date__]
--     2023-03-21
--
-- [__IP Status__]
--     No known IP claims.
--
-- [__Interactions and External Dependencies__]
--
--     -   Depends on apitext:VK_KHR_map_memory2
--
--     -   Interacts with apitext:VK_EXT_external_memory_host
--
-- [__Contributors__]
--
--     -   Faith Ekstrand, Collabora
--
--     -   Tobias Hector, AMD
--
--     -   James Jones, NVIDIA
--
--     -   Georg Lehmann, Valve
--
--     -   Derek Lesho, Codeweavers
--
-- == Description
--
-- This extension allows an application to request that
-- 'Vulkan.Extensions.VK_KHR_map_memory2.mapMemory2KHR' attempt to place
-- the memory map at a particular virtual address.
--
-- == New Structures
--
-- -   Extending
--     'Vulkan.Core14.Promoted_From_VK_KHR_map_memory2Roadmap.MemoryMapInfo':
--
--     -   'MemoryMapPlacedInfoEXT'
--
-- -   Extending
--     'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceFeatures2',
--     'Vulkan.Core10.Device.DeviceCreateInfo':
--
--     -   'PhysicalDeviceMapMemoryPlacedFeaturesEXT'
--
-- -   Extending
--     'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceProperties2':
--
--     -   'PhysicalDeviceMapMemoryPlacedPropertiesEXT'
--
-- == New Enum Constants
--
-- -   'EXT_MAP_MEMORY_PLACED_EXTENSION_NAME'
--
-- -   'EXT_MAP_MEMORY_PLACED_SPEC_VERSION'
--
-- -   Extending 'Vulkan.Core10.Enums.MemoryMapFlagBits.MemoryMapFlagBits':
--
--     -   'Vulkan.Core10.Enums.MemoryMapFlagBits.MEMORY_MAP_PLACED_BIT_EXT'
--
-- -   Extending
--     'Vulkan.Core14.Enums.MemoryUnmapFlagBits.MemoryUnmapFlagBits':
--
--     -   'Vulkan.Core14.Enums.MemoryUnmapFlagBits.MEMORY_UNMAP_RESERVE_BIT_EXT'
--
-- -   Extending 'Vulkan.Core10.Enums.StructureType.StructureType':
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_MEMORY_MAP_PLACED_INFO_EXT'
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_PHYSICAL_DEVICE_MAP_MEMORY_PLACED_FEATURES_EXT'
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_PHYSICAL_DEVICE_MAP_MEMORY_PLACED_PROPERTIES_EXT'
--
-- == Version History
--
-- -   Revision 1, 2024-01-14 (Faith Ekstrand)
--
--     -   Internal revisions
--
-- == See Also
--
-- No cross-references are available
--
-- == Document Notes
--
-- For more information, see the
-- <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#VK_EXT_map_memory_placed Vulkan Specification>.
--
-- This page is a generated document. Fixes and changes should be made to
-- the generator scripts, not directly.
module Vulkan.Extensions.VK_EXT_map_memory_placed  ( PhysicalDeviceMapMemoryPlacedFeaturesEXT(..)
                                                   , PhysicalDeviceMapMemoryPlacedPropertiesEXT(..)
                                                   , MemoryMapPlacedInfoEXT(..)
                                                   , EXT_MAP_MEMORY_PLACED_SPEC_VERSION
                                                   , pattern EXT_MAP_MEMORY_PLACED_SPEC_VERSION
                                                   , EXT_MAP_MEMORY_PLACED_EXTENSION_NAME
                                                   , pattern EXT_MAP_MEMORY_PLACED_EXTENSION_NAME
                                                   ) where

import Foreign.Marshal.Alloc (allocaBytes)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Zero (Zero(..))
import Data.String (IsString)
import Data.Typeable (Typeable)
import Foreign.Storable (Storable)
import Foreign.Storable (Storable(peek))
import Foreign.Storable (Storable(poke))
import qualified Foreign.Storable (Storable(..))
import GHC.Generics (Generic)
import Foreign.Ptr (Ptr)
import Data.Kind (Type)
import Vulkan.Core10.FundamentalTypes (bool32ToBool)
import Vulkan.Core10.FundamentalTypes (boolToBool32)
import Vulkan.Core10.FundamentalTypes (Bool32)
import Vulkan.Core10.FundamentalTypes (DeviceSize)
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_MEMORY_MAP_PLACED_INFO_EXT))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_MAP_MEMORY_PLACED_FEATURES_EXT))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_MAP_MEMORY_PLACED_PROPERTIES_EXT))
-- | VkPhysicalDeviceMapMemoryPlacedFeaturesEXT - Structure describing placed
-- memory map features that can be supported by an implementation
--
-- = Members
--
-- This structure describes the following features:
--
-- = Description
--
-- If the 'PhysicalDeviceMapMemoryPlacedFeaturesEXT' 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
-- 'PhysicalDeviceMapMemoryPlacedFeaturesEXT', 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_map_memory_placed VK_EXT_map_memory_placed>,
-- 'Vulkan.Core10.FundamentalTypes.Bool32',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PhysicalDeviceMapMemoryPlacedFeaturesEXT = PhysicalDeviceMapMemoryPlacedFeaturesEXT
  { -- | #features-memoryMapPlaced# @memoryMapPlaced@ indicates that the
    -- implementation supports placing memory maps at application-specified
    -- virtual addresses.
    PhysicalDeviceMapMemoryPlacedFeaturesEXT -> Bool
memoryMapPlaced :: Bool
  , -- | #features-memoryMapRangePlaced# @memoryMapRangePlaced@ indicates that
    -- the implementation supports placing memory maps of a subrange of a
    -- memory object at application-specified virtual addresses.
    PhysicalDeviceMapMemoryPlacedFeaturesEXT -> Bool
memoryMapRangePlaced :: Bool
  , -- | #features-memoryUnmapReserve# @memoryUnmapReserve@ indicates that the
    -- implementation supports leaving the memory range reserved when unmapping
    -- a memory object.
    PhysicalDeviceMapMemoryPlacedFeaturesEXT -> Bool
memoryUnmapReserve :: Bool
  }
  deriving (Typeable, PhysicalDeviceMapMemoryPlacedFeaturesEXT
-> PhysicalDeviceMapMemoryPlacedFeaturesEXT -> Bool
(PhysicalDeviceMapMemoryPlacedFeaturesEXT
 -> PhysicalDeviceMapMemoryPlacedFeaturesEXT -> Bool)
-> (PhysicalDeviceMapMemoryPlacedFeaturesEXT
    -> PhysicalDeviceMapMemoryPlacedFeaturesEXT -> Bool)
-> Eq PhysicalDeviceMapMemoryPlacedFeaturesEXT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PhysicalDeviceMapMemoryPlacedFeaturesEXT
-> PhysicalDeviceMapMemoryPlacedFeaturesEXT -> Bool
== :: PhysicalDeviceMapMemoryPlacedFeaturesEXT
-> PhysicalDeviceMapMemoryPlacedFeaturesEXT -> Bool
$c/= :: PhysicalDeviceMapMemoryPlacedFeaturesEXT
-> PhysicalDeviceMapMemoryPlacedFeaturesEXT -> Bool
/= :: PhysicalDeviceMapMemoryPlacedFeaturesEXT
-> PhysicalDeviceMapMemoryPlacedFeaturesEXT -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceMapMemoryPlacedFeaturesEXT)
#endif
deriving instance Show PhysicalDeviceMapMemoryPlacedFeaturesEXT

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

instance FromCStruct PhysicalDeviceMapMemoryPlacedFeaturesEXT where
  peekCStruct :: Ptr PhysicalDeviceMapMemoryPlacedFeaturesEXT
-> IO PhysicalDeviceMapMemoryPlacedFeaturesEXT
peekCStruct Ptr PhysicalDeviceMapMemoryPlacedFeaturesEXT
p = do
    memoryMapPlaced <- forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PhysicalDeviceMapMemoryPlacedFeaturesEXT
p Ptr PhysicalDeviceMapMemoryPlacedFeaturesEXT -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32))
    memoryMapRangePlaced <- peek @Bool32 ((p `plusPtr` 20 :: Ptr Bool32))
    memoryUnmapReserve <- peek @Bool32 ((p `plusPtr` 24 :: Ptr Bool32))
    pure $ PhysicalDeviceMapMemoryPlacedFeaturesEXT
             (bool32ToBool memoryMapPlaced)
             (bool32ToBool memoryMapRangePlaced)
             (bool32ToBool memoryUnmapReserve)

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

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


-- | VkPhysicalDeviceMapMemoryPlacedPropertiesEXT - Structure describing the
-- alignment requirements of placed memory maps for a physical device
--
-- = Members
--
-- The members of the 'PhysicalDeviceMapMemoryPlacedPropertiesEXT'
-- structure describe the following:
--
-- = Description
--
-- If the 'PhysicalDeviceMapMemoryPlacedPropertiesEXT' structure is
-- included in the @pNext@ chain of the
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceProperties2'
-- structure passed to
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.getPhysicalDeviceProperties2',
-- it is filled in with each corresponding implementation-dependent
-- property.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_map_memory_placed VK_EXT_map_memory_placed>,
-- 'Vulkan.Core10.FundamentalTypes.DeviceSize',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PhysicalDeviceMapMemoryPlacedPropertiesEXT = PhysicalDeviceMapMemoryPlacedPropertiesEXT
  { -- | #limits-minPlacedMemoryMapAlignment# @minPlacedMemoryMapAlignment@ is
    -- the minimum alignment required for memory object offsets and virtual
    -- address ranges when using placed memory mapping.
    PhysicalDeviceMapMemoryPlacedPropertiesEXT -> DeviceSize
minPlacedMemoryMapAlignment :: DeviceSize }
  deriving (Typeable, PhysicalDeviceMapMemoryPlacedPropertiesEXT
-> PhysicalDeviceMapMemoryPlacedPropertiesEXT -> Bool
(PhysicalDeviceMapMemoryPlacedPropertiesEXT
 -> PhysicalDeviceMapMemoryPlacedPropertiesEXT -> Bool)
-> (PhysicalDeviceMapMemoryPlacedPropertiesEXT
    -> PhysicalDeviceMapMemoryPlacedPropertiesEXT -> Bool)
-> Eq PhysicalDeviceMapMemoryPlacedPropertiesEXT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PhysicalDeviceMapMemoryPlacedPropertiesEXT
-> PhysicalDeviceMapMemoryPlacedPropertiesEXT -> Bool
== :: PhysicalDeviceMapMemoryPlacedPropertiesEXT
-> PhysicalDeviceMapMemoryPlacedPropertiesEXT -> Bool
$c/= :: PhysicalDeviceMapMemoryPlacedPropertiesEXT
-> PhysicalDeviceMapMemoryPlacedPropertiesEXT -> Bool
/= :: PhysicalDeviceMapMemoryPlacedPropertiesEXT
-> PhysicalDeviceMapMemoryPlacedPropertiesEXT -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceMapMemoryPlacedPropertiesEXT)
#endif
deriving instance Show PhysicalDeviceMapMemoryPlacedPropertiesEXT

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

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

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


-- | VkMemoryMapPlacedInfoEXT - Structure containing memory map placement
-- parameters
--
-- == Valid Usage
--
-- -   #VUID-VkMemoryMapPlacedInfoEXT-pPlacedAddress-09577#
--     @pPlacedAddress@ /must/ be aligned to an integer multiple of
--     'PhysicalDeviceMapMemoryPlacedPropertiesEXT'::@minPlacedMemoryMapAlignment@
--
-- -   #VUID-VkMemoryMapPlacedInfoEXT-pPlacedAddress-09578# The address
--     range specified by @pPlacedAddress@ and
--     'Vulkan.Core14.Promoted_From_VK_KHR_map_memory2Roadmap.MemoryMapInfo'::@size@
--     /must/ not overlap any existing Vulkan memory object mapping
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkMemoryMapPlacedInfoEXT-sType-sType# @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_MEMORY_MAP_PLACED_INFO_EXT'
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_map_memory_placed VK_EXT_map_memory_placed>,
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data MemoryMapPlacedInfoEXT = MemoryMapPlacedInfoEXT
  { -- | @pPlacedAddress@ is the virtual address at which to place the address.
    -- If
    -- 'Vulkan.Core14.Promoted_From_VK_KHR_map_memory2Roadmap.MemoryMapInfo'::@flags@
    -- does not contain
    -- 'Vulkan.Core10.Enums.MemoryMapFlagBits.MEMORY_MAP_PLACED_BIT_EXT', this
    -- value is ignored.
    MemoryMapPlacedInfoEXT -> Ptr ()
placedAddress :: Ptr () }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (MemoryMapPlacedInfoEXT)
#endif
deriving instance Show MemoryMapPlacedInfoEXT

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

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

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

instance Zero MemoryMapPlacedInfoEXT where
  zero :: MemoryMapPlacedInfoEXT
zero = Ptr () -> MemoryMapPlacedInfoEXT
MemoryMapPlacedInfoEXT
           Ptr ()
forall a. Zero a => a
zero


type EXT_MAP_MEMORY_PLACED_SPEC_VERSION = 1

-- No documentation found for TopLevel "VK_EXT_MAP_MEMORY_PLACED_SPEC_VERSION"
pattern EXT_MAP_MEMORY_PLACED_SPEC_VERSION :: forall a . Integral a => a
pattern $mEXT_MAP_MEMORY_PLACED_SPEC_VERSION :: forall {r} {a}.
Integral a =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
$bEXT_MAP_MEMORY_PLACED_SPEC_VERSION :: forall a. Integral a => a
EXT_MAP_MEMORY_PLACED_SPEC_VERSION = 1


type EXT_MAP_MEMORY_PLACED_EXTENSION_NAME = "VK_EXT_map_memory_placed"

-- No documentation found for TopLevel "VK_EXT_MAP_MEMORY_PLACED_EXTENSION_NAME"
pattern EXT_MAP_MEMORY_PLACED_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $mEXT_MAP_MEMORY_PLACED_EXTENSION_NAME :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
$bEXT_MAP_MEMORY_PLACED_EXTENSION_NAME :: forall a. (Eq a, IsString a) => a
EXT_MAP_MEMORY_PLACED_EXTENSION_NAME = "VK_EXT_map_memory_placed"