mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
internal/graphicsdriver/directx: smooth rendering when resizing the window with DirectX 12
Updates #2615
This commit is contained in:
parent
2423733598
commit
4473557e23
@ -710,6 +710,8 @@ func (g *graphics12) End(present bool) error {
|
||||
if err := g.resizeSwapChainDesktop(g.newScreenWidth, g.newScreenHeight); err != nil {
|
||||
return err
|
||||
}
|
||||
g.screenImage.width = g.newScreenWidth
|
||||
g.screenImage.height = g.newScreenHeight
|
||||
g.newScreenWidth = 0
|
||||
g.newScreenHeight = 0
|
||||
}
|
||||
@ -988,9 +990,14 @@ func (g *graphics12) NewImage(width, height int) (graphicsdriver.Image, error) {
|
||||
}
|
||||
|
||||
func (g *graphics12) NewScreenFramebufferImage(width, height int) (graphicsdriver.Image, error) {
|
||||
var imageWidth, imageHeight int
|
||||
if g.screenImage != nil {
|
||||
imageWidth, imageHeight = g.screenImage.width, g.screenImage.height
|
||||
g.screenImage.Dispose()
|
||||
g.screenImage = nil
|
||||
} else {
|
||||
imageWidth = width
|
||||
imageHeight = height
|
||||
}
|
||||
|
||||
if err := g.updateSwapChain(width, height); err != nil {
|
||||
@ -1000,8 +1007,8 @@ func (g *graphics12) NewScreenFramebufferImage(width, height int) (graphicsdrive
|
||||
i := &image12{
|
||||
graphics: g,
|
||||
id: g.genNextImageID(),
|
||||
width: width,
|
||||
height: height,
|
||||
width: imageWidth,
|
||||
height: imageHeight,
|
||||
screen: true,
|
||||
states: [frameCount]_D3D12_RESOURCE_STATES{0, 0},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user