The previous fix just used a local variable for the memory properties, which did not fix this issue.
Unified · Split
| @@ -1666,16 +1666,12 @@ static void vulkan_device_uninit(AVHWDeviceContext *ctx) · 1665 unmodified lines | ||
| 1666 | 1666 | static int vulkan_device_has_rebar(AVHWDeviceContext *ctx) |
| 1667 | 1667 | { |
| 1668 | 1668 | VulkanDevicePriv *p = ctx->hwctx; |
| 1669 | − AVVulkanDeviceContext *hwctx = &p->p; | |
| 1670 | − FFVulkanFunctions *vk = &p->vkctx.vkfn; | |
| 1671 | − VkPhysicalDeviceMemoryProperties mprops; | |
| 1672 | 1669 | VkDeviceSize max_vram = 0, max_visible_vram = 0; |
| 1673 | 1670 | |
| 1674 | 1671 | /* Get device memory properties */ |
| 1675 | − vk->GetPhysicalDeviceMemoryProperties(hwctx->phys_dev, &mprops); | |
| 1676 | − for (int i = 0; i < mprops.memoryTypeCount; i++) { | |
| 1677 | − const VkMemoryType type = mprops.memoryTypes[i]; | |
| 1678 | − const VkMemoryHeap heap = mprops.memoryHeaps[type.heapIndex]; | |
| 1672 | + for (int i = 0; i < p->mprops.memoryTypeCount; i++) { | |
| 1673 | + const VkMemoryType type = p->mprops.memoryTypes[i]; | |
| 1674 | + const VkMemoryHeap heap = p->mprops.memoryHeaps[type.heapIndex]; | |
| 1679 | 1675 | if (!(type.propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)) |
| 1680 | 1676 | continue; |
| 1681 | 1677 | max_vram = FFMAX(max_vram, heap.size); |
| @@ -2019,6 +2015,9 @@ FF_ENABLE_DEPRECATION_WARNINGS · 337 unmodified lines | ||
| 2019 | 2015 | if (!hwctx->unlock_queue) |
| 2020 | 2016 | hwctx->unlock_queue = unlock_queue; |
| 2021 | 2017 | |
| 2018 | + /* Re-query device capabilities, in case the device was created externally */ | |
| 2019 | + vk->GetPhysicalDeviceMemoryProperties(hwctx->phys_dev, &p->mprops); | |
| 2020 | + | |
| 2022 | 2021 | p->vkctx.device = ctx; |
| 2023 | 2022 | p->vkctx.hwctx = hwctx; |
| 2024 | 2023 | |
| @@ -2026,6 +2025,9 @@ FF_ENABLE_DEPRECATION_WARNINGS · 1 unmodified line | ||
| 2026 | 2025 | p->compute_qf = ff_vk_qf_find(&p->vkctx, VK_QUEUE_COMPUTE_BIT, 0); |
| 2027 | 2026 | p->transfer_qf = ff_vk_qf_find(&p->vkctx, VK_QUEUE_TRANSFER_BIT, 0); |
| 2028 | 2027 | |
| 2028 | + /* Re-query device capabilities, in case the device was created externally */ | |
| 2029 | + vk->GetPhysicalDeviceMemoryProperties(hwctx->phys_dev, &p->mprops); | |
| 2030 | + | |
| 2029 | 2031 | /* Only use host image transfers if ReBAR is enabled */ |
| 2030 | 2032 | p->disable_host_transfer = !vulkan_device_has_rebar(ctx); |
| 2031 | 2033 | |