mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2025-01-24 20:07:54 +01:00
The 3 time world heavyweight champion
- Fix instance hiding on indirect
This commit is contained in:
parent
c8d76c32a7
commit
eae1d0ef94
1 changed files with 22 additions and 12 deletions
|
@ -156,6 +156,27 @@ public class IndirectInstancer<I extends Instance> extends AbstractInstancer<I>
|
||||||
public InstanceHandleImpl.State<I> setDeleted(int index) {
|
public InstanceHandleImpl.State<I> setDeleted(int index) {
|
||||||
int localIndex = index % ObjectStorage.PAGE_SIZE;
|
int localIndex = index % ObjectStorage.PAGE_SIZE;
|
||||||
|
|
||||||
|
clear(localIndex);
|
||||||
|
|
||||||
|
return InstanceHandleImpl.Deleted.instance();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public InstanceHandleImpl.State<I> setVisible(InstanceHandleImpl<I> handle, int index, boolean visible) {
|
||||||
|
if (visible) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
int localIndex = index % ObjectStorage.PAGE_SIZE;
|
||||||
|
|
||||||
|
var out = instances[localIndex];
|
||||||
|
|
||||||
|
clear(localIndex);
|
||||||
|
|
||||||
|
return new InstanceHandleImpl.Hidden<>(parent.recreate, out);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void clear(int localIndex) {
|
||||||
instances[localIndex] = null;
|
instances[localIndex] = null;
|
||||||
handles[localIndex] = null;
|
handles[localIndex] = null;
|
||||||
|
|
||||||
|
@ -174,22 +195,11 @@ public class IndirectInstancer<I extends Instance> extends AbstractInstancer<I>
|
||||||
}
|
}
|
||||||
// Set full page last so that other threads don't race to set the other bitsets.
|
// Set full page last so that other threads don't race to set the other bitsets.
|
||||||
parent.fullPages.clear(pageNo);
|
parent.fullPages.clear(pageNo);
|
||||||
return InstanceHandleImpl.Deleted.instance();
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public InstanceHandleImpl.State<I> setVisible(InstanceHandleImpl<I> handle, int index, boolean visible) {
|
|
||||||
if (visible) {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
int localIndex = index % ObjectStorage.PAGE_SIZE;
|
|
||||||
|
|
||||||
return new InstanceHandleImpl.Hidden<>(parent.recreate, instances[localIndex]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only call this on 2 pages that are mergeable.
|
* Only call this on 2 pages that are mergeable.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue