setBlend method
Blending for one colour attachment; null switches it off.
attachment is an index into RenderPassDescriptor.colors.
Honoured only where GraphicsDevice.supportsIndependentBlend is
true, and that is a term of this contract rather than a bug in the
backends that answer false. Impeller passes the index to flutter_gpu's
colorAttachmentIndex, WebGPU keeps an equation per target in the
pipeline, the software rasteriser keeps one for each of its first two
attachments, and WebGL2 needs OES_draw_buffers_indexed, which is
optional there. A backend without it sets attachment zero whatever index
is named — so a caller that sets one state on attachment zero and a
different one on attachment one gets its second call applied to the
first, with no error and a plausible picture. Ask before relying on it.
What a call for attachment zero does to the others differs, as it
always has: WebGL2's plain blend functions set every draw buffer at
once, and the other three set attachment zero alone. A caller that wants
two attachments blended differently sets attachment zero first and every
other one after it, which is the same pass on all four. Weighted blended
transparency (R8) is that caller; the MRT probe is the other, switching
attachment one off where attachment zero already is.
Implementation
@override
void setBlend(BlendState? state, {int attachment = 0}) =>
commands.add(RecordedBlend(state, attachment));