internal/atlas, internal/graphicscommand: refactoring

This commit is contained in:
Hajime Hoshi 2023-04-19 21:32:14 +09:00
parent 1fdc45e652
commit 2f55bb1b3d
2 changed files with 9 additions and 8 deletions

View File

@ -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
}
}

View File

@ -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