-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Make all file access 64-bit #27247
Make all file access 64-bit #27247
Conversation
c705543
to
d5b6d5f
Compare
18f6b83
to
fd014e7
Compare
fd014e7
to
0a62e9a
Compare
93e6c5e
to
2baeec2
Compare
2baeec2
to
01f461e
Compare
This looks good to me. But I don't think this can go into 3.1 due to gdnative compatibility. |
Needs a rebase, otherwise this should be good to merge IMO to get some broader testing, if @reduz agrees. |
d764799
to
0b26ebe
Compare
This changes the types of a big number of variables. General rules: - Using `int64_t` in general. With 64-bit we no longer need to use unsigned type. That matches `Variant` better and avoids akward casts. Checks for negative numbers are performed where they don't make sense (seek, read/write buffer size). - Previous point means no more `size_t` for file size/offsets. - Not worrying about `FileAccess::get_64/store_64` working with unsigneds. I haven't found any place where conversion to unsigned will cause trouble and saves us from having to add `get/store_64_signed` or similar. - Using `int32_t` integers for concepts not needing such a huge range, like pages, blocks, etc. In addition: - Improve usage of integer types in some related places; namely, `DirAccess`, core binds. - The binding for `Directory::get_space_left()` tried to return the size in MiB, but the expression was missing parentheses, so the `1024 * 1024` is removed and it keeps working as usual, returning bytes. Fixes godotengine#27168.
0b26ebe
to
d51c41f
Compare
What kind of >2 GB files are expected to work? I tried loading a 2.4 GB PNG file, and it did not work, the editor crashes when it tries to import. Ubuntu 18.04 64-bit, compiled with this PR.
However, every project that works before still works, so I don't notice any regressions. I think that any issues would only be noticed after merging and lots of people tested it. |
Maybe some libraries aren't 64-bit aware, so this PR will make some file types "addressable" inside a big .pck, but they'll still be not readable if bigger than 2 (or 4) GiB. However, It's good news that you haven't found regressions. And then I agree with you in that it would be good to take advantage of the time span before 3.2 to spot errors. |
AFAIK this PR is to allow making PCKs of more than 2 GB, but not necessarily having a single file of this size in the PCK. Try to compute how much VRAM is necessary to load a 2.4 GB PNG and you should see why you ran out of memory ;) |
Needs a rebase, otherwise I would also like to merge this ASAP. |
Some comments from @reduz on IRC:
So I guess this will have to wait for 4.0. |
The idea behind using I think this is cleaner, leaving to the I/O implementations the work of dealing with Before making this I researched and tried to find something that would fit in Godot, while being correct on all platforms. Of course, my point of view is debatable and I may be wrong on some of my assumptions. |
@RandomShaper Can you try rebasing? Looking forward to this. |
@RandomShaper This feature is awesome, but it needs to be rebased on the latest master branch. If you can find the time, please do so. |
Yes, this PR is quite old. I guess the best thing would be doing it from scratch given the sheer amount of changes that have happened since. |
Since this PR has not been updated in a long time and may need to be redone from scratch, I'm closing this. I'll add the "Salvageable" tag. I think @RandomShaper still wants to be the one redoing this, but anyone is welcome to. |
Bugsquad edit: Superseded by #48768 and #47254
DISCLAIMER:
This change is big and can break a lot of stuff. I'm marking it as [wip] until I have done everything needed I can think of.Maybe it should go directly to 4.0.UPDATE:
This changes a lot of types and may introduce bugs, but it shouldn't break compatibility. Maybe it's suitable for 3.2 or even 3.1.1?
This is all I can do so far on my side. Now I'm asking the community for testing and feedback.
UPDATE:
As soon as I get the build checks to pass. :PCI checks passing!UPDATE: Current commit message after modifications:
This changes the types of a big number of variables.
General rules:
int64_t
in general. With 64-bit we no longer need to use unsigned type. That matchesVariant
better and avoids akward casts. Checks for negative numbers are performed where they don't make sense (seek, read/write buffer size).size_t
for file size/offsets.FileAccess::get_64/store_64
working with unsigneds. I haven't found any place where conversion to unsigned will cause trouble and saves us from having to addget/store_64_signed
or similar.int32_t
integers for concepts not needing such a huge range, like pages, blocks, etc.In addition:
DirAccess
, core binds.Directory::get_space_left()
tried to return the size in MiB, but the expression was missing parentheses, so the1024 * 1024
is removed and it keeps working as usual, returning bytes.Fixes #27168.
Bugsquad edit: Fixes godotengine/godot-proposals#400.