Use 0-length slice instead of nil to keep capacities

This commit is contained in:
Hajime Hoshi 2019-09-27 00:34:55 +09:00
parent 59333ba1ad
commit fc3e8bebe4
2 changed files with 2 additions and 2 deletions

View File

@ -59,6 +59,6 @@ func flushDelayedCommands() bool {
for _, c := range delayedCommands { for _, c := range delayedCommands {
c.f() c.f()
} }
delayedCommands = nil delayedCommands = delayedCommands[:0]
return true return true
} }

View File

@ -269,7 +269,7 @@ func (q *commandQueue) Flush() {
q.commands = q.commands[nc:] q.commands = q.commands[nc:]
} }
theGraphicsDriver.End() theGraphicsDriver.End()
q.commands = nil q.commands = q.commands[:0]
q.nvertices = 0 q.nvertices = 0
q.nindices = 0 q.nindices = 0
q.tmpNumIndices = 0 q.tmpNumIndices = 0