mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
internal/graphicsdriver/directx: bug fix: processtest failures
The command allocators should be reset only when the frame index was updated. Closes #2249
This commit is contained in:
parent
1762869791
commit
37bae461d1
@ -124,7 +124,8 @@ type Graphics struct {
|
|||||||
|
|
||||||
window windows.HWND
|
window windows.HWND
|
||||||
|
|
||||||
frameIndex int
|
frameIndex int
|
||||||
|
prevBeginFrameIndex int
|
||||||
|
|
||||||
// frameStarted is true since Begin until End with present
|
// frameStarted is true since Begin until End with present
|
||||||
frameStarted bool
|
frameStarted bool
|
||||||
@ -684,6 +685,8 @@ func (g *Graphics) resizeSwapChainDesktop(width, height int) error {
|
|||||||
// TODO: Reset 0 on Xbox
|
// TODO: Reset 0 on Xbox
|
||||||
g.frameIndex = int(g.swapChain.GetCurrentBackBufferIndex())
|
g.frameIndex = int(g.swapChain.GetCurrentBackBufferIndex())
|
||||||
|
|
||||||
|
// TODO: Are these resetting necessary?
|
||||||
|
|
||||||
if err := g.drawCommandAllocators[g.frameIndex].Reset(); err != nil {
|
if err := g.drawCommandAllocators[g.frameIndex].Reset(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -741,14 +744,17 @@ func (g *Graphics) Begin() error {
|
|||||||
}
|
}
|
||||||
g.frameStarted = true
|
g.frameStarted = true
|
||||||
|
|
||||||
if err := g.drawCommandAllocators[g.frameIndex].Reset(); err != nil {
|
if g.prevBeginFrameIndex != g.frameIndex {
|
||||||
return err
|
if err := g.drawCommandAllocators[g.frameIndex].Reset(); err != nil {
|
||||||
}
|
return err
|
||||||
if err := g.drawCommandList.Reset(g.drawCommandAllocators[g.frameIndex], nil); err != nil {
|
}
|
||||||
return err
|
if err := g.copyCommandAllocators[g.frameIndex].Reset(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
g.prevBeginFrameIndex = g.frameIndex
|
||||||
|
|
||||||
if err := g.copyCommandAllocators[g.frameIndex].Reset(); err != nil {
|
if err := g.drawCommandList.Reset(g.drawCommandAllocators[g.frameIndex], nil); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := g.copyCommandList.Reset(g.copyCommandAllocators[g.frameIndex], nil); err != nil {
|
if err := g.copyCommandList.Reset(g.copyCommandAllocators[g.frameIndex], nil); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user