{-# language CPP #-}
module Vulkan.Core12.Promoted_From_VK_EXT_separate_stencil_usage ( ImageStencilUsageCreateInfo(..)
, StructureType(..)
) where
import Foreign.Marshal.Alloc (allocaBytesAligned)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import Data.Typeable (Typeable)
import Foreign.Storable (Storable)
import Foreign.Storable (Storable(peek))
import Foreign.Storable (Storable(poke))
import qualified Foreign.Storable (Storable(..))
import Foreign.Ptr (Ptr)
import Data.Kind (Type)
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.Core10.Enums.ImageUsageFlagBits (ImageUsageFlags)
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Zero (Zero(..))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO))
import Vulkan.Core10.Enums.StructureType (StructureType(..))
data ImageStencilUsageCreateInfo = ImageStencilUsageCreateInfo
{
ImageStencilUsageCreateInfo -> ImageUsageFlags
stencilUsage :: ImageUsageFlags }
deriving (Typeable)
deriving instance Show ImageStencilUsageCreateInfo
instance ToCStruct ImageStencilUsageCreateInfo where
withCStruct :: ImageStencilUsageCreateInfo
-> (Ptr ImageStencilUsageCreateInfo -> IO b) -> IO b
withCStruct x :: ImageStencilUsageCreateInfo
x f :: Ptr ImageStencilUsageCreateInfo -> IO b
f = Int -> Int -> (Ptr ImageStencilUsageCreateInfo -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 24 8 ((Ptr ImageStencilUsageCreateInfo -> IO b) -> IO b)
-> (Ptr ImageStencilUsageCreateInfo -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr ImageStencilUsageCreateInfo
p -> Ptr ImageStencilUsageCreateInfo
-> ImageStencilUsageCreateInfo -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr ImageStencilUsageCreateInfo
p ImageStencilUsageCreateInfo
x (Ptr ImageStencilUsageCreateInfo -> IO b
f Ptr ImageStencilUsageCreateInfo
p)
pokeCStruct :: Ptr ImageStencilUsageCreateInfo
-> ImageStencilUsageCreateInfo -> IO b -> IO b
pokeCStruct p :: Ptr ImageStencilUsageCreateInfo
p ImageStencilUsageCreateInfo{..} f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageStencilUsageCreateInfo
p Ptr ImageStencilUsageCreateInfo -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageStencilUsageCreateInfo
p Ptr ImageStencilUsageCreateInfo -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
Ptr ImageUsageFlags -> ImageUsageFlags -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageStencilUsageCreateInfo
p Ptr ImageStencilUsageCreateInfo -> Int -> Ptr ImageUsageFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr ImageUsageFlags)) (ImageUsageFlags
stencilUsage)
IO b
f
cStructSize :: Int
cStructSize = 24
cStructAlignment :: Int
cStructAlignment = 8
pokeZeroCStruct :: Ptr ImageStencilUsageCreateInfo -> IO b -> IO b
pokeZeroCStruct p :: Ptr ImageStencilUsageCreateInfo
p f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageStencilUsageCreateInfo
p Ptr ImageStencilUsageCreateInfo -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageStencilUsageCreateInfo
p Ptr ImageStencilUsageCreateInfo -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
Ptr ImageUsageFlags -> ImageUsageFlags -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageStencilUsageCreateInfo
p Ptr ImageStencilUsageCreateInfo -> Int -> Ptr ImageUsageFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr ImageUsageFlags)) (ImageUsageFlags
forall a. Zero a => a
zero)
IO b
f
instance FromCStruct ImageStencilUsageCreateInfo where
peekCStruct :: Ptr ImageStencilUsageCreateInfo -> IO ImageStencilUsageCreateInfo
peekCStruct p :: Ptr ImageStencilUsageCreateInfo
p = do
ImageUsageFlags
stencilUsage <- Ptr ImageUsageFlags -> IO ImageUsageFlags
forall a. Storable a => Ptr a -> IO a
peek @ImageUsageFlags ((Ptr ImageStencilUsageCreateInfo
p Ptr ImageStencilUsageCreateInfo -> Int -> Ptr ImageUsageFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr ImageUsageFlags))
ImageStencilUsageCreateInfo -> IO ImageStencilUsageCreateInfo
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ImageStencilUsageCreateInfo -> IO ImageStencilUsageCreateInfo)
-> ImageStencilUsageCreateInfo -> IO ImageStencilUsageCreateInfo
forall a b. (a -> b) -> a -> b
$ ImageUsageFlags -> ImageStencilUsageCreateInfo
ImageStencilUsageCreateInfo
ImageUsageFlags
stencilUsage
instance Storable ImageStencilUsageCreateInfo where
sizeOf :: ImageStencilUsageCreateInfo -> Int
sizeOf ~ImageStencilUsageCreateInfo
_ = 24
alignment :: ImageStencilUsageCreateInfo -> Int
alignment ~ImageStencilUsageCreateInfo
_ = 8
peek :: Ptr ImageStencilUsageCreateInfo -> IO ImageStencilUsageCreateInfo
peek = Ptr ImageStencilUsageCreateInfo -> IO ImageStencilUsageCreateInfo
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: Ptr ImageStencilUsageCreateInfo
-> ImageStencilUsageCreateInfo -> IO ()
poke ptr :: Ptr ImageStencilUsageCreateInfo
ptr poked :: ImageStencilUsageCreateInfo
poked = Ptr ImageStencilUsageCreateInfo
-> ImageStencilUsageCreateInfo -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr ImageStencilUsageCreateInfo
ptr ImageStencilUsageCreateInfo
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero ImageStencilUsageCreateInfo where
zero :: ImageStencilUsageCreateInfo
zero = ImageUsageFlags -> ImageStencilUsageCreateInfo
ImageStencilUsageCreateInfo
ImageUsageFlags
forall a. Zero a => a
zero