At the moment the vertex attributes are interpolated linearly in screen space which produces an incorrect result. This is especially visible when using interpolated texture coordinates (see image below).
Fixing this issue probably requires the vertex shader to output a 4d vector in homogeneous coordinates. The w component of the vector can then be used by the rasterizer to perform perspective correct interpolation (this is how I believe OpenGL does it).
At the moment the vertex attributes are interpolated linearly in screen space which produces an incorrect result. This is especially visible when using interpolated texture coordinates (see image below).
Fixing this issue probably requires the vertex shader to output a 4d vector in homogeneous coordinates. The w component of the vector can then be used by the rasterizer to perform perspective correct interpolation (this is how I believe OpenGL does it).