setBlend method

  1. @override
void setBlend(
  1. BlendState? state, {
  2. int attachment = 0,
})
override

Blending for one colour attachment; null switches it off.

attachment is an index into RenderPassDescriptor.colors.

One backend of the three honours the index, and that is a term of this contract rather than a bug in the other two. Impeller passes it to flutter_gpu's colorAttachmentIndex; WebGL2 would need EXT_draw_buffers_indexed, which is optional there, and the software rasteriser keeps one blend state for the pass. Both of those set 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 attachment on two backends out of three, with no error and a plausible picture.

Which is why the engine has exactly one caller that passes an index — the MRT probe, switching blending off on attachment one when it is already off on attachment zero, so the substitution is a no-op. Anything wanting two attachments to blend differently needs the extension and a capability query beside it, and neither exists; write the state you want on attachment zero and treat the index as a hint until they do.

Implementation

@override
void setBlend(BlendState? state, {int attachment = 0}) =>
    commands.add(RecordedBlend(state, attachment));