{-# language CPP #-}
module Vulkan.Extensions.VK_NV_fragment_shader_barycentric  ( PhysicalDeviceFragmentShaderBarycentricFeaturesNV(..)
                                                            , NV_FRAGMENT_SHADER_BARYCENTRIC_SPEC_VERSION
                                                            , pattern NV_FRAGMENT_SHADER_BARYCENTRIC_SPEC_VERSION
                                                            , NV_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME
                                                            , pattern NV_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME
                                                            ) where

import Foreign.Marshal.Alloc (allocaBytesAligned)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
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 Foreign.Ptr (Ptr)
import Data.Kind (Type)
import Vulkan.Core10.BaseType (bool32ToBool)
import Vulkan.Core10.BaseType (boolToBool32)
import Vulkan.Core10.BaseType (Bool32)
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
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_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_FEATURES_NV))
-- | VkPhysicalDeviceFragmentShaderBarycentricFeaturesNV - Structure
-- describing barycentric support in fragment shaders that can be supported
-- by an implementation
--
-- = Members
--
-- The members of the 'PhysicalDeviceFragmentShaderBarycentricFeaturesNV'
-- structure describe the following features:
--
-- = Description
--
-- See
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#primsrast-barycentric Barycentric Interpolation>
-- for more information.
--
-- If the 'PhysicalDeviceFragmentShaderBarycentricFeaturesNV' structure is
-- included in the @pNext@ chain of
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceFeatures2',
-- it is filled with values indicating whether the feature is supported.
-- 'PhysicalDeviceFragmentShaderBarycentricFeaturesNV' /can/ also be
-- included in the @pNext@ chain of 'Vulkan.Core10.Device.DeviceCreateInfo'
-- to enable features.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- 'Vulkan.Core10.BaseType.Bool32',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PhysicalDeviceFragmentShaderBarycentricFeaturesNV = PhysicalDeviceFragmentShaderBarycentricFeaturesNV
  { -- | @fragmentShaderBarycentric@ indicates that the implementation supports
    -- the @BaryCoordNV@ and @BaryCoordNoPerspNV@ SPIR-V fragment shader
    -- built-ins and supports the @PerVertexNV@ SPIR-V decoration on fragment
    -- shader input variables.
    PhysicalDeviceFragmentShaderBarycentricFeaturesNV -> Bool
fragmentShaderBarycentric :: Bool }
  deriving (Typeable)
deriving instance Show PhysicalDeviceFragmentShaderBarycentricFeaturesNV

instance ToCStruct PhysicalDeviceFragmentShaderBarycentricFeaturesNV where
  withCStruct :: PhysicalDeviceFragmentShaderBarycentricFeaturesNV
-> (Ptr PhysicalDeviceFragmentShaderBarycentricFeaturesNV -> IO b)
-> IO b
withCStruct x :: PhysicalDeviceFragmentShaderBarycentricFeaturesNV
x f :: Ptr PhysicalDeviceFragmentShaderBarycentricFeaturesNV -> IO b
f = Int
-> Int
-> (Ptr PhysicalDeviceFragmentShaderBarycentricFeaturesNV -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 24 8 ((Ptr PhysicalDeviceFragmentShaderBarycentricFeaturesNV -> IO b)
 -> IO b)
-> (Ptr PhysicalDeviceFragmentShaderBarycentricFeaturesNV -> IO b)
-> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr PhysicalDeviceFragmentShaderBarycentricFeaturesNV
p -> Ptr PhysicalDeviceFragmentShaderBarycentricFeaturesNV
-> PhysicalDeviceFragmentShaderBarycentricFeaturesNV
-> IO b
-> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceFragmentShaderBarycentricFeaturesNV
p PhysicalDeviceFragmentShaderBarycentricFeaturesNV
x (Ptr PhysicalDeviceFragmentShaderBarycentricFeaturesNV -> IO b
f Ptr PhysicalDeviceFragmentShaderBarycentricFeaturesNV
p)
  pokeCStruct :: Ptr PhysicalDeviceFragmentShaderBarycentricFeaturesNV
-> PhysicalDeviceFragmentShaderBarycentricFeaturesNV
-> IO b
-> IO b
pokeCStruct p :: Ptr PhysicalDeviceFragmentShaderBarycentricFeaturesNV
p PhysicalDeviceFragmentShaderBarycentricFeaturesNV{..} f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceFragmentShaderBarycentricFeaturesNV
p Ptr PhysicalDeviceFragmentShaderBarycentricFeaturesNV
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_FEATURES_NV)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceFragmentShaderBarycentricFeaturesNV
p Ptr PhysicalDeviceFragmentShaderBarycentricFeaturesNV
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceFragmentShaderBarycentricFeaturesNV
p Ptr PhysicalDeviceFragmentShaderBarycentricFeaturesNV
-> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
fragmentShaderBarycentric))
    IO b
f
  cStructSize :: Int
cStructSize = 24
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr PhysicalDeviceFragmentShaderBarycentricFeaturesNV
-> IO b -> IO b
pokeZeroCStruct p :: Ptr PhysicalDeviceFragmentShaderBarycentricFeaturesNV
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceFragmentShaderBarycentricFeaturesNV
p Ptr PhysicalDeviceFragmentShaderBarycentricFeaturesNV
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_FEATURES_NV)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceFragmentShaderBarycentricFeaturesNV
p Ptr PhysicalDeviceFragmentShaderBarycentricFeaturesNV
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceFragmentShaderBarycentricFeaturesNV
p Ptr PhysicalDeviceFragmentShaderBarycentricFeaturesNV
-> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
forall a. Zero a => a
zero))
    IO b
f

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

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

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


type NV_FRAGMENT_SHADER_BARYCENTRIC_SPEC_VERSION = 1

-- No documentation found for TopLevel "VK_NV_FRAGMENT_SHADER_BARYCENTRIC_SPEC_VERSION"
pattern NV_FRAGMENT_SHADER_BARYCENTRIC_SPEC_VERSION :: forall a . Integral a => a
pattern $bNV_FRAGMENT_SHADER_BARYCENTRIC_SPEC_VERSION :: a
$mNV_FRAGMENT_SHADER_BARYCENTRIC_SPEC_VERSION :: forall r a. Integral a => a -> (Void# -> r) -> (Void# -> r) -> r
NV_FRAGMENT_SHADER_BARYCENTRIC_SPEC_VERSION = 1


type NV_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME = "VK_NV_fragment_shader_barycentric"

-- No documentation found for TopLevel "VK_NV_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME"
pattern NV_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bNV_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME :: a
$mNV_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME :: forall r a.
(Eq a, IsString a) =>
a -> (Void# -> r) -> (Void# -> r) -> r
NV_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME = "VK_NV_fragment_shader_barycentric"