All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
extCompPrimvarBufferSource.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_ST_EXT_COMP_PRIMVAR_BUFFER_SOURCE_H
8#define PXR_IMAGING_HD_ST_EXT_COMP_PRIMVAR_BUFFER_SOURCE_H
9
10#include "pxr/pxr.h"
11#include "pxr/imaging/hdSt/api.h"
12
13#include "pxr/imaging/hd/bufferSource.h"
14#include "pxr/imaging/hd/types.h"
15
16#include "pxr/base/tf/token.h"
17
18#include <memory>
19
20PXR_NAMESPACE_OPEN_SCOPE
21
22
23using HdStExtCompCpuComputationSharedPtr =
24 std::shared_ptr<class HdStExtCompCpuComputation>;
25
29{
30public:
31
38 HDST_API
40 const TfToken &primvarName,
41 const HdStExtCompCpuComputationSharedPtr &source,
42 const TfToken &sourceOutputName,
43 const HdTupleType &valueType);
44
45 HDST_API
47
49 HDST_API
50 TfToken const &GetName() const override;
51
53 HDST_API
54 void GetBufferSpecs(HdBufferSpecVector *specs) const override;
55
57 HDST_API
58 size_t ComputeHash() const override;
59
61 HDST_API
62 bool Resolve() override;
63
65 HDST_API
66 void const *GetData() const override;
67
69 HDST_API
70 HdTupleType GetTupleType() const override;
71
73 HDST_API
74 size_t GetNumElements() const override;
75
76protected:
78 HDST_API
79 bool _CheckValid() const override;
80
81private:
82 // TfHash support.
83 template <class HashState>
84 friend void TfHashAppend(HashState &h,
86
87 TfToken _primvarName;
88 HdStExtCompCpuComputationSharedPtr _source;
89 size_t _sourceOutputIdx;
90 HdTupleType _tupleType;
91 void const *_rawDataPtr;
92
95 const HdStExtCompPrimvarBufferSource &) = delete;
97 const HdStExtCompPrimvarBufferSource &) = delete;
98};
99
100PXR_NAMESPACE_CLOSE_SCOPE
101
102#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:39
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:71
HdTupleType represents zero, one, or more values of the same HdType.
Definition: types.h:343
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...