| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
WGPU.Internal.Instance
Description
Instance of the WGPU API Haskell bindings.
Synopsis
- newtype Instance = Instance {}
- withInstance :: FilePath -> Maybe LogCallback -> (Instance -> IO a) -> IO a
- type LogCallback = LogLevel -> Text -> IO ()
- data LogLevel
- setLogLevel :: Instance -> LogLevel -> IO ()
- logLevelToText :: LogLevel -> Text
- logStdout :: LogLevel -> Text -> IO ()
- data Version = Version {}
- getVersion :: Instance -> IO Version
- versionToText :: Version -> Text
Instance
The Haskell bindings to WGPU use a value of type Instance as a handle to
the rest of the API. An Instance value is obtained by loading a dynamic
library at runtime, using the withInstance function. A typical invocation
might look like this:
withInstance"libwgpu_native.dylib" (JustlogStdOut) $ inst -> do -- set the logging level for the instancesetLogLevelinstWarn-- run the rest of the program ...
The dynamic library libwgpu_native.dylib is obtained by compiling the
Rust project wgpu-native. Care
should be take to compile a version of libwgpu_native.dylib which is
compatible with the API in these bindings.
Instance of the WGPU API.
An instance is loaded from a dynamic library using the withInstance
function.
Constructors
| Instance | |
Fields | |
Instances
Arguments
| :: FilePath | Name of the |
| -> Maybe LogCallback | Optional logging callback. |
| -> (Instance -> IO a) | The Program. A function which takes an |
| -> IO a | IO action which loads the WGPU |
Load the WGPU API from a dynamic library and supply an Instance to a
program.
Logging
setLogLevel :: Instance -> LogLevel -> IO () Source #
Set the current logging level for the instance.
logStdout :: LogLevel -> Text -> IO () Source #
A logging function which prints to stdout.
This logging function can be supplied to withInstance to print logging
messages to stdout for debugging purposes.
Version
Version of WGPU native.