forked from flutter-team-archive/engine
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcommand_pool_vk.h
More file actions
56 lines (38 loc) · 1.41 KB
/
Copy pathcommand_pool_vk.h
File metadata and controls
56 lines (38 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#pragma once
#include <memory>
#include <set>
#include <thread>
#include "flutter/fml/macros.h"
#include "impeller/base/thread.h"
#include "impeller/renderer/backend/vulkan/device_holder.h"
#include "impeller/renderer/backend/vulkan/shared_object_vk.h"
#include "impeller/renderer/backend/vulkan/vk.h"
namespace impeller {
class ContextVK;
class CommandPoolVK {
public:
static std::shared_ptr<CommandPoolVK> GetThreadLocal(
const ContextVK* context);
static void ClearAllPools(const ContextVK* context);
~CommandPoolVK();
bool IsValid() const;
void Reset();
vk::CommandPool GetGraphicsCommandPool() const;
vk::UniqueCommandBuffer CreateGraphicsCommandBuffer();
void CollectGraphicsCommandBuffer(vk::UniqueCommandBuffer buffer);
private:
const std::thread::id owner_id_;
std::weak_ptr<const DeviceHolder> device_holder_;
vk::UniqueCommandPool graphics_pool_;
Mutex buffers_to_collect_mutex_;
std::vector<vk::UniqueCommandBuffer> buffers_to_collect_
IPLR_GUARDED_BY(buffers_to_collect_mutex_);
bool is_valid_ = false;
explicit CommandPoolVK(const ContextVK* context);
void GarbageCollectBuffersIfAble() IPLR_REQUIRES(buffers_to_collect_mutex_);
FML_DISALLOW_COPY_AND_ASSIGN(CommandPoolVK);
};
} // namespace impeller