so much framerate wow

This commit is contained in:
minjaesong
2020-08-10 09:38:24 +09:00
parent e3a4b375e3
commit 1095cbe26c
2 changed files with 8 additions and 4 deletions

View File

@@ -65,7 +65,7 @@ class V2kRunTest(val appConfig: LwjglApplicationConfiguration) : ApplicationAdap
private var updateRate = 1f / 60f private var updateRate = 1f / 60f
override fun render() { override fun render() {
Gdx.graphics.setTitle("${AppLoader.appTitle} $EMDASH F: ${Gdx.graphics.framesPerSecond}") Gdx.graphics.setTitle("${AppLoader.appTitle} $EMDASH F: ${Gdx.graphics.framesPerSecond} $EMDASH VF: ${(1.0 / vdc.statsFrameTime).toInt()}")
super.render() super.render()

View File

@@ -119,7 +119,10 @@ class Videotron2K(var gpu: GraphicsAdapter?) {
internal var variableMap = HashMap<Long, Int>() // VarId with VARIABLE_PREFIX, Integer-value internal var variableMap = HashMap<Long, Int>() // VarId with VARIABLE_PREFIX, Integer-value
internal var sleepLatch = false internal var sleepLatch = false
// statistics stuffs
internal var performanceCounterTmr = 0L internal var performanceCounterTmr = 0L
var statsFrameTime = 0.0 // in seconds
internal set
fun resetVarIdTable() { fun resetVarIdTable() {
varIdTable.clear() varIdTable.clear()
@@ -508,7 +511,7 @@ object Command {
instance.sleepLatch = true instance.sleepLatch = true
val timeTook = (System.nanoTime() - instance.performanceCounterTmr).toDouble() val timeTook = (System.nanoTime() - instance.performanceCounterTmr).toDouble()
println("Frame time: ${timeTook / 1000000.0} ms (fps: ${1000000000.0 / timeTook})") instance.statsFrameTime = timeTook / 1000000000.0
instance.performanceCounterTmr = System.nanoTime() instance.performanceCounterTmr = System.nanoTime()
} }
instSet[CMP shr 3] = { instance, args -> // CMP rA rB rC instSet[CMP shr 3] = { instance, args -> // CMP rA rB rC
@@ -525,8 +528,9 @@ object Command {
val width = instance.variableMap[Videotron2K.VARIABLE_WIDTH]!! val width = instance.variableMap[Videotron2K.VARIABLE_WIDTH]!!
val memAddr = py * width + px val memAddr = py * width + px
args.forEachIndexed { index, value -> args.forEachIndexed { index, variable ->
instance.gpu?.poke(memAddr.toLong() + index, value.toByte()) val value = resolveVar(instance, variable).toByte()
instance.gpu?.poke(memAddr.toLong() + index, value)
} }
// write back auto-incremented value // write back auto-incremented value