{-# language CPP #-}
-- No documentation found for Chapter "Promoted_From_VK_EXT_separate_stencil_usage"
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 GHC.Generics (Generic)
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(..))
-- | VkImageStencilUsageCreateInfo - Specify separate usage flags for the
-- stencil aspect of a depth-stencil image
--
-- = Description
--
-- If the @pNext@ chain of 'Vulkan.Core10.Image.ImageCreateInfo' includes a
-- 'ImageStencilUsageCreateInfo' structure, then that structure includes
-- the usage flags specific to the stencil aspect of the image for an image
-- with a depth-stencil format.
--
-- This structure specifies image usages which only apply to the stencil
-- aspect of a depth\/stencil format image. When this structure is included
-- in the @pNext@ chain of 'Vulkan.Core10.Image.ImageCreateInfo', the
-- stencil aspect of the image /must/ only be used as specified by
-- @stencilUsage@. When this structure is not included in the @pNext@ chain
-- of 'Vulkan.Core10.Image.ImageCreateInfo', the stencil aspect of an image
-- /must/ only be used as specified
-- 'Vulkan.Core10.Image.ImageCreateInfo'::@usage@. Use of other aspects of
-- an image are unaffected by this structure.
--
-- This structure /can/ also be included in the @pNext@ chain of
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceImageFormatInfo2'
-- to query additional capabilities specific to image creation parameter
-- combinations including a separate set of usage flags for the stencil
-- aspect of the image using
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.getPhysicalDeviceImageFormatProperties2'.
-- When this structure is not included in the @pNext@ chain of
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceImageFormatInfo2'
-- then the implicit value of @stencilUsage@ matches that of
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceImageFormatInfo2'::@usage@.
--
-- == Valid Usage
--
-- -   #VUID-VkImageStencilUsageCreateInfo-stencilUsage-02539# If
--     @stencilUsage@ includes
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT',
--     it /must/ not include bits other than
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT'
--     or
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_INPUT_ATTACHMENT_BIT'
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkImageStencilUsageCreateInfo-sType-sType# @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO'
--
-- -   #VUID-VkImageStencilUsageCreateInfo-stencilUsage-parameter#
--     @stencilUsage@ /must/ be a valid combination of
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.ImageUsageFlagBits' values
--
-- -   #VUID-VkImageStencilUsageCreateInfo-stencilUsage-requiredbitmask#
--     @stencilUsage@ /must/ not be @0@
--
-- = See Also
--
-- 'Vulkan.Core10.Enums.ImageUsageFlagBits.ImageUsageFlags',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data ImageStencilUsageCreateInfo = ImageStencilUsageCreateInfo
  { -- | @stencilUsage@ is a bitmask of
    -- 'Vulkan.Core10.Enums.ImageUsageFlagBits.ImageUsageFlagBits' describing
    -- the intended usage of the stencil aspect of the image.
    ImageStencilUsageCreateInfo -> ImageUsageFlags
stencilUsage :: ImageUsageFlags }
  deriving (Typeable, ImageStencilUsageCreateInfo -> ImageStencilUsageCreateInfo -> Bool
(ImageStencilUsageCreateInfo
 -> ImageStencilUsageCreateInfo -> Bool)
-> (ImageStencilUsageCreateInfo
    -> ImageStencilUsageCreateInfo -> Bool)
-> Eq ImageStencilUsageCreateInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImageStencilUsageCreateInfo -> ImageStencilUsageCreateInfo -> Bool
$c/= :: ImageStencilUsageCreateInfo -> ImageStencilUsageCreateInfo -> Bool
== :: ImageStencilUsageCreateInfo -> ImageStencilUsageCreateInfo -> Bool
$c== :: ImageStencilUsageCreateInfo -> ImageStencilUsageCreateInfo -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ImageStencilUsageCreateInfo)
#endif
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