-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[Merged by Bors] - Remove unnecessary alternate create_texture path in prepare_asset for Image #6671
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the parameters that went into write_texture()
came from the texture descriptor, so it seems unlikely that it was handling any special case not covered by create_texture_with_data()
.
while this works the same, it is potentially slower in the no-mip/no-compression case as the code was taking a lot of shortcuts |
@mockersf Current bevy with branch: This PR: So this PR is apparently faster. It looks like at least part of this is because |
nice! 🎉 |
bors r+ |
… Image (#6671) # Objective `prepare_asset` for Image has an alternate path for texture creation that is used when the image is not compressed and does not contain mipmaps. This additional code path is unnecessary as `render_device.create_texture_with_data()` will handle both cases correctly. ## Solution Use `render_device.create_texture_with_data()` in all cases. Tested successfully with the following examples: - load_gltf - render_to_texture - texture - 3d_shapes - sprite - sprite_sheet - array_texture - shader_material_screenspace_texture - skybox (though this already would use the `create_texture_with_data()` branch anyway)
Pull request successfully merged into main. Build succeeded:
|
… Image (bevyengine#6671) # Objective `prepare_asset` for Image has an alternate path for texture creation that is used when the image is not compressed and does not contain mipmaps. This additional code path is unnecessary as `render_device.create_texture_with_data()` will handle both cases correctly. ## Solution Use `render_device.create_texture_with_data()` in all cases. Tested successfully with the following examples: - load_gltf - render_to_texture - texture - 3d_shapes - sprite - sprite_sheet - array_texture - shader_material_screenspace_texture - skybox (though this already would use the `create_texture_with_data()` branch anyway)
… Image (bevyengine#6671) # Objective `prepare_asset` for Image has an alternate path for texture creation that is used when the image is not compressed and does not contain mipmaps. This additional code path is unnecessary as `render_device.create_texture_with_data()` will handle both cases correctly. ## Solution Use `render_device.create_texture_with_data()` in all cases. Tested successfully with the following examples: - load_gltf - render_to_texture - texture - 3d_shapes - sprite - sprite_sheet - array_texture - shader_material_screenspace_texture - skybox (though this already would use the `create_texture_with_data()` branch anyway)
… Image (bevyengine#6671) # Objective `prepare_asset` for Image has an alternate path for texture creation that is used when the image is not compressed and does not contain mipmaps. This additional code path is unnecessary as `render_device.create_texture_with_data()` will handle both cases correctly. ## Solution Use `render_device.create_texture_with_data()` in all cases. Tested successfully with the following examples: - load_gltf - render_to_texture - texture - 3d_shapes - sprite - sprite_sheet - array_texture - shader_material_screenspace_texture - skybox (though this already would use the `create_texture_with_data()` branch anyway)
Objective
prepare_asset
for Image has an alternate path for texture creation that is used when the image is not compressed and does not contain mipmaps. This additional code path is unnecessary asrender_device.create_texture_with_data()
will handle both cases correctly.Solution
Use
render_device.create_texture_with_data()
in all cases.Tested successfully with the following examples:
create_texture_with_data()
branch anyway)