module Graphics.Vulkan.Types.Struct.Clear
(VkClearAttachment(..), VkClearColorValue(..),
VkClearDepthStencilValue(..), VkClearRect(..), VkClearValue(..))
where
import Foreign.Storable (Storable (..))
import GHC.Base (Addr#, ByteArray#, Proxy#,
byteArrayContents#,
plusAddr#, proxy#)
import GHC.TypeLits (KnownNat, natVal')
import Graphics.Vulkan.Marshal
import Graphics.Vulkan.Marshal.Internal
import Graphics.Vulkan.Types.Enum.Image (VkImageAspectFlags)
import Graphics.Vulkan.Types.Struct.Rect (VkRect2D)
import System.IO.Unsafe (unsafeDupablePerformIO)
data VkClearAttachment = VkClearAttachment# Addr# ByteArray#
instance Eq VkClearAttachment where
(VkClearAttachment# a _) == x@(VkClearAttachment# b _)
= EQ == cmpBytes# (sizeOf x) a b
instance Ord VkClearAttachment where
(VkClearAttachment# a _) `compare` x@(VkClearAttachment# b _)
= cmpBytes# (sizeOf x) a b
instance Storable VkClearAttachment where
sizeOf ~_ = (24)
alignment ~_ = (4)
peek = peekVkData#
poke = pokeVkData#
instance VulkanMarshalPrim VkClearAttachment where
unsafeAddr (VkClearAttachment# a _) = a
unsafeByteArray (VkClearAttachment# _ b) = b
unsafeFromByteArrayOffset off b
= VkClearAttachment# (plusAddr# (byteArrayContents# b) off) b
instance VulkanMarshal VkClearAttachment where
type StructFields VkClearAttachment =
'["aspectMask", "colorAttachment", "clearValue"]
type CUnionType VkClearAttachment = 'False
type ReturnedOnly VkClearAttachment = 'False
type StructExtends VkClearAttachment = '[]
instance
HasField "aspectMask" VkClearAttachment where
type FieldType "aspectMask" VkClearAttachment = VkImageAspectFlags
type FieldOptional "aspectMask" VkClearAttachment = 'False
type FieldOffset "aspectMask" VkClearAttachment =
(0)
type FieldIsArray "aspectMask" VkClearAttachment = 'False
fieldOptional = False
fieldOffset = (0)
instance
CanReadField "aspectMask" VkClearAttachment where
getField x
= unsafeDupablePerformIO
(peekByteOff (unsafePtr x) (0))
readField p
= peekByteOff p (0)
instance
CanWriteField "aspectMask" VkClearAttachment where
writeField p
= pokeByteOff p (0)
instance
HasField "colorAttachment" VkClearAttachment where
type FieldType "colorAttachment" VkClearAttachment = Word32
type FieldOptional "colorAttachment" VkClearAttachment = 'False
type FieldOffset "colorAttachment" VkClearAttachment =
(4)
type FieldIsArray "colorAttachment" VkClearAttachment = 'False
fieldOptional = False
fieldOffset
= (4)
instance
CanReadField "colorAttachment" VkClearAttachment where
getField x
= unsafeDupablePerformIO
(peekByteOff (unsafePtr x) (4))
readField p
= peekByteOff p (4)
instance
CanWriteField "colorAttachment" VkClearAttachment where
writeField p
= pokeByteOff p (4)
instance
HasField "clearValue" VkClearAttachment where
type FieldType "clearValue" VkClearAttachment = VkClearValue
type FieldOptional "clearValue" VkClearAttachment = 'False
type FieldOffset "clearValue" VkClearAttachment =
(8)
type FieldIsArray "clearValue" VkClearAttachment = 'False
fieldOptional = False
fieldOffset = (8)
instance
CanReadField "clearValue" VkClearAttachment where
getField x
= unsafeDupablePerformIO
(peekByteOff (unsafePtr x) (8))
readField p
= peekByteOff p (8)
instance
CanWriteField "clearValue" VkClearAttachment where
writeField p
= pokeByteOff p (8)
instance Show VkClearAttachment where
showsPrec d x
= showString "VkClearAttachment {" .
showString "aspectMask = " .
showsPrec d (getField @"aspectMask" x) .
showString ", " .
showString "colorAttachment = " .
showsPrec d (getField @"colorAttachment" x) .
showString ", " .
showString "clearValue = " .
showsPrec d (getField @"clearValue" x) . showChar '}'
data VkClearColorValue = VkClearColorValue# Addr# ByteArray#
instance Eq VkClearColorValue where
(VkClearColorValue# a _) == x@(VkClearColorValue# b _)
= EQ == cmpBytes# (sizeOf x) a b
instance Ord VkClearColorValue where
(VkClearColorValue# a _) `compare` x@(VkClearColorValue# b _)
= cmpBytes# (sizeOf x) a b
instance Storable VkClearColorValue where
sizeOf ~_ = (16)
alignment ~_ = (4)
peek = peekVkData#
poke = pokeVkData#
instance VulkanMarshalPrim VkClearColorValue where
unsafeAddr (VkClearColorValue# a _) = a
unsafeByteArray (VkClearColorValue# _ b) = b
unsafeFromByteArrayOffset off b
= VkClearColorValue# (plusAddr# (byteArrayContents# b) off) b
instance VulkanMarshal VkClearColorValue where
type StructFields VkClearColorValue =
'["float32", "int32", "uint32"]
type CUnionType VkClearColorValue = 'True
type ReturnedOnly VkClearColorValue = 'False
type StructExtends VkClearColorValue = '[]
instance HasField "float32" VkClearColorValue
where
type FieldType "float32" VkClearColorValue =
Float
type FieldOptional "float32" VkClearColorValue = 'False
type FieldOffset "float32" VkClearColorValue =
(0)
type FieldIsArray "float32" VkClearColorValue = 'True
fieldOptional = False
fieldOffset = (0)
instance
(KnownNat idx, IndexInBounds "float32" idx VkClearColorValue) =>
CanReadFieldArray "float32" idx VkClearColorValue
where
type FieldArrayLength "float32" VkClearColorValue = 4
fieldArrayLength = 4
getFieldArray = f
where
f x = unsafeDupablePerformIO (peekByteOff (unsafePtr x) off)
off
= (0) +
sizeOf (undefined :: Float) *
fromInteger (natVal' (proxy# :: Proxy# idx))
readFieldArray p
= peekByteOff p
((0) +
sizeOf (undefined :: Float) *
fromInteger (natVal' (proxy# :: Proxy# idx)))
instance
(KnownNat idx, IndexInBounds "float32" idx VkClearColorValue) =>
CanWriteFieldArray "float32" idx VkClearColorValue
where
writeFieldArray p
= pokeByteOff p
((0) +
sizeOf (undefined :: Float) *
fromInteger (natVal' (proxy# :: Proxy# idx)))
instance HasField "int32" VkClearColorValue
where
type FieldType "int32" VkClearColorValue = Int32
type FieldOptional "int32" VkClearColorValue = 'False
type FieldOffset "int32" VkClearColorValue =
(0)
type FieldIsArray "int32" VkClearColorValue = 'True
fieldOptional = False
fieldOffset = (0)
instance
(KnownNat idx, IndexInBounds "int32" idx VkClearColorValue) =>
CanReadFieldArray "int32" idx VkClearColorValue
where
type FieldArrayLength "int32" VkClearColorValue = 4
fieldArrayLength = 4
getFieldArray = f
where
f x = unsafeDupablePerformIO (peekByteOff (unsafePtr x) off)
off
= (0) +
sizeOf (undefined :: Int32) *
fromInteger (natVal' (proxy# :: Proxy# idx))
readFieldArray p
= peekByteOff p
((0) +
sizeOf (undefined :: Int32) *
fromInteger (natVal' (proxy# :: Proxy# idx)))
instance
(KnownNat idx, IndexInBounds "int32" idx VkClearColorValue) =>
CanWriteFieldArray "int32" idx VkClearColorValue
where
writeFieldArray p
= pokeByteOff p
((0) +
sizeOf (undefined :: Int32) *
fromInteger (natVal' (proxy# :: Proxy# idx)))
instance HasField "uint32" VkClearColorValue
where
type FieldType "uint32" VkClearColorValue = Word32
type FieldOptional "uint32" VkClearColorValue = 'False
type FieldOffset "uint32" VkClearColorValue =
(0)
type FieldIsArray "uint32" VkClearColorValue = 'True
fieldOptional = False
fieldOffset = (0)
instance
(KnownNat idx, IndexInBounds "uint32" idx VkClearColorValue) =>
CanReadFieldArray "uint32" idx VkClearColorValue
where
type FieldArrayLength "uint32" VkClearColorValue = 4
fieldArrayLength = 4
getFieldArray = f
where
f x = unsafeDupablePerformIO (peekByteOff (unsafePtr x) off)
off
= (0) +
sizeOf (undefined :: Word32) *
fromInteger (natVal' (proxy# :: Proxy# idx))
readFieldArray p
= peekByteOff p
((0) +
sizeOf (undefined :: Word32) *
fromInteger (natVal' (proxy# :: Proxy# idx)))
instance
(KnownNat idx, IndexInBounds "uint32" idx VkClearColorValue) =>
CanWriteFieldArray "uint32" idx VkClearColorValue
where
writeFieldArray p
= pokeByteOff p
((0) +
sizeOf (undefined :: Word32) *
fromInteger (natVal' (proxy# :: Proxy# idx)))
instance Show VkClearColorValue where
showsPrec d x
= showString "VkClearColorValue {" .
(showString "float32 = [" .
showsPrec d
(let s = sizeOf
(undefined :: FieldType "float32" VkClearColorValue)
o = fieldOffset @"float32" @VkClearColorValue
f i
= peekByteOff (unsafePtr x) i ::
IO (FieldType "float32" VkClearColorValue)
in
unsafeDupablePerformIO . mapM f $
map (\ i -> o + i * s) [0 .. 4 1])
. showChar ']')
.
showString ", " .
(showString "int32 = [" .
showsPrec d
(let s = sizeOf (undefined :: FieldType "int32" VkClearColorValue)
o = fieldOffset @"int32" @VkClearColorValue
f i
= peekByteOff (unsafePtr x) i ::
IO (FieldType "int32" VkClearColorValue)
in
unsafeDupablePerformIO . mapM f $
map (\ i -> o + i * s) [0 .. 4 1])
. showChar ']')
.
showString ", " .
(showString "uint32 = [" .
showsPrec d
(let s = sizeOf (undefined :: FieldType "uint32" VkClearColorValue)
o = fieldOffset @"uint32" @VkClearColorValue
f i
= peekByteOff (unsafePtr x) i ::
IO (FieldType "uint32" VkClearColorValue)
in
unsafeDupablePerformIO . mapM f $
map (\ i -> o + i * s) [0 .. 4 1])
. showChar ']')
. showChar '}'
data VkClearDepthStencilValue = VkClearDepthStencilValue# Addr#
ByteArray#
instance Eq VkClearDepthStencilValue where
(VkClearDepthStencilValue# a _) ==
x@(VkClearDepthStencilValue# b _) = EQ == cmpBytes# (sizeOf x) a b
instance Ord VkClearDepthStencilValue where
(VkClearDepthStencilValue# a _) `compare`
x@(VkClearDepthStencilValue# b _) = cmpBytes# (sizeOf x) a b
instance Storable VkClearDepthStencilValue where
sizeOf ~_ = (8)
alignment ~_ = (4)
peek = peekVkData#
poke = pokeVkData#
instance VulkanMarshalPrim VkClearDepthStencilValue where
unsafeAddr (VkClearDepthStencilValue# a _) = a
unsafeByteArray (VkClearDepthStencilValue# _ b) = b
unsafeFromByteArrayOffset off b
= VkClearDepthStencilValue# (plusAddr# (byteArrayContents# b) off)
b
instance VulkanMarshal VkClearDepthStencilValue where
type StructFields VkClearDepthStencilValue = '["depth", "stencil"]
type CUnionType VkClearDepthStencilValue = 'False
type ReturnedOnly VkClearDepthStencilValue = 'False
type StructExtends VkClearDepthStencilValue = '[]
instance
HasField "depth" VkClearDepthStencilValue where
type FieldType "depth" VkClearDepthStencilValue =
Float
type FieldOptional "depth" VkClearDepthStencilValue = 'False
type FieldOffset "depth" VkClearDepthStencilValue =
(0)
type FieldIsArray "depth" VkClearDepthStencilValue = 'False
fieldOptional = False
fieldOffset = (0)
instance
CanReadField "depth" VkClearDepthStencilValue where
getField x
= unsafeDupablePerformIO
(peekByteOff (unsafePtr x) (0))
readField p
= peekByteOff p (0)
instance
CanWriteField "depth" VkClearDepthStencilValue where
writeField p
= pokeByteOff p (0)
instance
HasField "stencil" VkClearDepthStencilValue where
type FieldType "stencil" VkClearDepthStencilValue = Word32
type FieldOptional "stencil" VkClearDepthStencilValue = 'False
type FieldOffset "stencil" VkClearDepthStencilValue =
(4)
type FieldIsArray "stencil" VkClearDepthStencilValue = 'False
fieldOptional = False
fieldOffset
= (4)
instance
CanReadField "stencil" VkClearDepthStencilValue where
getField x
= unsafeDupablePerformIO
(peekByteOff (unsafePtr x) (4))
readField p
= peekByteOff p (4)
instance
CanWriteField "stencil" VkClearDepthStencilValue where
writeField p
= pokeByteOff p (4)
instance Show VkClearDepthStencilValue where
showsPrec d x
= showString "VkClearDepthStencilValue {" .
showString "depth = " .
showsPrec d (getField @"depth" x) .
showString ", " .
showString "stencil = " .
showsPrec d (getField @"stencil" x) . showChar '}'
data VkClearRect = VkClearRect# Addr# ByteArray#
instance Eq VkClearRect where
(VkClearRect# a _) == x@(VkClearRect# b _)
= EQ == cmpBytes# (sizeOf x) a b
instance Ord VkClearRect where
(VkClearRect# a _) `compare` x@(VkClearRect# b _)
= cmpBytes# (sizeOf x) a b
instance Storable VkClearRect where
sizeOf ~_ = (24)
alignment ~_ = (4)
peek = peekVkData#
poke = pokeVkData#
instance VulkanMarshalPrim VkClearRect where
unsafeAddr (VkClearRect# a _) = a
unsafeByteArray (VkClearRect# _ b) = b
unsafeFromByteArrayOffset off b
= VkClearRect# (plusAddr# (byteArrayContents# b) off) b
instance VulkanMarshal VkClearRect where
type StructFields VkClearRect =
'["rect", "baseArrayLayer", "layerCount"]
type CUnionType VkClearRect = 'False
type ReturnedOnly VkClearRect = 'False
type StructExtends VkClearRect = '[]
instance HasField "rect" VkClearRect where
type FieldType "rect" VkClearRect = VkRect2D
type FieldOptional "rect" VkClearRect = 'False
type FieldOffset "rect" VkClearRect =
(0)
type FieldIsArray "rect" VkClearRect = 'False
fieldOptional = False
fieldOffset = (0)
instance CanReadField "rect" VkClearRect where
getField x
= unsafeDupablePerformIO
(peekByteOff (unsafePtr x) (0))
readField p = peekByteOff p (0)
instance CanWriteField "rect" VkClearRect where
writeField p
= pokeByteOff p (0)
instance HasField "baseArrayLayer" VkClearRect
where
type FieldType "baseArrayLayer" VkClearRect = Word32
type FieldOptional "baseArrayLayer" VkClearRect = 'False
type FieldOffset "baseArrayLayer" VkClearRect =
(16)
type FieldIsArray "baseArrayLayer" VkClearRect = 'False
fieldOptional = False
fieldOffset = (16)
instance
CanReadField "baseArrayLayer" VkClearRect where
getField x
= unsafeDupablePerformIO
(peekByteOff (unsafePtr x) (16))
readField p
= peekByteOff p (16)
instance
CanWriteField "baseArrayLayer" VkClearRect where
writeField p
= pokeByteOff p (16)
instance HasField "layerCount" VkClearRect
where
type FieldType "layerCount" VkClearRect = Word32
type FieldOptional "layerCount" VkClearRect = 'False
type FieldOffset "layerCount" VkClearRect =
(20)
type FieldIsArray "layerCount" VkClearRect = 'False
fieldOptional = False
fieldOffset = (20)
instance CanReadField "layerCount" VkClearRect
where
getField x
= unsafeDupablePerformIO
(peekByteOff (unsafePtr x) (20))
readField p
= peekByteOff p (20)
instance CanWriteField "layerCount" VkClearRect
where
writeField p
= pokeByteOff p (20)
instance Show VkClearRect where
showsPrec d x
= showString "VkClearRect {" .
showString "rect = " .
showsPrec d (getField @"rect" x) .
showString ", " .
showString "baseArrayLayer = " .
showsPrec d (getField @"baseArrayLayer" x) .
showString ", " .
showString "layerCount = " .
showsPrec d (getField @"layerCount" x) . showChar '}'
data VkClearValue = VkClearValue# Addr# ByteArray#
instance Eq VkClearValue where
(VkClearValue# a _) == x@(VkClearValue# b _)
= EQ == cmpBytes# (sizeOf x) a b
instance Ord VkClearValue where
(VkClearValue# a _) `compare` x@(VkClearValue# b _)
= cmpBytes# (sizeOf x) a b
instance Storable VkClearValue where
sizeOf ~_ = (16)
alignment ~_ = (4)
peek = peekVkData#
poke = pokeVkData#
instance VulkanMarshalPrim VkClearValue where
unsafeAddr (VkClearValue# a _) = a
unsafeByteArray (VkClearValue# _ b) = b
unsafeFromByteArrayOffset off b
= VkClearValue# (plusAddr# (byteArrayContents# b) off) b
instance VulkanMarshal VkClearValue where
type StructFields VkClearValue = '["color", "depthStencil"]
type CUnionType VkClearValue = 'True
type ReturnedOnly VkClearValue = 'False
type StructExtends VkClearValue = '[]
instance HasField "color" VkClearValue where
type FieldType "color" VkClearValue = VkClearColorValue
type FieldOptional "color" VkClearValue = 'False
type FieldOffset "color" VkClearValue =
(0)
type FieldIsArray "color" VkClearValue = 'False
fieldOptional = False
fieldOffset = (0)
instance CanReadField "color" VkClearValue
where
getField x
= unsafeDupablePerformIO
(peekByteOff (unsafePtr x) (0))
readField p
= peekByteOff p (0)
instance CanWriteField "color" VkClearValue
where
writeField p
= pokeByteOff p (0)
instance HasField "depthStencil" VkClearValue
where
type FieldType "depthStencil" VkClearValue =
VkClearDepthStencilValue
type FieldOptional "depthStencil" VkClearValue = 'False
type FieldOffset "depthStencil" VkClearValue =
(0)
type FieldIsArray "depthStencil" VkClearValue = 'False
fieldOptional = False
fieldOffset = (0)
instance
CanReadField "depthStencil" VkClearValue where
getField x
= unsafeDupablePerformIO
(peekByteOff (unsafePtr x) (0))
readField p
= peekByteOff p (0)
instance
CanWriteField "depthStencil" VkClearValue where
writeField p
= pokeByteOff p (0)
instance Show VkClearValue where
showsPrec d x
= showString "VkClearValue {" .
showString "color = " .
showsPrec d (getField @"color" x) .
showString ", " .
showString "depthStencil = " .
showsPrec d (getField @"depthStencil" x) . showChar '}'