Loading...
Searching...
No Matches
extComputation.h
1//
2// Copyright 2017 Pixar
3//
4// Licensed under the Apache License, Version 2.0 (the "Apache License")
5// with the following modification; you may not use this file except in
6// compliance with the Apache License and the following modification to it:
7// Section 6. Trademarks. is deleted and replaced with:
8//
9// 6. Trademarks. This License does not grant permission to use the trade
10// names, trademarks, service marks, or product names of the Licensor
11// and its affiliates, except as required to comply with Section 4(c) of
12// the License and to reproduce the content of the NOTICE file.
13//
14// You may obtain a copy of the Apache License at
15//
16// http://www.apache.org/licenses/LICENSE-2.0
17//
18// Unless required by applicable law or agreed to in writing, software
19// distributed under the Apache License with the above modification is
20// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21// KIND, either express or implied. See the Apache License for the specific
22// language governing permissions and limitations under the Apache License.
23//
24#ifndef PXR_IMAGING_HD_EXT_COMPUTATION_H
25#define PXR_IMAGING_HD_EXT_COMPUTATION_H
26
27#include "pxr/pxr.h"
28#include "pxr/imaging/hd/api.h"
29#include "pxr/imaging/hd/sceneDelegate.h"
30#include "pxr/imaging/hd/sprim.h"
31
32PXR_NAMESPACE_OPEN_SCOPE
33
57{
58public:
60 HD_API
62
63 HD_API
64 ~HdExtComputation() override;
65
69 enum DirtyBits : HdDirtyBits {
70 Clean = 0,
71 DirtyInputDesc = 1 << 0,
73 DirtyOutputDesc = 1 << 1,
74 DirtyElementCount = 1 << 2,
76 DirtySceneInput = 1 << 3,
77 DirtyCompInput = 1 << 4,
78 DirtyKernel = 1 << 5,
79
80 DirtyDispatchCount = 1 << 6,
82
83 AllDirty = (DirtyInputDesc
90 };
91
92 HD_API
93 void Sync(HdSceneDelegate *sceneDelegate,
94 HdRenderParam *renderParam,
95 HdDirtyBits *dirtyBits) override;
96
97 HD_API
98 HdDirtyBits GetInitialDirtyBitsMask() const override;
99
100 HD_API
101 size_t GetDispatchCount() const;
102
103 HD_API
104 size_t GetElementCount() const { return _elementCount; }
105
106 HD_API
107 TfTokenVector const & GetSceneInputNames() const {
108 return _sceneInputNames;
109 }
110
111 HD_API
112 TfTokenVector GetOutputNames() const;
113
114 HD_API
115 HdExtComputationInputDescriptorVector const &
116 GetComputationInputs() const {
117 return _computationInputs;
118 }
119
120 HD_API
121 HdExtComputationOutputDescriptorVector const &
122 GetComputationOutputs() const {
123 return _computationOutputs;
124 }
125
126 HD_API
127 const std::string& GetGpuKernelSource() const { return _gpuKernelSource; }
128
129 HD_API
130 bool IsInputAggregation() const;
131
132protected:
133 HD_API
134 void
135 _Sync(HdSceneDelegate *sceneDelegate,
136 HdRenderParam *renderParam,
137 HdDirtyBits *dirtyBits);
138
139 HD_API
140 static bool _IsEnabledSharedExtComputationData();
141
142private:
143 size_t _dispatchCount;
144 size_t _elementCount;
145 TfTokenVector _sceneInputNames;
146 HdExtComputationInputDescriptorVector _computationInputs;
147 HdExtComputationOutputDescriptorVector _computationOutputs;
148 std::string _gpuKernelSource;
149
150 // No default construction or copying
151 HdExtComputation() = delete;
152 HdExtComputation(const HdExtComputation &) = delete;
153 HdExtComputation &operator =(const HdExtComputation &) = delete;
154
155};
156
157PXR_NAMESPACE_CLOSE_SCOPE
158
159#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:52
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:290
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:457