{-# language CPP #-}
-- | = Name
--
-- VK_AMD_shader_info - device extension
--
-- == VK_AMD_shader_info
--
-- [__Name String__]
--     @VK_AMD_shader_info@
--
-- [__Extension Type__]
--     Device extension
--
-- [__Registered Extension Number__]
--     43
--
-- [__Revision__]
--     1
--
-- [__Ratification Status__]
--     Not ratified
--
-- [__Extension and Version Dependencies__; __Special Use__]
--
--     -   <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#extendingvulkan-compatibility-specialuse Developer tools>
--
-- [__Contact__]
--
--     -   Jaakko Konttinen
--         <https://github.com/KhronosGroup/Vulkan-Docs/issues/new?body=[VK_AMD_shader_info] @jaakkoamd%0A*Here describe the issue or question you have about the VK_AMD_shader_info extension* >
--
-- == Other Extension Metadata
--
-- [__Last Modified Date__]
--     2017-10-09
--
-- [__IP Status__]
--     No known IP claims.
--
-- [__Contributors__]
--
--     -   Jaakko Konttinen, AMD
--
-- == Description
--
-- This extension adds a way to query certain information about a compiled
-- shader which is part of a pipeline. This information may include shader
-- disassembly, shader binary and various statistics about a shader’s
-- resource usage.
--
-- While this extension provides a mechanism for extracting this
-- information, the details regarding the contents or format of this
-- information are not specified by this extension and may be provided by
-- the vendor externally.
--
-- Furthermore, all information types are optionally supported, and users
-- should not assume every implementation supports querying every type of
-- information.
--
-- == New Commands
--
-- -   'getShaderInfoAMD'
--
-- == New Structures
--
-- -   'ShaderResourceUsageAMD'
--
-- -   'ShaderStatisticsInfoAMD'
--
-- == New Enums
--
-- -   'ShaderInfoTypeAMD'
--
-- == New Enum Constants
--
-- -   'AMD_SHADER_INFO_EXTENSION_NAME'
--
-- -   'AMD_SHADER_INFO_SPEC_VERSION'
--
-- == Examples
--
-- This example extracts the register usage of a fragment shader within a
-- particular graphics pipeline:
--
-- > extern VkDevice device;
-- > extern VkPipeline gfxPipeline;
-- >
-- > PFN_vkGetShaderInfoAMD pfnGetShaderInfoAMD = (PFN_vkGetShaderInfoAMD)vkGetDeviceProcAddr(
-- >     device, "vkGetShaderInfoAMD");
-- >
-- > VkShaderStatisticsInfoAMD statistics = {};
-- >
-- > size_t dataSize = sizeof(statistics);
-- >
-- > if (pfnGetShaderInfoAMD(device,
-- >     gfxPipeline,
-- >     VK_SHADER_STAGE_FRAGMENT_BIT,
-- >     VK_SHADER_INFO_TYPE_STATISTICS_AMD,
-- >     &dataSize,
-- >     &statistics) == VK_SUCCESS)
-- > {
-- >     printf("VGPR usage: %d\n", statistics.resourceUsage.numUsedVgprs);
-- >     printf("SGPR usage: %d\n", statistics.resourceUsage.numUsedSgprs);
-- > }
--
-- The following example continues the previous example by subsequently
-- attempting to query and print shader disassembly about the fragment
-- shader:
--
-- > // Query disassembly size (if available)
-- > if (pfnGetShaderInfoAMD(device,
-- >     gfxPipeline,
-- >     VK_SHADER_STAGE_FRAGMENT_BIT,
-- >     VK_SHADER_INFO_TYPE_DISASSEMBLY_AMD,
-- >     &dataSize,
-- >     nullptr) == VK_SUCCESS)
-- > {
-- >     printf("Fragment shader disassembly:\n");
-- >
-- >     void* disassembly = malloc(dataSize);
-- >
-- >     // Query disassembly and print
-- >     if (pfnGetShaderInfoAMD(device,
-- >         gfxPipeline,
-- >         VK_SHADER_STAGE_FRAGMENT_BIT,
-- >         VK_SHADER_INFO_TYPE_DISASSEMBLY_AMD,
-- >         &dataSize,
-- >         disassembly) == VK_SUCCESS)
-- >     {
-- >         printf((char*)disassembly);
-- >     }
-- >
-- >     free(disassembly);
-- > }
--
-- == Version History
--
-- -   Revision 1, 2017-10-09 (Jaakko Konttinen)
--
--     -   Initial revision
--
-- == See Also
--
-- 'ShaderInfoTypeAMD', 'ShaderResourceUsageAMD',
-- 'ShaderStatisticsInfoAMD', 'getShaderInfoAMD'
--
-- == Document Notes
--
-- For more information, see the
-- <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VK_AMD_shader_info Vulkan Specification>
--
-- This page is a generated document. Fixes and changes should be made to
-- the generator scripts, not directly.
module Vulkan.Extensions.VK_AMD_shader_info  ( getShaderInfoAMD
                                             , ShaderResourceUsageAMD(..)
                                             , ShaderStatisticsInfoAMD(..)
                                             , ShaderInfoTypeAMD( SHADER_INFO_TYPE_STATISTICS_AMD
                                                                , SHADER_INFO_TYPE_BINARY_AMD
                                                                , SHADER_INFO_TYPE_DISASSEMBLY_AMD
                                                                , ..
                                                                )
                                             , AMD_SHADER_INFO_SPEC_VERSION
                                             , pattern AMD_SHADER_INFO_SPEC_VERSION
                                             , AMD_SHADER_INFO_EXTENSION_NAME
                                             , pattern AMD_SHADER_INFO_EXTENSION_NAME
                                             ) where

import Vulkan.CStruct.Utils (FixedArray)
import Vulkan.Internal.Utils (enumReadPrec)
import Vulkan.Internal.Utils (enumShowsPrec)
import Vulkan.Internal.Utils (traceAroundEvent)
import Control.Exception.Base (bracket)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Foreign.Marshal.Alloc (allocaBytes)
import Foreign.Marshal.Alloc (callocBytes)
import Foreign.Marshal.Alloc (free)
import GHC.Base (when)
import GHC.IO (throwIO)
import GHC.Ptr (castPtr)
import GHC.Ptr (nullFunPtr)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import GHC.Show (showsPrec)
import Data.ByteString (packCStringLen)
import Data.Coerce (coerce)
import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Cont (evalContT)
import Foreign.C.Types (CSize(..))
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Zero (Zero)
import Vulkan.Zero (Zero(..))
import Control.Monad.IO.Class (MonadIO)
import Data.String (IsString)
import Data.Typeable (Typeable)
import Foreign.C.Types (CChar)
import Foreign.C.Types (CSize)
import Foreign.C.Types (CSize(..))
import Foreign.C.Types (CSize(CSize))
import Foreign.Storable (Storable)
import Foreign.Storable (Storable(peek))
import Foreign.Storable (Storable(poke))
import qualified Foreign.Storable (Storable(..))
import GHC.Generics (Generic)
import GHC.IO.Exception (IOErrorType(..))
import GHC.IO.Exception (IOException(..))
import Data.Int (Int32)
import Foreign.Ptr (FunPtr)
import Foreign.Ptr (Ptr)
import GHC.Read (Read(readPrec))
import GHC.Show (Show(showsPrec))
import Data.Word (Word32)
import Data.Word (Word64)
import Data.ByteString (ByteString)
import Data.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Vulkan.CStruct.Utils (advancePtrBytes)
import Vulkan.CStruct.Utils (lowerArrayPtr)
import Vulkan.NamedType ((:::))
import Vulkan.Core10.Handles (Device)
import Vulkan.Core10.Handles (Device(..))
import Vulkan.Core10.Handles (Device(Device))
import Vulkan.Dynamic (DeviceCmds(pVkGetShaderInfoAMD))
import Vulkan.Core10.Handles (Device_T)
import Vulkan.Core10.Handles (Pipeline)
import Vulkan.Core10.Handles (Pipeline(..))
import Vulkan.Core10.Enums.Result (Result)
import Vulkan.Core10.Enums.Result (Result(..))
import Vulkan.Core10.Enums.ShaderStageFlagBits (ShaderStageFlagBits)
import Vulkan.Core10.Enums.ShaderStageFlagBits (ShaderStageFlagBits(..))
import Vulkan.Core10.Enums.ShaderStageFlagBits (ShaderStageFlags)
import Vulkan.Exception (VulkanException(..))
import Vulkan.Core10.Enums.Result (Result(SUCCESS))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkGetShaderInfoAMD
  :: FunPtr (Ptr Device_T -> Pipeline -> ShaderStageFlagBits -> ShaderInfoTypeAMD -> Ptr CSize -> Ptr () -> IO Result) -> Ptr Device_T -> Pipeline -> ShaderStageFlagBits -> ShaderInfoTypeAMD -> Ptr CSize -> Ptr () -> IO Result

-- | vkGetShaderInfoAMD - Get information about a shader in a pipeline
--
-- = Description
--
-- If @pInfo@ is @NULL@, then the maximum size of the information that
-- /can/ be retrieved about the shader, in bytes, is returned in
-- @pInfoSize@. Otherwise, @pInfoSize@ /must/ point to a variable set by
-- the user to the size of the buffer, in bytes, pointed to by @pInfo@, and
-- on return the variable is overwritten with the amount of data actually
-- written to @pInfo@. If @pInfoSize@ is less than the maximum size that
-- /can/ be retrieved by the pipeline cache, then at most @pInfoSize@ bytes
-- will be written to @pInfo@, and 'Vulkan.Core10.Enums.Result.INCOMPLETE'
-- will be returned, instead of 'Vulkan.Core10.Enums.Result.SUCCESS', to
-- indicate that not all required of the pipeline cache was returned.
--
-- Not all information is available for every shader and implementations
-- may not support all kinds of information for any shader. When a certain
-- type of information is unavailable, the function returns
-- 'Vulkan.Core10.Enums.Result.ERROR_FEATURE_NOT_PRESENT'.
--
-- If information is successfully and fully queried, the function will
-- return 'Vulkan.Core10.Enums.Result.SUCCESS'.
--
-- For @infoType@ 'SHADER_INFO_TYPE_STATISTICS_AMD', a
-- 'ShaderStatisticsInfoAMD' structure will be written to the buffer
-- pointed to by @pInfo@. This structure will be populated with statistics
-- regarding the physical device resources used by that shader along with
-- other miscellaneous information and is described in further detail
-- below.
--
-- For @infoType@ 'SHADER_INFO_TYPE_DISASSEMBLY_AMD', @pInfo@ is a pointer
-- to a UTF-8 null-terminated string containing human-readable disassembly.
-- The exact formatting and contents of the disassembly string are
-- vendor-specific.
--
-- The formatting and contents of all other types of information, including
-- @infoType@ 'SHADER_INFO_TYPE_BINARY_AMD', are left to the vendor and are
-- not further specified by this extension.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-vkGetShaderInfoAMD-device-parameter# @device@ /must/ be a
--     valid 'Vulkan.Core10.Handles.Device' handle
--
-- -   #VUID-vkGetShaderInfoAMD-pipeline-parameter# @pipeline@ /must/ be a
--     valid 'Vulkan.Core10.Handles.Pipeline' handle
--
-- -   #VUID-vkGetShaderInfoAMD-shaderStage-parameter# @shaderStage@ /must/
--     be a valid
--     'Vulkan.Core10.Enums.ShaderStageFlagBits.ShaderStageFlagBits' value
--
-- -   #VUID-vkGetShaderInfoAMD-infoType-parameter# @infoType@ /must/ be a
--     valid 'ShaderInfoTypeAMD' value
--
-- -   #VUID-vkGetShaderInfoAMD-pInfoSize-parameter# @pInfoSize@ /must/ be
--     a valid pointer to a @size_t@ value
--
-- -   #VUID-vkGetShaderInfoAMD-pInfo-parameter# If the value referenced by
--     @pInfoSize@ is not @0@, and @pInfo@ is not @NULL@, @pInfo@ /must/ be
--     a valid pointer to an array of @pInfoSize@ bytes
--
-- -   #VUID-vkGetShaderInfoAMD-pipeline-parent# @pipeline@ /must/ have
--     been created, allocated, or retrieved from @device@
--
-- == Return Codes
--
-- [<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#fundamentals-successcodes Success>]
--
--     -   'Vulkan.Core10.Enums.Result.SUCCESS'
--
--     -   'Vulkan.Core10.Enums.Result.INCOMPLETE'
--
-- [<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#fundamentals-errorcodes Failure>]
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_FEATURE_NOT_PRESENT'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_OUT_OF_HOST_MEMORY'
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_AMD_shader_info VK_AMD_shader_info>,
-- 'Vulkan.Core10.Handles.Device', 'Vulkan.Core10.Handles.Pipeline',
-- 'ShaderInfoTypeAMD',
-- 'Vulkan.Core10.Enums.ShaderStageFlagBits.ShaderStageFlagBits'
getShaderInfoAMD :: forall io
                  . (MonadIO io)
                 => -- | @device@ is the device that created @pipeline@.
                    Device
                 -> -- | @pipeline@ is the target of the query.
                    Pipeline
                 -> -- | @shaderStage@ is a
                    -- 'Vulkan.Core10.Enums.ShaderStageFlagBits.ShaderStageFlagBits' specifying
                    -- the particular shader within the pipeline about which information is
                    -- being queried.
                    ShaderStageFlagBits
                 -> -- | @infoType@ describes what kind of information is being queried.
                    ShaderInfoTypeAMD
                 -> io (Result, ("info" ::: ByteString))
getShaderInfoAMD :: forall (io :: * -> *).
MonadIO io =>
Device
-> Pipeline
-> ShaderStageFlagBits
-> ShaderInfoTypeAMD
-> io (Result, "info" ::: ByteString)
getShaderInfoAMD Device
device Pipeline
pipeline ShaderStageFlagBits
shaderStage ShaderInfoTypeAMD
infoType = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT forall a b. (a -> b) -> a -> b
$ do
  let vkGetShaderInfoAMDPtr :: FunPtr
  (Ptr Device_T
   -> Pipeline
   -> ShaderStageFlagBits
   -> ShaderInfoTypeAMD
   -> ("pInfoSize" ::: Ptr CSize)
   -> ("pInfo" ::: Ptr ())
   -> IO Result)
vkGetShaderInfoAMDPtr = DeviceCmds
-> FunPtr
     (Ptr Device_T
      -> Pipeline
      -> ShaderStageFlagBits
      -> ShaderInfoTypeAMD
      -> ("pInfoSize" ::: Ptr CSize)
      -> ("pInfo" ::: Ptr ())
      -> IO Result)
pVkGetShaderInfoAMD (case Device
device of Device{DeviceCmds
$sel:deviceCmds:Device :: Device -> DeviceCmds
deviceCmds :: DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
  forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr Device_T
   -> Pipeline
   -> ShaderStageFlagBits
   -> ShaderInfoTypeAMD
   -> ("pInfoSize" ::: Ptr CSize)
   -> ("pInfo" ::: Ptr ())
   -> IO Result)
vkGetShaderInfoAMDPtr forall a. Eq a => a -> a -> Bool
/= forall a. FunPtr a
nullFunPtr) forall a b. (a -> b) -> a -> b
$
    forall e a. Exception e => e -> IO a
throwIO forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"The function pointer for vkGetShaderInfoAMD is null" forall a. Maybe a
Nothing forall a. Maybe a
Nothing
  let vkGetShaderInfoAMD' :: Ptr Device_T
-> Pipeline
-> ShaderStageFlagBits
-> ShaderInfoTypeAMD
-> ("pInfoSize" ::: Ptr CSize)
-> ("pInfo" ::: Ptr ())
-> IO Result
vkGetShaderInfoAMD' = FunPtr
  (Ptr Device_T
   -> Pipeline
   -> ShaderStageFlagBits
   -> ShaderInfoTypeAMD
   -> ("pInfoSize" ::: Ptr CSize)
   -> ("pInfo" ::: Ptr ())
   -> IO Result)
-> Ptr Device_T
-> Pipeline
-> ShaderStageFlagBits
-> ShaderInfoTypeAMD
-> ("pInfoSize" ::: Ptr CSize)
-> ("pInfo" ::: Ptr ())
-> IO Result
mkVkGetShaderInfoAMD FunPtr
  (Ptr Device_T
   -> Pipeline
   -> ShaderStageFlagBits
   -> ShaderInfoTypeAMD
   -> ("pInfoSize" ::: Ptr CSize)
   -> ("pInfo" ::: Ptr ())
   -> IO Result)
vkGetShaderInfoAMDPtr
  let device' :: Ptr Device_T
device' = Device -> Ptr Device_T
deviceHandle (Device
device)
  "pInfoSize" ::: Ptr CSize
pPInfoSize <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT forall a b. (a -> b) -> a -> b
$ forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (forall a. Int -> IO (Ptr a)
callocBytes @CSize Int
8) forall a. Ptr a -> IO ()
free
  Result
r <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. String -> IO a -> IO a
traceAroundEvent String
"vkGetShaderInfoAMD" (Ptr Device_T
-> Pipeline
-> ShaderStageFlagBits
-> ShaderInfoTypeAMD
-> ("pInfoSize" ::: Ptr CSize)
-> ("pInfo" ::: Ptr ())
-> IO Result
vkGetShaderInfoAMD'
                                                       Ptr Device_T
device'
                                                       (Pipeline
pipeline)
                                                       (ShaderStageFlagBits
shaderStage)
                                                       (ShaderInfoTypeAMD
infoType)
                                                       ("pInfoSize" ::: Ptr CSize
pPInfoSize)
                                                       (forall a. Ptr a
nullPtr))
  forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Result
r forall a. Ord a => a -> a -> Bool
< Result
SUCCESS) (forall e a. Exception e => e -> IO a
throwIO (Result -> VulkanException
VulkanException Result
r))
  CSize
pInfoSize <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> IO a
peek @CSize "pInfoSize" ::: Ptr CSize
pPInfoSize
  "pInfo" ::: Ptr ()
pPInfo <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT forall a b. (a -> b) -> a -> b
$ forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (forall a. Int -> IO (Ptr a)
callocBytes @(()) (forall a b. (Integral a, Num b) => a -> b
fromIntegral ((coerce :: forall a b. Coercible a b => a -> b
coerce @CSize @Word64 CSize
pInfoSize)))) forall a. Ptr a -> IO ()
free
  Result
r' <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. String -> IO a -> IO a
traceAroundEvent String
"vkGetShaderInfoAMD" (Ptr Device_T
-> Pipeline
-> ShaderStageFlagBits
-> ShaderInfoTypeAMD
-> ("pInfoSize" ::: Ptr CSize)
-> ("pInfo" ::: Ptr ())
-> IO Result
vkGetShaderInfoAMD'
                                                        Ptr Device_T
device'
                                                        (Pipeline
pipeline)
                                                        (ShaderStageFlagBits
shaderStage)
                                                        (ShaderInfoTypeAMD
infoType)
                                                        ("pInfoSize" ::: Ptr CSize
pPInfoSize)
                                                        ("pInfo" ::: Ptr ()
pPInfo))
  forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Result
r' forall a. Ord a => a -> a -> Bool
< Result
SUCCESS) (forall e a. Exception e => e -> IO a
throwIO (Result -> VulkanException
VulkanException Result
r'))
  CSize
pInfoSize'' <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> IO a
peek @CSize "pInfoSize" ::: Ptr CSize
pPInfoSize
  "info" ::: ByteString
pInfo' <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ CStringLen -> IO ("info" ::: ByteString)
packCStringLen  ( forall a b. Ptr a -> Ptr b
castPtr @() @CChar "pInfo" ::: Ptr ()
pPInfo
                                   , (forall a b. (Integral a, Num b) => a -> b
fromIntegral ((coerce :: forall a b. Coercible a b => a -> b
coerce @CSize @Word64 CSize
pInfoSize''))) )
  forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ ((Result
r'), "info" ::: ByteString
pInfo')


-- | VkShaderResourceUsageAMD - Resource usage information about a particular
-- shader within a pipeline
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_AMD_shader_info VK_AMD_shader_info>,
-- 'ShaderStatisticsInfoAMD'
data ShaderResourceUsageAMD = ShaderResourceUsageAMD
  { -- | @numUsedVgprs@ is the number of vector instruction general-purpose
    -- registers used by this shader.
    ShaderResourceUsageAMD -> Word32
numUsedVgprs :: Word32
  , -- | @numUsedSgprs@ is the number of scalar instruction general-purpose
    -- registers used by this shader.
    ShaderResourceUsageAMD -> Word32
numUsedSgprs :: Word32
  , -- | @ldsSizePerLocalWorkGroup@ is the maximum local data store size per work
    -- group in bytes.
    ShaderResourceUsageAMD -> Word32
ldsSizePerLocalWorkGroup :: Word32
  , -- | @ldsUsageSizeInBytes@ is the LDS usage size in bytes per work group by
    -- this shader.
    ShaderResourceUsageAMD -> Word64
ldsUsageSizeInBytes :: Word64
  , -- | @scratchMemUsageInBytes@ is the scratch memory usage in bytes by this
    -- shader.
    ShaderResourceUsageAMD -> Word64
scratchMemUsageInBytes :: Word64
  }
  deriving (Typeable, ShaderResourceUsageAMD -> ShaderResourceUsageAMD -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ShaderResourceUsageAMD -> ShaderResourceUsageAMD -> Bool
$c/= :: ShaderResourceUsageAMD -> ShaderResourceUsageAMD -> Bool
== :: ShaderResourceUsageAMD -> ShaderResourceUsageAMD -> Bool
$c== :: ShaderResourceUsageAMD -> ShaderResourceUsageAMD -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ShaderResourceUsageAMD)
#endif
deriving instance Show ShaderResourceUsageAMD

instance ToCStruct ShaderResourceUsageAMD where
  withCStruct :: forall b.
ShaderResourceUsageAMD
-> (Ptr ShaderResourceUsageAMD -> IO b) -> IO b
withCStruct ShaderResourceUsageAMD
x Ptr ShaderResourceUsageAMD -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
32 forall a b. (a -> b) -> a -> b
$ \Ptr ShaderResourceUsageAMD
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr ShaderResourceUsageAMD
p ShaderResourceUsageAMD
x (Ptr ShaderResourceUsageAMD -> IO b
f Ptr ShaderResourceUsageAMD
p)
  pokeCStruct :: forall b.
Ptr ShaderResourceUsageAMD
-> ShaderResourceUsageAMD -> IO b -> IO b
pokeCStruct Ptr ShaderResourceUsageAMD
p ShaderResourceUsageAMD{Word32
Word64
scratchMemUsageInBytes :: Word64
ldsUsageSizeInBytes :: Word64
ldsSizePerLocalWorkGroup :: Word32
numUsedSgprs :: Word32
numUsedVgprs :: Word32
$sel:scratchMemUsageInBytes:ShaderResourceUsageAMD :: ShaderResourceUsageAMD -> Word64
$sel:ldsUsageSizeInBytes:ShaderResourceUsageAMD :: ShaderResourceUsageAMD -> Word64
$sel:ldsSizePerLocalWorkGroup:ShaderResourceUsageAMD :: ShaderResourceUsageAMD -> Word32
$sel:numUsedSgprs:ShaderResourceUsageAMD :: ShaderResourceUsageAMD -> Word32
$sel:numUsedVgprs:ShaderResourceUsageAMD :: ShaderResourceUsageAMD -> Word32
..} IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderResourceUsageAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr Word32)) (Word32
numUsedVgprs)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderResourceUsageAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4 :: Ptr Word32)) (Word32
numUsedSgprs)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderResourceUsageAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr Word32)) (Word32
ldsSizePerLocalWorkGroup)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderResourceUsageAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr CSize)) (Word64 -> CSize
CSize (Word64
ldsUsageSizeInBytes))
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderResourceUsageAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr CSize)) (Word64 -> CSize
CSize (Word64
scratchMemUsageInBytes))
    IO b
