VideoBackends: Reimplement SSAA, now for D3D + OGL

This commit is contained in:
degasus
2015-09-06 13:58:18 +02:00
parent c08a83a5aa
commit 1c0366993a
12 changed files with 111 additions and 91 deletions

View File

@ -279,6 +279,29 @@ static inline void AssignVSOutputMembers(T& object, const char* a, const char* b
}
}
// We use the flag "centroid" to fix some MSAA rendering bugs. With MSAA, the
// pixel shader will be executed for each pixel which has at least one passed sample.
// So there may be rendered pixels where the center of the pixel isn't in the primitive.
// As the pixel shader usually renders at the center of the pixel, this position may be
// outside the primitive. This will lead to sampling outside the texture, sign changes, ...
// As a workaround, we interpolate at the centroid of the coveraged pixel, which
// is always inside the primitive.
// Without MSAA, this flag is defined to have no effect.
static inline const char* GetInterpolationQualifier(API_TYPE api_type, bool in = true, bool in_out = false)
{
if (!g_ActiveConfig.iMultisampleMode)
return "";
if (!g_ActiveConfig.bSSAA)
{
if (in_out && api_type == API_OPENGL && !g_ActiveConfig.backend_info.bSupportsBindingLayout)
return in ? "centroid in" : "centroid out";
return "centroid";
}
return "sample";
}
// Constant variable names
#define I_COLORS "color"
#define I_KCOLORS "k"