Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vulkan pipeline + color attachments

Tags:

gpu

vulkan

Is it possible to have a pipeline (with appropriate fragment shader) that doesn't write to all color attachments of a pass? e.g. Pass has 2xColor + 1depth attachments. Some fragment programs may write both color01+depth, while some only write color0+depth.

Just setting the colorWriteMask to none for the unused attachment isn't successful. I haven't been able to find a pipeline configuration that will pass the validation layer. it always complains that the extra attachments are not written by the fragment shader.

like image 893
J Bright Avatar asked Sep 02 '25 03:09

J Bright


1 Answers

If this is in a separate subpass then you can simply add the color attachment to the pPreserveAttachments.

The other option is to use blending to trick the fragment shader to discard the fragment shader output and use the existing color. Using ONE for dst and ZERO for src with OP_ADD blending.

like image 101
ratchet freak Avatar answered Sep 05 '25 01:09

ratchet freak