ecs: setCapacity in the ECS doesn't adjust component arrays to reflect their new location within ArchetypeStorage #341
Labels
No labels
CI
all
basisu
blog
bug
build
contributor-friendly
core
correctness
deferred
dev
direct3d-headers
docs
driver-os-issue
duplicate
dxcompiler
editor
examples
experiment
feature-idea
feedback
flac
freetype
gamemode
gkurve
glfw
gpu
gpu-dawn
harfbuzz
help welcome
in-progress
infrastructure
invalid
libmach
linux-audio-headers
long-term
mach
mach.gfx
mach.math
mach.physics
mach.testing
model3d
needs-triage
object
opengl-headers
opus
os/linux
os/macos
os/wasm
os/windows
package-manager
priority
proposal
proposal-accepted
question
roadmap
slipped
stability
sysaudio
sysgpu
sysjs
validating-fix
vulkan-zig-generated
wayland-headers
website
wontfix
wrench
www
x11-headers
xcode-frameworks
zig-update
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
hexops/mach#341
Loading…
Add table
Add a link
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?
github.com/hexops/mach@1c0930b404/ecs/src/entities.zig (L152-L155)This implementation of
setCapacityassumes that component arrays have the same position after expanding capacity which ends up with them overwriting one another after expanding archetype storage as the position of each array is shifted forward bynew_capacity - storage.capacity * size_of_previous_component.Thus is should instead be closer to:
As far as I understand this implementation of it.
In short,
setCapacitydoesn't perform step 3 thus leaving arrays overlapping in memory.