{-# language CPP #-}
-- | = Name
--
-- VK_EXT_fragment_shader_interlock - device extension
--
-- == VK_EXT_fragment_shader_interlock
--
-- [__Name String__]
--     @VK_EXT_fragment_shader_interlock@
--
-- [__Extension Type__]
--     Device extension
--
-- [__Registered Extension Number__]
--     252
--
-- [__Revision__]
--     1
--
-- [__Ratification Status__]
--     Not ratified
--
-- [__Extension and Version Dependencies__]
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_get_physical_device_properties2 VK_KHR_get_physical_device_properties2>
--     or
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#versions-1.1 Version 1.1>
--
-- [__Contact__]
--
--     -   Piers Daniell
--         <https://github.com/KhronosGroup/Vulkan-Docs/issues/new?body=[VK_EXT_fragment_shader_interlock] @pdaniell-nv%0A*Here describe the issue or question you have about the VK_EXT_fragment_shader_interlock extension* >
--
-- == Other Extension Metadata
--
-- [__Last Modified Date__]
--     2019-05-02
--
-- [__Interactions and External Dependencies__]
--
--     -   This extension requires
--         <https://htmlpreview.github.io/?https://github.com/KhronosGroup/SPIRV-Registry/blob/master/extensions/EXT/SPV_EXT_fragment_shader_interlock.html SPV_EXT_fragment_shader_interlock>
--
--     -   This extension provides API support for
--         <https://registry.khronos.org/OpenGL/extensions/ARB/ARB_fragment_shader_interlock.txt GL_ARB_fragment_shader_interlock>
--
-- [__Contributors__]
--
--     -   Daniel Koch, NVIDIA
--
--     -   Graeme Leese, Broadcom
--
--     -   Jan-Harald Fredriksen, Arm
--
--     -   Faith Ekstrand, Intel
--
--     -   Jeff Bolz, NVIDIA
--
--     -   Ruihao Zhang, Qualcomm
--
--     -   Slawomir Grajewski, Intel
--
--     -   Spencer Fricke, Samsung
--
-- == Description
--
-- This extension adds support for the @FragmentShaderPixelInterlockEXT@,
-- @FragmentShaderSampleInterlockEXT@, and
-- @FragmentShaderShadingRateInterlockEXT@ capabilities from the
-- @SPV_EXT_fragment_shader_interlock@ extension to Vulkan.
--
-- Enabling these capabilities provides a critical section for fragment
-- shaders to avoid overlapping pixels being processed at the same time,
-- and certain guarantees about the ordering of fragment shader invocations
-- of fragments of overlapping pixels.
--
-- This extension can be useful for algorithms that need to access
-- per-pixel data structures via shader loads and stores. Algorithms using
-- this extension can access per-pixel data structures in critical sections
-- without other invocations accessing the same per-pixel data.
-- Additionally, the ordering guarantees are useful for cases where the API
-- ordering of fragments is meaningful. For example, applications may be
-- able to execute programmable blending operations in the fragment shader,
-- where the destination buffer is read via image loads and the final value
-- is written via image stores.
--
-- == New Structures
--
-- -   Extending
--     'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceFeatures2',
--     'Vulkan.Core10.Device.DeviceCreateInfo':
--
--     -   'PhysicalDeviceFragmentShaderInterlockFeaturesEXT'
--
-- == New Enum Constants
--
-- -   'EXT_FRAGMENT_SHADER_INTERLOCK_EXTENSION_NAME'
--
-- -   'EXT_FRAGMENT_SHADER_INTERLOCK_SPEC_VERSION'
--
-- -   Extending 'Vulkan.Core10.Enums.StructureType.StructureType':
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_INTERLOCK_FEATURES_EXT'
--
-- == New SPIR-V Capabilities
--
-- -   <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#spirvenv-capabilities-table-FragmentShaderSampleInterlockEXT FragmentShaderInterlockEXT>
--
-- -   <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#spirvenv-capabilities-table-FragmentShaderPixelInterlockEXT FragmentShaderPixelInterlockEXT>
--
-- -   <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#spirvenv-capabilities-table-FragmentShaderShadingRateInterlockEXT FragmentShaderShadingRateInterlockEXT>
--
-- == Version History
--
-- -   Revision 1, 2019-05-24 (Piers Daniell)
--
--     -   Internal revisions
--
-- == See Also
--
-- 'PhysicalDeviceFragmentShaderInterlockFeaturesEXT'
--
-- == Document Notes
--
-- For more information, see the
-- <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VK_EXT_fragment_shader_interlock Vulkan Specification>
--
-- This page is a generated document. Fixes and changes should be made to
-- the generator scripts, not directly.
module Vulkan.Extensions.VK_EXT_fragment_shader_interlock  ( PhysicalDeviceFragmentShaderInterlockFeaturesEXT(..)
                                                           , EXT_FRAGMENT_SHADER_INTERLOCK_SPEC_VERSION
                                                           , pattern EXT_FRAGMENT_SHADER_INTERLOCK_SPEC_VERSION
                                                           , EXT_FRAGMENT_SHADER_INTERLOCK_EXTENSION_NAME
                                                           , pattern EXT_FRAGMENT_SHADER_INTERLOCK_EXTENSION_NAME
                                                           ) 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.String (IsString)
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.Core10.FundamentalTypes (bool32ToBool)
import Vulkan.Core10.FundamentalTypes (boolToBool32)
import Vulkan.Core10.FundamentalTypes (Bool32)
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_INTERLOCK_FEATURES_EXT))
-- | VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT - Structure
-- describing fragment shader interlock features that can be supported by
-- an implementation
--
-- = Members
--
-- This structure describes the following features:
--
-- = Description
--
-- If the 'PhysicalDeviceFragmentShaderInterlockFeaturesEXT' structure is
-- included in the @pNext@ chain of the
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceFeatures2'
-- structure passed to
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.getPhysicalDeviceFeatures2',
-- it is filled in to indicate whether each corresponding feature is
-- supported. 'PhysicalDeviceFragmentShaderInterlockFeaturesEXT' /can/ also
-- be used in the @pNext@ chain of 'Vulkan.Core10.Device.DeviceCreateInfo'
-- to selectively enable these features.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_fragment_shader_interlock VK_EXT_fragment_shader_interlock>,
-- 'Vulkan.Core10.FundamentalTypes.Bool32',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PhysicalDeviceFragmentShaderInterlockFeaturesEXT = PhysicalDeviceFragmentShaderInterlockFeaturesEXT
  { -- | #features-fragmentShaderSampleInterlock# @fragmentShaderSampleInterlock@
    -- indicates that the implementation supports the
    -- @FragmentShaderSampleInterlockEXT@ SPIR-V capability.
    PhysicalDeviceFragmentShaderInterlockFeaturesEXT -> Bool
fragmentShaderSampleInterlock :: Bool
  , -- | #features-fragmentShaderPixelInterlock# @fragmentShaderPixelInterlock@
    -- indicates that the implementation supports the
    -- @FragmentShaderPixelInterlockEXT@ SPIR-V capability.
    PhysicalDeviceFragmentShaderInterlockFeaturesEXT -> Bool
fragmentShaderPixelInterlock :: Bool
  , -- | #features-fragmentShaderShadingRateInterlock#
    -- @fragmentShaderShadingRateInterlock@ indicates that the implementation
    -- supports the @FragmentShaderShadingRateInterlockEXT@ SPIR-V capability.
    PhysicalDeviceFragmentShaderInterlockFeaturesEXT -> Bool
fragmentShaderShadingRateInterlock :: Bool
  }
  deriving (Typeable, PhysicalDeviceFragmentShaderInterlockFeaturesEXT
-> PhysicalDeviceFragmentShaderInterlockFeaturesEXT -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhysicalDeviceFragmentShaderInterlockFeaturesEXT
-> PhysicalDeviceFragmentShaderInterlockFeaturesEXT -> Bool
$c/= :: PhysicalDeviceFragmentShaderInterlockFeaturesEXT
-> PhysicalDeviceFragmentShaderInterlockFeaturesEXT -> Bool
== :: PhysicalDeviceFragmentShaderInterlockFeaturesEXT
-> PhysicalDeviceFragmentShaderInterlockFeaturesEXT -> Bool
$c== :: PhysicalDeviceFragmentShaderInterlockFeaturesEXT
-> PhysicalDeviceFragmentShaderInterlockFeaturesEXT -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceFragmentShaderInterlockFeaturesEXT)
#endif
deriving instance Show PhysicalDeviceFragmentShaderInterlockFeaturesEXT

