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
39 ~HdSt_TextureObjectRegistry();
47 HdStTextureObjectSharedPtr AllocateTextureObject(
49 HdStTextureType textureType);
55 std::set<HdStTextureObjectSharedPtr> Commit();
60 void GarbageCollect();
66 void MarkTextureFilePathDirty(
const TfToken &filePath);
72 void MarkTextureObjectDirty(
73 HdStTextureObjectPtr
const &textureObject);
79 return _resourceRegistry;
84 int64_t GetTotalTextureMemory()
const {
85 return _totalTextureMemory;
92 void AdjustTotalTextureMemory(int64_t memDiff);
95 size_t GetNumberOfTextureObjects()
const {
96 return _textureObjectRegistry.size();
100 HdStTextureObjectSharedPtr _MakeTextureObject(
102 HdStTextureType textureType);
104 std::atomic<int64_t> _totalTextureMemory;
108 _textureObjectRegistry;
112 std::unordered_map<
TfToken, HdStTextureObjectPtrVector,
114 _filePathToTextureObjects;
117 tbb::concurrent_vector<TfToken> _dirtyFilePaths;
120 tbb::concurrent_vector<HdStTextureObjectPtr> _dirtyTextures;
125PXR_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.