f
  cStructSize :: Int
cStructSize = Int
32
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b. Ptr ShaderResourceUsageAMD -> IO b -> IO b
pokeZeroCStruct Ptr ShaderResourceUsageAMD
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderResourceUsageAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr Word32)) (forall a. Zero a => a
zero)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderResourceUsageAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4 :: Ptr Word32)) (forall a. Zero a => a
zero)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderResourceUsageAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr Word32)) (forall a. Zero a => a
zero)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderResourceUsageAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr CSize)) (Word64 -> CSize
CSize (forall a. Zero a => a
zero))
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderResourceUsageAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr CSize)) (Word64 -> CSize
CSize (forall a. Zero a => a
zero))
    IO b
f

instance FromCStruct ShaderResourceUsageAMD where
  peekCStruct :: Ptr ShaderResourceUsageAMD -> IO ShaderResourceUsageAMD
peekCStruct Ptr ShaderResourceUsageAMD
p = do
    Word32
numUsedVgprs <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr ShaderResourceUsageAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr Word32))
    Word32
numUsedSgprs <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr ShaderResourceUsageAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4 :: Ptr Word32))
    Word32
ldsSizePerLocalWorkGroup <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr ShaderResourceUsageAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr Word32))
    CSize
ldsUsageSizeInBytes <- forall a. Storable a => Ptr a -> IO a
peek @CSize ((Ptr ShaderResourceUsageAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr CSize))
    CSize
