mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-03 16:36:25 +00:00
Generalize and validate optional GPU feature properties
Fixes https://github.com/libsdl-org/SDL/issues/13139 Fixes https://github.com/libsdl-org/SDL/issues/13138
This commit is contained in:
@@ -230,6 +230,13 @@
|
||||
* - `drawIndirectFirstInstance`
|
||||
* - `sampleRateShading`
|
||||
*
|
||||
* You can remove some of these requirements to increase compatibility with Android devices by using these properties when creating the GPU device with SDL_CreateGPUDeviceWithProperties():
|
||||
*
|
||||
* - SDL_PROP_GPU_DEVICE_CREATE_FEATURE_CLIP_DISTANCE_BOOLEAN
|
||||
* - SDL_PROP_GPU_DEVICE_CREATE_FEATURE_DEPTH_CLAMPING_BOOLEAN
|
||||
* - SDL_PROP_GPU_DEVICE_CREATE_FEATURE_INDIRECT_DRAW_FIRST_INSTANCE_BOOLEAN
|
||||
* - SDL_PROP_GPU_DEVICE_CREATE_FEATURE_ANISOTROPY_BOOLEAN
|
||||
*
|
||||
* ### D3D12
|
||||
*
|
||||
* SDL driver name: "direct3d12"
|
||||
@@ -238,6 +245,10 @@
|
||||
* (GDK). Requires a GPU that supports DirectX 12 Feature Level 11_0 and
|
||||
* Resource Binding Tier 2 or above.
|
||||
*
|
||||
* You can remove the Tier 2 resource binding requirement to support Intel Haswell and Broadwell GPUs by using this property when creating the GPU device with SDL_CreateGPUDeviceWithProperties():
|
||||
*
|
||||
* - SDL_PROP_GPU_DEVICE_CREATE_D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN
|
||||
*
|
||||
* ### Metal
|
||||
*
|
||||
* SDL driver name: "metal"
|
||||
@@ -2242,6 +2253,22 @@ extern SDL_DECLSPEC SDL_GPUDevice * SDLCALL SDL_CreateGPUDevice(
|
||||
* useful debug information on device creation, defaults to true.
|
||||
* - `SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING`: the name of the GPU driver to
|
||||
* use, if a specific one is desired.
|
||||
* - `SDL_PROP_GPU_DEVICE_CREATE_FEATURE_CLIP_DISTANCE_BOOLEAN`: Enable
|
||||
* Vulkan device feature shaderClipDistance. If disabled, clip distances are not
|
||||
* supported in shader code: gl_ClipDistance[] built-ins of GLSL,
|
||||
* SV_ClipDistance0/1 semantics of HLSL and [[clip_distance]] attribute of
|
||||
* Metal. Disabling optional features allows the application to run on some older Android devices. Defaults to true.
|
||||
* - `SDL_PROP_GPU_DEVICE_CREATE_FEATURE_DEPTH_CLAMPING_BOOLEAN`: Enable Vulkan device
|
||||
* feature depthClamp. If disabled, there is no depth clamp support and
|
||||
* enable_depth_clip in SDL_GPURasterizerState must always be set to true.
|
||||
* Disabling optional features allows the application to run on some older Android devices. Defaults to true.
|
||||
* - `SDL_PROP_GPU_DEVICE_CREATE_FEATURE_INDIRECT_DRAW_FIRST_INSTANCE_BOOLEAN`: Enable
|
||||
* Vulkan device feature drawIndirectFirstInstance. If disabled, the argument
|
||||
* first_instance of SDL_GPUIndirectDrawCommand must be set to zero.
|
||||
* Disabling optional features allows the application to run on some older Android devices. Defaults to true.
|
||||
* - `SDL_PROP_GPU_DEVICE_CREATE_FEATURE_ANISOTROPY_BOOLEAN`: Enable
|
||||
* Vulkan device feature samplerAnisotropy. If disabled, enable_anisotropy of
|
||||
* SDL_GPUSamplerCreateInfo must be set to false. Disabling optional features allows the application to run on some older Android devices. Defaults to true.
|
||||
*
|
||||
* These are the current shader format properties:
|
||||
*
|
||||
@@ -2271,25 +2298,6 @@ extern SDL_DECLSPEC SDL_GPUDevice * SDLCALL SDL_CreateGPUDevice(
|
||||
* either supports Tier 2 Resource Binding or does not support D3D12 in any
|
||||
* capacity. Defaults to false.
|
||||
*
|
||||
* With the Vulkan renderer:
|
||||
*
|
||||
* - `SDL_PROP_GPU_DEVICE_CREATE_VULKAN_SHADERCLIPDISTANCE_BOOLEAN`: Enable
|
||||
* device feature shaderClipDistance. If disabled, clip distances are not
|
||||
* supported in shader code: gl_ClipDistance[] built-ins of GLSL,
|
||||
* SV_ClipDistance0/1 semantics of HLSL and [[clip_distance]] attribute of
|
||||
* Metal. Defaults to true.
|
||||
* - `SDL_PROP_GPU_DEVICE_CREATE_VULKAN_DEPTHCLAMP_BOOLEAN`: Enable device
|
||||
* feature depthClamp. If disabled, there is no depth clamp support and
|
||||
* enable_depth_clip in SDL_GPURasterizerState must always be set to true.
|
||||
* Defaults to true.
|
||||
* - `SDL_PROP_GPU_DEVICE_CREATE_VULKAN_DRAWINDIRECTFIRST_BOOLEAN`: Enable
|
||||
* device feature drawIndirectFirstInstance. If disabled, the argument
|
||||
* first_instance of SDL_GPUIndirectDrawCommand must be set to zero.
|
||||
* Defaults to true.
|
||||
* - `SDL_PROP_GPU_DEVICE_CREATE_VULKAN_SAMPLERANISOTROPY_BOOLEAN`: Enable
|
||||
* device feature samplerAnisotropy. If disabled, enable_anisotropy of
|
||||
* SDL_GPUSamplerCreateInfo must be set to false. Defaults to true.
|
||||
*
|
||||
* \param props the properties to use.
|
||||
* \returns a GPU context on success or NULL on failure; call SDL_GetError()
|
||||
* for more information.
|
||||
@@ -2304,22 +2312,22 @@ extern SDL_DECLSPEC SDL_GPUDevice * SDLCALL SDL_CreateGPUDevice(
|
||||
extern SDL_DECLSPEC SDL_GPUDevice * SDLCALL SDL_CreateGPUDeviceWithProperties(
|
||||
SDL_PropertiesID props);
|
||||
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN "SDL.gpu.device.create.debugmode"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOLEAN "SDL.gpu.device.create.preferlowpower"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_VERBOSE_BOOLEAN "SDL.gpu.device.create.verbose"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING "SDL.gpu.device.create.name"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_PRIVATE_BOOLEAN "SDL.gpu.device.create.shaders.private"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOLEAN "SDL.gpu.device.create.shaders.spirv"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOLEAN "SDL.gpu.device.create.shaders.dxbc"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOLEAN "SDL.gpu.device.create.shaders.dxil"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOLEAN "SDL.gpu.device.create.shaders.msl"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOLEAN "SDL.gpu.device.create.shaders.metallib"
|
||||
#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_SHADERCLIPDISTANCE_BOOLEAN "SDL.gpu.device.create.vulkan.shaderclipdistance"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_VULKAN_DEPTHCLAMP_BOOLEAN "SDL.gpu.device.create.vulkan.depthclamp"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_VULKAN_DRAWINDIRECTFIRST_BOOLEAN "SDL.gpu.device.create.vulkan.drawindirectfirstinstance"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_VULKAN_SAMPLERANISOTROPY_BOOLEAN "SDL.gpu.device.create.vulkan.sampleranisotropy"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN "SDL.gpu.device.create.debugmode"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOLEAN "SDL.gpu.device.create.preferlowpower"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_VERBOSE_BOOLEAN "SDL.gpu.device.create.verbose"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING "SDL.gpu.device.create.name"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_FEATURE_CLIP_DISTANCE_BOOLEAN "SDL.gpu.device.create.feature.clip_distance"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_FEATURE_DEPTH_CLAMPING_BOOLEAN "SDL.gpu.device.create.feature.depth_clamping"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_FEATURE_INDIRECT_DRAW_FIRST_INSTANCE_BOOLEAN "SDL.gpu.device.create.feature.indirect_draw_first_instance"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_FEATURE_ANISOTROPY_BOOLEAN "SDL.gpu.device.create.feature.anisotropy"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_PRIVATE_BOOLEAN "SDL.gpu.device.create.shaders.private"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOLEAN "SDL.gpu.device.create.shaders.spirv"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOLEAN "SDL.gpu.device.create.shaders.dxbc"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOLEAN "SDL.gpu.device.create.shaders.dxil"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOLEAN "SDL.gpu.device.create.shaders.msl"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOLEAN "SDL.gpu.device.create.shaders.metallib"
|
||||
#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"
|
||||
|
||||
/**
|
||||
* Destroys a GPU context previously returned by SDL_CreateGPUDevice.
|
||||
|
Reference in New Issue
Block a user