SDL_CreateGPUDeviceWithProperties

Function SDL_CreateGPUDeviceWithProperties 

Source
pub unsafe extern "C" fn SDL_CreateGPUDeviceWithProperties(
    props: SDL_PropertiesID,
) -> *mut SDL_GPUDevice
Expand description

Creates a GPU context.

These are the supported properties:

These are the current shader format properties:

With the D3D12 backend:

  • SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING: the prefix to use for all vertex semantics, default is “TEXCOORD”.
  • SDL_PROP_GPU_DEVICE_CREATE_D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN: By default, Resourcing Binding Tier 2 is required for D3D12 support. However, an application can set this property to true to enable Tier 1 support, if (and only if) the application uses 8 or fewer storage resources across all shader stages. As of writing, this property is useful for targeting Intel Haswell and Broadwell GPUs; other hardware either supports Tier 2 Resource Binding or does not support D3D12 in any capacity. Defaults to false.

With the Vulkan backend:

  • SDL_PROP_GPU_DEVICE_CREATE_VULKAN_REQUIRE_HARDWARE_ACCELERATION_BOOLEAN: By default, Vulkan device enumeration includes drivers of all types, including software renderers (for example, the Lavapipe Mesa driver). This can be useful if your application requires SDL_GPU, but if you can provide your own fallback renderer (for example, an OpenGL renderer) this property can be set to true. Defaults to false.
  • SDL_PROP_GPU_DEVICE_CREATE_VULKAN_OPTIONS_POINTER: a pointer to an SDL_GPUVulkanOptions structure to be processed during device creation. This allows configuring a variety of Vulkan-specific options such as increasing the API version and opting into extensions aside from the minimal set SDL requires.

§Parameters

  • props: the properties to use.

§Return value

Returns a GPU context on success or NULL on failure; call SDL_GetError() for more information.

§Availability

This function is available since SDL 3.2.0.

§See also