mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
internal/restorable: bug fix: concurrent map write
This commit is contained in:
parent
71492554a7
commit
e4576a3de5
@ -57,12 +57,13 @@ var (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
var wg errgroup.Group
|
var wg errgroup.Group
|
||||||
|
var nearestIR, linearIR *shaderir.Program
|
||||||
wg.Go(func() error {
|
wg.Go(func() error {
|
||||||
ir, err := graphics.CompileShader([]byte(builtinshader.Shader(builtinshader.FilterNearest, builtinshader.AddressUnsafe, false)))
|
ir, err := graphics.CompileShader([]byte(builtinshader.Shader(builtinshader.FilterNearest, builtinshader.AddressUnsafe, false)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("restorable: compiling the nearest shader failed: %w", err)
|
return fmt.Errorf("restorable: compiling the nearest shader failed: %w", err)
|
||||||
}
|
}
|
||||||
NearestFilterShader = NewShader(ir)
|
nearestIR = ir
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
wg.Go(func() error {
|
wg.Go(func() error {
|
||||||
@ -70,10 +71,12 @@ func init() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("restorable: compiling the linear shader failed: %w", err)
|
return fmt.Errorf("restorable: compiling the linear shader failed: %w", err)
|
||||||
}
|
}
|
||||||
LinearFilterShader = NewShader(ir)
|
linearIR = ir
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
if err := wg.Wait(); err != nil {
|
if err := wg.Wait(); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
NearestFilterShader = NewShader(nearestIR)
|
||||||
|
LinearFilterShader = NewShader(linearIR)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user