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 cdf83ad2fc
commit c126dea7fb

View File

@ -684,12 +684,16 @@ 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())
// Do not reset the command allocators here (#2249). if err := g.drawCommandAllocators[g.frameIndex].Reset(); err != nil {
// The command allocators are reset at flushCommnadList. return err
}
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
} }
if err := g.copyCommandAllocators[g.frameIndex].Reset(); err != nil {
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 {
return err return err
} }
@ -737,12 +741,16 @@ func (g *Graphics) Begin() error {
} }
g.frameStarted = true g.frameStarted = true
// Do not reset the command allocators here (#2249). if err := g.drawCommandAllocators[g.frameIndex].Reset(); err != nil {
// The command allocators are reset at flushCommnadList. return err
}
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
} }
if err := g.copyCommandAllocators[g.frameIndex].Reset(); err != nil {
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 {
return err return err
} }