Geometry Nodes: De-duplicate index input nodes during evaluation
We do this in other nodes to reduce overhead of using the same node more than once. I don't think it will make a difference with index nodes currently, but at least it's consistent.
This commit is contained in:
@@ -421,6 +421,9 @@ class IndexFieldInput final : public FieldInput {
|
|||||||
const GVArray *get_varray_for_context(const FieldContext &context,
|
const GVArray *get_varray_for_context(const FieldContext &context,
|
||||||
IndexMask mask,
|
IndexMask mask,
|
||||||
ResourceScope &scope) const final;
|
ResourceScope &scope) const final;
|
||||||
|
|
||||||
|
uint64_t hash() const override;
|
||||||
|
bool is_equal_to(const fn::FieldNode &other) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** \} */
|
/** \} */
|
||||||
|
@@ -530,6 +530,17 @@ const GVArray *IndexFieldInput::get_varray_for_context(const fn::FieldContext &U
|
|||||||
mask.min_array_size(), mask.min_array_size(), index_func);
|
mask.min_array_size(), mask.min_array_size(), index_func);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint64_t IndexFieldInput::hash() const
|
||||||
|
{
|
||||||
|
/* Some random constant hash. */
|
||||||
|
return 128736487678;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IndexFieldInput::is_equal_to(const fn::FieldNode &other) const
|
||||||
|
{
|
||||||
|
return dynamic_cast<const IndexFieldInput *>(&other) != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------
|
/* --------------------------------------------------------------------
|
||||||
* FieldOperation.
|
* FieldOperation.
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user