diff --git a/internal/atlas/image.go b/internal/atlas/image.go index 9b37c045e..c5e90c41e 100644 --- a/internal/atlas/image.go +++ b/internal/atlas/image.go @@ -459,8 +459,8 @@ func (i *Image) drawTriangles(srcs [graphics.ShaderImageCount]*Image, vertices [ swf, shf := float32(sw), float32(sh) n := len(vertices) for i := 0; i < n; i += graphics.VertexFloatCount { - vertices[i] = vertices[i] + dx - vertices[i+1] = vertices[i+1] + dy + vertices[i] += dx + vertices[i+1] += dy vertices[i+2] = (vertices[i+2] + oxf) / swf vertices[i+3] = (vertices[i+3] + oyf) / shf } @@ -473,8 +473,8 @@ func (i *Image) drawTriangles(srcs [graphics.ShaderImageCount]*Image, vertices [ } else { n := len(vertices) for i := 0; i < n; i += graphics.VertexFloatCount { - vertices[i] = vertices[i] + dx - vertices[i+1] = vertices[i+1] + dy + vertices[i] += dx + vertices[i+1] += dy } } diff --git a/internal/graphicscommand/command.go b/internal/graphicscommand/command.go index 8ea0b1822..d00c6e370 100644 --- a/internal/graphicscommand/command.go +++ b/internal/graphicscommand/command.go @@ -590,11 +590,12 @@ func (q *commandQueue) prependPreservedUniforms(uniforms []uint32, shader *Shade // Set the source texture sizes. for i, src := range srcs { - if src != nil { - w, h := src.InternalSize() - uniforms[idx+2*i] = math.Float32bits(float32(w)) - uniforms[idx+2*i+1] = math.Float32bits(float32(h)) + if src == nil { + continue } + w, h := src.InternalSize() + uniforms[idx+2*i] = math.Float32bits(float32(w)) + uniforms[idx+2*i+1] = math.Float32bits(float32(h)) } idx += len(srcs) * 2