{-# language CPP #-}
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
getShaderInfoAMD :: forall io
. (MonadIO io)
=>
Device
->
Pipeline
->
ShaderStageFlagBits
->
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')
data ShaderResourceUsageAMD = ShaderResourceUsageAMD
{
ShaderResourceUsageAMD -> Word32
numUsedVgprs :: Word32
,
ShaderResourceUsageAMD -> Word32
numUsedSgprs :: Word32
,
ShaderResourceUsageAMD -> Word32
ldsSizePerLocalWorkGroup :: Word32
,
ShaderResourceUsageAMD -> Word64
ldsUsageSizeInBytes :: Word64
,
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
data ShaderStatisticsInfoAMD = ShaderStatisticsInfoAMD
{
ShaderStatisticsInfoAMD -> ShaderStageFlagBits
shaderStageMask :: ShaderStageFlags
,
ShaderStatisticsInfoAMD -> ShaderResourceUsageAMD
resourceUsage :: ShaderResourceUsageAMD
,
ShaderStatisticsInfoAMD -> Word32
numPhysicalVgprs :: Word32
,
ShaderStatisticsInfoAMD -> Word32
numPhysicalSgprs :: Word32
,
ShaderStatisticsInfoAMD -> Word32
numAvailableVgprs :: Word32
,
ShaderStatisticsInfoAMD -> Word32
numAvailableSgprs :: Word32
,
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)
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)
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
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
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
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"
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"