From 27a078f2b601e0c585c44431113601aea637ab4f Mon Sep 17 00:00:00 2001 From: Panos Karabelas Date: Thu, 23 Jan 2025 06:49:54 +0000 Subject: [PATCH] [vulkan] set version requirement to 1.4 --- runtime/RHI/Vulkan/Vulkan_Device.cpp | 27 ++++------ runtime/RHI/Vulkan/Vulkan_FidelityFX.cpp | 2 +- runtime/Rendering/Renderer.cpp | 64 ++++++++++++------------ 3 files changed, 43 insertions(+), 50 deletions(-) diff --git a/runtime/RHI/Vulkan/Vulkan_Device.cpp b/runtime/RHI/Vulkan/Vulkan_Device.cpp index 0546390cc..108a3dc1f 100644 --- a/runtime/RHI/Vulkan/Vulkan_Device.cpp +++ b/runtime/RHI/Vulkan/Vulkan_Device.cpp @@ -150,10 +150,10 @@ namespace spartan uint32_t sdk_version = VK_HEADER_VERSION_COMPLETE; app_info.apiVersion = min(sdk_version, driver_version); - // 1.3 the minimum required version as we are using extensions from 1.3 - if (app_info.apiVersion < VK_API_VERSION_1_3) + // the minimum required version is 1.4 + if (app_info.apiVersion < VK_API_VERSION_1_4) { - SP_ERROR_WINDOW("Your machine doesn't support Vulkan 1.3"); + SP_ERROR_WINDOW("Your machine doesn't support Vulkan 1.4"); } // in case the SDK is not supported by the driver, prompt the user to update @@ -231,15 +231,15 @@ namespace spartan vector extensions_device = { "VK_KHR_swapchain", "VK_EXT_memory_budget", // to obtain precise memory usage information from Vulkan Memory Allocator - "VK_KHR_fragment_shading_rate", - "VK_EXT_hdr_metadata", - "VK_EXT_robustness2", + "VK_KHR_fragment_shading_rate", + "VK_EXT_hdr_metadata", + "VK_EXT_robustness2", "VK_KHR_external_memory", // to share images with Intel Open Image Denoise - #if defined(_MSC_VER) + #if defined(_MSC_VER) "VK_KHR_external_memory_win32", // external memory handle type, linux alternative: VK_KHR_external_memory_fd #endif - "VK_KHR_synchronization2", // needed by AMD FidelityFX - Breadcrumbs - "VK_KHR_get_memory_requirements2" // needed by AMD FidelityFX - FSR 3 + "VK_KHR_synchronization2", // this is part of Vulkan 1.4 but AMD FidelityFX Breadcrumbs without it (they fetch device pointers from some table) + "VK_KHR_get_memory_requirements2" // this is part of Vulkan 1.4 but AMD FidelityFX FSR 3 crashes without it (they fetch device pointers from some table) }; bool is_present_device(const char* extension_name, VkPhysicalDevice device_physical) @@ -291,15 +291,6 @@ namespace spartan } } - // check and add VK_KHR_portability_subset if present - // this extension is needed for portability across different platforms and - // must be enabled if the physical device supports it - //const char* portability_extension = "VK_KHR_portability_subset"; - //if (is_present_device(portability_extension, RHI_Context::device_physical)) - //{ - // extensions_supported.emplace_back(portability_extension); - //} - return extensions_supported; } diff --git a/runtime/RHI/Vulkan/Vulkan_FidelityFX.cpp b/runtime/RHI/Vulkan/Vulkan_FidelityFX.cpp index 7fcfa107c..aa4cca539 100644 --- a/runtime/RHI/Vulkan/Vulkan_FidelityFX.cpp +++ b/runtime/RHI/Vulkan/Vulkan_FidelityFX.cpp @@ -394,7 +394,7 @@ namespace spartan description_context.fpMessage = &ffx_message_callback; #endif description_context.backendInterface = ffx_interface; - + // context SP_ASSERT(ffxFsr3UpscalerContextCreate(&context, &description_context) == FFX_OK); context_created = true; diff --git a/runtime/Rendering/Renderer.cpp b/runtime/Rendering/Renderer.cpp index a98540101..42dca37f8 100644 --- a/runtime/Rendering/Renderer.cpp +++ b/runtime/Rendering/Renderer.cpp @@ -147,37 +147,39 @@ namespace spartan RHI_Device::Initialize(); } - // set options (after the device has been created since it can clamp values like max shadow resolution etc) - m_options.clear(); - SetOption(Renderer_Option::WhitePoint, 350.0f); - SetOption(Renderer_Option::Tonemapping, static_cast(Renderer_Tonemapping::Max)); - SetOption(Renderer_Option::Bloom, 1.0f); // non-zero values activate it and control the intensity - SetOption(Renderer_Option::MotionBlur, 1.0f); - SetOption(Renderer_Option::DepthOfField, 1.0f); - SetOption(Renderer_Option::ScreenSpaceAmbientOcclusion, 1.0f); - SetOption(Renderer_Option::ScreenSpaceShadows, static_cast(Renderer_ScreenspaceShadow::Bend)); - SetOption(Renderer_Option::ScreenSpaceReflections, 1.0f); - SetOption(Renderer_Option::GlobalIllumination, 0.5f); // 0.5 is the percentage of the internal resolution (options are 25%, 50%, 75% and 100%) - SetOption(Renderer_Option::Anisotropy, 16.0f); - SetOption(Renderer_Option::ShadowResolution, 4096.0f); - SetOption(Renderer_Option::Exposure, 1.0f); - SetOption(Renderer_Option::Sharpness, 0.0f); // becomes the upsampler's sharpness as well - SetOption(Renderer_Option::Fog, 1.0f); // controls the intensity of the volumetric fog as well - SetOption(Renderer_Option::FogVolumetric, 1.0f); // these is only a toggle for the volumetric fog - SetOption(Renderer_Option::Antialiasing, static_cast(Renderer_Antialiasing::Taa)); // this is using fsr 3 for taa - SetOption(Renderer_Option::Upsampling, static_cast(Renderer_Upsampling::Fsr3)); - SetOption(Renderer_Option::ResolutionScale, 1.0f); - SetOption(Renderer_Option::VariableRateShading, 0.0f); - SetOption(Renderer_Option::Vsync, 0.0f); - SetOption(Renderer_Option::TransformHandle, 1.0f); - SetOption(Renderer_Option::SelectionOutline, 1.0f); - SetOption(Renderer_Option::Grid, 1.0f); - SetOption(Renderer_Option::Lights, 1.0f); - SetOption(Renderer_Option::Physics, 0.0f); - SetOption(Renderer_Option::PerformanceMetrics, 1.0f); - SetOption(Renderer_Option::OcclusionCulling, 0.0f); // disabled by default as it's a WIP (you can see the query delays) - - SetWind(Vector3(1.0f, 0.0f, 0.5f)); + // options + { + m_options.clear(); + SetOption(Renderer_Option::WhitePoint, 350.0f); + SetOption(Renderer_Option::Tonemapping, static_cast(Renderer_Tonemapping::Max)); + SetOption(Renderer_Option::Bloom, 1.0f); // non-zero values activate it and control the intensity + SetOption(Renderer_Option::MotionBlur, 1.0f); + SetOption(Renderer_Option::DepthOfField, 1.0f); + SetOption(Renderer_Option::ScreenSpaceAmbientOcclusion, 1.0f); + SetOption(Renderer_Option::ScreenSpaceShadows, static_cast(Renderer_ScreenspaceShadow::Bend)); + SetOption(Renderer_Option::ScreenSpaceReflections, 1.0f); + SetOption(Renderer_Option::GlobalIllumination, 0.5f); // 0.5 is the percentage of the internal resolution (options are 25%, 50%, 75% and 100%) + SetOption(Renderer_Option::Anisotropy, 16.0f); + SetOption(Renderer_Option::ShadowResolution, 4096.0f); + SetOption(Renderer_Option::Exposure, 1.0f); + SetOption(Renderer_Option::Sharpness, 0.0f); // becomes the upsampler's sharpness as well + SetOption(Renderer_Option::Fog, 1.0f); // controls the intensity of the volumetric fog as well + SetOption(Renderer_Option::FogVolumetric, 1.0f); // these is only a toggle for the volumetric fog + SetOption(Renderer_Option::Antialiasing, static_cast(Renderer_Antialiasing::Taa)); // this is using fsr 3 for taa + SetOption(Renderer_Option::Upsampling, static_cast(Renderer_Upsampling::Fsr3)); + SetOption(Renderer_Option::ResolutionScale, 1.0f); + SetOption(Renderer_Option::VariableRateShading, 0.0f); + SetOption(Renderer_Option::Vsync, 0.0f); + SetOption(Renderer_Option::TransformHandle, 1.0f); + SetOption(Renderer_Option::SelectionOutline, 1.0f); + SetOption(Renderer_Option::Grid, 1.0f); + SetOption(Renderer_Option::Lights, 1.0f); + SetOption(Renderer_Option::Physics, 0.0f); + SetOption(Renderer_Option::PerformanceMetrics, 1.0f); + SetOption(Renderer_Option::OcclusionCulling, 0.0f); // disabled by default as it's a WIP (you can see the query delays) + + SetWind(Vector3(1.0f, 0.0f, 0.5f)); + } // resolution {