Skip the first RenderTarget when writing to MRT with Opaque blending

Posted by cubrman on Game Development See other posts from Game Development or by cubrman
Published on 2013-11-12T09:03:31Z Indexed on 2013/11/12 10:23 UTC
Read the original article Hit count: 310

Filed under:
|
|

I am writing to three rendertargets and whant to know how to tell a GPU not to write to the first RT. When you write a shader you can simply output less data than you have RTs (like output a single float4 when writing to three RTs) and only the first RTs will be affected, but you cannot specify to output this data anywhere else but to COLOR0, then 1, etc. Is there a way to write to several RTs but skip the first target? If I output zeroes, the data in the target will become zeroes, but I need it to remain untuched in the first target and only change in the specified ones.

The reason I need this is to prevent data loss when calling SetRendertarget() with DiscardContents RTs. I write to all the RTs at one point and I need to write to only the specified ones afterwards. It must be the first texture as I have a depth buffer linked to it (XNA 4.0).

Thanks.

© Game Development or respective owner

Related posts about xna-4.0

Related posts about hlsl