internal/graphicscommand: bug fix: test failures on Windows

This commit is contained in:
Hajime Hoshi 2022-10-15 02:56:40 +09:00
parent bcc5dc1703
commit bf6a5415cf

View File

@ -179,6 +179,7 @@ func (q *commandQueue) flush(graphicsDriver graphicsdriver.Graphics, present boo
if err := graphicsDriver.Begin(); err != nil { if err := graphicsDriver.Begin(); err != nil {
return err return err
} }
var screenRendered bool
cs := q.commands cs := q.commands
for len(cs) > 0 { for len(cs) > 0 {
nv := 0 nv := 0
@ -194,6 +195,9 @@ func (q *commandQueue) flush(graphicsDriver graphicsdriver.Graphics, present boo
} }
nv += dtc.numVertices() nv += dtc.numVertices()
ne += dtc.numIndices() ne += dtc.numIndices()
if dtc.dst.screen {
screenRendered = true
}
} }
nc++ nc++
} }
@ -219,7 +223,7 @@ func (q *commandQueue) flush(graphicsDriver graphicsdriver.Graphics, present boo
} }
cs = cs[nc:] cs = cs[nc:]
} }
if err := graphicsDriver.End(present); err != nil { if err := graphicsDriver.End(present && screenRendered); err != nil {
return err return err
} }