Coverage Report

Created: 2024-09-14 07:19

/src/skia/src/gpu/graphite/vk/VulkanQueueManager.cpp
Line
Count
Source (jump to first uncovered line)
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
8
#include "src/gpu/graphite/vk/VulkanQueueManager.h"
9
10
#include "src/gpu/graphite/GpuWorkSubmission.h"
11
#include "src/gpu/graphite/vk/VulkanCommandBuffer.h"
12
#include "src/gpu/graphite/vk/VulkanResourceProvider.h"
13
#include "src/gpu/graphite/vk/VulkanSharedContext.h"
14
15
namespace skgpu::graphite {
16
17
VulkanQueueManager::VulkanQueueManager(VkQueue queue, const SharedContext* sharedContext)
18
        : QueueManager(sharedContext)
19
0
        , fQueue(queue) {
20
0
}
21
22
0
const VulkanSharedContext* VulkanQueueManager::vkSharedContext() const {
23
0
    return static_cast<const VulkanSharedContext*>(fSharedContext);
24
0
}
25
26
std::unique_ptr<CommandBuffer> VulkanQueueManager::getNewCommandBuffer(
27
0
        ResourceProvider* resourceProvider) {
28
0
    VulkanResourceProvider* vkResourceProvider =
29
0
            static_cast<VulkanResourceProvider*>(resourceProvider);
30
31
0
    auto cmdBuffer = VulkanCommandBuffer::Make(this->vkSharedContext(), vkResourceProvider);
32
0
    return cmdBuffer;
33
0
}
34
35
class VulkanWorkSubmission final : public GpuWorkSubmission {
36
public:
37
    VulkanWorkSubmission(std::unique_ptr<CommandBuffer> cmdBuffer, QueueManager* queueManager)
38
0
        : GpuWorkSubmission(std::move(cmdBuffer), queueManager) {}
39
0
    ~VulkanWorkSubmission() override {}
40
41
private:
42
0
    bool onIsFinished(const SharedContext*) override {
43
0
        return static_cast<VulkanCommandBuffer*>(this->commandBuffer())->isFinished();
44
0
    }
45
0
    void onWaitUntilFinished(const SharedContext*) override {
46
0
        return static_cast<VulkanCommandBuffer*>(this->commandBuffer())->waitUntilFinished();
47
0
    }
48
};
49
50
0
QueueManager::OutstandingSubmission VulkanQueueManager::onSubmitToGpu() {
51
0
    SkASSERT(fCurrentCommandBuffer);
52
0
    VulkanCommandBuffer* vkCmdBuffer =
53
0
            static_cast<VulkanCommandBuffer*>(fCurrentCommandBuffer.get());
54
0
    if (!vkCmdBuffer->submit(fQueue)) {
55
0
        fCurrentCommandBuffer->callFinishedProcs(/*success=*/false);
56
0
        return nullptr;
57
0
    }
58
59
0
    std::unique_ptr<GpuWorkSubmission> submission(
60
0
            new VulkanWorkSubmission(std::move(fCurrentCommandBuffer), this));
61
0
    return submission;
62
0
}
Unexecuted instantiation: skgpu::graphite::VulkanQueueManager::onSubmitToGpu()
Unexecuted instantiation: skgpu::graphite::VulkanQueueManager::onSubmitToGpu()
63
64
} // namespace skgpu::graphite