diff --git a/internal/graphics/opengl/context_mobile.go b/internal/graphics/opengl/context_mobile.go index d6e887799..253b99a77 100644 --- a/internal/graphics/opengl/context_mobile.go +++ b/internal/graphics/opengl/context_mobile.go @@ -61,30 +61,13 @@ func init() { } type context struct { - gl mgl.Context - worker mgl.Worker - initialized chan struct{} + gl mgl.Context + worker mgl.Worker } func NewContext() (*Context, error) { - c := &Context{ - locationCache: newLocationCache(), - lastCompositeMode: CompositeModeUnknown, - } + c := &Context{} c.gl, c.worker = mgl.NewContext() - c.initialized = make(chan struct{}) - go func() { - // GL calls will just enqueue an task to the worker. - // Since the worker is not available, this enqueuing should be done - // in a goroutine. - - // Textures' pixel formats are alpha premultiplied. - c.gl.Enable(mgl.BLEND) - c.BlendFunc(CompositeModeSourceOver) - f := c.gl.GetInteger(mgl.FRAMEBUFFER_BINDING) - c.screenFramebuffer = Framebuffer(mgl.Framebuffer{uint32(f)}) - close(c.initialized) - }() return c, nil } @@ -102,10 +85,6 @@ func (c *Context) Reset() error { return nil } -func (c *Context) InitializedCh() <-chan struct{} { - return c.initialized -} - func (c *Context) Worker() mgl.Worker { return c.worker } diff --git a/internal/ui/ui_mobile.go b/internal/ui/ui_mobile.go index cb0a22452..7ea5fae39 100644 --- a/internal/ui/ui_mobile.go +++ b/internal/ui/ui_mobile.go @@ -40,13 +40,6 @@ func Render(chError <-chan error) error { return errors.New("ui: chError must not be nil") } // TODO: Check this is called on the rendering thread - if chGLInitialized != nil { - if err := doGLWorks(chError, glContext.InitializedCh()); err != nil { - return err - } - close(chGLInitialized) - <-chGLInitializedEnd - } select { case chRender <- struct{}{}: return doGLWorks(chError, chRenderEnd) @@ -85,11 +78,9 @@ type userInterface struct { } var ( - chRender = make(chan struct{}) - chRenderEnd = make(chan struct{}) - chGLInitialized = make(chan struct{}) - chGLInitializedEnd = make(chan struct{}) - currentUI = &userInterface{ + chRender = make(chan struct{}) + chRenderEnd = make(chan struct{}) + currentUI = &userInterface{ sizeChanged: true, } ) @@ -111,12 +102,6 @@ func (u *userInterface) Terminate() error { } func (u *userInterface) Update() (interface{}, error) { - // TODO: Need lock? - if chGLInitialized != nil { - <-chGLInitialized - chGLInitialized = nil - close(chGLInitializedEnd) - } if u.sizeChanged { u.sizeChanged = false e := ScreenSizeEvent{