scratchMemUsageInBytes <- forall a. Storable a => Ptr a -> IO a
peek @CSize ((Ptr ShaderResourceUsageAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr CSize))
    forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Word32
-> Word32 -> Word32 -> Word64 -> Word64 -> ShaderResourceUsageAMD
ShaderResourceUsageAMD
             Word32
numUsedVgprs
             Word32
numUsedSgprs
             Word32
ldsSizePerLocalWorkGroup
             (coerce :: forall a b. Coercible a b => a -> b
coerce @CSize @Word64 CSize
ldsUsageSizeInBytes)
             (coerce :: forall a b. Coercible a b => a -> b
coerce @CSize @Word64 CSize
scratchMemUsageInBytes)

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

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


-- | VkShaderStatisticsInfoAMD - Statistical information about a particular
-- shader within a pipeline
--
-- = Description
--
-- Some implementations may merge multiple logical shader stages together
-- in a single shader. In such cases, @shaderStageMask@ will contain a
-- bitmask of all of the stages that are active within that shader.
-- Consequently, if specifying those stages as input to 'getShaderInfoAMD',
-- the same output information /may/ be returned for all such shader stage
-- queries.
--
-- The number of available VGPRs and SGPRs (@numAvailableVgprs@ and
-- @numAvailableSgprs@ respectively) are the shader-addressable subset of
-- physical registers that is given as a limit to the compiler for register
-- assignment. These values /may/ further be limited by implementations due
-- to performance optimizations where register pressure is a bottleneck.
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_AMD_shader_info VK_AMD_shader_info>,
-- 'ShaderResourceUsageAMD',
-- 'Vulkan.Core10.Enums.ShaderStageFlagBits.ShaderStageFlags'
data ShaderStatisticsInfoAMD = ShaderStatisticsInfoAMD
  { -- | @shaderStageMask@ are the combination of logical shader stages contained
    -- within this shader.
    ShaderStatisticsInfoAMD -> ShaderStageFlagBits
shaderStageMask :: ShaderStageFlags
  , -- | @resourceUsage@ is a 'ShaderResourceUsageAMD' structure describing
    -- internal physical device resources used by this shader.
    ShaderStatisticsInfoAMD -> ShaderResourceUsageAMD
resourceUsage :: ShaderResourceUsageAMD
  , -- | @numPhysicalVgprs@ is the maximum number of vector instruction
    -- general-purpose registers (VGPRs) available to the physical device.
    ShaderStatisticsInfoAMD -> Word32
numPhysicalVgprs :: Word32
  , -- | @numPhysicalSgprs@ is the maximum number of scalar instruction
    -- general-purpose registers (SGPRs) available to the physical device.
    ShaderStatisticsInfoAMD -> Word32
numPhysicalSgprs :: Word32
  , -- | @numAvailableVgprs@ is the maximum limit of VGPRs made available to the
    -- shader compiler.
    ShaderStatisticsInfoAMD -> Word32
numAvailableVgprs :: Word32
  , -- | @numAvailableSgprs@ is the maximum limit of SGPRs made available to the
    -- shader compiler.
    ShaderStatisticsInfoAMD -> Word32
numAvailableSgprs :: Word32
  , -- | @computeWorkGroupSize@ is the local workgroup size of this shader in {
    -- X, Y, Z } dimensions.
    ShaderStatisticsInfoAMD -> (Word32, Word32, Word32)
computeWorkGroupSize :: (Word32, Word32, Word32)
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ShaderStatisticsInfoAMD)
#endif
deriving instance Show ShaderStatisticsInfoAMD

