Skip to content

Commit b8573ad

Browse files
committed
Do not mark as dirty if data is the same
1 parent 3d8dee4 commit b8573ad

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

korge-core/src/korlibs/graphics/AGObjects.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,16 @@ class AGBuffer : AGObject() {
6868

6969
private fun upload(data: Buffer, needClone: Boolean): AGBuffer {
7070
if (mem?.sizeInBytes == data.sizeInBytes) {
71+
// Do not mark as dirty if the data is the same
72+
if (data.sizeInBytes < 1024 && Buffer.equals(data, 0, mem!!, 0, data.sizeInBytes)) {
73+
return this
74+
}
75+
7176
Buffer.copy(data, 0, mem!!, 0, data.sizeInBytes)
7277
} else {
7378
mem = if (needClone) data.clone() else data
7479
}
80+
7581
markAsDirty()
7682
return this
7783
}

0 commit comments

Comments
 (0)