upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/src/vulkan_index_view.h
blob: b9e72349b7afb10a8a5e6a75e21e05c600febeb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Device creation policy for bounded D3D12 indexed-indirect draws. No work per draw.
#pragma once

#include <vulkan/vulkan.h>

namespace leonida {

inline bool can_enable_robust_index_view(VkPhysicalDevice device, PFN_vkGetPhysicalDeviceProperties2 properties,
                                         bool sized_indirect, bool robust_access, bool storage_update_after_bind) {
    if (!sized_indirect || !robust_access) return false;
    if (!storage_update_after_bind) return true;
    // VUID-VkDeviceCreateInfo-robustBufferAccess-10247: preserve bindless rather than disabling
    // descriptorBindingStorageBufferUpdateAfterBind on a device that cannot combine the two.
    if (!properties) return false;
    VkPhysicalDeviceVulkan12Properties indexed{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES};
    VkPhysicalDeviceProperties2 query{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, &indexed};
    properties(device, &query);
    return indexed.robustBufferAccessUpdateAfterBind == VK_TRUE;
}

} // namespace leonida