internal/graphicscommand: rename arguments

This commit is contained in:
Hajime Hoshi 2022-10-15 03:36:25 +09:00
parent bf6a5415cf
commit e796646abd
2 changed files with 12 additions and 11 deletions

View File

@ -159,15 +159,15 @@ func (q *commandQueue) Enqueue(command command) {
}
// Flush flushes the command queue.
func (q *commandQueue) Flush(graphicsDriver graphicsdriver.Graphics, present bool) (err error) {
func (q *commandQueue) Flush(graphicsDriver graphicsdriver.Graphics, endFrame bool) (err error) {
runOnRenderingThread(func() {
err = q.flush(graphicsDriver, present)
err = q.flush(graphicsDriver, endFrame)
})
return
}
// flush must be called the main thread.
func (q *commandQueue) flush(graphicsDriver graphicsdriver.Graphics, present bool) error {
func (q *commandQueue) flush(graphicsDriver graphicsdriver.Graphics, endFrame bool) error {
if len(q.commands) == 0 {
return nil
}
@ -223,7 +223,8 @@ func (q *commandQueue) flush(graphicsDriver graphicsdriver.Graphics, present boo
}
cs = cs[nc:]
}
if err := graphicsDriver.End(present && screenRendered); err != nil {
// TODO: Without checking screenRendered, the tests fail on Windows. Investigate this issue.
if err := graphicsDriver.End(endFrame && screenRendered); err != nil {
return err
}
@ -244,10 +245,10 @@ func (q *commandQueue) flush(graphicsDriver graphicsdriver.Graphics, present boo
return nil
}
// FlushCommands flushes the command queue and present the screen.
// If present is true, the current screen is used to present.
func FlushCommands(graphicsDriver graphicsdriver.Graphics, present bool) error {
return theCommandQueue.Flush(graphicsDriver, present)
// FlushCommands flushes the command queue and present the screen if needed.
// If endFrame is true, the current screen might be used to present.
func FlushCommands(graphicsDriver graphicsdriver.Graphics, endFrame bool) error {
return theCommandQueue.Flush(graphicsDriver, endFrame)
}
// drawTrianglesCommand represents a drawing command to draw an image on another image.

View File

@ -52,10 +52,10 @@ var theImages = &images{
}
// ResolveStaleImages flushes the queued draw commands and resolves all stale images.
// If present is true, the current screen is used to present when flushing the commands.
// If endFrame is true, the current screen might be used to present when flushing the commands.
//
// ResolveStaleImages is intended to be called at the end of a frame.
func ResolveStaleImages(graphicsDriver graphicsdriver.Graphics, present bool) error {
func ResolveStaleImages(graphicsDriver graphicsdriver.Graphics, endFrame bool) error {
if debug.IsDebug {
debug.Logf("Internal image sizes:\n")
imgs := make([]*graphicscommand.Image, 0, len(theImages.images))
@ -65,7 +65,7 @@ func ResolveStaleImages(graphicsDriver graphicsdriver.Graphics, present bool) er
graphicscommand.LogImagesInfo(imgs)
}
if err := graphicscommand.FlushCommands(graphicsDriver, present); err != nil {
if err := graphicscommand.FlushCommands(graphicsDriver, endFrame); err != nil {
return err
}
if !needsRestoring() {