mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
Fixed nil dst image checks
This commit is contained in:
parent
c3a358b44b
commit
fc3a6ed373
3
image.go
3
image.go
@ -809,6 +809,9 @@ func DrawTrianglesShaderMRT(dsts [graphics.ShaderDstImageCount]*Image, vertices
|
||||
}
|
||||
|
||||
for _, dst := range dsts {
|
||||
if dst == nil {
|
||||
continue
|
||||
}
|
||||
dst.tmpUniforms = dst.tmpUniforms[:0]
|
||||
dst.tmpUniforms = shader.appendUniforms(dst.tmpUniforms, options.Uniforms)
|
||||
}
|
||||
|
@ -214,6 +214,9 @@ func (i *Image) DrawTriangles(srcs [graphics.ShaderSrcImageCount]*Image, vertice
|
||||
func DrawTrianglesMRT(dsts [graphics.ShaderDstImageCount]*Image, srcs [graphics.ShaderSrcImageCount]*Image, vertices []float32, indices []uint32, blend graphicsdriver.Blend, dstRegion image.Rectangle, srcRegions [graphics.ShaderSrcImageCount]image.Rectangle, shader *atlas.Shader, uniforms []uint32, fillRule graphicsdriver.FillRule) {
|
||||
for _, src := range srcs {
|
||||
for _, dst := range dsts {
|
||||
if dst == nil {
|
||||
continue
|
||||
}
|
||||
if dst == src {
|
||||
panic("buffered: DrawTrianglesMRT: source images must be different from the destination")
|
||||
}
|
||||
@ -246,6 +249,9 @@ func DrawTrianglesMRT(dsts [graphics.ShaderDstImageCount]*Image, srcs [graphics.
|
||||
|
||||
// After rendering, the pixel cache is no longer valid.
|
||||
for _, dst := range dsts {
|
||||
if dst == nil {
|
||||
continue
|
||||
}
|
||||
dst.pixels = nil
|
||||
}
|
||||
}
|
||||
|
@ -177,6 +177,9 @@ func DrawTrianglesMRT(dsts [graphics.ShaderDstImageCount]*Image, srcs [graphics.
|
||||
src.flushBufferedWritePixels()
|
||||
}
|
||||
for _, dst := range dsts {
|
||||
if dst == nil {
|
||||
continue
|
||||
}
|
||||
dst.flushBufferedWritePixels()
|
||||
}
|
||||
|
||||
|
@ -195,6 +195,9 @@ func DrawTrianglesMRT(dsts [graphics.ShaderDstImageCount]*Mipmap, srcs [graphics
|
||||
|
||||
buffered.DrawTrianglesMRT(dstImgs, srcImgs, vertices, indices, blend, dstRegion, srcRegions, shader, uniforms, fillRule)
|
||||
for _, dst := range dsts {
|
||||
if dst == nil {
|
||||
continue
|
||||
}
|
||||
dst.deallocateMipmaps()
|
||||
}
|
||||
}
|
||||
|
@ -119,6 +119,9 @@ func (i *Image) DrawTriangles(srcs [graphics.ShaderSrcImageCount]*Image, vertice
|
||||
func DrawTrianglesMRT(dsts [graphics.ShaderDstImageCount]*Image, srcs [graphics.ShaderSrcImageCount]*Image, vertices []float32, indices []uint32, blend graphicsdriver.Blend, dstRegion image.Rectangle, srcRegions [graphics.ShaderSrcImageCount]image.Rectangle, shader *Shader, uniforms []uint32, fillRule graphicsdriver.FillRule, canSkipMipmap bool, antialias bool) {
|
||||
var dstMipmaps [graphics.ShaderDstImageCount]*mipmap.Mipmap
|
||||
for i, dst := range dsts {
|
||||
if dst == nil {
|
||||
continue
|
||||
}
|
||||
if dst.modifyCallback != nil {
|
||||
dst.modifyCallback()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user