mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-15 07:39:00 -04:00
Freat[misc_settings]: check for Turnip compatibility to hide the driver option
This commit is contained in:
parent
bff49a7ed6
commit
a39cd84e08
@ -22,11 +22,6 @@ import android.database.Cursor;
|
||||
import android.hardware.Sensor;
|
||||
import android.hardware.SensorManager;
|
||||
import android.net.Uri;
|
||||
import android.opengl.EGL14;
|
||||
import android.opengl.EGLConfig;
|
||||
import android.opengl.EGLContext;
|
||||
import android.opengl.EGLDisplay;
|
||||
import android.opengl.GLES30;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
@ -48,10 +43,6 @@ import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
import androidx.core.view.WindowInsetsControllerCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
@ -242,8 +233,8 @@ public final class Tools {
|
||||
* @return whether the GPU is affected by the Large Thin Wrapper render distance issue on vanilla
|
||||
*/
|
||||
private static boolean affectedByRenderDistanceIssue() {
|
||||
GLInfoUtils.GLInfo info = GLInfoUtils.getInfo();
|
||||
return info.renderer.contains("Adreno") && info.vendor.equals("Qualcomm") && info.glesMajorVersion >= 3;
|
||||
GLInfoUtils.GLInfo info = GLInfoUtils.getGlInfo();
|
||||
return info.isAdreno() && info.glesMajorVersion >= 3;
|
||||
}
|
||||
|
||||
private static boolean checkRenderDistance(File gamedir) {
|
||||
@ -1035,7 +1026,7 @@ public final class Tools {
|
||||
Logger.appendToLog("Info: API version: " + SDK_INT);
|
||||
Logger.appendToLog("Info: Selected Minecraft version: " + gameVersion);
|
||||
Logger.appendToLog("Info: Custom Java arguments: \"" + javaArguments + "\"");
|
||||
GLInfoUtils.GLInfo info = GLInfoUtils.getInfo();
|
||||
GLInfoUtils.GLInfo info = GLInfoUtils.getGlInfo();
|
||||
Logger.appendToLog("Info: Graphics device: "+info.vendor+ " "+info.renderer+" (OpenGL ES "+info.glesMajorVersion+")");
|
||||
}
|
||||
|
||||
|
@ -1,19 +1,21 @@
|
||||
package net.kdt.pojavlaunch.prefs.screens;
|
||||
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import net.kdt.pojavlaunch.R;
|
||||
import net.kdt.pojavlaunch.Tools;
|
||||
import net.kdt.pojavlaunch.utils.GLInfoUtils;
|
||||
|
||||
public class LauncherPreferenceMiscellaneousFragment extends LauncherPreferenceFragment {
|
||||
@Override
|
||||
public void onCreatePreferences(Bundle b, String str) {
|
||||
addPreferencesFromResource(R.xml.pref_misc);
|
||||
Preference driverPreference = requirePreference("zinkPreferSystemDriver");
|
||||
if(!Tools.checkVulkanSupport(driverPreference.getContext().getPackageManager())) {
|
||||
driverPreference.setVisible(false);
|
||||
}
|
||||
PackageManager packageManager = driverPreference.getContext().getPackageManager();
|
||||
boolean supportsTurnip = Tools.checkVulkanSupport(packageManager) && GLInfoUtils.getGlInfo().isAdreno();
|
||||
driverPreference.setVisible(supportsTurnip);
|
||||
}
|
||||
}
|
||||
|
@ -99,7 +99,12 @@ public class GLInfoUtils {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static GLInfo getInfo() {
|
||||
/**
|
||||
* Get the information about the current OpenGL ES device, which consists of the vendor,
|
||||
* the renderer and the major GLES version
|
||||
* @return the info
|
||||
*/
|
||||
public static GLInfo getGlInfo() {
|
||||
if(info != null) return info;
|
||||
Log.i("GLInfoUtils", "Querying graphics device info...");
|
||||
boolean infoQueryResult = false;
|
||||
@ -121,5 +126,13 @@ public class GLInfoUtils {
|
||||
this.renderer = renderer;
|
||||
this.glesMajorVersion = glesMajorVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this GLInfo belongs to a Qualcomm Adreno graphics adapter
|
||||
* @return
|
||||
*/
|
||||
public boolean isAdreno() {
|
||||
return renderer.contains("Adreno") && vendor.equals("Qualcomm");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,11 +32,6 @@ import net.kdt.pojavlaunch.plugins.FFmpegPlugin;
|
||||
import net.kdt.pojavlaunch.prefs.*;
|
||||
import org.lwjgl.glfw.*;
|
||||
|
||||
import javax.microedition.khronos.egl.EGL10;
|
||||
import javax.microedition.khronos.egl.EGLConfig;
|
||||
import javax.microedition.khronos.egl.EGLContext;
|
||||
import javax.microedition.khronos.egl.EGLDisplay;
|
||||
|
||||
public class JREUtils {
|
||||
private JREUtils() {}
|
||||
|
||||
@ -239,7 +234,7 @@ public class JREUtils {
|
||||
reader.close();
|
||||
}
|
||||
|
||||
GLInfoUtils.GLInfo info = GLInfoUtils.getInfo();
|
||||
GLInfoUtils.GLInfo info = GLInfoUtils.getGlInfo();
|
||||
if(!envMap.containsKey("LIBGL_ES") && LOCAL_RENDERER != null) {
|
||||
int glesMajor = info.glesMajorVersion;
|
||||
Log.i("glesDetect","GLES version detected: "+glesMajor);
|
||||
@ -256,7 +251,7 @@ public class JREUtils {
|
||||
}
|
||||
}
|
||||
|
||||
if(info.vendor.equals("Qualcomm") && info.renderer.contains("Adreno") && !PREF_ZINK_PREFER_SYSTEM_DRIVER) {
|
||||
if(info.isAdreno() && !PREF_ZINK_PREFER_SYSTEM_DRIVER) {
|
||||
envMap.put("POJAV_LOAD_TURNIP", "1");
|
||||
}
|
||||
|
||||
@ -517,7 +512,7 @@ public class JREUtils {
|
||||
}
|
||||
|
||||
public static int getDetectedVersion() {
|
||||
return GLInfoUtils.getInfo().glesMajorVersion;
|
||||
return GLInfoUtils.getGlInfo().glesMajorVersion;
|
||||
}
|
||||
public static native int chdir(String path);
|
||||
public static native boolean dlopen(String libPath);
|
||||
|
Loading…
x
Reference in New Issue
Block a user