mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-13 12:32:05 +01:00
internal/graphicsdriver/directx: update frameIndex at present
This follows the official GDK samples.
This commit is contained in:
parent
b5bbebcccb
commit
a16ffef499
@ -612,13 +612,6 @@ func (g *Graphics) SetWindow(window uintptr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (g *Graphics) Begin() error {
|
func (g *Graphics) Begin() error {
|
||||||
g.frameIndex = 0
|
|
||||||
// The swap chain is initialized when NewScreenFramebufferImage is called.
|
|
||||||
// This must be called at the first frame.
|
|
||||||
if g.swapChain != nil {
|
|
||||||
g.frameIndex = int(g.swapChain.GetCurrentBackBufferIndex())
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := g.drawCommandList.Reset(g.drawCommandAllocators[g.frameIndex], nil); err != nil {
|
if err := g.drawCommandList.Reset(g.drawCommandAllocators[g.frameIndex], nil); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -691,6 +684,9 @@ func (g *Graphics) End(present bool) error {
|
|||||||
if err := g.releaseCommandAllocators(nextIndex); err != nil {
|
if err := g.releaseCommandAllocators(nextIndex); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Move to the next frame.
|
||||||
|
g.frameIndex = int(g.swapChain.GetCurrentBackBufferIndex())
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user