diff options
author | GPUCode <geoster3d@gmail.com> | 2023-09-09 16:28:06 +0200 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2023-11-12 20:27:39 +0100 |
commit | efc50485b80e4fde656897b7c9c32f2dbb78977b (patch) | |
tree | 0020d6913b7e8f123feacac8f0dbff87e0ac0c36 /src/video_core/renderer_vulkan/vk_scheduler.h | |
parent | Merge pull request #11980 from german77/moment (diff) | |
download | yuzu-efc50485b80e4fde656897b7c9c32f2dbb78977b.tar yuzu-efc50485b80e4fde656897b7c9c32f2dbb78977b.tar.gz yuzu-efc50485b80e4fde656897b7c9c32f2dbb78977b.tar.bz2 yuzu-efc50485b80e4fde656897b7c9c32f2dbb78977b.tar.lz yuzu-efc50485b80e4fde656897b7c9c32f2dbb78977b.tar.xz yuzu-efc50485b80e4fde656897b7c9c32f2dbb78977b.tar.zst yuzu-efc50485b80e4fde656897b7c9c32f2dbb78977b.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/renderer_vulkan/vk_scheduler.h | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/video_core/renderer_vulkan/vk_scheduler.h b/src/video_core/renderer_vulkan/vk_scheduler.h index da03803aa..f8d8ca80a 100644 --- a/src/video_core/renderer_vulkan/vk_scheduler.h +++ b/src/video_core/renderer_vulkan/vk_scheduler.h @@ -80,7 +80,8 @@ public: /// Send work to a separate thread. template <typename T> - void Record(T&& command) { + requires std::is_invocable_v<T, vk::CommandBuffer, vk::CommandBuffer> + void RecordWithUploadBuffer(T&& command) { if (chunk->Record(command)) { return; } @@ -88,6 +89,15 @@ public: (void)chunk->Record(command); } + template <typename T> + requires std::is_invocable_v<T, vk::CommandBuffer> + void Record(T&& c) { + this->RecordWithUploadBuffer( + [command = std::move(c)](vk::CommandBuffer cmdbuf, vk::CommandBuffer) { + command(cmdbuf); + }); + } + /// Returns the current command buffer tick. [[nodiscard]] u64 CurrentTick() const noexcept { return master_semaphore->CurrentTick(); @@ -119,7 +129,7 @@ private: public: virtual ~Command() = default; - virtual void Execute(vk::CommandBuffer cmdbuf) const = 0; + virtual void Execute(vk::CommandBuffer cmdbuf, vk::CommandBuffer upload_cmdbuf) const = 0; Command* GetNext() const { return next; @@ -142,8 +152,8 @@ private: TypedCommand(TypedCommand&&) = delete; TypedCommand& operator=(TypedCommand&&) = delete; - void Execute(vk::CommandBuffer cmdbuf) const override { - command(cmdbuf); + void Execute(vk::CommandBuffer cmdbuf, vk::CommandBuffer upload_cmdbuf) const override { + command(cmdbuf, upload_cmdbuf); } private: @@ -152,7 +162,7 @@ private: class CommandChunk final { public: - void ExecuteAll(vk::CommandBuffer cmdbuf); + void ExecuteAll(vk::CommandBuffer cmdbuf, vk::CommandBuffer upload_cmdbuf); template <typename T> bool Record(T& command) { @@ -228,6 +238,7 @@ private: VideoCommon::QueryCacheBase<QueryCacheParams>* query_cache = nullptr; vk::CommandBuffer current_cmdbuf; + vk::CommandBuffer current_upload_cmdbuf; std::unique_ptr<CommandChunk> chunk; std::function<void()> on_submit; |