upleb.uk

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

summaryrefslogtreecommitdiff
path: root/runtime/src/vulkan_scratch.h
diff options
context:
space:
mode:
authorRain156 <77776581+Rain156@users.noreply.github.com>2026-11-24 21:26:25 +0800
committerRain156 <77776581+Rain156@users.noreply.github.com>2026-11-24 21:26:25 +0800
commitaa8be9aef20291e6faf6ed986d2b6691aad96abf (patch)
tree80e0224b761256cd2375d069089f1eb6413dcd7a /runtime/src/vulkan_scratch.h
parentbe767b6889cb373cc695b67367644ea4370f8e9c (diff)
parentdb19bbd3455a757c3fe986c6e6db36998f275150 (diff)
Integrate the offline first-run UI runtime with current main and the published renderer fixes
Use the tagged pipeline variants and indexed quad expansion from #722 and #682 with the shared shader cache. Retain title-backed index uploads, cross-queue scratch sharing, amd64 console return conventions and the PC/console caller discriminator. The local shader build indexes native containers and includes the executable's embedded stages.
Diffstat (limited to 'runtime/src/vulkan_scratch.h')
-rw-r--r--runtime/src/vulkan_scratch.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/runtime/src/vulkan_scratch.h b/runtime/src/vulkan_scratch.h
index c12d909e6..a7187441e 100644
--- a/runtime/src/vulkan_scratch.h
+++ b/runtime/src/vulkan_scratch.h
@@ -11,6 +11,7 @@
11#define VK_NO_PROTOTYPES 11#define VK_NO_PROTOTYPES
12#endif 12#endif
13#include <vulkan/vulkan.h> 13#include <vulkan/vulkan.h>
14#include "queue_families.h"
14 15
15#include <algorithm> 16#include <algorithm>
16#include <cstdint> 17#include <cstdint>
@@ -25,8 +26,9 @@ public:
25 // A device-local allocation for a chunk; null on failure. 26 // A device-local allocation for a chunk; null on failure.
26 using Allocate = std::function<VkDeviceMemory(const VkMemoryRequirements&)>; 27 using Allocate = std::function<VkDeviceMemory(const VkMemoryRequirements&)>;
27 28
28 ScratchBuffers(PFN_vkGetDeviceProcAddr get, VkDevice device, Allocate allocate, VkBufferUsageFlags extra_usage = 0) 29 ScratchBuffers(PFN_vkGetDeviceProcAddr get, VkDevice device, Allocate allocate, VkBufferUsageFlags extra_usage = 0,
29 : device_(device), allocate_(std::move(allocate)), extra_usage_(extra_usage) { 30 std::vector<std::uint32_t> families = {})
31 : device_(device), allocate_(std::move(allocate)), extra_usage_(extra_usage), families_(std::move(families)) {
30 loaded_ = vk_.load(get, device); 32 loaded_ = vk_.load(get, device);
31 } 33 }
32 34
@@ -151,6 +153,8 @@ private:
151 VkBufferCreateInfo info{VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO}; 153 VkBufferCreateInfo info{VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO};
152 info.size = size; 154 info.size = size;
153 info.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT | extra_usage_; 155 info.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT | extra_usage_;
156 // A retired chunk can be reused by a submission on a different queue family.
157 share_across_queue_families(info, families_);
154 if (vk_.vkCreateBuffer(device_, &info, nullptr, &out.buffer) != VK_SUCCESS) return false; 158 if (vk_.vkCreateBuffer(device_, &info, nullptr, &out.buffer) != VK_SUCCESS) return false;
155 VkMemoryRequirements requirements{}; 159 VkMemoryRequirements requirements{};
156 vk_.vkGetBufferMemoryRequirements(device_, out.buffer, &requirements); 160 vk_.vkGetBufferMemoryRequirements(device_, out.buffer, &requirements);
@@ -175,6 +179,7 @@ private:
175 VkDevice device_; 179 VkDevice device_;
176 Allocate allocate_; 180 Allocate allocate_;
177 VkBufferUsageFlags extra_usage_ = 0; 181 VkBufferUsageFlags extra_usage_ = 0;
182 std::vector<std::uint32_t> families_;
178 Functions vk_; 183 Functions vk_;
179 bool loaded_ = false; 184 bool loaded_ = false;
180 Batch current_; // handed out, not yet submitted 185 Batch current_; // handed out, not yet submitted