Nameless Engine
Loading...
Searching...
No Matches
DirectXDescriptor.h
1#pragma once
2
3// Standard.
4#include <memory>
5#include <optional>
6#include <variant>
7
8// Custom.
9#include "DirectXDescriptorType.hpp"
10#include "misc/Error.h"
11
12namespace ne {
13 class DirectXDescriptorHeap;
14 class ContinuousDirectXDescriptorRange;
15 class DirectXResource;
16
22 // We notify the heap about descriptor being no longer used in destructor.
23 friend class DirectXDescriptorHeap;
24
25 public:
26 DirectXDescriptor() = delete;
27
30
31 DirectXDescriptor(const DirectXDescriptor& other) = delete;
32 DirectXDescriptor& operator=(const DirectXDescriptor& other) = delete;
33
34 // Intentionally disable `move` because heap stores raw pointers to descriptors
35 // and wraps descriptors into unique ptr to provide move functionality.
36 DirectXDescriptor(DirectXDescriptor&& other) noexcept = delete;
37 DirectXDescriptor& operator=(DirectXDescriptor&& other) noexcept = delete;
38
53
68 std::variant<unsigned int, Error> getOffsetFromRangeStartOnCurrentFrame();
69
76
82 std::shared_ptr<ContinuousDirectXDescriptorRange> getDescriptorRange() const { return pRange; }
83
90
91 protected:
107 DirectXDescriptorType descriptorType,
110 std::optional<size_t> referencedCubemapFaceIndex,
111 const std::shared_ptr<ContinuousDirectXDescriptorRange>& pRange = nullptr);
112
113 private:
119
122
124 DirectXDescriptorHeap* const pHeap = nullptr;
125
127 std::shared_ptr<ContinuousDirectXDescriptorRange> const pRange = nullptr;
128
130 const std::optional<size_t> referencedCubemapFaceIndex;
131
133 const DirectXDescriptorType descriptorType;
134 };
135} // namespace ne
Definition: DirectXDescriptorHeap.h:205
Definition: DirectXDescriptor.h:21
DirectXResource * pResource
Definition: DirectXDescriptor.h:121
std::shared_ptr< ContinuousDirectXDescriptorRange > const pRange
Definition: DirectXDescriptor.h:127
std::shared_ptr< ContinuousDirectXDescriptorRange > getDescriptorRange() const
Definition: DirectXDescriptor.h:82
DirectXResource * getOwnerResource() const
Definition: DirectXDescriptor.cpp:67
std::variant< unsigned int, Error > getOffsetFromRangeStartOnCurrentFrame()
Definition: DirectXDescriptor.cpp:32
int getOffsetInDescriptorsOnCurrentFrame() const
Definition: DirectXDescriptor.h:52
DirectXDescriptorHeap * getDescriptorHeap() const
Definition: DirectXDescriptor.h:75
int iDescriptorOffsetInDescriptors
Definition: DirectXDescriptor.h:118
const std::optional< size_t > referencedCubemapFaceIndex
Definition: DirectXDescriptor.h:130
~DirectXDescriptor()
Definition: DirectXDescriptor.cpp:8
DirectXDescriptorHeap *const pHeap
Definition: DirectXDescriptor.h:124
const DirectXDescriptorType descriptorType
Definition: DirectXDescriptor.h:133
Definition: DirectXResource.h:32