{-# language CPP #-}
module Vulkan.Core10.FundamentalTypes ( boolToBool32
, bool32ToBool
, Offset2D(..)
, Offset3D(..)
, Extent2D(..)
, Extent3D(..)
, Rect2D(..)
, Bool32( FALSE
, TRUE
, ..
)
, SampleMask
, Flags
, DeviceSize
, DeviceAddress
, StructureType(..)
, Result(..)
) where
import Data.Bool (bool)
import Foreign.Marshal.Alloc (allocaBytesAligned)
import Foreign.Ptr (plusPtr)
import GHC.Read (choose)
import GHC.Read (expectP)
import GHC.Read (parens)
import GHC.Show (showParen)
import GHC.Show (showString)
import GHC.Show (showsPrec)
import Text.ParserCombinators.ReadPrec ((+++))
import Text.ParserCombinators.ReadPrec (prec)
import Text.ParserCombinators.ReadPrec (step)
import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Cont (evalContT)
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 Data.Int (Int32)
import Foreign.Ptr (Ptr)
import GHC.Read (Read(readPrec))
import Data.Word (Word32)
import Data.Word (Word64)
import Text.Read.Lex (Lexeme(Ident))
import Data.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
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 Vulkan.Core10.Enums.Result (Result(..))
import Vulkan.Core10.Enums.StructureType (StructureType(..))
boolToBool32 :: Bool -> Bool32
boolToBool32 :: Bool -> Bool32
boolToBool32 = Bool32 -> Bool32 -> Bool -> Bool32
forall a. a -> a -> Bool -> a
bool Bool32
FALSE Bool32
TRUE
bool32ToBool :: Bool32 -> Bool
bool32ToBool :: Bool32 -> Bool
bool32ToBool = \case
FALSE -> Bool
False
TRUE -> Bool
True
data Offset2D = Offset2D
{
Offset2D -> Int32
x :: Int32
,
Offset2D -> Int32
y :: Int32
}
deriving (Typeable, Offset2D -> Offset2D -> Bool
(Offset2D -> Offset2D -> Bool)
-> (Offset2D -> Offset2D -> Bool) -> Eq Offset2D
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Offset2D -> Offset2D -> Bool
$c/= :: Offset2D -> Offset2D -> Bool
== :: Offset2D -> Offset2D -> Bool
$c== :: Offset2D -> Offset2D -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (Offset2D)
#endif
deriving instance Show Offset2D
instance ToCStruct Offset2D where
withCStruct :: Offset2D -> (Ptr Offset2D -> IO b) -> IO b
withCStruct x :: Offset2D
x f :: Ptr Offset2D -> IO b
f = Int -> Int -> (Ptr Offset2D -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 8 4 ((Ptr Offset2D -> IO b) -> IO b) -> (Ptr Offset2D -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr Offset2D
p -> Ptr Offset2D -> Offset2D -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr Offset2D
p Offset2D
x (Ptr Offset2D -> IO b
f Ptr Offset2D
p)
pokeCStruct :: Ptr Offset2D -> Offset2D -> IO b -> IO b
pokeCStruct p :: Ptr Offset2D
p Offset2D{..} f :: IO b
f = do
Ptr Int32 -> Int32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr Offset2D
p Ptr Offset2D -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr Int32)) (Int32
x)
Ptr Int32 -> Int32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr Offset2D
p Ptr Offset2D -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4 :: Ptr Int32)) (Int32
y)
IO b
f
cStructSize :: Int
cStructSize = 8
cStructAlignment :: Int
cStructAlignment = 4
pokeZeroCStruct :: Ptr Offset2D -> IO b -> IO b
pokeZeroCStruct p :: Ptr Offset2D
p f :: IO b
f = do
Ptr Int32 -> Int32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr Offset2D
p Ptr Offset2D -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr Int32)) (Int32
forall a. Zero a => a
zero)
Ptr Int32 -> Int32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr Offset2D
p Ptr Offset2D -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4 :: Ptr Int32)) (Int32
forall a. Zero a => a
zero)
IO b
f
instance FromCStruct Offset2D where
peekCStruct :: Ptr Offset2D -> IO Offset2D
peekCStruct p :: Ptr Offset2D
p = do
Int32
x <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek @Int32 ((Ptr Offset2D
p Ptr Offset2D -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr Int32))
Int32
y <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek @Int32 ((Ptr Offset2D
p Ptr Offset2D -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4 :: Ptr Int32))
Offset2D -> IO Offset2D
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Offset2D -> IO Offset2D) -> Offset2D -> IO Offset2D
forall a b. (a -> b) -> a -> b
$ Int32 -> Int32 -> Offset2D
Offset2D
Int32
x Int32
y
instance Storable Offset2D where
sizeOf :: Offset2D -> Int
sizeOf ~Offset2D
_ = 8
alignment :: Offset2D -> Int
alignment ~Offset2D
_ = 4
peek :: Ptr Offset2D -> IO Offset2D
peek = Ptr Offset2D -> IO Offset2D
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: Ptr Offset2D -> Offset2D -> IO ()
poke ptr :: Ptr Offset2D
ptr poked :: Offset2D
poked = Ptr Offset2D -> Offset2D -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr Offset2D
ptr Offset2D
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero Offset2D where
zero :: Offset2D
zero = Int32 -> Int32 -> Offset2D
Offset2D
Int32
forall a. Zero a => a
zero
Int32
forall a. Zero a => a
zero
data Offset3D = Offset3D
{
Offset3D -> Int32
x :: Int32
,
Offset3D -> Int32
y :: Int32
,
Offset3D -> Int32
z :: Int32
}
deriving (Typeable, Offset3D -> Offset3D -> Bool
(Offset3D -> Offset3D -> Bool)
-> (Offset3D -> Offset3D -> Bool) -> Eq Offset3D
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Offset3D -> Offset3D -> Bool
$c/= :: Offset3D -> Offset3D -> Bool
== :: Offset3D -> Offset3D -> Bool
$c== :: Offset3D -> Offset3D -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (Offset3D)
#endif
deriving instance Show Offset3D
instance ToCStruct Offset3D where
withCStruct :: Offset3D -> (Ptr Offset3D -> IO b) -> IO b
withCStruct x :: Offset3D
x f :: Ptr Offset3D -> IO b
f = Int -> Int -> (Ptr Offset3D -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 12 4 ((Ptr Offset3D -> IO b) -> IO b) -> (Ptr Offset3D -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr Offset3D
p -> Ptr Offset3D -> Offset3D -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr Offset3D
p Offset3D
x (Ptr Offset3D -> IO b
f Ptr Offset3D
p)
pokeCStruct :: Ptr Offset3D -> Offset3D -> IO b -> IO b
pokeCStruct p :: Ptr Offset3D
p Offset3D{..} f :: IO b
f = do
Ptr Int32 -> Int32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr Offset3D
p Ptr Offset3D -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr Int32)) (Int32
x)
Ptr Int32 -> Int32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr Offset3D
p Ptr Offset3D -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4 :: Ptr Int32)) (Int32
y)
Ptr Int32 -> Int32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr Offset3D
p Ptr Offset3D -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr Int32)) (Int32
z)
IO b
f
cStructSize :: Int
cStructSize = 12
cStructAlignment :: Int
cStructAlignment = 4
pokeZeroCStruct :: Ptr Offset3D -> IO b -> IO b
pokeZeroCStruct p :: Ptr Offset3D
p f :: IO b
f = do
Ptr Int32 -> Int32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr Offset3D
p Ptr Offset3D -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr Int32)) (Int32
forall a. Zero a => a
zero)
Ptr Int32 -> Int32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr Offset3D
p Ptr Offset3D -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4 :: Ptr Int32)) (Int32
forall a. Zero a => a
zero)
Ptr Int32 -> Int32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr Offset3D
p Ptr Offset3D -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr Int32)) (Int32
forall a. Zero a => a
zero)
IO b
f
instance FromCStruct Offset3D where
peekCStruct :: Ptr Offset3D -> IO Offset3D
peekCStruct p :: Ptr Offset3D
p = do
Int32
x <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek @Int32 ((Ptr Offset3D
p Ptr Offset3D -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr Int32))
Int32
y <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek @Int32 ((Ptr Offset3D
p Ptr Offset3D -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4 :: Ptr Int32))
Int32
z <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek @Int32 ((Ptr Offset3D
p Ptr Offset3D -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr Int32))
Offset3D -> IO Offset3D
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Offset3D -> IO Offset3D) -> Offset3D -> IO Offset3D
forall a b. (a -> b) -> a -> b
$ Int32 -> Int32 -> Int32 -> Offset3D
Offset3D
Int32
x Int32
y Int32
z
instance Storable Offset3D where
sizeOf :: Offset3D -> Int
sizeOf ~Offset3D
_ = 12
alignment :: Offset3D -> Int
alignment ~Offset3D
_ = 4
peek :: Ptr Offset3D -> IO Offset3D
peek = Ptr Offset3D -> IO Offset3D
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: Ptr Offset3D -> Offset3D -> IO ()
poke ptr :: Ptr Offset3D
ptr poked :: Offset3D
poked = Ptr Offset3D -> Offset3D -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr Offset3D
ptr Offset3D
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero Offset3D where
zero :: Offset3D
zero = Int32 -> Int32 -> Int32 -> Offset3D
Offset3D
Int32
forall a. Zero a => a
zero
Int32
forall a. Zero a => a
zero
Int32
forall a. Zero a => a
zero
data Extent2D = Extent2D
{
Extent2D -> Word32
width :: Word32
,
Extent2D -> Word32
height :: Word32
}
deriving (Typeable, Extent2D -> Extent2D -> Bool
(Extent2D -> Extent2D -> Bool)
-> (Extent2D -> Extent2D -> Bool) -> Eq Extent2D
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Extent2D -> Extent2D -> Bool
$c/= :: Extent2D -> Extent2D -> Bool
== :: Extent2D -> Extent2D -> Bool
$c== :: Extent2D -> Extent2D -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (Extent2D)
#endif
deriving instance Show Extent2D
instance ToCStruct Extent2D where
withCStruct :: Extent2D -> (Ptr Extent2D -> IO b) -> IO b
withCStruct x :: Extent2D
x f :: Ptr Extent2D -> IO b
f = Int -> Int -> (Ptr Extent2D -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 8 4 ((Ptr Extent2D -> IO b) -> IO b) -> (Ptr Extent2D -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr Extent2D
p -> Ptr Extent2D -> Extent2D -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr Extent2D
p Extent2D
x (Ptr Extent2D -> IO b
f Ptr Extent2D
p)
pokeCStruct :: Ptr Extent2D -> Extent2D -> IO b -> IO b
pokeCStruct p :: Ptr Extent2D
p Extent2D{..} f :: IO b
f = do
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr Extent2D
p Ptr Extent2D -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr Word32)) (Word32
width)
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr Extent2D
p Ptr Extent2D -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4 :: Ptr Word32)) (Word32
height)
IO b
f
cStructSize :: Int
cStructSize = 8
cStructAlignment :: Int
cStructAlignment = 4
pokeZeroCStruct :: Ptr Extent2D -> IO b -> IO b
pokeZeroCStruct p :: Ptr Extent2D
p f :: IO b
f = do
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr Extent2D
p Ptr Extent2D -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr Extent2D
p Ptr Extent2D -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
IO b
f
instance FromCStruct Extent2D where
peekCStruct :: Ptr Extent2D -> IO Extent2D
peekCStruct p :: Ptr Extent2D
p = do
Word32
width <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr Extent2D
p Ptr Extent2D -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr Word32))
Word32
height <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr Extent2D
p Ptr Extent2D -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4 :: Ptr Word32))
Extent2D -> IO Extent2D
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Extent2D -> IO Extent2D) -> Extent2D -> IO Extent2D
forall a b. (a -> b) -> a -> b
$ Word32 -> Word32 -> Extent2D
Extent2D
Word32
width Word32
height
instance Storable Extent2D where
sizeOf :: Extent2D -> Int
sizeOf ~Extent2D
_ = 8
alignment :: Extent2D -> Int
alignment ~Extent2D
_ = 4
peek :: Ptr Extent2D -> IO Extent2D
peek = Ptr Extent2D -> IO Extent2D
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: Ptr Extent2D -> Extent2D -> IO ()
poke ptr :: Ptr Extent2D
ptr poked :: Extent2D
poked = Ptr Extent2D -> Extent2D -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr Extent2D
ptr Extent2D
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero Extent2D where
zero :: Extent2D
zero = Word32 -> Word32 -> Extent2D
Extent2D
Word32
forall a. Zero a => a
zero
Word32
forall a. Zero a => a
zero
data Extent3D = Extent3D
{
Extent3D -> Word32
width :: Word32
,
Extent3D -> Word32
height :: Word32
,
Extent3D -> Word32
depth :: Word32
}
deriving (Typeable, Extent3D -> Extent3D -> Bool
(Extent3D -> Extent3D -> Bool)
-> (Extent3D -> Extent3D -> Bool) -> Eq Extent3D
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Extent3D -> Extent3D -> Bool
$c/= :: Extent3D -> Extent3D -> Bool
== :: Extent3D -> Extent3D -> Bool
$c== :: Extent3D -> Extent3D -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (Extent3D)
#endif
deriving instance Show Extent3D
instance ToCStruct Extent3D where
withCStruct :: Extent3D -> (Ptr Extent3D -> IO b) -> IO b
withCStruct x :: Extent3D
x f :: Ptr Extent3D -> IO b
f = Int -> Int -> (Ptr Extent3D -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 12 4 ((Ptr Extent3D -> IO b) -> IO b) -> (Ptr Extent3D -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr Extent3D
p -> Ptr Extent3D -> Extent3D -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr Extent3D
p Extent3D
x (Ptr Extent3D -> IO b
f Ptr Extent3D
p)
pokeCStruct :: Ptr Extent3D -> Extent3D -> IO b -> IO b
pokeCStruct p :: Ptr Extent3D
p Extent3D{..} f :: IO b
f = do
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr Extent3D
p Ptr Extent3D -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr Word32)) (Word32
width)
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr Extent3D
p Ptr Extent3D -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4 :: Ptr Word32)) (Word32
height)
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr Extent3D
p Ptr Extent3D -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr Word32)) (Word32
depth)
IO b
f
cStructSize :: Int
cStructSize = 12
cStructAlignment :: Int
cStructAlignment = 4
pokeZeroCStruct :: Ptr Extent3D -> IO b -> IO b
pokeZeroCStruct p :: Ptr Extent3D
p f :: IO b
f = do
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr Extent3D
p Ptr Extent3D -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr Extent3D
p Ptr Extent3D -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr Extent3D
p Ptr Extent3D -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
IO b
f
instance FromCStruct Extent3D where
peekCStruct :: Ptr Extent3D -> IO Extent3D
peekCStruct p :: Ptr Extent3D
p = do
Word32
width <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr Extent3D
p Ptr Extent3D -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr Word32))
Word32
height <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr Extent3D
p Ptr Extent3D -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4 :: Ptr Word32))
Word32
depth <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr Extent3D
p Ptr Extent3D -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr Word32))
Extent3D -> IO Extent3D
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Extent3D -> IO Extent3D) -> Extent3D -> IO Extent3D
forall a b. (a -> b) -> a -> b
$ Word32 -> Word32 -> Word32 -> Extent3D
Extent3D
Word32
width Word32
height Word32
depth
instance Storable Extent3D where
sizeOf :: Extent3D -> Int
sizeOf ~Extent3D
_ = 12
alignment :: Extent3D -> Int
alignment ~Extent3D
_ = 4
peek :: Ptr Extent3D -> IO Extent3D
peek = Ptr Extent3D -> IO Extent3D
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: Ptr Extent3D -> Extent3D -> IO ()
poke ptr :: Ptr Extent3D
ptr poked :: Extent3D
poked = Ptr Extent3D -> Extent3D -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr Extent3D
ptr Extent3D
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero Extent3D where
zero :: Extent3D
zero = Word32 -> Word32 -> Word32 -> Extent3D
Extent3D
Word32
forall a. Zero a => a
zero
Word32
forall a. Zero a => a
zero
Word32
forall a. Zero a => a
zero
data Rect2D = Rect2D
{
Rect2D -> Offset2D
offset :: Offset2D
,
Rect2D -> Extent2D
extent :: Extent2D
}
deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (Rect2D)
#endif
deriving instance Show Rect2D
instance ToCStruct Rect2D where
withCStruct :: Rect2D -> (Ptr Rect2D -> IO b) -> IO b
withCStruct x :: Rect2D
x f :: Ptr Rect2D -> IO b
f = Int -> Int -> (Ptr Rect2D -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 16 4 ((Ptr Rect2D -> IO b) -> IO b) -> (Ptr Rect2D -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr Rect2D
p -> Ptr Rect2D -> Rect2D -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr Rect2D
p Rect2D
x (Ptr Rect2D -> IO b
f Ptr Rect2D
p)
pokeCStruct :: Ptr Rect2D -> Rect2D -> IO b -> IO b
pokeCStruct p :: Ptr Rect2D
p Rect2D{..} f :: IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Offset2D -> Offset2D -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct ((Ptr Rect2D
p Ptr Rect2D -> Int -> Ptr Offset2D
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr Offset2D)) (Offset2D
offset) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())
((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Extent2D -> Extent2D -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct ((Ptr Rect2D
p Ptr Rect2D -> Int -> Ptr Extent2D
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr Extent2D)) (Extent2D
extent) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())
IO b -> ContT b IO b
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO b -> ContT b IO b) -> IO b -> ContT b IO b
forall a b. (a -> b) -> a -> b
$ IO b
f
cStructSize :: Int
cStructSize = 16
cStructAlignment :: Int
cStructAlignment = 4
pokeZeroCStruct :: Ptr Rect2D -> IO b -> IO b
pokeZeroCStruct p :: Ptr Rect2D
p f :: IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Offset2D -> Offset2D -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct ((Ptr Rect2D
p Ptr Rect2D -> Int -> Ptr Offset2D
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr Offset2D)) (Offset2D
forall a. Zero a => a
zero) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())
((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Extent2D -> Extent2D -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct ((Ptr Rect2D
p Ptr Rect2D -> Int -> Ptr Extent2D
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr Extent2D)) (Extent2D
forall a. Zero a => a
zero) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())
IO b -> ContT b IO b
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO b -> ContT b IO b) -> IO b -> ContT b IO b
forall a b. (a -> b) -> a -> b
$ IO b
f
instance FromCStruct Rect2D where
peekCStruct :: Ptr Rect2D -> IO Rect2D
peekCStruct p :: Ptr Rect2D
p = do
Offset2D
offset <- Ptr Offset2D -> IO Offset2D
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @Offset2D ((Ptr Rect2D
p Ptr Rect2D -> Int -> Ptr Offset2D
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr Offset2D))
Extent2D
extent <- Ptr Extent2D -> IO Extent2D
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @Extent2D ((Ptr Rect2D
p Ptr Rect2D -> Int -> Ptr Extent2D
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr Extent2D))
Rect2D -> IO Rect2D
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Rect2D -> IO Rect2D) -> Rect2D -> IO Rect2D
forall a b. (a -> b) -> a -> b
$ Offset2D -> Extent2D -> Rect2D
Rect2D
Offset2D
offset Extent2D
extent
instance Zero Rect2D where
zero :: Rect2D
zero = Offset2D -> Extent2D -> Rect2D
Rect2D
Offset2D
forall a. Zero a => a
zero
Extent2D
forall a. Zero a => a
zero
newtype Bool32 = Bool32 Int32
deriving newtype (Bool32 -> Bool32 -> Bool
(Bool32 -> Bool32 -> Bool)
-> (Bool32 -> Bool32 -> Bool) -> Eq Bool32
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Bool32 -> Bool32 -> Bool
$c/= :: Bool32 -> Bool32 -> Bool
== :: Bool32 -> Bool32 -> Bool
$c== :: Bool32 -> Bool32 -> Bool
Eq, Eq Bool32
Eq Bool32 =>
(Bool32 -> Bool32 -> Ordering)
-> (Bool32 -> Bool32 -> Bool)
-> (Bool32 -> Bool32 -> Bool)
-> (Bool32 -> Bool32 -> Bool)
-> (Bool32 -> Bool32 -> Bool)
-> (Bool32 -> Bool32 -> Bool32)
-> (Bool32 -> Bool32 -> Bool32)
-> Ord Bool32
Bool32 -> Bool32 -> Bool
Bool32 -> Bool32 -> Ordering
Bool32 -> Bool32 -> Bool32
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 :: Bool32 -> Bool32 -> Bool32
$cmin :: Bool32 -> Bool32 -> Bool32
max :: Bool32 -> Bool32 -> Bool32
$cmax :: Bool32 -> Bool32 -> Bool32
>= :: Bool32 -> Bool32 -> Bool
$c>= :: Bool32 -> Bool32 -> Bool
> :: Bool32 -> Bool32 -> Bool
$c> :: Bool32 -> Bool32 -> Bool
<= :: Bool32 -> Bool32 -> Bool
$c<= :: Bool32 -> Bool32 -> Bool
< :: Bool32 -> Bool32 -> Bool
$c< :: Bool32 -> Bool32 -> Bool
compare :: Bool32 -> Bool32 -> Ordering
$ccompare :: Bool32 -> Bool32 -> Ordering
$cp1Ord :: Eq Bool32
Ord, Ptr b -> Int -> IO Bool32
Ptr b -> Int -> Bool32 -> IO ()
Ptr Bool32 -> IO Bool32
Ptr Bool32 -> Int -> IO Bool32
Ptr Bool32 -> Int -> Bool32 -> IO ()
Ptr Bool32 -> Bool32 -> IO ()
Bool32 -> Int
(Bool32 -> Int)
-> (Bool32 -> Int)
-> (Ptr Bool32 -> Int -> IO Bool32)
-> (Ptr Bool32 -> Int -> Bool32 -> IO ())
-> (forall b. Ptr b -> Int -> IO Bool32)
-> (forall b. Ptr b -> Int -> Bool32 -> IO ())
-> (Ptr Bool32 -> IO Bool32)
-> (Ptr Bool32 -> Bool32 -> IO ())
-> Storable Bool32
forall b. Ptr b -> Int -> IO Bool32
forall b. Ptr b -> Int -> Bool32 -> 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 Bool32 -> Bool32 -> IO ()
$cpoke :: Ptr Bool32 -> Bool32 -> IO ()
peek :: Ptr Bool32 -> IO Bool32
$cpeek :: Ptr Bool32 -> IO Bool32
pokeByteOff :: Ptr b -> Int -> Bool32 -> IO ()
$cpokeByteOff :: forall b. Ptr b -> Int -> Bool32 -> IO ()
peekByteOff :: Ptr b -> Int -> IO Bool32
$cpeekByteOff :: forall b. Ptr b -> Int -> IO Bool32
pokeElemOff :: Ptr Bool32 -> Int -> Bool32 -> IO ()
$cpokeElemOff :: Ptr Bool32 -> Int -> Bool32 -> IO ()
peekElemOff :: Ptr Bool32 -> Int -> IO Bool32
$cpeekElemOff :: Ptr Bool32 -> Int -> IO Bool32
alignment :: Bool32 -> Int
$calignment :: Bool32 -> Int
sizeOf :: Bool32 -> Int
$csizeOf :: Bool32 -> Int
Storable, Bool32
Bool32 -> Zero Bool32
forall a. a -> Zero a
zero :: Bool32
$czero :: Bool32
Zero)
pattern $bFALSE :: Bool32
$mFALSE :: forall r. Bool32 -> (Void# -> r) -> (Void# -> r) -> r
FALSE = Bool32 0
pattern $bTRUE :: Bool32
$mTRUE :: forall r. Bool32 -> (Void# -> r) -> (Void# -> r) -> r
TRUE = Bool32 1
{-# complete FALSE,
TRUE :: Bool32 #-}
instance Show Bool32 where
showsPrec :: Int -> Bool32 -> ShowS
showsPrec p :: Int
p = \case
FALSE -> String -> ShowS
showString "FALSE"
TRUE -> String -> ShowS
showString "TRUE"
Bool32 x :: Int32
x -> Bool -> ShowS -> ShowS
showParen (Int
p Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= 11) (String -> ShowS
showString "Bool32 " ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Int32 -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec 11 Int32
x)
instance Read Bool32 where
readPrec :: ReadPrec Bool32
readPrec = ReadPrec Bool32 -> ReadPrec Bool32
forall a. ReadPrec a -> ReadPrec a
parens ([(String, ReadPrec Bool32)] -> ReadPrec Bool32
forall a. [(String, ReadPrec a)] -> ReadPrec a
choose [("FALSE", Bool32 -> ReadPrec Bool32
forall (f :: * -> *) a. Applicative f => a -> f a
pure Bool32
FALSE)
, ("TRUE", Bool32 -> ReadPrec Bool32
forall (f :: * -> *) a. Applicative f => a -> f a
pure Bool32
TRUE)]
ReadPrec Bool32 -> ReadPrec Bool32 -> ReadPrec Bool32
forall a. ReadPrec a -> ReadPrec a -> ReadPrec a
+++
Int -> ReadPrec Bool32 -> ReadPrec Bool32
forall a. Int -> ReadPrec a -> ReadPrec a
prec 10 (do
Lexeme -> ReadPrec ()
expectP (String -> Lexeme
Ident "Bool32")
Int32
v <- ReadPrec Int32 -> ReadPrec Int32
forall a. ReadPrec a -> ReadPrec a
step ReadPrec Int32
forall a. Read a => ReadPrec a
readPrec
Bool32 -> ReadPrec Bool32
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Int32 -> Bool32
Bool32 Int32
v)))
type SampleMask = Word32
type Flags = Word32
type DeviceSize = Word64
type DeviceAddress = Word64