mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-18 19:45:47 -04:00
GPU: Implement dithering on OpenGL backend
This commit is contained in:
@ -181,10 +181,22 @@ protected:
|
||||
BitField<u32, bool, 28, 1> shading_enable; // 0 - flat, 1 = gouroud
|
||||
BitField<u32, Primitive, 29, 21> primitive;
|
||||
|
||||
// Helper functions.
|
||||
bool IsTextureEnabled() const { return (primitive != Primitive::Line && texture_enable); }
|
||||
bool IsTextureBlendingEnabled() const { return (IsTextureEnabled() && !raw_texture_enable); }
|
||||
bool IsTransparencyEnabled() const { return transparency_enable; }
|
||||
// Returns true if dithering should be enabled. Depends on the primitive type.
|
||||
bool IsDitheringEnabled() const
|
||||
{
|
||||
switch (primitive)
|
||||
{
|
||||
case Primitive::Polygon:
|
||||
return shading_enable || !raw_texture_enable;
|
||||
|
||||
case Primitive::Line:
|
||||
return true;
|
||||
|
||||
case Primitive::Rectangle:
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// TODO: Use BitField to do sign extending instead
|
||||
@ -241,6 +253,12 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
// 4x4 dither matrix.
|
||||
static constexpr s32 DITHER_MATRIX[4][4] = {{-4, +0, -3, +1}, // row 0
|
||||
{+2, -2, +3, -1}, // row 1
|
||||
{-3, +1, -4, +0}, // row 2
|
||||
{+4, -1, +2, -2}}; // row 3
|
||||
|
||||
void SoftReset();
|
||||
|
||||
// Sets dots per scanline
|
||||
|
Reference in New Issue
Block a user