{-# language CPP #-}
module Graphics.Vulkan.Extensions.VK_EXT_line_rasterization ( cmdSetLineStippleEXT
, PhysicalDeviceLineRasterizationFeaturesEXT(..)
, PhysicalDeviceLineRasterizationPropertiesEXT(..)
, PipelineRasterizationLineStateCreateInfoEXT(..)
, LineRasterizationModeEXT( LINE_RASTERIZATION_MODE_DEFAULT_EXT
, LINE_RASTERIZATION_MODE_RECTANGULAR_EXT
, LINE_RASTERIZATION_MODE_BRESENHAM_EXT
, LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT
, ..
)
, EXT_LINE_RASTERIZATION_SPEC_VERSION
, pattern EXT_LINE_RASTERIZATION_SPEC_VERSION
, EXT_LINE_RASTERIZATION_EXTENSION_NAME
, pattern EXT_LINE_RASTERIZATION_EXTENSION_NAME
) where
import Control.Monad.IO.Class (liftIO)
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 Control.Monad.IO.Class (MonadIO)
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 (FunPtr)
import Foreign.Ptr (Ptr)
import GHC.Read (Read(readPrec))
import Data.Word (Word16)
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.NamedType ((:::))
import Graphics.Vulkan.Core10.BaseType (Bool32)
import Graphics.Vulkan.Core10.Handles (CommandBuffer)
import Graphics.Vulkan.Core10.Handles (CommandBuffer(..))
import Graphics.Vulkan.Core10.Handles (CommandBuffer_T)
import Graphics.Vulkan.Dynamic (DeviceCmds(pVkCmdSetLineStippleEXT))
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_LINE_RASTERIZATION_FEATURES_EXT))
import Graphics.Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_PROPERTIES_EXT))
import Graphics.Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PIPELINE_RASTERIZATION_LINE_STATE_CREATE_INFO_EXT))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkCmdSetLineStippleEXT
:: FunPtr (Ptr CommandBuffer_T -> Word32 -> Word16 -> IO ()) -> Ptr CommandBuffer_T -> Word32 -> Word16 -> IO ()
cmdSetLineStippleEXT :: forall io . MonadIO io => CommandBuffer -> ("lineStippleFactor" ::: Word32) -> ("lineStipplePattern" ::: Word16) -> io ()
cmdSetLineStippleEXT commandBuffer lineStippleFactor lineStipplePattern = liftIO $ do
let vkCmdSetLineStippleEXT' = mkVkCmdSetLineStippleEXT (pVkCmdSetLineStippleEXT (deviceCmds (commandBuffer :: CommandBuffer)))
vkCmdSetLineStippleEXT' (commandBufferHandle (commandBuffer)) (lineStippleFactor) (lineStipplePattern)
pure $ ()
data PhysicalDeviceLineRasterizationFeaturesEXT = PhysicalDeviceLineRasterizationFeaturesEXT
{
rectangularLines :: Bool
,
bresenhamLines :: Bool
,
smoothLines :: Bool
,
stippledRectangularLines :: Bool
,
stippledBresenhamLines :: Bool
,
stippledSmoothLines :: Bool
}
deriving (Typeable)
deriving instance Show PhysicalDeviceLineRasterizationFeaturesEXT
instance ToCStruct PhysicalDeviceLineRasterizationFeaturesEXT where
withCStruct x f = allocaBytesAligned 40 8 $ \p -> pokeCStruct p x (f p)
pokeCStruct p PhysicalDeviceLineRasterizationFeaturesEXT{..} f = do
poke ((p `plusPtr` 0 :: Ptr StructureType)) (STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_FEATURES_EXT)
poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) (nullPtr)
poke ((p `plusPtr` 16 :: Ptr Bool32)) (boolToBool32 (rectangularLines))
poke ((p `plusPtr` 20 :: Ptr Bool32)) (boolToBool32 (bresenhamLines))
poke ((p `plusPtr` 24 :: Ptr Bool32)) (boolToBool32 (smoothLines))
poke ((p `plusPtr` 28 :: Ptr Bool32)) (boolToBool32 (stippledRectangularLines))
poke ((p `plusPtr` 32 :: Ptr Bool32)) (boolToBool32 (stippledBresenhamLines))
poke ((p `plusPtr` 36 :: Ptr Bool32)) (boolToBool32 (stippledSmoothLines))
f
cStructSize = 40
cStructAlignment = 8
pokeZeroCStruct p f = do
poke ((p `plusPtr` 0 :: Ptr StructureType)) (STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_FEATURES_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 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 PhysicalDeviceLineRasterizationFeaturesEXT where
peekCStruct p = do
rectangularLines <- peek @Bool32 ((p `plusPtr` 16 :: Ptr Bool32))
bresenhamLines <- peek @Bool32 ((p `plusPtr` 20 :: Ptr Bool32))
smoothLines <- peek @Bool32 ((p `plusPtr` 24 :: Ptr Bool32))
stippledRectangularLines <- peek @Bool32 ((p `plusPtr` 28 :: Ptr Bool32))
stippledBresenhamLines <- peek @Bool32 ((p `plusPtr` 32 :: Ptr Bool32))
stippledSmoothLines <- peek @Bool32 ((p `plusPtr` 36 :: Ptr Bool32))
pure $ PhysicalDeviceLineRasterizationFeaturesEXT
(bool32ToBool rectangularLines) (bool32ToBool bresenhamLines) (bool32ToBool smoothLines) (bool32ToBool stippledRectangularLines) (bool32ToBool stippledBresenhamLines) (bool32ToBool stippledSmoothLines)
instance Storable PhysicalDeviceLineRasterizationFeaturesEXT where
sizeOf ~_ = 40
alignment ~_ = 8
peek = peekCStruct
poke ptr poked = pokeCStruct ptr poked (pure ())
instance Zero PhysicalDeviceLineRasterizationFeaturesEXT where
zero = PhysicalDeviceLineRasterizationFeaturesEXT
zero
zero
zero
zero
zero
zero
data PhysicalDeviceLineRasterizationPropertiesEXT = PhysicalDeviceLineRasterizationPropertiesEXT
{
lineSubPixelPrecisionBits :: Word32 }
deriving (Typeable)
deriving instance Show PhysicalDeviceLineRasterizationPropertiesEXT
instance ToCStruct PhysicalDeviceLineRasterizationPropertiesEXT where
withCStruct x f = allocaBytesAligned 24 8 $ \p -> pokeCStruct p x (f p)
pokeCStruct p PhysicalDeviceLineRasterizationPropertiesEXT{..} f = do
poke ((p `plusPtr` 0 :: Ptr StructureType)) (STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_PROPERTIES_EXT)
poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) (nullPtr)
poke ((p `plusPtr` 16 :: Ptr Word32)) (lineSubPixelPrecisionBits)
f
cStructSize = 24
cStructAlignment = 8
pokeZeroCStruct p f = do
poke ((p `plusPtr` 0 :: Ptr StructureType)) (STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_PROPERTIES_EXT)
poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) (nullPtr)
poke ((p `plusPtr` 16 :: Ptr Word32)) (zero)
f
instance FromCStruct PhysicalDeviceLineRasterizationPropertiesEXT where
peekCStruct p = do
lineSubPixelPrecisionBits <- peek @Word32 ((p `plusPtr` 16 :: Ptr Word32))
pure $ PhysicalDeviceLineRasterizationPropertiesEXT
lineSubPixelPrecisionBits
instance Storable PhysicalDeviceLineRasterizationPropertiesEXT where
sizeOf ~_ = 24
alignment ~_ = 8
peek = peekCStruct
poke ptr poked = pokeCStruct ptr poked (pure ())
instance Zero PhysicalDeviceLineRasterizationPropertiesEXT where
zero = PhysicalDeviceLineRasterizationPropertiesEXT
zero
data PipelineRasterizationLineStateCreateInfoEXT = PipelineRasterizationLineStateCreateInfoEXT
{
lineRasterizationMode :: LineRasterizationModeEXT
,
stippledLineEnable :: Bool
,
lineStippleFactor :: Word32
,
lineStipplePattern :: Word16
}
deriving (Typeable)
deriving instance Show PipelineRasterizationLineStateCreateInfoEXT
instance ToCStruct PipelineRasterizationLineStateCreateInfoEXT where
withCStruct x f = allocaBytesAligned 32 8 $ \p -> pokeCStruct p x (f p)
pokeCStruct p PipelineRasterizationLineStateCreateInfoEXT{..} f = do
poke ((p `plusPtr` 0 :: Ptr StructureType)) (STRUCTURE_TYPE_PIPELINE_RASTERIZATION_LINE_STATE_CREATE_INFO_EXT)
poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) (nullPtr)
poke ((p `plusPtr` 16 :: Ptr LineRasterizationModeEXT)) (lineRasterizationMode)
poke ((p `plusPtr` 20 :: Ptr Bool32)) (boolToBool32 (stippledLineEnable))
poke ((p `plusPtr` 24 :: Ptr Word32)) (lineStippleFactor)
poke ((p `plusPtr` 28 :: Ptr Word16)) (lineStipplePattern)
f
cStructSize = 32
cStructAlignment = 8
pokeZeroCStruct p f = do
poke ((p `plusPtr` 0 :: Ptr StructureType)) (STRUCTURE_TYPE_PIPELINE_RASTERIZATION_LINE_STATE_CREATE_INFO_EXT)
poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) (nullPtr)
poke ((p `plusPtr` 16 :: Ptr LineRasterizationModeEXT)) (zero)
poke ((p `plusPtr` 20 :: Ptr Bool32)) (boolToBool32 (zero))
f
instance FromCStruct PipelineRasterizationLineStateCreateInfoEXT where
peekCStruct p = do
lineRasterizationMode <- peek @LineRasterizationModeEXT ((p `plusPtr` 16 :: Ptr LineRasterizationModeEXT))
stippledLineEnable <- peek @Bool32 ((p `plusPtr` 20 :: Ptr Bool32))
lineStippleFactor <- peek @Word32 ((p `plusPtr` 24 :: Ptr Word32))
lineStipplePattern <- peek @Word16 ((p `plusPtr` 28 :: Ptr Word16))
pure $ PipelineRasterizationLineStateCreateInfoEXT
lineRasterizationMode (bool32ToBool stippledLineEnable) lineStippleFactor lineStipplePattern
instance Storable PipelineRasterizationLineStateCreateInfoEXT where
sizeOf ~_ = 32
alignment ~_ = 8
peek = peekCStruct
poke ptr poked = pokeCStruct ptr poked (pure ())
instance Zero PipelineRasterizationLineStateCreateInfoEXT where
zero = PipelineRasterizationLineStateCreateInfoEXT
zero
zero
zero
zero
newtype LineRasterizationModeEXT = LineRasterizationModeEXT Int32
deriving newtype (Eq, Ord, Storable, Zero)
pattern LINE_RASTERIZATION_MODE_DEFAULT_EXT = LineRasterizationModeEXT 0
pattern LINE_RASTERIZATION_MODE_RECTANGULAR_EXT = LineRasterizationModeEXT 1
pattern LINE_RASTERIZATION_MODE_BRESENHAM_EXT = LineRasterizationModeEXT 2
pattern LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT = LineRasterizationModeEXT 3
{-# complete LINE_RASTERIZATION_MODE_DEFAULT_EXT,
LINE_RASTERIZATION_MODE_RECTANGULAR_EXT,
LINE_RASTERIZATION_MODE_BRESENHAM_EXT,
LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT :: LineRasterizationModeEXT #-}
instance Show LineRasterizationModeEXT where
showsPrec p = \case
LINE_RASTERIZATION_MODE_DEFAULT_EXT -> showString "LINE_RASTERIZATION_MODE_DEFAULT_EXT"
LINE_RASTERIZATION_MODE_RECTANGULAR_EXT -> showString "LINE_RASTERIZATION_MODE_RECTANGULAR_EXT"
LINE_RASTERIZATION_MODE_BRESENHAM_EXT -> showString "LINE_RASTERIZATION_MODE_BRESENHAM_EXT"
LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT -> showString "LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT"
LineRasterizationModeEXT x -> showParen (p >= 11) (showString "LineRasterizationModeEXT " . showsPrec 11 x)
instance Read LineRasterizationModeEXT where
readPrec = parens (choose [("LINE_RASTERIZATION_MODE_DEFAULT_EXT", pure LINE_RASTERIZATION_MODE_DEFAULT_EXT)
, ("LINE_RASTERIZATION_MODE_RECTANGULAR_EXT", pure LINE_RASTERIZATION_MODE_RECTANGULAR_EXT)
, ("LINE_RASTERIZATION_MODE_BRESENHAM_EXT", pure LINE_RASTERIZATION_MODE_BRESENHAM_EXT)
, ("LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT", pure LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT)]
+++
prec 10 (do
expectP (Ident "LineRasterizationModeEXT")
v <- step readPrec
pure (LineRasterizationModeEXT v)))
type EXT_LINE_RASTERIZATION_SPEC_VERSION = 1
pattern EXT_LINE_RASTERIZATION_SPEC_VERSION :: forall a . Integral a => a
pattern EXT_LINE_RASTERIZATION_SPEC_VERSION = 1
type EXT_LINE_RASTERIZATION_EXTENSION_NAME = "VK_EXT_line_rasterization"
pattern EXT_LINE_RASTERIZATION_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern EXT_LINE_RASTERIZATION_EXTENSION_NAME = "VK_EXT_line_rasterization"