diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2021-01-10 06:14:32 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2021-01-10 06:14:32 +0000 |
| commit | 2d1b569e48c751a7bba1563deaf319affbcb18a3 (patch) | |
| tree | c866c98569d3a4ee5741f1a37b2e131a9fe2a247 /Graphics/GraphicsEngine | |
| parent | Renamed HIT_GROUP_BINDING_MODE_PER_ACCEL_STRUCT to HIT_GROUP_BINDING_MODE_PER... (diff) | |
| download | DiligentCore-2d1b569e48c751a7bba1563deaf319affbcb18a3.tar.gz DiligentCore-2d1b569e48c751a7bba1563deaf319affbcb18a3.zip | |
Added IDeviceObject::SetUserData() and IDeviceObject::GetUserData() methods (API240081)
Diffstat (limited to 'Graphics/GraphicsEngine')
| -rw-r--r-- | Graphics/GraphicsEngine/include/DeviceObjectBase.hpp | 14 | ||||
| -rw-r--r-- | Graphics/GraphicsEngine/interface/APIInfo.h | 2 | ||||
| -rw-r--r-- | Graphics/GraphicsEngine/interface/DeviceObject.h | 27 | ||||
| -rw-r--r-- | Graphics/GraphicsEngine/interface/EngineFactory.h | 2 |
4 files changed, 44 insertions, 1 deletions
diff --git a/Graphics/GraphicsEngine/include/DeviceObjectBase.hpp b/Graphics/GraphicsEngine/include/DeviceObjectBase.hpp index c3f3cbbb..c9d174dc 100644 --- a/Graphics/GraphicsEngine/include/DeviceObjectBase.hpp +++ b/Graphics/GraphicsEngine/include/DeviceObjectBase.hpp @@ -153,6 +153,18 @@ public: return m_UniqueID.GetID(); } + /// Implementation of IDeviceObject::SetUserData. + virtual void DILIGENT_CALL_TYPE SetUserData(IObject* pUserData) override final + { + m_pUserData = pUserData; + } + + /// Implementation of IDeviceObject::GetUserData. + virtual IObject* DILIGENT_CALL_TYPE GetUserData() const override final + { + return m_pUserData.RawPtr<IObject>(); + } + static bool IsSameObject(const DeviceObjectBase* pObj1, const DeviceObjectBase* pObj2) { UniqueIdentifier Id1 = (pObj1 != nullptr) ? pObj1->GetUniqueID() : 0; @@ -173,6 +185,8 @@ protected: // different groups of objects UniqueIdHelper<BaseInterface> m_UniqueID; const bool m_bIsDeviceInternal; + + RefCntAutoPtr<IObject> m_pUserData; }; } // namespace Diligent diff --git a/Graphics/GraphicsEngine/interface/APIInfo.h b/Graphics/GraphicsEngine/interface/APIInfo.h index c8ad22b4..cd2be5a4 100644 --- a/Graphics/GraphicsEngine/interface/APIInfo.h +++ b/Graphics/GraphicsEngine/interface/APIInfo.h @@ -30,7 +30,7 @@ /// \file /// Diligent API information -#define DILIGENT_API_VERSION 240080 +#define DILIGENT_API_VERSION 240081 #include "../../../Primitives/interface/BasicTypes.h" diff --git a/Graphics/GraphicsEngine/interface/DeviceObject.h b/Graphics/GraphicsEngine/interface/DeviceObject.h index 27b172ac..a7dabc43 100644 --- a/Graphics/GraphicsEngine/interface/DeviceObject.h +++ b/Graphics/GraphicsEngine/interface/DeviceObject.h @@ -46,6 +46,8 @@ static const INTERFACE_ID IID_DeviceObject = IObjectInclusiveMethods; \ IDeviceObjectMethods DeviceObject +// clang-format off + /// Base interface for all objects created by the render device Diligent::IRenderDevice DILIGENT_BEGIN_INTERFACE(IDeviceObject, IObject) { @@ -70,9 +72,32 @@ DILIGENT_BEGIN_INTERFACE(IDeviceObject, IObject) /// Valid identifiers are always positive values. Zero and negative values can never be /// assigned to an object and are always guaranteed to be invalid. VIRTUAL Int32 METHOD(GetUniqueID)(THIS) CONST PURE; + + + /// Stores a pointer to the user-provided data object, which + /// may later be retreived through GetUserData(). + /// + /// \param [in] pUserData - Pointer to the user data object to store. + /// + /// \note The method is not thread-safe and an application + /// must externally synchronize the access. + VIRTUAL void METHOD(SetUserData)(THIS_ + IObject* pUserData) PURE; + + + /// Returns a pointer to the user data object previously + /// set with SetUserData() method. + /// + /// \return The pointer to the user data object. + /// + /// \remarks The method does *NOT* call AddRef() + /// for the object being returned. + VIRTUAL IObject* METHOD(GetUserData)(THIS) CONST PURE; }; DILIGENT_END_INTERFACE +// clang-format on + #include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" #if DILIGENT_C_INTERFACE @@ -81,6 +106,8 @@ DILIGENT_END_INTERFACE # define IDeviceObject_GetDesc(This) CALL_IFACE_METHOD(DeviceObject, GetDesc, This) # define IDeviceObject_GetUniqueID(This) CALL_IFACE_METHOD(DeviceObject, GetUniqueID, This) +# define IDeviceObject_SetUserData(This) CALL_IFACE_METHOD(DeviceObject, SetUserData, This, __VA_ARGS__) +# define IDeviceObject_GetUserData(This) CALL_IFACE_METHOD(DeviceObject, GetUserData, This) // clang-format on diff --git a/Graphics/GraphicsEngine/interface/EngineFactory.h b/Graphics/GraphicsEngine/interface/EngineFactory.h index 05f5cf16..fba3e5f9 100644 --- a/Graphics/GraphicsEngine/interface/EngineFactory.h +++ b/Graphics/GraphicsEngine/interface/EngineFactory.h @@ -86,6 +86,8 @@ DILIGENT_BEGIN_INTERFACE(IEngineFactory, IObject) }; DILIGENT_END_INTERFACE +// clang-format on + #include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" #if DILIGENT_C_INTERFACE |
