{-# language CPP #-}
module Vulkan.Core13.Promoted_From_VK_EXT_tooling_info ( getPhysicalDeviceToolProperties
, PhysicalDeviceToolProperties(..)
, StructureType(..)
, ToolPurposeFlagBits(..)
, ToolPurposeFlags
) where
import Vulkan.CStruct.Utils (FixedArray)
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 (nullFunPtr)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import Data.ByteString (packCString)
import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Cont (evalContT)
import Data.Vector (generateM)
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Zero (Zero(..))
import Control.Monad.IO.Class (MonadIO)
import Data.Typeable (Typeable)
import Foreign.C.Types (CChar)
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 Foreign.Ptr (FunPtr)
import Foreign.Ptr (Ptr)
import Data.Word (Word32)
import Data.ByteString (ByteString)
import Data.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Data.Vector (Vector)
import Vulkan.CStruct.Utils (advancePtrBytes)
import Vulkan.CStruct.Utils (lowerArrayPtr)
import Vulkan.CStruct.Utils (pokeFixedLengthNullTerminatedByteString)
import Vulkan.NamedType ((:::))
import Vulkan.Dynamic (InstanceCmds(pVkGetPhysicalDeviceToolProperties))
import Vulkan.Core10.APIConstants (MAX_DESCRIPTION_SIZE)
import Vulkan.Core10.APIConstants (MAX_EXTENSION_NAME_SIZE)
import Vulkan.Core10.Handles (PhysicalDevice)
import Vulkan.Core10.Handles (PhysicalDevice(..))
import Vulkan.Core10.Handles (PhysicalDevice(PhysicalDevice))
import Vulkan.Core10.Handles (PhysicalDevice_T)
import Vulkan.Core10.Enums.Result (Result)
import Vulkan.Core10.Enums.Result (Result(..))
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Core13.Enums.ToolPurposeFlagBits (ToolPurposeFlags)
import Vulkan.Exception (VulkanException(..))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_TOOL_PROPERTIES))
import Vulkan.Core10.Enums.Result (Result(SUCCESS))
import Vulkan.Core10.Enums.StructureType (StructureType(..))
import Vulkan.Core13.Enums.ToolPurposeFlagBits (ToolPurposeFlagBits(..))
import Vulkan.Core13.Enums.ToolPurposeFlagBits (ToolPurposeFlags)
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkGetPhysicalDeviceToolProperties
:: FunPtr (Ptr PhysicalDevice_T -> Ptr Word32 -> Ptr PhysicalDeviceToolProperties -> IO Result) -> Ptr PhysicalDevice_T -> Ptr Word32 -> Ptr PhysicalDeviceToolProperties -> IO Result
getPhysicalDeviceToolProperties :: forall io
. (MonadIO io)
=>
PhysicalDevice
-> io (Result, ("toolProperties" ::: Vector PhysicalDeviceToolProperties))
getPhysicalDeviceToolProperties :: forall (io :: * -> *).
MonadIO io =>
PhysicalDevice
-> io
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
getPhysicalDeviceToolProperties PhysicalDevice
physicalDevice = IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
-> io
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
-> io
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties))
-> (ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
-> IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties))
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
-> io
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
-> IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
-> io
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties))
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
-> io
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
forall a b. (a -> b) -> a -> b
$ do
let vkGetPhysicalDeviceToolPropertiesPtr :: FunPtr
(Ptr PhysicalDevice_T
-> ("pToolCount" ::: Ptr Word32)
-> ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> IO Result)
vkGetPhysicalDeviceToolPropertiesPtr = InstanceCmds
-> FunPtr
(Ptr PhysicalDevice_T
-> ("pToolCount" ::: Ptr Word32)
-> ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> IO Result)
pVkGetPhysicalDeviceToolProperties (case PhysicalDevice
physicalDevice of PhysicalDevice{InstanceCmds
$sel:instanceCmds:PhysicalDevice :: PhysicalDevice -> InstanceCmds
instanceCmds :: InstanceCmds
instanceCmds} -> InstanceCmds
instanceCmds)
IO ()
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ()
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
())
-> IO ()
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
(Ptr PhysicalDevice_T
-> ("pToolCount" ::: Ptr Word32)
-> ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> IO Result)
vkGetPhysicalDeviceToolPropertiesPtr FunPtr
(Ptr PhysicalDevice_T
-> ("pToolCount" ::: Ptr Word32)
-> ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> IO Result)
-> FunPtr
(Ptr PhysicalDevice_T
-> ("pToolCount" ::: Ptr Word32)
-> ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
(Ptr PhysicalDevice_T
-> ("pToolCount" ::: Ptr Word32)
-> ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> 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 String
"" String
"The function pointer for vkGetPhysicalDeviceToolProperties is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
let vkGetPhysicalDeviceToolProperties' :: Ptr PhysicalDevice_T
-> ("pToolCount" ::: Ptr Word32)
-> ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> IO Result
vkGetPhysicalDeviceToolProperties' = FunPtr
(Ptr PhysicalDevice_T
-> ("pToolCount" ::: Ptr Word32)
-> ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> IO Result)
-> Ptr PhysicalDevice_T
-> ("pToolCount" ::: Ptr Word32)
-> ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> IO Result
mkVkGetPhysicalDeviceToolProperties FunPtr
(Ptr PhysicalDevice_T
-> ("pToolCount" ::: Ptr Word32)
-> ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> IO Result)
vkGetPhysicalDeviceToolPropertiesPtr
let physicalDevice' :: Ptr PhysicalDevice_T
physicalDevice' = PhysicalDevice -> Ptr PhysicalDevice_T
physicalDeviceHandle (PhysicalDevice
physicalDevice)
"pToolCount" ::: Ptr Word32
pPToolCount <- ((("pToolCount" ::: Ptr Word32)
-> IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties))
-> IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties))
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
("pToolCount" ::: Ptr Word32)
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pToolCount" ::: Ptr Word32)
-> IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties))
-> IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties))
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
("pToolCount" ::: Ptr Word32))
-> ((("pToolCount" ::: Ptr Word32)
-> IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties))
-> IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties))
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
("pToolCount" ::: Ptr Word32)
forall a b. (a -> b) -> a -> b
$ IO ("pToolCount" ::: Ptr Word32)
-> (("pToolCount" ::: Ptr Word32) -> IO ())
-> (("pToolCount" ::: Ptr Word32)
-> IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties))
-> IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (forall a. Int -> IO (Ptr a)
callocBytes @Word32 Int
4) ("pToolCount" ::: Ptr Word32) -> IO ()
forall a. Ptr a -> IO ()
free
Result
r <- IO Result
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
Result)
-> IO Result
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent String
"vkGetPhysicalDeviceToolProperties" (Ptr PhysicalDevice_T
-> ("pToolCount" ::: Ptr Word32)
-> ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> IO Result
vkGetPhysicalDeviceToolProperties'
Ptr PhysicalDevice_T
physicalDevice'
("pToolCount" ::: Ptr Word32
pPToolCount)
("pToolProperties" ::: Ptr PhysicalDeviceToolProperties
forall a. Ptr a
nullPtr))
IO ()
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ()
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
())
-> IO ()
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
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))
Word32
pToolCount <- IO Word32
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
Word32
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Word32
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
Word32)
-> IO Word32
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
Word32
forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> IO a
peek @Word32 "pToolCount" ::: Ptr Word32
pPToolCount
"pToolProperties" ::: Ptr PhysicalDeviceToolProperties
pPToolProperties <- ((("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties))
-> IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties))
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties))
-> IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties))
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
("pToolProperties" ::: Ptr PhysicalDeviceToolProperties))
-> ((("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties))
-> IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties))
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
forall a b. (a -> b) -> a -> b
$ IO ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> (("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> IO ())
-> (("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties))
-> IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (forall a. Int -> IO (Ptr a)
callocBytes @PhysicalDeviceToolProperties ((Word32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32
pToolCount)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
1048)) ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties) -> IO ()
forall a. Ptr a -> IO ()
free
[()]
_ <- (Int
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
())
-> [Int]
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
[()]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse (\Int
i -> ((()
-> IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties))
-> IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties))
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
()
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((()
-> IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties))
-> IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties))
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
())
-> ((()
-> IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties))
-> IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties))
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
()
forall a b. (a -> b) -> a -> b
$ ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
-> IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
forall a b. ToCStruct a => Ptr a -> IO b -> IO b
pokeZeroCStruct ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties
pPToolProperties ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> Int -> "pToolProperties" ::: Ptr PhysicalDeviceToolProperties
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
i Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
1048) :: Ptr PhysicalDeviceToolProperties) (IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
-> IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties))
-> ((()
-> IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties))
-> IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties))
-> (()
-> IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties))
-> IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((()
-> IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties))
-> ()
-> IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
forall a b. (a -> b) -> a -> b
$ ())) [Int
0..(Word32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32
pToolCount)) Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1]
Result
r' <- IO Result
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
Result)
-> IO Result
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent String
"vkGetPhysicalDeviceToolProperties" (Ptr PhysicalDevice_T
-> ("pToolCount" ::: Ptr Word32)
-> ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> IO Result
vkGetPhysicalDeviceToolProperties'
Ptr PhysicalDevice_T
physicalDevice'
("pToolCount" ::: Ptr Word32
pPToolCount)
(("pToolProperties" ::: Ptr PhysicalDeviceToolProperties
pPToolProperties)))
IO ()
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ()
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
())
-> IO ()
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
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'))
Word32
pToolCount' <- IO Word32
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
Word32
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Word32
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
Word32)
-> IO Word32
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
Word32
forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> IO a
peek @Word32 "pToolCount" ::: Ptr Word32
pPToolCount
"toolProperties" ::: Vector PhysicalDeviceToolProperties
pToolProperties' <- IO ("toolProperties" ::: Vector PhysicalDeviceToolProperties)
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
("toolProperties" ::: Vector PhysicalDeviceToolProperties)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ("toolProperties" ::: Vector PhysicalDeviceToolProperties)
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
("toolProperties" ::: Vector PhysicalDeviceToolProperties))
-> IO ("toolProperties" ::: Vector PhysicalDeviceToolProperties)
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
("toolProperties" ::: Vector PhysicalDeviceToolProperties)
forall a b. (a -> b) -> a -> b
$ Int
-> (Int -> IO PhysicalDeviceToolProperties)
-> IO ("toolProperties" ::: Vector PhysicalDeviceToolProperties)
forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM (Word32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32
pToolCount')) (\Int
i -> forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @PhysicalDeviceToolProperties ((("pToolProperties" ::: Ptr PhysicalDeviceToolProperties
pPToolProperties) ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> Int -> "pToolProperties" ::: Ptr PhysicalDeviceToolProperties
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
1048 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr PhysicalDeviceToolProperties)))
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
forall (f :: * -> *) a. Applicative f => a -> f a
pure ((Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties))
-> (Result,
"toolProperties" ::: Vector PhysicalDeviceToolProperties)
-> ContT
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
IO
(Result, "toolProperties" ::: Vector PhysicalDeviceToolProperties)
forall a b. (a -> b) -> a -> b
$ ((Result
r'), "toolProperties" ::: Vector PhysicalDeviceToolProperties
pToolProperties')
data PhysicalDeviceToolProperties = PhysicalDeviceToolProperties
{
PhysicalDeviceToolProperties -> ByteString
name :: ByteString
,
PhysicalDeviceToolProperties -> ByteString
version :: ByteString
,
PhysicalDeviceToolProperties -> ToolPurposeFlags
purposes :: ToolPurposeFlags
,
PhysicalDeviceToolProperties -> ByteString
description :: ByteString
,
PhysicalDeviceToolProperties -> ByteString
layer :: ByteString
}
deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceToolProperties)
#endif
deriving instance Show PhysicalDeviceToolProperties
instance ToCStruct PhysicalDeviceToolProperties where
withCStruct :: forall b.
PhysicalDeviceToolProperties
-> (("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> IO b)
-> IO b
withCStruct PhysicalDeviceToolProperties
x ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties) -> IO b
f = Int
-> (("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> IO b)
-> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
1048 ((("pToolProperties" ::: Ptr PhysicalDeviceToolProperties) -> IO b)
-> IO b)
-> (("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> IO b)
-> IO b
forall a b. (a -> b) -> a -> b
$ \"pToolProperties" ::: Ptr PhysicalDeviceToolProperties
p -> ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> PhysicalDeviceToolProperties -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pToolProperties" ::: Ptr PhysicalDeviceToolProperties
p PhysicalDeviceToolProperties
x (("pToolProperties" ::: Ptr PhysicalDeviceToolProperties) -> IO b
f "pToolProperties" ::: Ptr PhysicalDeviceToolProperties
p)
pokeCStruct :: forall b.
("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> PhysicalDeviceToolProperties -> IO b -> IO b
pokeCStruct "pToolProperties" ::: Ptr PhysicalDeviceToolProperties
p PhysicalDeviceToolProperties{ByteString
ToolPurposeFlags
layer :: ByteString
description :: ByteString
purposes :: ToolPurposeFlags
version :: ByteString
name :: ByteString
$sel:layer:PhysicalDeviceToolProperties :: PhysicalDeviceToolProperties -> ByteString
$sel:description:PhysicalDeviceToolProperties :: PhysicalDeviceToolProperties -> ByteString
$sel:purposes:PhysicalDeviceToolProperties :: PhysicalDeviceToolProperties -> ToolPurposeFlags
$sel:version:PhysicalDeviceToolProperties :: PhysicalDeviceToolProperties -> ByteString
$sel:name:PhysicalDeviceToolProperties :: PhysicalDeviceToolProperties -> ByteString
..} IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pToolProperties" ::: Ptr PhysicalDeviceToolProperties
p ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_TOOL_PROPERTIES)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pToolProperties" ::: Ptr PhysicalDeviceToolProperties
p ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
Ptr (FixedArray MAX_EXTENSION_NAME_SIZE CChar)
-> ByteString -> IO ()
forall (n :: Nat).
KnownNat n =>
Ptr (FixedArray n CChar) -> ByteString -> IO ()
pokeFixedLengthNullTerminatedByteString (("pToolProperties" ::: Ptr PhysicalDeviceToolProperties
p ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> Int -> Ptr (FixedArray MAX_EXTENSION_NAME_SIZE CChar)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr (FixedArray MAX_EXTENSION_NAME_SIZE CChar))) (ByteString
name)
Ptr (FixedArray MAX_EXTENSION_NAME_SIZE CChar)
-> ByteString -> IO ()
forall (n :: Nat).
KnownNat n =>
Ptr (FixedArray n CChar) -> ByteString -> IO ()
pokeFixedLengthNullTerminatedByteString (("pToolProperties" ::: Ptr PhysicalDeviceToolProperties
p ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> Int -> Ptr (FixedArray MAX_EXTENSION_NAME_SIZE CChar)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
272 :: Ptr (FixedArray MAX_EXTENSION_NAME_SIZE CChar))) (ByteString
version)
Ptr ToolPurposeFlags -> ToolPurposeFlags -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pToolProperties" ::: Ptr PhysicalDeviceToolProperties
p ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> Int -> Ptr ToolPurposeFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
528 :: Ptr ToolPurposeFlags)) (ToolPurposeFlags
purposes)
Ptr (FixedArray MAX_EXTENSION_NAME_SIZE CChar)
-> ByteString -> IO ()
forall (n :: Nat).
KnownNat n =>
Ptr (FixedArray n CChar) -> ByteString -> IO ()
pokeFixedLengthNullTerminatedByteString (("pToolProperties" ::: Ptr PhysicalDeviceToolProperties
p ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> Int -> Ptr (FixedArray MAX_EXTENSION_NAME_SIZE CChar)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
532 :: Ptr (FixedArray MAX_DESCRIPTION_SIZE CChar))) (ByteString
description)
Ptr (FixedArray MAX_EXTENSION_NAME_SIZE CChar)
-> ByteString -> IO ()
forall (n :: Nat).
KnownNat n =>
Ptr (FixedArray n CChar) -> ByteString -> IO ()
pokeFixedLengthNullTerminatedByteString (("pToolProperties" ::: Ptr PhysicalDeviceToolProperties
p ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> Int -> Ptr (FixedArray MAX_EXTENSION_NAME_SIZE CChar)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
788 :: Ptr (FixedArray MAX_EXTENSION_NAME_SIZE CChar))) (ByteString
layer)
IO b
f
cStructSize :: Int
cStructSize = Int
1048
cStructAlignment :: Int
cStructAlignment = Int
8
pokeZeroCStruct :: forall b.
("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> IO b -> IO b
pokeZeroCStruct "pToolProperties" ::: Ptr PhysicalDeviceToolProperties
p IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pToolProperties" ::: Ptr PhysicalDeviceToolProperties
p ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_TOOL_PROPERTIES)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pToolProperties" ::: Ptr PhysicalDeviceToolProperties
p ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
Ptr (FixedArray MAX_EXTENSION_NAME_SIZE CChar)
-> ByteString -> IO ()
forall (n :: Nat).
KnownNat n =>
Ptr (FixedArray n CChar) -> ByteString -> IO ()
pokeFixedLengthNullTerminatedByteString (("pToolProperties" ::: Ptr PhysicalDeviceToolProperties
p ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> Int -> Ptr (FixedArray MAX_EXTENSION_NAME_SIZE CChar)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr (FixedArray MAX_EXTENSION_NAME_SIZE CChar))) (ByteString
forall a. Monoid a => a
mempty)
Ptr (FixedArray MAX_EXTENSION_NAME_SIZE CChar)
-> ByteString -> IO ()
forall (n :: Nat).
KnownNat n =>
Ptr (FixedArray n CChar) -> ByteString -> IO ()
pokeFixedLengthNullTerminatedByteString (("pToolProperties" ::: Ptr PhysicalDeviceToolProperties
p ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> Int -> Ptr (FixedArray MAX_EXTENSION_NAME_SIZE CChar)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
272 :: Ptr (FixedArray MAX_EXTENSION_NAME_SIZE CChar))) (ByteString
forall a. Monoid a => a
mempty)
Ptr ToolPurposeFlags -> ToolPurposeFlags -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pToolProperties" ::: Ptr PhysicalDeviceToolProperties
p ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> Int -> Ptr ToolPurposeFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
528 :: Ptr ToolPurposeFlags)) (ToolPurposeFlags
forall a. Zero a => a
zero)
Ptr (FixedArray MAX_EXTENSION_NAME_SIZE CChar)
-> ByteString -> IO ()
forall (n :: Nat).
KnownNat n =>
Ptr (FixedArray n CChar) -> ByteString -> IO ()
pokeFixedLengthNullTerminatedByteString (("pToolProperties" ::: Ptr PhysicalDeviceToolProperties
p ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> Int -> Ptr (FixedArray MAX_EXTENSION_NAME_SIZE CChar)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
532 :: Ptr (FixedArray MAX_DESCRIPTION_SIZE CChar))) (ByteString
forall a. Monoid a => a
mempty)
Ptr (FixedArray MAX_EXTENSION_NAME_SIZE CChar)
-> ByteString -> IO ()
forall (n :: Nat).
KnownNat n =>
Ptr (FixedArray n CChar) -> ByteString -> IO ()
pokeFixedLengthNullTerminatedByteString (("pToolProperties" ::: Ptr PhysicalDeviceToolProperties
p ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> Int -> Ptr (FixedArray MAX_EXTENSION_NAME_SIZE CChar)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
788 :: Ptr (FixedArray MAX_EXTENSION_NAME_SIZE CChar))) (ByteString
forall a. Monoid a => a
mempty)
IO b
f
instance FromCStruct PhysicalDeviceToolProperties where
peekCStruct :: ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> IO PhysicalDeviceToolProperties
peekCStruct "pToolProperties" ::: Ptr PhysicalDeviceToolProperties
p = do
ByteString
name <- CString -> IO ByteString
packCString (Ptr (FixedArray MAX_EXTENSION_NAME_SIZE CChar) -> CString
forall a (n :: Nat). Ptr (FixedArray n a) -> Ptr a
lowerArrayPtr (("pToolProperties" ::: Ptr PhysicalDeviceToolProperties
p ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> Int -> Ptr (FixedArray MAX_EXTENSION_NAME_SIZE CChar)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr (FixedArray MAX_EXTENSION_NAME_SIZE CChar))))
ByteString
version <- CString -> IO ByteString
packCString (Ptr (FixedArray MAX_EXTENSION_NAME_SIZE CChar) -> CString
forall a (n :: Nat). Ptr (FixedArray n a) -> Ptr a
lowerArrayPtr (("pToolProperties" ::: Ptr PhysicalDeviceToolProperties
p ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> Int -> Ptr (FixedArray MAX_EXTENSION_NAME_SIZE CChar)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
272 :: Ptr (FixedArray MAX_EXTENSION_NAME_SIZE CChar))))
ToolPurposeFlags
purposes <- forall a. Storable a => Ptr a -> IO a
peek @ToolPurposeFlags (("pToolProperties" ::: Ptr PhysicalDeviceToolProperties
p ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> Int -> Ptr ToolPurposeFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
528 :: Ptr ToolPurposeFlags))
ByteString
description <- CString -> IO ByteString
packCString (Ptr (FixedArray MAX_EXTENSION_NAME_SIZE CChar) -> CString
forall a (n :: Nat). Ptr (FixedArray n a) -> Ptr a
lowerArrayPtr (("pToolProperties" ::: Ptr PhysicalDeviceToolProperties
p ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> Int -> Ptr (FixedArray MAX_EXTENSION_NAME_SIZE CChar)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
532 :: Ptr (FixedArray MAX_DESCRIPTION_SIZE CChar))))
ByteString
layer <- CString -> IO ByteString
packCString (Ptr (FixedArray MAX_EXTENSION_NAME_SIZE CChar) -> CString
forall a (n :: Nat). Ptr (FixedArray n a) -> Ptr a
lowerArrayPtr (("pToolProperties" ::: Ptr PhysicalDeviceToolProperties
p ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> Int -> Ptr (FixedArray MAX_EXTENSION_NAME_SIZE CChar)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
788 :: Ptr (FixedArray MAX_EXTENSION_NAME_SIZE CChar))))
PhysicalDeviceToolProperties -> IO PhysicalDeviceToolProperties
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PhysicalDeviceToolProperties -> IO PhysicalDeviceToolProperties)
-> PhysicalDeviceToolProperties -> IO PhysicalDeviceToolProperties
forall a b. (a -> b) -> a -> b
$ ByteString
-> ByteString
-> ToolPurposeFlags
-> ByteString
-> ByteString
-> PhysicalDeviceToolProperties
PhysicalDeviceToolProperties
ByteString
name ByteString
version ToolPurposeFlags
purposes ByteString
description ByteString
layer
instance Storable PhysicalDeviceToolProperties where
sizeOf :: PhysicalDeviceToolProperties -> Int
sizeOf ~PhysicalDeviceToolProperties
_ = Int
1048
alignment :: PhysicalDeviceToolProperties -> Int
alignment ~PhysicalDeviceToolProperties
_ = Int
8
peek :: ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> IO PhysicalDeviceToolProperties
peek = ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> IO PhysicalDeviceToolProperties
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> PhysicalDeviceToolProperties -> IO ()
poke "pToolProperties" ::: Ptr PhysicalDeviceToolProperties
ptr PhysicalDeviceToolProperties
poked = ("pToolProperties" ::: Ptr PhysicalDeviceToolProperties)
-> PhysicalDeviceToolProperties -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pToolProperties" ::: Ptr PhysicalDeviceToolProperties
ptr PhysicalDeviceToolProperties
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero PhysicalDeviceToolProperties where
zero :: PhysicalDeviceToolProperties
zero = ByteString
-> ByteString
-> ToolPurposeFlags
-> ByteString
-> ByteString
-> PhysicalDeviceToolProperties
PhysicalDeviceToolProperties
ByteString
forall a. Monoid a => a
mempty
ByteString
forall a. Monoid a => a
mempty
ToolPurposeFlags
forall a. Zero a => a
zero
ByteString
forall a. Monoid a => a
mempty
ByteString
forall a. Monoid a => a
mempty