Before this change, `delayedCommandsFlushed` was set as 1 BEFORE
buffered commands were flushed. This meant that a function call and
a command being flushed were not concurrent-safe.
This change fixes this issue by changing the timing of setting
`delayedCommandsFlushed` as 1 to the later time after flushing the
buffered commands.
Closes#2580
This CL fixes the race condtion on delayedCommands, which can be
accessed and set to nil at the same time.
This CL separates some operations for delayedCommands into slow-
paths and fast-paths, and use mutex only at slow-paths for
performance. The implementation is based on sync.Once.
Fixes#1195
This change also enables to remove the optimization at
(*buffered.Image).ReplacePixels.
// This commit w/ the optimization
BenchmarkImageDrawOver-8 60225 19241 ns/op
// This commit w/o the optimization
BenchmarkImageDrawOver-8 66567 17700 ns/op
// The previous w/ the optimization
BenchmarkImageDrawOver-8 62355 19580 ns/op
// The previous w/o the optimization
BenchmarkImageDrawOver-8 54460 22768 ns/op
Updates #1137
Now grpahicscommand saves the error and shows the error after a
while. This was good to simplify the API but was the cause to hide
some issues.
This change fixes all the errors to be returned immediately, and
buffer this in the ebiten package instead.
Fixes#971