mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
internal/graphicsdriver/directx: remove redundant resetting of allocators
Updates #2202
This commit is contained in:
parent
479483b76d
commit
82d31c5fb7
@ -649,9 +649,6 @@ func (g *Graphics) resizeSwapChainDesktop(width, height int) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
g.releaseResources(g.frameIndex)
|
g.releaseResources(g.frameIndex)
|
||||||
if err := g.resetCommandAllocators(g.frameIndex); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
for i := 0; i < frameCount; i++ {
|
for i := 0; i < frameCount; i++ {
|
||||||
g.fenceValues[i] = g.fenceValues[g.frameIndex]
|
g.fenceValues[i] = g.fenceValues[g.frameIndex]
|
||||||
@ -797,9 +794,6 @@ func (g *Graphics) End(present bool) error {
|
|||||||
|
|
||||||
g.releaseResources(g.frameIndex)
|
g.releaseResources(g.frameIndex)
|
||||||
g.releaseVerticesAndIndices(g.frameIndex)
|
g.releaseVerticesAndIndices(g.frameIndex)
|
||||||
if err := g.resetCommandAllocators(g.frameIndex); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
g.frameStarted = false
|
g.frameStarted = false
|
||||||
}
|
}
|
||||||
@ -888,17 +882,6 @@ func (g *Graphics) releaseVerticesAndIndices(frameIndex int) {
|
|||||||
g.indices[frameIndex] = g.indices[frameIndex][:0]
|
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.
|
// 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?
|
// 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.
|
// 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]) >= numDescriptorsPerFrame {
|
||||||
if len(g.pipelineStates.constantBuffers[g.frameIndex]) >= 16 {
|
|
||||||
if err := g.flushCommandList(g.drawCommandList); err != nil {
|
if err := g.flushCommandList(g.drawCommandList); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user