graphicsdriver/opengl: Bug fix: source_size can be optimized out with nearest filter

This commit is contained in:
Hajime Hoshi 2019-02-16 15:14:48 +09:00
parent b1b8d0b4b1
commit 1f46299870

View File

@ -323,10 +323,15 @@ func (d *Driver) useProgram(mode graphics.CompositeMode, colorM *affine.ColorM,
sw := graphics.InternalImageSize(srcW)
sh := graphics.InternalImageSize(srcH)
if d.state.lastSourceWidth != sw || d.state.lastSourceHeight != sh {
d.context.uniformFloats(program, "source_size", []float32{float32(sw), float32(sh)})
d.state.lastSourceWidth = sw
d.state.lastSourceHeight = sh
if filter == graphics.FilterNearest {
d.state.lastSourceWidth = 0
d.state.lastSourceHeight = 0
} else {
if d.state.lastSourceWidth != sw || d.state.lastSourceHeight != sh {
d.context.uniformFloats(program, "source_size", []float32{float32(sw), float32(sh)})
d.state.lastSourceWidth = sw
d.state.lastSourceHeight = sh
}
}
if filter == graphics.FilterScreen {