{-# language CPP #-}
-- No documentation found for Chapter "Promoted_From_VK_EXT_pipeline_creation_feedback"
module Vulkan.Core13.Promoted_From_VK_EXT_pipeline_creation_feedback  ( PipelineCreationFeedback(..)
                                                                      , PipelineCreationFeedbackCreateInfo(..)
                                                                      , StructureType(..)
                                                                      , PipelineCreationFeedbackFlagBits(..)
                                                                      , PipelineCreationFeedbackFlags
                                                                      ) where

import Foreign.Marshal.Alloc (allocaBytes)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Zero (Zero(..))
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.Word (Word32)
import Data.Word (Word64)
import Data.Kind (Type)
import Vulkan.Core13.Enums.PipelineCreationFeedbackFlagBits (PipelineCreationFeedbackFlags)
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO))
import Vulkan.Core13.Enums.PipelineCreationFeedbackFlagBits (PipelineCreationFeedbackFlagBits(..))
import Vulkan.Core13.Enums.PipelineCreationFeedbackFlagBits (PipelineCreationFeedbackFlags)
import Vulkan.Core10.Enums.StructureType (StructureType(..))
-- | VkPipelineCreationFeedback - Feedback about the creation of a pipeline
-- or pipeline stage
--
-- = Description
--
-- If the
-- 'Vulkan.Core13.Enums.PipelineCreationFeedbackFlagBits.PIPELINE_CREATION_FEEDBACK_VALID_BIT'
-- is not set in @flags@, an implementation /must/ not set any other bits
-- in @flags@, and the values of all other 'PipelineCreationFeedback' data
-- members are undefined.
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_pipeline_creation_feedback VK_EXT_pipeline_creation_feedback>,
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_VERSION_1_3 VK_VERSION_1_3>,
-- 'PipelineCreationFeedbackCreateInfo',
-- 'Vulkan.Core13.Enums.PipelineCreationFeedbackFlagBits.PipelineCreationFeedbackFlagBits',
-- 'Vulkan.Core13.Enums.PipelineCreationFeedbackFlagBits.PipelineCreationFeedbackFlags'
data PipelineCreationFeedback = PipelineCreationFeedback
  { -- | @flags@ is a bitmask of
    -- 'Vulkan.Core13.Enums.PipelineCreationFeedbackFlagBits.PipelineCreationFeedbackFlagBits'
    -- providing feedback about the creation of a pipeline or of a pipeline
    -- stage.
    PipelineCreationFeedback -> PipelineCreationFeedbackFlags
flags :: PipelineCreationFeedbackFlags
  , -- | @duration@ is the duration spent creating a pipeline or pipeline stage
    -- in nanoseconds.
    PipelineCreationFeedback -> Word64
duration :: Word64
  }
  deriving (Typeable, PipelineCreationFeedback -> PipelineCreationFeedback -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PipelineCreationFeedback -> PipelineCreationFeedback -> Bool
$c/= :: PipelineCreationFeedback -> PipelineCreationFeedback -> Bool
== :: PipelineCreationFeedback -> PipelineCreationFeedback -> Bool
$c== :: PipelineCreationFeedback -> PipelineCreationFeedback -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PipelineCreationFeedback)
#endif
deriving instance Show PipelineCreationFeedback

instance ToCStruct PipelineCreationFeedback where
  withCStruct :: forall b.
PipelineCreationFeedback
-> (Ptr PipelineCreationFeedback -> IO b) -> IO b
withCStruct PipelineCreationFeedback
x Ptr PipelineCreationFeedback -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
16 forall a b. (a -> b) -> a -> b
$ \Ptr PipelineCreationFeedback
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PipelineCreationFeedback
p PipelineCreationFeedback
x (Ptr PipelineCreationFeedback -> IO b
f Ptr PipelineCreationFeedback
p)
  pokeCStruct :: forall b.
Ptr PipelineCreationFeedback
-> PipelineCreationFeedback -> IO b -> IO b
pokeCStruct Ptr PipelineCreationFeedback
p PipelineCreationFeedback{Word64
PipelineCreationFeedbackFlags
duration :: Word64
flags :: PipelineCreationFeedbackFlags
$sel:duration:PipelineCreationFeedback :: PipelineCreationFeedback -> Word64
$sel:flags:PipelineCreationFeedback :: PipelineCreationFeedback -> PipelineCreationFeedbackFlags
..} IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineCreationFeedback
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr PipelineCreationFeedbackFlags)) (PipelineCreationFeedbackFlags
flags)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineCreationFeedback
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr Word64)) (Word64
duration)
    IO b
