From 53b93f8cd55c7fe84a3e24879bee74ee621e8ecb Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sun, 22 Sep 2013 13:54:47 +0000 Subject: [PATCH 1/3] Allow GLES3 hardware to support FSAA. Need a GUI option for this on Android devices. --- Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.cpp | 4 +--- Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp | 4 ++-- Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h | 1 + 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.cpp b/Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.cpp index f3b8578b23..9eac9f603b 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.cpp @@ -99,7 +99,6 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms GL_REPORT_FBO_ERROR(); } -#ifndef USE_GLES3 else { // EFB targets will be renderbuffers in MSAA mode (required by OpenGL). @@ -150,7 +149,7 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms glBindTexture(getFbType(), m_resolvedDepthTexture); glTexParameteri(getFbType(), GL_TEXTURE_MAX_LEVEL, 0); - glTexImage2D(getFbType(), 0, GL_DEPTH_COMPONENT24, m_targetWidth, m_targetHeight, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL); + glTexImage2D(getFbType(), 0, GL_DEPTH_COMPONENT24, m_targetWidth, m_targetHeight, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL); // Bind resolved textures to resolved framebuffer. @@ -165,7 +164,6 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms glBindFramebuffer(GL_FRAMEBUFFER, m_efbFramebuffer); } -#endif // Create XFB framebuffer; targets will be created elsewhere. glGenFramebuffers(1, &m_xfbFramebuffer); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp index d7a891ecd1..d5299e4c3e 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp @@ -141,7 +141,6 @@ void OpenGL_ReportARBProgramError() bool OpenGL_ReportFBOError(const char *function, const char *file, int line) { -#ifndef USE_GLES unsigned int fbo_status = glCheckFramebufferStatus(GL_FRAMEBUFFER); if (fbo_status != GL_FRAMEBUFFER_COMPLETE) { @@ -154,12 +153,14 @@ bool OpenGL_ReportFBOError(const char *function, const char *file, int line) case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: error = "INCOMPLETE_MISSING_ATTACHMENT"; break; +#ifndef USE_GLES case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER: error = "INCOMPLETE_DRAW_BUFFER"; break; case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER: error = "INCOMPLETE_READ_BUFFER"; break; +#endif case GL_FRAMEBUFFER_UNSUPPORTED: error = "UNSUPPORTED"; break; @@ -168,7 +169,6 @@ bool OpenGL_ReportFBOError(const char *function, const char *file, int line) file, line, function, error); return false; } -#endif return true; } diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h index c94776ef7f..54a2ac5735 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h @@ -32,6 +32,7 @@ #define GL_BGRA GL_RGBA #define glDrawElementsBaseVertex(...) #define glDrawRangeElementsBaseVertex(...) +#define glRenderbufferStorageMultisampleCoverageNV(...) #endif #else #define TEX2D GL_TEXTURE_RECTANGLE_ARB From 91619e28b85d513d0676accf3c785e10c31cb1b8 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sun, 22 Sep 2013 09:10:47 -0500 Subject: [PATCH 2/3] Pull in the glRenderbufferStorageMultisample function pointer at run time. --- Externals/GLES3/GLES3/gl3.h | 2 +- Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.cpp | 1 + Source/Plugins/Plugin_VideoOGL/Src/GLFunctions.cpp | 4 ++++ Source/Plugins/Plugin_VideoOGL/Src/GLFunctions.h | 7 ++++++- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Externals/GLES3/GLES3/gl3.h b/Externals/GLES3/GLES3/gl3.h index e5bf8f5bfc..01cbeaacf7 100644 --- a/Externals/GLES3/GLES3/gl3.h +++ b/Externals/GLES3/GLES3/gl3.h @@ -965,7 +965,7 @@ GL_APICALL void GL_APIENTRY glUniformMatrix2x4fv (GLint location, GLsi GL_APICALL void GL_APIENTRY glUniformMatrix4x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); GL_APICALL void GL_APIENTRY glUniformMatrix3x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); GL_APICALL void GL_APIENTRY glUniformMatrix4x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); -GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +//GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); GL_APICALL void GL_APIENTRY glFramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); GL_APICALL void GL_APIENTRY glFlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length); GL_APICALL GLboolean GL_APIENTRY glIsVertexArray (GLuint array); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.cpp b/Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.cpp index 9eac9f603b..a9ea7fbb4e 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.cpp @@ -6,6 +6,7 @@ #include "FramebufferManager.h" #include "VertexShaderGen.h" #include "OnScreenDisplay.h" +#include "GLFunctions.h" #include "TextureConverter.h" #include "Render.h" diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLFunctions.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GLFunctions.cpp index 8360f9631e..073e5cc513 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GLFunctions.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/GLFunctions.cpp @@ -32,6 +32,8 @@ PFNGLPROGRAMPARAMETERIPROC glProgramParameteri; PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements; +PFNGLRENDERBUFFERSTORAGEMULTISAMPLE glRenderbufferStorageMultisample; + PFNGLGETUNIFORMBLOCKINDEXPROC glGetUniformBlockIndex; PFNGLUNIFORMBLOCKBINDINGPROC glUniformBlockBinding; @@ -98,6 +100,8 @@ namespace GLFunc LoadFunction("glDrawRangeElements", (void**)&glDrawRangeElements); + LoadFunction("glRenderbufferStorageMultisample", (void**)&glRenderbufferStorageMultisample); + LoadFunction("glGetUniformBlockIndex", (void**)&glGetUniformBlockIndex); LoadFunction("glUniformBlockBinding", (void**)&glUniformBlockBinding); dlclose(self); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLFunctions.h b/Source/Plugins/Plugin_VideoOGL/Src/GLFunctions.h index 74fed7e227..cbfde1276c 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GLFunctions.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/GLFunctions.h @@ -30,7 +30,7 @@ typedef void (*PFNGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler); typedef void (*PFNGLDELETESAMPLERSPROC) (GLsizei count, const GLuint * samplers); typedef void (*PFNGLGENSAMPLERSPROC) (GLsizei count, GLuint* samplers); -//Program binar +//Program binary typedef void (*PFNGLGETPROGRAMBINARYPROC) (GLuint program, GLsizei bufSize, GLsizei* length, GLenum *binaryFormat, GLvoid*binary); typedef void (*PFNGLPROGRAMBINARYPROC) (GLuint program, GLenum binaryFormat, const void* binary, GLsizei length); typedef void (*PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value); @@ -48,6 +48,9 @@ typedef void (*PFNGLGENQUERIESPROC) (GLsizei n, GLuint* ids); // glDraw* typedef void (*PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices); +// Multisample buffer +typedef void (*PFNGLRENDERBUFFERSTORAGEMULTISAMPLE) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); + // ptrs extern PFNGLBEGINQUERYPROC glBeginQuery; extern PFNGLENDQUERYPROC glEndQuery; @@ -75,6 +78,8 @@ extern PFNGLPROGRAMPARAMETERIPROC glProgramParameteri; extern PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements; +extern PFNGLRENDERBUFFERSTORAGEMULTISAMPLE glRenderbufferStorageMultisample; + //Sampler extern PFNGLSAMPLERPARAMETERFPROC glSamplerParameterf; extern PFNGLSAMPLERPARAMETERIPROC glSamplerParameteri; From 81effb80993c3f64e368f4e9fdd551e60ce2f8c0 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sun, 22 Sep 2013 09:25:38 -0500 Subject: [PATCH 3/3] [Android] Add in FSAA option. --- Source/Android/res/values/arrays.xml | 14 +++++++++++++- Source/Android/res/values/strings.xml | 2 ++ Source/Android/res/xml/video_prefs.xml | 7 +++++++ .../dolphinemu/settings/UserPreferences.java | 5 +++++ 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/Source/Android/res/values/arrays.xml b/Source/Android/res/values/arrays.xml index 2144440a33..8e75554384 100644 --- a/Source/Android/res/values/arrays.xml +++ b/Source/Android/res/values/arrays.xml @@ -108,7 +108,19 @@ 6 7 - + + + + 1x + 2x + 4x + + + 0 + 1 + 2 + + 1x diff --git a/Source/Android/res/values/strings.xml b/Source/Android/res/values/strings.xml index 5c8a1269af..8c99835d1f 100644 --- a/Source/Android/res/values/strings.xml +++ b/Source/Android/res/values/strings.xml @@ -86,6 +86,8 @@ Enhancements Internal Resolution Specifies the resolution used to render at. A high resolution will improve visual quality a lot but is also quite heavy on performance and might cause glitches in certain games. + Fullscreen antialiasing + Reduces the amount of aliasing caused by rasterizing 3D graphics. This makes the rendered picture look less blocky. Heavily decreases emulation speed and sometimes causes issues. Anisotropic Filtering Enhances visual quality of textures that are at oblique viewing angles. Might cause issues in a small number of games. Scaled EFB Copy diff --git a/Source/Android/res/xml/video_prefs.xml b/Source/Android/res/xml/video_prefs.xml index 311c6ce8a9..72a50c4f3a 100644 --- a/Source/Android/res/xml/video_prefs.xml +++ b/Source/Android/res/xml/video_prefs.xml @@ -14,6 +14,13 @@ android:summary="@string/internal_resolution_descrip" android:title="@string/internal_resolution"/> + +