Merge Zink renderer to upstream (#1585)

* OSMesa EGLBridge

* It renders a gray screen with Zink!

* Image

* Added missing file: gl/glext.h

* Added jniLibs/arm64-v8a/libOSMesa_8.so

* Load built-in libOSMesa when dev lib not available

* Added jniLibs/x86_64/libOSMesa_8.so

* Start trying to use Android's internal APIs to manage framebuffers

* Automatic stride to un-broke the image

* DMA

* Update lwjgl3 version

* Update LauncherPreferences.java

Temporary force set, to fix #1121

* Remove ndk.abiFilters

* Re-add ndk.abiFilters but for 64bit archs only

* Fixed x86_64 libOSMesa_8.so

* Fix buffer size

* [WIP] Force enable VK ext for GL 3.0

* WIP force ext

* Attempt get Zink GL 3.0 by force enable some exts

* Just missing ;;

* Mesa3D: set OpenGL version to 4.6

* Added Zink to renderer list

* Fixed the renderer check

* Maybe correct the switch between gl4es and zink

* Update JREUtils.java

fixes from https://github.com/sp614x/optifine/issues/420

* also set glsl version

* [NOT TESTED] (DO NOT TRY DEVS ONLY) upstream mesa to staging mesa branch

* upstream mesa once again

* Revert "upstream mesa once again"

This reverts commit ccb0f429b707c6fed1376809bb978e7eb8230222.

* add arm32

* Enable building for arm32

* Attempt fix auto change to libname libOSMesa

* Attempt fix (2/2)?

* Added missed `break`, should fix gl4es crashes

* Update JREUtils.java

* Support OpenJDK 17 runtime environment (internal)

* Update JREUtils.java

* [zink] use RGBA instead of RGB

Some mobile GPUs does not support RGB format, so switching to RGBA is necessary. However, native window is set to RGBX to ignore alpha channel.

* Move jreReleaseList to here

* Update BaseMainActivity.java

* Fixes (#1525)

* import java.util.Map
* fix: String cannot be converted to boolean
* Fixes
* Put readJREReleaseProperties to try catch

* Remove loading libtinyiconv.so (statically linked)

* lets do this

* upsteam to the staging branch of 21.0

* [zink] exports OpenGL 4.6 again

Limit OpenGL version does nothing other than deny the game to use it, so limiting is probably useless. Also, this is a lie that user see "export OpenGL 4.6" in renderer list but see "OpenGL 3.2" when enter game. Therefore, change back to OpenGL 4.6.

* New string: mcn_check_fail_vulkan_support

* [not yet finish] error if GPU doesn’t have Vulkan

* [not yet finished] error if vulkan is unsupported

* Additional checks for Vulkan support state

* Changes about gl4es renderers

* Define new renderer: opengles2_5 g4es 1.1.4

Also, change how gl4es renderers works

* Filter out "_5"

* Don’t allow custom OpenGL libname from jvm args

* Update strings.xml

* Update headings_array.xml

* Update headings_array.xml

* Update strings.xml

* Unreachable code

* Enable build for 32-bit x86 (zink not added!)

* Changes from upstream and security changes (#1575)

* import java.util.Map

* fix: String cannot be converted to boolean

* Fixes

* Put readJREReleaseProperties to try catch

* Attempt to redirect signal handler to JVM

* @artdeell: missed \n in printf

* Missed include errno.h

* Comment out last changes

* try and optimise gl4es with flags

* corect format

* dont shrink textures

* does notting

* Fix issue #1199

* Filter out Session ID on new log pipe

* int index

* Debug: print all env vars to latestlog.txt

Co-authored-by: artdeell
Co-authored-by: rhjdvsgsgks
Co-authored-by: LegacyGamerHD
Co-authored-by: Boulay Mathias
This commit is contained in:
Duy Tran Khanh 2021-06-24 19:51:56 +07:00 committed by GitHub
parent 76b185e3b5
commit 4a90c8f124
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 16217 additions and 177 deletions

View file

@ -2,6 +2,7 @@ package net.kdt.pojavlaunch;
import android.app.*;
import android.content.*;
import android.content.pm.PackageManager;
import android.graphics.*;
import android.os.*;
import android.util.*;
@ -65,6 +66,7 @@ public class BaseMainActivity extends LoggableActivity {
}
}
};
private MinecraftGLView minecraftGLView;
private int guiScale;
private DisplayMetrics displayMetrics;
@ -893,6 +895,10 @@ public class BaseMainActivity extends LoggableActivity {
*/
appendlnToLog("--------- beggining with launcher debug");
appendlnToLog("Info: Launcher version: " + BuildConfig.VERSION_NAME);
if (LauncherPreferences.PREF_RENDERER.equals("vulkan_zink")) {
checkVulkanZinkIsSupported();
}
checkLWJGL3Installed();
jreReleaseList = JREUtils.readJREReleaseProperties();
@ -953,6 +959,16 @@ public class BaseMainActivity extends LoggableActivity {
appendlnToLog("Info: LWJGL3 directory: " + Arrays.toString(lwjgl3dir.list()));
}
}
private void checkVulkanZinkIsSupported() {
if (Tools.CURRENT_ARCHITECTURE.equals("x86")
|| Build.VERSION.SDK_INT < 25
|| !getPackageManager().hasSystemFeature(PackageManager.FEATURE_VULKAN_HARDWARE_LEVEL)
|| !getPackageManager().hasSystemFeature(PackageManager.FEATURE_VULKAN_HARDWARE_VERSION)) {
appendlnToLog("Error: Vulkan Zink renderer is not supported!");
throw new RuntimeException(getString(R.string. mcn_check_fail_vulkan_support));
}
}
public void printStream(InputStream stream) {
try {