{-# language CPP #-}
-- | = Name
--
-- VK_ARM_shader_core_properties - device extension
--
-- == VK_ARM_shader_core_properties
--
-- [__Name String__]
--     @VK_ARM_shader_core_properties@
--
-- [__Extension Type__]
--     Device extension
--
-- [__Registered Extension Number__]
--     416
--
-- [__Revision__]
--     1
--
-- [__Ratification Status__]
--     Not ratified
--
-- [__Extension and Version Dependencies__]
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#versions-1.1 Version 1.1>
--
-- [__Contact__]
--
--     -   Jan-Harald Fredriksen
--         <https://github.com/KhronosGroup/Vulkan-Docs/issues/new?body=[VK_ARM_shader_core_properties] @janharaldfredriksen-arm%0A*Here describe the issue or question you have about the VK_ARM_shader_core_properties extension* >
--
-- == Other Extension Metadata
--
-- [__Last Modified Date__]
--     2023-02-07
--
-- [__IP Status__]
--     No known IP claims.
--
-- [__Contributors__]
--
--     -   Jan-Harald Fredriksen, Arm Ltd.
--
-- == Description
--
-- This extension provides the ability to determine device-specific
-- performance properties of Arm GPUs.
--
-- It exposes properties for the number of texel, pixel, and fused
-- multiply-add operations per clock per shader core. This can be used in
-- combination with the @VK_ARM_shader_core_builtins@ extension that
-- provides the ability to query the number of shader cores on the physical
-- device.
--
-- == New Structures
--
-- -   Extending
--     'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceProperties2':
--
--     -   'PhysicalDeviceShaderCorePropertiesARM'
--
-- == New Enum Constants
--
-- -   'ARM_SHADER_CORE_PROPERTIES_EXTENSION_NAME'
--
-- -   'ARM_SHADER_CORE_PROPERTIES_SPEC_VERSION'
--
-- -   Extending 'Vulkan.Core10.Enums.StructureType.StructureType':
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_ARM'
--
-- == Version History
--
-- -   Revision 1, 2023-02-07 (Jan-Harald Fredriksen)
--
--     -   Initial draft.
--
-- == See Also
--
-- 'PhysicalDeviceShaderCorePropertiesARM'
--
-- == Document Notes
--
-- For more information, see the
-- <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VK_ARM_shader_core_properties Vulkan Specification>
--
-- This page is a generated document. Fixes and changes should be made to
-- the generator scripts, not directly.
module Vulkan.Extensions.VK_ARM_shader_core_properties  ( PhysicalDeviceShaderCorePropertiesARM(..)
                                                        , ARM_SHADER_CORE_PROPERTIES_SPEC_VERSION
                                                        , pattern ARM_SHADER_CORE_PROPERTIES_SPEC_VERSION
                                                        , ARM_SHADER_CORE_PROPERTIES_EXTENSION_NAME
                                                        , pattern ARM_SHADER_CORE_PROPERTIES_EXTENSION_NAME
                                                        ) where

import Foreign.Marshal.Alloc (allocaBytes)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Zero (Zero(..))
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 GHC.Generics (Generic)
import Foreign.Ptr (Ptr)
import Data.Word (Word32)
import Data.Kind (Type)
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_ARM))
-- | VkPhysicalDeviceShaderCorePropertiesARM - Structure describing shader
-- core properties that can be supported by an implementation
--
-- = Description
--
-- If a throughput rate cannot be determined on the physical device, the
-- value @0@ will be returned for that rate.
--
-- If the 'PhysicalDeviceShaderCorePropertiesARM' structure is included in
-- the @pNext@ chain of the
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceProperties2'
-- structure passed to
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.getPhysicalDeviceProperties2',
-- it is filled in with each corresponding implementation-dependent
-- property.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_ARM_shader_core_properties VK_ARM_shader_core_properties>,
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PhysicalDeviceShaderCorePropertiesARM = PhysicalDeviceShaderCorePropertiesARM
  { -- | @pixelRate@ is an unsigned integer value indicating the maximum number
    -- of pixels output per clock per shader core.
    PhysicalDeviceShaderCorePropertiesARM -> Word32
pixelRate :: Word32
  , -- | @texelRate@ is an unsigned integer value indicating the maximum number
    -- of texels per clock per shader core.
    PhysicalDeviceShaderCorePropertiesARM -> Word32
texelRate :: Word32
  , -- | @fmaRate@ is an unsigned integer value indicating the maximum number of
    -- single-precision fused multiply-add operations per clock per shader
    -- core.
    PhysicalDeviceShaderCorePropertiesARM -> Word32
fmaRate :: Word32
  }
  deriving (Typeable, PhysicalDeviceShaderCorePropertiesARM
-> PhysicalDeviceShaderCorePropertiesARM -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhysicalDeviceShaderCorePropertiesARM
-> PhysicalDeviceShaderCorePropertiesARM -> Bool
$c/= :: PhysicalDeviceShaderCorePropertiesARM
-> PhysicalDeviceShaderCorePropertiesARM -> Bool
== :: PhysicalDeviceShaderCorePropertiesARM
-> PhysicalDeviceShaderCorePropertiesARM -> Bool
$c== :: PhysicalDeviceShaderCorePropertiesARM
-> PhysicalDeviceShaderCorePropertiesARM -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceShaderCorePropertiesARM)
#endif
deriving instance Show PhysicalDeviceShaderCorePropertiesARM

