internal/ui: skip uniform variables when possible

Updates #2364
This commit is contained in:
Hajime Hoshi 2022-10-02 16:02:44 +09:00
parent 239f9de2ca
commit 7b6f726729

View File

@ -281,12 +281,15 @@ func (c *context) drawGame(graphicsDriver graphicsdriver.Graphics) {
dstWidth, dstHeight := c.screen.width, c.screen.height dstWidth, dstHeight := c.screen.width, c.screen.height
srcWidth, srcHeight := c.offscreen.width, c.offscreen.height srcWidth, srcHeight := c.offscreen.width, c.offscreen.height
uniforms := shader.ConvertUniforms(map[string]interface{}{ var uniforms [][]float32
"Scale": []float32{ if shader == c.screenShader {
float32(dstWidth) / float32(srcWidth), uniforms = shader.ConvertUniforms(map[string]interface{}{
float32(dstHeight) / float32(srcHeight), "Scale": []float32{
}, float32(dstWidth) / float32(srcWidth),
}) float32(dstHeight) / float32(srcHeight),
},
})
}
c.screen.DrawTriangles(srcs, vs, is, affine.ColorMIdentity{}, graphicsdriver.CompositeModeCopy, graphicsdriver.FilterNearest, graphicsdriver.AddressUnsafe, dstRegion, graphicsdriver.Region{}, [graphics.ShaderImageCount - 1][2]float32{}, shader, uniforms, false, true) c.screen.DrawTriangles(srcs, vs, is, affine.ColorMIdentity{}, graphicsdriver.CompositeModeCopy, graphicsdriver.FilterNearest, graphicsdriver.AddressUnsafe, dstRegion, graphicsdriver.Region{}, [graphics.ShaderImageCount - 1][2]float32{}, shader, uniforms, false, true)
} }