module Graphics.Vulkan.Types.Struct.Base
(VkBaseInStructure(..), VkBaseOutStructure(..)) 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.Enum.StructureType (VkStructureType)
import System.IO.Unsafe (unsafeDupablePerformIO)
data VkBaseInStructure = VkBaseInStructure# Addr# ByteArray#
instance Eq VkBaseInStructure where
(VkBaseInStructure# a _) == x@(VkBaseInStructure# b _)
= EQ == cmpBytes# (sizeOf x) a b
instance Ord VkBaseInStructure where
(VkBaseInStructure# a _) `compare` x@(VkBaseInStructure# b _)
= cmpBytes# (sizeOf x) a b
instance Storable VkBaseInStructure where
sizeOf ~_ = (16)
alignment ~_ = (8)
peek = peekVkData#
poke = pokeVkData#
instance VulkanMarshalPrim VkBaseInStructure where
unsafeAddr (VkBaseInStructure# a _) = a
unsafeByteArray (VkBaseInStructure# _ b) = b
unsafeFromByteArrayOffset off b
= VkBaseInStructure# (plusAddr# (byteArrayContents# b) off) b
instance VulkanMarshal VkBaseInStructure where
type StructFields VkBaseInStructure = '["sType", "pNext"]
type CUnionType VkBaseInStructure = 'False
type ReturnedOnly VkBaseInStructure = 'False
type StructExtends VkBaseInStructure = '[]
instance HasField "sType" VkBaseInStructure
where
type FieldType "sType" VkBaseInStructure = VkStructureType
type FieldOptional "sType" VkBaseInStructure = 'False
type FieldOffset "sType" VkBaseInStructure =
(0)
type FieldIsArray "sType" VkBaseInStructure = 'False
fieldOptional = False
fieldOffset = (0)
instance CanReadField "sType" VkBaseInStructure
where
getField x
= unsafeDupablePerformIO
(peekByteOff (unsafePtr x) (0))
readField p
= peekByteOff p (0)
instance
CanWriteField "sType" VkBaseInStructure where
writeField p
= pokeByteOff p (0)
instance HasField "pNext" VkBaseInStructure
where
type FieldType "pNext" VkBaseInStructure = Ptr VkBaseInStructure
type FieldOptional "pNext" VkBaseInStructure = 'False
type FieldOffset "pNext" VkBaseInStructure =
(8)
type FieldIsArray "pNext" VkBaseInStructure = 'False
fieldOptional = False
fieldOffset = (8)
instance CanReadField "pNext" VkBaseInStructure
where
getField x
= unsafeDupablePerformIO
(peekByteOff (unsafePtr x) (8))
readField p
= peekByteOff p (8)
instance
CanWriteField "pNext" VkBaseInStructure where
writeField p
= pokeByteOff p (8)
instance Show VkBaseInStructure where
showsPrec d x
= showString "VkBaseInStructure {" .
showString "sType = " .
showsPrec d (getField @"sType" x) .
showString ", " .
showString "pNext = " .
showsPrec d (getField @"pNext" x) . showChar '}'
data VkBaseOutStructure = VkBaseOutStructure# Addr# ByteArray#
instance Eq VkBaseOutStructure where
(VkBaseOutStructure# a _) == x@(VkBaseOutStructure# b _)
= EQ == cmpBytes# (sizeOf x) a b
instance Ord VkBaseOutStructure where
(VkBaseOutStructure# a _) `compare` x@(VkBaseOutStructure# b _)
= cmpBytes# (sizeOf x) a b
instance Storable VkBaseOutStructure where
sizeOf ~_ = (16)
alignment ~_ = (8)
peek = peekVkData#
poke = pokeVkData#
instance VulkanMarshalPrim VkBaseOutStructure where
unsafeAddr (VkBaseOutStructure# a _) = a
unsafeByteArray (VkBaseOutStructure# _ b) = b
unsafeFromByteArrayOffset off b
= VkBaseOutStructure# (plusAddr# (byteArrayContents# b) off) b
instance VulkanMarshal VkBaseOutStructure where
type StructFields VkBaseOutStructure = '["sType", "pNext"]
type CUnionType VkBaseOutStructure = 'False
type ReturnedOnly VkBaseOutStructure = 'False
type StructExtends VkBaseOutStructure = '[]
instance HasField "sType" VkBaseOutStructure
where
type FieldType "sType" VkBaseOutStructure = VkStructureType
type FieldOptional "sType" VkBaseOutStructure = 'False
type FieldOffset "sType" VkBaseOutStructure =
(0)
type FieldIsArray "sType" VkBaseOutStructure = 'False
fieldOptional = False
fieldOffset = (0)
instance
CanReadField "sType" VkBaseOutStructure where
getField x
= unsafeDupablePerformIO
(peekByteOff (unsafePtr x) (0))
readField p
= peekByteOff p (0)
instance
CanWriteField "sType" VkBaseOutStructure where
writeField p
= pokeByteOff p (0)
instance HasField "pNext" VkBaseOutStructure
where
type FieldType "pNext" VkBaseOutStructure = Ptr VkBaseOutStructure
type FieldOptional "pNext" VkBaseOutStructure = 'False
type FieldOffset "pNext" VkBaseOutStructure =
(8)
type FieldIsArray "pNext" VkBaseOutStructure = 'False
fieldOptional = False
fieldOffset = (8)
instance
CanReadField "pNext" VkBaseOutStructure where
getField x
= unsafeDupablePerformIO
(peekByteOff (unsafePtr x) (8))
readField p
= peekByteOff p (8)
instance
CanWriteField "pNext" VkBaseOutStructure where
writeField p
= pokeByteOff p (8)
instance Show VkBaseOutStructure where
showsPrec d x
= showString "VkBaseOutStructure {" .
showString "sType = " .
showsPrec d (getField @"sType" x) .
showString ", " .
showString "pNext = " .
showsPrec d (getField @"pNext" x) . showChar '}'