Отдельные потоки для чистки кеша не нужны, он использует ForkJoinPool
This commit is contained in:
parent
4f4baef997
commit
82955b51dd
@ -233,23 +233,6 @@ class Starbound : ISBFileLocator {
|
|||||||
.maximumWeight(1_024L * 1_024L * 256L /* 256 МиБ */)
|
.maximumWeight(1_024L * 1_024L * 256L /* 256 МиБ */)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
init {
|
|
||||||
val ref = WeakReference(imageCache)
|
|
||||||
|
|
||||||
val worker = Runnable {
|
|
||||||
while (true) {
|
|
||||||
val get = ref.get() ?: break
|
|
||||||
get.cleanUp()
|
|
||||||
LockSupport.parkNanos(1_000_000_000L)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Thread(worker, "Image Data Cache Cleaner for $this").also {
|
|
||||||
it.isDaemon = true
|
|
||||||
it.start()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun item(name: String): ItemStack {
|
fun item(name: String): ItemStack {
|
||||||
return ItemStack(items[name] ?: return ItemStack.EMPTY)
|
return ItemStack(items[name] ?: return ItemStack.EMPTY)
|
||||||
}
|
}
|
||||||
|
@ -442,26 +442,6 @@ class GLStateTracker(val client: StarboundClient) {
|
|||||||
.weakValues()
|
.weakValues()
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
init {
|
|
||||||
val ref0 = WeakReference(named2DTextures0)
|
|
||||||
val ref1 = WeakReference(named2DTextures1)
|
|
||||||
|
|
||||||
val worker = Runnable {
|
|
||||||
while (true) {
|
|
||||||
val get0 = ref0.get() ?: break
|
|
||||||
get0.cleanUp()
|
|
||||||
val get1 = ref1.get() ?: break
|
|
||||||
get1.cleanUp()
|
|
||||||
LockSupport.parkNanos(1_000_000_000L)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Thread(worker, "OpenGL Texture Cache Cleaner for $this").also {
|
|
||||||
it.isDaemon = true
|
|
||||||
it.start()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private val missingTexture: GLTexture2D by lazy {
|
private val missingTexture: GLTexture2D by lazy {
|
||||||
newTexture(missingTexturePath).upload(client.starbound.readDirect(missingTexturePath), GL_RGBA, GL_RGBA).generateMips().also {
|
newTexture(missingTexturePath).upload(client.starbound.readDirect(missingTexturePath), GL_RGBA, GL_RGBA).generateMips().also {
|
||||||
it.textureMinFilter = GL_NEAREST
|
it.textureMinFilter = GL_NEAREST
|
||||||
|
Loading…
Reference in New Issue
Block a user