upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/src/vulkan_present.h
diff options
context:
space:
mode:
authorAlxcBTW <187763517+AlxcBTW@users.noreply.github.com>2026-11-22 17:51:53 +0100
committerAlxcBTW <187763517+AlxcBTW@users.noreply.github.com>2026-11-22 17:51:53 +0100
commit97daa1aec0e11d9b063b32a5da6c176d55793330 (patch)
treeb25b47984eb810fea1ae338a8cd4feec34cbe0c4 /runtime/src/vulkan_present.h
parent0a3bf1ed91a529cb0ad093262d8b9d5250102763 (diff)
parent49475796c226c8511b9470bf97a4daf57b8af323 (diff)
Merge origin/main into presentx-planes
Keeps the swapchain_colorspace enable and main's custom border colour extension in create_vulkan_device_standalone; the present compose path follows main's LayoutPieces. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src/vulkan_present.h')
-rw-r--r--runtime/src/vulkan_present.h15
1 files changed, 7 insertions, 8 deletions
diff --git a/runtime/src/vulkan_present.h b/runtime/src/vulkan_present.h
index c858558b4..65a129b0e 100644
--- a/runtime/src/vulkan_present.h
+++ b/runtime/src/vulkan_present.h
@@ -28,9 +28,8 @@
28#include "vulkan_backend.h" 28#include "vulkan_backend.h"
29#include "vulkan_present_compose.h" 29#include "vulkan_present_compose.h"
30 30
31// Both extension names share the structures (the KHR one was promoted from the EXT one); headers older than the 31// Use the original EXT spellings. They are aliases of the promoted KHR types and are available in older headers.
32// promotion do not have the KHR types, and the presenter then never tears. 32#if defined(VK_EXT_SWAPCHAIN_MAINTENANCE_1_EXTENSION_NAME) && defined(VK_EXT_SURFACE_MAINTENANCE_1_EXTENSION_NAME)
33#if defined(VK_KHR_SWAPCHAIN_MAINTENANCE_1_EXTENSION_NAME) && defined(VK_KHR_SURFACE_MAINTENANCE_1_EXTENSION_NAME)
34#define LEONIDA_SWAPCHAIN_MAINTENANCE1 1 33#define LEONIDA_SWAPCHAIN_MAINTENANCE1 1
35#endif 34#endif
36 35
@@ -422,7 +421,7 @@ public:
422 present.pImageIndices = &image; 421 present.pImageIndices = &image;
423#ifdef LEONIDA_SWAPCHAIN_MAINTENANCE1 422#ifdef LEONIDA_SWAPCHAIN_MAINTENANCE1
424 // The swapchain was created with FIFO and tear_mode_ (both come from the same recreate). 423 // The swapchain was created with FIFO and tear_mode_ (both come from the same recreate).
425 VkSwapchainPresentModeInfoKHR present_mode{VK_STRUCTURE_TYPE_SWAPCHAIN_PRESENT_MODE_INFO_KHR}; 424 VkSwapchainPresentModeInfoEXT present_mode{VK_STRUCTURE_TYPE_SWAPCHAIN_PRESENT_MODE_INFO_EXT};
426 const bool tearing = tear && vsync_ && tear_supported(); 425 const bool tearing = tear && vsync_ && tear_supported();
427 if (tearing) { 426 if (tearing) {
428 present_mode.swapchainCount = 1; 427 present_mode.swapchainCount = 1;
@@ -635,7 +634,7 @@ private:
635 constexpr VkAccessFlags any = VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT; 634 constexpr VkAccessFlags any = VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT;
636 const VkImageSubresourceRange range{VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}; 635 const VkImageSubresourceRange range{VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1};
637 const bool same = planes.count > 1 && planes.plane[1].source == planes.plane[0].source; 636 const bool same = planes.count > 1 && planes.plane[1].source == planes.plane[0].source;
638 std::array<std::vector<LayoutPiece>, 2> pieces; 637 std::array<LayoutPieces, 2> pieces;
639 std::array<VkImageLayout, 2> read_layout{}; 638 std::array<VkImageLayout, 2> read_layout{};
640 // Each distinct source: its PRESENT (common) layout, then readable by the compute pass. A never-written back buffer 639 // Each distinct source: its PRESENT (common) layout, then readable by the compute pass. A never-written back buffer
641 // is zero-filled first, as any committed resource is. 640 // is zero-filled first, as any committed resource is.
@@ -958,7 +957,7 @@ private:
958 info.presentMode = mode; 957 info.presentMode = mode;
959#ifdef LEONIDA_SWAPCHAIN_MAINTENANCE1 958#ifdef LEONIDA_SWAPCHAIN_MAINTENANCE1
960 // A vsync swapchain that can also be presented in IMMEDIATE (or FIFO_RELAXED), switched per present. 959 // A vsync swapchain that can also be presented in IMMEDIATE (or FIFO_RELAXED), switched per present.
961 VkSwapchainPresentModesCreateInfoKHR switchable{VK_STRUCTURE_TYPE_SWAPCHAIN_PRESENT_MODES_CREATE_INFO_KHR}; 960 VkSwapchainPresentModesCreateInfoEXT switchable{VK_STRUCTURE_TYPE_SWAPCHAIN_PRESENT_MODES_CREATE_INFO_EXT};
962 std::array<VkPresentModeKHR, 2> switchable_modes{VK_PRESENT_MODE_FIFO_KHR, VK_PRESENT_MODE_MAX_ENUM_KHR}; 961 std::array<VkPresentModeKHR, 2> switchable_modes{VK_PRESENT_MODE_FIFO_KHR, VK_PRESENT_MODE_MAX_ENUM_KHR};
963 VkPresentModeKHR tear = VK_PRESENT_MODE_MAX_ENUM_KHR; 962 VkPresentModeKHR tear = VK_PRESENT_MODE_MAX_ENUM_KHR;
964 if (vsync && mode == VK_PRESENT_MODE_FIFO_KHR) tear = find_tear_mode(modes, info.minImageCount, info.imageUsage, info.imageExtent); 963 if (vsync && mode == VK_PRESENT_MODE_FIFO_KHR) tear = find_tear_mode(modes, info.minImageCount, info.imageUsage, info.imageExtent);
@@ -1030,11 +1029,11 @@ private:
1030 // The capabilities of the surface for one present mode, and the modes it can switch to from there. 1029 // The capabilities of the surface for one present mode, and the modes it can switch to from there.
1031 const auto ask = [&](VkPresentModeKHR asked, VkSurfaceCapabilitiesKHR& caps, 1030 const auto ask = [&](VkPresentModeKHR asked, VkSurfaceCapabilitiesKHR& caps,
1032 std::array<VkPresentModeKHR, 16>* compatible, std::uint32_t* compatible_count) { 1031 std::array<VkPresentModeKHR, 16>* compatible, std::uint32_t* compatible_count) {
1033 VkSurfacePresentModeKHR for_mode{VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_KHR}; 1032 VkSurfacePresentModeEXT for_mode{VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_EXT};
1034 for_mode.presentMode = asked; 1033 for_mode.presentMode = asked;
1035 VkPhysicalDeviceSurfaceInfo2KHR surface_info{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR, &for_mode}; 1034 VkPhysicalDeviceSurfaceInfo2KHR surface_info{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR, &for_mode};
1036 surface_info.surface = surface_; 1035 surface_info.surface = surface_;
1037 VkSurfacePresentModeCompatibilityKHR compat{VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_COMPATIBILITY_KHR}; 1036 VkSurfacePresentModeCompatibilityEXT compat{VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_COMPATIBILITY_EXT};
1038 if (compatible) { 1037 if (compatible) {
1039 compat.presentModeCount = std::uint32_t(compatible->size()); 1038 compat.presentModeCount = std::uint32_t(compatible->size());
1040 compat.pPresentModes = compatible->data(); 1039 compat.pPresentModes = compatible->data();