app/internal/d3d11: don't track the Backend for a Device

A previous commit removed the assumption that the output framebuffer
is constant across frames. Thus it is no longer necessary to track
and update a backend's current framebuffer when the window is resized.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-03-02 20:44:56 +01:00
parent 25a19481e3
commit fc56d438f3
2 changed files with 8 additions and 13 deletions
+3 -12
View File
@@ -11,7 +11,6 @@ type d3d11Context struct {
win *window
swchain *d3d11.SwapChain
fbo *d3d11.Framebuffer
backend backend.Device
*d3d11.Device
width, height int
}
@@ -36,13 +35,7 @@ func init() {
}
func (c *d3d11Context) Backend() (backend.Device, error) {
backend, err := d3d11.NewBackend(c.Device)
if err != nil {
return nil, err
}
c.backend = backend
c.backend.BindFramebuffer(c.fbo)
return backend, nil
return d3d11.NewBackend(c.Device)
}
func (c *d3d11Context) Present() error {
@@ -65,7 +58,7 @@ func (c *d3d11Context) Present() error {
func (c *d3d11Context) MakeCurrent() error {
_, width, height := c.win.HWND()
if c.fbo != nil && width == c.width && height == c.height {
c.backend.BindFramebuffer(c.fbo)
c.BindFramebuffer(c.fbo)
return nil
}
if c.fbo != nil {
@@ -82,9 +75,7 @@ func (c *d3d11Context) MakeCurrent() error {
return err
}
c.fbo = fbo
if c.backend != nil {
c.backend.BindFramebuffer(c.fbo)
}
c.BindFramebuffer(c.fbo)
return nil
}