Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 35 additions & 12 deletions ltw/src/main/tinywrapper/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "main.h"
#include "unpack.h"
#include "libraryinternal.h"
#include "env.h"
#include "env.h"

void glClearDepth(GLdouble depth) {
if(!current_context) return;
Expand Down Expand Up @@ -168,7 +168,14 @@ void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei widt
current_context->proxy_intformat = internalformat;
return;
}

if (target == GL_TEXTURE_2D && (width < 1024 && height <
1024)) {

es3_functions.glTexParameteri(target,
GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
es3_functions.glTexParameteri(target,
GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
}
// No data, just initialization
if(data == NULL) {
make_format_non_generic(&internalformat, &type, &format);
Expand Down Expand Up @@ -249,16 +256,32 @@ void glTexParameterf( GLenum target,
if(!filter_params_float(target, pname, param)) return;
es3_functions.glTexParameterf(target, pname, param);
}
void glTexParameteri( GLenum target,
GLenum pname,
GLint param) {
if(!current_context) return;
if(!filter_params_integer(target, pname, param)) return;
if(!filter_params_float(target, pname, (GLfloat)param)) return;
remove_mipmaps(pname, &param);
make_depthtex_nearest(target, pname, &param);
es3_functions.glTexParameteri(target, pname, param);
}
void glTexParameteri( GLenum target,
GLenum pname,
GLint param) {
if(!current_context) return;
if(!filter_params_integer(target, pname, param)) return;
if(!filter_params_float(target, pname, (GLfloat)param))
return;
remove_mipmaps(pname, &param);
make_depthtex_nearest(target, pname, &param);


if (target == GL_TEXTURE_2D && (pname ==
GL_TEXTURE_MIN_FILTER || pname == GL_TEXTURE_MAG_FILTER)) {

if (param == GL_LINEAR_MIPMAP_LINEAR || param ==
GL_NEAREST_MIPMAP_NEAREST ||
param == GL_NEAREST_MIPMAP_LINEAR || param ==
GL_LINEAR_MIPMAP_NEAREST) {

param = (param == GL_LINEAR_MIPMAP_LINEAR || param
== GL_LINEAR_MIPMAP_NEAREST) ? GL_LINEAR : GL_NEAREST;
}
}

es3_functions.glTexParameteri(target, pname, param);
}

void glTexParameterfv( GLenum target,
GLenum pname,
Expand Down
9 changes: 6 additions & 3 deletions ltw/src/main/tinywrapper/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ INTERNAL es3_functions_t es3_functions;

static void error_sysegl() {
__android_log_print(ANDROID_LOG_ERROR, "LTWInit", "Failed to load system EGL: %s", dlerror());
abort();
// abort();
return;
Comment on lines -24 to +25
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EGL is required for LTW. Why return here instead of abort?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EGL is required for LTW. Why return here instead of abort?

As FCL wouldn't start, I attempted to use

}

static void error_init(const char* functionName) {
__android_log_print(ANDROID_LOG_ERROR, "LTWInit", "Failed to load function \"%s\"", functionName);
abort();
// abort();
return;
}

static void init_es3_proc() {
Expand Down Expand Up @@ -72,7 +74,8 @@ static eglMustCastToProperFunctionPointerType resolve_stub(const char* procname)

static void unknown_stub() {
printf("Unknown stub! Aborting to produce backtrace...\n");
abort();
// abort();
return;
}

eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname) {
Expand Down
9 changes: 9 additions & 0 deletions ltw/src/main/tinywrapper/unpack.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,15 @@ void glPixelStoref( GLenum pname,

void glPixelStorei( GLenum pname,
GLint param) {
if(!current_context) return;
if (pname == GL_UNPACK_ALIGNMENT) {

if (param != 1 && param != 2 && param != 4) {
param = 4;
}
}
es3_functions.glPixelStorei(pname, param);

switch (pname) {
case GL_UNPACK_SWAP_BYTES:
current_context->unpack.swap_bytes = param == GL_TRUE;
Expand Down