Skip to content

Commit

Permalink
Minor sign check optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Dec 20, 2024
1 parent a68f856 commit e104976
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions GPU/Common/DepthRaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,12 @@ void DepthRasterTriangle(uint16_t *depthBuf, int stride, int x1, int y1, int x2,
beta += A1,
gamma += A2)
{
int mask = alpha >= 0 && beta >= 0 && gamma >= 0;
int mask = alpha | beta | gamma;
// Early out if all of this quad's pixels are outside the triangle.
if (!mask) {
if (mask < 0) {
continue;
} else {
mask = 1;
}
// Compute barycentric-interpolated depth. Could also compute it incrementally.
float depth = zz[0] + beta * zz[1] + gamma * zz[2];
Expand Down

0 comments on commit e104976

Please sign in to comment.