mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-12 03:24:06 +09:00
multithread light: forget about it
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -6,3 +6,4 @@
|
|||||||
*.pdf filter=lfs diff=lfs merge=lfs -text
|
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
*.kra filter=lfs diff=lfs merge=lfs -text
|
*.kra filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ object ThreadExecutor {
|
|||||||
|
|
||||||
// https://stackoverflow.com/questions/28818494/threads-stopping-prematurely-for-certain-values
|
// https://stackoverflow.com/questions/28818494/threads-stopping-prematurely-for-certain-values
|
||||||
fun join() {
|
fun join() {
|
||||||
println("ThreadExecutor.join")
|
//println("ThreadExecutor.join")
|
||||||
isOpen = false
|
isOpen = false
|
||||||
futures.forEach {
|
futures.forEach {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import net.torvald.terrarum.AppLoader.printdbg
|
|||||||
import net.torvald.terrarum.blockproperties.Block
|
import net.torvald.terrarum.blockproperties.Block
|
||||||
import net.torvald.terrarum.blockproperties.BlockCodex
|
import net.torvald.terrarum.blockproperties.BlockCodex
|
||||||
import net.torvald.terrarum.blockproperties.Fluid
|
import net.torvald.terrarum.blockproperties.Fluid
|
||||||
|
import net.torvald.terrarum.concurrent.ThreadExecutor
|
||||||
import net.torvald.terrarum.gameactors.ActorWithBody
|
import net.torvald.terrarum.gameactors.ActorWithBody
|
||||||
import net.torvald.terrarum.gameactors.Luminous
|
import net.torvald.terrarum.gameactors.Luminous
|
||||||
import net.torvald.terrarum.gameworld.BlockAddress
|
import net.torvald.terrarum.gameworld.BlockAddress
|
||||||
@@ -357,28 +358,23 @@ object LightmapRenderer {
|
|||||||
// each usually takes 8..12 ms total when not threaded
|
// each usually takes 8..12 ms total when not threaded
|
||||||
// - with direct memory access of world array and pre-calculating things in the start of the frame,
|
// - with direct memory access of world array and pre-calculating things in the start of the frame,
|
||||||
// I was able to pull out 3.5..5.5 ms! With abhorrently many occurrences of segfaults I had to track down...
|
// I was able to pull out 3.5..5.5 ms! With abhorrently many occurrences of segfaults I had to track down...
|
||||||
|
// - with 'NEWLIGHT2', I was able to pull ~2 ms!
|
||||||
|
//
|
||||||
|
// multithreading - forget about it; overhead is way too big and for some reason i was not able to
|
||||||
|
// resolve the 'noisy shit' artefact
|
||||||
|
AppLoader.measureDebugTime("Renderer.LightRuns") {
|
||||||
|
|
||||||
if (!AppLoader.getConfigBoolean("multithreadedlight")) {
|
// To save you from pains:
|
||||||
AppLoader.measureDebugTime("Renderer.LightRuns") {
|
// - Per-channel light updating is actually slower
|
||||||
|
// BELOW NOTES DOES NOT APPLY TO 'NEWLIGHT2' LIGHT SWIPER
|
||||||
|
// - It seems 5-pass lighting is needed to resonably eliminate the dark spot (of which I have zero idea
|
||||||
|
// why dark spots appear in the first place)
|
||||||
|
// - Multithreading? I have absolutely no idea.
|
||||||
|
// - If you naively slice the screen (job area) to multithread, the seam will appear.
|
||||||
|
|
||||||
// To save you from pains:
|
r1();r2();r3();r4()
|
||||||
// - Per-channel light updating is actually slower
|
|
||||||
// BELOW NOTES DOES NOT APPLY TO 'NEWLIGHT2' LIGHT SWIPER
|
|
||||||
// - It seems 5-pass lighting is needed to resonably eliminate the dark spot (of which I have zero idea
|
|
||||||
// why dark spots appear in the first place)
|
|
||||||
// - Multithreading? I have absolutely no idea.
|
|
||||||
// - If you naively slice the screen (job area) to multithread, the seam will appear.
|
|
||||||
//r3();r4();r1();r2();r3();
|
|
||||||
|
|
||||||
r1();r2();r3();r4()
|
|
||||||
//r1();r2();r3();r4()
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (world.worldIndex != -1) { // to avoid updating on the null world
|
|
||||||
AppLoader.measureDebugTime("Renderer.LightRuns") {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildLanternmap(actorContainers: Array<out List<ActorWithBody>?>) {
|
private fun buildLanternmap(actorContainers: Array<out List<ActorWithBody>?>) {
|
||||||
|
|||||||
Reference in New Issue
Block a user