Permalink
Browse files

SoftGPU: Apply pixel mask for clears.

Turns out it's respected even in clear mode.

Also, confirm logic op and blending interact.
  • Loading branch information...
unknownbrackets committed Aug 25, 2018
1 parent 28be6cc commit 44b90f638de21e39f6f4622dec88016bddc4e06b
Showing with 5 additions and 3 deletions.
  1. +5 −3 GPU/Software/Rasterizer.cpp
@@ -972,17 +972,16 @@ inline void DrawSinglePixel(const DrawingCoords &p, u16 z, u8 fog, const Vec4<in
#endif
}
// TODO: Is alpha blending still performed if logic ops are enabled?
// Logic ops are applied after blending (if blending is enabled.)
if (gstate.isLogicOpEnabled() && !clearMode) {
// Logic ops don't affect stencil.
new_color = (stencil << 24) | (ApplyLogicOp(gstate.getLogicOp(), old_color, new_color) & 0x00FFFFFF);
}
if (clearMode) {
new_color = (new_color & ~gstate.getClearModeColorMask()) | (old_color & gstate.getClearModeColorMask());
} else {
new_color = (new_color & ~gstate.getColorMask()) | (old_color & gstate.getColorMask());
}
new_color = (new_color & ~gstate.getColorMask()) | (old_color & gstate.getColorMask());
// TODO: Dither before or inside SetPixelColor
SetPixelColor(p.x, p.y, new_color);
@@ -1554,6 +1553,9 @@ void ClearRectangle(const VertexData &v0, const VertexData &v1)
break;
}
// The pixel write masks are respected in clear mode.
keepOldMask &= ~gstate.getColorMask();
if (keepOldMask == 0) {
ScreenCoords pprime(minX, minY, 0);
const int stride = gstate.FrameBufStride();

0 comments on commit 44b90f6

Please sign in to comment.