instance ToCStruct ShaderStatisticsInfoAMD where
  withCStruct :: forall b.
ShaderStatisticsInfoAMD
-> (Ptr ShaderStatisticsInfoAMD -> IO b) -> IO b
withCStruct ShaderStatisticsInfoAMD
x Ptr ShaderStatisticsInfoAMD -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
72 forall a b. (a -> b) -> a -> b
$ \Ptr ShaderStatisticsInfoAMD
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr ShaderStatisticsInfoAMD
p ShaderStatisticsInfoAMD
x (Ptr ShaderStatisticsInfoAMD -> IO b
f Ptr ShaderStatisticsInfoAMD
p)
  pokeCStruct :: forall b.
Ptr ShaderStatisticsInfoAMD
-> ShaderStatisticsInfoAMD -> IO b -> IO b
pokeCStruct Ptr ShaderStatisticsInfoAMD
p ShaderStatisticsInfoAMD{Word32
(Word32, Word32, Word32)
ShaderStageFlagBits
ShaderResourceUsageAMD
computeWorkGroupSize :: (Word32, Word32, Word32)
numAvailableSgprs :: Word32
numAvailableVgprs :: Word32
numPhysicalSgprs :: Word32
numPhysicalVgprs :: Word32
resourceUsage :: ShaderResourceUsageAMD
shaderStageMask :: ShaderStageFlagBits
$sel:computeWorkGroupSize:ShaderStatisticsInfoAMD :: ShaderStatisticsInfoAMD -> (Word32, Word32, Word32)
$sel:numAvailableSgprs:ShaderStatisticsInfoAMD :: ShaderStatisticsInfoAMD -> Word32
$sel:numAvailableVgprs:ShaderStatisticsInfoAMD :: ShaderStatisticsInfoAMD -> Word32
$sel:numPhysicalSgprs:ShaderStatisticsInfoAMD :: ShaderStatisticsInfoAMD -> Word32
$sel:numPhysicalVgprs:ShaderStatisticsInfoAMD :: ShaderStatisticsInfoAMD -> Word32
$sel:resourceUsage:ShaderStatisticsInfoAMD :: ShaderStatisticsInfoAMD -> ShaderResourceUsageAMD
$sel:shaderStageMask:ShaderStatisticsInfoAMD :: ShaderStatisticsInfoAMD -> ShaderStageFlagBits
..} IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderStatisticsInfoAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr ShaderStageFlags)) (ShaderStageFlagBits
shaderStageMask)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderStatisticsInfoAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr ShaderResourceUsageAMD)) (ShaderResourceUsageAMD
resourceUsage)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderStatisticsInfoAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
40 :: Ptr Word32)) (Word32
numPhysicalVgprs)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderStatisticsInfoAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
44 :: Ptr Word32)) (Word32
numPhysicalSgprs)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderStatisticsInfoAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
48 :: Ptr Word32)) (Word32
numAvailableVgprs)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderStatisticsInfoAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
52 :: Ptr Word32)) (Word32
numAvailableSgprs)
    let pComputeWorkGroupSize' :: Ptr Word32