f
  cStructSize :: Int
cStructSize = Int
16
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b. Ptr PipelineCreationFeedback -> IO b -> IO b
pokeZeroCStruct Ptr PipelineCreationFeedback
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineCreationFeedback
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr PipelineCreationFeedbackFlags)) (forall a. Zero a => a
zero)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineCreationFeedback
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr Word64)) (forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct PipelineCreationFeedback where
  peekCStruct :: Ptr PipelineCreationFeedback -> IO PipelineCreationFeedback
peekCStruct Ptr PipelineCreationFeedback
p = do
    PipelineCreationFeedbackFlags
flags <- forall a. Storable a => Ptr a -> IO a
peek @PipelineCreationFeedbackFlags ((Ptr PipelineCreationFeedback
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr PipelineCreationFeedbackFlags))
    Word64
duration <- forall a. Storable a => Ptr a -> IO a
peek @Word64 ((Ptr PipelineCreationFeedback
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr Word64))
    forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ PipelineCreationFeedbackFlags -> Word64 -> PipelineCreationFeedback
PipelineCreationFeedback
             PipelineCreationFeedbackFlags
flags Word64
duration

instance Storable PipelineCreationFeedback where
  sizeOf :: PipelineCreationFeedback -> Int
sizeOf ~PipelineCreationFeedback
_ = Int
16
  alignment :: PipelineCreationFeedback -> Int
alignment ~PipelineCreationFeedback
_ = Int
8
  peek :: Ptr PipelineCreationFeedback -> IO PipelineCreationFeedback
peek = forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
  poke :: Ptr PipelineCreationFeedback -> PipelineCreationFeedback -> IO ()
poke Ptr PipelineCreationFeedback
ptr PipelineCreationFeedback
poked = forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PipelineCreationFeedback
ptr PipelineCreationFeedback
poked (forall (f :: * -> *) a. Applicative f => a -> f a
pure ())

instance Zero PipelineCreationFeedback where
  zero :: PipelineCreationFeedback
zero = PipelineCreationFeedbackFlags -> Word64 -> PipelineCreationFeedback
PipelineCreationFeedback
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero


-- | VkPipelineCreationFeedbackCreateInfo - Request for feedback about the
-- creation of a pipeline
--
-- = Description
--
-- An implementation /should/ write pipeline creation feedback to
-- @pPipelineCreationFeedback@ and /may/ write pipeline stage creation
-- feedback to @pPipelineStageCreationFeedbacks@. An implementation /must/
-- set or clear the
-- 'Vulkan.Core13.Enums.PipelineCreationFeedbackFlagBits.PIPELINE_CREATION_FEEDBACK_VALID_BIT'
-- in 'PipelineCreationFeedback'::@flags@ for @pPipelineCreationFeedback@
-- and every element of @pPipelineStageCreationFeedbacks@.
--
-- Note
--
-- One common scenario for an implementation to skip per-stage feedback is
-- when
-- 'Vulkan.Core13.Enums.PipelineCreationFeedbackFlagBits.PIPELINE_CREATION_FEEDBACK_APPLICATION_PIPELINE_CACHE_HIT_BIT'
-- is set in @pPipelineCreationFeedback@.
--
-- When chained to
-- 'Vulkan.Extensions.VK_KHR_ray_tracing_pipeline.RayTracingPipelineCreateInfoKHR',
-- 'Vulkan.Extensions.VK_NV_ray_tracing.RayTracingPipelineCreateInfoNV', or
-- 'Vulkan.Core10.Pipeline.GraphicsPipelineCreateInfo', the @i@ element of
-- @pPipelineStageCreationFeedbacks@ corresponds to the @i@ element of
-- 'Vulkan.Extensions.VK_KHR_ray_tracing_pipeline.RayTracingPipelineCreateInfoKHR'::@pStages@,
-- 'Vulkan.Extensions.VK_NV_ray_tracing.RayTracingPipelineCreateInfoNV'::@pStages@,
-- or 'Vulkan.Core10.Pipeline.GraphicsPipelineCreateInfo'::@pStages@. When
-- chained to 'Vulkan.Core10.Pipeline.ComputePipelineCreateInfo', the first
-- element of @pPipelineStageCreationFeedbacks@ corresponds to
-- 'Vulkan.Core10.Pipeline.ComputePipelineCreateInfo'::@stage@.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkPipelineCreationFeedbackCreateInfo-sType-sType# @sType@
--     /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO'
--
-- -   #VUID-VkPipelineCreationFeedbackCreateInfo-pPipelineCreationFeedback-parameter#
--     @pPipelineCreationFeedback@ /must/ be a valid pointer to a
--     'PipelineCreationFeedback' structure
--
-- -   #VUID-VkPipelineCreationFeedbackCreateInfo-pPipelineStageCreationFeedbacks-parameter#
--     If @pipelineStageCreationFeedbackCount@ is not @0@,
--     @pPipelineStageCreationFeedbacks@ /must/ be a valid pointer to an
--     array of @pipelineStageCreationFeedbackCount@
--     'PipelineCreationFeedback' structures
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_pipeline_creation_feedback VK_EXT_pipeline_creation_feedback>,
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_VERSION_1_3 VK_VERSION_1_3>,
-- 'Vulkan.Core10.Pipeline.ComputePipelineCreateInfo',
-- 'Vulkan.Core10.Pipeline.GraphicsPipelineCreateInfo',
-- 'PipelineCreationFeedback',
-- 'Vulkan.Extensions.VK_KHR_ray_tracing_pipeline.RayTracingPipelineCreateInfoKHR',
-- 'Vulkan.Extensions.VK_NV_ray_tracing.RayTracingPipelineCreateInfoNV',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PipelineCreationFeedbackCreateInfo = PipelineCreationFeedbackCreateInfo
  { -- | @pPipelineCreationFeedback@ is a pointer to a 'PipelineCreationFeedback'
    -- structure.
    PipelineCreationFeedbackCreateInfo -> Ptr PipelineCreationFeedback
pipelineCreationFeedback :: Ptr PipelineCreationFeedback
  , -- | @pipelineStageCreationFeedbackCount@ is the number of elements in
    -- @pPipelineStageCreationFeedbacks@.
    PipelineCreationFeedbackCreateInfo -> Word32
pipelineStageCreationFeedbackCount :: Word32
  , -- | @pPipelineStageCreationFeedbacks@ is a pointer to an array of
    -- @pipelineStageCreationFeedbackCount@ 'PipelineCreationFeedback'
    -- structures.
    PipelineCreationFeedbackCreateInfo -> Ptr PipelineCreationFeedback
pipelineStageCreationFeedbacks :: Ptr PipelineCreationFeedback
  }
  deriving (Typeable, PipelineCreationFeedbackCreateInfo
-> PipelineCreationFeedbackCreateInfo -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PipelineCreationFeedbackCreateInfo
-> PipelineCreationFeedbackCreateInfo -> Bool
$c/= :: PipelineCreationFeedbackCreateInfo
-> PipelineCreationFeedbackCreateInfo -> Bool
== :: PipelineCreationFeedbackCreateInfo
-> PipelineCreationFeedbackCreateInfo -> Bool
$c== :: PipelineCreationFeedbackCreateInfo
-> PipelineCreationFeedbackCreateInfo -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PipelineCreationFeedbackCreateInfo)
#endif
deriving instance Show PipelineCreationFeedbackCreateInfo

instance ToCStruct PipelineCreationFeedbackCreateInfo where
  withCStruct :: forall b.
PipelineCreationFeedbackCreateInfo
-> (Ptr PipelineCreationFeedbackCreateInfo -> IO b) -> IO b
withCStruct PipelineCreationFeedbackCreateInfo
x Ptr PipelineCreationFeedbackCreateInfo -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
40 forall a b. (a -> b) -> a -> b
$ \Ptr PipelineCreationFeedbackCreateInfo
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PipelineCreationFeedbackCreateInfo
p PipelineCreationFeedbackCreateInfo
x (Ptr PipelineCreationFeedbackCreateInfo -> IO b
f Ptr PipelineCreationFeedbackCreateInfo
p)
  pokeCStruct :: forall b.
Ptr PipelineCreationFeedbackCreateInfo
-> PipelineCreationFeedbackCreateInfo -> IO b -> IO b
pokeCStruct Ptr PipelineCreationFeedbackCreateInfo
p PipelineCreationFeedbackCreateInfo{Word32
Ptr PipelineCreationFeedback
pipelineStageCreationFeedbacks :: Ptr PipelineCreationFeedback
pipelineStageCreationFeedbackCount :: Word32
pipelineCreationFeedback :: Ptr PipelineCreationFeedback
$sel:pipelineStageCreationFeedbacks:PipelineCreationFeedbackCreateInfo :: PipelineCreationFeedbackCreateInfo -> Ptr PipelineCreationFeedback
$sel:pipelineStageCreationFeedbackCount:PipelineCreationFeedbackCreateInfo :: PipelineCreationFeedbackCreateInfo -> Word32
$sel:pipelineCreationFeedback:PipelineCreationFeedbackCreateInfo :: PipelineCreationFeedbackCreateInfo -> Ptr PipelineCreationFeedback
..} IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineCreationFeedbackCreateInfo
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineCreationFeedbackCreateInfo
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineCreationFeedbackCreateInfo
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr (Ptr PipelineCreationFeedback))) (Ptr PipelineCreationFeedback
pipelineCreationFeedback)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineCreationFeedbackCreateInfo
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Word32)) (Word32
pipelineStageCreationFeedbackCount)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineCreationFeedbackCreateInfo
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr (Ptr PipelineCreationFeedback))) (Ptr PipelineCreationFeedback
pipelineStageCreationFeedbacks)
    IO b
