graphicscommand: Do not flush (glFlush) when commands are empty

Fixes #1140
This commit is contained in:
Hajime Hoshi 2020-04-23 00:51:25 +09:00
parent 56ae207d2a
commit 9b8c547342

View File

@ -175,6 +175,10 @@ func fract(x float32) float32 {
// Flush flushes the command queue. // Flush flushes the command queue.
func (q *commandQueue) Flush() error { func (q *commandQueue) Flush() error {
if len(q.commands) == 0 {
return nil
}
es := q.indices es := q.indices
vs := q.vertices vs := q.vertices
if recordLog() { if recordLog() {
@ -233,7 +237,6 @@ func (q *commandQueue) Flush() error {
vs[i*graphics.VertexFloatNum+7] /= s.height vs[i*graphics.VertexFloatNum+7] /= s.height
} }
} }
theGraphicsDriver.Begin() theGraphicsDriver.Begin()
cs := q.commands cs := q.commands
for len(cs) > 0 { for len(cs) > 0 {