app,app/internal/wm: fold context MakeCurrent/ReleaseCurrent into Lock/Unlock

While here, make context Refresh useful and remove the redundant
MakeCurrent from the window loop.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-08-04 12:03:04 +02:00
parent 4dd6a50670
commit 0bdc2e0432
11 changed files with 83 additions and 132 deletions
+5 -13
View File
@@ -72,16 +72,9 @@ func (c *d3d11Context) Present() error {
}
func (c *d3d11Context) Refresh() error {
return nil
}
func (c *d3d11Context) MakeCurrent() error {
var width, height int
c.win.w.Run(func() {
_, width, height = c.win.HWND()
})
_, width, height = c.win.HWND()
if c.renderTarget != nil && width == c.width && height == c.height {
c.ctx.OMSetRenderTargets(c.renderTarget, c.depthView)
return nil
}
c.releaseFBO()
@@ -112,14 +105,13 @@ func (c *d3d11Context) MakeCurrent() error {
}
c.renderTarget = renderTarget
c.depthView = depthView
c.ctx.OMSetRenderTargets(c.renderTarget, c.depthView)
return nil
}
func (c *d3d11Context) ReleaseCurrent() {}
func (c *d3d11Context) Lock() {}
func (c *d3d11Context) Lock() error {
c.ctx.OMSetRenderTargets(c.renderTarget, c.depthView)
return nil
}
func (c *d3d11Context) Unlock() {}