-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Cannot load textures bigger than 512MB #5304
Comments
Is that 512MB the compressed file size? What image dimensions? What format? |
That is the max allocation size allowed for the decoder, so the answer depends on the decoder. In my case I need to load a 16k texture resulting from a photogrammetry scan, this fix allows me to load unlimited size textures (until the actual memory runs out) |
I guess as we handle the error state anyway, if you try to load a texture that is too large for whatever reason and you have insufficient ram, the APIs will warn you appropriately. From that perspective it seems fine. |
# Objective Fixes bevyengine#5304 ## Solution Instead of using a simple utility function for loading, which uses a default allocation limit of 512MB, we use a Reader object which can be configured ad hoc. ## Changelog > This section is optional. If this was a trivial fix, or has no externally-visible impact, you can delete this section. - Allows loading of textures larger than 512MB
# Objective Fixes bevyengine#5304 ## Solution Instead of using a simple utility function for loading, which uses a default allocation limit of 512MB, we use a Reader object which can be configured ad hoc. ## Changelog > This section is optional. If this was a trivial fix, or has no externally-visible impact, you can delete this section. - Allows loading of textures larger than 512MB
# Objective Fixes bevyengine#5304 ## Solution Instead of using a simple utility function for loading, which uses a default allocation limit of 512MB, we use a Reader object which can be configured ad hoc. ## Changelog > This section is optional. If this was a trivial fix, or has no externally-visible impact, you can delete this section. - Allows loading of textures larger than 512MB
Bevy version
commit - de484c1
[Optional] Relevant system information
MacOs 12.4, MacBook Pro Apple M1 Max
What you did
I tried loading a PNG texture larger than 512MB.
What went wrong
It failed loading with the following warning:
2022-07-13T03:37:38.679032Z WARN bevy_asset::asset_server: encountered an error while loading an asset: You may need to add the feature for the file format: failed to load an image: Insufficient memory
Additional information
This is due to the use of a helper function from the image crate, which sets default limits on allocation (512MB).
(from bevy's texture/image.rs:384)
let dyn_img = image::load_from_memory_with_format(buffer, image_crate_format)?;
it can be fixed by using a Reader instead:
With this fix I was able to load very large textures (1GB+) successfully
The text was updated successfully, but these errors were encountered: