From ac303772978029815b21717106e62746383488a0 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 5 Sep 2020 00:42:47 +0900 Subject: [PATCH] graphicscommand: Bug fix: Adjusting source regions must be done before checking merging Fixes #1333 --- internal/graphicscommand/command.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/internal/graphicscommand/command.go b/internal/graphicscommand/command.go index f9d8a6fde..97a2c6149 100644 --- a/internal/graphicscommand/command.go +++ b/internal/graphicscommand/command.go @@ -151,16 +151,6 @@ func (q *commandQueue) EnqueueDrawTrianglesCommand(dst *Image, srcs [graphics.Sh q.nextIndex += len(vertices) / graphics.VertexFloatNum q.tmpNumIndices += len(indices) - // TODO: If dst is the screen, reorder the command to be the last. - if !split && 0 < len(q.commands) { - // TODO: Pass offsets and uniforms when merging considers the shader. - if last := q.commands[len(q.commands)-1]; last.CanMergeWithDrawTrianglesCommand(dst, srcs, color, mode, filter, address, sourceRegion, shader) { - last.AddNumVertices(len(vertices)) - last.AddNumIndices(len(indices)) - return - } - } - if srcs[0] != nil { w, h := srcs[0].InternalSize() sourceRegion.X /= float32(w) @@ -173,6 +163,16 @@ func (q *commandQueue) EnqueueDrawTrianglesCommand(dst *Image, srcs [graphics.Sh } } + // TODO: If dst is the screen, reorder the command to be the last. + if !split && 0 < len(q.commands) { + // TODO: Pass offsets and uniforms when merging considers the shader. + if last := q.commands[len(q.commands)-1]; last.CanMergeWithDrawTrianglesCommand(dst, srcs, color, mode, filter, address, sourceRegion, shader) { + last.AddNumVertices(len(vertices)) + last.AddNumIndices(len(indices)) + return + } + } + c := &drawTrianglesCommand{ dst: dst, srcs: srcs,