Skip to content

Commit

Permalink
VideoCommon: Account for pixel quads in bounding box calculation
Browse files Browse the repository at this point in the history
The GC/Wii GPU rasterizes in 2x2 pixel groups, so bounding box values
will be rounded to the extents of these groups, rather than the exact
pixel. To account for this, we'll round the top/left down to even and
the bottom/right up to odd. I have verified that the values resulting
from this change exactly match a real Wii.
  • Loading branch information
Techjar committed May 22, 2021
1 parent 0f17990 commit d9569e1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Source/Core/VideoCommon/RenderBase.cpp
Expand Up @@ -187,7 +187,16 @@ void Renderer::ReinterpretPixelData(EFBReinterpretType convtype)

u16 Renderer::BBoxRead(int index)
{
return BBoxReadImpl(index);
u16 value = BBoxReadImpl(index);

// The GC/Wii GPU rasterizes in 2x2 pixel groups, so bounding box values will be rounded to the
// extents of these groups, rather than the exact pixel.
if (index == 0 || index == 2)
value &= ~1;
else
value |= 1;

return value;
}

void Renderer::BBoxWrite(int index, u16 value)
Expand Down

0 comments on commit d9569e1

Please sign in to comment.