Skip to content

Commit 0316589

Browse files
committed
chore: rename swapchain.toDisplay to current
1 parent ab96aa0 commit 0316589

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

src/main/java/dev/silenium/compose/gl/fbo/FBOFifoSwapChain.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ class FBOFifoSwapChain(capacity: Int, override val fboCreator: (IntSize) -> FBOP
99
override var size: IntSize = IntSize.Zero
1010
private set
1111
private val displayLock = ReentrantLock()
12-
private var toDisplay: FBOPool.FBO? = null
12+
private var current: FBOPool.FBO? = null
1313
private val renderQueue = ArrayBlockingQueue<FBOPool.FBO>(capacity)
1414
private val displayQueue = ArrayBlockingQueue<FBOPool.FBO>(capacity)
1515

1616
override fun display(block: (FBOPool.FBO) -> Unit) = displayLock.withLock {
17-
toDisplay?.let(block)
17+
current?.let(block)
1818
if (!displayQueue.isEmpty()) {
19-
toDisplay?.let{
19+
current?.let{
2020
if (it.size != size) it.destroy()
2121
else renderQueue.offer(it)
2222
}
23-
toDisplay = displayQueue.poll()
23+
current = displayQueue.poll()
2424
}
2525
}
2626

@@ -46,8 +46,8 @@ class FBOFifoSwapChain(capacity: Int, override val fboCreator: (IntSize) -> FBOP
4646
renderQueue.onEach { it.destroy() }.clear()
4747
displayQueue.onEach { it.destroy() }.clear()
4848
displayLock.withLock {
49-
toDisplay?.destroy()
50-
toDisplay = null
49+
current?.destroy()
50+
current = null
5151
}
5252
}
5353
}

src/main/java/dev/silenium/compose/gl/fbo/FBOMailboxSwapChain.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ class FBOMailboxSwapChain(capacity: Int, override val fboCreator: (IntSize) -> F
1111
private val displayLock = ReentrantLock()
1212
private val waitingLock = ReentrantLock()
1313
private var waitingFBO: FBOPool.FBO? = null
14-
private var toDisplay: FBOPool.FBO? = null
14+
private var current: FBOPool.FBO? = null
1515
private val renderQueue = ArrayBlockingQueue<FBOPool.FBO>(capacity)
1616

1717
override fun display(block: (FBOPool.FBO) -> Unit) = displayLock.withLock {
18-
toDisplay?.let(block)
18+
current?.let(block)
1919
waitingLock.withLock {
2020
val waiting = waitingFBO ?: return
2121
if (waiting.size != size) {
2222
waiting.destroy()
2323
waitingFBO = null
2424
return
2525
}
26-
toDisplay = waitingFBO
26+
current = waitingFBO
2727
waitingFBO = null
2828
}
2929
}
@@ -36,14 +36,14 @@ class FBOMailboxSwapChain(capacity: Int, override val fboCreator: (IntSize) -> F
3636
return null
3737
}
3838
displayLock.withLock {
39-
toDisplay?.let {
39+
current?.let {
4040
if (it.size != size) it.destroy()
4141
else renderQueue.offer(it)
4242
}
43-
toDisplay = fbo
43+
current = fbo
4444
}
4545
if (displayLock.tryLock()) {
46-
toDisplay = fbo
46+
current = fbo
4747
displayLock.unlock()
4848
} else waitingLock.withLock {
4949
waitingFBO = fbo
@@ -60,8 +60,8 @@ class FBOMailboxSwapChain(capacity: Int, override val fboCreator: (IntSize) -> F
6060
override fun destroyFBOs() {
6161
renderQueue.onEach { it.destroy() }.clear()
6262
displayLock.withLock {
63-
toDisplay?.destroy()
64-
toDisplay = null
63+
current?.destroy()
64+
current = null
6565
}
6666
waitingLock.withLock {
6767
waitingFBO?.destroy()

0 commit comments

Comments
 (0)