RavEngine
Loading...
Searching...
No Matches
WGDevice.hpp
1#pragma once
2#include <RGL/Types.hpp>
3#include <RGL/Device.hpp>
4#include <span>
5#include <emscripten/html5_webgpu.h>
6
7namespace RGL{
8 struct DeviceWG : public IDevice, public std::enable_shared_from_this<DeviceWG>{
9 WGPUDevice device;
10 WGPUAdapter adapter;
11
12 DeviceWG();
13 std::string GetBrandString() final;
14
15 RGLSwapchainPtr CreateSwapchain(RGLSurfacePtr, RGLCommandQueuePtr presentQueue, int, int) final;
16
17 RGLPipelineLayoutPtr CreatePipelineLayout(const PipelineLayoutDescriptor&) final;
18 RGLRenderPipelinePtr CreateRenderPipeline(const RenderPipelineDescriptor&) final;
19 RGLComputePipelinePtr CreateComputePipeline(const struct ComputePipelineDescriptor&) final;
20
21 RGLShaderLibraryPtr CreateShaderLibraryFromName(const std::string_view& name) final;
22 RGLShaderLibraryPtr CreateDefaultShaderLibrary() final;
23 RGLShaderLibraryPtr CreateShaderLibraryFromBytes(const std::span<const uint8_t>) final;
24 RGLShaderLibraryPtr CreateShaderLibrarySourceCode(const std::string_view, const FromSourceConfig& config) final;
25 RGLShaderLibraryPtr CreateShaderLibraryFromPath(const std::filesystem::path&) final;
26
27 RGLBufferPtr CreateBuffer(const BufferConfig&) final;
28 RGLTexturePtr CreateTextureWithData(const TextureConfig&, untyped_span) final;
29 RGLTexturePtr CreateTexture(const TextureConfig&) final;
30 RGLSamplerPtr CreateSampler(const SamplerConfig&) final;
31
32 RGLCommandQueuePtr CreateCommandQueue(QueueType type) final;
33
34 TextureView GetGlobalBindlessTextureHeap() const final;
35
36 size_t GetTotalVRAM() const;
37 size_t GetCurrentVRAMInUse() const;
38 DeviceData GetDeviceData() final;
39
40 RGLFencePtr CreateFence(bool preSignaled) final;
41 void BlockUntilIdle() final;
42
43 virtual ~DeviceWG();
44 };
45
46 RGLDevicePtr CreateDefaultDeviceWG();
47}
Definition Span.hpp:11
Definition Buffer.hpp:21
Definition Pipeline.hpp:269
Definition WGDevice.hpp:8
Definition ShaderLibrary.hpp:11
Definition Device.hpp:35
Definition Pipeline.hpp:59
Definition Pipeline.hpp:164
Definition Sampler.hpp:33
Definition Texture.hpp:138
Definition Texture.hpp:43
Definition Device.hpp:17