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

Class NativeHandle

Source/Falcor/Core/API/NativeHandle.h:73–99  ·  view source on GitHub ↗

Represents a native graphics API handle (e.g. D3D12 or Vulkan). Native handles are expected to fit into 64 bits. Type information and conversion from/to native handles is done using type traits from NativeHandleTraits.h which needs to be included when creating and accessing NativeHandle. This separation is done so we don't expose the heavy D3D12/Vulkan headers everywhere.

Source from the content-addressed store, hash-verified

71/// This separation is done so we don't expose the heavy D3D12/Vulkan
72/// headers everywhere.
73class NativeHandle
74{
75public:
76 NativeHandle() = default;
77
78 template<typename T>
79 explicit NativeHandle(T native)
80 {
81 mType = NativeHandleTrait<T>::type;
82 mValue = NativeHandleTrait<T>::pack(native);
83 }
84
85 NativeHandleType getType() const { return mType; }
86
87 bool isValid() const { return mType != NativeHandleType::Unknown; }
88
89 template<typename T>
90 T as() const
91 {
92 FALCOR_ASSERT(mType == NativeHandleTrait<T>::type);
93 return NativeHandleTrait<T>::unpack(mValue);
94 }
95
96private:
97 NativeHandleType mType{NativeHandleType::Unknown};
98 uint64_t mValue{0};
99};
100
101} // namespace Falcor

Callers 8

getNativeHandleMethod · 0.85
getNativeHandleMethod · 0.85
getNativeHandleMethod · 0.85
getNativeHandleMethod · 0.85
getNativeHandleMethod · 0.85
getNativeHandleMethod · 0.85

Calls

no outgoing calls

Tested by 1

getNativeHandleMethod · 0.68