24 #ifndef PXR_IMAGING_HD_ST_TEXTURE_OBJECT_REGISTRY_H
25 #define PXR_IMAGING_HD_ST_TEXTURE_OBJECT_REGISTRY_H
28 #include "pxr/imaging/hdSt/api.h"
29 #include "pxr/imaging/hd/enums.h"
30 #include "pxr/imaging/hd/instanceRegistry.h"
32 #include <tbb/concurrent_vector.h>
36 PXR_NAMESPACE_OPEN_SCOPE
38 using HdStTextureObjectSharedPtr =
39 std::shared_ptr<class HdStTextureObject>;
40 using HdStTextureObjectPtr =
41 std::weak_ptr<class HdStTextureObject>;
42 using HdStTextureObjectPtrVector =
43 std::vector<HdStTextureObjectPtr>;
52 class HdSt_TextureObjectRegistry final
56 ~HdSt_TextureObjectRegistry();
64 HdStTextureObjectSharedPtr AllocateTextureObject(
66 HdTextureType textureType);
72 std::set<HdStTextureObjectSharedPtr> Commit();
77 void GarbageCollect();
83 void MarkTextureFilePathDirty(
const TfToken &filePath);
89 void MarkTextureObjectDirty(
90 HdStTextureObjectPtr
const &textureObject);
96 return _resourceRegistry;
101 int64_t GetTotalTextureMemory()
const {
102 return _totalTextureMemory;
109 void AdjustTotalTextureMemory(int64_t memDiff);
112 size_t GetNumberOfTextureObjects()
const {
113 return _textureObjectRegistry.size();
117 HdStTextureObjectSharedPtr _MakeTextureObject(
119 HdTextureType textureType);
121 std::atomic<int64_t> _totalTextureMemory;
125 _textureObjectRegistry;
129 std::unordered_map<
TfToken, HdStTextureObjectPtrVector,
131 _filePathToTextureObjects;
134 tbb::concurrent_vector<TfToken> _dirtyFilePaths;
137 tbb::concurrent_vector<HdStTextureObjectPtr> _dirtyTextures;
142 PXR_NAMESPACE_CLOSE_SCOPE
Functor to use for hash maps from tokens to other things.
HdInstanceRegistry is a dictionary container of HdInstance.
Class to identify a texture file or a texture within the texture file (e.g., a frame in a movie)...
Token for efficient comparison, assignment, and hashing of known strings.
A central registry of all GPU resources.