FSR 3.1 and frame generation no longer allocate their images in protected or AMD device-coherent memory, which turned the whole picture into noise on RADV

The SDK's findMemoryTypeIndex keeps the last matching memory type, and RADV lists protected (TMZ) and DEVICE_COHERENT_AMD / DEVICE_UNCACHED_AMD device-local types after the plain ones. The runtime enables neither feature, so on a Radeon 780M (Mesa 26.3) every FSR pass read garbage. Those types are now skipped. On unified-memory GPUs (Adreno under Turnip), where every device-local type is host-visible, it falls back to a host-visible device-local type instead of failing every texture allocation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
gurrgurandClaude Opus 5.5 committed 2026-11-22 13:37:42 +01:00
1 parent afae80c908
commit ba81204847
2 files changed
+26 -2

No files matched your search

+6
View File
@@ -43,3 +43,9 @@ Changes of our own (marked "TotK Recomp"):
- `sdk/include/FidelityFX/gpu/fsr3upscaler/ffx_fsr3upscaler_callbacks_glsl.h`: the luma history's storage image is
declared `rgba16f`, the format of its images (R16G16B16A16_FLOAT in `ffx_fsr3upscaler.cpp`). It was `rgba8`, which
the Vulkan validation layer reports as a format mismatch with undefined loads and stores.
- `sdk/src/backends/vk/ffx_vk.cpp` `findMemoryTypeIndex`: memory types with `PROTECTED`, `DEVICE_COHERENT_AMD` or
`DEVICE_UNCACHED_AMD` are skipped, since the runtime enables neither protected memory nor device-coherent memory. The
function keeps the last matching type, and RADV lists those types after the plain device-local ones, so on a Radeon
780M (Mesa 26.3) FSR 3.1's images were allocated in them and its whole output was noise. When no device-local type
without `HOST_VISIBLE` exists (unified-memory GPUs: Adreno under Turnip) it takes a host-visible device-local one
instead of failing every texture allocation.
@@ -402,14 +402,28 @@ uint32_t findMemoryTypeIndex(VkPhysicalDevice physicalDevice, VkMemoryRequiremen
vkGetPhysicalDeviceMemoryProperties(physicalDevice, &memProperties);
uint32_t bestCandidate = UINT32_MAX;
// TotK Recomp: unified-memory GPUs (Adreno under Turnip) have no device-local type without HOST_VISIBLE: the first
// host-visible one is taken rather than failing when no invisible type exists.
uint32_t visibleCandidate = UINT32_MAX;
VkMemoryPropertyFlags visibleProperties = 0;
for (uint32_t i = 0; i < memProperties.memoryTypeCount; i++) {
if ((memRequirements.memoryTypeBits & (1 << i)) && (memProperties.memoryTypes[i].propertyFlags & requestedProperties)) {
// if just device-local memory is requested, make sure this is the invisible heap to prevent over-subscribing the local heap
if (requestedProperties == VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT && (memProperties.memoryTypes[i].propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT))
// TotK Recomp: types that need a device feature the application did not enable are skipped. The loop keeps
// the last match, and RADV lists protected (TMZ) and AMD device-coherent/uncached device-local types after
// the plain ones: FSR 3.1's images landed in them and every pass read noise.
if (memProperties.memoryTypes[i].propertyFlags & (VK_MEMORY_PROPERTY_PROTECTED_BIT | VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD |
VK_MEMORY_PROPERTY_DEVICE_UNCACHED_BIT_AMD))
continue;
// if just device-local memory is requested, make sure this is the invisible heap to prevent over-subscribing the local heap
if (requestedProperties == VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT && (memProperties.memoryTypes[i].propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT)) {
if (visibleCandidate == UINT32_MAX)
visibleCandidate = i, visibleProperties = memProperties.memoryTypes[i].propertyFlags;
continue;
}
bestCandidate = i;
outProperties = memProperties.memoryTypes[i].propertyFlags;
@@ -419,6 +433,10 @@ uint32_t findMemoryTypeIndex(VkPhysicalDevice physicalDevice, VkMemoryRequiremen
}
}
if (bestCandidate == UINT32_MAX && visibleCandidate != UINT32_MAX) {
bestCandidate = visibleCandidate;
outProperties = visibleProperties;
}
return bestCandidate;
}