Revert "internal/graphicsdriver/directx: bug fix: do not reset command allocators at Begin"

This reverts commit 9d303e8dc5.

Reason: A GPU memory leak (#2292). Though this reverting reveals the error #2249
again, a memory leak is more critical. Then revert the change once, and then
take time to investigate how to resolve #2249.

Closes #2292
Updates #2249
This commit is contained in:
Hajime Hoshi 2022-09-02 02:27:40 +09:00
parent e93aac7b98
commit 5459036d1c

View File

@ -694,12 +694,16 @@ func (g *Graphics) resizeSwapChainDesktop(width, height int) error {
// TODO: Reset 0 on Xbox
g.frameIndex = int(g.swapChain.GetCurrentBackBufferIndex())
// Do not reset the command allocators here (#2249).
// The command allocators are reset at flushCommnadList.
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
}
if err := g.copyCommandList.Reset(g.copyCommandAllocators[g.frameIndex], nil); err != nil {
return err
}
@ -747,12 +751,16 @@ func (g *Graphics) Begin() error {
}
g.frameStarted = true
// Do not reset the command allocators here (#2249).
// The command allocators are reset at flushCommnadList.
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
}
if err := g.copyCommandList.Reset(g.copyCommandAllocators[g.frameIndex], nil); err != nil {
return err
}