mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-09-07 12:49:14 +01:00
vulkan_common: enable OpenGL interop on other Unices
This commit is contained in:
parent
fb7dcbf7af
commit
9b50b23a50
2 changed files with 5 additions and 5 deletions
|
@ -51,7 +51,7 @@ constexpr std::array REQUIRED_EXTENSIONS{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME,
|
VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME,
|
||||||
#endif
|
#endif
|
||||||
#ifdef __linux__
|
#ifdef __unix__
|
||||||
VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME,
|
VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME,
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
|
@ -62,7 +62,7 @@ public:
|
||||||
: memory{std::move(memory_)}, allocation_size{allocation_size_}, property_flags{properties},
|
: memory{std::move(memory_)}, allocation_size{allocation_size_}, property_flags{properties},
|
||||||
shifted_memory_type{1U << type} {}
|
shifted_memory_type{1U << type} {}
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(__linux__)
|
#if defined(_WIN32) || defined(__unix__)
|
||||||
~MemoryAllocation() {
|
~MemoryAllocation() {
|
||||||
if (owning_opengl_handle != 0) {
|
if (owning_opengl_handle != 0) {
|
||||||
glDeleteMemoryObjectsEXT(1, &owning_opengl_handle);
|
glDeleteMemoryObjectsEXT(1, &owning_opengl_handle);
|
||||||
|
@ -114,7 +114,7 @@ public:
|
||||||
}
|
}
|
||||||
return owning_opengl_handle;
|
return owning_opengl_handle;
|
||||||
}
|
}
|
||||||
#elif __linux__
|
#elif __unix__
|
||||||
[[nodiscard]] u32 ExportOpenGLHandle() {
|
[[nodiscard]] u32 ExportOpenGLHandle() {
|
||||||
if (!owning_opengl_handle) {
|
if (!owning_opengl_handle) {
|
||||||
glCreateMemoryObjectsEXT(1, &owning_opengl_handle);
|
glCreateMemoryObjectsEXT(1, &owning_opengl_handle);
|
||||||
|
@ -165,7 +165,7 @@ private:
|
||||||
const u32 shifted_memory_type; ///< Shifted Vulkan memory type.
|
const u32 shifted_memory_type; ///< Shifted Vulkan memory type.
|
||||||
std::vector<Range> commits; ///< All commit ranges done from this allocation.
|
std::vector<Range> commits; ///< All commit ranges done from this allocation.
|
||||||
std::span<u8> memory_mapped_span; ///< Memory mapped span. Empty if not queried before.
|
std::span<u8> memory_mapped_span; ///< Memory mapped span. Empty if not queried before.
|
||||||
#if defined(_WIN32) || defined(__linux__)
|
#if defined(_WIN32) || defined(__unix__)
|
||||||
u32 owning_opengl_handle{}; ///< Owning OpenGL memory object handle.
|
u32 owning_opengl_handle{}; ///< Owning OpenGL memory object handle.
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
@ -249,7 +249,7 @@ void MemoryAllocator::AllocMemory(VkMemoryPropertyFlags flags, u32 type_mask, u6
|
||||||
.pNext = nullptr,
|
.pNext = nullptr,
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT,
|
.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT,
|
||||||
#elif __linux__
|
#elif __unix__
|
||||||
.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT,
|
.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT,
|
||||||
#else
|
#else
|
||||||
.handleTypes = 0,
|
.handleTypes = 0,
|
||||||
|
|
Loading…
Reference in a new issue