Hardware clipping bug?

I have a vertex/pixel shader combination that is implementing basic 2D clipping with user defined clip planes. Specifically the vertex shader is setting up a float4 SV_CLIPDISTANCE output where each element corresponds to the signed distance to each edge of the clipping rect:

output.mClipDist.xy = input.mPosition.xy - cliprect.xy;
output.mClipDist.zw = cliprect.zw - input.mPosition.xy;

Where output.mClipDist represents distances in pixel coordinates and is defined as:

float4	mClipDist	: SV_CLIPDISTANCE;

When clipping against a single plane I haven’t seen any problems. However, when clipping against multiple planes I am seeing artefacts that I can’t explain through anything I’m doing. (The shaders generally work. Other than generating values for mClipDist, I have no control over the clipping. Outputting { 0, 0, 0, 0 } for the clip planes removes the artefacts displayed, so it’s definitely clipping related.)

In the following example, the text is being clipped to the edges of the grey boxes. (Same code and data for both instances - just a different screen position.) In the instance on the right, a few of the characters are being clipped on the left, while the ‘p’ is being clipped on the right. However, in the instance on the left, the ‘p’ is also being clipped to the left clip plane (the edge of the view area in question), and I am seeing a fully black box instead of the expected glyph. (I also see additional artefacts in other glyphs when only a few pixels are visible - in that instance the ‘p’ actually renders correctly - see second image.)



In the Visual Studio Graphics Debugger, the shader debugger for one of those black pixels in the ‘p’ clearly shows it should be returning { 0, 0, 0, 0 }, however { 0, 0, 0, 1 } is being written to the render target:

I’m using DirectX 11 on Windows 10 with the latest GeForce drivers.


Just wanted to add:

This doesn’t happen if I create a WARP device. Everything works as expected.

I’m testing with a GeForce GTX 1650.