module Graphics.Vulkan.Types.Struct.AllocationCallbacks
(VkAllocationCallbacks(..)) where
import Foreign.Storable (Storable (..))
import GHC.Base (Addr#, ByteArray#,
byteArrayContents#,
plusAddr#)
import Graphics.Vulkan.Marshal
import Graphics.Vulkan.Marshal.Internal
import Graphics.Vulkan.Types.Funcpointers (PFN_vkAllocationFunction,
PFN_vkFreeFunction,
PFN_vkInternalAllocationNotification,
PFN_vkInternalFreeNotification,
PFN_vkReallocationFunction)
import System.IO.Unsafe (unsafeDupablePerformIO)
data VkAllocationCallbacks = VkAllocationCallbacks# Addr#
ByteArray#
instance Eq VkAllocationCallbacks where
(VkAllocationCallbacks# a _) == x@(VkAllocationCallbacks# b _)
= EQ == cmpBytes# (sizeOf x) a b
instance Ord VkAllocationCallbacks where
(VkAllocationCallbacks# a _) `compare`
x@(VkAllocationCallbacks# b _) = cmpBytes# (sizeOf x) a b
instance Storable VkAllocationCallbacks where
sizeOf ~_ = (48)
alignment ~_ = (8)
peek = peekVkData#
poke = pokeVkData#
instance VulkanMarshalPrim VkAllocationCallbacks where
unsafeAddr (VkAllocationCallbacks# a _) = a
unsafeByteArray (VkAllocationCallbacks# _ b) = b
unsafeFromByteArrayOffset off b
= VkAllocationCallbacks# (plusAddr# (byteArrayContents# b) off) b
instance VulkanMarshal VkAllocationCallbacks where
type StructFields VkAllocationCallbacks =
'["pUserData", "pfnAllocation", "pfnReallocation", "pfnFree",
"pfnInternalAllocation", "pfnInternalFree"]
type CUnionType VkAllocationCallbacks = 'False
type ReturnedOnly VkAllocationCallbacks = 'False
type StructExtends VkAllocationCallbacks = '[]
instance
HasField "pUserData" VkAllocationCallbacks where
type FieldType "pUserData" VkAllocationCallbacks = Ptr Void
type FieldOptional "pUserData" VkAllocationCallbacks = 'True
type FieldOffset "pUserData" VkAllocationCallbacks =
(0)
type FieldIsArray "pUserData" VkAllocationCallbacks = 'False
fieldOptional = True
fieldOffset
= (0)
instance
CanReadField "pUserData" VkAllocationCallbacks where
getField x
= unsafeDupablePerformIO
(peekByteOff (unsafePtr x) (0))
readField p
= peekByteOff p (0)
instance
CanWriteField "pUserData" VkAllocationCallbacks where
writeField p
= pokeByteOff p (0)
instance
HasField "pfnAllocation" VkAllocationCallbacks where
type FieldType "pfnAllocation" VkAllocationCallbacks =
PFN_vkAllocationFunction
type FieldOptional "pfnAllocation" VkAllocationCallbacks = 'False
type FieldOffset "pfnAllocation" VkAllocationCallbacks =
(8)
type FieldIsArray "pfnAllocation" VkAllocationCallbacks = 'False
fieldOptional = False
fieldOffset
= (8)
instance
CanReadField "pfnAllocation" VkAllocationCallbacks where
getField x
= unsafeDupablePerformIO
(peekByteOff (unsafePtr x) (8))
readField p
= peekByteOff p (8)
instance
CanWriteField "pfnAllocation" VkAllocationCallbacks where
writeField p
= pokeByteOff p (8)
instance
HasField "pfnReallocation" VkAllocationCallbacks where
type FieldType "pfnReallocation" VkAllocationCallbacks =
PFN_vkReallocationFunction
type FieldOptional "pfnReallocation" VkAllocationCallbacks = 'False
type FieldOffset "pfnReallocation" VkAllocationCallbacks =
(16)
type FieldIsArray "pfnReallocation" VkAllocationCallbacks = 'False
fieldOptional = False
fieldOffset
= (16)
instance
CanReadField "pfnReallocation" VkAllocationCallbacks where
getField x
= unsafeDupablePerformIO
(peekByteOff (unsafePtr x) (16))
readField p
= peekByteOff p (16)
instance
CanWriteField "pfnReallocation" VkAllocationCallbacks where
writeField p
= pokeByteOff p (16)
instance
HasField "pfnFree" VkAllocationCallbacks where
type FieldType "pfnFree" VkAllocationCallbacks = PFN_vkFreeFunction
type FieldOptional "pfnFree" VkAllocationCallbacks = 'False
type FieldOffset "pfnFree" VkAllocationCallbacks =
(24)
type FieldIsArray "pfnFree" VkAllocationCallbacks = 'False
fieldOptional = False
fieldOffset = (24)
instance
CanReadField "pfnFree" VkAllocationCallbacks where
getField x
= unsafeDupablePerformIO
(peekByteOff (unsafePtr x) (24))
readField p
= peekByteOff p (24)
instance
CanWriteField "pfnFree" VkAllocationCallbacks where
writeField p
= pokeByteOff p (24)
instance
HasField "pfnInternalAllocation" VkAllocationCallbacks where
type FieldType "pfnInternalAllocation" VkAllocationCallbacks =
PFN_vkInternalAllocationNotification
type FieldOptional "pfnInternalAllocation" VkAllocationCallbacks =
'True
type FieldOffset "pfnInternalAllocation" VkAllocationCallbacks =
(32)
type FieldIsArray "pfnInternalAllocation" VkAllocationCallbacks =
'False
fieldOptional = True
fieldOffset
= (32)
instance
CanReadField "pfnInternalAllocation" VkAllocationCallbacks where
getField x
= unsafeDupablePerformIO
(peekByteOff (unsafePtr x) (32))
readField p
= peekByteOff p (32)
instance
CanWriteField "pfnInternalAllocation" VkAllocationCallbacks where
writeField p
= pokeByteOff p (32)
instance
HasField "pfnInternalFree" VkAllocationCallbacks where
type FieldType "pfnInternalFree" VkAllocationCallbacks =
PFN_vkInternalFreeNotification
type FieldOptional "pfnInternalFree" VkAllocationCallbacks = 'True
type FieldOffset "pfnInternalFree" VkAllocationCallbacks =
(40)
type FieldIsArray "pfnInternalFree" VkAllocationCallbacks = 'False
fieldOptional = True
fieldOffset
= (40)
instance
CanReadField "pfnInternalFree" VkAllocationCallbacks where
getField x
= unsafeDupablePerformIO
(peekByteOff (unsafePtr x) (40))
readField p
= peekByteOff p (40)
instance
CanWriteField "pfnInternalFree" VkAllocationCallbacks where
writeField p
= pokeByteOff p (40)
instance Show VkAllocationCallbacks where
showsPrec d x
= showString "VkAllocationCallbacks {" .
showString "pUserData = " .
showsPrec d (getField @"pUserData" x) .
showString ", " .
showString "pfnAllocation = " .
showsPrec d (getField @"pfnAllocation" x) .
showString ", " .
showString "pfnReallocation = " .
showsPrec d (getField @"pfnReallocation" x) .
showString ", " .
showString "pfnFree = " .
showsPrec d (getField @"pfnFree" x) .
showString ", " .
showString "pfnInternalAllocation = " .
showsPrec d (getField @"pfnInternalAllocation" x) .
showString ", " .
showString "pfnInternalFree = " .
showsPrec d (getField @"pfnInternalFree" x) .
showChar '}'