From 33bdc0f985d4c46c88d19677330554d1edc09b86 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Mon, 5 May 2014 13:44:08 -0500 Subject: [PATCH] Adds support for the PP shaders in the Android UI. Copies over the PP shaders to the APK's assets and installs them on run. Exposes them via the video settings UI. This is in anticipation of dropping the workaround for rotated blits on Adreno and instead forcing shader usage by the user. --- Source/Android/res/values/strings.xml | 2 ++ Source/Android/res/xml/video_prefs.xml | 5 +++ .../dolphinemu/DolphinEmulator.java | 16 +++++++++ .../dolphinemu/settings/UserPreferences.java | 5 +++ .../settings/video/VideoSettingsFragment.java | 36 ++++++++++++++++++- Source/Core/DolphinWX/CMakeLists.txt | 3 ++ Source/Core/DolphinWX/MainAndroid.cpp | 1 + 7 files changed, 67 insertions(+), 1 deletion(-) diff --git a/Source/Android/res/values/strings.xml b/Source/Android/res/values/strings.xml index 62c56f06c2..5f7318dbaa 100644 --- a/Source/Android/res/values/strings.xml +++ b/Source/Android/res/values/strings.xml @@ -157,6 +157,8 @@ 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. + Post Processing Shader + Apply a post-processing effect after finishing a frame. Scaled EFB Copy Greatly increases quality of textures generated using render to texture effects. Raising the internal resolution will improve the effect of this setting. Slightly decreases performance and possibly causes issues (although unlikely). Per-Pixel Lighting diff --git a/Source/Android/res/xml/video_prefs.xml b/Source/Android/res/xml/video_prefs.xml index e2807956be..b52dc7dcf6 100644 --- a/Source/Android/res/xml/video_prefs.xml +++ b/Source/Android/res/xml/video_prefs.xml @@ -28,6 +28,11 @@ android:summary="@string/anisotropic_filtering_descrip" android:title="@string/anisotropic_filtering"/> + + shader_names = new ArrayList(); + List shader_values = new ArrayList(); + + // Disabled option + shader_names.add("Disabled"); + shader_values.add(""); + + for (File file : shaders) + { + if (file.isFile()) + { + String filename = file.getName(); + if (filename.contains(".glsl")) + { + // Strip the extension and put it in to the list + shader_names.add(filename.substring(0, filename.lastIndexOf('.'))); + shader_values.add(filename.substring(0, filename.lastIndexOf('.'))); + } + } + } + + final ListPreference shader_preference = (ListPreference) findPreference("postProcessingShader"); + shader_preference.setEntries(shader_names.toArray(new CharSequence[shader_names.size()])); + shader_preference.setEntryValues(shader_values.toArray(new CharSequence[shader_values.size()])); + // // Disable all options if Software Rendering is used. // diff --git a/Source/Core/DolphinWX/CMakeLists.txt b/Source/Core/DolphinWX/CMakeLists.txt index a47862da18..085efcb3de 100644 --- a/Source/Core/DolphinWX/CMakeLists.txt +++ b/Source/Core/DolphinWX/CMakeLists.txt @@ -205,6 +205,9 @@ if(ANDROID) add_custom_command(TARGET ${DOLPHIN_EXE} POST_BUILD COMMAND cp ARGS ${CMAKE_SOURCE_DIR}/Data/Sys/GC/* ${CMAKE_SOURCE_DIR}/Source/Android/assets/ ) + add_custom_command(TARGET ${DOLPHIN_EXE} POST_BUILD + COMMAND cp ARGS -r ${CMAKE_SOURCE_DIR}/Data/Sys/Shaders ${CMAKE_SOURCE_DIR}/Source/Android/assets/ + ) else() add_executable(${DOLPHIN_EXE} ${SRCS}) target_link_libraries(${DOLPHIN_EXE} ${LIBS} ${WXLIBS}) diff --git a/Source/Core/DolphinWX/MainAndroid.cpp b/Source/Core/DolphinWX/MainAndroid.cpp index d103589ea5..15c3027357 100644 --- a/Source/Core/DolphinWX/MainAndroid.cpp +++ b/Source/Core/DolphinWX/MainAndroid.cpp @@ -357,6 +357,7 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_CreateUserFo File::CreateFullPath(File::GetUserPath(D_SCREENSHOTS_IDX)); File::CreateFullPath(File::GetUserPath(D_STATESAVES_IDX)); File::CreateFullPath(File::GetUserPath(D_MAILLOGS_IDX)); + File::CreateFullPath(File::GetUserPath(D_SHADERS_IDX)); File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX) + USA_DIR DIR_SEP); File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX) + EUR_DIR DIR_SEP); File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX) + JAP_DIR DIR_SEP);