{-# language CPP #-}
module Vulkan.Extensions.VK_KHR_map_memory2 ( mapMemory2KHR
, unmapMemory2KHR
, MemoryMapInfoKHR(..)
, MemoryUnmapInfoKHR(..)
, MemoryUnmapFlagsKHR(..)
, KHR_MAP_MEMORY_2_SPEC_VERSION
, pattern KHR_MAP_MEMORY_2_SPEC_VERSION
, KHR_MAP_MEMORY_2_EXTENSION_NAME
, pattern KHR_MAP_MEMORY_2_EXTENSION_NAME
) where
import Data.Bits (Bits)
import Data.Bits (FiniteBits)
import Vulkan.Internal.Utils (enumReadPrec)
import Vulkan.Internal.Utils (enumShowsPrec)
import Vulkan.Internal.Utils (traceAroundEvent)
import Control.Exception.Base (bracket)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Foreign.Marshal.Alloc (allocaBytes)
import Foreign.Marshal.Alloc (callocBytes)
import Foreign.Marshal.Alloc (free)
import GHC.Base (when)
import GHC.IO (throwIO)
import GHC.Ptr (nullFunPtr)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import GHC.Show (showString)
import Numeric (showHex)
import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Cont (evalContT)
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Zero (Zero)
import 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 GHC.Read (Read(readPrec))
import GHC.Show (Show(showsPrec))
import Data.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Vulkan.NamedType ((:::))
import Vulkan.Core10.Handles (Device)
import Vulkan.Core10.Handles (Device(..))
import Vulkan.Core10.Handles (Device(Device))
import Vulkan.Dynamic (DeviceCmds(pVkMapMemory2KHR))
import Vulkan.Dynamic (DeviceCmds(pVkUnmapMemory2KHR))
import Vulkan.Core10.Handles (DeviceMemory)
import Vulkan.Core10.FundamentalTypes (DeviceSize)
import Vulkan.Core10.Handles (Device_T)
import Vulkan.Core10.FundamentalTypes (Flags)
import Vulkan.Core10.Enums.MemoryMapFlags (MemoryMapFlags)
import Vulkan.Core10.Enums.Result (Result)
import Vulkan.Core10.Enums.Result (Result(..))
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Exception (VulkanException(..))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_MEMORY_MAP_INFO_KHR))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_MEMORY_UNMAP_INFO_KHR))
import Vulkan.Core10.Enums.Result (Result(SUCCESS))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkMapMemory2KHR
:: FunPtr (Ptr Device_T -> Ptr MemoryMapInfoKHR -> Ptr (Ptr ()) -> IO Result) -> Ptr Device_T -> Ptr MemoryMapInfoKHR -> Ptr (Ptr ()) -> IO Result
mapMemory2KHR :: forall io
. (MonadIO io)
=>
Device
->
MemoryMapInfoKHR
-> io (("data" ::: Ptr ()))
mapMemory2KHR :: forall (io :: * -> *).
MonadIO io =>
Device -> MemoryMapInfoKHR -> io ("data" ::: Ptr ())
mapMemory2KHR Device
device MemoryMapInfoKHR
memoryMapInfo = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT forall a b. (a -> b) -> a -> b
$ do
let vkMapMemory2KHRPtr :: FunPtr
(Ptr Device_T
-> ("pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR)
-> ("ppData" ::: Ptr ("data" ::: Ptr ()))
-> IO Result)
vkMapMemory2KHRPtr = DeviceCmds
-> FunPtr
(Ptr Device_T
-> ("pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR)
-> ("ppData" ::: Ptr ("data" ::: Ptr ()))
-> IO Result)
pVkMapMemory2KHR (case Device
device of Device{DeviceCmds
$sel:deviceCmds:Device :: Device -> DeviceCmds
deviceCmds :: DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
(Ptr Device_T
-> ("pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR)
-> ("ppData" ::: Ptr ("data" ::: Ptr ()))
-> IO Result)
vkMapMemory2KHRPtr forall a. Eq a => a -> a -> Bool
/= forall a. FunPtr a
nullFunPtr) forall a b. (a -> b) -> a -> b
$
forall e a. Exception e => e -> IO a
throwIO forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"The function pointer for vkMapMemory2KHR is null" forall a. Maybe a
Nothing forall a. Maybe a
Nothing
let vkMapMemory2KHR' :: Ptr Device_T
-> ("pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR)
-> ("ppData" ::: Ptr ("data" ::: Ptr ()))
-> IO Result
vkMapMemory2KHR' = FunPtr
(Ptr Device_T
-> ("pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR)
-> ("ppData" ::: Ptr ("data" ::: Ptr ()))
-> IO Result)
-> Ptr Device_T
-> ("pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR)
-> ("ppData" ::: Ptr ("data" ::: Ptr ()))
-> IO Result
mkVkMapMemory2KHR FunPtr
(Ptr Device_T
-> ("pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR)
-> ("ppData" ::: Ptr ("data" ::: Ptr ()))
-> IO Result)
vkMapMemory2KHRPtr
"pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR
pMemoryMapInfo <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT forall a b. (a -> b) -> a -> b
$ forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (MemoryMapInfoKHR
memoryMapInfo)
"ppData" ::: Ptr ("data" ::: Ptr ())
pPpData <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT forall a b. (a -> b) -> a -> b
$ forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (forall a. Int -> IO (Ptr a)
callocBytes @(Ptr ()) Int
8) forall a. Ptr a -> IO ()
free
Result
r <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. String -> IO a -> IO a
traceAroundEvent String
"vkMapMemory2KHR" (Ptr Device_T
-> ("pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR)
-> ("ppData" ::: Ptr ("data" ::: Ptr ()))
-> IO Result
vkMapMemory2KHR'
(Device -> Ptr Device_T
deviceHandle (Device
device))
"pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR
pMemoryMapInfo
("ppData" ::: Ptr ("data" ::: Ptr ())
pPpData))
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Result
r forall a. Ord a => a -> a -> Bool
< Result
SUCCESS) (forall e a. Exception e => e -> IO a
throwIO (Result -> VulkanException
VulkanException Result
r))
"data" ::: Ptr ()
ppData <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> IO a
peek @(Ptr ()) "ppData" ::: Ptr ("data" ::: Ptr ())
pPpData
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ ("data" ::: Ptr ()
ppData)
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkUnmapMemory2KHR
:: FunPtr (Ptr Device_T -> Ptr MemoryUnmapInfoKHR -> IO Result) -> Ptr Device_T -> Ptr MemoryUnmapInfoKHR -> IO Result
unmapMemory2KHR :: forall io
. (MonadIO io)
=>
Device
->
MemoryUnmapInfoKHR
-> io ()
unmapMemory2KHR :: forall (io :: * -> *).
MonadIO io =>
Device -> MemoryUnmapInfoKHR -> io ()
unmapMemory2KHR Device
device MemoryUnmapInfoKHR
memoryUnmapInfo = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT forall a b. (a -> b) -> a -> b
$ do
let vkUnmapMemory2KHRPtr :: FunPtr
(Ptr Device_T
-> ("pMemoryUnmapInfo" ::: Ptr MemoryUnmapInfoKHR) -> IO Result)
vkUnmapMemory2KHRPtr = DeviceCmds
-> FunPtr
(Ptr Device_T
-> ("pMemoryUnmapInfo" ::: Ptr MemoryUnmapInfoKHR) -> IO Result)
pVkUnmapMemory2KHR (case Device
device of Device{DeviceCmds
deviceCmds :: DeviceCmds
$sel:deviceCmds:Device :: Device -> DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
(Ptr Device_T
-> ("pMemoryUnmapInfo" ::: Ptr MemoryUnmapInfoKHR) -> IO Result)
vkUnmapMemory2KHRPtr forall a. Eq a => a -> a -> Bool
/= forall a. FunPtr a
nullFunPtr) forall a b. (a -> b) -> a -> b
$
forall e a. Exception e => e -> IO a
throwIO forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"The function pointer for vkUnmapMemory2KHR is null" forall a. Maybe a
Nothing forall a. Maybe a
Nothing
let vkUnmapMemory2KHR' :: Ptr Device_T
-> ("pMemoryUnmapInfo" ::: Ptr MemoryUnmapInfoKHR) -> IO Result
vkUnmapMemory2KHR' = FunPtr
(Ptr Device_T
-> ("pMemoryUnmapInfo" ::: Ptr MemoryUnmapInfoKHR) -> IO Result)
-> Ptr Device_T
-> ("pMemoryUnmapInfo" ::: Ptr MemoryUnmapInfoKHR)
-> IO Result
mkVkUnmapMemory2KHR FunPtr
(Ptr Device_T
-> ("pMemoryUnmapInfo" ::: Ptr MemoryUnmapInfoKHR) -> IO Result)
vkUnmapMemory2KHRPtr
"pMemoryUnmapInfo" ::: Ptr MemoryUnmapInfoKHR
pMemoryUnmapInfo <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT forall a b. (a -> b) -> a -> b
$ forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (MemoryUnmapInfoKHR
memoryUnmapInfo)
Result
_ <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. String -> IO a -> IO a
traceAroundEvent String
"vkUnmapMemory2KHR" (Ptr Device_T
-> ("pMemoryUnmapInfo" ::: Ptr MemoryUnmapInfoKHR) -> IO Result
vkUnmapMemory2KHR'
(Device -> Ptr Device_T
deviceHandle (Device
device))
"pMemoryUnmapInfo" ::: Ptr MemoryUnmapInfoKHR
pMemoryUnmapInfo)
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ ()
data MemoryMapInfoKHR = MemoryMapInfoKHR
{
MemoryMapInfoKHR -> MemoryMapFlags
flags :: MemoryMapFlags
,
MemoryMapInfoKHR -> DeviceMemory
memory :: DeviceMemory
,
MemoryMapInfoKHR -> DeviceSize
offset :: DeviceSize
,
MemoryMapInfoKHR -> DeviceSize
size :: DeviceSize
}
deriving (Typeable, MemoryMapInfoKHR -> MemoryMapInfoKHR -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MemoryMapInfoKHR -> MemoryMapInfoKHR -> Bool
$c/= :: MemoryMapInfoKHR -> MemoryMapInfoKHR -> Bool
== :: MemoryMapInfoKHR -> MemoryMapInfoKHR -> Bool
$c== :: MemoryMapInfoKHR -> MemoryMapInfoKHR -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (MemoryMapInfoKHR)
#endif
deriving instance Show MemoryMapInfoKHR
instance ToCStruct MemoryMapInfoKHR where
withCStruct :: forall b.
MemoryMapInfoKHR
-> (("pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR) -> IO b) -> IO b
withCStruct MemoryMapInfoKHR
x ("pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR) -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
48 forall a b. (a -> b) -> a -> b
$ \"pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR
p MemoryMapInfoKHR
x (("pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR) -> IO b
f "pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR
p)
pokeCStruct :: forall b.
("pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR)
-> MemoryMapInfoKHR -> IO b -> IO b
pokeCStruct "pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR
p MemoryMapInfoKHR{DeviceSize
MemoryMapFlags
DeviceMemory
size :: DeviceSize
offset :: DeviceSize
memory :: DeviceMemory
flags :: MemoryMapFlags
$sel:size:MemoryMapInfoKHR :: MemoryMapInfoKHR -> DeviceSize
$sel:offset:MemoryMapInfoKHR :: MemoryMapInfoKHR -> DeviceSize
$sel:memory:MemoryMapInfoKHR :: MemoryMapInfoKHR -> DeviceMemory
$sel:flags:MemoryMapInfoKHR :: MemoryMapInfoKHR -> MemoryMapFlags
..} IO b
f = do
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_MEMORY_MAP_INFO_KHR)
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr MemoryMapFlags)) (MemoryMapFlags
flags)
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr DeviceMemory)) (DeviceMemory
memory)
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr DeviceSize)) (DeviceSize
offset)
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
40 :: Ptr DeviceSize)) (DeviceSize
size)
IO b
f
cStructSize :: Int
cStructSize = Int
48
cStructAlignment :: Int
cStructAlignment = Int
8
pokeZeroCStruct :: forall b.
("pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR) -> IO b -> IO b
pokeZeroCStruct "pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR
p IO b
f = do
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_MEMORY_MAP_INFO_KHR)
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr DeviceMemory)) (forall a. Zero a => a
zero)
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr DeviceSize)) (forall a. Zero a => a
zero)
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
40 :: Ptr DeviceSize)) (forall a. Zero a => a
zero)
IO b
f
instance FromCStruct MemoryMapInfoKHR where
peekCStruct :: ("pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR) -> IO MemoryMapInfoKHR
peekCStruct "pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR
p = do
MemoryMapFlags
flags <- forall a. Storable a => Ptr a -> IO a
peek @MemoryMapFlags (("pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr MemoryMapFlags))
DeviceMemory
memory <- forall a. Storable a => Ptr a -> IO a
peek @DeviceMemory (("pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr DeviceMemory))
DeviceSize
offset <- forall a. Storable a => Ptr a -> IO a
peek @DeviceSize (("pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr DeviceSize))
DeviceSize
size <- forall a. Storable a => Ptr a -> IO a
peek @DeviceSize (("pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
40 :: Ptr DeviceSize))
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ MemoryMapFlags
-> DeviceMemory -> DeviceSize -> DeviceSize -> MemoryMapInfoKHR
MemoryMapInfoKHR
MemoryMapFlags
flags DeviceMemory
memory DeviceSize
offset DeviceSize
size
instance Storable MemoryMapInfoKHR where
sizeOf :: MemoryMapInfoKHR -> Int
sizeOf ~MemoryMapInfoKHR
_ = Int
48
alignment :: MemoryMapInfoKHR -> Int
alignment ~MemoryMapInfoKHR
_ = Int
8
peek :: ("pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR) -> IO MemoryMapInfoKHR
peek = forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: ("pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR)
-> MemoryMapInfoKHR -> IO ()
poke "pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR
ptr MemoryMapInfoKHR
poked = forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pMemoryMapInfo" ::: Ptr MemoryMapInfoKHR
ptr MemoryMapInfoKHR
poked (forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero MemoryMapInfoKHR where
zero :: MemoryMapInfoKHR
zero = MemoryMapFlags
-> DeviceMemory -> DeviceSize -> DeviceSize -> MemoryMapInfoKHR
MemoryMapInfoKHR
forall a. Zero a => a
zero
forall a. Zero a => a
zero
forall a. Zero a => a
zero
forall a. Zero a => a
zero
data MemoryUnmapInfoKHR = MemoryUnmapInfoKHR
{
MemoryUnmapInfoKHR -> MemoryUnmapFlagsKHR
flags :: MemoryUnmapFlagsKHR
,
MemoryUnmapInfoKHR -> DeviceMemory
memory :: DeviceMemory
}
deriving (Typeable, MemoryUnmapInfoKHR -> MemoryUnmapInfoKHR -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MemoryUnmapInfoKHR -> MemoryUnmapInfoKHR -> Bool
$c/= :: MemoryUnmapInfoKHR -> MemoryUnmapInfoKHR -> Bool
== :: MemoryUnmapInfoKHR -> MemoryUnmapInfoKHR -> Bool
$c== :: MemoryUnmapInfoKHR -> MemoryUnmapInfoKHR -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (MemoryUnmapInfoKHR)
#endif
deriving instance Show MemoryUnmapInfoKHR
instance ToCStruct MemoryUnmapInfoKHR where
withCStruct :: forall b.
MemoryUnmapInfoKHR
-> (("pMemoryUnmapInfo" ::: Ptr MemoryUnmapInfoKHR) -> IO b)
-> IO b
withCStruct MemoryUnmapInfoKHR
x ("pMemoryUnmapInfo" ::: Ptr MemoryUnmapInfoKHR) -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
32 forall a b. (a -> b) -> a -> b
$ \"pMemoryUnmapInfo" ::: Ptr MemoryUnmapInfoKHR
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pMemoryUnmapInfo" ::: Ptr MemoryUnmapInfoKHR
p MemoryUnmapInfoKHR
x (("pMemoryUnmapInfo" ::: Ptr MemoryUnmapInfoKHR) -> IO b
f "pMemoryUnmapInfo" ::: Ptr MemoryUnmapInfoKHR
p)
pokeCStruct :: forall b.
("pMemoryUnmapInfo" ::: Ptr MemoryUnmapInfoKHR)
-> MemoryUnmapInfoKHR -> IO b -> IO b
pokeCStruct "pMemoryUnmapInfo" ::: Ptr MemoryUnmapInfoKHR
p MemoryUnmapInfoKHR{DeviceMemory
MemoryUnmapFlagsKHR
memory :: DeviceMemory
flags :: MemoryUnmapFlagsKHR
$sel:memory:MemoryUnmapInfoKHR :: MemoryUnmapInfoKHR -> DeviceMemory
$sel:flags:MemoryUnmapInfoKHR :: MemoryUnmapInfoKHR -> MemoryUnmapFlagsKHR
..} IO b
f = do
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMemoryUnmapInfo" ::: Ptr MemoryUnmapInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_MEMORY_UNMAP_INFO_KHR)
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMemoryUnmapInfo" ::: Ptr MemoryUnmapInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMemoryUnmapInfo" ::: Ptr MemoryUnmapInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr MemoryUnmapFlagsKHR)) (MemoryUnmapFlagsKHR
flags)
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMemoryUnmapInfo" ::: Ptr MemoryUnmapInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr DeviceMemory)) (DeviceMemory
memory)
IO b
f
cStructSize :: Int
cStructSize = Int
32
cStructAlignment :: Int
cStructAlignment = Int
8
pokeZeroCStruct :: forall b.
("pMemoryUnmapInfo" ::: Ptr MemoryUnmapInfoKHR) -> IO b -> IO b
pokeZeroCStruct "pMemoryUnmapInfo" ::: Ptr MemoryUnmapInfoKHR
p IO b
f = do
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMemoryUnmapInfo" ::: Ptr MemoryUnmapInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_MEMORY_UNMAP_INFO_KHR)
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMemoryUnmapInfo" ::: Ptr MemoryUnmapInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMemoryUnmapInfo" ::: Ptr MemoryUnmapInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr DeviceMemory)) (forall a. Zero a => a
zero)
IO b
f
instance FromCStruct MemoryUnmapInfoKHR where
peekCStruct :: ("pMemoryUnmapInfo" ::: Ptr MemoryUnmapInfoKHR)
-> IO MemoryUnmapInfoKHR
peekCStruct "pMemoryUnmapInfo" ::: Ptr MemoryUnmapInfoKHR
p = do
MemoryUnmapFlagsKHR
flags <- forall a. Storable a => Ptr a -> IO a
peek @MemoryUnmapFlagsKHR (("pMemoryUnmapInfo" ::: Ptr MemoryUnmapInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr MemoryUnmapFlagsKHR))
DeviceMemory
memory <- forall a. Storable a => Ptr a -> IO a
peek @DeviceMemory (("pMemoryUnmapInfo" ::: Ptr MemoryUnmapInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr DeviceMemory))
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ MemoryUnmapFlagsKHR -> DeviceMemory -> MemoryUnmapInfoKHR
MemoryUnmapInfoKHR
MemoryUnmapFlagsKHR
flags DeviceMemory
memory
instance Storable MemoryUnmapInfoKHR where
sizeOf :: MemoryUnmapInfoKHR -> Int
sizeOf ~MemoryUnmapInfoKHR
_ = Int
32
alignment :: MemoryUnmapInfoKHR -> Int
alignment ~MemoryUnmapInfoKHR
_ = Int
8
peek :: ("pMemoryUnmapInfo" ::: Ptr MemoryUnmapInfoKHR)
-> IO MemoryUnmapInfoKHR
peek = forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: ("pMemoryUnmapInfo" ::: Ptr MemoryUnmapInfoKHR)
-> MemoryUnmapInfoKHR -> IO ()
poke "pMemoryUnmapInfo" ::: Ptr MemoryUnmapInfoKHR
ptr MemoryUnmapInfoKHR
poked = forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pMemoryUnmapInfo" ::: Ptr MemoryUnmapInfoKHR
ptr MemoryUnmapInfoKHR
poked (forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero MemoryUnmapInfoKHR where
zero :: MemoryUnmapInfoKHR
zero = MemoryUnmapFlagsKHR -> DeviceMemory -> MemoryUnmapInfoKHR
MemoryUnmapInfoKHR
forall a. Zero a => a
zero
forall a. Zero a => a
zero
newtype MemoryUnmapFlagsKHR = MemoryUnmapFlagsKHR Flags
deriving newtype (MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR -> Bool
$c/= :: MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR -> Bool
== :: MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR -> Bool
$c== :: MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR -> Bool
Eq, Eq MemoryUnmapFlagsKHR
MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR -> Bool
MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR -> Ordering
MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR
$cmin :: MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR
max :: MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR
$cmax :: MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR
>= :: MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR -> Bool
$c>= :: MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR -> Bool
> :: MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR -> Bool
$c> :: MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR -> Bool
<= :: MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR -> Bool
$c<= :: MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR -> Bool
< :: MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR -> Bool
$c< :: MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR -> Bool
compare :: MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR -> Ordering
$ccompare :: MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR -> Ordering
Ord, Ptr MemoryUnmapFlagsKHR -> IO MemoryUnmapFlagsKHR
Ptr MemoryUnmapFlagsKHR -> Int -> IO MemoryUnmapFlagsKHR
Ptr MemoryUnmapFlagsKHR -> Int -> MemoryUnmapFlagsKHR -> IO ()
Ptr MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR -> IO ()
MemoryUnmapFlagsKHR -> Int
forall b. Ptr b -> Int -> IO MemoryUnmapFlagsKHR
forall b. Ptr b -> Int -> MemoryUnmapFlagsKHR -> IO ()
forall a.
(a -> Int)
-> (a -> Int)
-> (Ptr a -> Int -> IO a)
-> (Ptr a -> Int -> a -> IO ())
-> (forall b. Ptr b -> Int -> IO a)
-> (forall b. Ptr b -> Int -> a -> IO ())
-> (Ptr a -> IO a)
-> (Ptr a -> a -> IO ())
-> Storable a
poke :: Ptr MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR -> IO ()
$cpoke :: Ptr MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR -> IO ()
peek :: Ptr MemoryUnmapFlagsKHR -> IO MemoryUnmapFlagsKHR
$cpeek :: Ptr MemoryUnmapFlagsKHR -> IO MemoryUnmapFlagsKHR
pokeByteOff :: forall b. Ptr b -> Int -> MemoryUnmapFlagsKHR -> IO ()
$cpokeByteOff :: forall b. Ptr b -> Int -> MemoryUnmapFlagsKHR -> IO ()
peekByteOff :: forall b. Ptr b -> Int -> IO MemoryUnmapFlagsKHR
$cpeekByteOff :: forall b. Ptr b -> Int -> IO MemoryUnmapFlagsKHR
pokeElemOff :: Ptr MemoryUnmapFlagsKHR -> Int -> MemoryUnmapFlagsKHR -> IO ()
$cpokeElemOff :: Ptr MemoryUnmapFlagsKHR -> Int -> MemoryUnmapFlagsKHR -> IO ()
peekElemOff :: Ptr MemoryUnmapFlagsKHR -> Int -> IO MemoryUnmapFlagsKHR
$cpeekElemOff :: Ptr MemoryUnmapFlagsKHR -> Int -> IO MemoryUnmapFlagsKHR
alignment :: MemoryUnmapFlagsKHR -> Int
$calignment :: MemoryUnmapFlagsKHR -> Int
sizeOf :: MemoryUnmapFlagsKHR -> Int
$csizeOf :: MemoryUnmapFlagsKHR -> Int
Storable, MemoryUnmapFlagsKHR
forall a. a -> Zero a
zero :: MemoryUnmapFlagsKHR
$czero :: MemoryUnmapFlagsKHR
Zero, Eq MemoryUnmapFlagsKHR
MemoryUnmapFlagsKHR
Int -> MemoryUnmapFlagsKHR
MemoryUnmapFlagsKHR -> Bool
MemoryUnmapFlagsKHR -> Int
MemoryUnmapFlagsKHR -> Maybe Int
MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR
MemoryUnmapFlagsKHR -> Int -> Bool
MemoryUnmapFlagsKHR -> Int -> MemoryUnmapFlagsKHR
MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR
forall a.
Eq a
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> a
-> (Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> Bool)
-> (a -> Maybe Int)
-> (a -> Int)
-> (a -> Bool)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int)
-> Bits a
popCount :: MemoryUnmapFlagsKHR -> Int
$cpopCount :: MemoryUnmapFlagsKHR -> Int
rotateR :: MemoryUnmapFlagsKHR -> Int -> MemoryUnmapFlagsKHR
$crotateR :: MemoryUnmapFlagsKHR -> Int -> MemoryUnmapFlagsKHR
rotateL :: MemoryUnmapFlagsKHR -> Int -> MemoryUnmapFlagsKHR
$crotateL :: MemoryUnmapFlagsKHR -> Int -> MemoryUnmapFlagsKHR
unsafeShiftR :: MemoryUnmapFlagsKHR -> Int -> MemoryUnmapFlagsKHR
$cunsafeShiftR :: MemoryUnmapFlagsKHR -> Int -> MemoryUnmapFlagsKHR
shiftR :: MemoryUnmapFlagsKHR -> Int -> MemoryUnmapFlagsKHR
$cshiftR :: MemoryUnmapFlagsKHR -> Int -> MemoryUnmapFlagsKHR
unsafeShiftL :: MemoryUnmapFlagsKHR -> Int -> MemoryUnmapFlagsKHR
$cunsafeShiftL :: MemoryUnmapFlagsKHR -> Int -> MemoryUnmapFlagsKHR
shiftL :: MemoryUnmapFlagsKHR -> Int -> MemoryUnmapFlagsKHR
$cshiftL :: MemoryUnmapFlagsKHR -> Int -> MemoryUnmapFlagsKHR
isSigned :: MemoryUnmapFlagsKHR -> Bool
$cisSigned :: MemoryUnmapFlagsKHR -> Bool
bitSize :: MemoryUnmapFlagsKHR -> Int
$cbitSize :: MemoryUnmapFlagsKHR -> Int
bitSizeMaybe :: MemoryUnmapFlagsKHR -> Maybe Int
$cbitSizeMaybe :: MemoryUnmapFlagsKHR -> Maybe Int
testBit :: MemoryUnmapFlagsKHR -> Int -> Bool
$ctestBit :: MemoryUnmapFlagsKHR -> Int -> Bool
complementBit :: MemoryUnmapFlagsKHR -> Int -> MemoryUnmapFlagsKHR
$ccomplementBit :: MemoryUnmapFlagsKHR -> Int -> MemoryUnmapFlagsKHR
clearBit :: MemoryUnmapFlagsKHR -> Int -> MemoryUnmapFlagsKHR
$cclearBit :: MemoryUnmapFlagsKHR -> Int -> MemoryUnmapFlagsKHR
setBit :: MemoryUnmapFlagsKHR -> Int -> MemoryUnmapFlagsKHR
$csetBit :: MemoryUnmapFlagsKHR -> Int -> MemoryUnmapFlagsKHR
bit :: Int -> MemoryUnmapFlagsKHR
$cbit :: Int -> MemoryUnmapFlagsKHR
zeroBits :: MemoryUnmapFlagsKHR
$czeroBits :: MemoryUnmapFlagsKHR
rotate :: MemoryUnmapFlagsKHR -> Int -> MemoryUnmapFlagsKHR
$crotate :: MemoryUnmapFlagsKHR -> Int -> MemoryUnmapFlagsKHR
shift :: MemoryUnmapFlagsKHR -> Int -> MemoryUnmapFlagsKHR
$cshift :: MemoryUnmapFlagsKHR -> Int -> MemoryUnmapFlagsKHR
complement :: MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR
$ccomplement :: MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR
xor :: MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR
$cxor :: MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR
.|. :: MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR
$c.|. :: MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR
.&. :: MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR
$c.&. :: MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR -> MemoryUnmapFlagsKHR
Bits, Bits MemoryUnmapFlagsKHR
MemoryUnmapFlagsKHR -> Int
forall b.
Bits b -> (b -> Int) -> (b -> Int) -> (b -> Int) -> FiniteBits b
countTrailingZeros :: MemoryUnmapFlagsKHR -> Int
$ccountTrailingZeros :: MemoryUnmapFlagsKHR -> Int
countLeadingZeros :: MemoryUnmapFlagsKHR -> Int
$ccountLeadingZeros :: MemoryUnmapFlagsKHR -> Int
finiteBitSize :: MemoryUnmapFlagsKHR -> Int
$cfiniteBitSize :: MemoryUnmapFlagsKHR -> Int
FiniteBits)
conNameMemoryUnmapFlagsKHR :: String
conNameMemoryUnmapFlagsKHR :: String
conNameMemoryUnmapFlagsKHR = String
"MemoryUnmapFlagsKHR"
enumPrefixMemoryUnmapFlagsKHR :: String
enumPrefixMemoryUnmapFlagsKHR :: String
enumPrefixMemoryUnmapFlagsKHR = String
""
showTableMemoryUnmapFlagsKHR :: [(MemoryUnmapFlagsKHR, String)]
showTableMemoryUnmapFlagsKHR :: [(MemoryUnmapFlagsKHR, String)]
showTableMemoryUnmapFlagsKHR = []
instance Show MemoryUnmapFlagsKHR where
showsPrec :: Int -> MemoryUnmapFlagsKHR -> ShowS
showsPrec =
forall a i.
Eq a =>
String
-> [(a, String)]
-> String
-> (a -> i)
-> (i -> ShowS)
-> Int
-> a
-> ShowS
enumShowsPrec
String
enumPrefixMemoryUnmapFlagsKHR
[(MemoryUnmapFlagsKHR, String)]
showTableMemoryUnmapFlagsKHR
String
conNameMemoryUnmapFlagsKHR
(\(MemoryUnmapFlagsKHR Flags
x) -> Flags
x)
(\Flags
x -> String -> ShowS
showString String
"0x" forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. (Integral a, Show a) => a -> ShowS
showHex Flags
x)
instance Read MemoryUnmapFlagsKHR where
readPrec :: ReadPrec MemoryUnmapFlagsKHR
readPrec =
forall i a.
Read i =>
String -> [(a, String)] -> String -> (i -> a) -> ReadPrec a
enumReadPrec
String
enumPrefixMemoryUnmapFlagsKHR
[(MemoryUnmapFlagsKHR, String)]
showTableMemoryUnmapFlagsKHR
String
conNameMemoryUnmapFlagsKHR
Flags -> MemoryUnmapFlagsKHR
MemoryUnmapFlagsKHR
type KHR_MAP_MEMORY_2_SPEC_VERSION = 1
pattern KHR_MAP_MEMORY_2_SPEC_VERSION :: forall a . Integral a => a
pattern $bKHR_MAP_MEMORY_2_SPEC_VERSION :: forall a. Integral a => a
$mKHR_MAP_MEMORY_2_SPEC_VERSION :: forall {r} {a}.
Integral a =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
KHR_MAP_MEMORY_2_SPEC_VERSION = 1
type KHR_MAP_MEMORY_2_EXTENSION_NAME = "VK_KHR_map_memory2"
pattern KHR_MAP_MEMORY_2_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bKHR_MAP_MEMORY_2_EXTENSION_NAME :: forall a. (Eq a, IsString a) => a
$mKHR_MAP_MEMORY_2_EXTENSION_NAME :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
KHR_MAP_MEMORY_2_EXTENSION_NAME = "VK_KHR_map_memory2"