internal/graphicsdriver/directx: refactoring

This commit is contained in:
Hajime Hoshi 2023-04-09 15:30:46 +09:00
parent 78d3e4273b
commit 730c7a2ad0

View File

@ -356,11 +356,12 @@ func (g *graphics11) NewImage(width, height int) (graphicsdriver.Image, error) {
} }
func (g *graphics11) NewScreenFramebufferImage(width, height int) (graphicsdriver.Image, error) { func (g *graphics11) NewScreenFramebufferImage(width, height int) (graphicsdriver.Image, error) {
if g.screenImage != nil {
g.screenImage.Dispose()
g.screenImage = nil
}
if g.graphicsInfra.isSwapChainInited() { if g.graphicsInfra.isSwapChainInited() {
if g.screenImage != nil {
g.screenImage.Dispose()
g.screenImage = nil
}
if err := g.graphicsInfra.resizeSwapChain(width, height); err != nil { if err := g.graphicsInfra.resizeSwapChain(width, height); err != nil {
return nil, err return nil, err
} }
@ -370,11 +371,6 @@ func (g *graphics11) NewScreenFramebufferImage(width, height int) (graphicsdrive
} }
} }
if g.screenImage != nil {
g.screenImage.Dispose()
g.screenImage = nil
}
t, err := g.graphicsInfra.getBuffer(0, &_IID_ID3D11Texture2D) t, err := g.graphicsInfra.getBuffer(0, &_IID_ID3D11Texture2D)
if err != nil { if err != nil {
return nil, err return nil, err