mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-25 07:09:48 -06:00
VideoBackends: Reimplement SSAA, now for D3D + OGL
This commit is contained in:
@ -88,7 +88,6 @@ static RasterFont* s_pfont = nullptr;
|
||||
// 1 for no MSAA. Use s_MSAASamples > 1 to check for MSAA.
|
||||
static int s_MSAASamples = 1;
|
||||
static int s_last_multisample_mode = 0;
|
||||
static bool s_last_ssaa_mode = false;
|
||||
static bool s_last_stereo_mode = false;
|
||||
static bool s_last_xfb_mode = false;
|
||||
|
||||
@ -136,27 +135,6 @@ static int GetNumMSAASamples(int MSAAMode)
|
||||
return g_ogl_config.max_samples;
|
||||
}
|
||||
|
||||
static void ApplySSAASettings()
|
||||
{
|
||||
if (g_ActiveConfig.bSSAA)
|
||||
{
|
||||
if (g_ActiveConfig.backend_info.bSupportsSSAA)
|
||||
{
|
||||
glEnable(GL_SAMPLE_SHADING_ARB);
|
||||
glMinSampleShading(1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: move this to InitBackendInfo
|
||||
OSD::AddMessage("SSAA Anti Aliasing isn't supported by your GPU.", 10000);
|
||||
}
|
||||
}
|
||||
else if (g_ActiveConfig.backend_info.bSupportsSSAA)
|
||||
{
|
||||
glDisable(GL_SAMPLE_SHADING_ARB);
|
||||
}
|
||||
}
|
||||
|
||||
static void GLAPIENTRY ErrorCallback( GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const char* message, const void* userParam)
|
||||
{
|
||||
const char *s_source;
|
||||
@ -483,8 +461,6 @@ Renderer::Renderer()
|
||||
g_ogl_config.bSupportsGLBufferStorage = GLExtensions::Supports("GL_ARB_buffer_storage") ||
|
||||
GLExtensions::Supports("GL_EXT_buffer_storage");
|
||||
g_ogl_config.bSupportsMSAA = GLExtensions::Supports("GL_ARB_texture_multisample");
|
||||
g_ActiveConfig.backend_info.bSupportsSSAA = GLExtensions::Supports("GL_ARB_sample_shading") ||
|
||||
GLExtensions::Supports("GL_OES_sample_shading");
|
||||
g_ogl_config.bSupportOGL31 = GLExtensions::Version() >= 310;
|
||||
g_ogl_config.bSupportViewportFloat = GLExtensions::Supports("GL_ARB_viewport_array");
|
||||
g_ogl_config.bSupportsDebug = GLExtensions::Supports("GL_KHR_debug") ||
|
||||
@ -514,6 +490,7 @@ Renderer::Renderer()
|
||||
g_Config.backend_info.bSupportsEarlyZ = true;
|
||||
g_Config.backend_info.bSupportsGeometryShaders = g_ogl_config.bSupportsAEP;
|
||||
g_Config.backend_info.bSupportsGSInstancing = g_Config.backend_info.bSupportsGeometryShaders && g_ogl_config.SupportedESPointSize > 0;
|
||||
g_Config.backend_info.bSupportsSSAA = g_ogl_config.bSupportsAEP;
|
||||
g_ogl_config.bSupportsMSAA = true;
|
||||
g_ogl_config.bSupports2DTextureStorage = true;
|
||||
if (g_ActiveConfig.iStereoMode > 0 && g_ActiveConfig.iMultisampleMode > 1 && !g_ogl_config.bSupports3DTextureStorage)
|
||||
@ -555,16 +532,28 @@ Renderer::Renderer()
|
||||
g_ogl_config.eSupportedGLSLVersion = GLSL_130;
|
||||
g_Config.backend_info.bSupportsEarlyZ = false; // layout keyword is only supported on glsl150+
|
||||
g_Config.backend_info.bSupportsGeometryShaders = false; // geometry shaders are only supported on glsl150+
|
||||
g_Config.backend_info.bSupportsSSAA = false; // sample shading is only supported on glsl400+
|
||||
}
|
||||
else if (strstr(g_ogl_config.glsl_version, "1.40"))
|
||||
{
|
||||
g_ogl_config.eSupportedGLSLVersion = GLSL_140;
|
||||
g_Config.backend_info.bSupportsEarlyZ = false; // layout keyword is only supported on glsl150+
|
||||
g_Config.backend_info.bSupportsGeometryShaders = false; // geometry shaders are only supported on glsl150+
|
||||
g_Config.backend_info.bSupportsSSAA = false; // sample shading is only supported on glsl400+
|
||||
}
|
||||
else if (strstr(g_ogl_config.glsl_version, "1.50"))
|
||||
{
|
||||
g_ogl_config.eSupportedGLSLVersion = GLSL_150;
|
||||
g_Config.backend_info.bSupportsSSAA = false; // sample shading is only supported on glsl400+
|
||||
}
|
||||
else if (strstr(g_ogl_config.glsl_version, "3.30"))
|
||||
{
|
||||
g_ogl_config.eSupportedGLSLVersion = GLSL_330;
|
||||
g_Config.backend_info.bSupportsSSAA = false; // sample shading is only supported on glsl400+
|
||||
}
|
||||
else
|
||||
{
|
||||
g_ogl_config.eSupportedGLSLVersion = GLSL_150;
|
||||
g_ogl_config.eSupportedGLSLVersion = GLSL_400;
|
||||
}
|
||||
|
||||
// Desktop OpenGL can't have the Android Extension Pack
|
||||
@ -638,9 +627,7 @@ Renderer::Renderer()
|
||||
);
|
||||
|
||||
s_last_multisample_mode = g_ActiveConfig.iMultisampleMode;
|
||||
s_last_ssaa_mode = g_ActiveConfig.bSSAA;
|
||||
s_MSAASamples = GetNumMSAASamples(s_last_multisample_mode);
|
||||
ApplySSAASettings();
|
||||
|
||||
s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0;
|
||||
s_last_xfb_mode = g_ActiveConfig.bUseRealXFB;
|
||||
@ -1691,21 +1678,19 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co
|
||||
{
|
||||
TargetSizeChanged = true;
|
||||
}
|
||||
if (TargetSizeChanged || xfbchanged || WindowResized || s_last_ssaa_mode != g_ActiveConfig.bSSAA ||
|
||||
if (TargetSizeChanged || xfbchanged || WindowResized ||
|
||||
(s_last_multisample_mode != g_ActiveConfig.iMultisampleMode) || (s_last_stereo_mode != (g_ActiveConfig.iStereoMode > 0)))
|
||||
{
|
||||
s_last_xfb_mode = g_ActiveConfig.bUseRealXFB;
|
||||
|
||||
UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height);
|
||||
|
||||
if (TargetSizeChanged || s_last_ssaa_mode != g_ActiveConfig.bSSAA ||
|
||||
if (TargetSizeChanged ||
|
||||
s_last_multisample_mode != g_ActiveConfig.iMultisampleMode || s_last_stereo_mode != (g_ActiveConfig.iStereoMode > 0))
|
||||
{
|
||||
s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0;
|
||||
s_last_multisample_mode = g_ActiveConfig.iMultisampleMode;
|
||||
s_last_ssaa_mode = g_ActiveConfig.bSSAA;
|
||||
s_MSAASamples = GetNumMSAASamples(s_last_multisample_mode);
|
||||
ApplySSAASettings();
|
||||
|
||||
delete g_framebuffer_manager;
|
||||
g_framebuffer_manager = new FramebufferManager(s_target_width, s_target_height,
|
||||
|
Reference in New Issue
Block a user