-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Commit entire chunks of light at a time - Share all light data between embeddings
- Loading branch information
Showing
16 changed files
with
524 additions
and
386 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 0 additions & 17 deletions
17
common/src/backend/java/dev/engine_room/flywheel/backend/engine/EnvironmentStorage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,22 @@ | ||
package dev.engine_room.flywheel.backend.engine; | ||
|
||
import java.util.Queue; | ||
import java.util.concurrent.ConcurrentLinkedQueue; | ||
|
||
import dev.engine_room.flywheel.backend.engine.embed.AbstractEmbeddedEnvironment; | ||
import it.unimi.dsi.fastutil.objects.ReferenceLinkedOpenHashSet; | ||
import it.unimi.dsi.fastutil.objects.ReferenceSet; | ||
import it.unimi.dsi.fastutil.objects.ReferenceSets; | ||
|
||
public class EnvironmentStorage { | ||
protected final ReferenceSet<AbstractEmbeddedEnvironment> environments = ReferenceSets.synchronize(new ReferenceLinkedOpenHashSet<>()); | ||
private final Queue<AbstractEmbeddedEnvironment> forDeletion = new ConcurrentLinkedQueue<>(); | ||
|
||
public void track(AbstractEmbeddedEnvironment environment) { | ||
environments.add(environment); | ||
} | ||
|
||
public void enqueueDeletion(AbstractEmbeddedEnvironment environment) { | ||
environments.remove(environment); | ||
|
||
forDeletion.add(environment); | ||
} | ||
|
||
public void flush() { | ||
AbstractEmbeddedEnvironment env; | ||
|
||
while ((env = forDeletion.poll()) != null) { | ||
env.actuallyDelete(); | ||
} | ||
|
||
environments.forEach(AbstractEmbeddedEnvironment::flush); | ||
} | ||
|
||
public void delete() { | ||
environments.forEach(AbstractEmbeddedEnvironment::actuallyDelete); | ||
environments.clear(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
common/src/backend/java/dev/engine_room/flywheel/backend/engine/embed/Arena.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package dev.engine_room.flywheel.backend.engine.embed; | ||
|
||
import dev.engine_room.flywheel.lib.memory.MemoryBlock; | ||
import it.unimi.dsi.fastutil.ints.IntArrayList; | ||
import it.unimi.dsi.fastutil.ints.IntList; | ||
|
||
public class Arena { | ||
private final long elementSizeBytes; | ||
|
||
private MemoryBlock memoryBlock; | ||
|
||
// Monotonic index, generally represents the size of the arena. | ||
private int top = 0; | ||
// List of free indices. | ||
private final IntList freeStack = new IntArrayList(); | ||
|
||
public Arena(long elementSizeBytes, int initialCapacity) { | ||
this.elementSizeBytes = elementSizeBytes; | ||
|
||
memoryBlock = MemoryBlock.malloc(elementSizeBytes * initialCapacity); | ||
} | ||
|
||
public int alloc() { | ||
// First re-use freed elements. | ||
if (!freeStack.isEmpty()) { | ||
return freeStack.removeInt(freeStack.size() - 1); | ||
} | ||
|
||
// Make sure there's room to increment top. | ||
if (top * elementSizeBytes >= memoryBlock.size()) { | ||
memoryBlock = memoryBlock.realloc(memoryBlock.size() * 2); | ||
} | ||
|
||
// Return the top index and increment. | ||
return top++; | ||
} | ||
|
||
public void free(int i) { | ||
// That's it! Now pls don't try to use it. | ||
freeStack.add(i); | ||
} | ||
|
||
public long indexToPointer(int i) { | ||
return memoryBlock.ptr() + i * elementSizeBytes; | ||
} | ||
|
||
public void delete() { | ||
memoryBlock.free(); | ||
} | ||
} |
87 changes: 0 additions & 87 deletions
87
.../src/backend/java/dev/engine_room/flywheel/backend/engine/embed/EmbeddedLightTexture.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.