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"
16#include <tbb/concurrent_vector.h>
20PXR_NAMESPACE_OPEN_SCOPE
22using HdStTextureObjectSharedPtr =
23 std::shared_ptr<class HdStTextureObject>;
24using HdStTextureObjectPtr =
25 std::weak_ptr<class HdStTextureObject>;
26using HdStTextureObjectPtrVector =
27 std::vector<HdStTextureObjectPtr>;
36class HdSt_TextureObjectRegistry final
42 ~HdSt_TextureObjectRegistry();
50 HdStTextureObjectSharedPtr AllocateTextureObject(
52 HdStTextureType textureType);
58 std::set<HdStTextureObjectSharedPtr> Commit();
63 void GarbageCollect();
69 void MarkTextureFilePathDirty(
const TfToken &filePath);
75 void MarkTextureObjectDirty(
76 HdStTextureObjectPtr
const &textureObject);
82 return _resourceRegistry;
87 int64_t GetTotalTextureMemory()
const {
88 return _totalTextureMemory;
95 void AdjustTotalTextureMemory(int64_t memDiff);
98 size_t GetNumberOfTextureObjects()
const {
99 return _textureObjectRegistry.size();
106 std::vector<VtDictionary> GetAllocInfo()
const;
109 HdStTextureObjectSharedPtr _MakeTextureObject(
111 HdStTextureType textureType);
113 std::atomic<int64_t> _totalTextureMemory;
117 _textureObjectRegistry;
121 std::unordered_map<
TfToken, HdStTextureObjectPtrVector,
123 _filePathToTextureObjects;
126 tbb::concurrent_vector<TfToken> _dirtyFilePaths;
129 tbb::concurrent_vector<HdStTextureObjectPtr> _dirtyTextures;
134PXR_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.