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
+5 -1
View File
@@ -185,6 +185,10 @@ func (d *Device) CreateSwapChain(hwnd windows.Handle) (*SwapChain, error) {
return &SwapChain{swchain: d3dswchain, fbo: &Framebuffer{}}, nil
}
func (d *Device) BindFramebuffer(fbo *Framebuffer) {
d.ctx.OMSetRenderTargets(fbo.renderTarget, fbo.depthView)
}
func (s *SwapChain) Framebuffer(d *Device) (*Framebuffer, error) {
if s.fbo.renderTarget != nil {
return s.fbo, nil
@@ -816,7 +820,7 @@ func (f *Framebuffer) ReadPixels(src image.Rectangle, pixels []byte) error {
func (b *Backend) BindFramebuffer(fbo backend.Framebuffer) {
b.fbo = fbo.(*Framebuffer)
b.dev.ctx.OMSetRenderTargets(b.fbo.renderTarget, b.fbo.depthView)
b.dev.BindFramebuffer(b.fbo)
}
func (f *Framebuffer) Invalidate() {