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. // 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() { runOnRenderingThread(func() {
err = q.flush(graphicsDriver, present) err = q.flush(graphicsDriver, endFrame)
}) })
return return
} }
// flush must be called the main thread. // 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 { if len(q.commands) == 0 {
return nil return nil
} }
@ -223,7 +223,8 @@ func (q *commandQueue) flush(graphicsDriver graphicsdriver.Graphics, present boo
} }
cs = cs[nc:] 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 return err
} }
@ -244,10 +245,10 @@ func (q *commandQueue) flush(graphicsDriver graphicsdriver.Graphics, present boo
return nil return nil
} }
// FlushCommands flushes the command queue and present the screen. // FlushCommands flushes the command queue and present the screen if needed.
// If present is true, the current screen is used to present. // If endFrame is true, the current screen might be used to present.
func FlushCommands(graphicsDriver graphicsdriver.Graphics, present bool) error { func FlushCommands(graphicsDriver graphicsdriver.Graphics, endFrame bool) error {
return theCommandQueue.Flush(graphicsDriver, present) return theCommandQueue.Flush(graphicsDriver, endFrame)
} }
// drawTrianglesCommand represents a drawing command to draw an image on another image. // 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. // 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. // 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 { if debug.IsDebug {
debug.Logf("Internal image sizes:\n") debug.Logf("Internal image sizes:\n")
imgs := make([]*graphicscommand.Image, 0, len(theImages.images)) imgs := make([]*graphicscommand.Image, 0, len(theImages.images))
@ -65,7 +65,7 @@ func ResolveStaleImages(graphicsDriver graphicsdriver.Graphics, present bool) er
graphicscommand.LogImagesInfo(imgs) graphicscommand.LogImagesInfo(imgs)
} }
if err := graphicscommand.FlushCommands(graphicsDriver, present); err != nil { if err := graphicscommand.FlushCommands(graphicsDriver, endFrame); err != nil {
return err return err
} }
if !needsRestoring() { if !needsRestoring() {