Driver bans

src/common/gpu/vk/extension_bans.txt is the table of drivers known to break a Vulkan extension or feature: a line per ban, with the extension or feature, off, warn or prefer, the driver (its VkDriverId by name, or * for each driver, whose versions are then *), the versions in that driver's own numbering, the system, the GPUs, what breaks, where that is known from, the case that tests it again, the date it was last tested and the setting that turns it on anyway. Its head explains each field. It is compiled in, and the device reads it before it turns anything on (src/common/gpu/vk/extension_bans.c): an off line takes the extension out of the device's list, or the feature off where the renderer can do without it, and a warn line is only said. A prefer line is the other way round: the way its key names is taken on the drivers it lists and on no other (vk_prefer), with the measure that showed it. The renderer compares no driver or vendor itself: runtime_architecture refuses one outside the table's reader. Each line that holds is said in the log, with the device, its driver and version and the table's line:

vulkan: VK_KHR_present_id2 is off on NVIDIA GeForce RTX 3060 (NVIDIA, 590.48.01, driver version 590.48.01): NVIDIA's driver before 595.0.0 hangs games at their first frames with present_id2 and present_wait2 (590.48, with Smooth Motion on) (DXVK dxvk_device_info.cpp:610, issue 5507; extension_bans.txt:66)

A ban joins the table with its source; one that holds for something the renderer does not use is said as such. Driver quirks shows every line by driver, beside the quirks the code works around by itself: scripts/check-docs.py --bans writes those rows from the table after a change to it, and docs_check fails while they differ. vulkan_ban_ignore (Settings) goes over the bans of the keys it lists for one run, to test a driver again: --vulkan-ban-ignore=VK_KHR_present_id2 on the command line, --setting vulkan_ban_ignore=... to scripts/amberlith.py, the row in a phone's .ini. Each key is said, as a warning with the ban it goes over where one holds; a key the table has not stops the game with the nearest ones it has. A case that passes with the ban gone over, held against the console's or Eden's, is what lifts it. To see which lines hold for this machine's drivers, or for a driver given by hand:

build/tests/snx-test-vk-bans --devices                              # each Vulkan device and the lines that hold
build/tests/snx-test-vk-bans --match qualcomm 512.800.48 android    # a phone's driver
build/tests/snx-test-vk-bans --check src/common/gpu/vk/extension_bans.txt   # a table being edited: its first error
ctest --test-dir build -R 'vk_extension_bans|vk_vertex_input'

Each extension the renderer can use also has a setting, vk_ext_<name> (Settings), auto by default: auto leaves the extension to this table, on goes over every line on it, off takes it out of the device's list (vk_extension_settings, beside the table in extension_bans.c). The list is the table g_vk_extensions_ini vulkan of src/nx/runtime/settings.txt, a setting @VK_... line per extension a renderer turns on: tools/settingsgen checks each against the Khronos registry (the build's Vulkan-Headers' registry/vk.xml) and makes its key and help. A new extension the renderer reads is a line there. The log says each one's value in effect and why after the bans:

vulkan: VK_EXT_vertex_input_dynamic_state: on (vk_ext_vertex_input_dynamic_state=on goes over the ban: ...)

vk_extension_bans checks the table's errors, each driver's numbering at every bound's edge, the filter and the features asked for against stand-in devices, the table the build carries, vulkan_ban_ignore read from a .ini with a key the table has and with one it has not, and the extension settings' values and log lines.

An extension stays on only with its commands. Once the device is made, each command each of its extensions requires is asked of the driver (vkGetDeviceProcAddr, snx_vk_commands_lacking in src/common/gpu/vk/extension_commands.c). The table of them is generated from the same registry by tools/vkcmdgen: every device extension, with the commands of its <require> blocks that a device answers for, each block's depends kept and checked against the device (a version up to the one the renderer runs it at, an extension it is made with; any other name, an instance extension's, does not hold). A driver that lists an extension without one of them (NVIDIA's VK_EXT_depth_clamp_control without vkCmdSetDepthClampRangeEXT) would have the renderer call a null pointer: the extension goes off as an off line takes one out, its features and their structures with it, and the device is made again without it, once. A command the renderer tests for NULL before each call is the exception (snx_vk_optional_commands there: vkGetQueueCheckpointData2NV, which NVIDIA's driver leaves out of VK_NV_device_diagnostic_checkpoints): its extension stays on, and a warning names the command and what goes without it. Every renderer's device takes that check, in the one way they make it (below). One the device can't go without (a window's swapchain, what 1.3 took in on a 1.2 device) fails the start, saying so, and so does a device made again that still lacks a command. The log says each, with the driver and its version (here a command vk_debug_hide_commands hid, on lavapipe):

vulkan: llvmpipe (LLVM 22.1.8, 256 bits)'s driver lists VK_EXT_conditional_rendering without vkCmdBeginConditionalRenderingEXT, which it requires (vk_debug_hide_commands hides it from the check): the device is made again without it
vulkan: VK_EXT_conditional_rendering is off on llvmpipe (LLVM 22.1.8, 256 bits) (llvmpipe, Mesa 26.2.6 (LLVM 22.1.8), driver version 26.2.6): its driver lists it without vkCmdBeginConditionalRenderingEXT, which it requires (vk_debug_hide_commands hides from the check what the driver has)

vk_debug_hide_commands (Settings) has the check take the commands it lists as missing, to test that path on any driver (one the renderer goes without is also unloaded from volk, as such a driver leaves it); a 3DS or Vita game takes it too. vulkan_headless_hidden_commands hides vkCmdSetDepthClampRangeEXT and vkCmdBeginConditionalRenderingEXT and runs every check of vulkan_headless on the device made again without the extensions of the two that the driver has on; 3ds_vk_hidden_commands makes the 3DS's device again without VK_EXT_shader_object, and vita_vk_device the Vita's without VK_KHR_dynamic_rendering_local_read, by the check and by its setting; vk_extension_commands checks the table, the depends, a stand-in device's check, a command the renderer goes without and the hide list; vkcmdgen the generator on registries of its own and on the build's; and vk_extension_settings that every device extension a renderer can turn on has its setting @VK_... line.

ctest --test-dir build -R 'vk_extension_commands|vk_extension_settings|vkcmdgen|vk_extension_bans'
VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/lvp_icd.x86_64.json ctest --test-dir build -R 'hidden_commands'

Every renderer makes its device one way, snx_vk_device_make (src/common/gpu/vk/device.h): the Switch's, the 3DS's, the Vita's, the NDS's, the GBA's and the Android apps'. It reads the table, vulkan_ban_ignore and vk_debug_hide_commands; on each physical device it applies the vk_ext_* settings, then the bans, to the device's list, and gives what is left to the renderer's choose. That turns an extension on only through snx_vk_choice_enable, which refuses, naming it, one no setting @VK_... line names (the Android apps' program reads no settings, so takes the bans and the check alone), and makes the device through snx_vk_choice_create; the check of the commands and the device made again follow. The log says the bans and the setting of each extension the renderer asked about, each device passed over and why, and the device made:

nds gpu: the device is AMD Radeon RX 6700 XT (RADV NAVI22), driver radv Mesa 26.2.6, Vulkan 1.3, queue family 0, made with no extension

runtime_architecture fails a source of src/ but common/gpu/vk/device.c that calls vkCreateDevice or volkLoadDevice, and vk_device_make checks the way with stand-in drivers: the settings before the bans, an extension no setting names refused, one whose driver lacks a command left out of the device made again, the devices passed over.


Made from docs/dev/development.md at 69237645142c. GPL-3.0-or-later.