Loading...
Searching...
No Matches
resourceRegistry.h
1//
2// Copyright 2016 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_IMAGING_HD_RESOURCE_REGISTRY_H
8#define PXR_IMAGING_HD_RESOURCE_REGISTRY_H
9
10#include "pxr/pxr.h"
11#include "pxr/imaging/hd/api.h"
12#include "pxr/imaging/hd/version.h"
13
14#include "pxr/imaging/hd/perfLog.h"
15
16#include "pxr/imaging/hf/perfLog.h"
17
19#include "pxr/base/tf/token.h"
21
22#include <memory>
23
24PXR_NAMESPACE_OPEN_SCOPE
25
26
27using HdResourceRegistrySharedPtr = std::shared_ptr<class HdResourceRegistry>;
28
34public:
35 HF_MALLOC_TAG_NEW("new HdResourceRegistry");
36
37 HD_API
39
40 HD_API
41 virtual ~HdResourceRegistry();
42
44 HD_API
45 void Commit();
46
48 HD_API
50
53 typedef size_t TextureKey;
54
56 HD_API
58
65 HD_API
66 virtual void ReloadResource(
67 TfToken const& resourceType,
68 std::string const& path);
69
72 HD_API
74
75protected:
77 HD_API
78 virtual void _Commit();
79
82 HD_API
83 virtual void _GarbageCollect();
84
85private:
86 // Not copyable
88 HdResourceRegistry& operator=(const HdResourceRegistry&) = delete;
89};
90
91PXR_NAMESPACE_CLOSE_SCOPE
92
93#endif //PXR_IMAGING_HD_RESOURCE_REGISTRY_H
A central registry for resources.
virtual HD_API void _Commit()
A hook for derived registries to perform additional resource commits.
size_t TextureKey
Globally unique id for texture, see HdRenderIndex::GetTextureKey() for details.
HD_API void Commit()
Commits all in-flight source data.
virtual HD_API void InvalidateShaderRegistry()
Invalidate any shaders registered with this registry.
virtual HD_API void _GarbageCollect()
Hooks for derived registries to perform additional GC when GarbageCollect() is invoked.
HD_API void GarbageCollect()
cleanup all buffers and remove if empty
virtual HD_API VtDictionary GetResourceAllocation() const
Returns a report of resource allocation by role in bytes and a summary total allocation of GPU memory...
virtual HD_API void ReloadResource(TfToken const &resourceType, std::string const &path)
Generic method to inform RenderDelegate a resource needs to be reloaded.
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
A map with string keys and VtValue values.
Definition: dictionary.h:52
Manage a single instance of an object.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...