-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathCommandBuffer.h
More file actions
44 lines (34 loc) · 1.24 KB
/
CommandBuffer.h
File metadata and controls
44 lines (34 loc) · 1.24 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
//===- CommandBuffer.h - Offload Command Buffer API -----------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
//
//===----------------------------------------------------------------------===//
#ifndef OFFLOADTEST_API_COMMANDBUFFER_H
#define OFFLOADTEST_API_COMMANDBUFFER_H
#include "API/API.h"
#include <cassert>
namespace offloadtest {
class CommandBuffer {
GPUAPI API;
public:
explicit CommandBuffer(GPUAPI API) : API(API) {}
virtual ~CommandBuffer() = default;
CommandBuffer(const CommandBuffer &) = delete;
CommandBuffer &operator=(const CommandBuffer &) = delete;
GPUAPI getAPI() const { return API; }
template <typename T> T &as() {
assert(API == T::BackendAPI && "CommandBuffer backend mismatch");
return static_cast<T &>(*this);
}
template <typename T> const T &as() const {
assert(API == T::BackendAPI && "CommandBuffer backend mismatch");
return static_cast<const T &>(*this);
}
};
} // namespace offloadtest
#endif // OFFLOADTEST_API_COMMANDBUFFER_H