Guest memory: allow device-local host types on single-pool GPUs

On integrated Intel Arc/Xe with Mesa's ANV driver every memory type is
device-local and host-pointer imports are allowed only into those, so no
type was found and the game stopped at startup with exit code 23. A second
pass now accepts a device-local host-visible type when no system-memory
type is allowed; the search is unchanged on other GPUs.

From deadinside28/bloodborne_pc#429.

Co-Authored-By: Mark Hall <[email protected]>
This commit is contained in:
ayozetrandMark Hall committed 2026-11-04 11:11:26 +00:00
1 parent 21e1ce4224
commit 843424de13
1 file changed
+15 -9
+15 -9
View File
@@ -124,16 +124,22 @@ void FreeChunk(u64 phys, u64 size) {
std::uint32_t FindHostType(std::uint32_t bits) {
// Cached host memory first, then any host-visible type the import allows.
for (const bool cached : {true, false}) {
for (std::uint32_t i = 0; i < memory_properties.memoryTypeCount; ++i) {
const auto flags = memory_properties.memoryTypes[i].propertyFlags;
if (!(bits & (1u << i)) || !(flags & vk::MemoryPropertyFlagBits::eHostVisible) ||
(flags & vk::MemoryPropertyFlagBits::eDeviceLocal) || !TypeAllowed(flags) ||
(cached &&!(flags & vk::MemoryPropertyFlagBits::eHostCached))) {
continue;
// Cached host memory first, then any host-visible type the import allows. System-memory types
// (not device-local) come first; a GPU with one memory pool (Intel ANV on integrated Arc/Xe:
// every type is device-local, the imports allow only those) then takes a device-local
// host-visible type: the pages stay the CPU's own, cached, memory.
for (const bool device_local : {false, true}) {
for (const bool cached : {true, false}) {
for (std::uint32_t i = 0; i < memory_properties.memoryTypeCount; ++i) {
const auto flags = memory_properties.memoryTypes[i].propertyFlags;
if (!(bits & (1u << i)) || !(flags & vk::MemoryPropertyFlagBits::eHostVisible) ||
bool(flags & vk::MemoryPropertyFlagBits::eDeviceLocal) != device_local ||
!TypeAllowed(flags) ||
(cached && !(flags & vk::MemoryPropertyFlagBits::eHostCached))) {
continue;
}
return i;
}
return i;
}
}
return ~0u;