{-# language CPP #-}
module Graphics.Vulkan.Extensions.VK_AMD_shader_core_properties2 ( PhysicalDeviceShaderCoreProperties2AMD(..)
, ShaderCorePropertiesFlagBitsAMD(..)
, ShaderCorePropertiesFlagsAMD
, AMD_SHADER_CORE_PROPERTIES_2_SPEC_VERSION
, pattern AMD_SHADER_CORE_PROPERTIES_2_SPEC_VERSION
, AMD_SHADER_CORE_PROPERTIES_2_EXTENSION_NAME
, pattern AMD_SHADER_CORE_PROPERTIES_2_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 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.Storable (Storable)
import Foreign.Storable (Storable(peek))
import Foreign.Storable (Storable(poke))
import qualified Foreign.Storable (Storable(..))
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 (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_SHADER_CORE_PROPERTIES_2_AMD))
data PhysicalDeviceShaderCoreProperties2AMD = PhysicalDeviceShaderCoreProperties2AMD
{
shaderCoreFeatures :: ShaderCorePropertiesFlagsAMD
,
activeComputeUnitCount :: Word32
}
deriving (Typeable)
deriving instance Show PhysicalDeviceShaderCoreProperties2AMD
instance ToCStruct PhysicalDeviceShaderCoreProperties2AMD where
withCStruct x f = allocaBytesAligned 24 8 $ \p -> pokeCStruct p x (f p)
pokeCStruct p PhysicalDeviceShaderCoreProperties2AMD{..} f = do
poke ((p `plusPtr` 0 :: Ptr StructureType)) (STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_2_AMD)
poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) (nullPtr)
poke ((p `plusPtr` 16 :: Ptr ShaderCorePropertiesFlagsAMD)) (shaderCoreFeatures)
poke ((p `plusPtr` 20 :: Ptr Word32)) (activeComputeUnitCount)
f
cStructSize = 24
cStructAlignment = 8
pokeZeroCStruct p f = do
poke ((p `plusPtr` 0 :: Ptr StructureType)) (STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_2_AMD)
poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) (nullPtr)
poke ((p `plusPtr` 16 :: Ptr ShaderCorePropertiesFlagsAMD)) (zero)
poke ((p `plusPtr` 20 :: Ptr Word32)) (zero)
f
instance FromCStruct PhysicalDeviceShaderCoreProperties2AMD where
peekCStruct p = do
shaderCoreFeatures <- peek @ShaderCorePropertiesFlagsAMD ((p `plusPtr` 16 :: Ptr ShaderCorePropertiesFlagsAMD))
activeComputeUnitCount <- peek @Word32 ((p `plusPtr` 20 :: Ptr Word32))
pure $ PhysicalDeviceShaderCoreProperties2AMD
shaderCoreFeatures activeComputeUnitCount
instance Storable PhysicalDeviceShaderCoreProperties2AMD where
sizeOf ~_ = 24
alignment ~_ = 8
peek = peekCStruct
poke ptr poked = pokeCStruct ptr poked (pure ())
instance Zero PhysicalDeviceShaderCoreProperties2AMD where
zero = PhysicalDeviceShaderCoreProperties2AMD
zero
zero
newtype ShaderCorePropertiesFlagBitsAMD = ShaderCorePropertiesFlagBitsAMD Flags
deriving newtype (Eq, Ord, Storable, Zero, Bits)
type ShaderCorePropertiesFlagsAMD = ShaderCorePropertiesFlagBitsAMD
instance Show ShaderCorePropertiesFlagBitsAMD where
showsPrec p = \case
ShaderCorePropertiesFlagBitsAMD x -> showParen (p >= 11) (showString "ShaderCorePropertiesFlagBitsAMD 0x" . showHex x)
instance Read ShaderCorePropertiesFlagBitsAMD where
readPrec = parens (choose []
+++
prec 10 (do
expectP (Ident "ShaderCorePropertiesFlagBitsAMD")
v <- step readPrec
pure (ShaderCorePropertiesFlagBitsAMD v)))
type AMD_SHADER_CORE_PROPERTIES_2_SPEC_VERSION = 1
pattern AMD_SHADER_CORE_PROPERTIES_2_SPEC_VERSION :: forall a . Integral a => a
pattern AMD_SHADER_CORE_PROPERTIES_2_SPEC_VERSION = 1
type AMD_SHADER_CORE_PROPERTIES_2_EXTENSION_NAME = "VK_AMD_shader_core_properties2"
pattern AMD_SHADER_CORE_PROPERTIES_2_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern AMD_SHADER_CORE_PROPERTIES_2_EXTENSION_NAME = "VK_AMD_shader_core_properties2"