Load shared GLESv2 library
This commit is contained in:
@@ -446,6 +446,16 @@ public class MainActivity extends Activity {
|
||||
|
||||
public void LoadLibraries()
|
||||
{
|
||||
try
|
||||
{
|
||||
if(Globals.NeedGles2)
|
||||
System.loadLibrary("GLESv2");
|
||||
}
|
||||
catch ( UnsatisfiedLinkError e )
|
||||
{
|
||||
System.out.println("libSDL: Cannot load GLESv2 lib");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
for(String l : Globals.AppLibraries)
|
||||
|
||||
@@ -2356,7 +2356,7 @@ class Settings
|
||||
|
||||
static void Apply(Activity p)
|
||||
{
|
||||
nativeSetVideoDepth(Globals.VideoDepthBpp);
|
||||
nativeSetVideoDepth(Globals.VideoDepthBpp, Globals.NeedGles2 ? 1 : 0);
|
||||
if(Globals.SmoothVideo)
|
||||
nativeSetSmoothVideo();
|
||||
if( Globals.CompatibilityHacks )
|
||||
@@ -2489,7 +2489,7 @@ class Settings
|
||||
private static native void nativeSetMultitouchUsed();
|
||||
private static native void nativeSetTouchscreenKeyboardUsed();
|
||||
private static native void nativeSetSmoothVideo();
|
||||
private static native void nativeSetVideoDepth(int bpp);
|
||||
private static native void nativeSetVideoDepth(int bpp, int gles2);
|
||||
private static native void nativeSetCompatibilityHacks();
|
||||
private static native void nativeSetVideoMultithreaded();
|
||||
private static native void nativeSetupScreenKeyboard(int size, int drawsize, int theme, int nbuttonsAutoFire, int transparency);
|
||||
|
||||
@@ -131,6 +131,7 @@ SDL_Surface *SDL_CurrentVideoSurface = NULL;
|
||||
static int HwSurfaceCount = 0;
|
||||
static SDL_Surface ** HwSurfaceList = NULL;
|
||||
void * glLibraryHandle = NULL;
|
||||
void * gl2LibraryHandle = NULL;
|
||||
|
||||
static Uint32 SDL_VideoThreadID = 0;
|
||||
int SDL_ANDROID_InsideVideoThread()
|
||||
@@ -201,6 +202,8 @@ static SDL_VideoDevice *ANDROID_CreateDevice(int devindex)
|
||||
device->ToggleFullScreen = ANDROID_ToggleFullScreen;
|
||||
|
||||
glLibraryHandle = dlopen("libGLESv1_CM.so", RTLD_NOW);
|
||||
if(SDL_ANDROID_UseGles2)
|
||||
gl2LibraryHandle = dlopen("libGLESv2.so", RTLD_NOW);
|
||||
|
||||
return device;
|
||||
}
|
||||
@@ -996,6 +999,8 @@ void SDL_ANDROID_VideoContextRecreated()
|
||||
static void* ANDROID_GL_GetProcAddress(_THIS, const char *proc)
|
||||
{
|
||||
void * func = dlsym(glLibraryHandle, proc);
|
||||
if(!func && gl2LibraryHandle)
|
||||
func = dlsym(gl2LibraryHandle, proc);
|
||||
//__android_log_print(ANDROID_LOG_INFO, "libSDL", "ANDROID_GL_GetProcAddress(\"%s\"): %p", proc, func);
|
||||
return func;
|
||||
};
|
||||
|
||||
@@ -70,6 +70,7 @@ int SDL_ANDROID_VideoMultithreaded = 0;
|
||||
int SDL_ANDROID_CompatibilityHacks = 0;
|
||||
int SDL_ANDROID_BYTESPERPIXEL = 2;
|
||||
int SDL_ANDROID_BITSPERPIXEL = 16;
|
||||
int SDL_ANDROID_UseGles2 = 0;
|
||||
|
||||
|
||||
static void appPutToBackgroundCallbackDefault(void)
|
||||
@@ -311,8 +312,9 @@ JAVA_EXPORT_NAME(Settings_nativeSetCompatibilityHacks) (JNIEnv* env, jobject thi
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
JAVA_EXPORT_NAME(Settings_nativeSetVideoDepth) (JNIEnv* env, jobject thiz, jint bpp)
|
||||
JAVA_EXPORT_NAME(Settings_nativeSetVideoDepth) (JNIEnv* env, jobject thiz, jint bpp, jint UseGles2)
|
||||
{
|
||||
SDL_ANDROID_BITSPERPIXEL = bpp;
|
||||
SDL_ANDROID_BYTESPERPIXEL = SDL_ANDROID_BITSPERPIXEL / 8;
|
||||
SDL_ANDROID_UseGles2 = UseGles2;
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ extern int SDL_ANDROID_TouchscreenCalibrationY;
|
||||
extern int SDL_ANDROID_SmoothVideo;
|
||||
extern int SDL_ANDROID_VideoMultithreaded;
|
||||
extern int SDL_ANDROID_CompatibilityHacks;
|
||||
extern int SDL_ANDROID_UseGles2;
|
||||
extern int SDL_ANDROID_BYTESPERPIXEL;
|
||||
extern int SDL_ANDROID_BITSPERPIXEL;
|
||||
extern void SDL_ANDROID_TextInputInit(char * buffer, int len);
|
||||
|
||||
Reference in New Issue
Block a user