instance ToCStruct PhysicalDeviceShaderCorePropertiesARM where
  withCStruct :: forall b.
PhysicalDeviceShaderCorePropertiesARM
-> (Ptr PhysicalDeviceShaderCorePropertiesARM -> IO b) -> IO b
withCStruct PhysicalDeviceShaderCorePropertiesARM
x Ptr PhysicalDeviceShaderCorePropertiesARM -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
32 forall a b. (a -> b) -> a -> b
$ \Ptr PhysicalDeviceShaderCorePropertiesARM
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceShaderCorePropertiesARM
p PhysicalDeviceShaderCorePropertiesARM
x (Ptr PhysicalDeviceShaderCorePropertiesARM -> IO b
f Ptr PhysicalDeviceShaderCorePropertiesARM
p)
  pokeCStruct :: forall b.
Ptr PhysicalDeviceShaderCorePropertiesARM
-> PhysicalDeviceShaderCorePropertiesARM -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceShaderCorePropertiesARM
p PhysicalDeviceShaderCorePropertiesARM{Word32
fmaRate :: Word32
texelRate :: Word32
pixelRate :: Word32
$sel:fmaRate:PhysicalDeviceShaderCorePropertiesARM :: PhysicalDeviceShaderCorePropertiesARM -> Word32
$sel:texelRate:PhysicalDeviceShaderCorePropertiesARM :: PhysicalDeviceShaderCorePropertiesARM -> Word32
$sel:pixelRate:PhysicalDeviceShaderCorePropertiesARM :: PhysicalDeviceShaderCorePropertiesARM -> Word32
..} IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceShaderCorePropertiesARM
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_ARM)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceShaderCorePropertiesARM
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceShaderCorePropertiesARM
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32)) (Word32
pixelRate)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceShaderCorePropertiesARM
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Word32)) (Word32
texelRate)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceShaderCorePropertiesARM
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Word32)) (Word32
fmaRate)
    IO b
f
  cStructSize :: Int
cStructSize = Int
32
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b. Ptr PhysicalDeviceShaderCorePropertiesARM -> IO b -> IO b
pokeZeroCStruct Ptr PhysicalDeviceShaderCorePropertiesARM
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceShaderCorePropertiesARM
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_ARM)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceShaderCorePropertiesARM
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceShaderCorePropertiesARM
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32)) (forall a. Zero a => a
zero)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceShaderCorePropertiesARM
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Word32)) (forall a. Zero a => a
zero)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceShaderCorePropertiesARM
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Word32)) (forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct PhysicalDeviceShaderCorePropertiesARM where
  peekCStruct :: Ptr PhysicalDeviceShaderCorePropertiesARM
-> IO PhysicalDeviceShaderCorePropertiesARM
peekCStruct Ptr PhysicalDeviceShaderCorePropertiesARM
p = do
    Word32
pixelRate <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr PhysicalDeviceShaderCorePropertiesARM
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32))
    Word32
texelRate <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr PhysicalDeviceShaderCorePropertiesARM
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Word32))
    Word32
fmaRate <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr PhysicalDeviceShaderCorePropertiesARM
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Word32))
    forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Word32 -> Word32 -> Word32 -> PhysicalDeviceShaderCorePropertiesARM
PhysicalDeviceShaderCorePropertiesARM
             Word32
pixelRate Word32
texelRate Word32
fmaRate

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

instance Zero PhysicalDeviceShaderCorePropertiesARM where
  zero :: PhysicalDeviceShaderCorePropertiesARM
zero = Word32 -> Word32 -> Word32 -> PhysicalDeviceShaderCorePropertiesARM
PhysicalDeviceShaderCorePropertiesARM
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero


type ARM_SHADER_CORE_PROPERTIES_SPEC_VERSION = 1

-- No documentation found for TopLevel "VK_ARM_SHADER_CORE_PROPERTIES_SPEC_VERSION"
pattern ARM_SHADER_CORE_PROPERTIES_SPEC_VERSION :: forall a . Integral a => a
pattern $bARM_SHADER_CORE_PROPERTIES_SPEC_VERSION :: forall a. Integral a => a
$mARM_SHADER_CORE_PROPERTIES_SPEC_VERSION :: forall {r} {a}.
Integral a =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
ARM_SHADER_CORE_PROPERTIES_SPEC_VERSION = 1


type ARM_SHADER_CORE_PROPERTIES_EXTENSION_NAME = "VK_ARM_shader_core_properties"

-- No documentation found for TopLevel "VK_ARM_SHADER_CORE_PROPERTIES_EXTENSION_NAME"
pattern ARM_SHADER_CORE_PROPERTIES_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bARM_SHADER_CORE_PROPERTIES_EXTENSION_NAME :: forall a. (Eq a, IsString a) => a
$mARM_SHADER_CORE_PROPERTIES_EXTENSION_NAME :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
ARM_SHADER_CORE_PROPERTIES_EXTENSION_NAME = "VK_ARM_shader_core_properties"