mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 15:45:38 +00:00
gpu/gl: explicitly clear buffers before replacing their content
The iOS GL implementation doesn't optimize BufferSubData of the entire buffer, leading to GPU stalls. The workaround is to explicitly clear the buffer before replacing it. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -676,6 +676,12 @@ func (b *gpuBuffer) Upload(data []byte) {
|
||||
if b.hasBuffer {
|
||||
firstBinding := firstBufferType(b.typ)
|
||||
b.backend.funcs.BindBuffer(firstBinding, b.obj)
|
||||
if len(data) == b.size {
|
||||
// the iOS GL implementation doesn't recognize when BufferSubData
|
||||
// clears the entire buffer. Tell it and avoid GPU stalls.
|
||||
// See also https://github.com/godotengine/godot/issues/23956.
|
||||
b.backend.funcs.BufferData(firstBinding, b.size, glimpl.DYNAMIC_DRAW)
|
||||
}
|
||||
b.backend.funcs.BufferSubData(firstBinding, 0, data)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user