Skip to content
This repository has been archived by the owner on May 15, 2023. It is now read-only.

LFS: Faster autorotate and bytes operations + LfsApi: Add ScreenshotTextureEvent #226

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dakyneko
Copy link

This PR optimize the bytes and autorotation of screenshot after rendering. Some real numbers:

with 4K rendering

daky optimized v2 (this PR)
rgb 22ms!
rgba 20ms!

knah:
0°
rgb 55-65ms
rgba 80ms

270° 
rgb 260ms
rgba 280ms

90°
rgb 100ms
rgba 130ms

180°
rgb 100ms
rgba 145ms

Details: Unity render is horizontally swapped so we need to mirror swap on X:
That part was rewritten so it's simplified and optimized. Old code was doing the byte wizardry and then using another marshall.Copy which were combined in this PR and thus saving operations and memory.

Also if autorotate previous code was doing byte wizardry but that's not
necessary and slow. In this new version we manipulate the camera so it's always
upright before the rendering. So then there is no need to fix and correct anything except for the above mentioned unity X swap. Enjoy.

Also I added a new event (2nd commit) that allows more modding possibilities: For ex I have a WIP mod that allows to spawn the camera photos in VR directly.

Daky added 2 commits June 20, 2022 16:35
Unity render is horizontally swapped so we need to mirror swap on X:
that part was rewritten so it's simplified and optimized.

Also if autorotate previous code was doing byte wizzardry but that's not
necessary and slow. In this new version we put the camera so it's always
upright then renders, so it's already good.
@dakyneko
Copy link
Author

@knah what do you need to review and merge this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant