I'm currently developing a shader which requires me to blur the image first.
However, there have been some weird bugs plagging me for a while.
In DX9, in areas where depth returns 0, the screen blacks out, and outside of those, it flickers a lot. From what I can tell, that means one of the textures is not being rendered properly.
The awkward part though, is that the only fix I've found for this is to reload the shader. No changes to variables or code, nor changing where I look, just reload a few times. Eventually, it starts working again, if not instantly. This happens only once in a while, which makes it even weirder.
In DX11, it never displays this issue. However, I've recently messed with matrices and the vertex shader in hopes of improving performance (which sadly didn't), and that created another weird glitch: one of the textures just spazzes out depending on where I look, and does so intermittently. Reloading the shader does not fix it. So, what fixed it? Changed:
position = float4(xy * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1);
to
position = float4(xy * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1. + 10e-7);
I never use SV_Position for anything, nor change it anywhere else. And this glitch is exclusive to DX11 (not sure if it also happens in DX10).
Any idea what's going on?