instance ToCStruct PhysicalDeviceFragmentShaderInterlockFeaturesEXT where
  withCStruct :: forall b.
PhysicalDeviceFragmentShaderInterlockFeaturesEXT
-> (Ptr PhysicalDeviceFragmentShaderInterlockFeaturesEXT -> IO b)
-> IO b
withCStruct PhysicalDeviceFragmentShaderInterlockFeaturesEXT
x Ptr PhysicalDeviceFragmentShaderInterlockFeaturesEXT -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
32 forall a b. (a -> b) -> a -> b
$ \Ptr PhysicalDeviceFragmentShaderInterlockFeaturesEXT
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceFragmentShaderInterlockFeaturesEXT
p PhysicalDeviceFragmentShaderInterlockFeaturesEXT
x (Ptr PhysicalDeviceFragmentShaderInterlockFeaturesEXT -> IO b
f Ptr PhysicalDeviceFragmentShaderInterlockFeaturesEXT
p)
  pokeCStruct :: forall b.
Ptr PhysicalDeviceFragmentShaderInterlockFeaturesEXT
-> PhysicalDeviceFragmentShaderInterlockFeaturesEXT -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceFragmentShaderInterlockFeaturesEXT
p PhysicalDeviceFragmentShaderInterlockFeaturesEXT{Bool
fragmentShaderShadingRateInterlock :: Bool
fragmentShaderPixelInterlock :: Bool
fragmentShaderSampleInterlock :: Bool
$sel:fragmentShaderShadingRateInterlock:PhysicalDeviceFragmentShaderInterlockFeaturesEXT :: PhysicalDeviceFragmentShaderInterlockFeaturesEXT -> Bool
$sel:fragmentShaderPixelInterlock:PhysicalDeviceFragmentShaderInterlockFeaturesEXT :: PhysicalDeviceFragmentShaderInterlockFeaturesEXT -> Bool
$sel:fragmentShaderSampleInterlock:PhysicalDeviceFragmentShaderInterlockFeaturesEXT :: PhysicalDeviceFragmentShaderInterlockFeaturesEXT -> Bool
..} IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceFragmentShaderInterlockFeaturesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_INTERLOCK_FEATURES_EXT)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceFragmentShaderInterlockFeaturesEXT
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 PhysicalDeviceFragmentShaderInterlockFeaturesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
fragmentShaderSampleInterlock))
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceFragmentShaderInterlockFeaturesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
fragmentShaderPixelInterlock))
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceFragmentShaderInterlockFeaturesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
fragmentShaderShadingRateInterlock))
    IO b
