NetDEM v1.0
Loading...
Searching...
No Matches
resource_manager.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <filesystem>
4#include <vector>
5#include <webgpu/webgpu.hpp>
6
7namespace netdem {
8
9namespace webgpu {
10
12public:
13 static wgpu::Device GetDevice();
14 static wgpu::Device GetDevice(wgpu::RequiredLimits limits);
15
16 // Load a shader from a WGSL file into a new shader module
17 static std::string ReadFile(std::filesystem::path const &path);
18
19 static wgpu::ShaderModule
20 CreateShaderModule(wgpu::Device &device, std::string const &shader_source);
21
22 static wgpu::Buffer CreateBufferWithData(wgpu::Device &device,
23 const void *data, size_t size,
24 wgpu::BufferUsageFlags usage);
25
26 static void ReadBuffer(wgpu::Device &device, wgpu::Buffer const &buffer,
27 size_t buffer_offset, void *data, size_t size);
28
29private:
30 static wgpu::Adapter
31 RequestAdapterSync(wgpu::Instance instance,
32 wgpu::RequestAdapterOptions const *options);
33
34 static wgpu::Device
35 RequestDeviceSync(wgpu::Adapter adapter,
36 wgpu::DeviceDescriptor const *descriptor);
37};
38
39} // namespace webgpu
40
41} // namespace netdem
Definition resource_manager.hpp:11
static wgpu::Buffer CreateBufferWithData(wgpu::Device &device, const void *data, size_t size, wgpu::BufferUsageFlags usage)
Definition resource_manager.cpp:65
static wgpu::Device GetDevice()
Definition resource_manager.cpp:9
static void ReadBuffer(wgpu::Device &device, wgpu::Buffer const &buffer, size_t buffer_offset, void *data, size_t size)
Definition resource_manager.cpp:82
static std::string ReadFile(std::filesystem::path const &path)
Definition resource_manager.cpp:34
static wgpu::ShaderModule CreateShaderModule(wgpu::Device &device, std::string const &shader_source)
Definition resource_manager.cpp:49
shader_source
Definition dem.wgsl.h:5
Definition bond_entry.hpp:7