25#ifndef PXR_IMAGING_HD_UTILS_H
26#define PXR_IMAGING_HD_UTILS_H
29#include "pxr/imaging/hd/api.h"
30#include "pxr/imaging/cameraUtil/conformWindow.h"
33#include "pxr/usd/sdf/path.h"
38#include <unordered_map>
40PXR_NAMESPACE_OPEN_SCOPE
76class RenderInstanceTracker
79 using TWeakPtr = std::weak_ptr<T>;
80 using TSharedPtr = std::shared_ptr<T>;
82 void RegisterInstance(
83 std::string
const &renderInstanceId,
90 auto res = idInstanceMap.insert({renderInstanceId, sp});
92 TWeakPtr &wp = res.first->second;
93 if (
auto handle = wp.lock()) {
98 "An instance with renderInstanceId %s was already "
99 "registered previously.", renderInstanceId.c_str());
102 res.first->second = sp;
106 void UnregisterInstance(
107 std::string
const &renderInstanceId)
109 idInstanceMap.erase(renderInstanceId);
112 TSharedPtr GetInstance(
113 std::string
const &
id)
115 const auto it = idInstanceMap.find(
id);
116 if (it != idInstanceMap.end()) {
117 if (TSharedPtr sp = it->second.lock()) {
126 using _IdToInstanceMap = std::unordered_map<std::string, TWeakPtr>;
127 _IdToInstanceMap idInstanceMap;
136HasActiveRenderSettingsPrim(
137 const HdSceneIndexBaseRefPtr &si,
144CameraUtilConformWindowPolicy
145ToConformWindowPolicy(
const TfToken &token);
154 const HdSceneIndexBaseRefPtr &si,
159PXR_NAMESPACE_CLOSE_SCOPE
Abstract interface to scene data.
A path value used to locate objects in layers or scenegraphs.
static SDF_API const SdfPath & AbsoluteRootPath()
The absolute path representing the top of the namespace hierarchy.
Token for efficient comparison, assignment, and hashing of known strings.
Standard pointer typedefs.
#define TF_DECLARE_REF_PTRS(type)
Define standard ref pointer types.
#define TF_WARN(...)
Issue a warning, but continue execution.