forked from facebook/igl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommandBuffer.h
42 lines (35 loc) · 1.49 KB
/
CommandBuffer.h
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
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <igl/CommandBuffer.h>
namespace iglu::sentinel {
/**
* Sentinel CommandBuffer intended for safe use where access to a real command buffer is not
* available.
* Use cases include returning a reference to a command buffer from a raw pointer when a
* valid command buffer is not available.
* All methods return nullptr, the default value or an error.
*/
class CommandBuffer final : public igl::ICommandBuffer {
public:
explicit CommandBuffer(bool shouldAssert = true);
[[nodiscard]] std::unique_ptr<igl::IRenderCommandEncoder> createRenderCommandEncoder(
const igl::RenderPassDesc& /*renderPass*/,
const std::shared_ptr<igl::IFramebuffer>& /*framebuffer*/,
const igl::Dependencies& /*dependencies*/,
igl::Result* IGL_NULLABLE /*outResult*/) final;
[[nodiscard]] std::unique_ptr<igl::IComputeCommandEncoder> createComputeCommandEncoder() final;
void present(const std::shared_ptr<igl::ITexture>& /*surface*/) const final;
void waitUntilScheduled() final;
void waitUntilCompleted() final;
void pushDebugGroupLabel(const char* IGL_NONNULL /*label*/,
const igl::Color& /*color*/ = igl::Color(1, 1, 1, 1)) const final;
void popDebugGroupLabel() const final;
private:
[[maybe_unused]] bool shouldAssert_;
};
} // namespace iglu::sentinel