f
  cStructSize :: Int
cStructSize = Int
40
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b. Ptr PipelineCreationFeedbackCreateInfo -> IO b -> IO b
pokeZeroCStruct Ptr PipelineCreationFeedbackCreateInfo
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineCreationFeedbackCreateInfo
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineCreationFeedbackCreateInfo
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineCreationFeedbackCreateInfo
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr (Ptr PipelineCreationFeedback))) (forall a. Zero a => a
zero)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineCreationFeedbackCreateInfo
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr (Ptr PipelineCreationFeedback))) (forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct PipelineCreationFeedbackCreateInfo where
  peekCStruct :: Ptr PipelineCreationFeedbackCreateInfo
-> IO PipelineCreationFeedbackCreateInfo
peekCStruct Ptr PipelineCreationFeedbackCreateInfo
p = do
    Ptr PipelineCreationFeedback
pPipelineCreationFeedback <- forall a. Storable a => Ptr a -> IO a
peek @(Ptr PipelineCreationFeedback) ((Ptr PipelineCreationFeedbackCreateInfo
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr (Ptr PipelineCreationFeedback)))
    Word32
pipelineStageCreationFeedbackCount <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr PipelineCreationFeedbackCreateInfo
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Word32))
    Ptr PipelineCreationFeedback
