module Graphics.Vulkan.Types.Struct.Extent
(VkExtent2D(..), VkExtent3D(..)) where
import Foreign.Storable (Storable (..))
import GHC.Base (Addr#, ByteArray#,
byteArrayContents#,
plusAddr#)
import Graphics.Vulkan.Marshal
import Graphics.Vulkan.Marshal.Internal
import System.IO.Unsafe (unsafeDupablePerformIO)
data VkExtent2D = VkExtent2D# Addr# ByteArray#
instance Eq VkExtent2D where
(VkExtent2D# a _) == x@(VkExtent2D# b _)
= EQ == cmpBytes# (sizeOf x) a b
instance Ord VkExtent2D where
(VkExtent2D# a _) `compare` x@(VkExtent2D# b _)
= cmpBytes# (sizeOf x) a b
instance Storable VkExtent2D where
sizeOf ~_ = (8)
alignment ~_ = (4)
peek = peekVkData#
poke = pokeVkData#
instance VulkanMarshalPrim VkExtent2D where
unsafeAddr (VkExtent2D# a _) = a
unsafeByteArray (VkExtent2D# _ b) = b
unsafeFromByteArrayOffset off b
= VkExtent2D# (plusAddr# (byteArrayContents# b) off) b
instance VulkanMarshal VkExtent2D where
type StructFields VkExtent2D = '["width", "height"]
type CUnionType VkExtent2D = 'False
type ReturnedOnly VkExtent2D = 'False
type StructExtends VkExtent2D = '[]
instance HasField "width" VkExtent2D where
type FieldType "width" VkExtent2D = Word32
type FieldOptional "width" VkExtent2D = 'False
type FieldOffset "width" VkExtent2D =
(0)
type FieldIsArray "width" VkExtent2D = 'False
fieldOptional = False
fieldOffset = (0)
instance CanReadField "width" VkExtent2D where
getField x
= unsafeDupablePerformIO
(peekByteOff (unsafePtr x) (0))
readField p = peekByteOff p (0)
instance CanWriteField "width" VkExtent2D where
writeField p
= pokeByteOff p (0)
instance HasField "height" VkExtent2D where
type FieldType "height" VkExtent2D = Word32
type FieldOptional "height" VkExtent2D = 'False
type FieldOffset "height" VkExtent2D =
(4)
type FieldIsArray "height" VkExtent2D = 'False
fieldOptional = False
fieldOffset = (4)
instance CanReadField "height" VkExtent2D where
getField x
= unsafeDupablePerformIO
(peekByteOff (unsafePtr x) (4))
readField p
= peekByteOff p (4)
instance CanWriteField "height" VkExtent2D
where
writeField p
= pokeByteOff p (4)
instance Show VkExtent2D where
showsPrec d x
= showString "VkExtent2D {" .
showString "width = " .
showsPrec d (getField @"width" x) .
showString ", " .
showString "height = " .
showsPrec d (getField @"height" x) . showChar '}'
data VkExtent3D = VkExtent3D# Addr# ByteArray#
instance Eq VkExtent3D where
(VkExtent3D# a _) == x@(VkExtent3D# b _)
= EQ == cmpBytes# (sizeOf x) a b
instance Ord VkExtent3D where
(VkExtent3D# a _) `compare` x@(VkExtent3D# b _)
= cmpBytes# (sizeOf x) a b
instance Storable VkExtent3D where
sizeOf ~_ = (12)
alignment ~_ = (4)
peek = peekVkData#
poke = pokeVkData#
instance VulkanMarshalPrim VkExtent3D where
unsafeAddr (VkExtent3D# a _) = a
unsafeByteArray (VkExtent3D# _ b) = b
unsafeFromByteArrayOffset off b
= VkExtent3D# (plusAddr# (byteArrayContents# b) off) b
instance VulkanMarshal VkExtent3D where
type StructFields VkExtent3D = '["width", "height", "depth"]
type CUnionType VkExtent3D = 'False
type ReturnedOnly VkExtent3D = 'False
type StructExtends VkExtent3D = '[]
instance HasField "width" VkExtent3D where
type FieldType "width" VkExtent3D = Word32
type FieldOptional "width" VkExtent3D = 'False
type FieldOffset "width" VkExtent3D =
(0)
type FieldIsArray "width" VkExtent3D = 'False
fieldOptional = False
fieldOffset = (0)
instance CanReadField "width" VkExtent3D where
getField x
= unsafeDupablePerformIO
(peekByteOff (unsafePtr x) (0))
readField p = peekByteOff p (0)
instance CanWriteField "width" VkExtent3D where
writeField p
= pokeByteOff p (0)
instance HasField "height" VkExtent3D where
type FieldType "height" VkExtent3D = Word32
type FieldOptional "height" VkExtent3D = 'False
type FieldOffset "height" VkExtent3D =
(4)
type FieldIsArray "height" VkExtent3D = 'False
fieldOptional = False
fieldOffset = (4)
instance CanReadField "height" VkExtent3D where
getField x
= unsafeDupablePerformIO
(peekByteOff (unsafePtr x) (4))
readField p
= peekByteOff p (4)
instance CanWriteField "height" VkExtent3D
where
writeField p
= pokeByteOff p (4)
instance HasField "depth" VkExtent3D where
type FieldType "depth" VkExtent3D = Word32
type FieldOptional "depth" VkExtent3D = 'False
type FieldOffset "depth" VkExtent3D =
(8)
type FieldIsArray "depth" VkExtent3D = 'False
fieldOptional = False
fieldOffset = (8)
instance CanReadField "depth" VkExtent3D where
getField x
= unsafeDupablePerformIO
(peekByteOff (unsafePtr x) (8))
readField p = peekByteOff p (8)
instance CanWriteField "depth" VkExtent3D where
writeField p
= pokeByteOff p (8)
instance Show VkExtent3D where
showsPrec d x
= showString "VkExtent3D {" .
showString "width = " .
showsPrec d (getField @"width" x) .
showString ", " .
showString "height = " .
showsPrec d (getField @"height" x) .
showString ", " .
showString "depth = " .
showsPrec d (getField @"depth" x) . showChar '}'