protonscr

UMA detection doesn't work correctly in presence of (DEVICE_LOCAL_BIT|LAZILY_ALLOCATED_BIT) memory type

vkd3dclosed
HansKristian-Work/vkd3d-proton#2806 · opened 2026-01-30 by werman · updated 2026-02-13 · 3 comments · github
Wwerman 2026-01-30 github

On Turnip we have a memory type for lazily allocated images:

memoryTypes[3]:
                heapIndex     = 0
                propertyFlags = 0x0011: count = 2
                        MEMORY_PROPERTY_DEVICE_LOCAL_BIT
                        MEMORY_PROPERTY_LAZILY_ALLOCATED_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
                                (transient only)
                        IMAGE_TILING_LINEAR:
                                color images
                                (transient only)

This throws off d3d12_device_is_uma because it expects that all memory types have HOST_VISIBLE_BIT if GPU has UMA, but lazily allocated memory type is special in this regard.

Ddoitsujin maintainer 2026-01-30 github

Ugh, yeah, I think we end up using this memory type as well with our current logic, unless the driver actually prevents us from doing so via memory type masks.

Is it on the same heap as all the other memory types? If so, I guess we can add special treatment for this flag, but the heuristics on our end are getting somewhat cursed.

Wwerman 2026-01-30 github

Yes, it's on the same heap:

VkPhysicalDeviceMemoryProperties:
=================================
memoryHeaps: count = 1
        memoryHeaps[0]:
                size   = 15398088960 (0x395cc3100) (14.34 GiB)
                budget = 11181930240 (0x29a7eb700) (10.41 GiB)
                usage  = 0 (0x00000000) (0.00 B)
                flags: count = 1
                        MEMORY_HEAP_DEVICE_LOCAL_BIT
memoryTypes: count = 4
        memoryTypes[0]:
                heapIndex     = 0
                propertyFlags = 0x0007: count = 3
                        MEMORY_PROPERTY_DEVICE_LOCAL_BIT
                        MEMORY_PROPERTY_HOST_VISIBLE_BIT
                        MEMORY_PROPERTY_HOST_COHERENT_BIT
        memoryTypes[1]:
                heapIndex     = 0
                propertyFlags = 0x000f: count = 4
                        MEMORY_PROPERTY_DEVICE_LOCAL_BIT
                        MEMORY_PROPERTY_HOST_VISIBLE_BIT
                        MEMORY_PROPERTY_HOST_COHERENT_BIT
                        MEMORY_PROPERTY_HOST_CACHED_BIT
        memoryTypes[2]:
                heapIndex     = 0
                propertyFlags = 0x000b: count = 3
                        MEMORY_PROPERTY_DEVICE_LOCAL_BIT
                        MEMORY_PROPERTY_HOST_VISIBLE_BIT
                        MEMORY_PROPERTY_HOST_CACHED_BIT
        memoryTypes[3]:
                heapIndex     = 0
                propertyFlags = 0x0011: count = 2
                        MEMORY_PROPERTY_DEVICE_LOCAL_BIT
                        MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT

Similar for proprietary driver: https://vulkan.gpuinfo.org/displayreport.php?id=44960#memory, but they have even more weirder memory types...

HHansKristian-Work maintainer 2026-02-13 github

Could you check if the PR reports what you expect now?

Nothing extracted yet.