pComputeWorkGroupSize' = forall a (n :: Nat). Ptr (FixedArray n a) -> Ptr a
lowerArrayPtr ((Ptr ShaderStatisticsInfoAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
56 :: Ptr (FixedArray 3 Word32)))
    case ((Word32, Word32, Word32)
computeWorkGroupSize) of
      (Word32
e0, Word32
e1, Word32
e2) -> do
        forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word32
pComputeWorkGroupSize' :: Ptr Word32) (Word32
e0)
        forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word32
pComputeWorkGroupSize' forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4 :: Ptr Word32) (Word32
e1)
        forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word32
pComputeWorkGroupSize' forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr Word32) (Word32
e2)
    IO b
f
  cStructSize :: Int
cStructSize = Int
72
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b. Ptr ShaderStatisticsInfoAMD -> IO b -> IO b
pokeZeroCStruct Ptr ShaderStatisticsInfoAMD
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderStatisticsInfoAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr ShaderStageFlags)) (forall a. Zero a => a
zero)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderStatisticsInfoAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr ShaderResourceUsageAMD)) (forall a. Zero a => a
zero)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderStatisticsInfoAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
40 :: Ptr Word32)) (forall a. Zero a => a
zero)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderStatisticsInfoAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
44 :: Ptr Word32)) (forall a. Zero a => a
zero)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderStatisticsInfoAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
48 :: Ptr Word32)) (forall a. Zero a => a
zero)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderStatisticsInfoAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
52 :: Ptr Word32)) (forall a. Zero a => a
zero)
    let pComputeWorkGroupSize' :: Ptr Word32
