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
54protected:
55
56 HDPRMANLOADER_API
57 virtual TfToken _GetRenderVariant() { return TfToken(); }
58
59 HDPRMANLOADER_API
60 virtual int _GetCpuConfig(HdRenderSettingsMap const& settingsMap);
61
62 HDPRMANLOADER_API
63 virtual std::vector<int> _GetGpuConfig(HdRenderSettingsMap const& settingsMap);
64
65private:
66 // This class does not support copying.
67 HdPrmanLoaderRendererPlugin(
68 const HdPrmanLoaderRendererPlugin&) = delete;
69 HdPrmanLoaderRendererPlugin &operator =(
70 const HdPrmanLoaderRendererPlugin&) = delete;
71};
72
73// These macros are used to shim the actual hdPrman delegate implementation
74#define HDPRMAN_LOADER_CREATE_DELEGATE \
75 extern "C" ARCH_EXPORT HdRenderDelegate* HdPrmanLoaderCreateDelegate( \
76 HdRenderSettingsMap const& settingsMap, \
77 TfToken const& rileyVariant, \
78 int xpuCpuConfig, \
79 std::vector<int> xpuGpuConfig)
80#define HDPRMAN_LOADER_DELETE_DELEGATE \
81 extern "C" ARCH_EXPORT void HdPrmanLoaderDeleteDelegate( \
82 HdRenderDelegate *renderDelegate)
83
84PXR_NAMESPACE_CLOSE_SCOPE
85
86#endif // PXR_IMAGING_PLUGIN_HD_PRMAN_LOADER_RENDERER_PLUGIN_H
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(HdContainerDataSourceHandle const &rendererCreateArgs, std::string *reasonWhyNot=nullptr) const
Returns true if this renderer plugin is supported in the running process and false if not.
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:71
#define TF_DECLARE_PUBLIC_TOKENS(...)
Macro to define public tokens.
Definition: staticTokens.h:92
HdRendererCreateArgs contains members indicating the resources available when creating a renderer plu...