{-# language CPP #-}
module Graphics.Vulkan.Extensions.VK_EXT_blend_operation_advanced ( PhysicalDeviceBlendOperationAdvancedFeaturesEXT(..)
, PhysicalDeviceBlendOperationAdvancedPropertiesEXT(..)
, PipelineColorBlendAdvancedStateCreateInfoEXT(..)
, BlendOverlapEXT( BLEND_OVERLAP_UNCORRELATED_EXT
, BLEND_OVERLAP_DISJOINT_EXT
, BLEND_OVERLAP_CONJOINT_EXT
, ..
)
, EXT_BLEND_OPERATION_ADVANCED_SPEC_VERSION
, pattern EXT_BLEND_OPERATION_ADVANCED_SPEC_VERSION
, EXT_BLEND_OPERATION_ADVANCED_EXTENSION_NAME
, pattern EXT_BLEND_OPERATION_ADVANCED_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 Text.ParserCombinators.ReadPrec ((+++))
import Text.ParserCombinators.ReadPrec (prec)
import Text.ParserCombinators.ReadPrec (step)
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 Data.Int (Int32)
import Foreign.Ptr (Ptr)
import GHC.Read (Read(readPrec))
import Data.Word (Word32)
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.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_BLEND_OPERATION_ADVANCED_FEATURES_EXT))
import Graphics.Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_PROPERTIES_EXT))
import Graphics.Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_ADVANCED_STATE_CREATE_INFO_EXT))
data PhysicalDeviceBlendOperationAdvancedFeaturesEXT = PhysicalDeviceBlendOperationAdvancedFeaturesEXT
{
advancedBlendCoherentOperations :: Bool }
deriving (Typeable)
deriving instance Show PhysicalDeviceBlendOperationAdvancedFeaturesEXT
instance ToCStruct PhysicalDeviceBlendOperationAdvancedFeaturesEXT where
withCStruct x f = allocaBytesAligned 24 8 $ \p -> pokeCStruct p x (f p)
pokeCStruct p PhysicalDeviceBlendOperationAdvancedFeaturesEXT{..} f = do
poke ((p `plusPtr` 0 :: Ptr StructureType)) (STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_FEATURES_EXT)
poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) (nullPtr)
poke ((p `plusPtr` 16 :: Ptr Bool32)) (boolToBool32 (advancedBlendCoherentOperations))
f
cStructSize = 24
cStructAlignment = 8
pokeZeroCStruct p f = do
poke ((p `plusPtr` 0 :: Ptr StructureType)) (STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_FEATURES_EXT)
poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) (nullPtr)
poke ((p `plusPtr` 16 :: Ptr Bool32)) (boolToBool32 (zero))
f
instance FromCStruct PhysicalDeviceBlendOperationAdvancedFeaturesEXT where
peekCStruct p = do
advancedBlendCoherentOperations <- peek @Bool32 ((p `plusPtr` 16 :: Ptr Bool32))
pure $ PhysicalDeviceBlendOperationAdvancedFeaturesEXT
(bool32ToBool advancedBlendCoherentOperations)
instance Storable PhysicalDeviceBlendOperationAdvancedFeaturesEXT where
sizeOf ~_ = 24
alignment ~_ = 8
peek = peekCStruct
poke ptr poked = pokeCStruct ptr poked (pure ())
instance Zero PhysicalDeviceBlendOperationAdvancedFeaturesEXT where
zero = PhysicalDeviceBlendOperationAdvancedFeaturesEXT
zero
data PhysicalDeviceBlendOperationAdvancedPropertiesEXT = PhysicalDeviceBlendOperationAdvancedPropertiesEXT
{
advancedBlendMaxColorAttachments :: Word32
,
advancedBlendIndependentBlend :: Bool
,
advancedBlendNonPremultipliedSrcColor :: Bool
,
advancedBlendNonPremultipliedDstColor :: Bool
,
advancedBlendCorrelatedOverlap :: Bool
,
advancedBlendAllOperations :: Bool
}
deriving (Typeable)
deriving instance Show PhysicalDeviceBlendOperationAdvancedPropertiesEXT
instance ToCStruct PhysicalDeviceBlendOperationAdvancedPropertiesEXT where
withCStruct x f = allocaBytesAligned 40 8 $ \p -> pokeCStruct p x (f p)
pokeCStruct p PhysicalDeviceBlendOperationAdvancedPropertiesEXT{..} f = do
poke ((p `plusPtr` 0 :: Ptr StructureType)) (STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_PROPERTIES_EXT)
poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) (nullPtr)
poke ((p `plusPtr` 16 :: Ptr Word32)) (advancedBlendMaxColorAttachments)
poke ((p `plusPtr` 20 :: Ptr Bool32)) (boolToBool32 (advancedBlendIndependentBlend))
poke ((p `plusPtr` 24 :: Ptr Bool32)) (boolToBool32 (advancedBlendNonPremultipliedSrcColor))
poke ((p `plusPtr` 28 :: Ptr Bool32)) (boolToBool32 (advancedBlendNonPremultipliedDstColor))
poke ((p `plusPtr` 32 :: Ptr Bool32)) (boolToBool32 (advancedBlendCorrelatedOverlap))
poke ((p `plusPtr` 36 :: Ptr Bool32)) (boolToBool32 (advancedBlendAllOperations))
f
cStructSize = 40
cStructAlignment = 8
pokeZeroCStruct p f = do
poke ((p `plusPtr` 0 :: Ptr StructureType)) (STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_PROPERTIES_EXT)
poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) (nullPtr)
poke ((p `plusPtr` 16 :: Ptr Word32)) (zero)
poke ((p `plusPtr` 20 :: Ptr Bool32)) (boolToBool32 (zero))
poke ((p `plusPtr` 24 :: Ptr Bool32)) (boolToBool32 (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))
f
instance FromCStruct PhysicalDeviceBlendOperationAdvancedPropertiesEXT where
peekCStruct p = do
advancedBlendMaxColorAttachments <- peek @Word32 ((p `plusPtr` 16 :: Ptr Word32))
advancedBlendIndependentBlend <- peek @Bool32 ((p `plusPtr` 20 :: Ptr Bool32))
advancedBlendNonPremultipliedSrcColor <- peek @Bool32 ((p `plusPtr` 24 :: Ptr Bool32))
advancedBlendNonPremultipliedDstColor <- peek @Bool32 ((p `plusPtr` 28 :: Ptr Bool32))
advancedBlendCorrelatedOverlap <- peek @Bool32 ((p `plusPtr` 32 :: Ptr Bool32))
advancedBlendAllOperations <- peek @Bool32 ((p `plusPtr` 36 :: Ptr Bool32))
pure $ PhysicalDeviceBlendOperationAdvancedPropertiesEXT
advancedBlendMaxColorAttachments (bool32ToBool advancedBlendIndependentBlend) (bool32ToBool advancedBlendNonPremultipliedSrcColor) (bool32ToBool advancedBlendNonPremultipliedDstColor) (bool32ToBool advancedBlendCorrelatedOverlap) (bool32ToBool advancedBlendAllOperations)
instance Storable PhysicalDeviceBlendOperationAdvancedPropertiesEXT where
sizeOf ~_ = 40
alignment ~_ = 8
peek = peekCStruct
poke ptr poked = pokeCStruct ptr poked (pure ())
instance Zero PhysicalDeviceBlendOperationAdvancedPropertiesEXT where
zero = PhysicalDeviceBlendOperationAdvancedPropertiesEXT
zero
zero
zero
zero
zero
zero
data PipelineColorBlendAdvancedStateCreateInfoEXT = PipelineColorBlendAdvancedStateCreateInfoEXT
{
srcPremultiplied :: Bool
,
dstPremultiplied :: Bool
,
blendOverlap :: BlendOverlapEXT
}
deriving (Typeable)
deriving instance Show PipelineColorBlendAdvancedStateCreateInfoEXT
instance ToCStruct PipelineColorBlendAdvancedStateCreateInfoEXT where
withCStruct x f = allocaBytesAligned 32 8 $ \p -> pokeCStruct p x (f p)
pokeCStruct p PipelineColorBlendAdvancedStateCreateInfoEXT{..} f = do
poke ((p `plusPtr` 0 :: Ptr StructureType)) (STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_ADVANCED_STATE_CREATE_INFO_EXT)
poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) (nullPtr)
poke ((p `plusPtr` 16 :: Ptr Bool32)) (boolToBool32 (srcPremultiplied))
poke ((p `plusPtr` 20 :: Ptr Bool32)) (boolToBool32 (dstPremultiplied))
poke ((p `plusPtr` 24 :: Ptr BlendOverlapEXT)) (blendOverlap)
f
cStructSize = 32
cStructAlignment = 8
pokeZeroCStruct p f = do
poke ((p `plusPtr` 0 :: Ptr StructureType)) (STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_ADVANCED_STATE_CREATE_INFO_EXT)
poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) (nullPtr)
poke ((p `plusPtr` 16 :: Ptr Bool32)) (boolToBool32 (zero))
poke ((p `plusPtr` 20 :: Ptr Bool32)) (boolToBool32 (zero))
poke ((p `plusPtr` 24 :: Ptr BlendOverlapEXT)) (zero)
f
instance FromCStruct PipelineColorBlendAdvancedStateCreateInfoEXT where
peekCStruct p = do
srcPremultiplied <- peek @Bool32 ((p `plusPtr` 16 :: Ptr Bool32))
dstPremultiplied <- peek @Bool32 ((p `plusPtr` 20 :: Ptr Bool32))
blendOverlap <- peek @BlendOverlapEXT ((p `plusPtr` 24 :: Ptr BlendOverlapEXT))
pure $ PipelineColorBlendAdvancedStateCreateInfoEXT
(bool32ToBool srcPremultiplied) (bool32ToBool dstPremultiplied) blendOverlap
instance Storable PipelineColorBlendAdvancedStateCreateInfoEXT where
sizeOf ~_ = 32
alignment ~_ = 8
peek = peekCStruct
poke ptr poked = pokeCStruct ptr poked (pure ())
instance Zero PipelineColorBlendAdvancedStateCreateInfoEXT where
zero = PipelineColorBlendAdvancedStateCreateInfoEXT
zero
zero
zero
newtype BlendOverlapEXT = BlendOverlapEXT Int32
deriving newtype (Eq, Ord, Storable, Zero)
pattern BLEND_OVERLAP_UNCORRELATED_EXT = BlendOverlapEXT 0
pattern BLEND_OVERLAP_DISJOINT_EXT = BlendOverlapEXT 1
pattern BLEND_OVERLAP_CONJOINT_EXT = BlendOverlapEXT 2
{-# complete BLEND_OVERLAP_UNCORRELATED_EXT,
BLEND_OVERLAP_DISJOINT_EXT,
BLEND_OVERLAP_CONJOINT_EXT :: BlendOverlapEXT #-}
instance Show BlendOverlapEXT where
showsPrec p = \case
BLEND_OVERLAP_UNCORRELATED_EXT -> showString "BLEND_OVERLAP_UNCORRELATED_EXT"
BLEND_OVERLAP_DISJOINT_EXT -> showString "BLEND_OVERLAP_DISJOINT_EXT"
BLEND_OVERLAP_CONJOINT_EXT -> showString "BLEND_OVERLAP_CONJOINT_EXT"
BlendOverlapEXT x -> showParen (p >= 11) (showString "BlendOverlapEXT " . showsPrec 11 x)
instance Read BlendOverlapEXT where
readPrec = parens (choose [("BLEND_OVERLAP_UNCORRELATED_EXT", pure BLEND_OVERLAP_UNCORRELATED_EXT)
, ("BLEND_OVERLAP_DISJOINT_EXT", pure BLEND_OVERLAP_DISJOINT_EXT)
, ("BLEND_OVERLAP_CONJOINT_EXT", pure BLEND_OVERLAP_CONJOINT_EXT)]
+++
prec 10 (do
expectP (Ident "BlendOverlapEXT")
v <- step readPrec
pure (BlendOverlapEXT v)))
type EXT_BLEND_OPERATION_ADVANCED_SPEC_VERSION = 2
pattern EXT_BLEND_OPERATION_ADVANCED_SPEC_VERSION :: forall a . Integral a => a
pattern EXT_BLEND_OPERATION_ADVANCED_SPEC_VERSION = 2
type EXT_BLEND_OPERATION_ADVANCED_EXTENSION_NAME = "VK_EXT_blend_operation_advanced"
pattern EXT_BLEND_OPERATION_ADVANCED_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern EXT_BLEND_OPERATION_ADVANCED_EXTENSION_NAME = "VK_EXT_blend_operation_advanced"