protonscr

Commit 4075809 breaks multiple games

vkd3dclosed
HansKristian-Work/vkd3d-proton#860 · opened 2021-10-18 by dave-juicelabs · updated 2021-10-18 · 11 comments · github
Ddave-juicelabs 2021-10-18 github

https://github.com/HansKristian-Work/vkd3d-proton/commit/4075809a91b09d932abced9b9ace994671164228

For this commit, repeated here:

 1:        if (vkd3d_memory_info_type_mask_covers_multiple_memory_heaps(&device->memory_properties, type_mask))
 2:        {
 3:            WARN("Memory allocation failed, falling back to system memory.\n");
 4:            hr = vkd3d_try_allocate_device_memory(device, size,
 5:                    type_flags & ~optional_flags, type_mask, pNext, allocation);
 6:        }
 7:        else if (device->memory_properties.memoryHeapCount > 1)
 8:        {
 9:            /* It might be the case (NV with RT/DS heap) that we just cannot fall back in any meaningful way.
10:             * E.g. there exists no memory type that is not DEVICE_LOCAL and covers both RT and DS.
11:             * For this case, we have no choice but to not allocate,
12:             * and defer actual memory allocation to CreatePlacedResource() time. */
13:            WARN("Memory allocation failed, but it is not possible to fallback to system memory here. Deferring allocation.\n");
14:            return hr;
15:        }
16:
17:        /* If we fail to allocate, and only have one heap to work with (iGPU),
18:         * falling back is meaningless, just fail. */

Line 1 seems to be the issue. The initial vkd3d_try_allocate_device_memory, not shown here, fails and previously line 4 would execute and succeeded because of the removal of the optional_flags. This commit prevents that second attempt to allocate and is seemingly the cause of borderlands 3 and cyberpunk 2077 from running.

Mmisyltoad maintainer 2021-10-18 github

We havent seen this issue on amd or nv at all. Can you give vulkaninfo output?

Ddave-juicelabs 2021-10-18 github

I'm not at my system at the moment.

I believe this is my GPU.
https://vulkan.gpuinfo.org/displayreport.php?id=10830

HHansKristian-Work maintainer 2021-10-18 github

That is a Windows report, sure that is correct? Please paste vulkaninfo output.

SSveSop 2021-10-18 github

I'm not at my system at the moment.

I believe this is my GPU. https://vulkan.gpuinfo.org/displayreport.php?id=10830

I this seems to be what is reported from https://github.com/SaschaWillems/VulkanCapsViewer - App to report vulkan capabilities (and can be run from Wine.)

Afaik this may not report the same as vulkaninfo run natively from Linux does, since it may rely on what wine version (winevulkan) are being run. (API, extensions and whatnot). Your best bet would be to run Vulkaninfo from Linux to make sure "actual" capabilities are reported.

HHansKristian-Work maintainer 2021-10-18 github

I tried Cyberpunk on RTX 3070 with 495.29.05 in both Resizable BAR and without Resizable BAR enabled in BIOS, and it works fine for me.

I'd need more detailed information, in particular, logging type_mask + vulkaninfo might help.

Ddave-juicelabs 2021-10-18 github

juice.vulkaninfo.log
vulkaninfo.log

Here are the vulkan info output. I will get some information from the runs later.

HHansKristian-Work maintainer 2021-10-18 github
memoryTypes: count = 4
	memoryTypes[0]:
		heapIndex     = 0
		propertyFlags = 0x0001: count = 1
			MEMORY_PROPERTY_DEVICE_LOCAL_BIT
		usable for:
			IMAGE_TILING_OPTIMAL:
				color images
				FORMAT_D16_UNORM
				FORMAT_X8_D24_UNORM_PACK32
				FORMAT_D32_SFLOAT
				FORMAT_S8_UINT
				FORMAT_D24_UNORM_S8_UINT
				FORMAT_D32_SFLOAT_S8_UINT
				(non-sparse)
			IMAGE_TILING_LINEAR:
				color images
				(non-sparse, non-transient)
	memoryTypes[1]:
		heapIndex     = 1
		propertyFlags = 0x0006: count = 2
			MEMORY_PROPERTY_HOST_VISIBLE_BIT
			MEMORY_PROPERTY_HOST_COHERENT_BIT
		usable for:
			IMAGE_TILING_OPTIMAL:
				None
			IMAGE_TILING_LINEAR:
				color images
				(non-sparse, non-transient)
	memoryTypes[2]:
		heapIndex     = 1
		propertyFlags = 0x000e: count = 3
			MEMORY_PROPERTY_HOST_VISIBLE_BIT
			MEMORY_PROPERTY_HOST_COHERENT_BIT
			MEMORY_PROPERTY_HOST_CACHED_BIT
		usable for:
			IMAGE_TILING_OPTIMAL:
				None
			IMAGE_TILING_LINEAR:
				color images
				(non-sparse, non-transient)
	memoryTypes[3]:
		heapIndex     = 2
		propertyFlags = 0x0007: count = 3
			MEMORY_PROPERTY_DEVICE_LOCAL_BIT
			MEMORY_PROPERTY_HOST_VISIBLE_BIT
			MEMORY_PROPERTY_HOST_COHERENT_BIT
		usable for:
			IMAGE_TILING_OPTIMAL:
				None
			IMAGE_TILING_LINEAR:
				None

Is disturbing and completely different from what other NV GPUs do. This implies that fallback allocations are straight up impossible, so I don't think vkd3d-proton is necessarily wrong here.

SSveSop 2021-10-18 github

Is this "juice gpu" some sort of virtual gpu? Maybe it is trying to render the game on some virtual gpu thing, and that is what is failing...

Could https://github.com/doitsujin/dxvk#device-filter be useful? Assuming that DXVK's dxgi.dll is used to set up the devices in the wineprefix.

Ddave-juicelabs 2021-10-18 github

Juice GPU is the product I am working on. It is a virtual GPU of sorts. It is the client side of a remote GPU architecture. juicelabs.co

@HansKristian-Work Would you explain a small bit why it is disturbing? From what you posted, am I right that it is the image tiling support for the various memory types?

HHansKristian-Work maintainer 2021-10-18 github

The problem here is that there is only one memory type which can support textures, memory type 0. When GPU VRAM is exhausted, try_allocate_memory for device-local memory fails, but there is no other memory type to fall back to, normally we'd use a memory type with no DEVICE_LOCAL on NVIDIA, which maps to system memory. I'm very confused as to why this worked before the patch however, it should be impossible.

Given this vulkaninfo output, failing the check in line 1 is working as intended at least.

Ddave-juicelabs 2021-10-18 github

Thank you. This is an error in Juice. I will figure out why only memory type 0 is showing support.

DLLs