Working ANGLE!

This commit is contained in:
The Judge 2022-10-15 19:22:12 -07:00
parent 5362e66436
commit c07cc0629c
25 changed files with 25 additions and 32 deletions

View file

@ -1 +1 @@
1664111720511
1665886806915

View file

@ -222,7 +222,9 @@ public class JREUtils {
envMap.put("REGAL_GL_VERSION", "4.5");
if(LOCAL_RENDERER != null) {
envMap.put("POJAV_RENDERER", LOCAL_RENDERER);
envMap.put("LIBGL_ES", Character.toString(LOCAL_RENDERER.charAt(8)));
}
if(LOCAL_RENDERER.equals("opengles3_desktopgl_angle_vulkan")) envMap.put("POJAVEXEC_EGL","libEGL_angle.so"); // use ANGLE egl
envMap.put("AWTSTUB_WIDTH", Integer.toString(CallbackBridge.windowWidth > 0 ? CallbackBridge.windowWidth : CallbackBridge.physicalWidth));
envMap.put("AWTSTUB_HEIGHT", Integer.toString(CallbackBridge.windowHeight > 0 ? CallbackBridge.windowHeight : CallbackBridge.physicalHeight));

View file

@ -8,6 +8,17 @@ HERE_PATH := $(LOCAL_PATH)
LOCAL_PATH := $(HERE_PATH)
include $(CLEAR_VARS)
LOCAL_MODULE := angle_gles2
LOCAL_SRC_FILES := tinywrapper/angle-gles/$(TARGET_ARCH_ABI)/libGLESv2_angle.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := tinywrapper
LOCAL_SHARED_LIBRARIES := angle_gles2
LOCAL_SRC_FILES := tinywrapper/main.c tinywrapper/string_utils.c
LOCAL_C_INCLUDES := $(LOCAL_PATH)/tinywrapper
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := xhook
@ -24,18 +35,6 @@ LOCAL_CONLYFLAGS := -std=c11
LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := angle_gles2
LOCAL_SRC_FILES := tinywrapper/angle-gles/$(TARGET_ARCH_ABI)/libGLESv2_angle.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := tinywrapper
LOCAL_SHARED_LIBRARIES := angle_gles2
LOCAL_SRC_FILES := tinywrapper/main.c tinywrapper/string_utils.c
LOCAL_C_INCLUDES := $(LOCAL_PATH)/tinywrapper
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
# Link GLESv2 for test
LOCAL_LDLIBS := -ldl -llog -landroid

View file

@ -59,6 +59,9 @@ render_window_t* gl_init_context(render_window_t *share) {
eglChooseConfig_p(g_EglDisplay, egl_attributes, &bundle->config, 1, &num_configs);
eglGetConfigAttrib_p(g_EglDisplay, bundle->config, EGL_NATIVE_VISUAL_ID, &bundle->format);
EGLBoolean bindResult = eglBindAPI_p(EGL_OPENGL_API);
if(!bindResult) printf("EGLBridge: bind failed: %p\n", eglGetError_p());
int libgl_es = strtol(getenv("LIBGL_ES"), NULL, 0);
if(libgl_es < 0 || libgl_es > INT16_MAX) libgl_es = 2;
const EGLint egl_context_attributes[] = { EGL_CONTEXT_CLIENT_VERSION, libgl_es, EGL_NONE };

View file

@ -774,14 +774,14 @@ int pojavInit() {
return 0;
}
static const EGLint attribs[] = {
static const EGLint attribs[13] = {
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_ALPHA_SIZE, 8,
// Minecraft required on initial 24
EGL_DEPTH_SIZE, 24,
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
EGL_NONE
};
@ -803,22 +803,8 @@ int pojavInit() {
ANativeWindow_setBuffersGeometry(pojav_environ->pojavWindow, 0, 0, vid);
eglBindAPI_p(EGL_OPENGL_ES_API);
potatoBridge.eglSurface = eglCreateWindowSurface_p(potatoBridge.eglDisplay, config, pojav_environ->pojavWindow, NULL);
ANativeWindow_setBuffersGeometry(potatoBridge.androidWindow, 0, 0, vid);
{
EGLBoolean bindResult;
if (strncmp(renderer, "opengles3_desktopgl", 19) == 0) {
printf("EGLBridge: Binding to desktop OpenGL\n");
bindResult = eglBindAPI_p(EGL_OPENGL_API);
} else {
printf("EGLBridge: Binding to OpenGL ES\n");
bindResult = eglBindAPI_p(EGL_OPENGL_ES_API);
}
if(!bindResult) printf("EGLBridge: bind failed: %p\n", eglGetError_p());
}
potatoBridge.eglSurface = eglCreateWindowSurface_p(potatoBridge.eglDisplay, config, potatoBridge.androidWindow, NULL);
eglBindAPI_p(EGL_OPENGL_ES_API);
if (!potatoBridge.eglSurface) {
printf("EGLBridge: Error eglCreateWindowSurface failed: %p\n", eglGetError_p());

View file

@ -12,6 +12,9 @@ __attribute__((constructor)) void env_init() {
char* strptr_env = getenv("POJAV_ENVIRON");
if(strptr_env == NULL) {
__android_log_print(ANDROID_LOG_INFO, "Environ", "No environ found, creating...");
pojav_environ = malloc(sizeof(struct pojav_environ_s));
assert(pojav_environ);
memset(pojav_environ, 0 , sizeof(struct pojav_environ_s));
if(asprintf(&strptr_env, "%p", pojav_environ) == -1) abort();
setenv("POJAV_ENVIRON", strptr_env, 1);
free(strptr_env);

View file

@ -95,7 +95,7 @@ void glShaderSource(GLuint shader, GLsizei count, const GLchar * const *string,
for (int i=0; i<count; i++)
strcat(source, string[i]);
}
char *source2 = strchr(source, '#');
if (!source2) {
source2 = source;

View file

Binary file not shown.

View file

Before

Width:  |  Height:  |  Size: 501 B

After

Width:  |  Height:  |  Size: 501 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 280 B

After

Width:  |  Height:  |  Size: 280 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 633 B

After

Width:  |  Height:  |  Size: 633 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 293 B

After

Width:  |  Height:  |  Size: 293 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 506 B

After

Width:  |  Height:  |  Size: 506 B

Before After
Before After

View file

@ -4,6 +4,7 @@
<item name="2">@string/mcl_setting_renderer_gles2_4</item>
<!-- <item name="4">@string/mcl_setting_renderer_vulkan_zink</item> -->
<item name="5">@string/mcl_setting_renderer_virgl</item>
<item name="6">TINYWRAPPER ANGLE VULKAN</item>
</string-array>
<string-array name="menu_customcontrol">
@ -21,7 +22,6 @@
<item>@string/control_customkey</item>
<item>@string/mcl_setting_title_mousespeed</item>
<item>@string/mcl_option_customcontrol</item>
<item name="6">TINYWRAPPER ANGLE VULKAN</item>
</string-array>
<string-array name="renderer_values">

0
scripts/languagelist_updater.sh Executable file → Normal file
View file