7#ifndef PXR_IMAGING_HD_ST_TEXTURE_OBJECT_REGISTRY_H
8#define PXR_IMAGING_HD_ST_TEXTURE_OBJECT_REGISTRY_H
11#include "pxr/imaging/hdSt/api.h"
12#include "pxr/imaging/hdSt/enums.h"
13#include "pxr/imaging/hd/instanceRegistry.h"
15#include <tbb/concurrent_vector.h>
19PXR_NAMESPACE_OPEN_SCOPE
21using HdStTextureObjectSharedPtr =
22 std::shared_ptr<class HdStTextureObject>;
23using HdStTextureObjectPtr =
24 std::weak_ptr<class HdStTextureObject>;
25using HdStTextureObjectPtrVector =
26 std::vector<HdStTextureObjectPtr>;
35class HdSt_TextureObjectRegistry final
41 ~HdSt_TextureObjectRegistry();
49 HdStTextureObjectSharedPtr AllocateTextureObject(
51 HdStTextureType textureType);
57 std::set<HdStTextureObjectSharedPtr> Commit();
62 void GarbageCollect();
68 void MarkTextureFilePathDirty(
const TfToken &filePath);
74 void MarkTextureObjectDirty(
75 HdStTextureObjectPtr
const &textureObject);
81 return _resourceRegistry;
86 int64_t GetTotalTextureMemory()
const {
87 return _totalTextureMemory;
94 void AdjustTotalTextureMemory(int64_t memDiff);
97 size_t GetNumberOfTextureObjects()
const {
98 return _textureObjectRegistry.size();
102 HdStTextureObjectSharedPtr _MakeTextureObject(
104 HdStTextureType textureType);
106 std::atomic<int64_t> _totalTextureMemory;
110 _textureObjectRegistry;
114 std::unordered_map<
TfToken, HdStTextureObjectPtrVector,
116 _filePathToTextureObjects;
119 tbb::concurrent_vector<TfToken> _dirtyFilePaths;
122 tbb::concurrent_vector<HdStTextureObjectPtr> _dirtyTextures;
127PXR_NAMESPACE_CLOSE_SCOPE
HdInstanceRegistry is a dictionary container of HdInstance.
A central registry of all GPU resources.
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.
Functor to use for hash maps from tokens to other things.