From aa333e6fb1b68dc15811bf7c858b20a0b07c8acc Mon Sep 17 00:00:00 2001 From: swurl Date: Fri, 9 May 2025 14:19:51 +0000 Subject: [PATCH] Vulkan 1.4 and New Extensions (#93) - Add descriptor_indexing, VIDS, provoking_vertex - Fix up EDS - Implement VK 1.4 Co-authored-by: JPikachu Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/93 Co-authored-by: swurl Co-committed-by: swurl --- .../features/settings/model/BooleanSetting.kt | 3 + .../settings/model/view/SettingsItem.kt | 31 ++- .../settings/ui/SettingsFragmentPresenter.kt | 5 + .../app/src/main/res/values/strings.xml | 14 +- src/common/settings.h | 138 +++++++------- .../renderer_vulkan/pipeline_helper.h | 1 + .../renderer_vulkan/vk_graphics_pipeline.cpp | 9 +- .../renderer_vulkan/vk_pipeline_cache.cpp | 9 +- .../vulkan_common/vulkan_device.cpp | 178 ++++++++++-------- src/video_core/vulkan_common/vulkan_device.h | 8 +- .../configure_graphics_extensions.cpp | 13 ++ src/yuzu/configuration/shared_translation.cpp | 12 ++ src/yuzu/game_list.cpp | 2 +- 13 files changed, 264 insertions(+), 159 deletions(-) diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt index 0a40daa486..8b2d658f4b 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt @@ -19,6 +19,9 @@ enum class BooleanSetting(override val key: String) : AbstractBooleanSetting { RENDERER_ASYNCHRONOUS_SHADERS("use_asynchronous_shaders"), RENDERER_REACTIVE_FLUSHING("use_reactive_flushing"), RENDERER_DEBUG("debug"), + RENDERER_DYNA_STATE3("dyna_state3"), + RENDERER_PROVOKING_VERTEX("provoking_vertex"), + RENDERER_DESCRIPTOR_INDEXING("descriptor_indexing"), PICTURE_IN_PICTURE("picture_in_picture"), USE_CUSTOM_RTC("custom_rtc_enabled"), BLACK_BACKGROUNDS("black_backgrounds"), diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.kt index 47d45cf510..0ac5f4576b 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.kt @@ -57,13 +57,6 @@ abstract class SettingsItem( return NativeInput.getStyleIndex(0) != NpadStyleIndex.Handheld } - if (setting.key == ByteSetting.RENDERER_DYNA_STATE.key) { - // Can't change on Mali GPU's otherwise no game loading for you - if (!GpuDriverHelper.supportsCustomDriverLoading()) { - return false - } - } - // Can't edit settings that aren't saveable in per-game config even if they are switchable if (NativeConfig.isPerGameConfigLoaded() && !setting.isSaveable) { return false @@ -139,10 +132,30 @@ abstract class SettingsItem( titleId = R.string.dyna_state, descriptionId = R.string.dyna_state_description, min = 0, - max = 3, + max = 2, + ) + ) + put( + SwitchSetting( + BooleanSetting.RENDERER_DYNA_STATE3, + titleId = R.string.dyna_state3, + descriptionId = R.string.dyna_state3_description + ) + ) + put( + SwitchSetting( + BooleanSetting.RENDERER_PROVOKING_VERTEX, + titleId = R.string.provoking_vertex, + descriptionId = R.string.provoking_vertex_description + ) + ) + put( + SwitchSetting( + BooleanSetting.RENDERER_DESCRIPTOR_INDEXING, + titleId = R.string.descriptor_indexing, + descriptionId = R.string.descriptor_indexing_description ) ) - put( SliderSetting( ShortSetting.RENDERER_SPEED_LIMIT, diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt index 8bc8d64115..3c1671a691 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt @@ -479,7 +479,12 @@ class SettingsFragmentPresenter( descriptionId = R.string.use_lru_cache_description ) ) + add(ByteSetting.RENDERER_DYNA_STATE.key) + add(BooleanSetting.RENDERER_DYNA_STATE3.key) + add(BooleanSetting.RENDERER_PROVOKING_VERTEX.key) + add(BooleanSetting.RENDERER_DESCRIPTOR_INDEXING.key) + add( SwitchSetting( syncCoreSpeedSetting, diff --git a/src/android/app/src/main/res/values/strings.xml b/src/android/app/src/main/res/values/strings.xml index eec9eddcd3..e9872a2d5b 100644 --- a/src/android/app/src/main/res/values/strings.xml +++ b/src/android/app/src/main/res/values/strings.xml @@ -64,9 +64,9 @@ Grid Folder Pre-Alpha Software - "WARNING: This build is not meant to be shared or shown to the public. This software is in pre-alpha stages and may have bugs and incomplete feature implementations. \nIf you somehow got unauthorized access to this build; it's heavily recommended to uninstall it immediately " - Dont Show Again - PRE-ALPHA SOFTWARE; NOT MEANT FOR PUBLIC USE\ + "WARNING: This software is in the pre-alpha stage and may have bugs and incomplete feature implementations." + Don\'t Show Again + PRE-ALPHA SOFTWARE\ "New game directory added successfully " Games Search @@ -302,7 +302,13 @@ Choose how shaders are compiled and translated for your GPU. Extended Dynamic State Enables Vulkan features to improve performance, rendering, and save resources on pipeline creation while maintaining lower CPU/GPU usage. -These features may have repercussions on the device\'s temperature, some GPUs belonging to the older A6XX line may not react properly. Disabled by default to use Yuzu emulated formats, risk-free core functions 1 - 2, for higher-end devices select 3. +These extensions may increase device temperature, and GPUs belonging to the older A6XX line may not react properly. Set to 0 to use Yuzu emulated formats. + EDS3 + VertexInputDynamicState + Improves performance on newer devices. Only supported on Vulkan 1.3+ GPUs. + Provoking Vertex + Improves lighting and vertex handling in certain games. Only supported on Vulkan 1.0+ GPUs. + Descriptor Indexing + Improves texture and buffer handling, as well as the Maxwell translation layer. Supported by some Vulkan 1.1 GPUs and all Vulkan 1.2+ GPUs. CPU diff --git a/src/common/settings.h b/src/common/settings.h index f2bf4f83c9..67ca2936e4 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -146,7 +146,7 @@ struct Values { Setting net_connect_applet_mode{linkage, AppletMode::HLE, "net_connect_applet_mode", Category::LibraryApplet}; Setting player_select_applet_mode{ - linkage, AppletMode::HLE, "player_select_applet_mode", Category::LibraryApplet}; + linkage, AppletMode::HLE, "player_select_applet_mode", Category::LibraryApplet}; Setting swkbd_applet_mode{linkage, AppletMode::LLE, "swkbd_applet_mode", Category::LibraryApplet}; Setting mii_edit_applet_mode{linkage, AppletMode::LLE, "mii_edit_applet_mode", @@ -156,13 +156,13 @@ struct Values { Setting shop_applet_mode{linkage, AppletMode::HLE, "shop_applet_mode", Category::LibraryApplet}; Setting photo_viewer_applet_mode{ - linkage, AppletMode::LLE, "photo_viewer_applet_mode", Category::LibraryApplet}; + linkage, AppletMode::LLE, "photo_viewer_applet_mode", Category::LibraryApplet}; Setting offline_web_applet_mode{linkage, AppletMode::LLE, "offline_web_applet_mode", Category::LibraryApplet}; Setting login_share_applet_mode{linkage, AppletMode::HLE, "login_share_applet_mode", Category::LibraryApplet}; Setting wifi_web_auth_applet_mode{ - linkage, AppletMode::HLE, "wifi_web_auth_applet_mode", Category::LibraryApplet}; + linkage, AppletMode::HLE, "wifi_web_auth_applet_mode", Category::LibraryApplet}; Setting my_page_applet_mode{linkage, AppletMode::LLE, "my_page_applet_mode", Category::LibraryApplet}; @@ -170,13 +170,13 @@ struct Values { SwitchableSetting sink_id{linkage, AudioEngine::Auto, "output_engine", Category::Audio, Specialization::RuntimeList}; SwitchableSetting audio_output_device_id{ - linkage, "auto", "output_device", Category::Audio, Specialization::RuntimeList}; + linkage, "auto", "output_device", Category::Audio, Specialization::RuntimeList}; SwitchableSetting audio_input_device_id{ - linkage, "auto", "input_device", Category::Audio, Specialization::RuntimeList}; + linkage, "auto", "input_device", Category::Audio, Specialization::RuntimeList}; SwitchableSetting sound_index{ - linkage, AudioMode::Stereo, AudioMode::Mono, AudioMode::Surround, - "sound_index", Category::SystemAudio, Specialization::Default, true, - true}; + linkage, AudioMode::Stereo, AudioMode::Mono, AudioMode::Surround, + "sound_index", Category::SystemAudio, Specialization::Default, true, + true}; SwitchableSetting volume{linkage, 100, 0, @@ -187,9 +187,9 @@ struct Values { true, true}; Setting audio_muted{ - linkage, false, "audio_muted", Category::Audio, Specialization::Default, true, true}; + linkage, false, "audio_muted", Category::Audio, Specialization::Default, true, true}; Setting dump_audio_commands{ - linkage, false, "dump_audio_commands", Category::Audio, Specialization::Default, false}; + linkage, false, "dump_audio_commands", Category::Audio, Specialization::Default, false}; // Core SwitchableSetting use_multi_core{linkage, true, "use_multi_core", Category::Core}; @@ -202,7 +202,7 @@ struct Values { Specialization::Default, false}; SwitchableSetting use_speed_limit{ - linkage, true, "use_speed_limit", Category::Core, Specialization::Paired, true, true}; + linkage, true, "use_speed_limit", Category::Core, Specialization::Paired, true, true}; SwitchableSetting speed_limit{linkage, 100, 0, @@ -262,41 +262,41 @@ struct Values { SwitchableSetting cpuopt_unsafe_unfuse_fma{linkage, true, "cpuopt_unsafe_unfuse_fma", Category::CpuUnsafe}; SwitchableSetting cpuopt_unsafe_reduce_fp_error{ - linkage, true, "cpuopt_unsafe_reduce_fp_error", Category::CpuUnsafe}; + linkage, true, "cpuopt_unsafe_reduce_fp_error", Category::CpuUnsafe}; SwitchableSetting cpuopt_unsafe_ignore_standard_fpcr{ - linkage, true, "cpuopt_unsafe_ignore_standard_fpcr", Category::CpuUnsafe}; + linkage, true, "cpuopt_unsafe_ignore_standard_fpcr", Category::CpuUnsafe}; SwitchableSetting cpuopt_unsafe_inaccurate_nan{ - linkage, true, "cpuopt_unsafe_inaccurate_nan", Category::CpuUnsafe}; + linkage, true, "cpuopt_unsafe_inaccurate_nan", Category::CpuUnsafe}; SwitchableSetting cpuopt_unsafe_fastmem_check{ - linkage, true, "cpuopt_unsafe_fastmem_check", Category::CpuUnsafe}; + linkage, true, "cpuopt_unsafe_fastmem_check", Category::CpuUnsafe}; SwitchableSetting cpuopt_unsafe_ignore_global_monitor{ - linkage, true, "cpuopt_unsafe_ignore_global_monitor", Category::CpuUnsafe}; + linkage, true, "cpuopt_unsafe_ignore_global_monitor", Category::CpuUnsafe}; // Renderer SwitchableSetting renderer_backend{ - linkage, RendererBackend::Vulkan, RendererBackend::OpenGL, RendererBackend::Null, - "backend", Category::Renderer}; + linkage, RendererBackend::Vulkan, RendererBackend::OpenGL, RendererBackend::Null, + "backend", Category::Renderer}; SwitchableSetting shader_backend{ - linkage, ShaderBackend::Glsl, ShaderBackend::Glsl, ShaderBackend::SpirV, - "shader_backend", Category::Renderer, Specialization::RuntimeList}; + linkage, ShaderBackend::Glsl, ShaderBackend::Glsl, ShaderBackend::SpirV, + "shader_backend", Category::Renderer, Specialization::RuntimeList}; SwitchableSetting vulkan_device{linkage, 0, "vulkan_device", Category::Renderer, Specialization::RuntimeList}; - #ifdef __ANDROID__ +#ifdef __ANDROID__ SwitchableSetting frame_interpolation{linkage, true, "frame_interpolation", Category::Renderer, - Specialization::RuntimeList}; + Specialization::RuntimeList}; SwitchableSetting frame_skipping{linkage, true, "frame_skipping", Category::Renderer, - Specialization::RuntimeList}; - #endif + Specialization::RuntimeList}; +#endif SwitchableSetting use_disk_shader_cache{linkage, true, "use_disk_shader_cache", Category::Renderer}; SwitchableSetting optimize_spirv_output{linkage, - SpirvOptimizeMode::OnLoad, - SpirvOptimizeMode::Never, - SpirvOptimizeMode::Always, - "optimize_spirv_output", - Category::Renderer}; + SpirvOptimizeMode::OnLoad, + SpirvOptimizeMode::Never, + SpirvOptimizeMode::Always, + "optimize_spirv_output", + Category::Renderer}; SwitchableSetting use_asynchronous_gpu_emulation{ - linkage, true, "use_asynchronous_gpu_emulation", Category::Renderer}; + linkage, true, "use_asynchronous_gpu_emulation", Category::Renderer}; SwitchableSetting accelerate_astc{linkage, #ifdef ANDROID AstcDecodeMode::Cpu, @@ -308,9 +308,9 @@ struct Values { "accelerate_astc", Category::Renderer}; SwitchableSetting vsync_mode{ - linkage, VSyncMode::Fifo, VSyncMode::Immediate, VSyncMode::FifoRelaxed, - "use_vsync", Category::Renderer, Specialization::RuntimeList, true, - true}; + linkage, VSyncMode::Fifo, VSyncMode::Immediate, VSyncMode::FifoRelaxed, + "use_vsync", Category::Renderer, Specialization::RuntimeList, true, + true}; SwitchableSetting nvdec_emulation{linkage, NvdecEmulation::Gpu, "nvdec_emulation", Category::Renderer}; // *nix platforms may have issues with the borderless windowed fullscreen mode. @@ -367,11 +367,11 @@ struct Values { true}; SwitchableSetting bg_red{ - linkage, 0, "bg_red", Category::Renderer, Specialization::Default, true, true}; + linkage, 0, "bg_red", Category::Renderer, Specialization::Default, true, true}; SwitchableSetting bg_green{ - linkage, 0, "bg_green", Category::Renderer, Specialization::Default, true, true}; + linkage, 0, "bg_green", Category::Renderer, Specialization::Default, true, true}; SwitchableSetting bg_blue{ - linkage, 0, "bg_blue", Category::Renderer, Specialization::Default, true, true}; + linkage, 0, "bg_blue", Category::Renderer, Specialization::Default, true, true}; SwitchableSetting gpu_accuracy{linkage, #ifdef ANDROID @@ -429,8 +429,8 @@ struct Values { SwitchableSetting use_asynchronous_shaders{linkage, false, "use_asynchronous_shaders", Category::RendererAdvanced}; SwitchableSetting use_fast_gpu_time{ - linkage, true, "use_fast_gpu_time", Category::RendererAdvanced, Specialization::Default, - true, true}; + linkage, true, "use_fast_gpu_time", Category::RendererAdvanced, Specialization::Default, + true, true}; SwitchableSetting use_vulkan_driver_pipeline_cache{linkage, true, "use_vulkan_driver_pipeline_cache", @@ -446,12 +446,20 @@ struct Values { Category::RendererAdvanced}; SwitchableSetting dyna_state{linkage, - 1, - 0, - 3, - "dyna_state", - Category::RendererExtensions, - Specialization::Scalar}; +#ifdef ANDROID + 0, +#else + 1, +#endif + 0, + 2, + "dyna_state", + Category::RendererExtensions, + Specialization::Scalar}; + + SwitchableSetting dyna_state3{linkage, false, "dyna_state3", Category::RendererExtensions}; + SwitchableSetting provoking_vertex{linkage, false, "provoking_vertex", Category::RendererExtensions}; + SwitchableSetting descriptor_indexing{linkage, false, "descriptor_indexing", Category::RendererExtensions}; Setting renderer_debug{linkage, false, "debug", Category::RendererDebug}; Setting renderer_shader_feedback{linkage, false, "shader_feedback", @@ -459,7 +467,7 @@ struct Values { Setting enable_nsight_aftermath{linkage, false, "nsight_aftermath", Category::RendererDebug}; Setting disable_shader_loop_safety_checks{ - linkage, false, "disable_shader_loop_safety_checks", Category::RendererDebug}; + linkage, false, "disable_shader_loop_safety_checks", Category::RendererDebug}; Setting enable_renderdoc_hotkey{linkage, false, "renderdoc_hotkey", Category::RendererDebug}; Setting disable_buffer_reorder{linkage, false, "disable_buffer_reorder", @@ -479,10 +487,10 @@ struct Values { "time_zone_index", Category::System}; // Measured in seconds since epoch SwitchableSetting custom_rtc_enabled{ - linkage, false, "custom_rtc_enabled", Category::System, Specialization::Paired, true, true}; + linkage, false, "custom_rtc_enabled", Category::System, Specialization::Paired, true, true}; SwitchableSetting custom_rtc{ - linkage, 0, "custom_rtc", Category::System, Specialization::Time, - false, true, &custom_rtc_enabled}; + linkage, 0, "custom_rtc", Category::System, Specialization::Time, + false, true, &custom_rtc_enabled}; SwitchableSetting custom_rtc_offset{linkage, 0, std::numeric_limits::min(), @@ -493,12 +501,12 @@ struct Values { true, true}; SwitchableSetting rng_seed_enabled{ - linkage, false, "rng_seed_enabled", Category::System, Specialization::Paired, true, true}; + linkage, false, "rng_seed_enabled", Category::System, Specialization::Paired, true, true}; SwitchableSetting rng_seed{ - linkage, 0, "rng_seed", Category::System, Specialization::Hex, - true, true, &rng_seed_enabled}; + linkage, 0, "rng_seed", Category::System, Specialization::Hex, + true, true, &rng_seed_enabled}; Setting device_name{ - linkage, "eden", "device_name", Category::System, Specialization::Default, true, true}; + linkage, "eden", "device_name", Category::System, Specialization::Default, true, true}; Setting current_user{linkage, 0, "current_user", Category::System}; @@ -549,21 +557,21 @@ struct Values { Setting tas_loop{linkage, false, "tas_loop", Category::Controls}; Setting mouse_panning{ - linkage, false, "mouse_panning", Category::Controls, Specialization::Default, false}; + linkage, false, "mouse_panning", Category::Controls, Specialization::Default, false}; Setting mouse_panning_sensitivity{ - linkage, 50, 1, 100, "mouse_panning_sensitivity", Category::Controls}; + linkage, 50, 1, 100, "mouse_panning_sensitivity", Category::Controls}; Setting mouse_enabled{linkage, false, "mouse_enabled", Category::Controls}; Setting mouse_panning_x_sensitivity{ - linkage, 50, 1, 100, "mouse_panning_x_sensitivity", Category::Controls}; + linkage, 50, 1, 100, "mouse_panning_x_sensitivity", Category::Controls}; Setting mouse_panning_y_sensitivity{ - linkage, 50, 1, 100, "mouse_panning_y_sensitivity", Category::Controls}; + linkage, 50, 1, 100, "mouse_panning_y_sensitivity", Category::Controls}; Setting mouse_panning_deadzone_counterweight{ - linkage, 20, 0, 100, "mouse_panning_deadzone_counterweight", Category::Controls}; + linkage, 20, 0, 100, "mouse_panning_deadzone_counterweight", Category::Controls}; Setting mouse_panning_decay_strength{ - linkage, 18, 0, 100, "mouse_panning_decay_strength", Category::Controls}; + linkage, 18, 0, 100, "mouse_panning_decay_strength", Category::Controls}; Setting mouse_panning_min_decay{ - linkage, 6, 0, 100, "mouse_panning_min_decay", Category::Controls}; + linkage, 6, 0, 100, "mouse_panning_min_decay", Category::Controls}; Setting emulate_analog_keyboard{linkage, false, "emulate_analog_keyboard", Category::Controls}; @@ -606,23 +614,23 @@ struct Values { Setting dump_exefs{linkage, false, "dump_exefs", Category::Debugging}; Setting dump_nso{linkage, false, "dump_nso", Category::Debugging}; Setting dump_shaders{ - linkage, false, "dump_shaders", Category::DebuggingGraphics, Specialization::Default, - false}; + linkage, false, "dump_shaders", Category::DebuggingGraphics, Specialization::Default, + false}; Setting dump_macros{ - linkage, false, "dump_macros", Category::DebuggingGraphics, Specialization::Default, false}; + linkage, false, "dump_macros", Category::DebuggingGraphics, Specialization::Default, false}; Setting enable_fs_access_log{linkage, false, "enable_fs_access_log", Category::Debugging}; Setting reporting_services{ - linkage, false, "reporting_services", Category::Debugging, Specialization::Default, false}; + linkage, false, "reporting_services", Category::Debugging, Specialization::Default, false}; Setting quest_flag{linkage, false, "quest_flag", Category::Debugging}; Setting disable_macro_jit{linkage, false, "disable_macro_jit", Category::DebuggingGraphics}; Setting disable_macro_hle{linkage, false, "disable_macro_hle", Category::DebuggingGraphics}; Setting extended_logging{ - linkage, false, "extended_logging", Category::Debugging, Specialization::Default, false}; + linkage, false, "extended_logging", Category::Debugging, Specialization::Default, false}; Setting use_debug_asserts{linkage, false, "use_debug_asserts", Category::Debugging}; Setting use_auto_stub{ - linkage, false, "use_auto_stub", Category::Debugging}; + linkage, false, "use_auto_stub", Category::Debugging}; Setting enable_all_controllers{linkage, false, "enable_all_controllers", Category::Debugging}; Setting perform_vulkan_check{linkage, true, "perform_vulkan_check", Category::Debugging}; diff --git a/src/video_core/renderer_vulkan/pipeline_helper.h b/src/video_core/renderer_vulkan/pipeline_helper.h index 850c34a3a7..910e07a606 100644 --- a/src/video_core/renderer_vulkan/pipeline_helper.h +++ b/src/video_core/renderer_vulkan/pipeline_helper.h @@ -28,6 +28,7 @@ public: num_descriptors <= device->MaxPushDescriptors(); } + // TODO(crueter): utilize layout binding flags vk::DescriptorSetLayout CreateDescriptorSetLayout(bool use_push_descriptor) const { if (bindings.empty()) { return nullptr; diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp index 2765a44f3c..4b4331d2f4 100644 --- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp +++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp @@ -235,6 +235,7 @@ ConfigureFuncPtr ConfigureFunc(const std::array& m } } // Anonymous namespace +// TODO(crueter): This is the worst-formatted code I have EVER seen GraphicsPipeline::GraphicsPipeline( Scheduler& scheduler_, BufferCache& buffer_cache_, TextureCache& texture_cache_, vk::PipelineCache& pipeline_cache_, VideoCore::ShaderNotify* shader_notify, @@ -263,9 +264,11 @@ GraphicsPipeline::GraphicsPipeline( DescriptorLayoutBuilder builder{MakeBuilder(device, stage_infos)}; uses_push_descriptor = builder.CanUsePushDescriptor(); descriptor_set_layout = builder.CreateDescriptorSetLayout(uses_push_descriptor); + if (!uses_push_descriptor) { descriptor_allocator = descriptor_pool.Allocator(*descriptor_set_layout, stage_infos); } + const VkDescriptorSetLayout set_layout{*descriptor_set_layout}; pipeline_layout = builder.CreatePipelineLayout(set_layout); descriptor_update_template = @@ -716,13 +719,14 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) { ? VK_PROVOKING_VERTEX_MODE_LAST_VERTEX_EXT : VK_PROVOKING_VERTEX_MODE_FIRST_VERTEX_EXT, }; + if (IsLine(input_assembly_topology) && device.IsExtLineRasterizationSupported()) { line_state.pNext = std::exchange(rasterization_ci.pNext, &line_state); } if (device.IsExtConservativeRasterizationSupported()) { conservative_raster.pNext = std::exchange(rasterization_ci.pNext, &conservative_raster); } - if (device.IsExtProvokingVertexSupported()) { + if (device.IsExtProvokingVertexSupported() && Settings::values.provoking_vertex.GetValue()) { provoking_vertex.pNext = std::exchange(rasterization_ci.pNext, &provoking_vertex); } @@ -803,7 +807,7 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) { static constexpr std::array extended{ VK_DYNAMIC_STATE_CULL_MODE_EXT, VK_DYNAMIC_STATE_FRONT_FACE_EXT, - VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT, + //VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT, //Disabled for VK_EXT_VERTEX_INPUT_DYNAMIC_STATE_EXTENSION_NAME VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT, VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE_EXT, VK_DYNAMIC_STATE_DEPTH_COMPARE_OP_EXT, @@ -897,6 +901,7 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) { if (device.IsKhrPipelineExecutablePropertiesEnabled()) { flags |= VK_PIPELINE_CREATE_CAPTURE_STATISTICS_BIT_KHR; } + pipeline = device.GetLogical().CreateGraphicsPipeline( { .sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO, diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp index 62578cf306..27efc02e69 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp @@ -403,20 +403,23 @@ PipelineCache::PipelineCache(Tegra::MaxwellDeviceMemoryManager& device_memory_, } const u8 dynamic_state = Settings::values.dyna_state.GetValue(); + const bool dynamic_state3 = dynamic_state == 2 && Settings::values.dyna_state3.GetValue(); LOG_INFO(Render_Vulkan, "DynamicState value is set to {}", (u32) dynamic_state); + LOG_INFO(Render_Vulkan, "DynamicState3 value is set to {}", dynamic_state3); dynamic_features = DynamicFeatures{ .has_extended_dynamic_state = device.IsExtExtendedDynamicStateSupported() && dynamic_state > 0, .has_extended_dynamic_state_2 = device.IsExtExtendedDynamicState2Supported() && dynamic_state > 1, .has_extended_dynamic_state_2_extra = device.IsExtExtendedDynamicState2ExtrasSupported() && dynamic_state > 1, - .has_extended_dynamic_state_3_blend = device.IsExtExtendedDynamicState3BlendingSupported() && dynamic_state > 2, - .has_extended_dynamic_state_3_enables = device.IsExtExtendedDynamicState3EnablesSupported() && dynamic_state > 2, - .has_dynamic_vertex_input = device.IsExtVertexInputDynamicStateSupported(), + .has_extended_dynamic_state_3_blend = device.IsExtExtendedDynamicState3BlendingSupported() && dynamic_state3, + .has_extended_dynamic_state_3_enables = device.IsExtExtendedDynamicState3EnablesSupported() && dynamic_state3, + .has_dynamic_vertex_input = device.IsExtVertexInputDynamicStateSupported(),// && dynamic_state3, }; LOG_INFO(Render_Vulkan, "DynamicState1: {}", dynamic_features.has_extended_dynamic_state); LOG_INFO(Render_Vulkan, "DynamicState2: {}", dynamic_features.has_extended_dynamic_state_2); LOG_INFO(Render_Vulkan, "DynamicState3: {}", dynamic_features.has_extended_dynamic_state_3_enables); + LOG_INFO(Render_Vulkan, "DynamicVertexInput: {}", dynamic_features.has_dynamic_vertex_input); } PipelineCache::~PipelineCache() { diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp index dc7223227a..f0b3ed4e6b 100644 --- a/src/video_core/vulkan_common/vulkan_device.cpp +++ b/src/video_core/vulkan_common/vulkan_device.cpp @@ -313,18 +313,18 @@ void OverrideBcnFormats(std::unordered_map& format #endif NvidiaArchitecture GetNvidiaArchitecture(vk::PhysicalDevice physical, - const std::set>& exts) { + const std::set>& exts) { + VkPhysicalDeviceProperties2 physical_properties{}; + physical_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2; + physical_properties.pNext = nullptr; + if (exts.contains(VK_KHR_FRAGMENT_SHADING_RATE_EXTENSION_NAME)) { VkPhysicalDeviceFragmentShadingRatePropertiesKHR shading_rate_props{}; shading_rate_props.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_PROPERTIES_KHR; - VkPhysicalDeviceProperties2 physical_properties{}; - physical_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2; physical_properties.pNext = &shading_rate_props; physical.GetProperties2(physical_properties); if (shading_rate_props.primitiveFragmentShadingRateWithMultipleViewports) { - // Only Ampere and newer support this feature - // TODO: Find a way to differentiate Ampere and Ada return NvidiaArchitecture::Arch_AmpereOrNewer; } return NvidiaArchitecture::Arch_Turing; @@ -334,8 +334,6 @@ NvidiaArchitecture GetNvidiaArchitecture(vk::PhysicalDevice physical, VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT advanced_blending_props{}; advanced_blending_props.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_PROPERTIES_EXT; - VkPhysicalDeviceProperties2 physical_properties{}; - physical_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2; physical_properties.pNext = &advanced_blending_props; physical.GetProperties2(physical_properties); if (advanced_blending_props.advancedBlendMaxColorAttachments == 1) { @@ -388,11 +386,11 @@ void Device::RemoveExtensionFeature(bool& extension, Feature& feature, // Unload extension. this->RemoveExtension(extension, extension_name); - // Save sType and pNext for chain. + // Save sType and pNext for chain. VkStructureType sType = feature.sType; void* pNext = feature.pNext; - // Clear feature struct and restore chain. + // Clear feature struct and restore chain. feature = {}; feature.sType = sType; feature.pNext = pNext; @@ -410,7 +408,7 @@ void Device::RemoveExtensionFeatureIfUnsuitable(bool is_suitable, Feature& featu Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR surface, const vk::InstanceDispatch& dld_) : instance{instance_}, dld{dld_}, physical{physical_}, - format_properties(GetFormatProperties(physical)) { + format_properties(GetFormatProperties(physical)) { // Get suitability and device properties. const bool is_suitable = GetSuitability(surface != nullptr); @@ -442,12 +440,13 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR SetupFamilies(surface); const auto queue_cis = GetDeviceQueueCreateInfos(); - // GetSuitability has already configured the linked list of features for us. - // Reuse it here. + // GetSuitability has already configured the linked list of features for us. + // Reuse it here. const void* first_next = &features2; VkDeviceDiagnosticsConfigCreateInfoNV diagnostics_nv{}; - if (Settings::values.enable_nsight_aftermath && extensions.device_diagnostics_config) { + const bool use_diagnostics_nv = Settings::values.enable_nsight_aftermath && extensions.device_diagnostics_config; + if (use_diagnostics_nv) { nsight_aftermath_tracker = std::make_unique(); diagnostics_nv = { @@ -460,6 +459,18 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR first_next = &diagnostics_nv; } + VkPhysicalDeviceDescriptorIndexingFeaturesEXT descriptor_indexing{ + .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES_EXT, + .pNext = use_diagnostics_nv ? static_cast(&diagnostics_nv) : static_cast(&features2), + .shaderSampledImageArrayNonUniformIndexing = VK_TRUE, + .descriptorBindingPartiallyBound = VK_TRUE, + .descriptorBindingVariableDescriptorCount = VK_TRUE, + }; + + if (extensions.descriptor_indexing && Settings::values.descriptor_indexing.GetValue()) { + first_next = &descriptor_indexing; + } + is_blit_depth24_stencil8_supported = TestDepthStencilBlits(VK_FORMAT_D24_UNORM_S8_UINT); is_blit_depth32_stencil8_supported = TestDepthStencilBlits(VK_FORMAT_D32_SFLOAT_S8_UINT); is_optimal_astc_supported = ComputeIsOptimalAstcSupported(); @@ -490,7 +501,7 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR if (is_qualcomm) { LOG_WARNING(Render_Vulkan, "Qualcomm drivers have a slow VK_KHR_push_descriptor implementation"); - RemoveExtension(extensions.push_descriptor, VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME); + //RemoveExtension(extensions.push_descriptor, VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME); #if defined(ANDROID) && defined(ARCHITECTURE_arm64) // Patch the driver to enable BCn textures. @@ -524,7 +535,7 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR } else if (arch <= NvidiaArchitecture::Arch_Volta) { if (nv_major_version < 527) { LOG_WARNING(Render_Vulkan, "Volta and older have broken VK_KHR_push_descriptor"); - RemoveExtension(extensions.push_descriptor, VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME); + //RemoveExtension(extensions.push_descriptor, VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME); } } if (nv_major_version >= 510) { @@ -641,9 +652,9 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR const u32 version = (properties.properties.driverVersion << 3) >> 3; if (version < VK_MAKE_API_VERSION(27, 20, 100, 0)) { LOG_WARNING(Render_Vulkan, "Intel has broken VK_EXT_vertex_input_dynamic_state"); - RemoveExtensionFeature(extensions.vertex_input_dynamic_state, - features.vertex_input_dynamic_state, - VK_EXT_VERTEX_INPUT_DYNAMIC_STATE_EXTENSION_NAME); + //RemoveExtensionFeature(extensions.vertex_input_dynamic_state, + //features.vertex_input_dynamic_state, + //VK_EXT_VERTEX_INPUT_DYNAMIC_STATE_EXTENSION_NAME); } } if (features.shader_float16_int8.shaderFloat16 && is_intel_windows) { @@ -670,14 +681,14 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR // mesa/mesa/-/commit/ff91c5ca42bc80aa411cb3fd8f550aa6fdd16bdc LOG_WARNING(Render_Vulkan, "ANV drivers 22.3.0 to 23.1.0 have broken VK_KHR_push_descriptor"); - RemoveExtension(extensions.push_descriptor, VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME); + //RemoveExtension(extensions.push_descriptor, VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME); } } else if (extensions.push_descriptor && is_nvidia) { const auto arch = GetNvidiaArch(); if (arch <= NvidiaArchitecture::Arch_Pascal) { LOG_WARNING(Render_Vulkan, "Pascal and older architectures have broken VK_KHR_push_descriptor"); - RemoveExtension(extensions.push_descriptor, VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME); + //RemoveExtension(extensions.push_descriptor, VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME); } } @@ -715,28 +726,25 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR must_emulate_scaled_formats = true; LOG_INFO(Render_Vulkan, "Dynamic state is disabled (dyna_state = 0), forcing scaled format emulation ON"); - // Remove all dynamic state 1-2 extensions and features + // Disable dynamic state 1-3 and all extensions RemoveExtensionFeature(extensions.custom_border_color, features.custom_border_color, - VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME); + VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME); RemoveExtensionFeature(extensions.extended_dynamic_state, features.extended_dynamic_state, - VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME); + VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME); RemoveExtensionFeature(extensions.extended_dynamic_state2, features.extended_dynamic_state2, - VK_EXT_EXTENDED_DYNAMIC_STATE_2_EXTENSION_NAME); + VK_EXT_EXTENDED_DYNAMIC_STATE_2_EXTENSION_NAME); RemoveExtensionFeature(extensions.vertex_input_dynamic_state, features.vertex_input_dynamic_state, - VK_EXT_VERTEX_INPUT_DYNAMIC_STATE_EXTENSION_NAME); - - // Disable extended dynamic state 3 features - features.extended_dynamic_state3.extendedDynamicState3ColorBlendEnable = false; - features.extended_dynamic_state3.extendedDynamicState3ColorBlendEquation = false; - features.extended_dynamic_state3.extendedDynamicState3DepthClampEnable = false; + VK_EXT_VERTEX_INPUT_DYNAMIC_STATE_EXTENSION_NAME); + RemoveExtensionFeature(extensions.extended_dynamic_state3, features.extended_dynamic_state3, + VK_EXT_EXTENDED_DYNAMIC_STATE_3_EXTENSION_NAME); dynamic_state3_blending = false; dynamic_state3_enables = false; - LOG_INFO(Render_Vulkan, "Dynamic state extensions and features have been fully disabled"); + LOG_INFO(Render_Vulkan, "All dynamic state extensions and features have been disabled"); } else { must_emulate_scaled_formats = false; LOG_INFO(Render_Vulkan, "Dynamic state is enabled (dyna_state = 1-3), disabling scaled format emulation"); @@ -799,7 +807,7 @@ VkFormat Device::GetSupportedFormat(VkFormat wanted_format, VkFormatFeatureFlags return alternative; } - // No alternatives found, panic + // No alternatives found, panic LOG_ERROR(Render_Vulkan, "Format={} with usage={} and type={} is not supported by the host hardware and " "doesn't support any of the alternatives", @@ -810,7 +818,7 @@ VkFormat Device::GetSupportedFormat(VkFormat wanted_format, VkFormatFeatureFlags void Device::ReportLoss() const { LOG_CRITICAL(Render_Vulkan, "Device loss occurred!"); - // Wait for the log to flush and for Nsight Aftermath to dump the results + // Wait for the log to flush and for Nsight Aftermath to dump the results std::this_thread::sleep_for(std::chrono::seconds{15}); } @@ -963,25 +971,30 @@ bool Device::GetSuitability(bool requires_swapchain) { // Assume we will be suitable. bool suitable = true; - // Configure properties. + // Configure properties. + VkPhysicalDeviceVulkan12Features features_1_2{}; + VkPhysicalDeviceVulkan13Features features_1_3{}; + VkPhysicalDeviceVulkan14Features features_1_4{}; + + // Configure properties. properties.properties = physical.GetProperties(); - // Set instance version. + // Set instance version. instance_version = properties.properties.apiVersion; - // Minimum of API version 1.1 is required. (This is well-supported.) + // Minimum of API version 1.1 is required. (This is well-supported.) ASSERT(instance_version >= VK_API_VERSION_1_1); - // Get available extensions. + // Get available extensions. auto extension_properties = physical.EnumerateDeviceExtensionProperties(); - // Get the set of supported extensions. + // Get the set of supported extensions. supported_extensions.clear(); for (const VkExtensionProperties& property : extension_properties) { supported_extensions.insert(property.extensionName); } - // Generate list of extensions to load. + // Generate list of extensions to load. loaded_extensions.clear(); #define EXTENSION(prefix, macro_name, var_name) \ @@ -1008,7 +1021,7 @@ bool Device::GetSuitability(bool requires_swapchain) { #undef FEATURE_EXTENSION #undef EXTENSION - // Some extensions are mandatory. Check those. +// Some extensions are mandatory. Check those. #define CHECK_EXTENSION(extension_name) \ if (!loaded_extensions.contains(extension_name)) { \ LOG_ERROR(Render_Vulkan, "Missing required extension {}", extension_name); \ @@ -1030,15 +1043,28 @@ bool Device::GetSuitability(bool requires_swapchain) { #undef LOG_EXTENSION #undef CHECK_EXTENSION - // Generate the linked list of features to test. + // Generate the linked list of features to test. features2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2; - // Set next pointer. + // Set next pointer. void** next = &features2.pNext; - // Test all features we know about. If the feature is not available in core at our - // current API version, and was not enabled by an extension, skip testing the feature. - // We set the structure sType explicitly here as it is zeroed by the constructor. + // Vulkan 1.2, 1.3 and 1.4 features + if (instance_version >= VK_API_VERSION_1_2) { + features_1_2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES; + features_1_3.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES; + features_1_4.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_4_FEATURES; + + features_1_2.pNext = &features_1_3; + features_1_3.pNext = &features_1_4; + + *next = &features_1_2; + // next = &features_1_4.pNext; + } + +// Test all features we know about. If the feature is not available in core at our +// current API version, and was not enabled by an extension, skip testing the feature. +// We set the structure sType explicitly here as it is zeroed by the constructor. #define FEATURE(prefix, struct_name, macro_name, var_name) \ features.var_name.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_##macro_name##_FEATURES; \ SetNext(next, features.var_name); @@ -1066,11 +1092,13 @@ bool Device::GetSuitability(bool requires_swapchain) { #undef EXT_FEATURE #undef FEATURE - // Perform the feature test. + // Perform the feature test. physical.GetFeatures2(features2); + + // Base Vulkan 1.0 features are always valid regardless of instance version. features.features = features2.features; - // Some features are mandatory. Check those. +// Some features are mandatory. Check those. #define CHECK_FEATURE(feature, name) \ if (!features.feature.name) { \ LOG_ERROR(Render_Vulkan, "Missing required feature {}", #name); \ @@ -1088,21 +1116,21 @@ bool Device::GetSuitability(bool requires_swapchain) { #undef LOG_FEATURE #undef CHECK_FEATURE - // Generate linked list of properties. + // Generate linked list of properties. properties2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2; - // Set next pointer. + // Set next pointer. next = &properties2.pNext; - // Get driver info. + // Get driver info. properties.driver.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES; SetNext(next, properties.driver); - // Retrieve subgroup properties. + // Retrieve subgroup properties. properties.subgroup_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES; SetNext(next, properties.subgroup_properties); - // Retrieve relevant extension properties. + // Retrieve relevant extension properties. if (extensions.shader_float_controls) { properties.float_controls.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES; @@ -1124,14 +1152,16 @@ bool Device::GetSuitability(bool requires_swapchain) { SetNext(next, properties.transform_feedback); } - // Perform the property fetch. + // Perform the property fetch. physical.GetProperties2(properties2); + + // Store base properties properties.properties = properties2.properties; - // Unload extensions if feature support is insufficient. + // Unload extensions if feature support is insufficient. RemoveUnsuitableExtensions(); - // Check limits. + // Check limits. struct Limit { u32 minimum; u32 value; @@ -1153,7 +1183,7 @@ bool Device::GetSuitability(bool requires_swapchain) { } } - // Return whether we were suitable. + // Return whether we were suitable. return suitable; } @@ -1164,14 +1194,14 @@ void Device::RemoveUnsuitableExtensions() { RemoveExtensionFeatureIfUnsuitable(extensions.custom_border_color, features.custom_border_color, VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME); - // VK_EXT_depth_bias_control + // VK_EXT_depth_bias_control extensions.depth_bias_control = features.depth_bias_control.depthBiasControl && features.depth_bias_control.leastRepresentableValueForceUnormRepresentation; RemoveExtensionFeatureIfUnsuitable(extensions.depth_bias_control, features.depth_bias_control, VK_EXT_DEPTH_BIAS_CONTROL_EXTENSION_NAME); - // VK_EXT_depth_clip_control + // VK_EXT_depth_clip_control extensions.depth_clip_control = features.depth_clip_control.depthClipControl; RemoveExtensionFeatureIfUnsuitable(extensions.depth_clip_control, features.depth_clip_control, VK_EXT_DEPTH_CLIP_CONTROL_EXTENSION_NAME); @@ -1182,13 +1212,13 @@ void Device::RemoveUnsuitableExtensions() { features.extended_dynamic_state, VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME); - // VK_EXT_extended_dynamic_state2 + // VK_EXT_extended_dynamic_state2 extensions.extended_dynamic_state2 = features.extended_dynamic_state2.extendedDynamicState2; RemoveExtensionFeatureIfUnsuitable(extensions.extended_dynamic_state2, features.extended_dynamic_state2, - VK_EXT_EXTENDED_DYNAMIC_STATE_2_EXTENSION_NAME); + VK_EXT_EXTENDED_DYNAMIC_STATE_2_EXTENSION_NAME); - // VK_EXT_extended_dynamic_state3 + // VK_EXT_extended_dynamic_state3 dynamic_state3_blending = features.extended_dynamic_state3.extendedDynamicState3ColorBlendEnable && features.extended_dynamic_state3.extendedDynamicState3ColorBlendEquation && @@ -1204,27 +1234,27 @@ void Device::RemoveUnsuitableExtensions() { features.extended_dynamic_state3, VK_EXT_EXTENDED_DYNAMIC_STATE_3_EXTENSION_NAME); - // VK_EXT_provoking_vertex + // VK_EXT_provoking_vertex extensions.provoking_vertex = features.provoking_vertex.provokingVertexLast && features.provoking_vertex.transformFeedbackPreservesProvokingVertex; - RemoveExtensionFeatureIfUnsuitable(extensions.provoking_vertex, features.provoking_vertex, - VK_EXT_PROVOKING_VERTEX_EXTENSION_NAME); + // RemoveExtensionFeatureIfUnsuitable(extensions.provoking_vertex, features.provoking_vertex, + // VK_EXT_PROVOKING_VERTEX_EXTENSION_NAME); - // VK_KHR_shader_atomic_int64 + // VK_KHR_shader_atomic_int64 extensions.shader_atomic_int64 = features.shader_atomic_int64.shaderBufferInt64Atomics && features.shader_atomic_int64.shaderSharedInt64Atomics; RemoveExtensionFeatureIfUnsuitable(extensions.shader_atomic_int64, features.shader_atomic_int64, VK_KHR_SHADER_ATOMIC_INT64_EXTENSION_NAME); - // VK_EXT_shader_demote_to_helper_invocation + // VK_EXT_shader_demote_to_helper_invocation extensions.shader_demote_to_helper_invocation = features.shader_demote_to_helper_invocation.shaderDemoteToHelperInvocation; RemoveExtensionFeatureIfUnsuitable(extensions.shader_demote_to_helper_invocation, features.shader_demote_to_helper_invocation, VK_EXT_SHADER_DEMOTE_TO_HELPER_INVOCATION_EXTENSION_NAME); - // VK_EXT_subgroup_size_control + // VK_EXT_subgroup_size_control extensions.subgroup_size_control = features.subgroup_size_control.subgroupSizeControl && properties.subgroup_size_control.minSubgroupSize <= GuestWarpSize && @@ -1233,7 +1263,7 @@ void Device::RemoveUnsuitableExtensions() { features.subgroup_size_control, VK_EXT_SUBGROUP_SIZE_CONTROL_EXTENSION_NAME); - // VK_EXT_transform_feedback + // VK_EXT_transform_feedback extensions.transform_feedback = features.transform_feedback.transformFeedback && features.transform_feedback.geometryStreams && @@ -1244,14 +1274,14 @@ void Device::RemoveUnsuitableExtensions() { RemoveExtensionFeatureIfUnsuitable(extensions.transform_feedback, features.transform_feedback, VK_EXT_TRANSFORM_FEEDBACK_EXTENSION_NAME); - // VK_EXT_vertex_input_dynamic_state + // VK_EXT_vertex_input_dynamic_state extensions.vertex_input_dynamic_state = features.vertex_input_dynamic_state.vertexInputDynamicState; - RemoveExtensionFeatureIfUnsuitable(extensions.vertex_input_dynamic_state, - features.vertex_input_dynamic_state, - VK_EXT_VERTEX_INPUT_DYNAMIC_STATE_EXTENSION_NAME); + //RemoveExtensionFeatureIfUnsuitable(extensions.vertex_input_dynamic_state, + //features.vertex_input_dynamic_state, + //VK_EXT_VERTEX_INPUT_DYNAMIC_STATE_EXTENSION_NAME); - // VK_KHR_pipeline_executable_properties + // VK_KHR_pipeline_executable_properties if (Settings::values.renderer_shader_feedback.GetValue()) { extensions.pipeline_executable_properties = features.pipeline_executable_properties.pipelineExecutableInfo; @@ -1264,7 +1294,7 @@ void Device::RemoveUnsuitableExtensions() { VK_KHR_PIPELINE_EXECUTABLE_PROPERTIES_EXTENSION_NAME); } - // VK_KHR_workgroup_memory_explicit_layout + // VK_KHR_workgroup_memory_explicit_layout extensions.workgroup_memory_explicit_layout = features.features.shaderInt16 && features.workgroup_memory_explicit_layout.workgroupMemoryExplicitLayout && diff --git a/src/video_core/vulkan_common/vulkan_device.h b/src/video_core/vulkan_common/vulkan_device.h index 93dfdcb722..ddc9451a7e 100644 --- a/src/video_core/vulkan_common/vulkan_device.h +++ b/src/video_core/vulkan_common/vulkan_device.h @@ -84,7 +84,8 @@ VK_DEFINE_HANDLE(VmaAllocator) EXTENSION(NV, DEVICE_DIAGNOSTICS_CONFIG, device_diagnostics_config) \ EXTENSION(NV, GEOMETRY_SHADER_PASSTHROUGH, geometry_shader_passthrough) \ EXTENSION(NV, VIEWPORT_ARRAY2, viewport_array2) \ - EXTENSION(NV, VIEWPORT_SWIZZLE, viewport_swizzle) + EXTENSION(NV, VIEWPORT_SWIZZLE, viewport_swizzle) \ + EXTENSION(EXT, DESCRIPTOR_INDEXING, descriptor_indexing) // Define extensions which must be supported. #define FOR_EACH_VK_MANDATORY_EXTENSION(EXTENSION_NAME) \ @@ -404,6 +405,11 @@ public: return extensions.viewport_array2; } + /// Returns true if the device supporst VK_EXT_DESCRIPTOR_INDEXING + bool isExtDescriptorIndexingSupported() const { + return extensions.descriptor_indexing; + } + /// Returns true if the device supports VK_NV_geometry_shader_passthrough. bool IsNvGeometryShaderPassthroughSupported() const { return extensions.geometry_shader_passthrough; diff --git a/src/yuzu/configuration/configure_graphics_extensions.cpp b/src/yuzu/configuration/configure_graphics_extensions.cpp index 88bea9786e..51c7a6cdea 100644 --- a/src/yuzu/configuration/configure_graphics_extensions.cpp +++ b/src/yuzu/configuration/configure_graphics_extensions.cpp @@ -33,6 +33,9 @@ void ConfigureGraphicsExtensions::SetConfiguration() {} void ConfigureGraphicsExtensions::Setup(const ConfigurationShared::Builder& builder) { auto& layout = *ui->populate_target->layout(); std::map hold{}; // A map will sort the data for us + + QSlider *dyna_state = nullptr; + QCheckBox *dyna_state3 = nullptr; for (auto setting : Settings::values.linkage.by_category[Settings::Category::RendererExtensions]) { ConfigurationShared::Widget* widget = builder.BuildWidget(setting, apply_funcs); @@ -50,12 +53,22 @@ void ConfigureGraphicsExtensions::Setup(const ConfigurationShared::Builder& buil if (setting->Id() == Settings::values.dyna_state.Id()) { widget->slider->setTickInterval(1); widget->slider->setTickPosition(QSlider::TicksAbove); + dyna_state = widget->slider; + } else if (setting->Id() == Settings::values.dyna_state3.Id()) { + dyna_state3 = widget->checkbox; } } for (const auto& [id, widget] : hold) { layout.addWidget(widget); } + + connect(dyna_state, &QSlider::sliderMoved, this, [dyna_state3](int value) { + dyna_state3->setEnabled(value == 2); + if (value < 2) { + dyna_state3->setChecked(false); + } + }); } void ConfigureGraphicsExtensions::ApplyConfiguration() { diff --git a/src/yuzu/configuration/shared_translation.cpp b/src/yuzu/configuration/shared_translation.cpp index 59f00f384e..6307daeb5a 100644 --- a/src/yuzu/configuration/shared_translation.cpp +++ b/src/yuzu/configuration/shared_translation.cpp @@ -235,6 +235,18 @@ std::unique_ptr InitializeTranslations(QWidget* parent) { tr("Enables the VkExtendedDynamicState* extensions.\nHigher dynamic states will generally improve " "performance, but may cause issues on certain games or devices.")); + INSERT(Settings, dyna_state3, tr("EDS3 + Vertex Input"), + tr("Enables the VkExtendedDynamicState3 and VkVertexInputDynamicState extensions.\n" + "Only Vulkan 1.3+ devices support these extensions, and will generally see improved performance.")); + + INSERT(Settings, provoking_vertex, tr("Provoking Vertex"), + tr("Improves lighting and vertex handling in certain games.\n" + "Only Vulkan 1.0+ devices support this extension.")); + + INSERT(Settings, descriptor_indexing, tr("Descriptor Indexing"), + tr("Improves texture & buffer handling and the Maxwell translation layer.\n" + "Some Vulkan 1.1+ and all 1.2+ devices support this extension.")); + // Renderer (Debug) // System diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index ed0ffb7efc..30a6886d73 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp @@ -374,7 +374,7 @@ GameList::GameList(FileSys::VirtualFilesystem vfs_, FileSys::ManualContentProvid warning_layout = new QHBoxLayout; pre_alpha_warning = new QLabel; pre_alpha_warning->setText( - tr("IMPORTANT: Eden is PRE-ALPHA SOFTWARE and is not meant to be used by or get shared to the public just yet; " + tr("IMPORTANT: Eden is PRE-ALPHA SOFTWARE." "Bugs and unfinished features are expected to be present at this stage.")); pre_alpha_warning->setWordWrap(true); pre_alpha_warning->setOpenExternalLinks(true);