[PR #3092] [CLOSED] VulkanDevice: Accelerate texture downloads with VK_EXT_external_memory_host #1589

Closed
opened 2026-01-29 19:17:33 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/stenzek/duckstation/pull/3092
Author: @Wunkolo
Created: 1/21/2024
Status: Closed

Base: masterHead: vk-memory-import


📝 Commits (3)

  • 8b5f40e VulkanDevice: Optional VK_EXT_external_memory_host enablement
  • f88447f VulkanDevice: Add TryImportHostMemory
  • 24ec546 VulkanDevice: Attempt to import out_data for texture Downloads

📊 Changes

4 files changed (+140 additions, -13 deletions)

View changed files

📝 src/util/vulkan_device.cpp (+97 -0)
📝 src/util/vulkan_device.h (+4 -0)
📝 src/util/vulkan_entry_points.inl (+4 -0)
📝 src/util/vulkan_texture.cpp (+35 -13)

📄 Description

With VK_EXT_external_memory_host, host memory can be directly imported into a VkDeviceMemory/VkBuffer without the need to allocate or copy from staging memory. When minImportedHostPointerAlignment matches the page-size of the system, then basically any host pointer can be imported into Vulkan by importing the entire span of PAGE_SIZE-chunks of memory into Vulkan and offsetting into it.

In the case of large texture downloads like upscaled screenshots, this saves a good chunk of memory from having to be allocated by directly writing texture-data into void* out_data.

This could work for any kind of CPU<->GPU transfer too.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/stenzek/duckstation/pull/3092 **Author:** [@Wunkolo](https://github.com/Wunkolo) **Created:** 1/21/2024 **Status:** ❌ Closed **Base:** `master` ← **Head:** `vk-memory-import` --- ### 📝 Commits (3) - [`8b5f40e`](https://github.com/stenzek/duckstation/commit/8b5f40e1a879ee5086d614ef81e8b79162d5dcf1) VulkanDevice: Optional `VK_EXT_external_memory_host` enablement - [`f88447f`](https://github.com/stenzek/duckstation/commit/f88447fac204bce0fa26e4357f78ae71edc6ec65) VulkanDevice: Add `TryImportHostMemory` - [`24ec546`](https://github.com/stenzek/duckstation/commit/24ec546b885ceb94d5844a126702ff493d97170b) VulkanDevice: Attempt to import `out_data` for texture Downloads ### 📊 Changes **4 files changed** (+140 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `src/util/vulkan_device.cpp` (+97 -0) 📝 `src/util/vulkan_device.h` (+4 -0) 📝 `src/util/vulkan_entry_points.inl` (+4 -0) 📝 `src/util/vulkan_texture.cpp` (+35 -13) </details> ### 📄 Description With [VK_EXT_external_memory_host](https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_external_memory_host.html), host memory can be directly imported into a `VkDeviceMemory`/`VkBuffer` without the need to allocate or copy from staging memory. When [minImportedHostPointerAlignment](https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkPhysicalDeviceExternalMemoryHostPropertiesEXT.html#_members) matches the page-size of the system, then basically _any_ host pointer can be imported into Vulkan by importing the entire span of `PAGE_SIZE`-chunks of memory into Vulkan and offsetting into it. In the case of large texture downloads like upscaled screenshots, this saves a good chunk of memory from having to be allocated by directly writing texture-data into `void* out_data`. This could work for any kind of CPU<->GPU transfer too. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 19:17:33 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/duckstation#1589