GPU: Clamp coordinates to 11 bits after applying drawing offset

Fixes flickering in some scenes (e.g. Galbadia Missile Base).
This commit is contained in:
Connor McLaughlin
2020-04-04 00:10:45 +10:00
parent 48fba47ee6
commit 5302f83818
3 changed files with 19 additions and 14 deletions

View File

@ -251,10 +251,15 @@ protected:
{
u32 bits;
BitField<u32, s32, 0, 12> x;
BitField<u32, s32, 16, 12> y;
BitField<u32, s32, 0, 11> x;
BitField<u32, s32, 16, 11> y;
};
// Vertices have to be clamped to 11 bits before rendering. Normally this would happen as part of the scanline,
// but in the hardware renderers we'll do it at the vertex. FF8 is a good test case here, once you go too far left
// in the first scene of Galbadia Missile Base, the screen will flicker.
ALWAYS_INLINE static s32 VertexPositionToVRAMCoordinate(s32 x) { return SignExtendN<11, s32>(x); }
union VRAMPixel
{
u16 bits;