You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
create_texture_with_data is not possible to use correctly with mip-mapped non-power-of-two textures:
the mip sizes are calculated from the texture dimensions, assuming that the provided dimensions are logical dimensions (e.g. not necessarily a multiple of blocksize). this is correct. but the validation step requires that the texture dimensions be physical dimensions (e.g. a multiple of blocksize).
this creates a dilemma where if you have a nPOT texture with mips stored (for example, ktx2) and try to give it to wgpu, you either
tell wgpu the true logical dimensions of the texture and give it the data, so that it can correctly calculate the mip sizes to read from the data block. except wgpu immediately sees that the dimensions are not a multiple of blocksize and rejects it
lie to wgpu and round to physical dimensions, and give it the data. wgpu happily calculates the wrong mip sizes based off of the physical dimensions, which inevitably end up larger than they should be, and tries to index into data that doesnt exist, panicking.
I believe the fix is to remove the validation and handle the conversion to physical dimensions somewhere internally, but i dont know all the places that would be affected by this.
create_texture_with_data is not possible to use correctly with mip-mapped non-power-of-two textures:
the mip sizes are calculated from the texture dimensions, assuming that the provided dimensions are logical dimensions (e.g. not necessarily a multiple of blocksize). this is correct. but the validation step requires that the texture dimensions be physical dimensions (e.g. a multiple of blocksize).
this creates a dilemma where if you have a nPOT texture with mips stored (for example, ktx2) and try to give it to wgpu, you either
In bevy, we currently do option 2 by just calling
.physical_size(texture_format);
before passing it in: https://github.com/bevyengine/bevy/blob/main/crates/bevy_image/src/ktx2.rs#L280I believe the fix is to remove the validation and handle the conversion to physical dimensions somewhere internally, but i dont know all the places that would be affected by this.
This is causing bevy users crashes:
bevyengine/bevy#13289
bevyengine/bevy#19124
The text was updated successfully, but these errors were encountered: