There is one small issue with this. It uses viewport extents clamped
to [0, 16384], but it should use unclamped signed coordinates of the
viewport. The hw clipper doesn't do any clamping, so it's easy to
generate window coordinates outside of [-32768, 32768] if the viewport
covers [-32768, 1] in
With the previous changes to handling of viewport clipping, it is
almost trivial to add proper support for guard band clipping. Select a
suitable integer clipping value to keep inside the rasterizer's guard
band range of [-32768, 32767] and program the hardware to use guard
band clipping.
Guard