Skip to content

Commit

Permalink
Revert "internal/graphicscommand: clear the queue regardless of an er…
Browse files Browse the repository at this point in the history
…ror"

This reverts commit e21636f.

Reason: Simply this is no longer needed. We gave up testing when an error
occurs in a graphics command queue.
  • Loading branch information
hajimehoshi committed Mar 21, 2022
1 parent 31104c4 commit 5e973ab
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions internal/graphicscommand/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,23 +224,6 @@ func (q *commandQueue) flush(graphicsDriver graphicsdriver.Graphics) error {
return nil
}

defer func() {
// Release the commands explicitly (#1803).
// Apparently, the part of a slice between len and cap-1 still holds references.
// Then, resetting the length by [:0] doesn't release the references.
for i, c := range q.commands {
if c, ok := c.(*drawTrianglesCommand); ok {
q.drawTrianglesCommandPool.put(c)
}
q.commands[i] = nil
}
q.commands = q.commands[:0]
q.nvertices = 0
q.nindices = 0
q.tmpNumVertexFloats = 0
q.tmpNumIndices = 0
}()

es := q.indices
vs := q.vertices
debug.Logf("Graphics commands:\n")
Expand Down Expand Up @@ -340,6 +323,21 @@ func (q *commandQueue) flush(graphicsDriver graphicsdriver.Graphics) error {
cs = cs[nc:]
}
graphicsDriver.End(present)

// Release the commands explicitly (#1803).
// Apparently, the part of a slice between len and cap-1 still holds references.
// Then, resetting the length by [:0] doesn't release the references.
for i, c := range q.commands {
if c, ok := c.(*drawTrianglesCommand); ok {
q.drawTrianglesCommandPool.put(c)
}
q.commands[i] = nil
}
q.commands = q.commands[:0]
q.nvertices = 0
q.nindices = 0
q.tmpNumVertexFloats = 0
q.tmpNumIndices = 0
return nil
}

Expand Down

0 comments on commit 5e973ab

Please sign in to comment.