Skip to content

Commit 518a705

Browse files
committed
Set GPU properties for maximum hardware compatibility
Resolves #13928
1 parent 00812d1 commit 518a705

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

include/SDL3/SDL_gpu.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2261,12 +2261,12 @@ extern SDL_DECLSPEC SDL_GPUDevice * SDLCALL SDL_CreateGPUDevice(
22612261
* use for all vertex semantics, default is "TEXCOORD".
22622262
* - `SDL_PROP_GPU_DEVICE_CREATE_D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN`: By
22632263
* default, Resourcing Binding Tier 2 is required for D3D12 support.
2264-
* However, an application can enable this property to enable Tier 1
2264+
* However, an application can set this property to true to enable Tier 1
22652265
* support, if (and only if) the application uses 8 or fewer storage
22662266
* resources across all shader stages. As of writing, this property is
22672267
* useful for targeting Intel Haswell and Broadwell GPUs; other hardware
22682268
* either supports Tier 2 Resource Binding or does not support D3D12 in any
2269-
* capacity.
2269+
* capacity. Defaults to false.
22702270
*
22712271
* With the Vulkan renderer:
22722272
*

src/render/gpu/SDL_render_gpu.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,6 +1199,23 @@ static bool GPU_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_P
11991199
SDL_SetBooleanProperty(create_props, SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN, debug);
12001200
SDL_SetBooleanProperty(create_props, SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOLEAN, lowpower);
12011201

1202+
// Set hints for the greatest hardware compatibility
1203+
if (!SDL_HasProperty(create_props, SDL_PROP_GPU_DEVICE_CREATE_D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN)) {
1204+
SDL_SetBooleanProperty(create_props, SDL_PROP_GPU_DEVICE_CREATE_D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN, true);
1205+
}
1206+
if (!SDL_HasProperty(create_props, SDL_PROP_GPU_DEVICE_CREATE_VULKAN_SHADERCLIPDISTANCE_BOOLEAN)) {
1207+
SDL_SetBooleanProperty(create_props, SDL_PROP_GPU_DEVICE_CREATE_VULKAN_SHADERCLIPDISTANCE_BOOLEAN, false);
1208+
}
1209+
if (!SDL_HasProperty(create_props, SDL_PROP_GPU_DEVICE_CREATE_VULKAN_DEPTHCLAMP_BOOLEAN)) {
1210+
SDL_SetBooleanProperty(create_props, SDL_PROP_GPU_DEVICE_CREATE_VULKAN_DEPTHCLAMP_BOOLEAN, false);
1211+
}
1212+
if (!SDL_HasProperty(create_props, SDL_PROP_GPU_DEVICE_CREATE_VULKAN_DRAWINDIRECTFIRST_BOOLEAN)) {
1213+
SDL_SetBooleanProperty(create_props, SDL_PROP_GPU_DEVICE_CREATE_VULKAN_DRAWINDIRECTFIRST_BOOLEAN, false);
1214+
}
1215+
if (!SDL_HasProperty(create_props, SDL_PROP_GPU_DEVICE_CREATE_VULKAN_SAMPLERANISOTROPY_BOOLEAN)) {
1216+
SDL_SetBooleanProperty(create_props, SDL_PROP_GPU_DEVICE_CREATE_VULKAN_SHADERCLIPDISTANCE_BOOLEAN, false);
1217+
}
1218+
12021219
GPU_FillSupportedShaderFormats(create_props);
12031220
data->device = SDL_CreateGPUDeviceWithProperties(create_props);
12041221

0 commit comments

Comments
 (0)