Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FlxGraphic.dump #3345

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft

Conversation

ACrazyTown
Copy link
Contributor

@ACrazyTown ACrazyTown commented Jan 30, 2025

Adds the feature described in #3034. I think it might also be possible to add undumping, but I'd have to play around and confirm.

One concern I have is about the naming, imo I feel as if dump isn't very descriptive and there's also deprecated canBeDumped and undump() fields that aren't related to this.

Also, the original issue mentions:

Depending on the type of graphic I think this should probably even be the default in many cases, requiring the graphic to be explicitly "undumped" to be drawn on.

Maybe there could be a compile flag (FLX_GRAPHIC_DEFAULT_DUMP?) or a variable that decides whether the graphics should be automatically dumped

@Geokureli
Copy link
Member

If you're not already aware, the previous dump/undump fields were just removed in flixel 6.0.0, here: #3059

I still don't fully understand the implications of graphic dumping, but the idea was to remove the previous fields that did nothing, and then add them back with actual functionality later on, so people know to remove them from their project to avoid unintended behavior (not that anyone should have been using them)

So this is gonna be a post-6.0.0 feature, but pointing it at release6 is the right move

@Geokureli Geokureli added this to the Post 6.0.0 stuff milestone Jan 30, 2025
@ACrazyTown
Copy link
Contributor Author

If you're not already aware, the previous dump/undump fields were just removed in flixel 6.0.0, here: #3059

I was waiting for that to get merged to avoid any potential conflicts

I still don't fully understand the implications of graphic dumping, but the idea was to remove the previous fields that did nothing, and then add them back with actual functionality later on, so people know to remove them from their project to avoid unintended behavior (not that anyone should have been using them)

In short, OpenFL BitmapDatas hold references to both an image buffer in RAM and a texture on the GPU. When rendering, the texture is used. When drawing on the bitmap or modifying its pixels, the image buffer is used and the rendering texture is updated. If you don't need to modify the pixels (most cases) you can get rid of the image buffer from RAM and just keep the GPU texture. Since decompressed images in RAM can be quite large in size (especially if dealing with bigger spritesheets, like FNF does), this lets us free a lot of memory and the only drawback is losing the ability to modify the bitmap's pixels.

I think a lot of fuss could be avoided simply by using names other than dump() and undump()

@Geokureli
Copy link
Member

this all makes sense to me, thanks for the info

@Geokureli Geokureli deleted the branch HaxeFlixel:dev January 31, 2025 14:28
@Geokureli Geokureli closed this Jan 31, 2025
@ACrazyTown
Copy link
Contributor Author

Was this meant to be closed?

@Geokureli
Copy link
Member

Geokureli commented Jan 31, 2025

This was closed automatically when I merged and deleted the release 6 branch. I didn't know that would happen, try pointing it at dev

@Geokureli Geokureli reopened this Jan 31, 2025
@Geokureli Geokureli changed the base branch from release6 to dev January 31, 2025 15:01
@ACrazyTown
Copy link
Contributor Author

FYI #2909 and #2891 were also closed for the same reason it seems. I'll try to fix the messed up commits

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