I need to make some changes to source, so I decided I will finally build monogame from source. I made some minor changes to draw string. Now once I used my MonoGame.Framework.dll I’ve encountered unexpected issue that will be better to show with image.
Original:
This seems to affect only some render targets, what is even more confusing is the way how it is affecting them. This are definitely not just swapped color channels, difference is much more drastic. Has anyone encountered something like this?
Edit: at this point I know it is somehow related to Render Target surfaces as well as to my Gauss blur shader.
Edit2: It boils down to this difference:
This is post gauss blur pass, input is same
Edit3: Here is where it falls apart
SCREEN_MANAGER.Device.SetRenderTarget(lightRTa);
batch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null); //
batch.Draw(lightRT, new Rectangle(0, 0, lightRTa.Width, lightRTa.Height), Color.White);
batch.End();
if I use .Opaque then both results are same, on Alpha Blend behavior is vastly different, thing is I need that alpha channel.
Solved altho I am still confused, it seems like clear color after reusing RT is for whatever reason #442288 while prebuild framework dll clears to black.
Post solved edit: I am now 100% sure that reusing render target that discard content results in #442288 while prebuild monogame “clears” to #000000
Final edit: /Facepalm
#if DEBUG
private static readonly Color DiscardColor = new Color(68, 34, 136, 255);
#else
private static readonly Color DiscardColor = new Color(0, 0, 0, 255);
#endif