MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / CpuTextureHandle

Class CpuTextureHandle

Source/Falcor/Utils/Image/TextureManager.h:81–130  ·  view source on GitHub ↗

* Handle to a managed texture on the CPU side. */

Source from the content-addressed store, hash-verified

79 * Handle to a managed texture on the CPU side.
80 */
81 class CpuTextureHandle
82 {
83 public:
84 static constexpr uint32_t kInvalidID = std::numeric_limits<uint32_t>::max();
85
86 public:
87 CpuTextureHandle() = default;
88 explicit CpuTextureHandle(uint32_t id) : mID(id) {}
89
90 explicit CpuTextureHandle(uint32_t id, bool isUdim) : mID(id), mIsUdim(isUdim) {}
91
92 explicit CpuTextureHandle(const TextureHandle& gpuHandle)
93 {
94 if (gpuHandle.getMode() == TextureHandle::Mode::Texture)
95 {
96 mID = gpuHandle.getTextureID();
97 mIsUdim = gpuHandle.getUdimEnabled();
98 }
99 }
100
101 bool isValid() const { return mID != kInvalidID; }
102 explicit operator bool() const { return isValid(); }
103
104 uint32_t getID() const { return mID; }
105 bool isUdim() const { return mIsUdim; }
106
107 bool operator<(const CpuTextureHandle& other) const { return mID < other.mID; }
108 bool operator==(const CpuTextureHandle& other) const { return mID == other.mID && mIsUdim == other.mIsUdim; }
109
110 TextureHandle toGpuHandle() const
111 {
112 TextureHandle gpuHandle;
113 if (isValid())
114 {
115 gpuHandle.setTextureID(this->getID());
116 gpuHandle.setMode(TextureHandle::Mode::Texture);
117 gpuHandle.setUdimEnabled(this->isUdim());
118 }
119 else
120 {
121 gpuHandle.setMode(TextureHandle::Mode::Uniform);
122 gpuHandle.setUdimEnabled(false);
123 }
124 return gpuHandle;
125 }
126
127 private:
128 uint32_t mID{kInvalidID};
129 bool mIsUdim{false};
130 };
131
132 /// Struct describing a managed texture.
133 struct TextureDesc

Callers 2

loadUdimTextureMethod · 0.85
resolveUdimTextureMethod · 0.85

Calls 2

maxFunction · 0.50
isValidFunction · 0.50

Tested by

no test coverage detected