sdl2-2.5.5.0: Both high- and low-level bindings to the SDL library (version 2.0.6+).

Safe Haskell | Safe-Inferred
Language | Haskell2010

SDL.Video.Vulkan

Contents

- Vulkan types
- Vulkan loader
- Vulkan surface
- Querying for the drawable size

Synopsis

- type VkInstance = Ptr ()
- type VkSurfaceKHR = Word64
- type VkGetInstanceProcAddrFunc = VkInstance -> CString -> IO (FunPtr ())
- vkLoadLibrary :: MonadIO m => Maybe FilePath -> m ()
- vkUnloadLibrary :: MonadIO m => m ()
- vkGetVkGetInstanceProcAddr :: (Functor m, MonadIO m) => m VkGetInstanceProcAddrFunc
- vkGetInstanceExtensions :: MonadIO m => Window -> m [CString]
- vkCreateSurface :: MonadIO m => Window -> VkInstance -> m VkSurfaceKHR
- vkGetDrawableSize :: MonadIO m => Window -> m (V2 CInt)

# Vulkan types

type VkInstance = Ptr () Source #

type VkSurfaceKHR = Word64 Source #

type VkGetInstanceProcAddrFunc = VkInstance -> CString -> IO (FunPtr ()) Source #

# Vulkan loader

vkLoadLibrary :: MonadIO m => Maybe FilePath -> m () Source #

Dynamically load a Vulkan loader library.

If a filePath is `Nothing`, SDL will use the value of the environment variable SDL_VULKAN_LIBRARY, if set, otherwise it loads the default Vulkan loader library.

This function should be called after initializing the video driver (i.e. `initialize` [`InitVideo`]), but before creating any windows with `windowGraphicsContext` = `VulkanContext`.

If no Vulkan loader library is loaded, analogue of `vkLoadLibrary` `Nothing` will be automatically called by SDL C library upon creation of the first Vulkan window.

Throws `SDLException` if there are no working Vulkan drivers installed.

vkUnloadLibrary :: MonadIO m => m () Source #

Unload the Vulkan loader library previously loaded by `vkLoadLibrary`.

Analogue of this function will be automatically called by SDL C library after destruction of the last window with `windowGraphicsContext` = `VulkanContext`.

vkGetVkGetInstanceProcAddr :: (Functor m, MonadIO m) => m VkGetInstanceProcAddrFunc Source #

Get the vkGetInstanceProcAddr function, which can be used to obtain another Vulkan functions (see https://www.khronos.org/registry/vulkan/specs/1.0/man/html/vkGetInstanceProcAddr.html).

The `vkGetVkGetInstanceProcAddr` function should be called after either calling `vkLoadLibrary` function or creating first Vulkan window.

# Vulkan surface

vkGetInstanceExtensions :: MonadIO m => Window -> m [CString] Source #

Get the names of the Vulkan instance extensions needed to create a surface with `vkCreateSurface`.

The extension names queried here must be enabled when calling vkCreateInstance (see https://www.khronos.org/registry/vulkan/specs/1.0/man/html/vkCreateInstance.html), otherwise `vkCreateSurface` will fail.

Window should have been created with `windowGraphicsContext` = `VulkanContext`.

Throws `SDLException` on failure.

vkCreateSurface :: MonadIO m => Window -> VkInstance -> m VkSurfaceKHR Source #

Create a Vulkan rendering surface for a window.

Window should have been created with `windowGraphicsContext` = `VulkanContext`.

Instance should have been created with the extensions returned by `vkGetInstanceExtensions` enabled.

Throws `SDLException` on failure.

# Querying for the drawable size

vkGetDrawableSize :: MonadIO m => Window -> m (V2 CInt) Source #

Get the size of a window's underlying drawable area in pixels (for use with setting viewport, scissor & etc).

It may differ from `windowSize` if window was created with `windowHighDPI` flag.