diff --git a/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/device.cpp b/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/device.cpp index 7a3b5ae32..317daeb49 100644 --- a/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/device.cpp +++ b/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/device.cpp @@ -73,9 +73,29 @@ void kope_d3d12_device_create(kope_g5_device *device, const kope_g5_device_wishl IDXGIAdapter *adapter; dxgi_factory->EnumWarpAdapter(IID_PPV_ARGS(&adapter)); - kinc_microsoft_affirm(D3D12CreateDevice(adapter, D3D_FEATURE_LEVEL_12_1, IID_PPV_ARGS(&device->d3d12.device))); + + result = D3D12CreateDevice(adapter, D3D_FEATURE_LEVEL_12_2, IID_PPV_ARGS(&device->d3d12.device)); + if (result == S_OK) { + kinc_log(KINC_LOG_LEVEL_INFO, "%s", "Direct3D running on feature level 12.2."); + } + + if (result != S_OK) { + result = D3D12CreateDevice(adapter, D3D_FEATURE_LEVEL_12_1, IID_PPV_ARGS(&device->d3d12.device)); + if (result == S_OK) { + kinc_log(KINC_LOG_LEVEL_INFO, "%s", "Direct3D running on feature level 12.1."); + } + } + + if (result != S_OK) { + result = D3D12CreateDevice(adapter, D3D_FEATURE_LEVEL_12_0, IID_PPV_ARGS(&device->d3d12.device)); + if (result == S_OK) { + kinc_log(KINC_LOG_LEVEL_INFO, "%s", "Direct3D running on feature level 12.0."); + } + } } + assert(result == S_OK); + #if defined(KOPE_NVAPI) && !defined(NDEBUG) NvAPI_Initialize(); NvAPI_D3D12_EnableRaytracingValidation(device->d3d12.device, NVAPI_D3D12_RAYTRACING_VALIDATION_FLAG_NONE); @@ -797,7 +817,7 @@ void kope_d3d12_device_create_raytracing_hierarchy(kope_g5_device *device, kope_ kope_g5_device_create_buffer(device, &scratch_params, &hierarchy->d3d12.scratch_buffer); // TODO: delete later kope_g5_buffer_parameters update_scratch_params; - update_scratch_params.size = prebuild_info.UpdateScratchDataSizeInBytes; + update_scratch_params.size = prebuild_info.UpdateScratchDataSizeInBytes > 0 ? prebuild_info.UpdateScratchDataSizeInBytes : 1; update_scratch_params.usage_flags = KOPE_G5_BUFFER_USAGE_READ_WRITE; kope_g5_device_create_buffer(device, &update_scratch_params, &hierarchy->d3d12.update_scratch_buffer);