pPipelineStageCreationFeedbacks <- forall a. Storable a => Ptr a -> IO a
peek @(Ptr PipelineCreationFeedback) ((Ptr PipelineCreationFeedbackCreateInfo
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr (Ptr PipelineCreationFeedback)))
    forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Ptr PipelineCreationFeedback
-> Word32
-> Ptr PipelineCreationFeedback
-> PipelineCreationFeedbackCreateInfo
PipelineCreationFeedbackCreateInfo
             Ptr PipelineCreationFeedback
pPipelineCreationFeedback
             Word32
pipelineStageCreationFeedbackCount
             Ptr PipelineCreationFeedback
pPipelineStageCreationFeedbacks

instance Storable PipelineCreationFeedbackCreateInfo where
  sizeOf :: PipelineCreationFeedbackCreateInfo -> Int
sizeOf ~PipelineCreationFeedbackCreateInfo
_ = Int
40
  alignment :: PipelineCreationFeedbackCreateInfo -> Int
alignment ~PipelineCreationFeedbackCreateInfo
_ = Int
8
  peek :: Ptr PipelineCreationFeedbackCreateInfo
-> IO PipelineCreationFeedbackCreateInfo
peek = forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
  poke :: Ptr PipelineCreationFeedbackCreateInfo
-> PipelineCreationFeedbackCreateInfo -> IO ()
poke Ptr PipelineCreationFeedbackCreateInfo
ptr PipelineCreationFeedbackCreateInfo
poked = forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PipelineCreationFeedbackCreateInfo
ptr PipelineCreationFeedbackCreateInfo
poked (forall (f :: * -> *) a. Applicative f => a -> f a
pure ())

instance Zero PipelineCreationFeedbackCreateInfo where
  zero :: PipelineCreationFeedbackCreateInfo
zero = Ptr PipelineCreationFeedback
-> Word32
-> Ptr PipelineCreationFeedback
-> PipelineCreationFeedbackCreateInfo
PipelineCreationFeedbackCreateInfo
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero