Skip to content

Commit

Permalink
gpu: sw: Fix translucent pixel rejection
Browse files Browse the repository at this point in the history
  • Loading branch information
fleroviux committed Jan 21, 2024
1 parent d7a0698 commit 850b325
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ namespace dual::nds::gpu {
struct PixelAttributes {
enum Flags : u16 {
Shadow = 1,
Edge = 2
Edge = 2,
Translucent = 8
};

u8 poly_id[2];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,7 @@ namespace dual::nds::gpu {

const bool opaque_pixel = color.A() == 63;

// @todo: Do not reject pixel if the destination pixel is opaque.
if(!opaque_pixel && attributes.poly_id[1] == polygon_id) {
if(!opaque_pixel && (attributes.flags & PixelAttributes::Translucent) && attributes.poly_id[1] == polygon_id) {
continue;
}

Expand All @@ -379,9 +378,11 @@ namespace dual::nds::gpu {
if(!opaque_pixel) {
m_frame_buffer[1][y][x] = AlphaBlend(color, m_frame_buffer[1][y][x]);
m_frame_buffer[0][y][x] = AlphaBlend(color, m_frame_buffer[0][y][x]);
attributes.flags |= PixelAttributes::Translucent;
} else {
m_frame_buffer[1][y][x] = m_frame_buffer[0][y][x];
m_frame_buffer[0][y][x] = color;
attributes.flags &= ~PixelAttributes::Translucent;

if(x1 != x0) {
m_coverage_buffer[y][x] = (cov0 * (x - x0) + cov1 * (x1 - x)) / (x1 - x0);
Expand Down

0 comments on commit 850b325

Please sign in to comment.