diff options
author | Fernando S <fsahmkow27@gmail.com> | 2023-11-26 18:33:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-26 18:33:05 +0100 |
commit | f21340f7aa60296c7b56e293b5f870b7efd3807d (patch) | |
tree | 9e2a8f9ba77be42bf7695b051f515e52481dd490 /src/video_core/renderer_vulkan/vk_scheduler.h | |
parent | Merge pull request #12180 from german77/cabinetmii (diff) | |
parent | Vulkan: Add a final barrier to the upload command buffer (diff) | |
download | yuzu-f21340f7aa60296c7b56e293b5f870b7efd3807d.tar yuzu-f21340f7aa60296c7b56e293b5f870b7efd3807d.tar.gz yuzu-f21340f7aa60296c7b56e293b5f870b7efd3807d.tar.bz2 yuzu-f21340f7aa60296c7b56e293b5f870b7efd3807d.tar.lz yuzu-f21340f7aa60296c7b56e293b5f870b7efd3807d.tar.xz yuzu-f21340f7aa60296c7b56e293b5f870b7efd3807d.tar.zst yuzu-f21340f7aa60296c7b56e293b5f870b7efd3807d.zip |
Diffstat (limited to 'src/video_core/renderer_vulkan/vk_scheduler.h')
-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; |