Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'GLES3-FSAA'
  • Loading branch information
Sonicadvance1 committed Sep 22, 2013
2 parents 75129dc + 81effb8 commit 6340ad6
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Externals/GLES3/GLES3/gl3.h
Expand Up @@ -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);
Expand Down
14 changes: 13 additions & 1 deletion Source/Android/res/values/arrays.xml
Expand Up @@ -108,7 +108,19 @@
<item>6</item>
<item>7</item>
</string-array>


<!-- FSAA Preference -->
<string-array name="FSAAEntries" translatable="false">
<item>1x</item>
<item>2x</item>
<item>4x</item>
</string-array>
<string-array name="FSAAValues" translatable="false">
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>

<!-- Anisotropic Filtering Preference -->
<string-array name="anisotropicFilteringEntries" translatable="false">
<item>1x</item>
Expand Down
2 changes: 2 additions & 0 deletions Source/Android/res/values/strings.xml
Expand Up @@ -86,6 +86,8 @@
<string name="enhancements">Enhancements</string>
<string name="internal_resolution">Internal Resolution</string>
<string name="internal_resolution_descrip">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.</string>
<string name="FSAA">Fullscreen antialiasing</string>
<string name="FSAA_descrip">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.</string>
<string name="anisotropic_filtering">Anisotropic Filtering</string>
<string name="anisotropic_filtering_descrip">Enhances visual quality of textures that are at oblique viewing angles. Might cause issues in a small number of games.</string>
<string name="scaled_efb_copy">Scaled EFB Copy</string>
Expand Down
7 changes: 7 additions & 0 deletions Source/Android/res/xml/video_prefs.xml
Expand Up @@ -14,6 +14,13 @@
android:summary="@string/internal_resolution_descrip"
android:title="@string/internal_resolution"/>

<ListPreference
android:entries="@array/FSAAEntries"
android:entryValues="@array/FSAAValues"
android:key="FSAA"
android:summary="@string/FSAA_descrip"
android:title="@string/FSAA"/>

<ListPreference
android:entries="@array/anisotropicFilteringEntries"
android:entryValues="@array/anisotropicFilteringValues"
Expand Down
Expand Up @@ -43,6 +43,7 @@ public static void LoadDolphinConfigToPrefs(Context ctx)
editor.putBoolean("drawOnscreenControls", getConfig("Dolphin.ini", "Android", "ScreenControls", "True").equals("True"));

editor.putString("internalResolution", getConfig("gfx_opengl.ini", "Settings", "EFBScale", "2") );
editor.putString("FSAA", getConfig("gfx_opengl.ini", "Settings", "MSAA", "0"));
editor.putString("anisotropicFiltering", getConfig("gfx_opengl.ini", "Enhancements", "MaxAnisotropy", "0"));
editor.putBoolean("scaledEFBCopy", getConfig("gfx_opengl.ini", "Hacks", "EFBScaleCopy", "True").equals("True"));
editor.putBoolean("perPixelLighting", getConfig("gfx_opengl.ini", "Settings", "EnablePixelLighting", "False").equals("True"));
Expand Down Expand Up @@ -158,6 +159,9 @@ public static void SaveConfigToDolphinIni(Context ctx)
// Internal resolution. Falls back to 1x Native upon error.
String internalResolution = prefs.getString("internalResolution", "2");

// FSAA Level. Falls back to 1x upon error.
String FSAALevel = prefs.getString("FSAA", "0");

// Anisotropic Filtering Level. Falls back to 1x upon error.
String anisotropicFiltLevel = prefs.getString("anisotropicFiltering", "0");

Expand Down Expand Up @@ -236,6 +240,7 @@ else if (externalFrameBuffer.equals("Real"))

//-- Enhancement Settings --//
NativeLibrary.SetConfig("gfx_opengl.ini", "Settings", "EFBScale", internalResolution);
NativeLibrary.SetConfig("gfx_opengl.ini", "Settings", "MSAA", FSAALevel);
NativeLibrary.SetConfig("gfx_opengl.ini", "Enhancements", "MaxAnisotropy", anisotropicFiltLevel);
NativeLibrary.SetConfig("gfx_opengl.ini", "Hacks", "EFBScaledCopy", usingScaledEFBCopy ? "True" : "False");
NativeLibrary.SetConfig("gfx_opengl.ini", "Settings", "EnablePixelLighting", usingPerPixelLighting ? "True" : "False");
Expand Down
5 changes: 2 additions & 3 deletions Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.cpp
Expand Up @@ -6,6 +6,7 @@
#include "FramebufferManager.h"
#include "VertexShaderGen.h"
#include "OnScreenDisplay.h"
#include "GLFunctions.h"

#include "TextureConverter.h"
#include "Render.h"
Expand Down Expand Up @@ -99,7 +100,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).
Expand Down Expand Up @@ -150,7 +150,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.

Expand All @@ -165,7 +165,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);
Expand Down
4 changes: 4 additions & 0 deletions Source/Plugins/Plugin_VideoOGL/Src/GLFunctions.cpp
Expand Up @@ -32,6 +32,8 @@ PFNGLPROGRAMPARAMETERIPROC glProgramParameteri;

PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements;

PFNGLRENDERBUFFERSTORAGEMULTISAMPLE glRenderbufferStorageMultisample;

PFNGLGETUNIFORMBLOCKINDEXPROC glGetUniformBlockIndex;
PFNGLUNIFORMBLOCKBINDINGPROC glUniformBlockBinding;

Expand Down Expand Up @@ -98,6 +100,8 @@ namespace GLFunc

LoadFunction("glDrawRangeElements", (void**)&glDrawRangeElements);

LoadFunction("glRenderbufferStorageMultisample", (void**)&glRenderbufferStorageMultisample);

LoadFunction("glGetUniformBlockIndex", (void**)&glGetUniformBlockIndex);
LoadFunction("glUniformBlockBinding", (void**)&glUniformBlockBinding);
dlclose(self);
Expand Down
7 changes: 6 additions & 1 deletion Source/Plugins/Plugin_VideoOGL/Src/GLFunctions.h
Expand Up @@ -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);
Expand All @@ -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;
Expand Down Expand Up @@ -75,6 +78,8 @@ extern PFNGLPROGRAMPARAMETERIPROC glProgramParameteri;

extern PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements;

extern PFNGLRENDERBUFFERSTORAGEMULTISAMPLE glRenderbufferStorageMultisample;

//Sampler
extern PFNGLSAMPLERPARAMETERFPROC glSamplerParameterf;
extern PFNGLSAMPLERPARAMETERIPROC glSamplerParameteri;
Expand Down
4 changes: 2 additions & 2 deletions Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp
Expand Up @@ -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)
{
Expand All @@ -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;
Expand All @@ -168,7 +169,6 @@ bool OpenGL_ReportFBOError(const char *function, const char *file, int line)
file, line, function, error);
return false;
}
#endif
return true;
}

1 change: 1 addition & 0 deletions Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h
Expand Up @@ -32,6 +32,7 @@
#define GL_BGRA GL_RGBA
#define glDrawElementsBaseVertex(...)
#define glDrawRangeElementsBaseVertex(...)
#define glRenderbufferStorageMultisampleCoverageNV(...)
#endif
#else
#define TEX2D GL_TEXTURE_RECTANGLE_ARB
Expand Down

0 comments on commit 6340ad6

Please sign in to comment.