mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-02-13 15:23:34 +00:00
Allow SDL GPU to opt into additional Vulkan features (#14204)
This commit is contained in:
@@ -2315,7 +2315,13 @@ extern SDL_DECLSPEC SDL_GPUDevice * SDLCALL SDL_CreateGPUDevice(
|
||||
* 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`: 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. The structure is NOT deep-copied. Make sure
|
||||
* that the pointer valid memory during window creation.
|
||||
*
|
||||
* \param props the properties to use.
|
||||
* \returns a GPU context on success or NULL on failure; call SDL_GetError()
|
||||
* for more information.
|
||||
@@ -2347,6 +2353,38 @@ extern SDL_DECLSPEC SDL_GPUDevice * SDLCALL SDL_CreateGPUDeviceWithProperties(
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN "SDL.gpu.device.create.d3d12.allowtier1resourcebinding"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING "SDL.gpu.device.create.d3d12.semantic"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_VULKAN_REQUIRE_HARDWARE_ACCELERATION_BOOLEAN "SDL.gpu.device.create.vulkan.requirehardwareacceleration"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_VULKAN_OPTIONS_POINTER "SDL.gpu.device.create.vulkan.options"
|
||||
|
||||
|
||||
/**
|
||||
* A structure specifying additional options when using Vulkan.
|
||||
*
|
||||
* When no such structure is provided, SDL will use Vulkan API version 1.0 and
|
||||
* a minimal set of features.
|
||||
* The requested API version influences how the feature_list is processed by
|
||||
* SDL. When requesting API version 1.0, the feature_list is ignored. Only the
|
||||
* vulkan_10_phyisical_device_features and the extension lists are used. When
|
||||
* requesting API version 1.1, the feature_list is scanned for feature
|
||||
* structures introduced in Vulkan 1.1. When requesting Vulkan 1.2 or higher,
|
||||
* the feature_list is additionally scanned for compound feature structs such
|
||||
* as VkPhysicalDeviceVulkan11Features. The device and instance extension
|
||||
* lists, as well as vulkan_10_physical_device_features, are always processed.
|
||||
* The pointers inside this structure are NOT deep-copied. Make sure they are
|
||||
* valid during window creation.
|
||||
*
|
||||
* \since This struct is available since SDL 3.4.0.
|
||||
*
|
||||
*/
|
||||
typedef struct SDL_GPUVulkanOptions
|
||||
{
|
||||
Uint32 vulkan_api_version; /**< The Vulkan API version to request for the instance. Use Vulkan's VK_MAKE_VERSION or VK_MAKE_API_VERSION. */
|
||||
void *feature_list; /**< Pointer to the first element of a chain of Vulkan feature structs. (Requires API version 1.1 or higher.)*/
|
||||
void *vulkan_10_physical_device_features; /**< Pointer to a VkPhysicalDeviceFeatures struct to enable additional Vulkan 1.0 features. */
|
||||
Uint32 device_extension_count; /**< Number of additional device extensions to require. */
|
||||
const char **device_extension_names; /**< Pointer to a list of additional device extensions to require. */
|
||||
Uint32 instance_extension_count; /**< Number of additional instance extensions to require. */
|
||||
const char **instance_extension_names; /**< Pointer to a list of additional instance extensions to require. */
|
||||
} SDL_GPUVulkanOptions;
|
||||
|
||||
/**
|
||||
* Destroys a GPU context previously returned by SDL_CreateGPUDevice.
|
||||
|
||||
Reference in New Issue
Block a user