pComputeWorkGroupSize' = forall a (n :: Nat). Ptr (FixedArray n a) -> Ptr a
lowerArrayPtr ((Ptr ShaderStatisticsInfoAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
56 :: Ptr (FixedArray 3 Word32)))
    case ((forall a. Zero a => a
zero, forall a. Zero a => a
zero, forall a. Zero a => a
zero)) of
      (Word32
e0, Word32
e1, Word32
e2) -> do
        forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word32
pComputeWorkGroupSize' :: Ptr Word32) (Word32
e0)
        forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word32
pComputeWorkGroupSize' forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4 :: Ptr Word32) (Word32
e1)
        forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word32
pComputeWorkGroupSize' forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr Word32) (Word32
e2)
    IO b
f

instance FromCStruct ShaderStatisticsInfoAMD where
  peekCStruct :: Ptr ShaderStatisticsInfoAMD -> IO ShaderStatisticsInfoAMD
peekCStruct Ptr ShaderStatisticsInfoAMD
p = do
    ShaderStageFlagBits
shaderStageMask <- forall a. Storable a => Ptr a -> IO a
peek @ShaderStageFlags ((Ptr ShaderStatisticsInfoAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr ShaderStageFlags))
    ShaderResourceUsageAMD
resourceUsage <- forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @ShaderResourceUsageAMD ((Ptr ShaderStatisticsInfoAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr ShaderResourceUsageAMD))
    Word32
