Skip to content

Generalize the GPU brush cache for reusable node data - #4526

Open
YohYamasaki wants to merge 9 commits into
GraphiteEditor:masterfrom
YohYamasaki:extract-brush-cache
Open

YohYamasaki wants to merge 9 commits into
GraphiteEditor:masterfrom
YohYamasaki:extract-brush-cache

Conversation

@YohYamasaki

Copy link
Copy Markdown
Contributor

This extracts BrushCache from #4468 into a reusable generic cache, which will also be used in the mesh gradient #4081. It now allows to have custom eviction strategy through cache policies.
Also fixed a bug-ish type mismatch path in Cache::take() that could trigger duplicate eviction policy updates by removing and reinserting the entry.

@YohYamasaki
YohYamasaki marked this pull request as draft September 13, 2026 04:43
@YohYamasaki YohYamasaki reopened this Sep 13, 2026
@YohYamasaki
YohYamasaki marked this pull request as ready for review September 13, 2026 04:47

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 11 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread node-graph/libraries/graphene-cache/src/lib.rs
Comment thread node-graph/nodes/brush/src/basic_brush/mod.rs Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 8 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread node-graph/libraries/brush-types/src/lib.rs Outdated
@YohYamasaki
YohYamasaki force-pushed the extract-brush-cache branch 2 times, most recently from 50447d6 to 3f6f2a9 Compare September 14, 2026 01:41

@0HyperCube 0HyperCube left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Seems reasonable. I'm not very good at reasoning about generic ZSTs 🙃.

Comment thread node-graph/libraries/graphene-cache/src/lib.rs Outdated
Comment thread node-graph/libraries/graphene-cache/src/lib.rs Outdated
Comment on lines -112 to -114
if slot.epoch == self.epoch {
self.epoch += 1;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@timon-schelling this is a bit confusing. Why only increment the epoch if we have a cache hit? If you have infinite cache misses then you end up still on epoch 0?

Comment thread node-graph/libraries/graphene-cache/src/lib.rs Outdated
Comment thread node-graph/libraries/graphene-cache/Cargo.toml

@timon-schelling timon-schelling left a comment

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.

Generally happy how it looks, great work.

Comment thread node-graph/libraries/graphene-cache/src/lib.rs Outdated
Comment thread node-graph/libraries/graphene-cache/src/lib.rs Outdated
Comment thread node-graph/libraries/graphene-cache/src/lib.rs Outdated
Comment thread node-graph/libraries/graphene-cache/src/lib.rs Outdated
Comment thread node-graph/libraries/graphene-cache/src/lib.rs Outdated
Comment thread node-graph/libraries/graphene-cache/src/lib.rs Outdated
Comment thread node-graph/libraries/graphene-cache/src/lib.rs Outdated
@YohYamasaki

Copy link
Copy Markdown
Contributor Author

@cubic-dev-ai review

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review

@YohYamasaki I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 13 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread node-graph/nodes/brush/src/basic_brush/mod.rs
Comment thread node-graph/graph-craft/src/document/value.rs Outdated
Comment thread node-graph/libraries/graphene-cache/src/lib.rs Outdated
YohYamasaki and others added 2 commits September 24, 2026 09:34
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
@YohYamasaki

Copy link
Copy Markdown
Contributor Author

@timon-schelling I have added the handle + made the cache generic over the value, could you please review this again?

This branch has not been deployed

No deployments
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.

3 participants