Loading...
Searching...
No Matches
extCompPrimvarBufferSource.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_ST_EXT_COMP_PRIMVAR_BUFFER_SOURCE_H
25#define PXR_IMAGING_HD_ST_EXT_COMP_PRIMVAR_BUFFER_SOURCE_H
26
27#include "pxr/pxr.h"
28#include "pxr/imaging/hdSt/api.h"
29
30#include "pxr/imaging/hd/bufferSource.h"
31#include "pxr/imaging/hd/types.h"
32
33#include "pxr/base/tf/token.h"
34
35#include <memory>
36
37PXR_NAMESPACE_OPEN_SCOPE
38
39
40using HdStExtCompCpuComputationSharedPtr =
41 std::shared_ptr<class HdStExtCompCpuComputation>;
42
46{
47public:
48
55 HDST_API
57 const TfToken &primvarName,
58 const HdStExtCompCpuComputationSharedPtr &source,
59 const TfToken &sourceOutputName,
60 const HdTupleType &valueType);
61
62 HDST_API
64
66 HDST_API
67 TfToken const &GetName() const override;
68
70 HDST_API
71 void GetBufferSpecs(HdBufferSpecVector *specs) const override;
72
74 HDST_API
75 size_t ComputeHash() const override;
76
78 HDST_API
79 bool Resolve() override;
80
82 HDST_API
83 void const *GetData() const override;
84
86 HDST_API
87 HdTupleType GetTupleType() const override;
88
90 HDST_API
91 size_t GetNumElements() const override;
92
93protected:
95 HDST_API
96 bool _CheckValid() const override;
97
98private:
99 // TfHash support.
100 template <class HashState>
101 friend void TfHashAppend(HashState &h,
103
104 TfToken _primvarName;
105 HdStExtCompCpuComputationSharedPtr _source;
106 size_t _sourceOutputIdx;
107 HdTupleType _tupleType;
108 void const *_rawDataPtr;
109
112 const HdStExtCompPrimvarBufferSource &) = delete;
114 const HdStExtCompPrimvarBufferSource &) = delete;
115};
116
117PXR_NAMESPACE_CLOSE_SCOPE
118
119#endif // PXR_IMAGING_HD_ST_EXT_COMP_PRIMVAR_BUFFER_SOURCE_H
A transient buffer of data that has not yet been committed.
Definition: bufferSource.h:56
Hd Buffer Source that binds a primvar to a Ext Computation output.
HDST_API bool Resolve() override
Extracts the primvar from the source computation.
HDST_API size_t ComputeHash() const override
Computes and returns a hash value for the underlying data.
HDST_API void GetBufferSpecs(HdBufferSpecVector *specs) const override
Adds this Primvar's buffer description to the buffer spec vector.
HDST_API size_t GetNumElements() const override
Returns a count of the number of elements.
HDST_API TfToken const & GetName() const override
Returns the name of the primvar.
HDST_API bool _CheckValid() const override
Returns true if the binding to the source computation was successful.
HDST_API HdTupleType GetTupleType() const override
Returns the tuple data format of the primvar data.
HDST_API HdStExtCompPrimvarBufferSource(const TfToken &primvarName, const HdStExtCompCpuComputationSharedPtr &source, const TfToken &sourceOutputName, const HdTupleType &valueType)
Constructs a new primvar buffer source called primvarName and binds it to the output called sourceOut...
HDST_API void const * GetData() const override
Returns a raw pointer to the primvar data.
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:88
HdTupleType represents zero, one, or more values of the same HdType.
Definition: types.h:358
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...