mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-13 12:32:05 +01:00
graphicscommand: Bug fix: Adjusting source regions must be done before checking merging
Fixes #1333
This commit is contained in:
parent
68c43bb4fb
commit
ac30377297
@ -151,16 +151,6 @@ func (q *commandQueue) EnqueueDrawTrianglesCommand(dst *Image, srcs [graphics.Sh
|
|||||||
q.nextIndex += len(vertices) / graphics.VertexFloatNum
|
q.nextIndex += len(vertices) / graphics.VertexFloatNum
|
||||||
q.tmpNumIndices += len(indices)
|
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 {
|
if srcs[0] != nil {
|
||||||
w, h := srcs[0].InternalSize()
|
w, h := srcs[0].InternalSize()
|
||||||
sourceRegion.X /= float32(w)
|
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{
|
c := &drawTrianglesCommand{
|
||||||
dst: dst,
|
dst: dst,
|
||||||
srcs: srcs,
|
srcs: srcs,
|
||||||
|
Loading…
Reference in New Issue
Block a user