numPhysicalVgprs <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr ShaderStatisticsInfoAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
40 :: Ptr Word32))
    Word32
numPhysicalSgprs <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr ShaderStatisticsInfoAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
44 :: Ptr Word32))
    Word32
numAvailableVgprs <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr ShaderStatisticsInfoAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
48 :: Ptr Word32))
    Word32
numAvailableSgprs <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr ShaderStatisticsInfoAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
52 :: Ptr Word32))
    let pcomputeWorkGroupSize :: Ptr Word32
pcomputeWorkGroupSize = forall a (n :: Nat). Ptr (FixedArray n a) -> Ptr a
lowerArrayPtr @Word32 ((Ptr ShaderStatisticsInfoAMD
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
56 :: Ptr (FixedArray 3 Word32)))
    Word32
computeWorkGroupSize0 <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr Word32
pcomputeWorkGroupSize forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` Int
0 :: Ptr Word32))
    Word32
computeWorkGroupSize1 <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr Word32
pcomputeWorkGroupSize forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` Int
4 :: Ptr Word32))
    Word32
computeWorkGroupSize2 <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr Word32
pcomputeWorkGroupSize forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` Int
8 :: Ptr Word32))
    forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ ShaderStageFlagBits
-> ShaderResourceUsageAMD
-> Word32
-> Word32
-> Word32
-> Word32
-> (Word32, Word32, Word32)
-> ShaderStatisticsInfoAMD
ShaderStatisticsInfoAMD
             ShaderStageFlagBits
shaderStageMask
             ShaderResourceUsageAMD
resourceUsage
             Word32
numPhysicalVgprs
             Word32
numPhysicalSgprs
             Word32
numAvailableVgprs
             Word32
numAvailableSgprs
             (( Word32
computeWorkGroupSize0
              , Word32
computeWorkGroupSize1
              , Word32
computeWorkGroupSize2 ))

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

instance Zero ShaderStatisticsInfoAMD where
  zero :: ShaderStatisticsInfoAMD
zero = ShaderStageFlagBits
-> ShaderResourceUsageAMD
-> Word32
-> Word32
-> Word32
-> Word32
-> (Word32, Word32, Word32)
-> ShaderStatisticsInfoAMD
ShaderStatisticsInfoAMD
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero
           (forall a. Zero a => a
zero, forall a. Zero a => a
zero, forall a. Zero a => a
zero)


-- | VkShaderInfoTypeAMD - Enum specifying which type of shader information
-- to query
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_AMD_shader_info VK_AMD_shader_info>,
-- 'getShaderInfoAMD'
newtype ShaderInfoTypeAMD = ShaderInfoTypeAMD Int32
  deriving newtype (ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> Bool
$c/= :: ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> Bool
== :: ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> Bool
$c== :: ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> Bool
Eq, Eq ShaderInfoTypeAMD
ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> Bool
ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> Ordering
ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> ShaderInfoTypeAMD
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> ShaderInfoTypeAMD
$cmin :: ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> ShaderInfoTypeAMD
max :: ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> ShaderInfoTypeAMD
$cmax :: ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> ShaderInfoTypeAMD
>= :: ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> Bool
$c>= :: ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> Bool
> :: ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> Bool
$c> :: ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> Bool
<= :: ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> Bool
$c<= :: ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> Bool
< :: ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> Bool
$c< :: ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> Bool
compare :: ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> Ordering
$ccompare :: ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> Ordering
Ord, Ptr ShaderInfoTypeAMD -> IO ShaderInfoTypeAMD
Ptr ShaderInfoTypeAMD -> Int -> IO ShaderInfoTypeAMD
Ptr ShaderInfoTypeAMD -> Int -> ShaderInfoTypeAMD -> IO ()
Ptr ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> IO ()
ShaderInfoTypeAMD -> Int
forall b. Ptr b -> Int -> IO ShaderInfoTypeAMD
forall b. Ptr b -> Int -> ShaderInfoTypeAMD -> IO ()
forall a.
(a -> Int)
-> (a -> Int)
-> (Ptr a -> Int -> IO a)
-> (Ptr a -> Int -> a -> IO ())
-> (forall b. Ptr b -> Int -> IO a)
-> (forall b. Ptr b -> Int -> a -> IO ())
-> (Ptr a -> IO a)
-> (Ptr a -> a -> IO ())
-> Storable a
poke :: Ptr ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> IO ()
$cpoke :: Ptr ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> IO ()
peek :: Ptr ShaderInfoTypeAMD -> IO ShaderInfoTypeAMD
$cpeek :: Ptr ShaderInfoTypeAMD -> IO ShaderInfoTypeAMD
pokeByteOff :: forall b. Ptr b -> Int -> ShaderInfoTypeAMD -> IO ()
$cpokeByteOff :: forall b. Ptr b -> Int -> ShaderInfoTypeAMD -> IO ()
peekByteOff :: forall b. Ptr b -> Int -> IO ShaderInfoTypeAMD
$cpeekByteOff :: forall b. Ptr b -> Int -> IO ShaderInfoTypeAMD
pokeElemOff :: Ptr ShaderInfoTypeAMD -> Int -> ShaderInfoTypeAMD -> IO ()
$cpokeElemOff :: Ptr ShaderInfoTypeAMD -> Int -> ShaderInfoTypeAMD -> IO ()
peekElemOff :: Ptr ShaderInfoTypeAMD -> Int -> IO ShaderInfoTypeAMD
$cpeekElemOff :: Ptr ShaderInfoTypeAMD -> Int -> IO ShaderInfoTypeAMD
alignment :: ShaderInfoTypeAMD -> Int
$calignment :: ShaderInfoTypeAMD -> Int
sizeOf :: ShaderInfoTypeAMD -> Int
$csizeOf :: ShaderInfoTypeAMD -> Int
Storable, ShaderInfoTypeAMD
forall a. a -> Zero a
zero :: ShaderInfoTypeAMD
$czero :: ShaderInfoTypeAMD
Zero)

-- | 'SHADER_INFO_TYPE_STATISTICS_AMD' specifies that device resources used
-- by a shader will be queried.
pattern $bSHADER_INFO_TYPE_STATISTICS_AMD :: ShaderInfoTypeAMD
$mSHADER_INFO_TYPE_STATISTICS_AMD :: forall {r}. ShaderInfoTypeAMD -> ((# #) -> r) -> ((# #) -> r) -> r
SHADER_INFO_TYPE_STATISTICS_AMD = ShaderInfoTypeAMD 0

-- | 'SHADER_INFO_TYPE_BINARY_AMD' specifies that implementation-specific
-- information will be queried.
pattern $bSHADER_INFO_TYPE_BINARY_AMD :: ShaderInfoTypeAMD
$mSHADER_INFO_TYPE_BINARY_AMD :: forall {r}. ShaderInfoTypeAMD -> ((# #) -> r) -> ((# #) -> r) -> r
SHADER_INFO_TYPE_BINARY_AMD = ShaderInfoTypeAMD 1

-- | 'SHADER_INFO_TYPE_DISASSEMBLY_AMD' specifies that human-readable
-- disassembly of a shader.
pattern $bSHADER_INFO_TYPE_DISASSEMBLY_AMD :: ShaderInfoTypeAMD
$mSHADER_INFO_TYPE_DISASSEMBLY_AMD :: forall {r}. ShaderInfoTypeAMD -> ((# #) -> r) -> ((# #) -> r) -> r
SHADER_INFO_TYPE_DISASSEMBLY_AMD = ShaderInfoTypeAMD 2

{-# COMPLETE
  SHADER_INFO_TYPE_STATISTICS_AMD
  , SHADER_INFO_TYPE_BINARY_AMD
  , SHADER_INFO_TYPE_DISASSEMBLY_AMD ::
    ShaderInfoTypeAMD
  #-}

conNameShaderInfoTypeAMD :: String
conNameShaderInfoTypeAMD :: String
conNameShaderInfoTypeAMD = String
"ShaderInfoTypeAMD"

enumPrefixShaderInfoTypeAMD :: String
enumPrefixShaderInfoTypeAMD :: String
enumPrefixShaderInfoTypeAMD = String
"SHADER_INFO_TYPE_"

showTableShaderInfoTypeAMD :: [(ShaderInfoTypeAMD, String)]
showTableShaderInfoTypeAMD :: [(ShaderInfoTypeAMD, String)]
showTableShaderInfoTypeAMD =
  [
    ( ShaderInfoTypeAMD
SHADER_INFO_TYPE_STATISTICS_AMD
    , String
"STATISTICS_AMD"
    )
  , (ShaderInfoTypeAMD
SHADER_INFO_TYPE_BINARY_AMD, String
"BINARY_AMD")
  ,
    ( ShaderInfoTypeAMD
SHADER_INFO_TYPE_DISASSEMBLY_AMD
    , String
"DISASSEMBLY_AMD"
    )
  ]

instance Show ShaderInfoTypeAMD where
  showsPrec :: Int -> ShaderInfoTypeAMD -> ShowS
showsPrec =
    forall a i.
Eq a =>
String
-> [(a, String)]
-> String
-> (a -> i)
-> (i -> ShowS)
-> Int
-> a
-> ShowS
enumShowsPrec
      String
enumPrefixShaderInfoTypeAMD
      [(ShaderInfoTypeAMD, String)]
showTableShaderInfoTypeAMD
      String
conNameShaderInfoTypeAMD
      (\(ShaderInfoTypeAMD Int32
x) -> Int32
x)
      (forall a. Show a => Int -> a -> ShowS
showsPrec Int
11)

instance Read ShaderInfoTypeAMD where
  readPrec :: ReadPrec ShaderInfoTypeAMD
readPrec =
    forall i a.
Read i =>
String -> [(a, String)] -> String -> (i -> a) -> ReadPrec a
enumReadPrec
      String
enumPrefixShaderInfoTypeAMD
      [(ShaderInfoTypeAMD, String)]
showTableShaderInfoTypeAMD
      String
conNameShaderInfoTypeAMD
      Int32 -> ShaderInfoTypeAMD
ShaderInfoTypeAMD

type AMD_SHADER_INFO_SPEC_VERSION = 1

-- No documentation found for TopLevel "VK_AMD_SHADER_INFO_SPEC_VERSION"
pattern AMD_SHADER_INFO_SPEC_VERSION :: forall a . Integral a => a
pattern $bAMD_SHADER_INFO_SPEC_VERSION :: forall a. Integral a => a
$mAMD_SHADER_INFO_SPEC_VERSION :: forall {r} {a}.
Integral a =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
AMD_SHADER_INFO_SPEC_VERSION = 1


type AMD_SHADER_INFO_EXTENSION_NAME = "VK_AMD_shader_info"

-- No documentation found for TopLevel "VK_AMD_SHADER_INFO_EXTENSION_NAME"
pattern AMD_SHADER_INFO_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bAMD_SHADER_INFO_EXTENSION_NAME :: forall a. (Eq a, IsString a) => a
$mAMD_SHADER_INFO_EXTENSION_NAME :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
AMD_SHADER_INFO_EXTENSION_NAME = "VK_AMD_shader_info"