mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 11:18: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 {
|
if err := g.resizeSwapChainDesktop(g.newScreenWidth, g.newScreenHeight); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
g.screenImage.width = g.newScreenWidth
|
||||||
|
g.screenImage.height = g.newScreenHeight
|
||||||
g.newScreenWidth = 0
|
g.newScreenWidth = 0
|
||||||
g.newScreenHeight = 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) {
|
func (g *graphics12) NewScreenFramebufferImage(width, height int) (graphicsdriver.Image, error) {
|
||||||
|
var imageWidth, imageHeight int
|
||||||
if g.screenImage != nil {
|
if g.screenImage != nil {
|
||||||
|
imageWidth, imageHeight = g.screenImage.width, g.screenImage.height
|
||||||
g.screenImage.Dispose()
|
g.screenImage.Dispose()
|
||||||
g.screenImage = nil
|
g.screenImage = nil
|
||||||
|
} else {
|
||||||
|
imageWidth = width
|
||||||
|
imageHeight = height
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := g.updateSwapChain(width, height); err != nil {
|
if err := g.updateSwapChain(width, height); err != nil {
|
||||||
@ -1000,8 +1007,8 @@ func (g *graphics12) NewScreenFramebufferImage(width, height int) (graphicsdrive
|
|||||||
i := &image12{
|
i := &image12{
|
||||||
graphics: g,
|
graphics: g,
|
||||||
id: g.genNextImageID(),
|
id: g.genNextImageID(),
|
||||||
width: width,
|
width: imageWidth,
|
||||||
height: height,
|
height: imageHeight,
|
||||||
screen: true,
|
screen: true,
|
||||||
states: [frameCount]_D3D12_RESOURCE_STATES{0, 0},
|
states: [frameCount]_D3D12_RESOURCE_STATES{0, 0},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user