mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-05-04 11:14:48 +12:00
add shader-jit option
This commit is contained in:
parent
b214d6d194
commit
8ffd648fd1
9 changed files with 31 additions and 1 deletions
|
@ -16,6 +16,9 @@ JavaVM* jvm = nullptr;
|
|||
|
||||
#define AlberFunction(type, name) JNIEXPORT type JNICALL Java_com_panda3ds_pandroid_AlberDriver_##name
|
||||
|
||||
#define MAKE_SETTING(functionName, type, settingName) \
|
||||
AlberFunction(void, functionName) (JNIEnv* env, jobject obj, type value) { emulator->getConfig().settingName = value; }
|
||||
|
||||
void throwException(JNIEnv* env, const char* message) {
|
||||
jclass exceptionClass = env->FindClass("java/lang/RuntimeException");
|
||||
env->ThrowNew(exceptionClass, message);
|
||||
|
@ -35,6 +38,8 @@ JNIEnv* jniEnv() {
|
|||
|
||||
extern "C" {
|
||||
|
||||
MAKE_SETTING(setShaderJitEnabled, jboolean, shaderJitEnabled)
|
||||
|
||||
AlberFunction(void, Setup)(JNIEnv* env, jobject obj) { env->GetJavaVM(&jvm); }
|
||||
AlberFunction(void, Pause)(JNIEnv* env, jobject obj) { emulator->pause(); }
|
||||
AlberFunction(void, Resume)(JNIEnv* env, jobject obj) { emulator->resume(); }
|
||||
|
|
|
@ -22,5 +22,7 @@ public class AlberDriver {
|
|||
public static native void LoadLuaScript(String script);
|
||||
public static native byte[] GetSmdh();
|
||||
|
||||
public static native void setShaderJitEnabled(boolean enable);
|
||||
|
||||
static { System.loadLibrary("Alber"); }
|
||||
}
|
|
@ -20,6 +20,7 @@ public class DeveloperPreferences extends BasePreferenceFragment {
|
|||
setActivityTitle(R.string.developer_options);
|
||||
|
||||
setItemClick("performanceMonitor", pref -> GlobalConfig.set(GlobalConfig.KEY_SHOW_PERFORMANCE_OVERLAY, ((SwitchPreference) pref).isChecked()));
|
||||
setItemClick("shaderJit", pref -> GlobalConfig.set(GlobalConfig.KEY_SHADER_JIT, ((SwitchPreference) pref).isChecked()));
|
||||
setItemClick("loggerService", pref -> {
|
||||
boolean checked = ((SwitchPreference) pref).isChecked();
|
||||
Context ctx = PandroidApplication.getAppContext();
|
||||
|
@ -43,5 +44,6 @@ public class DeveloperPreferences extends BasePreferenceFragment {
|
|||
private void refresh() {
|
||||
((SwitchPreference) findPreference("performanceMonitor")).setChecked(GlobalConfig.get(GlobalConfig.KEY_SHOW_PERFORMANCE_OVERLAY));
|
||||
((SwitchPreference) findPreference("loggerService")).setChecked(GlobalConfig.get(GlobalConfig.KEY_LOGGER_SERVICE));
|
||||
((SwitchPreference) findPreference("shaderJit")).setChecked(GlobalConfig.get(GlobalConfig.KEY_SHADER_JIT));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ public class GlobalConfig {
|
|||
|
||||
public static DataModel data;
|
||||
|
||||
public static final Key<Boolean> KEY_SHADER_JIT = new Key<>("emu.shader_jit", false);
|
||||
public static final Key<Boolean> KEY_SHOW_PERFORMANCE_OVERLAY = new Key<>("dev.performanceOverlay", false);
|
||||
public static final Key<Boolean> KEY_LOGGER_SERVICE = new Key<>("dev.loggerService", false);
|
||||
public static final Key<Integer> KEY_APP_THEME = new Key<>("app.theme", THEME_ANDROID);
|
||||
|
|
|
@ -7,6 +7,7 @@ import android.graphics.Rect;
|
|||
import android.opengl.GLSurfaceView;
|
||||
import android.util.Log;
|
||||
import com.panda3ds.pandroid.AlberDriver;
|
||||
import com.panda3ds.pandroid.data.config.GlobalConfig;
|
||||
import com.panda3ds.pandroid.utils.Constants;
|
||||
import com.panda3ds.pandroid.utils.GameUtils;
|
||||
import com.panda3ds.pandroid.utils.PerformanceMonitor;
|
||||
|
@ -80,6 +81,7 @@ public class PandaGlRenderer implements GLSurfaceView.Renderer, ConsoleRenderer
|
|||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
|
||||
AlberDriver.Initialize();
|
||||
AlberDriver.setShaderJitEnabled(GlobalConfig.get(GlobalConfig.KEY_SHADER_JIT));
|
||||
AlberDriver.LoadRom(romPath);
|
||||
|
||||
// Load the SMDH
|
||||
|
|
|
@ -11,6 +11,7 @@ import androidx.annotation.NonNull;
|
|||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
|
||||
import com.panda3ds.pandroid.data.config.GlobalConfig;
|
||||
import com.panda3ds.pandroid.utils.PerformanceMonitor;
|
||||
|
||||
public class PerformanceView extends AppCompatTextView {
|
||||
|
@ -46,7 +47,7 @@ public class PerformanceView extends AppCompatTextView {
|
|||
|
||||
debug += "<b>FPS: </b>"+PerformanceMonitor.getFps()+"<br>";
|
||||
debug += "<b>RAM: </b>"+Math.round(((float) memoryUsageMb / memoryTotalMb)*100)+"% ("+memoryUsageMb+"MB/"+memoryTotalMb+"MB)<br>";
|
||||
debug += "<b>BACKEND: </b>"+PerformanceMonitor.getBackend()+"<br>";
|
||||
debug += "<b>BACKEND: </b>"+PerformanceMonitor.getBackend()+(GlobalConfig.get(GlobalConfig.KEY_SHADER_JIT) ? " + JIT" : "")+"<br>";
|
||||
setText(Html.fromHtml(debug, Html.FROM_HTML_MODE_COMPACT));
|
||||
postDelayed(this::refresh, 250);
|
||||
}
|
||||
|
|
|
@ -51,4 +51,6 @@
|
|||
<string name="pref_performance_monitor_summary">Mostrar um overlay com fps, memoria, etc.</string>
|
||||
<string name="pref_logger_service_title">Depuração</string>
|
||||
<string name="pref_logger_service_summary">Grave os registros para um arquivo.</string>
|
||||
<string name="pref_shader_jit_title">Shader Jit</string>
|
||||
<string name="pref_shader_jit_summary">Usar recompilador de shaders</string>
|
||||
</resources>
|
|
@ -52,4 +52,7 @@
|
|||
<string name="pref_performance_monitor_summary">Show overlay with fps, memory, etc.</string>
|
||||
<string name="pref_logger_service_title">Logger</string>
|
||||
<string name="pref_logger_service_summary">Store application logs to file.</string>
|
||||
<string name="pref_shader_jit_title">Shader JIT</string>
|
||||
<string name="pref_shader_jit_summary">Use shader re-compiler</string>
|
||||
<string name="graphics">Graphics</string>
|
||||
</resources>
|
||||
|
|
|
@ -14,4 +14,16 @@
|
|||
app:title="@string/pref_logger_service_title"
|
||||
android:summary="@string/pref_logger_service_summary"/>
|
||||
|
||||
<PreferenceCategory
|
||||
app:iconSpaceReserved="false"
|
||||
app:title="@string/graphics">
|
||||
|
||||
<SwitchPreference
|
||||
app:key="shaderJit"
|
||||
app:title="@string/pref_shader_jit_title"
|
||||
app:summary="@string/pref_shader_jit_summary"
|
||||
app:iconSpaceReserved="false"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
Loading…
Add table
Add a link
Reference in a new issue