This document is for a version of USD that is under development. See this page for the current release.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
extComputation.h
1//
2// Copyright 2017 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_EXT_COMPUTATION_H
8#define PXR_IMAGING_HD_EXT_COMPUTATION_H
9
10#include "pxr/pxr.h"
11#include "pxr/imaging/hd/api.h"
12#include "pxr/imaging/hd/sceneDelegate.h"
13#include "pxr/imaging/hd/sprim.h"
14
15PXR_NAMESPACE_OPEN_SCOPE
16
40{
41public:
43 HD_API
45
46 HD_API
47 ~HdExtComputation() override;
48
52 enum DirtyBits : HdDirtyBits {
53 Clean = 0,
54 DirtyInputDesc = 1 << 0,
56 DirtyOutputDesc = 1 << 1,
57 DirtyElementCount = 1 << 2,
59 DirtySceneInput = 1 << 3,
60 DirtyCompInput = 1 << 4,
61 DirtyKernel = 1 << 5,
62
63 DirtyDispatchCount = 1 << 6,
65
66 AllDirty = (DirtyInputDesc
73 };
74
75 HD_API
76 void Sync(HdSceneDelegate *sceneDelegate,
77 HdRenderParam *renderParam,
78 HdDirtyBits *dirtyBits) override;
79
80 HD_API
81 HdDirtyBits GetInitialDirtyBitsMask() const override;
82
83 HD_API
84 size_t GetDispatchCount() const;
85
86 HD_API
87 size_t GetElementCount() const { return _elementCount; }
88
89 HD_API
90 TfTokenVector const & GetSceneInputNames() const {
91 return _sceneInputNames;
92 }
93
94 HD_API
95 TfTokenVector GetOutputNames() const;
96
97 HD_API
98 HdExtComputationInputDescriptorVector const &
99 GetComputationInputs() const {
100 return _computationInputs;
101 }
102
103 HD_API
104 HdExtComputationOutputDescriptorVector const &
105 GetComputationOutputs() const {
106 return _computationOutputs;
107 }
108
109 HD_API
110 const std::string& GetGpuKernelSource() const { return _gpuKernelSource; }
111
112 HD_API
113 bool IsInputAggregation() const;
114
115protected:
116 HD_API
117 void
118 _Sync(HdSceneDelegate *sceneDelegate,
119 HdRenderParam *renderParam,
120 HdDirtyBits *dirtyBits);
121
122 HD_API
123 static bool _IsEnabledSharedExtComputationData();
124
125private:
126 size_t _dispatchCount;
127 size_t _elementCount;
128 TfTokenVector _sceneInputNames;
129 HdExtComputationInputDescriptorVector _computationInputs;
130 HdExtComputationOutputDescriptorVector _computationOutputs;
131 std::string _gpuKernelSource;
132
133 // No default construction or copying
134 HdExtComputation() = delete;
135 HdExtComputation(const HdExtComputation &) = delete;
136 HdExtComputation &operator =(const HdExtComputation &) = delete;
137
138};
139
140PXR_NAMESPACE_CLOSE_SCOPE
141
142#endif // PXR_IMAGING_HD_EXT_COMPUTATION_H
Hydra Representation of a Client defined computation.
DirtyBits
Change tracking.
@ DirtyCompInput
A computation input changed value.
@ DirtyKernel
The compute kernel binding changed.
@ DirtySceneInput
A scene input changed value.
@ DirtyDispatchCount
The number of kernel invocations to execute changed.
@ DirtyElementCount
The number of elements in the output arrays changed.
@ DirtyOutputDesc
The list of outputs changed.
@ DirtyInputDesc
The list of inputs or input bindings changed.
HD_API void Sync(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, HdDirtyBits *dirtyBits) override
Synchronizes state from the delegate to this object.
HD_API HdDirtyBits GetInitialDirtyBitsMask() const override
Returns the minimal set of dirty bits to place in the change tracker for use in the first sync of thi...
HD_API HdExtComputation(SdfPath const &id)
Construct a new ExtComputation identified by id.
The HdRenderParam is an opaque (to core Hydra) handle, to an object that is obtained from the render ...
Adapter class providing data exchange with the client scene graph.
Sprim (state prim) is a base class of managing state for non-drawable scene entity (e....
Definition: sprim.h:35
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440