-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathwebgpu_adapter.hpp
More file actions
53 lines (47 loc) · 1.46 KB
/
webgpu_adapter.hpp
File metadata and controls
53 lines (47 loc) · 1.46 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
#pragma once
#include <memory>
#include <string>
#include <unordered_map>
#include <vector>
#include <common/command_buffers/gpu/gpu_adapter.hpp>
namespace client_graphics
{
/**
* The `WebGPUAdapter` class represents a WebGPU adapter which provides information
* about the underlying graphics hardware and its capabilities.
*/
class WebGPUAdapter
{
public:
WebGPUAdapter(const commandbuffers::GPUAdapterInfo &info);
~WebGPUAdapter() = default;
public:
const commandbuffers::GPUAdapterInfo &info() const
{
return adapter_info_;
}
const commandbuffers::GPUSupportedFeatures &features() const
{
return features_;
}
const commandbuffers::GPUSupportedLimits &limits() const
{
return limits_;
}
/**
* Request a device from this adapter.
* @param label Optional label for the device
* @param requiredFeatures Features required by the device
* @param requiredLimits Limits required by the device
* @returns A WebGPU device or nullptr if device creation fails
*/
std::unique_ptr<class WebGPUDevice> requestDevice(
std::optional<std::string> label = std::nullopt,
const std::vector<std::string> &requiredFeatures = {},
const std::unordered_map<std::string, uint32_t> &requiredLimits = {});
private:
commandbuffers::GPUAdapterInfo adapter_info_;
commandbuffers::GPUSupportedFeatures features_;
commandbuffers::GPUSupportedLimits limits_;
};
}