SDL: added GLES3 support

This commit is contained in:
Sergii Pylypenko
2016-08-22 21:46:35 +03:00
parent 250f254b5d
commit ee54f13f75
15 changed files with 134 additions and 59 deletions

View File

@@ -60,6 +60,7 @@ if [ "$SwVideoMode" = "y" ]; then
NeedDepthBuffer=n
NeedStencilBuffer=n
NeedGles2=n
NeedGles3=n
fi
@@ -178,10 +179,14 @@ echo >> AndroidAppSettings.cfg
echo "# Enable OpenGL stencil buffer (needed only for 3-d applications, small speed decrease) (y) or (n)" >> AndroidAppSettings.cfg
echo NeedStencilBuffer=$NeedStencilBuffer >> AndroidAppSettings.cfg
echo >> AndroidAppSettings.cfg
echo "# Try to use GLES 2.x context - will revert to GLES 1.X if unsupported by device" >> AndroidAppSettings.cfg
echo "# Use GLES 2.x context" >> AndroidAppSettings.cfg
echo "# you need this option only if you're developing 3-d app (y) or (n)" >> AndroidAppSettings.cfg
echo NeedGles2=$NeedGles2 >> AndroidAppSettings.cfg
echo >> AndroidAppSettings.cfg
echo "# Use GLES 3.x context" >> AndroidAppSettings.cfg
echo "# you need this option only if you're developing 3-d app (y) or (n)" >> AndroidAppSettings.cfg
echo NeedGles3=$NeedGles3 >> AndroidAppSettings.cfg
echo >> AndroidAppSettings.cfg
echo "# Use glshim library for provide OpenGL 1.x functionality to OpenGL ES accelerated cards (y) or (n)" >> AndroidAppSettings.cfg
echo UseGlshim=$UseGlshim >> AndroidAppSettings.cfg
echo >> AndroidAppSettings.cfg
@@ -483,12 +488,6 @@ else
NeedStencilBuffer=false
fi
if [ "$NeedGles2" = "y" ] ; then
NeedGles2=true
else
NeedGles2=false
fi
if [ "$UseGlshim" = "y" ] ; then
UseGlshimCFlags=-DUSE_GLSHIM=1
else
@@ -831,6 +830,20 @@ else
ImmersiveMode=true
fi
if [ "$NeedGles2" = "y" ] ; then
NeedGles2=true
else
NeedGles2=false
$SEDI "/==GLES2==/ d" project/AndroidManifest.xml
fi
if [ "$NeedGles3" = "y" ] ; then
NeedGles3=true
else
NeedGles3=false
$SEDI "/==GLES3==/ d" project/AndroidManifest.xml
fi
echo Patching project/src/Globals.java
$SEDI "s/public static String ApplicationName = .*;/public static String ApplicationName = \"$AppShortName\";/" project/src/Globals.java
$SEDI "s/public static final boolean Using_SDL_1_3 = .*;/public static final boolean Using_SDL_1_3 = $UsingSdl13;/" project/src/Globals.java
@@ -848,6 +861,7 @@ $SEDI "s/public static int VideoDepthBpp = .*;/public static int VideoDepthBpp =
$SEDI "s/public static boolean NeedDepthBuffer = .*;/public static boolean NeedDepthBuffer = $NeedDepthBuffer;/" project/src/Globals.java
$SEDI "s/public static boolean NeedStencilBuffer = .*;/public static boolean NeedStencilBuffer = $NeedStencilBuffer;/" project/src/Globals.java
$SEDI "s/public static boolean NeedGles2 = .*;/public static boolean NeedGles2 = $NeedGles2;/" project/src/Globals.java
$SEDI "s/public static boolean NeedGles3 = .*;/public static boolean NeedGles3 = $NeedGles3;/" project/src/Globals.java
$SEDI "s/public static boolean CompatibilityHacksVideo = .*;/public static boolean CompatibilityHacksVideo = $CompatibilityHacksForceScreenUpdate;/" project/src/Globals.java
$SEDI "s/public static boolean CompatibilityHacksStaticInit = .*;/public static boolean CompatibilityHacksStaticInit = $CompatibilityHacksStaticInit;/" project/src/Globals.java
$SEDI "s/public static boolean CompatibilityHacksTextInputEmulatesHwKeyboard = .*;/public static boolean CompatibilityHacksTextInputEmulatesHwKeyboard = $CompatibilityHacksTextInputEmulatesHwKeyboard;/" project/src/Globals.java
@@ -944,10 +958,9 @@ mkdir -p project/libs
if [ "$GooglePlayGameServicesId" = "n" -o -z "$GooglePlayGameServicesId" ] ; then
$SEDI "/==GOOGLEPLAYGAMESERVICES==/ d" project/AndroidManifest.xml
GooglePlayGameServicesId=""
grep 'google-play-services' project/local.properties > /dev/null && {
$SEDI 's/.*android.library.reference.*//g' project/local.properties
grep '=play-services' project/local.properties > /dev/null && {
$SEDI 's/.*=play-services.*//g' project/local.properties
rm -f project/libs/android-support-v4.jar
rm -f project/libs/play-services-games.jar
}
else
for F in $JAVA_SRC_PATH/googleplaygameservices/*.java; do

View File

@@ -64,5 +64,7 @@
<!-- ==SCREEN-SIZE-SMALL== --> <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" />
<!-- ==SCREEN-SIZE-NORMAL== --> <supports-screens android:smallScreens="false" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" />
<!-- ==SCREEN-SIZE-LARGE== --> <supports-screens android:smallScreens="false" android:normalScreens="false" android:largeScreens="true" android:xlargeScreens="true" />
<!-- ==GLES2== --> <uses-feature android:glEsVersion="0x00020000" required="true"/>
<!-- ==GLES3== --> <uses-feature android:glEsVersion="0x00030000" required="true"/>
</manifest>

View File

@@ -284,7 +284,7 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call
"setRenderer has already been called for this instance.");
}
if (mEGLConfigChooser == null) {
mEGLConfigChooser = getEglConfigChooser(16, false, false, false);
mEGLConfigChooser = getEglConfigChooser(16, false, false, false, false);
}
mGLThread = new GLThread(renderer);
mGLThread.start();
@@ -323,8 +323,8 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call
*
* @param needDepth
*/
public void setEGLConfigChooser(int bpp, boolean needDepth, boolean stencil, boolean gles2) {
setEGLConfigChooser(getEglConfigChooser(bpp, needDepth, stencil, gles2));
public void setEGLConfigChooser(int bpp, boolean needDepth, boolean stencil, boolean gles2, boolean gles3) {
setEGLConfigChooser(getEglConfigChooser(bpp, needDepth, stencil, gles2, gles3));
}
/**
@@ -341,9 +341,9 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call
*
*/
public void setEGLConfigChooser(int redSize, int greenSize, int blueSize,
int alphaSize, int depthSize, int stencilSize, boolean gles2) {
int alphaSize, int depthSize, int stencilSize, boolean gles2, boolean gles3) {
setEGLConfigChooser(new ComponentSizeChooser(redSize, greenSize,
blueSize, alphaSize, depthSize, stencilSize, gles2));
blueSize, alphaSize, depthSize, stencilSize, gles2, gles3));
}
/**
* Set the rendering mode. When renderMode is
@@ -636,6 +636,7 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call
*/
EGLConfig chooseConfig(EGL10 egl, EGLDisplay display);
public boolean isGles2Required();
public boolean isGles3Required();
}
private static abstract class BaseConfigChooser
@@ -672,7 +673,7 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call
private static class ComponentSizeChooser extends BaseConfigChooser {
public ComponentSizeChooser(int redSize, int greenSize, int blueSize,
int alphaSize, int depthSize, int stencilSize, boolean isGles2) {
int alphaSize, int depthSize, int stencilSize, boolean isGles2, boolean isGles3) {
super(new int[] {EGL10.EGL_NONE}); // Get all possible configs
mValue = new int[1];
mRedSize = redSize;
@@ -682,6 +683,7 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call
mDepthSize = depthSize;
mStencilSize = stencilSize;
mIsGles2 = isGles2;
mIsGles3 = isGles3;
}
@Override
@@ -693,7 +695,7 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call
int idx = 0;
int selectidx = -1;
Log.v("SDL", "Desired GL config: " + "R" + mRedSize + "G" + mGreenSize + "B" + mBlueSize + "A" + mAlphaSize + " depth " + mDepthSize + " stencil " + mStencilSize + " type " + (mIsGles2 ? "GLES2" : "GLES"));
Log.v("SDL", "Desired GL config: " + "R" + mRedSize + "G" + mGreenSize + "B" + mBlueSize + "A" + mAlphaSize + " depth " + mDepthSize + " stencil " + mStencilSize + " type " + (mIsGles3 ? "GLES3" : mIsGles2 ? "GLES2" : "GLES"));
for(EGLConfig config : configs) {
if ( config == null )
continue;
@@ -711,7 +713,7 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call
EGL10.EGL_STENCIL_SIZE, 0);
int rendertype = findConfigAttrib(egl, display, config,
EGL10.EGL_RENDERABLE_TYPE, 0);
int desiredtype = mIsGles2 ? EGL_OPENGL_ES2_BIT : EGL_OPENGL_ES_BIT;
int desiredtype = mIsGles3 ? EGL_OPENGL_ES3_BIT : mIsGles2 ? EGL_OPENGL_ES2_BIT : EGL_OPENGL_ES_BIT;
int nativeRender = findConfigAttrib(egl, display, config,
EGL10.EGL_NATIVE_RENDERABLE, 0);
int caveat = findConfigAttrib(egl, display, config,
@@ -743,6 +745,8 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call
cfgcur += "GLES";
if((rendertype & EGL_OPENGL_ES2_BIT) != 0)
cfgcur += " GLES2";
if((rendertype & EGL_OPENGL_ES3_BIT) != 0)
cfgcur += " GLES3";
if((rendertype & EGL_OPENGL_BIT) != 0)
cfgcur += " OPENGL";
if((rendertype & EGL_OPENVG_BIT) != 0)
@@ -782,6 +786,11 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call
return mIsGles2;
}
public boolean isGles3Required()
{
return mIsGles3;
}
private int[] mValue;
// Subclasses can adjust these values:
protected int mRedSize;
@@ -791,11 +800,13 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call
protected int mDepthSize;
protected int mStencilSize;
protected boolean mIsGles2 = false;
protected boolean mIsGles3 = false;
public static final int EGL_OPENGL_ES_BIT = 1;
public static final int EGL_OPENVG_BIT = 2;
public static final int EGL_OPENGL_ES2_BIT = 4;
public static final int EGL_OPENGL_BIT = 8;
public static final int EGL_OPENGL_ES3_BIT = 16;
}
/**
@@ -804,8 +815,8 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call
*
*/
private static class SimpleEGLConfigChooser16 extends ComponentSizeChooser {
public SimpleEGLConfigChooser16(boolean withDepthBuffer, boolean stencil, boolean gles2) {
super(4, 4, 4, 0, withDepthBuffer ? 16 : 0, stencil ? 8 : 0, gles2);
public SimpleEGLConfigChooser16(boolean withDepthBuffer, boolean stencil, boolean gles2, boolean gles3) {
super(4, 4, 4, 0, withDepthBuffer ? 16 : 0, stencil ? 8 : 0, gles2, gles3);
// Adjust target values. This way we'll accept a 4444 or
// 555 buffer if there's no 565 buffer available.
mRedSize = 5;
@@ -815,8 +826,8 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call
}
private static class SimpleEGLConfigChooser24 extends ComponentSizeChooser {
public SimpleEGLConfigChooser24(boolean withDepthBuffer, boolean stencil, boolean gles2) {
super(8, 8, 8, 0, withDepthBuffer ? 16 : 0, stencil ? 8 : 0, gles2);
public SimpleEGLConfigChooser24(boolean withDepthBuffer, boolean stencil, boolean gles2, boolean gles3) {
super(8, 8, 8, 0, withDepthBuffer ? 16 : 0, stencil ? 8 : 0, gles2, gles3);
mRedSize = 8;
mGreenSize = 8;
mBlueSize = 8;
@@ -824,21 +835,21 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call
}
private static class SimpleEGLConfigChooser32 extends ComponentSizeChooser {
public SimpleEGLConfigChooser32(boolean withDepthBuffer, boolean stencil, boolean gles2) {
super(8, 8, 8, 8, withDepthBuffer ? 16 : 0, stencil ? 8 : 0, gles2);
public SimpleEGLConfigChooser32(boolean withDepthBuffer, boolean stencil, boolean gles2, boolean gles3) {
super(8, 8, 8, 8, withDepthBuffer ? 16 : 0, stencil ? 8 : 0, gles2, gles3);
mRedSize = 8;
mGreenSize = 8;
mBlueSize = 8;
mAlphaSize = 8;
}
}
private static ComponentSizeChooser getEglConfigChooser(int videoDepthBpp, boolean withDepthBuffer, boolean stencil, boolean gles2) {
private static ComponentSizeChooser getEglConfigChooser(int videoDepthBpp, boolean withDepthBuffer, boolean stencil, boolean gles2, boolean gles3) {
if(videoDepthBpp == 16)
return new SimpleEGLConfigChooser16(withDepthBuffer, stencil, gles2);
return new SimpleEGLConfigChooser16(withDepthBuffer, stencil, gles2, gles3);
if(videoDepthBpp == 24)
return new SimpleEGLConfigChooser24(withDepthBuffer, stencil, gles2);
return new SimpleEGLConfigChooser24(withDepthBuffer, stencil, gles2, gles3);
if(videoDepthBpp == 32)
return new SimpleEGLConfigChooser32(withDepthBuffer, stencil, gles2);
return new SimpleEGLConfigChooser32(withDepthBuffer, stencil, gles2, gles3);
return null;
};
@@ -883,9 +894,12 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call
*/
final int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
final int[] gles2_attrib_list = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE };
final int[] gles3_attrib_list = {EGL_CONTEXT_CLIENT_VERSION, 3, EGL10.EGL_NONE };
mEglContext = mEgl.eglCreateContext(mEglDisplay, mEglConfig,
EGL10.EGL_NO_CONTEXT, mEGLConfigChooser.isGles2Required() ? gles2_attrib_list : null );
EGL10.EGL_NO_CONTEXT,
mEGLConfigChooser.isGles3Required() ? gles3_attrib_list :
mEGLConfigChooser.isGles2Required() ? gles2_attrib_list : null );
if( mEglContext == null || mEglContext == EGL10.EGL_NO_CONTEXT )
Log.e("SDL", "GLSurfaceView_SDL::EglHelper::start(): mEglContext is EGL_NO_CONTEXT, error: " + mEgl.eglGetError());

View File

@@ -40,6 +40,7 @@ class Globals
public static boolean NeedDepthBuffer = false;
public static boolean NeedStencilBuffer = false;
public static boolean NeedGles2 = false;
public static boolean NeedGles3 = false;
public static boolean CompatibilityHacksVideo = false;
public static boolean CompatibilityHacksForceScreenUpdateMouseClick = true;
public static boolean CompatibilityHacksStaticInit = false;

View File

@@ -1251,13 +1251,20 @@ public class MainActivity extends Activity
{
try
{
if(Globals.NeedGles2)
if(Globals.NeedGles3)
{
System.loadLibrary("GLESv3");
Log.i("SDL", "libSDL: loaded GLESv3 lib");
}
else if(Globals.NeedGles2)
{
System.loadLibrary("GLESv2");
Log.i("SDL", "libSDL: loaded GLESv2 lib");
Log.i("SDL", "libSDL: loaded GLESv2 lib");
}
}
catch ( UnsatisfiedLinkError e )
{
Log.i("SDL", "libSDL: Cannot load GLESv2 lib");
Log.i("SDL", "libSDL: Cannot load GLESv3 or GLESv2 lib");
}
// Load all libraries

View File

@@ -553,7 +553,7 @@ class Settings
static void Apply(MainActivity p)
{
setEnvVars(p);
nativeSetVideoDepth(Globals.VideoDepthBpp, Globals.NeedGles2 ? 1 : 0);
nativeSetVideoDepth(Globals.VideoDepthBpp, Globals.NeedGles2 ? 1 : 0, Globals.NeedGles3 ? 1 : 0);
if(Globals.VideoLinearFilter)
nativeSetVideoLinearFilter();
if( Globals.CompatibilityHacksVideo )
@@ -958,7 +958,7 @@ class Settings
private static native void nativeSetMultitouchUsed();
private static native void nativeSetTouchscreenKeyboardUsed();
private static native void nativeSetVideoLinearFilter();
private static native void nativeSetVideoDepth(int bpp, int gles2);
private static native void nativeSetVideoDepth(int bpp, int gles2, int gles3);
private static native void nativeSetCompatibilityHacks();
private static native void nativeSetVideoMultithreaded();
private static native void nativeSetVideoForceSoftwareMode();

View File

@@ -991,7 +991,7 @@ class DemoGLSurfaceView extends GLSurfaceView_SDL {
public DemoGLSurfaceView(MainActivity context) {
super(context);
mParent = context;
setEGLConfigChooser(Globals.VideoDepthBpp, Globals.NeedDepthBuffer, Globals.NeedStencilBuffer, Globals.NeedGles2);
setEGLConfigChooser(Globals.VideoDepthBpp, Globals.NeedDepthBuffer, Globals.NeedStencilBuffer, Globals.NeedGles2, Globals.NeedGles3);
mRenderer = new DemoRenderer(context);
setRenderer(mRenderer);
}

View File

@@ -46,9 +46,13 @@ NeedDepthBuffer=n
# Enable OpenGL stencil buffer (needed only for 3-d applications, small speed decrease) (y) or (n)
NeedStencilBuffer=n
# Try to use GLES 2.x context - will revert to GLES 1.X if unsupported by device
# Use GLES 2.x context
# you need this option only if you're developing 3-d app (y) or (n)
NeedGles2=y
NeedGles2=n
# Use GLES 3.x context
# you need this option only if you're developing 3-d app (y) or (n)
NeedGles3=y
# Use glshim library for provide OpenGL 1.x functionality to OpenGL ES accelerated cards (y) or (n)
UseGlshim=
@@ -253,7 +257,7 @@ CompiledLibraries="sdl_image freetype glu"
CustomBuildScript=n
# Aditional CFLAGS for application
AppCflags='-O2 -flto'
AppCflags='-O2 -flto -isystem jni/application/src/src/src/base/android'
# Aditional C++-specific compiler flags for application, added after AppCflags
AppCppflags=''
@@ -265,7 +269,7 @@ AppLdflags='-lEGL -flto'
AppOverlapsSystemHeaders=n
# Build only following subdirs (empty will build all dirs, ignored with custom script)
AppSubdirsBuild='src/src src/src/base/system.c src/src/engine src/src/engine/client src/src/engine/shared src/src/engine/external/pnglite src/src/engine/external/wavpack src/src/engine/external/json-parser src/src/game src/src/game/client/* src/src/game/editor src/src/game/generated/protocol.cpp src/src/game/generated/client_data.cpp'
AppSubdirsBuild='src/src src/src/base/android src/src/base/system.c src/src/engine src/src/engine/client src/src/engine/shared src/src/engine/external/pnglite src/src/engine/external/wavpack src/src/engine/external/json-parser src/src/game src/src/game/client/* src/src/game/editor src/src/game/generated/protocol.cpp src/src/game/generated/client_data.cpp'
# Exclude these files from build
AppBuildExclude=''

View File

@@ -28,7 +28,7 @@ zip -r ../AndroidData/data.zip data *.txt *.cfg >/dev/null
for ARCH in armeabi-v7a x86; do
[ -e ../AndroidData/binaries-$ARCH.zip ] && continue
rm -rf teeworlds_srv
rm -rf ninslash_srv
mkdir -p objs
# server-sources.txt generated by running bam server_release 2>&1 | tee build.log
# and parsing logs with grep -o ' [^ ]*[.]cp\?p\?' build.log | grep -v /zlib/ > ../server-sources.txt
@@ -47,13 +47,13 @@ for ARCH in armeabi-v7a x86; do
$CXX $CFLAGS -fno-exceptions -fno-rtti $OBJS $LDFLAGS -pie -flto -pthread -o ninslash_srv || exit 1
$STRIP --strip-unneeded ninslash_srv
' || exit 1
mkdir -p bin-$ARCH
cp ninslash_srv bin-$ARCH/
cd bin-$ARCH
zip ../../AndroidData/binaries-$ARCH.zip *
cd ..
mkdir -p bin/$ARCH
mv -f ninslash_srv bin/$ARCH/
cd bin/$ARCH
zip ../../../AndroidData/binaries-$ARCH.zip *
cd ../..
done
cp -f logo.png ../AndroidData/
ln -s ../src/logo.png ../AndroidData/
exit 0

View File

@@ -0,0 +1,28 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/**
* \file SDL_clipboard.h
*
* Include file for SDL clipboard handling
*/
#include "SDL_screenkeyboard.h" /* SDL2 lololol */

View File

@@ -146,7 +146,6 @@ 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()
@@ -218,13 +217,21 @@ static SDL_VideoDevice *ANDROID_CreateDevice(int devindex)
device->handles_any_size = 1; // Any video mode is OK
glLibraryHandle = dlopen("libGLESv1_CM.so", RTLD_NOW | RTLD_GLOBAL);
if(SDL_ANDROID_UseGles2)
if ( SDL_ANDROID_UseGles3 )
{
gl2LibraryHandle = dlopen("libGLESv2.so", RTLD_NOW | RTLD_GLOBAL);
__android_log_print(ANDROID_LOG_INFO, "libSDL", "Loading libGLESv2.so: %p", gl2LibraryHandle);
glLibraryHandle = dlopen("libGLESv3.so", RTLD_LAZY | RTLD_GLOBAL);
__android_log_print(ANDROID_LOG_INFO, "libSDL", "Loading libGLESv3.so: %p", glLibraryHandle);
}
else if ( SDL_ANDROID_UseGles2 )
{
glLibraryHandle = dlopen("libGLESv2.so", RTLD_LAZY | RTLD_GLOBAL);
__android_log_print(ANDROID_LOG_INFO, "libSDL", "Loading libGLESv2.so: %p", glLibraryHandle);
}
else
{
glLibraryHandle = dlopen("libGLESv1_CM.so", RTLD_LAZY | RTLD_GLOBAL);
}
return device;
}
@@ -1240,11 +1247,9 @@ void SDL_ANDROID_VideoContextRecreated()
static void* ANDROID_GL_GetProcAddress(_THIS, const char *proc)
{
#ifdef USE_GLSHIM
void * func = glXGetProcAddress(proc);
void * func = glXGetProcAddress(proc);
#else
void * func = dlsym(glLibraryHandle, proc);
if(!func && gl2LibraryHandle)
func = dlsym(gl2LibraryHandle, proc);
#endif
__android_log_print(ANDROID_LOG_INFO, "libSDL", "ANDROID_GL_GetProcAddress(\"%s\"): %p", proc, func);
return func;

View File

@@ -99,6 +99,7 @@ int SDL_ANDROID_CompatibilityHacks = 0;
int SDL_ANDROID_BYTESPERPIXEL = 2;
int SDL_ANDROID_BITSPERPIXEL = 16;
int SDL_ANDROID_UseGles2 = 0;
int SDL_ANDROID_UseGles3 = 0;
int SDL_ANDROID_ShowMouseCursor = 0;
SDL_Rect SDL_ANDROID_VideoDebugRect;
SDL_Color SDL_ANDROID_VideoDebugRectColor;
@@ -431,11 +432,12 @@ JAVA_EXPORT_NAME(Settings_nativeSetCompatibilityHacks) (JNIEnv* env, jobject thi
}
JNIEXPORT void JNICALL
JAVA_EXPORT_NAME(Settings_nativeSetVideoDepth) (JNIEnv* env, jobject thiz, jint bpp, jint UseGles2)
JAVA_EXPORT_NAME(Settings_nativeSetVideoDepth) (JNIEnv* env, jobject thiz, jint bpp, jint UseGles2, jint UseGles3)
{
SDL_ANDROID_BITSPERPIXEL = bpp;
SDL_ANDROID_BYTESPERPIXEL = SDL_ANDROID_BITSPERPIXEL / 8;
SDL_ANDROID_UseGles2 = UseGles2;
SDL_ANDROID_UseGles3 = UseGles3;
}
void SDLCALL SDL_ANDROID_GetClipboardText(char * buf, int len)

View File

@@ -55,6 +55,7 @@ extern int SDL_ANDROID_VideoForceSoftwareMode;
extern int SDL_ANDROID_CompatibilityHacks;
extern int SDL_ANDROID_ShowMouseCursor;
extern int SDL_ANDROID_UseGles2;
extern int SDL_ANDROID_UseGles3;
extern int SDL_ANDROID_BYTESPERPIXEL;
extern int SDL_ANDROID_BITSPERPIXEL;
extern void SDL_ANDROID_TextInputInit(char * buffer, int len);

View File

@@ -17,8 +17,6 @@ TODO, which will get actually done
- UQM HD: add fonts from http://mosc-portal.bursa.ru/showthread.php?t=206 and switch back to joystick controls, set 4:3 aspect ratio as default.
- SDL: implement SDL_GL_LoadLibrary() / SDL_GL_GetProcAddress() / SDL_GL_SetAttribute() / SDL_GL_GetAttribute().
- SDL: CompatibilityHacksForceScreenUpdate=y does not redraw screen after putting to background and restoring.
- SDL: request SD card permission on Android 6.