vulkan_device: Fully disable dynamic state extensions/features when dyna_state = 0
Some checks are pending
eden-build / source (push) Waiting to run
eden-build / windows (msvc) (push) Waiting to run
eden-build / linux (push) Waiting to run
eden-build / android (push) Waiting to run

If the user selects dynamic state = 0, force-disable all Vulkan dynamic state extensions and related struct fields.
This ensures compatibility with drivers and simplifies shader pipeline logic.

Also logs all removals for clarity.
This commit is contained in:
JPikachu 2025-04-29 20:30:47 +01:00 committed by JPikachu
parent 82d2f14f48
commit b2dcc2d0d2

View file

@ -711,14 +711,36 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
dynamic_state3_enables = true; dynamic_state3_enables = true;
} }
// Scaled formats must be emulated if dynamic state is disabled
if (Settings::values.dyna_state.GetValue() == 0) { if (Settings::values.dyna_state.GetValue() == 0) {
must_emulate_scaled_formats = true; must_emulate_scaled_formats = true;
LOG_INFO(Render_Vulkan, "Dynamic state is disabled (dyna_state = 0), forcing scaled format emulation ON"); 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
RemoveExtensionFeature(extensions.custom_border_color, features.custom_border_color,
VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME);
RemoveExtensionFeature(extensions.extended_dynamic_state, features.extended_dynamic_state,
VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME);
RemoveExtensionFeature(extensions.extended_dynamic_state2, features.extended_dynamic_state2,
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;
dynamic_state3_blending = false;
dynamic_state3_enables = false;
LOG_INFO(Render_Vulkan, "Dynamic state extensions and features have been fully disabled");
} else { } else {
must_emulate_scaled_formats = false; must_emulate_scaled_formats = false;
LOG_INFO(Render_Vulkan, "Dynamic state is enabled (dyna_state = 1-3), disabling scaled format emulation"); LOG_INFO(Render_Vulkan, "Dynamic state is enabled (dyna_state = 1-3), disabling scaled format emulation");
} }
logical = vk::Device::Create(physical, queue_cis, ExtensionListForVulkan(loaded_extensions), logical = vk::Device::Create(physical, queue_cis, ExtensionListForVulkan(loaded_extensions),
first_next, dld); first_next, dld);