Loading...
Searching...
No Matches
rendererPlugin.h
1//
2// Copyright 2019 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_PLUGIN_HD_PRMAN_LOADER_RENDERER_PLUGIN_H
8#define PXR_IMAGING_PLUGIN_HD_PRMAN_LOADER_RENDERER_PLUGIN_H
9
10#include "pxr/pxr.h"
11#include "pxr/imaging/hd/rendererPlugin.h"
12#include "hdPrmanLoader/api.h"
13
14PXR_NAMESPACE_OPEN_SCOPE
15
16#define HDPRMAN_LOADER_TOKENS \
17 (xpu) \
18 ((xpuCpuConfig, "ri:xpuCpuConfig")) \
19 ((xpuGpuConfig, "ri:xpuGpuConfig"))
20 /* end */
21
22TF_DECLARE_PUBLIC_TOKENS(HdPrmanLoaderTokens, HDPRMANLOADER_API, HDPRMAN_LOADER_TOKENS);
23
24class HdPrmanLoaderRendererPlugin : public HdRendererPlugin
25{
26public:
27 HDPRMANLOADER_API
28 HdPrmanLoaderRendererPlugin();
29
30 HDPRMANLOADER_API
31 virtual ~HdPrmanLoaderRendererPlugin();
32
33 HDPRMANLOADER_API
34 HdRenderDelegate *CreateRenderDelegate() override;
35
36 HDPRMANLOADER_API
37 HdRenderDelegate *CreateRenderDelegate(
38 HdRenderSettingsMap const& settingsMap) override;
39
40 HDPRMANLOADER_API
41 void DeleteRenderDelegate(HdRenderDelegate *) override;
42
43 HDPRMANLOADER_API
44#if PXR_VERSION < 2305
45 bool IsSupported() const override;
46#elif HD_API_VERSION < 83
47 bool IsSupported(bool gpuEnabled = true) const override;
48#else
49 bool IsSupported(
50 HdRendererCreateArgs const &rendererCreateArgs,
51 std::string * reasonWhyNot = nullptr) const override;
52#endif
53
54#if HD_API_VERSION >= 90
55#if HD_API_VERSION >= 101
56 HDPRMANLOADER_API
57 HdContainerDataSourceHandle GetSceneIndexCreateArgs() const override;
58#else
59 HDPRMANLOADER_API
60 HdContainerDataSourceHandle GetSceneIndexInputArgs() const override;
61#endif
62#endif
63
64protected:
65
66 HDPRMANLOADER_API
67 virtual TfToken _GetRenderVariant() { return TfToken(); }
68
69 HDPRMANLOADER_API
70 virtual int _GetCpuConfig(HdRenderSettingsMap const& settingsMap);
71
72 HDPRMANLOADER_API
73 virtual std::vector<int> _GetGpuConfig(HdRenderSettingsMap const& settingsMap);
74
75private:
76 // This class does not support copying.
77 HdPrmanLoaderRendererPlugin(
78 const HdPrmanLoaderRendererPlugin&) = delete;
79 HdPrmanLoaderRendererPlugin &operator =(
80 const HdPrmanLoaderRendererPlugin&) = delete;
81};
82
83// These macros are used to shim the actual hdPrman delegate implementation
84#define HDPRMAN_LOADER_CREATE_DELEGATE \
85 extern "C" ARCH_EXPORT HdRenderDelegate* HdPrmanLoaderCreateDelegate( \
86 HdRenderSettingsMap const& settingsMap, \
87 TfToken const& rileyVariant, \
88 int xpuCpuConfig, \
89 std::vector<int> xpuGpuConfig)
90#define HDPRMAN_LOADER_DELETE_DELEGATE \
91 extern "C" ARCH_EXPORT void HdPrmanLoaderDeleteDelegate( \
92 HdRenderDelegate *renderDelegate)
93
94PXR_NAMESPACE_CLOSE_SCOPE
95
96#endif // PXR_IMAGING_PLUGIN_HD_PRMAN_LOADER_RENDERER_PLUGIN_H
This class defines a renderer plugin interface for Hydra.
virtual HD_API HdContainerDataSourceHandle GetSceneIndexCreateArgs() const
Arguments that an application should pass as create arguments to scene indices so that they can be co...
Token for efficient comparison, assignment, and hashing of known strings.
Definition token.h:71
#define TF_DECLARE_PUBLIC_TOKENS(...)
Macro to define public tokens.