mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-24 13:45:57 +00:00
Merge pull request #1368: FSR 3.1 and frame generation skip protected and AMD device-coherent memory types (gurrgur)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
e3befaebcc
2 files changed
+26
-2
No files matched your search
+6
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user