{-# 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 Control.Exception.Base (bracket)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Foreign.Marshal.Alloc (allocaBytesAligned)
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.Read (choose)
import GHC.Read (expectP)
import GHC.Read (parens)
import GHC.Show (showParen)
import GHC.Show (showString)
import GHC.Show (showsPrec)
import Text.ParserCombinators.ReadPrec ((+++))
import Text.ParserCombinators.ReadPrec (prec)
import Text.ParserCombinators.ReadPrec (step)
import Data.ByteString (packCStringLen)
import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Cont (evalContT)
import Foreign.C.Types (CSize(..))
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(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 Data.Word (Word32)
import Data.Word (Word64)
import Text.Read.Lex (Lexeme(Ident))
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.Dynamic (DeviceCmds(pVkGetShaderInfoAMD))
import Vulkan.Core10.Handles (Device_T)
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
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.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Exception (VulkanException(..))
import Vulkan.Zero (Zero)
import Vulkan.Zero (Zero(..))
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 :: Device
-> Pipeline
-> ShaderStageFlagBits
-> ShaderInfoTypeAMD
-> io (Result, "info" ::: ByteString)
getShaderInfoAMD device :: Device
device pipeline :: Pipeline
pipeline shaderStage :: ShaderStageFlagBits
shaderStage infoType :: ShaderInfoTypeAMD
infoType = IO (Result, "info" ::: ByteString)
-> io (Result, "info" ::: ByteString)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Result, "info" ::: ByteString)
-> io (Result, "info" ::: ByteString))
-> (ContT
(Result, "info" ::: ByteString) IO (Result, "info" ::: ByteString)
-> IO (Result, "info" ::: ByteString))
-> ContT
(Result, "info" ::: ByteString) IO (Result, "info" ::: ByteString)
-> io (Result, "info" ::: ByteString)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT
(Result, "info" ::: ByteString) IO (Result, "info" ::: ByteString)
-> IO (Result, "info" ::: ByteString)
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT
(Result, "info" ::: ByteString) IO (Result, "info" ::: ByteString)
-> io (Result, "info" ::: ByteString))
-> ContT
(Result, "info" ::: ByteString) IO (Result, "info" ::: ByteString)
-> io (Result, "info" ::: ByteString)
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 (Device -> DeviceCmds
deviceCmds (Device
device :: Device))
IO () -> ContT (Result, "info" ::: ByteString) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT (Result, "info" ::: ByteString) IO ())
-> IO () -> ContT (Result, "info" ::: ByteString) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
(Ptr Device_T
-> Pipeline
-> ShaderStageFlagBits
-> ShaderInfoTypeAMD
-> ("pInfoSize" ::: Ptr CSize)
-> ("pInfo" ::: Ptr ())
-> IO Result)
vkGetShaderInfoAMDPtr FunPtr
(Ptr Device_T
-> Pipeline
-> ShaderStageFlagBits
-> ShaderInfoTypeAMD
-> ("pInfoSize" ::: Ptr CSize)
-> ("pInfo" ::: Ptr ())
-> IO Result)
-> FunPtr
(Ptr Device_T
-> Pipeline
-> ShaderStageFlagBits
-> ShaderInfoTypeAMD
-> ("pInfoSize" ::: Ptr CSize)
-> ("pInfo" ::: Ptr ())
-> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
(Ptr Device_T
-> Pipeline
-> ShaderStageFlagBits
-> ShaderInfoTypeAMD
-> ("pInfoSize" ::: Ptr CSize)
-> ("pInfo" ::: Ptr ())
-> IO Result)
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
IOException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument "" "The function pointer for vkGetShaderInfoAMD is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
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 <- ((("pInfoSize" ::: Ptr CSize)
-> IO (Result, "info" ::: ByteString))
-> IO (Result, "info" ::: ByteString))
-> ContT
(Result, "info" ::: ByteString) IO ("pInfoSize" ::: Ptr CSize)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pInfoSize" ::: Ptr CSize)
-> IO (Result, "info" ::: ByteString))
-> IO (Result, "info" ::: ByteString))
-> ContT
(Result, "info" ::: ByteString) IO ("pInfoSize" ::: Ptr CSize))
-> ((("pInfoSize" ::: Ptr CSize)
-> IO (Result, "info" ::: ByteString))
-> IO (Result, "info" ::: ByteString))
-> ContT
(Result, "info" ::: ByteString) IO ("pInfoSize" ::: Ptr CSize)
forall a b. (a -> b) -> a -> b
$ IO ("pInfoSize" ::: Ptr CSize)
-> (("pInfoSize" ::: Ptr CSize) -> IO ())
-> (("pInfoSize" ::: Ptr CSize)
-> IO (Result, "info" ::: ByteString))
-> IO (Result, "info" ::: ByteString)
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int -> IO ("pInfoSize" ::: Ptr CSize)
forall a. Int -> IO (Ptr a)
callocBytes @CSize 8) ("pInfoSize" ::: Ptr CSize) -> IO ()
forall a. Ptr a -> IO ()
free
Result
r <- IO Result -> ContT (Result, "info" ::: ByteString) IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result -> ContT (Result, "info" ::: ByteString) IO Result)
-> IO Result -> ContT (Result, "info" ::: ByteString) IO Result
forall a b. (a -> b) -> a -> b
$ 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 ()
forall a. Ptr a
nullPtr)
IO () -> ContT (Result, "info" ::: ByteString) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT (Result, "info" ::: ByteString) IO ())
-> IO () -> ContT (Result, "info" ::: ByteString) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Result
r Result -> Result -> Bool
forall a. Ord a => a -> a -> Bool
< Result
SUCCESS) (VulkanException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (Result -> VulkanException
VulkanException Result
r))
CSize
pInfoSize <- IO CSize -> ContT (Result, "info" ::: ByteString) IO CSize
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO CSize -> ContT (Result, "info" ::: ByteString) IO CSize)
-> IO CSize -> ContT (Result, "info" ::: ByteString) IO CSize
forall a b. (a -> b) -> a -> b
$ ("pInfoSize" ::: Ptr CSize) -> IO CSize
forall a. Storable a => Ptr a -> IO a
peek @CSize "pInfoSize" ::: Ptr CSize
pPInfoSize
"pInfo" ::: Ptr ()
pPInfo <- ((("pInfo" ::: Ptr ()) -> IO (Result, "info" ::: ByteString))
-> IO (Result, "info" ::: ByteString))
-> ContT (Result, "info" ::: ByteString) IO ("pInfo" ::: Ptr ())
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pInfo" ::: Ptr ()) -> IO (Result, "info" ::: ByteString))
-> IO (Result, "info" ::: ByteString))
-> ContT (Result, "info" ::: ByteString) IO ("pInfo" ::: Ptr ()))
-> ((("pInfo" ::: Ptr ()) -> IO (Result, "info" ::: ByteString))
-> IO (Result, "info" ::: ByteString))
-> ContT (Result, "info" ::: ByteString) IO ("pInfo" ::: Ptr ())
forall a b. (a -> b) -> a -> b
$ IO ("pInfo" ::: Ptr ())
-> (("pInfo" ::: Ptr ()) -> IO ())
-> (("pInfo" ::: Ptr ()) -> IO (Result, "info" ::: ByteString))
-> IO (Result, "info" ::: ByteString)
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int -> IO ("pInfo" ::: Ptr ())
forall a. Int -> IO (Ptr a)
callocBytes @(()) (Word64 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (((\(CSize a :: Word64
a) -> Word64
a) CSize
pInfoSize)))) ("pInfo" ::: Ptr ()) -> IO ()
forall a. Ptr a -> IO ()
free
Result
r' <- IO Result -> ContT (Result, "info" ::: ByteString) IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result -> ContT (Result, "info" ::: ByteString) IO Result)
-> IO Result -> ContT (Result, "info" ::: ByteString) IO Result
forall a b. (a -> b) -> a -> b
$ 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)
IO () -> ContT (Result, "info" ::: ByteString) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT (Result, "info" ::: ByteString) IO ())
-> IO () -> ContT (Result, "info" ::: ByteString) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Result
r' Result -> Result -> Bool
forall a. Ord a => a -> a -> Bool
< Result
SUCCESS) (VulkanException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (Result -> VulkanException
VulkanException Result
r'))
CSize
pInfoSize'' <- IO CSize -> ContT (Result, "info" ::: ByteString) IO CSize
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO CSize -> ContT (Result, "info" ::: ByteString) IO CSize)
-> IO CSize -> ContT (Result, "info" ::: ByteString) IO CSize
forall a b. (a -> b) -> a -> b
$ ("pInfoSize" ::: Ptr CSize) -> IO CSize
forall a. Storable a => Ptr a -> IO a
peek @CSize "pInfoSize" ::: Ptr CSize
pPInfoSize
"info" ::: ByteString
pInfo' <- IO ("info" ::: ByteString)
-> ContT (Result, "info" ::: ByteString) IO ("info" ::: ByteString)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ("info" ::: ByteString)
-> ContT
(Result, "info" ::: ByteString) IO ("info" ::: ByteString))
-> IO ("info" ::: ByteString)
-> ContT (Result, "info" ::: ByteString) IO ("info" ::: ByteString)
forall a b. (a -> b) -> a -> b
$ CStringLen -> IO ("info" ::: ByteString)
packCStringLen (("pInfo" ::: Ptr ()) -> Ptr CChar
forall a b. Ptr a -> Ptr b
castPtr @() @CChar "pInfo" ::: Ptr ()
pPInfo, (Word64 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (((\(CSize a :: Word64
a) -> Word64
a) CSize
pInfoSize''))))
(Result, "info" ::: ByteString)
-> ContT
(Result, "info" ::: ByteString) IO (Result, "info" ::: ByteString)
forall (f :: * -> *) a. Applicative f => a -> f a
pure ((Result, "info" ::: ByteString)
-> ContT
(Result, "info" ::: ByteString) IO (Result, "info" ::: ByteString))
-> (Result, "info" ::: ByteString)
-> ContT
(Result, "info" ::: ByteString) IO (Result, "info" ::: ByteString)
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
(ShaderResourceUsageAMD -> ShaderResourceUsageAMD -> Bool)
-> (ShaderResourceUsageAMD -> ShaderResourceUsageAMD -> Bool)
-> Eq ShaderResourceUsageAMD
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 :: ShaderResourceUsageAMD
-> (Ptr ShaderResourceUsageAMD -> IO b) -> IO b
withCStruct x :: ShaderResourceUsageAMD
x f :: Ptr ShaderResourceUsageAMD -> IO b
f = Int -> Int -> (Ptr ShaderResourceUsageAMD -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 32 8 ((Ptr ShaderResourceUsageAMD -> IO b) -> IO b)
-> (Ptr ShaderResourceUsageAMD -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr ShaderResourceUsageAMD
p -> Ptr ShaderResourceUsageAMD
-> ShaderResourceUsageAMD -> IO b -> IO b
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 :: Ptr ShaderResourceUsageAMD
-> ShaderResourceUsageAMD -> IO b -> IO b
pokeCStruct p :: Ptr ShaderResourceUsageAMD
p ShaderResourceUsageAMD{..} f :: IO b
f = do
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderResourceUsageAMD
p Ptr ShaderResourceUsageAMD -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr Word32)) (Word32
numUsedVgprs)
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderResourceUsageAMD
p Ptr ShaderResourceUsageAMD -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4 :: Ptr Word32)) (Word32
numUsedSgprs)
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderResourceUsageAMD
p Ptr ShaderResourceUsageAMD -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr Word32)) (Word32
ldsSizePerLocalWorkGroup)
("pInfoSize" ::: Ptr CSize) -> CSize -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderResourceUsageAMD
p Ptr ShaderResourceUsageAMD -> Int -> "pInfoSize" ::: Ptr CSize
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr CSize)) (Word64 -> CSize
CSize (Word64
ldsUsageSizeInBytes))
("pInfoSize" ::: Ptr CSize) -> CSize -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderResourceUsageAMD
p Ptr ShaderResourceUsageAMD -> Int -> "pInfoSize" ::: Ptr CSize
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr CSize)) (Word64 -> CSize
CSize (Word64
scratchMemUsageInBytes))
IO b
f
cStructSize :: Int
cStructSize = 32
cStructAlignment :: Int
cStructAlignment = 8
pokeZeroCStruct :: Ptr ShaderResourceUsageAMD -> IO b -> IO b
pokeZeroCStruct p :: Ptr ShaderResourceUsageAMD
p f :: IO b
f = do
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderResourceUsageAMD
p Ptr ShaderResourceUsageAMD -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderResourceUsageAMD
p Ptr ShaderResourceUsageAMD -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderResourceUsageAMD
p Ptr ShaderResourceUsageAMD -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
("pInfoSize" ::: Ptr CSize) -> CSize -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderResourceUsageAMD
p Ptr ShaderResourceUsageAMD -> Int -> "pInfoSize" ::: Ptr CSize
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr CSize)) (Word64 -> CSize
CSize (Word64
forall a. Zero a => a
zero))
("pInfoSize" ::: Ptr CSize) -> CSize -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderResourceUsageAMD
p Ptr ShaderResourceUsageAMD -> Int -> "pInfoSize" ::: Ptr CSize
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr CSize)) (Word64 -> CSize
CSize (Word64
forall a. Zero a => a
zero))
IO b
f
instance FromCStruct ShaderResourceUsageAMD where
peekCStruct :: Ptr ShaderResourceUsageAMD -> IO ShaderResourceUsageAMD
peekCStruct p :: Ptr ShaderResourceUsageAMD
p = do
Word32
numUsedVgprs <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr ShaderResourceUsageAMD
p Ptr ShaderResourceUsageAMD -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr Word32))
Word32
numUsedSgprs <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr ShaderResourceUsageAMD
p Ptr ShaderResourceUsageAMD -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4 :: Ptr Word32))
Word32
ldsSizePerLocalWorkGroup <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr ShaderResourceUsageAMD
p Ptr ShaderResourceUsageAMD -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr Word32))
CSize
ldsUsageSizeInBytes <- ("pInfoSize" ::: Ptr CSize) -> IO CSize
forall a. Storable a => Ptr a -> IO a
peek @CSize ((Ptr ShaderResourceUsageAMD
p Ptr ShaderResourceUsageAMD -> Int -> "pInfoSize" ::: Ptr CSize
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr CSize))
CSize
scratchMemUsageInBytes <- ("pInfoSize" ::: Ptr CSize) -> IO CSize
forall a. Storable a => Ptr a -> IO a
peek @CSize ((Ptr ShaderResourceUsageAMD
p Ptr ShaderResourceUsageAMD -> Int -> "pInfoSize" ::: Ptr CSize
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr CSize))
ShaderResourceUsageAMD -> IO ShaderResourceUsageAMD
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ShaderResourceUsageAMD -> IO ShaderResourceUsageAMD)
-> ShaderResourceUsageAMD -> IO ShaderResourceUsageAMD
forall a b. (a -> b) -> a -> b
$ Word32
-> Word32 -> Word32 -> Word64 -> Word64 -> ShaderResourceUsageAMD
ShaderResourceUsageAMD
Word32
numUsedVgprs Word32
numUsedSgprs Word32
ldsSizePerLocalWorkGroup ((\(CSize a :: Word64
a) -> Word64
a) CSize
ldsUsageSizeInBytes) ((\(CSize a :: Word64
a) -> Word64
a) CSize
scratchMemUsageInBytes)
instance Storable ShaderResourceUsageAMD where
sizeOf :: ShaderResourceUsageAMD -> Int
sizeOf ~ShaderResourceUsageAMD
_ = 32
alignment :: ShaderResourceUsageAMD -> Int
alignment ~ShaderResourceUsageAMD
_ = 8
peek :: Ptr ShaderResourceUsageAMD -> IO ShaderResourceUsageAMD
peek = Ptr ShaderResourceUsageAMD -> IO ShaderResourceUsageAMD
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: Ptr ShaderResourceUsageAMD -> ShaderResourceUsageAMD -> IO ()
poke ptr :: Ptr ShaderResourceUsageAMD
ptr poked :: ShaderResourceUsageAMD
poked = Ptr ShaderResourceUsageAMD
-> ShaderResourceUsageAMD -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr ShaderResourceUsageAMD
ptr ShaderResourceUsageAMD
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero ShaderResourceUsageAMD where
zero :: ShaderResourceUsageAMD
zero = Word32
-> Word32 -> Word32 -> Word64 -> Word64 -> ShaderResourceUsageAMD
ShaderResourceUsageAMD
Word32
forall a. Zero a => a
zero
Word32
forall a. Zero a => a
zero
Word32
forall a. Zero a => a
zero
Word64
forall a. Zero a => a
zero
Word64
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 :: ShaderStatisticsInfoAMD
-> (Ptr ShaderStatisticsInfoAMD -> IO b) -> IO b
withCStruct x :: ShaderStatisticsInfoAMD
x f :: Ptr ShaderStatisticsInfoAMD -> IO b
f = Int -> Int -> (Ptr ShaderStatisticsInfoAMD -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 72 8 ((Ptr ShaderStatisticsInfoAMD -> IO b) -> IO b)
-> (Ptr ShaderStatisticsInfoAMD -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr ShaderStatisticsInfoAMD
p -> Ptr ShaderStatisticsInfoAMD
-> ShaderStatisticsInfoAMD -> IO b -> IO b
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 :: Ptr ShaderStatisticsInfoAMD
-> ShaderStatisticsInfoAMD -> IO b -> IO b
pokeCStruct p :: Ptr ShaderStatisticsInfoAMD
p ShaderStatisticsInfoAMD{..} f :: IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr ShaderStageFlagBits -> ShaderStageFlagBits -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderStatisticsInfoAMD
p Ptr ShaderStatisticsInfoAMD -> Int -> Ptr ShaderStageFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr ShaderStageFlags)) (ShaderStageFlagBits
shaderStageMask)
((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr ShaderResourceUsageAMD
-> ShaderResourceUsageAMD -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct ((Ptr ShaderStatisticsInfoAMD
p Ptr ShaderStatisticsInfoAMD -> Int -> Ptr ShaderResourceUsageAMD
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr ShaderResourceUsageAMD)) (ShaderResourceUsageAMD
resourceUsage) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())
IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderStatisticsInfoAMD
p Ptr ShaderStatisticsInfoAMD -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 40 :: Ptr Word32)) (Word32
numPhysicalVgprs)
IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderStatisticsInfoAMD
p Ptr ShaderStatisticsInfoAMD -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 44 :: Ptr Word32)) (Word32
numPhysicalSgprs)
IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderStatisticsInfoAMD
p Ptr ShaderStatisticsInfoAMD -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 48 :: Ptr Word32)) (Word32
numAvailableVgprs)
IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderStatisticsInfoAMD
p Ptr ShaderStatisticsInfoAMD -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 52 :: Ptr Word32)) (Word32
numAvailableSgprs)
let pComputeWorkGroupSize' :: Ptr Word32
pComputeWorkGroupSize' = Ptr (FixedArray 3 Word32) -> Ptr Word32
forall a (n :: Nat). Ptr (FixedArray n a) -> Ptr a
lowerArrayPtr ((Ptr ShaderStatisticsInfoAMD
p Ptr ShaderStatisticsInfoAMD -> Int -> Ptr (FixedArray 3 Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 56 :: Ptr (FixedArray 3 Word32)))
IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ case ((Word32, Word32, Word32)
computeWorkGroupSize) of
(e0 :: Word32
e0, e1 :: Word32
e1, e2 :: Word32
e2) -> do
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word32
pComputeWorkGroupSize' :: Ptr Word32) (Word32
e0)
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word32
pComputeWorkGroupSize' Ptr Word32 -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4 :: Ptr Word32) (Word32
e1)
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word32
pComputeWorkGroupSize' Ptr Word32 -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr Word32) (Word32
e2)
IO b -> ContT b IO b
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO b -> ContT b IO b) -> IO b -> ContT b IO b
forall a b. (a -> b) -> a -> b
$ IO b
f
cStructSize :: Int
cStructSize = 72
cStructAlignment :: Int
cStructAlignment = 8
pokeZeroCStruct :: Ptr ShaderStatisticsInfoAMD -> IO b -> IO b
pokeZeroCStruct p :: Ptr ShaderStatisticsInfoAMD
p f :: IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr ShaderStageFlagBits -> ShaderStageFlagBits -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderStatisticsInfoAMD
p Ptr ShaderStatisticsInfoAMD -> Int -> Ptr ShaderStageFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr ShaderStageFlags)) (ShaderStageFlagBits
forall a. Zero a => a
zero)
((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr ShaderResourceUsageAMD
-> ShaderResourceUsageAMD -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct ((Ptr ShaderStatisticsInfoAMD
p Ptr ShaderStatisticsInfoAMD -> Int -> Ptr ShaderResourceUsageAMD
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr ShaderResourceUsageAMD)) (ShaderResourceUsageAMD
forall a. Zero a => a
zero) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())
IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderStatisticsInfoAMD
p Ptr ShaderStatisticsInfoAMD -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 40 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderStatisticsInfoAMD
p Ptr ShaderStatisticsInfoAMD -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 44 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderStatisticsInfoAMD
p Ptr ShaderStatisticsInfoAMD -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 48 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ShaderStatisticsInfoAMD
p Ptr ShaderStatisticsInfoAMD -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 52 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
let pComputeWorkGroupSize' :: Ptr Word32
pComputeWorkGroupSize' = Ptr (FixedArray 3 Word32) -> Ptr Word32
forall a (n :: Nat). Ptr (FixedArray n a) -> Ptr a
lowerArrayPtr ((Ptr ShaderStatisticsInfoAMD
p Ptr ShaderStatisticsInfoAMD -> Int -> Ptr (FixedArray 3 Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 56 :: Ptr (FixedArray 3 Word32)))
IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ case ((Word32
forall a. Zero a => a
zero, Word32
forall a. Zero a => a
zero, Word32
forall a. Zero a => a
zero)) of
(e0 :: Word32
e0, e1 :: Word32
e1, e2 :: Word32
e2) -> do
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word32
pComputeWorkGroupSize' :: Ptr Word32) (Word32
e0)
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word32
pComputeWorkGroupSize' Ptr Word32 -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4 :: Ptr Word32) (Word32
e1)
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word32
pComputeWorkGroupSize' Ptr Word32 -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr Word32) (Word32
e2)
IO b -> ContT b IO b
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO b -> ContT b IO b) -> IO b -> ContT b IO b
forall a b. (a -> b) -> a -> b
$ IO b
f
instance FromCStruct ShaderStatisticsInfoAMD where
peekCStruct :: Ptr ShaderStatisticsInfoAMD -> IO ShaderStatisticsInfoAMD
peekCStruct p :: Ptr ShaderStatisticsInfoAMD
p = do
ShaderStageFlagBits
shaderStageMask <- Ptr ShaderStageFlagBits -> IO ShaderStageFlagBits
forall a. Storable a => Ptr a -> IO a
peek @ShaderStageFlags ((Ptr ShaderStatisticsInfoAMD
p Ptr ShaderStatisticsInfoAMD -> Int -> Ptr ShaderStageFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr ShaderStageFlags))
ShaderResourceUsageAMD
resourceUsage <- Ptr ShaderResourceUsageAMD -> IO ShaderResourceUsageAMD
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @ShaderResourceUsageAMD ((Ptr ShaderStatisticsInfoAMD
p Ptr ShaderStatisticsInfoAMD -> Int -> Ptr ShaderResourceUsageAMD
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr ShaderResourceUsageAMD))
Word32
numPhysicalVgprs <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr ShaderStatisticsInfoAMD
p Ptr ShaderStatisticsInfoAMD -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 40 :: Ptr Word32))
Word32
numPhysicalSgprs <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr ShaderStatisticsInfoAMD
p Ptr ShaderStatisticsInfoAMD -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 44 :: Ptr Word32))
Word32
numAvailableVgprs <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr ShaderStatisticsInfoAMD
p Ptr ShaderStatisticsInfoAMD -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 48 :: Ptr Word32))
Word32
numAvailableSgprs <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr ShaderStatisticsInfoAMD
p Ptr ShaderStatisticsInfoAMD -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 52 :: Ptr Word32))
let pcomputeWorkGroupSize :: Ptr Word32
pcomputeWorkGroupSize = Ptr (FixedArray 3 Word32) -> Ptr Word32
forall a (n :: Nat). Ptr (FixedArray n a) -> Ptr a
lowerArrayPtr @Word32 ((Ptr ShaderStatisticsInfoAMD
p Ptr ShaderStatisticsInfoAMD -> Int -> Ptr (FixedArray 3 Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 56 :: Ptr (FixedArray 3 Word32)))
Word32
computeWorkGroupSize0 <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr Word32
pcomputeWorkGroupSize Ptr Word32 -> Int -> Ptr Word32
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` 0 :: Ptr Word32))
Word32
computeWorkGroupSize1 <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr Word32
pcomputeWorkGroupSize Ptr Word32 -> Int -> Ptr Word32
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` 4 :: Ptr Word32))
Word32
computeWorkGroupSize2 <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr Word32
pcomputeWorkGroupSize Ptr Word32 -> Int -> Ptr Word32
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` 8 :: Ptr Word32))
ShaderStatisticsInfoAMD -> IO ShaderStatisticsInfoAMD
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ShaderStatisticsInfoAMD -> IO ShaderStatisticsInfoAMD)
-> ShaderStatisticsInfoAMD -> IO ShaderStatisticsInfoAMD
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 Zero ShaderStatisticsInfoAMD where
zero :: ShaderStatisticsInfoAMD
zero = ShaderStageFlagBits
-> ShaderResourceUsageAMD
-> Word32
-> Word32
-> Word32
-> Word32
-> (Word32, Word32, Word32)
-> ShaderStatisticsInfoAMD
ShaderStatisticsInfoAMD
ShaderStageFlagBits
forall a. Zero a => a
zero
ShaderResourceUsageAMD
forall a. Zero a => a
zero
Word32
forall a. Zero a => a
zero
Word32
forall a. Zero a => a
zero
Word32
forall a. Zero a => a
zero
Word32
forall a. Zero a => a
zero
(Word32
forall a. Zero a => a
zero, Word32
forall a. Zero a => a
zero, Word32
forall a. Zero a => a
zero)
newtype ShaderInfoTypeAMD = ShaderInfoTypeAMD Int32
deriving newtype (ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> Bool
(ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> Bool)
-> (ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> Bool)
-> Eq ShaderInfoTypeAMD
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
Eq ShaderInfoTypeAMD =>
(ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> Ordering)
-> (ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> Bool)
-> (ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> Bool)
-> (ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> Bool)
-> (ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> Bool)
-> (ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> ShaderInfoTypeAMD)
-> (ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> ShaderInfoTypeAMD)
-> Ord 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
$cp1Ord :: Eq ShaderInfoTypeAMD
Ord, Ptr b -> Int -> IO ShaderInfoTypeAMD
Ptr b -> Int -> ShaderInfoTypeAMD -> IO ()
Ptr ShaderInfoTypeAMD -> IO ShaderInfoTypeAMD
Ptr ShaderInfoTypeAMD -> Int -> IO ShaderInfoTypeAMD
Ptr ShaderInfoTypeAMD -> Int -> ShaderInfoTypeAMD -> IO ()
Ptr ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> IO ()
ShaderInfoTypeAMD -> Int
(ShaderInfoTypeAMD -> Int)
-> (ShaderInfoTypeAMD -> Int)
-> (Ptr ShaderInfoTypeAMD -> Int -> IO ShaderInfoTypeAMD)
-> (Ptr ShaderInfoTypeAMD -> Int -> ShaderInfoTypeAMD -> IO ())
-> (forall b. Ptr b -> Int -> IO ShaderInfoTypeAMD)
-> (forall b. Ptr b -> Int -> ShaderInfoTypeAMD -> IO ())
-> (Ptr ShaderInfoTypeAMD -> IO ShaderInfoTypeAMD)
-> (Ptr ShaderInfoTypeAMD -> ShaderInfoTypeAMD -> IO ())
-> Storable ShaderInfoTypeAMD
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 :: Ptr b -> Int -> ShaderInfoTypeAMD -> IO ()
$cpokeByteOff :: forall b. Ptr b -> Int -> ShaderInfoTypeAMD -> IO ()
peekByteOff :: 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
ShaderInfoTypeAMD -> Zero 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 -> (Void# -> r) -> (Void# -> r) -> r
SHADER_INFO_TYPE_STATISTICS_AMD = ShaderInfoTypeAMD 0
pattern $bSHADER_INFO_TYPE_BINARY_AMD :: ShaderInfoTypeAMD
$mSHADER_INFO_TYPE_BINARY_AMD :: forall r. ShaderInfoTypeAMD -> (Void# -> r) -> (Void# -> r) -> r
SHADER_INFO_TYPE_BINARY_AMD = ShaderInfoTypeAMD 1
pattern $bSHADER_INFO_TYPE_DISASSEMBLY_AMD :: ShaderInfoTypeAMD
$mSHADER_INFO_TYPE_DISASSEMBLY_AMD :: forall r. ShaderInfoTypeAMD -> (Void# -> r) -> (Void# -> 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 #-}
instance Show ShaderInfoTypeAMD where
showsPrec :: Int -> ShaderInfoTypeAMD -> ShowS
showsPrec p :: Int
p = \case
SHADER_INFO_TYPE_STATISTICS_AMD -> String -> ShowS
showString "SHADER_INFO_TYPE_STATISTICS_AMD"
SHADER_INFO_TYPE_BINARY_AMD -> String -> ShowS
showString "SHADER_INFO_TYPE_BINARY_AMD"
SHADER_INFO_TYPE_DISASSEMBLY_AMD -> String -> ShowS
showString "SHADER_INFO_TYPE_DISASSEMBLY_AMD"
ShaderInfoTypeAMD x :: Int32
x -> Bool -> ShowS -> ShowS
showParen (Int
p Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= 11) (String -> ShowS
showString "ShaderInfoTypeAMD " ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Int32 -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec 11 Int32
x)
instance Read ShaderInfoTypeAMD where
readPrec :: ReadPrec ShaderInfoTypeAMD
readPrec = ReadPrec ShaderInfoTypeAMD -> ReadPrec ShaderInfoTypeAMD
forall a. ReadPrec a -> ReadPrec a
parens ([(String, ReadPrec ShaderInfoTypeAMD)]
-> ReadPrec ShaderInfoTypeAMD
forall a. [(String, ReadPrec a)] -> ReadPrec a
choose [("SHADER_INFO_TYPE_STATISTICS_AMD", ShaderInfoTypeAMD -> ReadPrec ShaderInfoTypeAMD
forall (f :: * -> *) a. Applicative f => a -> f a
pure ShaderInfoTypeAMD
SHADER_INFO_TYPE_STATISTICS_AMD)
, ("SHADER_INFO_TYPE_BINARY_AMD", ShaderInfoTypeAMD -> ReadPrec ShaderInfoTypeAMD
forall (f :: * -> *) a. Applicative f => a -> f a
pure ShaderInfoTypeAMD
SHADER_INFO_TYPE_BINARY_AMD)
, ("SHADER_INFO_TYPE_DISASSEMBLY_AMD", ShaderInfoTypeAMD -> ReadPrec ShaderInfoTypeAMD
forall (f :: * -> *) a. Applicative f => a -> f a
pure ShaderInfoTypeAMD
SHADER_INFO_TYPE_DISASSEMBLY_AMD)]
ReadPrec ShaderInfoTypeAMD
-> ReadPrec ShaderInfoTypeAMD -> ReadPrec ShaderInfoTypeAMD
forall a. ReadPrec a -> ReadPrec a -> ReadPrec a
+++
Int -> ReadPrec ShaderInfoTypeAMD -> ReadPrec ShaderInfoTypeAMD
forall a. Int -> ReadPrec a -> ReadPrec a
prec 10 (do
Lexeme -> ReadPrec ()
expectP (String -> Lexeme
Ident "ShaderInfoTypeAMD")
Int32
v <- ReadPrec Int32 -> ReadPrec Int32
forall a. ReadPrec a -> ReadPrec a
step ReadPrec Int32
forall a. Read a => ReadPrec a
readPrec
ShaderInfoTypeAMD -> ReadPrec ShaderInfoTypeAMD
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Int32 -> ShaderInfoTypeAMD
ShaderInfoTypeAMD Int32
v)))
type AMD_SHADER_INFO_SPEC_VERSION = 1
pattern AMD_SHADER_INFO_SPEC_VERSION :: forall a . Integral a => a
pattern $bAMD_SHADER_INFO_SPEC_VERSION :: a
$mAMD_SHADER_INFO_SPEC_VERSION :: forall r a. Integral a => a -> (Void# -> r) -> (Void# -> 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 :: a
$mAMD_SHADER_INFO_EXTENSION_NAME :: forall r a.
(Eq a, IsString a) =>
a -> (Void# -> r) -> (Void# -> r) -> r
AMD_SHADER_INFO_EXTENSION_NAME = "VK_AMD_shader_info"