{-# language CPP #-}
module Graphics.Vulkan.Extensions.VK_EXT_conservative_rasterization ( PhysicalDeviceConservativeRasterizationPropertiesEXT(..)
, PipelineRasterizationConservativeStateCreateInfoEXT(..)
, PipelineRasterizationConservativeStateCreateFlagsEXT(..)
, ConservativeRasterizationModeEXT( CONSERVATIVE_RASTERIZATION_MODE_DISABLED_EXT
, CONSERVATIVE_RASTERIZATION_MODE_OVERESTIMATE_EXT
, CONSERVATIVE_RASTERIZATION_MODE_UNDERESTIMATE_EXT
, ..
)
, EXT_CONSERVATIVE_RASTERIZATION_SPEC_VERSION
, pattern EXT_CONSERVATIVE_RASTERIZATION_SPEC_VERSION
, EXT_CONSERVATIVE_RASTERIZATION_EXTENSION_NAME
, pattern EXT_CONSERVATIVE_RASTERIZATION_EXTENSION_NAME
) where
import Foreign.Marshal.Alloc (allocaBytesAligned)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import GHC.Read (choose)
import GHC.Read (expectP)
import GHC.Read (parens)
import GHC.Show (showParen)
import GHC.Show (showString)
import GHC.Show (showsPrec)
import Numeric (showHex)
import Text.ParserCombinators.ReadPrec ((+++))
import Text.ParserCombinators.ReadPrec (prec)
import Text.ParserCombinators.ReadPrec (step)
import Data.Bits (Bits)
import Data.String (IsString)
import Data.Typeable (Typeable)
import Foreign.C.Types (CFloat)
import Foreign.C.Types (CFloat(CFloat))
import Foreign.Storable (Storable)
import Foreign.Storable (Storable(peek))
import Foreign.Storable (Storable(poke))
import qualified Foreign.Storable (Storable(..))
import Data.Int (Int32)
import Foreign.Ptr (Ptr)
import GHC.Read (Read(readPrec))
import Text.Read.Lex (Lexeme(Ident))
import Data.Kind (Type)
import Graphics.Vulkan.Core10.BaseType (bool32ToBool)
import Graphics.Vulkan.Core10.BaseType (boolToBool32)
import Graphics.Vulkan.Core10.BaseType (Bool32)
import Graphics.Vulkan.Core10.BaseType (Flags)
import Graphics.Vulkan.CStruct (FromCStruct)
import Graphics.Vulkan.CStruct (FromCStruct(..))
import Graphics.Vulkan.Core10.Enums.StructureType (StructureType)
import Graphics.Vulkan.CStruct (ToCStruct)
import Graphics.Vulkan.CStruct (ToCStruct(..))
import Graphics.Vulkan.Zero (Zero)
import Graphics.Vulkan.Zero (Zero(..))
import Graphics.Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_CONSERVATIVE_RASTERIZATION_PROPERTIES_EXT))
import Graphics.Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PIPELINE_RASTERIZATION_CONSERVATIVE_STATE_CREATE_INFO_EXT))
data PhysicalDeviceConservativeRasterizationPropertiesEXT = PhysicalDeviceConservativeRasterizationPropertiesEXT
{
primitiveOverestimationSize :: Float
,
maxExtraPrimitiveOverestimationSize :: Float
,
extraPrimitiveOverestimationSizeGranularity :: Float
,
primitiveUnderestimation :: Bool
,
conservativePointAndLineRasterization :: Bool
,
degenerateTrianglesRasterized :: Bool
,
degenerateLinesRasterized :: Bool
,
fullyCoveredFragmentShaderInputVariable :: Bool
,
conservativeRasterizationPostDepthCoverage :: Bool
}
deriving (Typeable)
deriving instance Show PhysicalDeviceConservativeRasterizationPropertiesEXT
instance ToCStruct PhysicalDeviceConservativeRasterizationPropertiesEXT where
withCStruct x f = allocaBytesAligned 56 8 $ \p -> pokeCStruct p x (f p)
pokeCStruct p PhysicalDeviceConservativeRasterizationPropertiesEXT{..} f = do
poke ((p `plusPtr` 0 :: Ptr StructureType)) (STRUCTURE_TYPE_PHYSICAL_DEVICE_CONSERVATIVE_RASTERIZATION_PROPERTIES_EXT)
poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) (nullPtr)
poke ((p `plusPtr` 16 :: Ptr CFloat)) (CFloat (primitiveOverestimationSize))
poke ((p `plusPtr` 20 :: Ptr CFloat)) (CFloat (maxExtraPrimitiveOverestimationSize))
poke ((p `plusPtr` 24 :: Ptr CFloat)) (CFloat (extraPrimitiveOverestimationSizeGranularity))
poke ((p `plusPtr` 28 :: Ptr Bool32)) (boolToBool32 (primitiveUnderestimation))
poke ((p `plusPtr` 32 :: Ptr Bool32)) (boolToBool32 (conservativePointAndLineRasterization))
poke ((p `plusPtr` 36 :: Ptr Bool32)) (boolToBool32 (degenerateTrianglesRasterized))
poke ((p `plusPtr` 40 :: Ptr Bool32)) (boolToBool32 (degenerateLinesRasterized))
poke ((p `plusPtr` 44 :: Ptr Bool32)) (boolToBool32 (fullyCoveredFragmentShaderInputVariable))
poke ((p `plusPtr` 48 :: Ptr Bool32)) (boolToBool32 (conservativeRasterizationPostDepthCoverage))
f
cStructSize = 56
cStructAlignment = 8
pokeZeroCStruct p f = do
poke ((p `plusPtr` 0 :: Ptr StructureType)) (STRUCTURE_TYPE_PHYSICAL_DEVICE_CONSERVATIVE_RASTERIZATION_PROPERTIES_EXT)
poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) (nullPtr)
poke ((p `plusPtr` 16 :: Ptr CFloat)) (CFloat (zero))
poke ((p `plusPtr` 20 :: Ptr CFloat)) (CFloat (zero))
poke ((p `plusPtr` 24 :: Ptr CFloat)) (CFloat (zero))
poke ((p `plusPtr` 28 :: Ptr Bool32)) (boolToBool32 (zero))
poke ((p `plusPtr` 32 :: Ptr Bool32)) (boolToBool32 (zero))
poke ((p `plusPtr` 36 :: Ptr Bool32)) (boolToBool32 (zero))
poke ((p `plusPtr` 40 :: Ptr Bool32)) (boolToBool32 (zero))
poke ((p `plusPtr` 44 :: Ptr Bool32)) (boolToBool32 (zero))
poke ((p `plusPtr` 48 :: Ptr Bool32)) (boolToBool32 (zero))
f
instance FromCStruct PhysicalDeviceConservativeRasterizationPropertiesEXT where
peekCStruct p = do
primitiveOverestimationSize <- peek @CFloat ((p `plusPtr` 16 :: Ptr CFloat))
maxExtraPrimitiveOverestimationSize <- peek @CFloat ((p `plusPtr` 20 :: Ptr CFloat))
extraPrimitiveOverestimationSizeGranularity <- peek @CFloat ((p `plusPtr` 24 :: Ptr CFloat))
primitiveUnderestimation <- peek @Bool32 ((p `plusPtr` 28 :: Ptr Bool32))
conservativePointAndLineRasterization <- peek @Bool32 ((p `plusPtr` 32 :: Ptr Bool32))
degenerateTrianglesRasterized <- peek @Bool32 ((p `plusPtr` 36 :: Ptr Bool32))
degenerateLinesRasterized <- peek @Bool32 ((p `plusPtr` 40 :: Ptr Bool32))
fullyCoveredFragmentShaderInputVariable <- peek @Bool32 ((p `plusPtr` 44 :: Ptr Bool32))
conservativeRasterizationPostDepthCoverage <- peek @Bool32 ((p `plusPtr` 48 :: Ptr Bool32))
pure $ PhysicalDeviceConservativeRasterizationPropertiesEXT
((\(CFloat a) -> a) primitiveOverestimationSize) ((\(CFloat a) -> a) maxExtraPrimitiveOverestimationSize) ((\(CFloat a) -> a) extraPrimitiveOverestimationSizeGranularity) (bool32ToBool primitiveUnderestimation) (bool32ToBool conservativePointAndLineRasterization) (bool32ToBool degenerateTrianglesRasterized) (bool32ToBool degenerateLinesRasterized) (bool32ToBool fullyCoveredFragmentShaderInputVariable) (bool32ToBool conservativeRasterizationPostDepthCoverage)
instance Storable PhysicalDeviceConservativeRasterizationPropertiesEXT where
sizeOf ~_ = 56
alignment ~_ = 8
peek = peekCStruct
poke ptr poked = pokeCStruct ptr poked (pure ())
instance Zero PhysicalDeviceConservativeRasterizationPropertiesEXT where
zero = PhysicalDeviceConservativeRasterizationPropertiesEXT
zero
zero
zero
zero
zero
zero
zero
zero
zero
data PipelineRasterizationConservativeStateCreateInfoEXT = PipelineRasterizationConservativeStateCreateInfoEXT
{
flags :: PipelineRasterizationConservativeStateCreateFlagsEXT
,
conservativeRasterizationMode :: ConservativeRasterizationModeEXT
,
extraPrimitiveOverestimationSize :: Float
}
deriving (Typeable)
deriving instance Show PipelineRasterizationConservativeStateCreateInfoEXT
instance ToCStruct PipelineRasterizationConservativeStateCreateInfoEXT where
withCStruct x f = allocaBytesAligned 32 8 $ \p -> pokeCStruct p x (f p)
pokeCStruct p PipelineRasterizationConservativeStateCreateInfoEXT{..} f = do
poke ((p `plusPtr` 0 :: Ptr StructureType)) (STRUCTURE_TYPE_PIPELINE_RASTERIZATION_CONSERVATIVE_STATE_CREATE_INFO_EXT)
poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) (nullPtr)
poke ((p `plusPtr` 16 :: Ptr PipelineRasterizationConservativeStateCreateFlagsEXT)) (flags)
poke ((p `plusPtr` 20 :: Ptr ConservativeRasterizationModeEXT)) (conservativeRasterizationMode)
poke ((p `plusPtr` 24 :: Ptr CFloat)) (CFloat (extraPrimitiveOverestimationSize))
f
cStructSize = 32
cStructAlignment = 8
pokeZeroCStruct p f = do
poke ((p `plusPtr` 0 :: Ptr StructureType)) (STRUCTURE_TYPE_PIPELINE_RASTERIZATION_CONSERVATIVE_STATE_CREATE_INFO_EXT)
poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) (nullPtr)
poke ((p `plusPtr` 20 :: Ptr ConservativeRasterizationModeEXT)) (zero)
poke ((p `plusPtr` 24 :: Ptr CFloat)) (CFloat (zero))
f
instance FromCStruct PipelineRasterizationConservativeStateCreateInfoEXT where
peekCStruct p = do
flags <- peek @PipelineRasterizationConservativeStateCreateFlagsEXT ((p `plusPtr` 16 :: Ptr PipelineRasterizationConservativeStateCreateFlagsEXT))
conservativeRasterizationMode <- peek @ConservativeRasterizationModeEXT ((p `plusPtr` 20 :: Ptr ConservativeRasterizationModeEXT))
extraPrimitiveOverestimationSize <- peek @CFloat ((p `plusPtr` 24 :: Ptr CFloat))
pure $ PipelineRasterizationConservativeStateCreateInfoEXT
flags conservativeRasterizationMode ((\(CFloat a) -> a) extraPrimitiveOverestimationSize)
instance Storable PipelineRasterizationConservativeStateCreateInfoEXT where
sizeOf ~_ = 32
alignment ~_ = 8
peek = peekCStruct
poke ptr poked = pokeCStruct ptr poked (pure ())
instance Zero PipelineRasterizationConservativeStateCreateInfoEXT where
zero = PipelineRasterizationConservativeStateCreateInfoEXT
zero
zero
zero
newtype PipelineRasterizationConservativeStateCreateFlagsEXT = PipelineRasterizationConservativeStateCreateFlagsEXT Flags
deriving newtype (Eq, Ord, Storable, Zero, Bits)
instance Show PipelineRasterizationConservativeStateCreateFlagsEXT where
showsPrec p = \case
PipelineRasterizationConservativeStateCreateFlagsEXT x -> showParen (p >= 11) (showString "PipelineRasterizationConservativeStateCreateFlagsEXT 0x" . showHex x)
instance Read PipelineRasterizationConservativeStateCreateFlagsEXT where
readPrec = parens (choose []
+++
prec 10 (do
expectP (Ident "PipelineRasterizationConservativeStateCreateFlagsEXT")
v <- step readPrec
pure (PipelineRasterizationConservativeStateCreateFlagsEXT v)))
newtype ConservativeRasterizationModeEXT = ConservativeRasterizationModeEXT Int32
deriving newtype (Eq, Ord, Storable, Zero)
pattern CONSERVATIVE_RASTERIZATION_MODE_DISABLED_EXT = ConservativeRasterizationModeEXT 0
pattern CONSERVATIVE_RASTERIZATION_MODE_OVERESTIMATE_EXT = ConservativeRasterizationModeEXT 1
pattern CONSERVATIVE_RASTERIZATION_MODE_UNDERESTIMATE_EXT = ConservativeRasterizationModeEXT 2
{-# complete CONSERVATIVE_RASTERIZATION_MODE_DISABLED_EXT,
CONSERVATIVE_RASTERIZATION_MODE_OVERESTIMATE_EXT,
CONSERVATIVE_RASTERIZATION_MODE_UNDERESTIMATE_EXT :: ConservativeRasterizationModeEXT #-}
instance Show ConservativeRasterizationModeEXT where
showsPrec p = \case
CONSERVATIVE_RASTERIZATION_MODE_DISABLED_EXT -> showString "CONSERVATIVE_RASTERIZATION_MODE_DISABLED_EXT"
CONSERVATIVE_RASTERIZATION_MODE_OVERESTIMATE_EXT -> showString "CONSERVATIVE_RASTERIZATION_MODE_OVERESTIMATE_EXT"
CONSERVATIVE_RASTERIZATION_MODE_UNDERESTIMATE_EXT -> showString "CONSERVATIVE_RASTERIZATION_MODE_UNDERESTIMATE_EXT"
ConservativeRasterizationModeEXT x -> showParen (p >= 11) (showString "ConservativeRasterizationModeEXT " . showsPrec 11 x)
instance Read ConservativeRasterizationModeEXT where
readPrec = parens (choose [("CONSERVATIVE_RASTERIZATION_MODE_DISABLED_EXT", pure CONSERVATIVE_RASTERIZATION_MODE_DISABLED_EXT)
, ("CONSERVATIVE_RASTERIZATION_MODE_OVERESTIMATE_EXT", pure CONSERVATIVE_RASTERIZATION_MODE_OVERESTIMATE_EXT)
, ("CONSERVATIVE_RASTERIZATION_MODE_UNDERESTIMATE_EXT", pure CONSERVATIVE_RASTERIZATION_MODE_UNDERESTIMATE_EXT)]
+++
prec 10 (do
expectP (Ident "ConservativeRasterizationModeEXT")
v <- step readPrec
pure (ConservativeRasterizationModeEXT v)))
type EXT_CONSERVATIVE_RASTERIZATION_SPEC_VERSION = 1
pattern EXT_CONSERVATIVE_RASTERIZATION_SPEC_VERSION :: forall a . Integral a => a
pattern EXT_CONSERVATIVE_RASTERIZATION_SPEC_VERSION = 1
type EXT_CONSERVATIVE_RASTERIZATION_EXTENSION_NAME = "VK_EXT_conservative_rasterization"
pattern EXT_CONSERVATIVE_RASTERIZATION_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern EXT_CONSERVATIVE_RASTERIZATION_EXTENSION_NAME = "VK_EXT_conservative_rasterization"