f
  cStructSize :: Int
cStructSize = Int
32
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b.
Ptr PhysicalDeviceFragmentShaderInterlockFeaturesEXT
-> IO b -> IO b
pokeZeroCStruct Ptr PhysicalDeviceFragmentShaderInterlockFeaturesEXT
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceFragmentShaderInterlockFeaturesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_INTERLOCK_FEATURES_EXT)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceFragmentShaderInterlockFeaturesEXT
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 PhysicalDeviceFragmentShaderInterlockFeaturesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (forall a. Zero a => a
zero))
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceFragmentShaderInterlockFeaturesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (forall a. Zero a => a
zero))
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceFragmentShaderInterlockFeaturesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (forall a. Zero a => a
zero))
    IO b
f

instance FromCStruct PhysicalDeviceFragmentShaderInterlockFeaturesEXT where
  peekCStruct :: Ptr PhysicalDeviceFragmentShaderInterlockFeaturesEXT
-> IO PhysicalDeviceFragmentShaderInterlockFeaturesEXT
peekCStruct Ptr PhysicalDeviceFragmentShaderInterlockFeaturesEXT
p = do
    Bool32
fragmentShaderSampleInterlock <- forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PhysicalDeviceFragmentShaderInterlockFeaturesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32))
    Bool32
fragmentShaderPixelInterlock <- forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PhysicalDeviceFragmentShaderInterlockFeaturesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Bool32))
    Bool32
fragmentShaderShadingRateInterlock <- forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PhysicalDeviceFragmentShaderInterlockFeaturesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Bool32))
    forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Bool
-> Bool -> Bool -> PhysicalDeviceFragmentShaderInterlockFeaturesEXT
PhysicalDeviceFragmentShaderInterlockFeaturesEXT
             (Bool32 -> Bool
bool32ToBool Bool32
fragmentShaderSampleInterlock)
             (Bool32 -> Bool
bool32ToBool Bool32
fragmentShaderPixelInterlock)
             (Bool32 -> Bool
bool32ToBool Bool32
fragmentShaderShadingRateInterlock)

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

instance Zero PhysicalDeviceFragmentShaderInterlockFeaturesEXT where
  zero :: PhysicalDeviceFragmentShaderInterlockFeaturesEXT
zero = Bool
-> Bool -> Bool -> PhysicalDeviceFragmentShaderInterlockFeaturesEXT
PhysicalDeviceFragmentShaderInterlockFeaturesEXT
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero


type EXT_FRAGMENT_SHADER_INTERLOCK_SPEC_VERSION = 1

-- No documentation found for TopLevel "VK_EXT_FRAGMENT_SHADER_INTERLOCK_SPEC_VERSION"
pattern EXT_FRAGMENT_SHADER_INTERLOCK_SPEC_VERSION :: forall a . Integral a => a
pattern $bEXT_FRAGMENT_SHADER_INTERLOCK_SPEC_VERSION :: forall a. Integral a => a
$mEXT_FRAGMENT_SHADER_INTERLOCK_SPEC_VERSION :: forall {r} {a}.
Integral a =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
EXT_FRAGMENT_SHADER_INTERLOCK_SPEC_VERSION = 1


type EXT_FRAGMENT_SHADER_INTERLOCK_EXTENSION_NAME = "VK_EXT_fragment_shader_interlock"

-- No documentation found for TopLevel "VK_EXT_FRAGMENT_SHADER_INTERLOCK_EXTENSION_NAME"
pattern EXT_FRAGMENT_SHADER_INTERLOCK_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bEXT_FRAGMENT_SHADER_INTERLOCK_EXTENSION_NAME :: forall a. (Eq a, IsString a) => a
$mEXT_FRAGMENT_SHADER_INTERLOCK_EXTENSION_NAME :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
EXT_FRAGMENT_SHADER_INTERLOCK_EXTENSION_NAME = "VK_EXT_fragment_shader_interlock"