Skip to content

Commit

Permalink
gpu: sw: Ensure that vertex depth value stays within 24-bit range
Browse files Browse the repository at this point in the history
  • Loading branch information
fleroviux committed Jan 17, 2024
1 parent d4811b7 commit e48b398
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ namespace dual::nds::gpu {

const i32 x = (i32)(((( (i64)position.X().Raw() + w) * viewport.width + 0x800) / two_w) + viewport.x0);
const i32 y = (i32)((((-(i64)position.Y().Raw() + w) * viewport.height + 0x800) / two_w) + viewport.y0);
const u32 depth = (u32)((((i64)position.Z().Raw() << 14) / w + 0x3FFF) << 9);
const u32 depth = (u32)((((i64)position.Z().Raw() << 14) / w + 0x3FFF) << 9) & 0x00FFFFFFu;

points[i] = Edge::Point{x, y, depth, (i32)w, vertex};

Expand Down

0 comments on commit e48b398

Please sign in to comment.