Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions project_tuxbox/console_cbv.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ def configure_console_cbv(backend, env, executable, report):
if marker and marker.is_file() and feature in marker.read_text().splitlines():
prepend(env, "VKD3D_CONFIG", feature, ",")
# The fork binds 16-byte offsets as storage buffers on its descriptor-set path.
prepend(env, "VKD3D_DISABLE_EXTENSIONS", "VK_EXT_descriptor_buffer", ",")
for extension in ("VK_EXT_descriptor_heap", "VK_EXT_descriptor_buffer"):
prepend(env, "VKD3D_DISABLE_EXTENSIONS", extension, ",")
report("Constant-buffer alignment: selected Proton build feature")
else:
# The layer hides VK_EXT_descriptor_buffer itself, only on GPUs that need it.
# The layer hides descriptor buffers and heaps itself, only on GPUs that need it.
layer = console_cbv_layer(env)
path_key = "VK_LAYER_PATH" if env.get("VK_LAYER_PATH") else "VK_ADD_LAYER_PATH"
prepend(env, path_key, layer, ":")
Expand Down
7 changes: 4 additions & 3 deletions tests/test_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,13 @@ def test_explicit_fork_feature_and_wine_with_an_older_staged_copy(self):
sample.write_bytes(b"older sample")
self.provider.write_bytes(sample.read_bytes())
(self.root / "tuxbox-features").write_text("cbv_16_byte_alignment\n")
env = {"PROTONPATH": str(self.root), "VKD3D_DISABLE_EXTENSIONS": "first;VK_EXT_descriptor_buffer",
env = {"PROTONPATH": str(self.root),
"VKD3D_DISABLE_EXTENSIONS": "first;VK_EXT_descriptor_buffer;VK_EXT_descriptor_heap",
"VKD3D_CONFIG": "other"}
with patch("project_tuxbox.console_cbv.console_cbv_layer", return_value=self.layer) as layer:
configure_console_cbv("proton", env, self.exe, self.log.status)
self.assertEqual(env["VKD3D_CONFIG"], "cbv_16_byte_alignment,other")
self.assertEqual(env["VKD3D_DISABLE_EXTENSIONS"], "first;VK_EXT_descriptor_buffer")
self.assertEqual(env["VKD3D_DISABLE_EXTENSIONS"], "first;VK_EXT_descriptor_buffer;VK_EXT_descriptor_heap")
layer.assert_not_called()
wine = {"PROTONPATH": str(self.root)}
configure_console_cbv("wine", wine, self.exe, self.log.status)
Expand All @@ -296,7 +297,7 @@ def test_explicit_fork_feature_and_wine_with_an_older_staged_copy(self):
self.assertNotIn("VKD3D_DISABLE_EXTENSIONS", wine)
fork = {"PROTONPATH": str(self.root)}
configure_console_cbv("proton", fork, self.exe, self.log.status)
self.assertEqual(fork["VKD3D_DISABLE_EXTENSIONS"], "VK_EXT_descriptor_buffer")
self.assertEqual(fork["VKD3D_DISABLE_EXTENSIONS"], "VK_EXT_descriptor_buffer,VK_EXT_descriptor_heap")
self.assertNotIn("PRESSURE_VESSEL_FILESYSTEMS_RO", wine)

def test_native_foreign_missing_and_explicit_comparison(self):
Expand Down
12 changes: 9 additions & 3 deletions tools/reference/cbv-layer/layer.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
#include <stdlib.h>
#include <string.h>

// Vulkan headers older than VK_EXT_descriptor_heap do not name it.
#ifndef VK_EXT_DESCRIPTOR_HEAP_EXTENSION_NAME
#define VK_EXT_DESCRIPTOR_HEAP_EXTENSION_NAME "VK_EXT_descriptor_heap"
#endif

struct instance_dispatch {
void *key;
PFN_vkGetInstanceProcAddr get_proc;
Expand Down Expand Up @@ -130,8 +135,8 @@ static VKAPI_ATTR void VKAPI_CALL get_khr_features(VkPhysicalDevice device, VkPh
}

// vkd3d-proton binds constant buffers as storage buffers only on its
// descriptor-set path, so hide descriptor buffers from the devices that need it.
// Other devices keep the extension.
// descriptor-set path, so hide descriptor buffers and descriptor heaps from the
// devices that need it. Other devices keep both extensions.
static VKAPI_ATTR VkResult VKAPI_CALL enumerate_extensions(VkPhysicalDevice device, const char *layer,
uint32_t *count, VkExtensionProperties *properties) {
const struct instance_dispatch *entry = lookup(device);
Expand All @@ -149,7 +154,8 @@ static VKAPI_ATTR VkResult VKAPI_CALL enumerate_extensions(VkPhysicalDevice devi
if (result == VK_SUCCESS) {
uint32_t capacity = properties ? *count : 0, kept = 0;
for (uint32_t i = 0; i < total; i++) {
if (!strcmp(all[i].extensionName, VK_EXT_DESCRIPTOR_BUFFER_EXTENSION_NAME))
if (!strcmp(all[i].extensionName, VK_EXT_DESCRIPTOR_BUFFER_EXTENSION_NAME)
|| !strcmp(all[i].extensionName, VK_EXT_DESCRIPTOR_HEAP_EXTENSION_NAME))
continue;
if (properties) {
if (kept == capacity) {
Expand Down
Loading