ebiten: update comments

Updates #2601
This commit is contained in:
Hajime Hoshi 2023-03-14 13:06:11 +09:00
parent b1048025d9
commit 39aaf7fe37
2 changed files with 5 additions and 2 deletions

View File

@ -38,10 +38,10 @@ type Image struct {
original *Image
bounds image.Rectangle
// tmpVertices must not be reused until the vertices are sent to the graphics command queue.
// tmpVertices must not be reused until ui.Image.Draw* is called.
tmpVertices []float32
// tmpUniforms must not be reused until the vertices are sent to the graphics command queue.
// tmpUniforms must not be reused until ui.Image.Draw* is called.
tmpUniforms []uint32
// Do not add a 'buffering' member that are resolved lazily.

View File

@ -110,6 +110,9 @@ func (q *commandQueue) EnqueueDrawTrianglesCommand(dst *Image, srcs [graphics.Sh
q.tmpNumVertexFloats += len(vertices)
q.tmpNumIndices += len(indices)
// prependPreservedUniforms not only prepends values to the given slice but also creates a new slice.
// Allocating a new slice is necessary to make EnqueueDrawTrianglesCommand safe so far.
// TODO: This might cause a performance issue (#2601).
uniforms = q.prependPreservedUniforms(uniforms, shader, dst, srcs, offsets, dstRegion, srcRegion)
// Remove unused uniform variables so that more commands can be merged.