gui cache: don't finish data

Reduces hud allocation a lot
This commit is contained in:
Moritz Zwerger 2025-03-05 19:16:15 +01:00
parent cf488e1dd6
commit 3598cd4902
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
2 changed files with 3 additions and 12 deletions

View File

@ -1,6 +1,6 @@
/*
* Minosoft
* Copyright (C) 2020-2023 Moritz Zwerger
* Copyright (C) 2020-2025 Moritz Zwerger
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
@ -28,7 +28,6 @@ import de.bixilon.minosoft.gui.rendering.util.vec.vec2.Vec2Util.isGreater
import de.bixilon.minosoft.gui.rendering.util.vec.vec2.Vec2Util.isSmaller
import de.bixilon.minosoft.gui.rendering.util.vec.vec4.Vec4Util.EMPTY
import de.bixilon.minosoft.gui.rendering.util.vec.vec4.Vec4Util.spaceSize
import de.bixilon.minosoft.util.collections.DirectList
abstract class Element(val guiRenderer: GUIRenderer, initialCacheSize: Int = 1000) : InputElement, DragTarget {
var ignoreDisplaySize = false
@ -166,10 +165,6 @@ abstract class Element(val guiRenderer: GUIRenderer, initialCacheSize: Int = 100
cache.offset = Vec2(offset)
cache.options = options
forceRender(offset, cache, options)
if (cache.data !is DirectList) {
// not raw mesh data
cache.data.finish()
}
cacheUpToDate = true
}
if (!directRendering) {

View File

@ -1,6 +1,6 @@
/*
* Minosoft
* Copyright (C) 2020-2023 Moritz Zwerger
* Copyright (C) 2020-2025 Moritz Zwerger
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
@ -36,11 +36,7 @@ class GUIMeshCache(
var options: GUIVertexOptions? = null
fun clear() {
if (data.finished) {
data = HeapArrayFloatList(initialSize = data.size)
} else {
data.clear()
}
data.clear()
}