implement 4xSSAA for OGL
I don't think it's needed, but its requested often
This commit is contained in:
parent
3d5e0a6d3d
commit
d4fadf4b6f
|
@ -37,17 +37,6 @@
|
|||
#define CONF_SAVETARGETS 8
|
||||
#define CONF_SAVESHADERS 16
|
||||
|
||||
enum MultisampleMode {
|
||||
MULTISAMPLE_OFF,
|
||||
MULTISAMPLE_2X,
|
||||
MULTISAMPLE_4X,
|
||||
MULTISAMPLE_8X,
|
||||
MULTISAMPLE_CSAA_8X,
|
||||
MULTISAMPLE_CSAA_8XQ,
|
||||
MULTISAMPLE_CSAA_16X,
|
||||
MULTISAMPLE_CSAA_16XQ,
|
||||
};
|
||||
|
||||
enum AspectMode {
|
||||
ASPECT_AUTO = 0,
|
||||
ASPECT_FORCE_16_9 = 1,
|
||||
|
|
|
@ -104,6 +104,20 @@ int OSDInternalW, OSDInternalH;
|
|||
|
||||
namespace OGL
|
||||
{
|
||||
|
||||
enum MultisampleMode {
|
||||
MULTISAMPLE_OFF,
|
||||
MULTISAMPLE_2X,
|
||||
MULTISAMPLE_4X,
|
||||
MULTISAMPLE_8X,
|
||||
MULTISAMPLE_CSAA_8X,
|
||||
MULTISAMPLE_CSAA_8XQ,
|
||||
MULTISAMPLE_CSAA_16X,
|
||||
MULTISAMPLE_CSAA_16XQ,
|
||||
MULTISAMPLE_SSAA_4X,
|
||||
};
|
||||
|
||||
|
||||
VideoConfig g_ogl_config;
|
||||
|
||||
// Declarations and definitions
|
||||
|
@ -149,6 +163,7 @@ int GetNumMSAASamples(int MSAAMode)
|
|||
case MULTISAMPLE_4X:
|
||||
case MULTISAMPLE_CSAA_8X:
|
||||
case MULTISAMPLE_CSAA_16X:
|
||||
case MULTISAMPLE_SSAA_4X:
|
||||
samples = 4;
|
||||
break;
|
||||
|
||||
|
@ -192,6 +207,19 @@ int GetNumMSAACoverageSamples(int MSAAMode)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void ApplySSAASettings() {
|
||||
if(g_ActiveConfig.iMultisampleMode == MULTISAMPLE_SSAA_4X) {
|
||||
if(g_ogl_config.bSupportSampleShading) {
|
||||
glEnable(GL_SAMPLE_SHADING_ARB);
|
||||
glMinSampleShadingARB(s_MSAASamples);
|
||||
} else {
|
||||
ERROR_LOG(VIDEO, "MSAA Bug: SSAA selected, but not supported by gpu.");
|
||||
}
|
||||
} else if(g_ogl_config.bSupportSampleShading) {
|
||||
glDisable(GL_SAMPLE_SHADING_ARB);
|
||||
}
|
||||
}
|
||||
|
||||
// Init functions
|
||||
Renderer::Renderer()
|
||||
{
|
||||
|
@ -271,6 +299,7 @@ Renderer::Renderer()
|
|||
g_ogl_config.bSupportsGLSync = GLEW_ARB_sync;
|
||||
g_ogl_config.bSupportsGLBaseVertex = GLEW_ARB_draw_elements_base_vertex;
|
||||
g_ogl_config.bSupportCoverageMSAA = GLEW_NV_framebuffer_multisample_coverage;
|
||||
g_ogl_config.bSupportSampleShading = GLEW_ARB_sample_shading;
|
||||
|
||||
g_ogl_config.gl_vendor = (const char*)glGetString(GL_VENDOR);
|
||||
g_ogl_config.gl_renderer = (const char*)glGetString(GL_RENDERER);
|
||||
|
@ -299,19 +328,21 @@ Renderer::Renderer()
|
|||
g_ogl_config.gl_renderer,
|
||||
g_ogl_config.gl_version).c_str(), 5000);
|
||||
|
||||
OSD::AddMessage(StringFromFormat("Missing Extensions: %s%s%s%s%s%s%s",
|
||||
OSD::AddMessage(StringFromFormat("Missing Extensions: %s%s%s%s%s%s%s%s",
|
||||
g_ActiveConfig.backend_info.bSupportsDualSourceBlend ? "" : "DualSourceBlend ",
|
||||
g_ActiveConfig.backend_info.bSupportsGLSLUBO ? "" : "UniformBuffer ",
|
||||
g_ogl_config.bSupportsGLPinnedMemory ? "" : "PinnedMemory ",
|
||||
g_ogl_config.bSupportsGLSLCache ? "" : "ShaderCache ",
|
||||
g_ogl_config.bSupportsGLBaseVertex ? "" : "BaseVertex ",
|
||||
g_ogl_config.bSupportsGLSync ? "" : "Sync ",
|
||||
g_ogl_config.bSupportCoverageMSAA ? "" : "CSAA "
|
||||
g_ogl_config.bSupportCoverageMSAA ? "" : "CSAA ",
|
||||
g_ogl_config.bSupportSampleShading ? "" : "SSAA "
|
||||
).c_str(), 5000);
|
||||
|
||||
s_LastMultisampleMode = g_ActiveConfig.iMultisampleMode;
|
||||
s_MSAASamples = GetNumMSAASamples(s_LastMultisampleMode);
|
||||
s_MSAACoverageSamples = GetNumMSAACoverageSamples(s_LastMultisampleMode);
|
||||
ApplySSAASettings();
|
||||
|
||||
// Decide frambuffer size
|
||||
s_backbuffer_width = (int)GLInterface->GetBackBufferWidth();
|
||||
|
@ -1270,6 +1301,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
|
|||
s_LastMultisampleMode = g_ActiveConfig.iMultisampleMode;
|
||||
s_MSAASamples = GetNumMSAASamples(s_LastMultisampleMode);
|
||||
s_MSAACoverageSamples = GetNumMSAACoverageSamples(s_LastMultisampleMode);
|
||||
ApplySSAASettings();
|
||||
|
||||
delete g_framebuffer_manager;
|
||||
g_framebuffer_manager = new FramebufferManager(s_target_width, s_target_height,
|
||||
|
|
|
@ -16,6 +16,7 @@ extern struct VideoConfig {
|
|||
bool bSupportsGLSync;
|
||||
bool bSupportsGLBaseVertex;
|
||||
bool bSupportCoverageMSAA;
|
||||
bool bSupportSampleShading;
|
||||
|
||||
const char *gl_vendor;
|
||||
const char *gl_renderer;
|
||||
|
|
|
@ -141,7 +141,7 @@ void InitBackendInfo()
|
|||
g_Config.backend_info.bSupportsPixelLighting = true;
|
||||
|
||||
// aamodes
|
||||
const char* caamodes[] = {"None", "2x", "4x", "8x", "8x CSAA", "8xQ CSAA", "16x CSAA", "16xQ CSAA"};
|
||||
const char* caamodes[] = {"None", "2x", "4x", "8x", "8x CSAA", "8xQ CSAA", "16x CSAA", "16xQ CSAA", "4x SSAA"};
|
||||
g_Config.backend_info.AAModes.assign(caamodes, caamodes + sizeof(caamodes)/sizeof(*caamodes));
|
||||
|
||||
// pp shaders
|
||||
|
|
Loading…
Reference in New Issue