update(MobileGlues): Update to 1.2.7 release

Added new options
- angleDepthClearFixMode
- timerQueryExt
- Compute multidraw emulation
This commit is contained in:
alexytomi
2025-07-19 23:20:54 +08:00
parent 325811baea
commit ea43e8ad84
5 changed files with 69 additions and 16 deletions

View File

@@ -231,11 +231,15 @@ public class LauncherPreferences {
// These guys are SwitchPreferences so they get special treatment, they need to be converted to ints
int gl43exts = DEFAULT_PREF.getBoolean("mg_renderer_setting_gl43ext", false) ? 1 : 0;
int computeShaderext = DEFAULT_PREF.getBoolean("mg_renderer_computeShaderext", false) ? 1 : 0;
int angleDepthClearFixMode = DEFAULT_PREF.getBoolean("mg_renderer_setting_angleDepthClearFixMode", false) ? 1 : 0;
int timerQueryExt = DEFAULT_PREF.getBoolean("mg_renderer_setting_timerQueryExt", false) ? 1 : 0;
MGConfigJson.put("enableExtGL43", gl43exts);
MGConfigJson.put("enableExtComputeShader", computeShaderext);
MGConfigJson.put("enableCompatibleMode", Integer.parseInt(DEFAULT_PREF.getString("", "0"))); // Placeholder, doesn't do anything on current MG
MGConfigJson.put("multidrawMode", Integer.parseInt(DEFAULT_PREF.getString("mg_renderer_setting_multidraw", "0")));
MGConfigJson.put("angleDepthClearFixMode", angleDepthClearFixMode);
MGConfigJson.put("timerQueryExt", timerQueryExt);
if (DEFAULT_PREF.getBoolean("mg_renderer_multidrawCompute", false)) {
MGConfigJson.put("multidrawMode", 5); // Special handling for the (special mayhaps) compute emulation
} else MGConfigJson.put("multidrawMode", Integer.parseInt(DEFAULT_PREF.getString("mg_renderer_setting_multidraw", "0")));
MGConfigJson.put("maxGlslCacheSize", Integer.parseInt(DEFAULT_PREF.getString("mg_renderer_setting_glsl_cache_size", "2048")));
File configFile = new File(Tools.DIR_DATA + "/MobileGlues", "config.json");
FileUtils.ensureParentDirectory(configFile);

View File

@@ -7,10 +7,10 @@ import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import androidx.annotation.NonNull;
import androidx.preference.EditTextPreference;
import androidx.preference.ListPreference;
import androidx.preference.Preference;
import androidx.preference.SwitchPreference;
import net.kdt.pojavlaunch.R;
@@ -18,10 +18,16 @@ import java.util.Objects;
public class LauncherPreferenceRendererSettingsFragment extends LauncherPreferenceFragment {
EditTextPreference GLSLCachePreference;
ListPreference MultiDrawEmulationPreference;
SwitchPreference ComputeMultiDrawPreference;
Preference.SummaryProvider MultiDrawSummaryProvider;
@Override
public void onCreatePreferences(Bundle b, String str) {
addPreferencesFromResource(R.xml.pref_renderer);
GLSLCachePreference = findPreference("mg_renderer_setting_glsl_cache_size");
ComputeMultiDrawPreference = findPreference("mg_renderer_multidrawCompute");
MultiDrawEmulationPreference = findPreference("mg_renderer_setting_multidraw");
GLSLCachePreference.setOnBindEditTextListener((editText) -> {
editText.setInputType(TYPE_CLASS_NUMBER);
editText.addTextChangedListener(new TextWatcher() {
@@ -29,18 +35,20 @@ public class LauncherPreferenceRendererSettingsFragment extends LauncherPreferen
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
// Nothing, its boilerplate
}
@Override
public void afterTextChanged(Editable editable) {
// Nothing, its boilerplate
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
// This is just to handle the summary not updating when its above max int value
// Horrible I know.
if (editText.getText().toString().isEmpty()){
if (editText.getText().toString().isEmpty()) {
editText.setText("0");
}
if (Long.parseLong(editText.getText().toString()) > Integer.MAX_VALUE){
if (Long.parseLong(editText.getText().toString()) > Integer.MAX_VALUE) {
editText.setError("Too big! Setting to maximum value");
editText.setText(String.valueOf(Integer.MAX_VALUE));
}
@@ -49,12 +57,30 @@ public class LauncherPreferenceRendererSettingsFragment extends LauncherPreferen
});
});
updateGLSLCacheSummary(); // Just updates the summary with the value when user opens the menu. Yes it's out of place.
updateMultiDrawSummary(); // Same as above
}
@Override
public void onSharedPreferenceChanged(SharedPreferences p, String s) {
GLSLCachePreference = findPreference("mg_renderer_setting_glsl_cache_size");
updateGLSLCacheSummary();
updateMultiDrawSummary();
}
private void updateMultiDrawSummary() {
if (MultiDrawEmulationPreference != null) {
if (MultiDrawEmulationPreference.getSummaryProvider() != null) {
MultiDrawSummaryProvider = MultiDrawEmulationPreference.getSummaryProvider();
}
if (ComputeMultiDrawPreference.isChecked()) {
MultiDrawEmulationPreference.setEnabled(false);
MultiDrawEmulationPreference.setSummaryProvider(null);
MultiDrawEmulationPreference.setSummary("(Experimental) Compute");
} else if (MultiDrawEmulationPreference != null) {
MultiDrawEmulationPreference.setEnabled(true);
MultiDrawEmulationPreference.setSummaryProvider(MultiDrawSummaryProvider);
}
}
}
private void updateGLSLCacheSummary() {
@@ -62,6 +88,8 @@ public class LauncherPreferenceRendererSettingsFragment extends LauncherPreferen
if (Objects.equals(Objects.requireNonNull(this.GLSLCachePreference).getText(), "") || Integer.parseInt(Objects.requireNonNull(this.GLSLCachePreference.getText())) == 0) {
this.GLSLCachePreference.setSummary(getString(R.string.global_off));
} else this.GLSLCachePreference.setSummary(this.GLSLCachePreference.getText() + " MB");
} catch (Exception e){ e.printStackTrace(); }
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -205,7 +205,6 @@
<string name="preference_java_description">Java Runtimes, JVM Arguments, RAM amount and sandbox</string>
<string name="preference_misc_title">Miscellaneous settings</string>
<string name="preference_misc_description">Version list and libraries check</string>
<string name="preference_experimental_title">Experimental Stuff</string>
<string name="preference_experimental_description">Use things there with consideration, no support</string>
<string name="preference_sustained_performance_title">Enable sustained performance mode</string>
<string name="preference_sustained_performance_description">Limit thermal throttling by limiting peak performance.</string>
@@ -439,11 +438,19 @@
<string name="mg_renderer_glsl_cache">Max GLSL cache size</string>
<string name="mg_renderer_angle">Use ANGLE as driver</string>
<string name="mg_renderer_multidraw">Multidraw emulation mode</string>
<string name="mg_renderer_title_errorSetting">Error Filtering</string>
<string name="mg_renderer_title_timerQueryExt">Disable GPU Utilization in F3 menu</string>
<string name="mg_renderer_summary_timerQueryExt">Fixes random crashes when F3 is open on some Mali devices</string>
<string name="preference_ANGLE_only">ANGLE Only Options</string>
<string name="mg_renderer_title_angleDepthClearFixMode">Fix hand and held items from going through blocks</string>
<string name="mg_renderer_summary_angleDepthClearFixMode">Only affects ANGLE, can affect performance.</string>
<string name="preference_experimental_title">Experimental Stuff</string>
<string name="mg_renderer_title_gl43exts">Advertise Experimental OpenGL 4.3 extensions</string>
<string name="mg_renderer_summary_gl43exts">May help with mod crashes. Disable if not needed, can cause crashes.</string>
<string name="mg_renderer_title_computeShaderext">Advertise Experimental Compute Shader extension</string>
<string name="mg_renderer_summary_computeShaderext">May help with shaderpack glitches. Disable if not needed, can cause crashes.</string>
<string name="mg_renderer_title_errorSetting">Error Filtering</string>
<string name="mg_renderer_title_multidrawCompute">Use Compute Multidraw Emulation</string>
<string name="mg_renderer_summary_multidrawCompute">Uses compute shaders for multidraw emulation</string>
<string name="app_short_name">Amethyst</string>
<string name="demo_versions_supported">Only Vanilla 1.3.1 and above are supported on demo accounts</string>
<string name="demo_unsupported">Demo Profile not supported</string>

View File

@@ -9,8 +9,7 @@
android:title="@string/mg_renderer_glsl_cache"
android:key="mg_renderer_setting_glsl_cache_size"
android:inputType="number"
android:defaultValue="2048"
/>
android:defaultValue="2048" />
<androidx.preference.ListPreference
android:title="@string/mg_renderer_angle"
android:key="mg_renderer_setting_angle"
@@ -32,19 +31,34 @@
android:entries="@array/mg_renderer_names_errorSetting"
android:entryValues="@array/mg_renderer_values_errorSetting"
app2:useSimpleSummaryProvider="true"/>
<SwitchPreference
android:title="@string/mg_renderer_title_timerQueryExt"
android:summary="@string/mg_renderer_summary_timerQueryExt"
android:key="mg_renderer_setting_timerQueryExt"
android:defaultValue="false" />
<PreferenceCategory android:title="@string/preference_ANGLE_only">
<SwitchPreference
android:title="@string/mg_renderer_title_angleDepthClearFixMode"
android:summary="@string/mg_renderer_summary_angleDepthClearFixMode"
android:key="mg_renderer_setting_angleDepthClearFixMode"
android:defaultValue="false" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/preference_experimental_title">
<SwitchPreference
android:title="@string/mg_renderer_title_gl43exts"
android:summary="@string/mg_renderer_summary_gl43exts"
android:key="mg_renderer_setting_gl43exts"
android:defaultValue="false"
/>
android:defaultValue="false" />
<SwitchPreference
android:title="@string/mg_renderer_title_computeShaderext"
android:summary="@string/mg_renderer_summary_computeShaderext"
android:key="mg_renderer_computeShaderext"
android:defaultValue="false"
/>
android:defaultValue="false" />
<SwitchPreference
android:title="@string/mg_renderer_title_multidrawCompute"
android:summary="@string/mg_renderer_summary_multidrawCompute"
android:key="mg_renderer_multidrawCompute"
android:defaultValue="false" />
</PreferenceCategory>
</PreferenceCategory>
</PreferenceScreen>