Closed finscn closed 8 years ago
This was a conscious decision. If you apply the transformations in the shader, you have to flush the draw buffers before each transformation. E.g.:
var draw = function(img) {
ctx.drawImage(img, 100, 100);
ctx.save()
ctx.rotate(45 * Math.PI / 180);
ctx.drawImage(img, 100, 100);
ctx.restore();
}
Currently this needs just one draw call. Doing the transform in the shader would require us to flush the draw buffer when ctx.rotate()
is called resulting in two draw calls. So, in theory doing the transformation in the shader should be faster (though barely measurable), but overall your app will probably run slower.
If you have a performance bottleneck, use the CPU profiler in Instruments.
I found in pixi.js , vertex shader used
It runs transform operation in shader , But Ejecta uses EJVector2ApplyTransform for transform operation.
If move transform operation to Shader, will get better performance ? (Shader uses GPU, oc uses CPU)