mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +01:00
graphicsdriver/opengl: Use sync.Once for concurrent safety
This commit is contained in:
parent
6b7f21f0c8
commit
3a0dbd3977
@ -50,6 +50,7 @@ type context struct {
|
||||
lastViewportHeight int
|
||||
lastCompositeMode driver.CompositeMode
|
||||
maxTextureSize int
|
||||
maxTextureSizeOnce sync.Once
|
||||
highp bool
|
||||
highpOnce sync.Once
|
||||
|
||||
@ -100,9 +101,9 @@ func (c *context) getScreenFramebuffer() framebufferNative {
|
||||
}
|
||||
|
||||
func (c *context) getMaxTextureSize() int {
|
||||
if c.maxTextureSize == 0 {
|
||||
c.maxTextureSizeOnce.Do(func() {
|
||||
c.maxTextureSize = c.maxTextureSizeImpl()
|
||||
}
|
||||
})
|
||||
return c.maxTextureSize
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user