Hymn to Beauty
C++ 3D Engine
WebGPUTexture.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "../Interface/Texture.hpp"
4
5#include <glm/glm.hpp>
6#include "WebGPU.hpp"
7
8namespace Video {
9
10class WebGPURenderer;
11
13class WebGPUTexture : public Texture {
14 public:
16
25 WebGPUTexture(WebGPURenderer& renderer, const glm::uvec2 size, Texture::Type type, Texture::Format format, int components = 0, unsigned char* data = nullptr, uint32_t sampleCount = 1);
26
28 ~WebGPUTexture() final;
29
31
34 WGPUTexture GetTexture() const;
35
37
40 WGPUTextureView GetTextureView() const;
41
43
46 WGPUTextureFormat GetTextureFormat() const;
47
49
52 uint32_t GetSampleCount() const;
53
54 private:
55 WebGPUTexture(const WebGPUTexture& other) = delete;
56
57 void GenerateMipMaps(WebGPURenderer& renderer, const glm::uvec2& size, uint32_t mipLevels);
58
59 WGPUTexture texture;
60 WGPUTextureView textureView;
61 WGPUTextureFormat textureFormat;
62 uint32_t sampleCount;
63};
64
65}
A texture.
Definition: Texture.hpp:8
Format
The format of the texture.
Definition: Texture.hpp:18
Type
The type of texture.
Definition: Texture.hpp:11
Low-level renderer implementing WebGPU.
Definition: WebGPURenderer.hpp:22
WebGPU implementation of Texture.
Definition: WebGPUTexture.hpp:13
~WebGPUTexture() final
Destructor.
Definition: WebGPUTexture.cpp:120
WGPUTexture GetTexture() const
Get the interan WebGPU texture.
Definition: WebGPUTexture.cpp:125
WGPUTextureView GetTextureView() const
Get the texture view.
Definition: WebGPUTexture.cpp:129
WGPUTextureFormat GetTextureFormat() const
Get the format of the texture.
Definition: WebGPUTexture.cpp:133
uint32_t GetSampleCount() const
Get the MSAA sample count.
Definition: WebGPUTexture.cpp:137
WebGPUTexture(WebGPURenderer &renderer, const glm::uvec2 size, Texture::Type type, Texture::Format format, int components=0, unsigned char *data=nullptr, uint32_t sampleCount=1)
Create new WebGPU texture.
Definition: WebGPUTexture.cpp:14
Definition: Editor.hpp:18