Skip to content

IR dot3 print v2 + true IR deep copy#1069

Open
keptsecret wants to merge 11 commits into
material_compiler_irfrom
ir_dot3_print_v2
Open

IR dot3 print v2 + true IR deep copy#1069
keptsecret wants to merge 11 commits into
material_compiler_irfrom
ir_dot3_print_v2

Conversation

@keptsecret
Copy link
Copy Markdown
Contributor

No description provided.

#define HASH_OPTIONALS_HASH(HANDLE) if (HANDLE) {HASH_REQUIREDS_HASH(HANDLE);} else {hasher << core::blake3_hash_t::EmptyInput();}

virtual _typed_pointer_type<INode> copy(CTrueIR* ir) const = 0;
#define COPY_DEFAULT_IMPL inline _typed_pointer_type<INode> copy(CTrueIR* ir) const override final \
Copy link
Copy Markdown
Member

@devshgraphicsprogramming devshgraphicsprogramming May 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing undef for this

Comment on lines +369 to +379
inline typed_pointer_type<INode> getChildHandle_impl(const uint8_t ix) const override final { return block_allocator_type::_static_cast<INode>(child[0]); }
inline void setChild_impl(const uint8_t ix, _typed_pointer_type<INode> newChild) override final { child[0] = block_allocator_type::_static_cast<IFactor>(newChild); }

inline _typed_pointer_type<INode> copy(CTrueIR* ir) const override final
{
auto& pool = ir->getObjectPool();
const auto copyH = pool.emplace<std::remove_const_t<std::remove_pointer_t<decltype(this)> > >(getState());
if (auto* const copy = pool.deref(copyH); copyH)
*copy = *this;
return copyH;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are wrong, child is variable size/length


inline typed_pointer_type<INode> getChildHandle_impl(const uint8_t ix) const override final
{
return ix ? block_allocator_type::_static_cast<INode>(factor) : block_allocator_type::_static_cast<INode>(contributor);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't need to static cast up the hierarchy, handle should do it by itself, the probelm stems from you trying to return a typed<T> instead of a typed<const T>

public:
inline EFinalType getFinalType() const override {return EFinalType::CCorellatedTransmission;}

inline uint8_t getChildCount() const override final { return 3; } // TODO: or 4?
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4

Comment on lines 214 to 218
const auto visited = visitedNodes.find(childHandle);
if (visited != visitedNodes.end())
continue;
nodeStack.push_back(childHandle);
visitedNodes.insert(childHandle);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use the std::bind insert pattern

}
}

uint32_t CTrueIR::deepCopy(typed_pointer_type<const INode>* out,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm actually the out could be pointer to non-const handles

pushedChildren++;
}

// TODO: how to handle coated in CorrelatedTransmission?
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

treat it as a child

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants