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 HDPRMANLOADER_API_TYPE HdPrmanLoaderRendererPlugin : public HdRendererPlugin
25{
26public:
27 HDPRMANLOADER_API
28 HdPrmanLoaderRendererPlugin();
29
30 HDPRMANLOADER_API
31 ~HdPrmanLoaderRendererPlugin() override;
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 bool IsSupported(
45#if HD_API_VERSION >= 103
46 const HdRendererCreateArgsSchema &rendererCreateArgs,
47 std::string * reasonWhyNot = nullptr
48#elif HD_API_VERSION >= 83
49 HdRendererCreateArgs const &rendererCreateArgs,
50 std::string * reasonWhyNot = nullptr
51#elif PXR_VERSION >= 2305
52 bool gpuEnabled = true
53#endif
54 ) const override;
55
56#if HD_API_VERSION >= 90
57#if HD_API_VERSION >= 101
58 HDPRMANLOADER_API
59 HdContainerDataSourceHandle GetSceneIndexCreateArgs() const override;
60#else
61 HDPRMANLOADER_API
62 HdContainerDataSourceHandle GetSceneIndexInputArgs() const override;
63#endif
64#endif
65
66protected:
67
68 HDPRMANLOADER_API
69 virtual TfToken _GetRenderVariant();
70
71 HDPRMANLOADER_API
72 virtual int _GetCpuConfig(HdRenderSettingsMap const& settingsMap);
73
74 HDPRMANLOADER_API
75 virtual std::vector<int> _GetGpuConfig(HdRenderSettingsMap const& settingsMap);
76
77private:
78 // This class does not support copying.
79 HdPrmanLoaderRendererPlugin(
80 const HdPrmanLoaderRendererPlugin&) = delete;
81 HdPrmanLoaderRendererPlugin &operator =(
82 const HdPrmanLoaderRendererPlugin&) = delete;
83};
84
85// These macros are used to shim the actual hdPrman delegate implementation
86#define HDPRMAN_LOADER_CREATE_DELEGATE \
87 extern "C" ARCH_EXPORT HdRenderDelegate* HdPrmanLoaderCreateDelegate( \
88 HdRenderSettingsMap const& settingsMap, \
89 TfToken const& rileyVariant, \
90 int xpuCpuConfig, \
91 std::vector<int> xpuGpuConfig)
92#define HDPRMAN_LOADER_DELETE_DELEGATE \
93 extern "C" ARCH_EXPORT void HdPrmanLoaderDeleteDelegate( \
94 HdRenderDelegate *renderDelegate)
95
96PXR_NAMESPACE_CLOSE_SCOPE
97
98#endif // PXR_IMAGING_PLUGIN_HD_PRMAN_LOADER_RENDERER_PLUGIN_H
Arguments to HdRendererPlugin::IsSupported and CreateRenderer.
This class defines a renderer plugin interface for Hydra.
virtual void DeleteRenderDelegate(HdRenderDelegate *renderDelegate)=0
Clients should use CreateDelegate since this method will eventually become protected.
virtual HD_API bool IsSupported(const HdRendererCreateArgsSchema &rendererCreateArgs, std::string *reasonWhyNot=nullptr) const =0
Returns true if this renderer plugin is supported in the running process and false if not.
virtual HD_API HdContainerDataSourceHandle GetSceneIndexCreateArgs() const
Arguments that an application should pass as create arguments to scene indices so that they can be co...
virtual HdRenderDelegate * CreateRenderDelegate()=0
Clients should use CreateDelegate since this method will eventually become protected,...
Token for efficient comparison, assignment, and hashing of known strings.
Definition token.h:81
#define TF_DECLARE_PUBLIC_TOKENS(...)
Macro to define public tokens.