Texture::from_path uses confusing/misleading byte conversion #673
Labels
No labels
Context: Bug
Context: Enhancements
Platform: Android
Platform: Linux
Platform: Web
Platform: Windows
Platform: iOS
Platform: macOS
Target: CI
Target: CLI
Target: Dependency
Target: Engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
SakulFlee/Orbital#673
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: 🟡 Medium
File:
Crates/orbital_resources/src/texture/mod.rs:210-215Bug:
The
from_pathmethod converts image pixel data using a roundabout approach:This is equivalent to
img.to_rgba8().into_raw()(or.to_vec()), but theto_le_bytes()call suggests the author thought they were iterating over pixel values, not individual bytes. The code works correctly but is misleading and suggests potential confusion about theimagecrate API.This also pairs with the manual
bytes_per_pixeltable on lines 342-383 that duplicatestarget_pixel_byte_cost()from wgpu — together they signal fragility in the texture loading pipeline.Fix: Replace with
img.to_rgba8().into_raw()for clarity.@SakulFlee