From 82d31c5fb730348c016f27b682a8d85a30a9e08a Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Fri, 15 Jul 2022 00:13:22 +0900 Subject: [PATCH] internal/graphicsdriver/directx: remove redundant resetting of allocators Updates #2202 --- .../directx/graphics_windows.go | 20 +------------------ 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/internal/graphicsdriver/directx/graphics_windows.go b/internal/graphicsdriver/directx/graphics_windows.go index 819f112ed..c8eb230bd 100644 --- a/internal/graphicsdriver/directx/graphics_windows.go +++ b/internal/graphicsdriver/directx/graphics_windows.go @@ -649,9 +649,6 @@ func (g *Graphics) resizeSwapChainDesktop(width, height int) error { return err } g.releaseResources(g.frameIndex) - if err := g.resetCommandAllocators(g.frameIndex); err != nil { - return err - } for i := 0; i < frameCount; i++ { g.fenceValues[i] = g.fenceValues[g.frameIndex] @@ -797,9 +794,6 @@ func (g *Graphics) End(present bool) error { g.releaseResources(g.frameIndex) g.releaseVerticesAndIndices(g.frameIndex) - if err := g.resetCommandAllocators(g.frameIndex); err != nil { - return err - } g.frameStarted = false } @@ -888,17 +882,6 @@ func (g *Graphics) releaseVerticesAndIndices(frameIndex int) { g.indices[frameIndex] = g.indices[frameIndex][:0] } -func (g *Graphics) resetCommandAllocators(frameIndex int) error { - if err := g.drawCommandAllocators[frameIndex].Reset(); err != nil { - return err - } - if err := g.copyCommandAllocators[frameIndex].Reset(); err != nil { - return err - } - - return nil -} - // flushCommandList executes commands in the command list and waits for its completion. // // TODO: This is not efficient. Is it possible to make two command lists work in parallel? @@ -1386,8 +1369,7 @@ func (g *Graphics) DrawTriangles(dstID graphicsdriver.ImageID, srcs [graphics.Sh } // Release constant buffers when too many ones were created. - // This is needed espciallly for testings, where present is always false. - if len(g.pipelineStates.constantBuffers[g.frameIndex]) >= 16 { + if len(g.pipelineStates.constantBuffers[g.frameIndex]) >= numDescriptorsPerFrame { if err := g.flushCommandList(g.drawCommandList); err != nil { return err }