Skip to content

Commit

Permalink
Merge pull request #1802 from eliasdaler/interpolation_fixes
Browse files Browse the repository at this point in the history
Fix interpolation issues on HW
  • Loading branch information
nicolasnoble authored Nov 18, 2024
2 parents ef2aef9 + 3c3fda5 commit 3c9b655
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 24 deletions.
8 changes: 4 additions & 4 deletions src/mips/psyqo/primitives/lines.hh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ struct Line {
Line(Color c) : command(0x40000000 | c.packed) {}
Line& setColor(Color c) {
uint32_t wasSemiTrans = command & 0x02000000;
command = 0x40000000 | c.packed | wasSemiTrans;
command = 0x40000000 | (c.packed & 0xffffff) | wasSemiTrans;
return *this;
}
Line& setOpaque() {
Expand Down Expand Up @@ -81,7 +81,7 @@ struct GouraudLine {
GouraudLine(Color c) : command(0x50000000 | c.packed) {}
GouraudLine& setColorA(Color c) {
uint32_t wasSemiTrans = command & 0x02000000;
command = 0x50000000 | c.packed | wasSemiTrans;
command = 0x50000000 | (c.packed & 0xffffff) | wasSemiTrans;
return *this;
}
GouraudLine& setColorB(Color c) {
Expand Down Expand Up @@ -125,7 +125,7 @@ struct PolyLineBegin {
PolyLineBegin(Color c) : command(0x48000000 | c.packed) {}
PolyLineBegin& setColor(Color c) {
uint32_t wasSemiTrans = command & 0x02000000;
command = 0x48000000 | c.packed | wasSemiTrans;
command = 0x48000000 | (c.packed & 0xffffff) | wasSemiTrans;
return *this;
}
PolyLineBegin& setOpaque() {
Expand Down Expand Up @@ -166,7 +166,7 @@ struct PolyLine {
PolyLine(Color c) : command(0x48000000 | c.packed) {}
PolyLine& setColor(Color c) {
uint32_t wasSemiTrans = command & 0x02000000;
command = 0x48000000 | c.packed | wasSemiTrans;
command = 0x48000000 | (c.packed & 0xffffff) | wasSemiTrans;
return *this;
}
PolyLine& setOpaque() {
Expand Down
16 changes: 8 additions & 8 deletions src/mips/psyqo/primitives/quads.hh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct Quad {
Quad(Color c) : command(0x28000000 | c.packed) {}
Quad& setColor(Color c) {
uint32_t wasSemiTrans = command & 0x02000000;
command = 0x28000000 | c.packed | wasSemiTrans;
command = 0x28000000 | (c.packed & 0xffffff) | wasSemiTrans;
return *this;
}
Quad& setOpaque() {
Expand Down Expand Up @@ -109,7 +109,7 @@ struct TexturedQuad {
TexturedQuad(Color c) : command(0x2c000000 | c.packed) {}
TexturedQuad& setColor(Color c) {
uint32_t wasSemiTrans = command & 0x02000000;
command = 0x2c000000 | c.packed | wasSemiTrans;
command = 0x2c000000 | (c.packed & 0xffffff) | wasSemiTrans;
return *this;
}
TexturedQuad& setOpaque() {
Expand Down Expand Up @@ -151,7 +151,7 @@ struct GouraudQuad {
GouraudQuad(Color c) : command(0x38000000 | c.packed) {}
GouraudQuad& setColorA(Color c) {
uint32_t wasSemiTrans = command & 0x02000000;
command = 0x38000000 | c.packed | wasSemiTrans;
command = 0x38000000 | (c.packed & 0xffffff) | wasSemiTrans;
return *this;
}
GouraudQuad& setColorB(Color c) {
Expand Down Expand Up @@ -205,7 +205,7 @@ struct GouraudQuad {
GTE::read<GTE::Register::RGB2>(&command);
GTE::write<GTE::Register::RGB0, GTE::Unsafe>(&b->packed);
GTE::write<GTE::Register::RGB1, GTE::Unsafe>(&c->packed);
GTE::write<GTE::Register::RGB2, GTE::Unsafe>(&d->packed);
GTE::write<GTE::Register::RGB2, GTE::Safe>(&d->packed);
GTE::Kernels::dpct();
GTE::read<GTE::Register::RGB0>(&colorB.packed);
GTE::read<GTE::Register::RGB1>(&colorC.packed);
Expand All @@ -226,7 +226,7 @@ struct GouraudQuad {
GTE::read<GTE::Register::RGB2>(&command);
GTE::write<GTE::Register::RGB0, GTE::Unsafe>(b.packed);
GTE::write<GTE::Register::RGB1, GTE::Unsafe>(c.packed);
GTE::write<GTE::Register::RGB2, GTE::Unsafe>(d.packed);
GTE::write<GTE::Register::RGB2, GTE::Safe>(d.packed);
GTE::Kernels::dpct();
GTE::read<GTE::Register::RGB0>(&colorB.packed);
GTE::read<GTE::Register::RGB1>(&colorC.packed);
Expand Down Expand Up @@ -267,7 +267,7 @@ struct GouraudTexturedQuad {
GouraudTexturedQuad(Color c) : command(0x3c000000 | c.packed) {}
GouraudTexturedQuad& setColorA(Color c) {
uint32_t wasSemiTrans = command & 0x02000000;
command = 0x3c000000 | c.packed | wasSemiTrans;
command = 0x3c000000 | (c.packed & 0xffffff) | wasSemiTrans;
return *this;
}
GouraudTexturedQuad& setColorB(Color c) {
Expand Down Expand Up @@ -305,7 +305,7 @@ struct GouraudTexturedQuad {
GTE::read<GTE::Register::RGB2>(&command);
GTE::write<GTE::Register::RGB0, GTE::Unsafe>(&b->packed);
GTE::write<GTE::Register::RGB1, GTE::Unsafe>(&c->packed);
GTE::write<GTE::Register::RGB2, GTE::Unsafe>(&d->packed);
GTE::write<GTE::Register::RGB2, GTE::Safe>(&d->packed);
GTE::Kernels::dpct();
GTE::read<GTE::Register::RGB0>(&colorB.packed);
GTE::read<GTE::Register::RGB1>(&colorC.packed);
Expand All @@ -326,7 +326,7 @@ struct GouraudTexturedQuad {
GTE::read<GTE::Register::RGB2>(&command);
GTE::write<GTE::Register::RGB0, GTE::Unsafe>(b.packed);
GTE::write<GTE::Register::RGB1, GTE::Unsafe>(c.packed);
GTE::write<GTE::Register::RGB2, GTE::Unsafe>(d.packed);
GTE::write<GTE::Register::RGB2, GTE::Safe>(d.packed);
GTE::Kernels::dpct();
GTE::read<GTE::Register::RGB0>(&colorB.packed);
GTE::read<GTE::Register::RGB1>(&colorC.packed);
Expand Down
8 changes: 4 additions & 4 deletions src/mips/psyqo/primitives/rectangles.hh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ struct Rectangle {
Rectangle(Color c) : command(BASE | c.packed) {}
Rectangle& setColor(Color c) {
uint32_t wasSemiTrans = command & 0x02000000;
command = BASE | c.packed | wasSemiTrans;
command = BASE | (c.packed & 0xffffff) | wasSemiTrans;
return *this;
}
Rectangle& setOpaque() {
Expand Down Expand Up @@ -84,7 +84,7 @@ struct Pixel {
Pixel(Color c) : command(BASE | c.packed) {}
Pixel& setColor(Color c) {
uint32_t wasSemiTrans = command & 0x02000000;
command = BASE | c.packed | wasSemiTrans;
command = BASE | (c.packed & 0xffffff) | wasSemiTrans;
return *this;
}
Pixel& setOpaque() {
Expand Down Expand Up @@ -118,7 +118,7 @@ struct Rectangle8x8 {
Rectangle8x8(Color c) : command(BASE | c.packed) {}
Rectangle8x8& setColor(Color c) {
uint32_t wasSemiTrans = command & 0x02000000;
command = BASE | c.packed | wasSemiTrans;
command = BASE | (c.packed & 0xffffff) | wasSemiTrans;
return *this;
}
Rectangle8x8& setOpaque() {
Expand Down Expand Up @@ -152,7 +152,7 @@ struct Rectangle16x16 {
Rectangle16x16(Color c) : command(BASE | c.packed) {}
Rectangle16x16& setColor(Color c) {
uint32_t wasSemiTrans = command & 0x02000000;
command = BASE | c.packed | wasSemiTrans;
command = BASE | (c.packed & 0xffffff) | wasSemiTrans;
return *this;
}
Rectangle16x16& setOpaque() {
Expand Down
8 changes: 4 additions & 4 deletions src/mips/psyqo/primitives/sprites.hh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct Sprite {
Sprite(Color c) : command(BASE | c.packed) {}
Sprite& setColor(Color c) {
uint32_t wasSemiTrans = command & 0x02000000;
command = BASE | c.packed | wasSemiTrans;
command = BASE | (c.packed & 0xffffff) | wasSemiTrans;
return *this;
}
Sprite& setOpaque() {
Expand Down Expand Up @@ -87,7 +87,7 @@ struct Sprite1x1 {
Sprite1x1(Color c) : command(BASE | c.packed) {}
Sprite1x1& setColor(Color c) {
uint32_t wasSemiTrans = command & 0x02000000;
command = BASE | c.packed | wasSemiTrans;
command = BASE | (c.packed & 0xffffff) | wasSemiTrans;
return *this;
}
Sprite1x1& setOpaque() {
Expand Down Expand Up @@ -123,7 +123,7 @@ struct Sprite8x8 {
Sprite8x8(Color c) : command(BASE | c.packed) {}
Sprite8x8& setColor(Color c) {
uint32_t wasSemiTrans = command & 0x02000000;
command = BASE | c.packed | wasSemiTrans;
command = BASE | (c.packed & 0xffffff) | wasSemiTrans;
return *this;
}
Sprite8x8& setOpaque() {
Expand Down Expand Up @@ -159,7 +159,7 @@ struct Sprite16x16 {
Sprite16x16(Color c) : command(BASE | c.packed) {}
Sprite16x16& setColor(Color c) {
uint32_t wasSemiTrans = command & 0x02000000;
command = BASE | c.packed | wasSemiTrans;
command = BASE | (c.packed & 0xffffff) | wasSemiTrans;
return *this;
}
Sprite16x16& setOpaque() {
Expand Down
8 changes: 4 additions & 4 deletions src/mips/psyqo/primitives/triangles.hh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ struct Triangle {
Triangle(Color c) : command(0x20000000 | c.packed) {}
Triangle& setColor(Color c) {
uint32_t wasSemiTrans = command & 0x02000000;
command = 0x20000000 | c.packed | wasSemiTrans;
command = 0x20000000 | (c.packed & 0xffffff) | wasSemiTrans;
return *this;
}
Triangle& setOpaque() {
Expand Down Expand Up @@ -98,7 +98,7 @@ struct TexturedTriangle {
TexturedTriangle(Color c) : command(0x24000000 | c.packed) {}
TexturedTriangle& setColor(Color c) {
uint32_t wasSemiTrans = command & 0x02000000;
command = 0x24000000 | c.packed | wasSemiTrans;
command = 0x24000000 | (c.packed & 0xffffff) | wasSemiTrans;
return *this;
}
TexturedTriangle& setOpaque() {
Expand Down Expand Up @@ -138,7 +138,7 @@ struct GouraudTriangle {
GouraudTriangle(Color c) : command(0x30000000 | c.packed) {}
GouraudTriangle& setColorA(Color c) {
uint32_t wasSemiTrans = command & 0x02000000;
command = 0x30000000 | c.packed | wasSemiTrans;
command = 0x30000000 | (c.packed & 0xffffff) | wasSemiTrans;
return *this;
}
GouraudTriangle& setColorB(Color c) {
Expand Down Expand Up @@ -235,7 +235,7 @@ struct GouraudTexturedTriangle {
GouraudTexturedTriangle(Color c) : command(0x34000000 | c.packed) {}
GouraudTexturedTriangle& setColorA(Color c) {
uint32_t wasSemiTrans = command & 0x02000000;
command = 0x34000000 | c.packed | wasSemiTrans;
command = 0x34000000 | (c.packed & 0xffffff) | wasSemiTrans;
return *this;
}
GouraudTexturedTriangle& setColorB(Color c) {
Expand Down

0 comments on commit 3c9b655

Please sign in to comment.