Skip to content

Commit

Permalink
Get rid of push descriptor workarounds, make context flag instead.
Browse files Browse the repository at this point in the history
  • Loading branch information
Themaister committed Dec 8, 2024
1 parent bd851e6 commit 974c763
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 15 deletions.
2 changes: 1 addition & 1 deletion vulkan/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1423,7 +1423,7 @@ bool Context::create_device(VkPhysicalDevice gpu_, VkSurfaceKHR surface,
ADD_CHAIN(ext.video_maintenance1_features, VIDEO_MAINTENANCE_1_FEATURES_KHR);
}

if (has_extension(VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME))
if ((flags & CONTEXT_CREATION_ENABLE_PUSH_DESCRIPTOR_BIT) != 0 && has_extension(VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME))
{
enabled_extensions.push_back(VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME);
ext.supports_push_descriptor = true;
Expand Down
3 changes: 2 additions & 1 deletion vulkan/context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ enum ContextCreationFlagBits
CONTEXT_CREATION_ENABLE_VIDEO_ENCODE_BIT = 1 << 2,
CONTEXT_CREATION_ENABLE_VIDEO_H264_BIT = 1 << 3,
CONTEXT_CREATION_ENABLE_VIDEO_H265_BIT = 1 << 4,
CONTEXT_CREATION_ENABLE_PIPELINE_BINARY_BIT = 1 << 5
CONTEXT_CREATION_ENABLE_PIPELINE_BINARY_BIT = 1 << 5,
CONTEXT_CREATION_ENABLE_PUSH_DESCRIPTOR_BIT = 1 << 6
};
using ContextCreationFlags = uint32_t;

Expand Down
2 changes: 1 addition & 1 deletion vulkan/descriptor_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ DescriptorSetAllocator::DescriptorSetAllocator(Hash hash, Device *device_, const
device->register_descriptor_set_layout(set_layout_pool, get_hash(), info);
#endif

if (!bindless && device->get_device_features().supports_push_descriptor && !device->workarounds.broken_push_descriptors)
if (!bindless && device->get_device_features().supports_push_descriptor)
{
info.flags |= VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR;
for (auto &b : bindings)
Expand Down
11 changes: 0 additions & 11 deletions vulkan/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,8 +503,6 @@ const PipelineLayout *Device::request_pipeline_layout(const CombinedResourceLayo
h.data(layout.spec_constant_mask, sizeof(layout.spec_constant_mask));
h.u32(layout.attribute_mask);
h.u32(layout.render_target_mask);
// Drivers with and without push descriptor support need to observe different hashes for Fossilize.
h.s32(int(ext.supports_push_descriptor && !workarounds.broken_push_descriptors));
for (unsigned set = 0; set < VULKAN_NUM_DESCRIPTOR_SETS; set++)
{
Util::for_each_bit(layout.sets[set].immutable_sampler_mask, [&](unsigned bit) {
Expand Down Expand Up @@ -881,9 +879,6 @@ void Device::init_workarounds()
// Events are not supported in MoltenVK.
// TODO: Use VK_KHR_portability_subset to determine this.
workarounds.emulate_event_as_pipeline_barrier = true;
// MoltenVK is broken with push descriptor templates.
// KhronosGroup/MoltenVK issue 2323.
workarounds.broken_push_descriptors = true;
LOGW("Emulating events as pipeline barriers on Metal emulation.\n");
LOGW("Disabling push descriptors on Metal emulation.\n");
#else
Expand Down Expand Up @@ -932,12 +927,6 @@ void Device::init_workarounds()
// Avoids having to add workaround path to events as well, just fallback to plain barriers.
workarounds.emulate_event_as_pipeline_barrier = true;
}

// I cannot reproduce this myself, but there are several users experiencing GPU hangs with push descriptors
// on AMD drivers (not RADV), so :shrug:.
// https://github.com/simple64/simple64/issues/449
if (ext.driver_id == VK_DRIVER_ID_AMD_OPEN_SOURCE || ext.driver_id == VK_DRIVER_ID_AMD_PROPRIETARY)
workarounds.broken_push_descriptors = true;
#endif

if (ext.supports_tooling_info && vkGetPhysicalDeviceToolPropertiesEXT)
Expand Down
1 change: 0 additions & 1 deletion vulkan/quirks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,5 @@ struct ImplementationWorkarounds
bool broken_pipeline_cache_control = false;
bool force_host_cached = false;
bool force_sync1_access = false;
bool broken_push_descriptors = false;
};
}
2 changes: 2 additions & 0 deletions vulkan/wsi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ bool WSI::init_context_from_platform(unsigned num_thread_indices, const Context:
if (!new_context->init_instance(
instance_ext.data(), instance_ext.size(),
CONTEXT_CREATION_ENABLE_ADVANCED_WSI_BIT |
CONTEXT_CREATION_ENABLE_PUSH_DESCRIPTOR_BIT |
#ifdef GRANITE_VULKAN_SYSTEM_HANDLES
CONTEXT_CREATION_ENABLE_PIPELINE_BINARY_BIT |
#endif
Expand All @@ -373,6 +374,7 @@ bool WSI::init_context_from_platform(unsigned num_thread_indices, const Context:
VK_NULL_HANDLE, tmp_surface,
device_ext.data(), device_ext.size(),
CONTEXT_CREATION_ENABLE_ADVANCED_WSI_BIT |
CONTEXT_CREATION_ENABLE_PUSH_DESCRIPTOR_BIT |
#ifdef GRANITE_VULKAN_SYSTEM_HANDLES
CONTEXT_CREATION_ENABLE_PIPELINE_BINARY_BIT |
#endif
Expand Down

0 comments on commit 974c763

Please sign in to comment.