Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
VulkanQueueManager.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2022 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
9
14
15namespace skgpu::graphite {
16
17VulkanQueueManager::VulkanQueueManager(VkQueue queue, const SharedContext* sharedContext)
18 : QueueManager(sharedContext)
19 , fQueue(queue) {
20}
21
22const VulkanSharedContext* VulkanQueueManager::vkSharedContext() const {
23 return static_cast<const VulkanSharedContext*>(fSharedContext);
24}
25
26std::unique_ptr<CommandBuffer> VulkanQueueManager::getNewCommandBuffer(
27 ResourceProvider* resourceProvider) {
28 VulkanResourceProvider* vkResourceProvider =
29 static_cast<VulkanResourceProvider*>(resourceProvider);
30
31 auto cmdBuffer = VulkanCommandBuffer::Make(this->vkSharedContext(), vkResourceProvider);
32 return cmdBuffer;
33}
34
36public:
37 VulkanWorkSubmission(std::unique_ptr<CommandBuffer> cmdBuffer, QueueManager* queueManager)
38 : GpuWorkSubmission(std::move(cmdBuffer), queueManager) {}
40
41private:
42 bool onIsFinished(const SharedContext*) override {
43 return static_cast<VulkanCommandBuffer*>(this->commandBuffer())->isFinished();
44 }
45 void onWaitUntilFinished(const SharedContext*) override {
46 return static_cast<VulkanCommandBuffer*>(this->commandBuffer())->waitUntilFinished();
47 }
48};
49
52 VulkanCommandBuffer* vkCmdBuffer =
53 static_cast<VulkanCommandBuffer*>(fCurrentCommandBuffer.get());
54 if (!vkCmdBuffer->submit(fQueue)) {
55 fCurrentCommandBuffer->callFinishedProcs(/*success=*/false);
56 return nullptr;
57 }
58
59 std::unique_ptr<GpuWorkSubmission> submission(
60 new VulkanWorkSubmission(std::move(fCurrentCommandBuffer), this));
61 return submission;
62}
63
64} // namespace skgpu::graphite
#define SkASSERT(cond)
Definition SkAssert.h:116
void callFinishedProcs(bool success)
void waitUntilFinished(const SharedContext *sharedContext)
bool isFinished(const SharedContext *sharedContext)
const SharedContext * fSharedContext
std::unique_ptr< GpuWorkSubmission > OutstandingSubmission
std::unique_ptr< CommandBuffer > fCurrentCommandBuffer
static std::unique_ptr< VulkanCommandBuffer > Make(const VulkanSharedContext *, VulkanResourceProvider *)
OutstandingSubmission onSubmitToGpu() override
std::unique_ptr< CommandBuffer > getNewCommandBuffer(ResourceProvider *) override
VulkanQueueManager(VkQueue queue, const SharedContext *)
bool onIsFinished(const SharedContext *) override
VulkanWorkSubmission(std::unique_ptr< CommandBuffer > cmdBuffer, QueueManager *queueManager)
void onWaitUntilFinished(const SharedContext *) override
VkQueue queue
Definition main.cc:55
Definition ref_ptr.h:256