Right, I misread the code. Indeed, assigning a pipeline to the graphics object calls internal setPipeline() which will call flush() anyway (there https://github.com/Kode/Kha/blob/master/Sources/kha/graphics4/Graphics2.hx#L1035). Thanks!
I will give all this a try as soon as I can
One more thing I forgot to mention: I suppose I need to call flush() on the graphics object before changing pipeline, in order to ensure everything is drawn with previous blending, before moving to the next blending. (by reading at the code, it seems that changing pipeline doesn't trigger flush, so it needs to be called manually, which is fine).
I am considering implementing a spine renderer for Kha, and this requires being able to draw some textures with a specific blending (like additive blending).
By reading code in kha repository, it seems that I need to create multiple pipelines : one for each kind of blending. From what I understood, I need to :
1/ Create (and compile) 1 pipeline instance per kind of blending I need to use
2/ When the next element I want to draw uses a blending different to the previous element, assign the pipelline related to the blending I want to the graphics object (g4) and then draw. Do this each time the blending needs to be changed.
Would this work? And is this the way to go with Kha? OR is there a better alternative or any code example achieving similar things?