|
|
@@ -8374,6 +8374,7 @@ static bool D3D12_PrepareDriver(SDL_VideoDevice *_this, SDL_PropertiesID props)
|
|
|
IDXGIFactory6 *factory6;
|
|
|
IDXGIAdapter1 *adapter;
|
|
|
bool supports_64UAVs = false;
|
|
|
+ bool needs_64UAVs = !SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN, false);
|
|
|
|
|
|
// Early check to see if the app has _any_ D3D12 formats, if not we don't
|
|
|
// have to fuss with loading D3D in the first place.
|
|
|
@@ -8475,23 +8476,29 @@ static bool D3D12_PrepareDriver(SDL_VideoDevice *_this, SDL_PropertiesID props)
|
|
|
|
|
|
SDL_COMPILE_TIME_ASSERT(featurelevel, D3D_FEATURE_LEVEL_CHOICE < D3D_FEATURE_LEVEL_11_1);
|
|
|
|
|
|
- // Check feature level 11_1 first, guarantees 64+ UAVs unlike 11_0 Tier1
|
|
|
+ /* FIXME: If Windows 11 is running and the app has neither DXIL nor TIER2
|
|
|
+ * requirements, we can skip doing any device checks entirely
|
|
|
+ */
|
|
|
+#if 0
|
|
|
+ if (!needs_64UAVs && !has_dxil && WIN_IsWindows11OrGreater()) {
|
|
|
+ IDXGIAdapter1_Release(adapter);
|
|
|
+ IDXGIFactory1_Release(factory);
|
|
|
+
|
|
|
+ SDL_UnloadObject(d3d12Dll);
|
|
|
+ SDL_UnloadObject(dxgiDll);
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+#endif
|
|
|
+
|
|
|
res = pD3D12CreateDevice(
|
|
|
(IUnknown *)adapter,
|
|
|
- D3D_FEATURE_LEVEL_11_1,
|
|
|
+ D3D_FEATURE_LEVEL_CHOICE,
|
|
|
D3D_GUID(D3D_IID_ID3D12Device),
|
|
|
(void **)&device);
|
|
|
-
|
|
|
if (SUCCEEDED(res)) {
|
|
|
- supports_64UAVs = true;
|
|
|
- } else {
|
|
|
- res = pD3D12CreateDevice(
|
|
|
- (IUnknown *)adapter,
|
|
|
- D3D_FEATURE_LEVEL_CHOICE,
|
|
|
- D3D_GUID(D3D_IID_ID3D12Device),
|
|
|
- (void **)&device);
|
|
|
-
|
|
|
- if (SUCCEEDED(res)) {
|
|
|
+ // Only check for Tier 2 resource binding if the app needs it
|
|
|
+ if (needs_64UAVs) {
|
|
|
D3D12_FEATURE_DATA_D3D12_OPTIONS featureOptions;
|
|
|
SDL_zero(featureOptions);
|
|
|
|
|
|
@@ -8504,30 +8511,32 @@ static bool D3D12_PrepareDriver(SDL_VideoDevice *_this, SDL_PropertiesID props)
|
|
|
supports_64UAVs = true;
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- if (SUCCEEDED(res)) {
|
|
|
- D3D12_FEATURE_DATA_SHADER_MODEL shaderModel;
|
|
|
- shaderModel.HighestShaderModel = D3D_SHADER_MODEL_6_0;
|
|
|
+ // Only check for SM6 support if DXIL is provided
|
|
|
+ if (has_dxil) {
|
|
|
+ D3D12_FEATURE_DATA_SHADER_MODEL shaderModel;
|
|
|
+ shaderModel.HighestShaderModel = D3D_SHADER_MODEL_6_0;
|
|
|
|
|
|
- res = ID3D12Device_CheckFeatureSupport(
|
|
|
- device,
|
|
|
- D3D12_FEATURE_SHADER_MODEL,
|
|
|
- &shaderModel,
|
|
|
- sizeof(shaderModel));
|
|
|
- if (SUCCEEDED(res) && shaderModel.HighestShaderModel >= D3D_SHADER_MODEL_6_0) {
|
|
|
- supports_dxil = true;
|
|
|
+ res = ID3D12Device_CheckFeatureSupport(
|
|
|
+ device,
|
|
|
+ D3D12_FEATURE_SHADER_MODEL,
|
|
|
+ &shaderModel,
|
|
|
+ sizeof(shaderModel));
|
|
|
+ if (SUCCEEDED(res) && shaderModel.HighestShaderModel >= D3D_SHADER_MODEL_6_0) {
|
|
|
+ supports_dxil = true;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
ID3D12Device_Release(device);
|
|
|
}
|
|
|
+
|
|
|
IDXGIAdapter1_Release(adapter);
|
|
|
IDXGIFactory1_Release(factory);
|
|
|
|
|
|
SDL_UnloadObject(d3d12Dll);
|
|
|
SDL_UnloadObject(dxgiDll);
|
|
|
|
|
|
- if (!supports_64UAVs && !SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN, false)) {
|
|
|
+ if (!supports_64UAVs && needs_64UAVs) {
|
|
|
SDL_LogWarn(SDL_LOG_CATEGORY_GPU, "D3D12: Tier 2 Resource Binding is not supported");
|
|
|
return false;
|
|
|
}
|