Engine²
Open-source game engine written in C++.
Loading...
Searching...
No Matches
TextureView.hpp
Go to the documentation of this file.
1#pragma once
2
5#include "resource/Image.hpp"
7#include "utils/webgpu.hpp"
8#include <array>
9#include <bit>
10#include <cstddef>
11#include <cstdint>
12#include <cstring>
13#include <functional>
14#include <glm/gtc/packing.hpp>
15#include <glm/vec2.hpp>
16#include <glm/vec4.hpp>
17#include <vector>
18
19namespace Graphic::Resource {
20
22 public:
23 TextureView(void) = default;
24 explicit TextureView(wgpu::TextureView &&textureView) : _webgpuView(std::move(textureView)) {}
25
27 TextureView(const TextureView &) = delete;
28 TextureView &operator=(const TextureView &) = delete;
29
30 TextureView(TextureView &&other) noexcept : _webgpuView(std::move(other._webgpuView))
31 {
32 other._webgpuView = nullptr;
33 }
34
36 {
37 if (this != &other)
38 {
39 if (_webgpuView != nullptr)
40 {
41 _webgpuView.release();
42 _webgpuView = nullptr;
43 }
44 _webgpuView = std::move(other._webgpuView);
45 other._webgpuView = nullptr;
46 }
47 return *this;
48 }
49
50 const wgpu::TextureView &GetWebGPUView() const { return _webgpuView; }
51
52 void Delete()
53 {
54 if (_webgpuView != nullptr)
55 {
56 _webgpuView.release();
57 _webgpuView = nullptr;
58 }
59 }
60
61 private:
62 wgpu::TextureView _webgpuView = nullptr;
63};
64} // namespace Graphic::Resource
void Delete()
Definition TextureView.hpp:52
~TextureView()
Definition TextureView.hpp:26
TextureView(TextureView &&other) noexcept
Definition TextureView.hpp:30
TextureView(wgpu::TextureView &&textureView)
Definition TextureView.hpp:24
TextureView(const TextureView &)=delete
const wgpu::TextureView & GetWebGPUView() const
Definition TextureView.hpp:50
TextureView & operator=(TextureView &&other) noexcept
Definition TextureView.hpp:35
TextureView & operator=(const TextureView &)=delete
wgpu::TextureView _webgpuView
Definition TextureView.hpp:62
Definition AGPUBuffer.hpp:6