-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathrenderDelegate.h
96 lines (66 loc) · 2.9 KB
/
renderDelegate.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// Copyright 2024 The Khronos Group
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include "renderParam.h"
#include <pxr/base/tf/staticTokens.h>
#include <pxr/base/tf/token.h>
#include <pxr/imaging/hd/renderDelegate.h>
#include <pxr/imaging/hd/renderThread.h>
#include <pxr/pxr.h>
#include <anari/anari_cpp.hpp>
#include <mutex>
PXR_NAMESPACE_OPEN_SCOPE
class HdAnariRenderParam;
#define HDANARI_RENDER_SETTINGS_TOKENS (ambientRadiance)(ambientColor)
TF_DECLARE_PUBLIC_TOKENS(
HdAnariRenderSettingsTokens, HDANARI_RENDER_SETTINGS_TOKENS);
class HdAnariRenderDelegate final : public HdRenderDelegate
{
public:
HdAnariRenderDelegate();
HdAnariRenderDelegate(HdRenderSettingsMap const &settingsMap);
~HdAnariRenderDelegate() override;
HdAnariRenderParam *GetRenderParam() const override;
const TfTokenVector &GetSupportedRprimTypes() const override;
const TfTokenVector &GetSupportedSprimTypes() const override;
const TfTokenVector &GetSupportedBprimTypes() const override;
HdResourceRegistrySharedPtr GetResourceRegistry() const override;
HdRenderSettingDescriptorList GetRenderSettingDescriptors() const override;
bool IsPauseSupported() const override;
bool Pause() override;
bool Resume() override;
HdRenderPassSharedPtr CreateRenderPass(
HdRenderIndex *index, HdRprimCollection const &collection) override;
HdInstancer *CreateInstancer(
HdSceneDelegate *delegate, SdfPath const &id) override;
void DestroyInstancer(HdInstancer *instancer) override;
HdRprim *CreateRprim(TfToken const &typeId, SdfPath const &rprimId) override;
void DestroyRprim(HdRprim *rPrim) override;
HdSprim *CreateSprim(TfToken const &typeId, SdfPath const &sprimId) override;
HdSprim *CreateFallbackSprim(TfToken const &typeId) override;
void DestroySprim(HdSprim *sPrim) override;
HdBprim *CreateBprim(TfToken const &typeId, SdfPath const &bprimId) override;
HdBprim *CreateFallbackBprim(TfToken const &typeId) override;
void DestroyBprim(HdBprim *bPrim) override;
void CommitResources(HdChangeTracker *tracker) override;
TfToken GetMaterialBindingPurpose() const override
{
return HdTokens->full;
}
HdAovDescriptor GetDefaultAovDescriptor(TfToken const &name) const override;
VtDictionary GetRenderStats() const override;
private:
static const TfTokenVector SUPPORTED_RPRIM_TYPES;
static const TfTokenVector SUPPORTED_SPRIM_TYPES;
static const TfTokenVector SUPPORTED_BPRIM_TYPES;
static std::mutex _mutexResourceRegistry;
static std::atomic_int _counterResourceRegistry;
static HdResourceRegistrySharedPtr _resourceRegistry;
// This class does not support copying.
HdAnariRenderDelegate(const HdAnariRenderDelegate &) = delete;
HdAnariRenderDelegate &operator=(const HdAnariRenderDelegate &) = delete;
void Initialize();
std::shared_ptr<HdAnariRenderParam> _renderParam;
HdRenderSettingDescriptorList _settingDescriptors;
};
PXR_NAMESPACE_CLOSE_SCOPE