Skip to main content

SDL_CreateGPUDevice

Function SDL_CreateGPUDevice 

Source
pub unsafe extern "C" fn SDL_CreateGPUDevice(
    format_flags: SDL_GPUShaderFormat,
    debug_mode: bool,
    name: *const c_char,
) -> *mut SDL_GPUDevice
Expand description

Creates a GPU context.

The GPU driver name can be one of the following:

  • “vulkan”: Vulkan
  • “direct3d12”: D3D12
  • “metal”: Metal
  • NULL: let SDL pick the optimal driver

Parameter: format_flags a bitflag indicating which shader formats the app is able to provide. Parameter: debug_mode enable debug mode properties and validations. Parameter: name the preferred GPU driver, or NULL to let SDL pick the optimal driver. Returns: a GPU context on success or NULL on failure; call SDL_GetError() for more information.

Available Since: This function is available since SDL 3.2.0.

See Also: SDL_CreateGPUDeviceWithProperties See Also: SDL_GetGPUShaderFormats See Also: SDL_GetGPUDeviceDriver See Also: SDL_DestroyGPUDevice See Also: SDL_GPUSupportsShaderFormats