Skip to content

macOS cache#770

Open
pgilfernandez wants to merge 3 commits into
friction2d:mainfrom
pgilfernandez:macos_cache_v1
Open

macOS cache#770
pgilfernandez wants to merge 3 commits into
friction2d:mainfrom
pgilfernandez:macos_cache_v1

Conversation

@pgilfernandez

Copy link
Copy Markdown

Hi @rodlie,

I've been trying to improve the experience of working with video within Friction under macOS. I used IA to see if it could do it and, after some tests I think it got better.
Have a look at the code and get the ideas, it may have fixed/improved some issues:

This PR improves macOS video/cache stability in Friction.

It fixes several cache-related issues that could cause crashes or stale frames when working with video previews or rendering animations to video on macOS.

## Changes

- Hardened HDD cache save/load handling against missing or failed tasks.
- Moved temporary cache files to Friction’s app temp directory on macOS.
- Added safer handling for missing temporary cache files.
- Prevented invalid image/audio cache entries from being reused.
- Fixed scene frame cache invalidation when the canvas changes.
- Fixed video rendering when cached/rendered frame sizes differ from the codec size.
- Added a macOS memory usage fallback when `TASK_VM_INFO` is unavailable.

I hope it helps ☺️

@rodlie

rodlie commented Jun 2, 2026

Copy link
Copy Markdown
Member

Thanks, will do a review when I get the time (sometime this week).

@rodlie rodlie added the renderer label Jun 2, 2026
@rodlie rodlie self-requested a review June 2, 2026 15:22
@rodlie

rodlie commented Jun 2, 2026

Copy link
Copy Markdown
Member

Did a quick test of d076942, and it "fixes" the main cache issue on macOS, but it's still a weird one and I still don't know the rot of the issue, anyway a good workaround 👍

I think we just run invalidateSceneFramesCache if macOS as it's not needed elsewhere. I will do some minor changes.


Will check the rest later.

@pgilfernandez

Copy link
Copy Markdown
Author

it sounds great!

@rodlie

rodlie commented Jun 2, 2026

Copy link
Copy Markdown
Member

I cherry-picked d076942 to main and added a check for macOS.

@rodlie

rodlie commented Jun 2, 2026

Copy link
Copy Markdown
Member

I took two changes from videoencoder.cpp into this 13b5c1b

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants