Author Topic: SDL 2.0  (Read 8777 times)

Offline littleguy

  • Moderator
  • double
  • *****
  • Posts: 1945
    • View Profile
SDL 2.0
« on: March 24, 2013, 01:37:54 PM »
Looking forward to SDL 2.0 integration.  After working with gles2rice for awhile now I must say it would be really nice if we can maintain a reference to the upstream source, the way Sven does with the core and plugins.  Was this the plan?
2012 Nexus 7, rooted stock Lollipop
Samsung Galaxy Victory, rooted stock Jelly Bean
Xperia PLAY, stock Gingerbread
OUYA, retail version

Offline Paul

  • Administrator
  • double
  • *****
  • Posts: 3499
  • Developer
    • View Profile
    • PaulsCode.Com
Re: SDL 2.0
« Reply #1 on: March 24, 2013, 02:03:52 PM »
Yes, that is the hope.  For now I just need to get it working.  I'm having trouble getting Rice to compile.  I might have to just disable Rice for now and get the rest of it working.
Device: Samsung Galaxy Nexus i515
CPU: TI OMAP4460, 1.2 GHz (dual core, ARM Cortex-A9)
GPU: PowerVR SGX540, 307 MHz
RAM: 1 GB
Resolution: 720 x 1280
Rom: omni-4.4.4-20141014-toro-FML KitKat 4.4.4, rooted

Device: Eee PC 1015PEM
CPU: Intel Atom N550, 1.5 GHz (dual core, x86)
GPU: Intel GMA 3150, 200 MHz (dual core)
RAM: 2GB
Resolution: 1024 x 600
Rom: android-x86-4.3-20130725 Jelly Bean 4.3, rooted

Offline Paul

  • Administrator
  • double
  • *****
  • Posts: 3499
  • Developer
    • View Profile
    • PaulsCode.Com
Re: SDL 2.0
« Reply #2 on: March 24, 2013, 02:06:26 PM »
I should point out that changes on the Java side will be more difficult to keep synchronized due to refractoring.
Device: Samsung Galaxy Nexus i515
CPU: TI OMAP4460, 1.2 GHz (dual core, ARM Cortex-A9)
GPU: PowerVR SGX540, 307 MHz
RAM: 1 GB
Resolution: 720 x 1280
Rom: omni-4.4.4-20141014-toro-FML KitKat 4.4.4, rooted

Device: Eee PC 1015PEM
CPU: Intel Atom N550, 1.5 GHz (dual core, x86)
GPU: Intel GMA 3150, 200 MHz (dual core)
RAM: 2GB
Resolution: 1024 x 600
Rom: android-x86-4.3-20130725 Jelly Bean 4.3, rooted

Offline littleguy

  • Moderator
  • double
  • *****
  • Posts: 1945
    • View Profile
Re: SDL 2.0
« Reply #3 on: March 24, 2013, 02:25:51 PM »
Cool.  Feel free to push what you have to an experimental branch.  One reason I'm eager to see it is because I'm in the final stages of having a fully integrated rice plugin.  On thing that remains is related to sdl and i'd just as soon invest the time with sdl2.  See my gles2rice branch for more.

Regarding Jni, would be good to modularize it into a single class if possible.  Better, make a separate native shared lib to contain our changes, that we link SDL and the core stuff to.  Idea being we only modify a few lines of the pristine sources.
2012 Nexus 7, rooted stock Lollipop
Samsung Galaxy Victory, rooted stock Jelly Bean
Xperia PLAY, stock Gingerbread
OUYA, retail version

Offline Paul

  • Administrator
  • double
  • *****
  • Posts: 3499
  • Developer
    • View Profile
    • PaulsCode.Com
Re: SDL 2.0
« Reply #4 on: March 24, 2013, 03:28:54 PM »
The problem is something that changed with the headers.  Spitting out tons of errors like "'GLenum does not name a type".  I've been trying to track down exactly where in SDL2 the header changed to cause this, but I suppose I could just go hog-wild on the Rice sources to add these everywhere:
Code: [Select]
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>

Those should be getting included from jni/SDL/include/SDL_opengles2.h, so the best solution would be to figure out what happened between SDL 1.3 and 2.0 which caused that particular header not to be included.  Probably best to hack it together for now so I can finish the Java side and debug the JNI linkage if there are any problems.
Device: Samsung Galaxy Nexus i515
CPU: TI OMAP4460, 1.2 GHz (dual core, ARM Cortex-A9)
GPU: PowerVR SGX540, 307 MHz
RAM: 1 GB
Resolution: 720 x 1280
Rom: omni-4.4.4-20141014-toro-FML KitKat 4.4.4, rooted

Device: Eee PC 1015PEM
CPU: Intel Atom N550, 1.5 GHz (dual core, x86)
GPU: Intel GMA 3150, 200 MHz (dual core)
RAM: 2GB
Resolution: 1024 x 600
Rom: android-x86-4.3-20130725 Jelly Bean 4.3, rooted

Offline Paul

  • Administrator
  • double
  • *****
  • Posts: 3499
  • Developer
    • View Profile
    • PaulsCode.Com
Re: SDL 2.0
« Reply #5 on: March 24, 2013, 03:44:15 PM »
Ok, I think I'm actually getting closer.  I started adding in those hacks, and eliminated most of the noise, leaving this:

Code: [Select]
jni/gles2rice/projects/android/../../src/OGLFragmentShaders.cpp:35:13: error: expected ',' or ';' before 'GLSL_VERSION'
A global search for GLSL_VERSION shows it is defined in jni/gles2rice/src/osal_opengl.h:

Code: [Select]
#include <SDL_config.h>

#if SDL_VIDEO_OPENGL
#include <SDL_opengl.h>
#define GLSL_VERSION "120"

#elif SDL_VIDEO_OPENGL_ES2
#include <SDL_opengles2.h>
#define GLSL_VERSION "100"

So the only way it wouldn't be defined is if neither SDL_VIDEO_OPENGL nor SDL_VIDEO_OPENGL_ES2 were defined.  Interestingly, if neither of those were defined, the gl header wouldn't be included either (explaining all those tons of errors).  So I now know I am looking for differences between SDL1.3 and SDL2 that involve the symbol SDL_VIDEO_OPENGL_ES2
Device: Samsung Galaxy Nexus i515
CPU: TI OMAP4460, 1.2 GHz (dual core, ARM Cortex-A9)
GPU: PowerVR SGX540, 307 MHz
RAM: 1 GB
Resolution: 720 x 1280
Rom: omni-4.4.4-20141014-toro-FML KitKat 4.4.4, rooted

Device: Eee PC 1015PEM
CPU: Intel Atom N550, 1.5 GHz (dual core, x86)
GPU: Intel GMA 3150, 200 MHz (dual core)
RAM: 2GB
Resolution: 1024 x 600
Rom: android-x86-4.3-20130725 Jelly Bean 4.3, rooted

Offline Paul

  • Administrator
  • double
  • *****
  • Posts: 3499
  • Developer
    • View Profile
    • PaulsCode.Com
Re: SDL 2.0
« Reply #6 on: March 24, 2013, 03:55:18 PM »
OMG, I am an idiot!  You already fixed this problem in commit 169ec16703.   :-[
Device: Samsung Galaxy Nexus i515
CPU: TI OMAP4460, 1.2 GHz (dual core, ARM Cortex-A9)
GPU: PowerVR SGX540, 307 MHz
RAM: 1 GB
Resolution: 720 x 1280
Rom: omni-4.4.4-20141014-toro-FML KitKat 4.4.4, rooted

Device: Eee PC 1015PEM
CPU: Intel Atom N550, 1.5 GHz (dual core, x86)
GPU: Intel GMA 3150, 200 MHz (dual core)
RAM: 2GB
Resolution: 1024 x 600
Rom: android-x86-4.3-20130725 Jelly Bean 4.3, rooted

Offline Paul

  • Administrator
  • double
  • *****
  • Posts: 3499
  • Developer
    • View Profile
    • PaulsCode.Com
Re: SDL 2.0
« Reply #7 on: March 24, 2013, 04:23:50 PM »
Cool, so the rice sources compile now.  Last problem to deal with is:

Code: [Select]
SharedLibrary  : libgles2rice.so
/home/paul/bin/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: error: ./obj/local/armeabi/objs/gles2rice/__/__/src/Video.o: multiple definition of 'initialized_video'
/home/paul/bin/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs/gles2rice/__/__/src/OGLGraphicsContext.o: previous definition here

I think this is due to both files including jni/core/src/api/vidext_sdl2_compat.h, which is where that int is defined.  Hmm.. I'll have to think about this one.
Device: Samsung Galaxy Nexus i515
CPU: TI OMAP4460, 1.2 GHz (dual core, ARM Cortex-A9)
GPU: PowerVR SGX540, 307 MHz
RAM: 1 GB
Resolution: 720 x 1280
Rom: omni-4.4.4-20141014-toro-FML KitKat 4.4.4, rooted

Device: Eee PC 1015PEM
CPU: Intel Atom N550, 1.5 GHz (dual core, x86)
GPU: Intel GMA 3150, 200 MHz (dual core)
RAM: 2GB
Resolution: 1024 x 600
Rom: android-x86-4.3-20130725 Jelly Bean 4.3, rooted

Offline littleguy

  • Moderator
  • double
  • *****
  • Posts: 1945
    • View Profile
Re: SDL 2.0
« Reply #8 on: March 24, 2013, 04:40:07 PM »
Suspense is killing me, please push a branch  :D  Or else I'm gonna have to do it myself ;D  I've been really in the thick of dependencies lately with the cleanup I did to the makefiles and gles2rice, so I feel kind of primed to help solve it.
2012 Nexus 7, rooted stock Lollipop
Samsung Galaxy Victory, rooted stock Jelly Bean
Xperia PLAY, stock Gingerbread
OUYA, retail version

Offline Paul

  • Administrator
  • double
  • *****
  • Posts: 3499
  • Developer
    • View Profile
    • PaulsCode.Com
Re: SDL 2.0
« Reply #9 on: March 24, 2013, 04:42:50 PM »
Ok, I'll push what I have.  It is NOT buildable yet though.
Device: Samsung Galaxy Nexus i515
CPU: TI OMAP4460, 1.2 GHz (dual core, ARM Cortex-A9)
GPU: PowerVR SGX540, 307 MHz
RAM: 1 GB
Resolution: 720 x 1280
Rom: omni-4.4.4-20141014-toro-FML KitKat 4.4.4, rooted

Device: Eee PC 1015PEM
CPU: Intel Atom N550, 1.5 GHz (dual core, x86)
GPU: Intel GMA 3150, 200 MHz (dual core)
RAM: 2GB
Resolution: 1024 x 600
Rom: android-x86-4.3-20130725 Jelly Bean 4.3, rooted

Offline littleguy

  • Moderator
  • double
  • *****
  • Posts: 1945
    • View Profile
Re: SDL 2.0
« Reply #10 on: March 24, 2013, 04:49:37 PM »
Great, that's fine if not buildable.
2012 Nexus 7, rooted stock Lollipop
Samsung Galaxy Victory, rooted stock Jelly Bean
Xperia PLAY, stock Gingerbread
OUYA, retail version

Offline Paul

  • Administrator
  • double
  • *****
  • Posts: 3499
  • Developer
    • View Profile
    • PaulsCode.Com
Re: SDL 2.0
« Reply #11 on: March 24, 2013, 04:53:10 PM »
Ok, I'll work on the Java components for a while then.  Maybe the solution to that integer redefinition problem will come to you first (should be the last thing left to complete the native code).
Device: Samsung Galaxy Nexus i515
CPU: TI OMAP4460, 1.2 GHz (dual core, ARM Cortex-A9)
GPU: PowerVR SGX540, 307 MHz
RAM: 1 GB
Resolution: 720 x 1280
Rom: omni-4.4.4-20141014-toro-FML KitKat 4.4.4, rooted

Device: Eee PC 1015PEM
CPU: Intel Atom N550, 1.5 GHz (dual core, x86)
GPU: Intel GMA 3150, 200 MHz (dual core)
RAM: 2GB
Resolution: 1024 x 600
Rom: android-x86-4.3-20130725 Jelly Bean 4.3, rooted

Offline Paul

  • Administrator
  • double
  • *****
  • Posts: 3499
  • Developer
    • View Profile
    • PaulsCode.Com
Re: SDL 2.0
« Reply #12 on: March 24, 2013, 05:13:47 PM »
Oops, overwrote a couple of fixes there.  Pushed another commit, sorry about that.
Device: Samsung Galaxy Nexus i515
CPU: TI OMAP4460, 1.2 GHz (dual core, ARM Cortex-A9)
GPU: PowerVR SGX540, 307 MHz
RAM: 1 GB
Resolution: 720 x 1280
Rom: omni-4.4.4-20141014-toro-FML KitKat 4.4.4, rooted

Device: Eee PC 1015PEM
CPU: Intel Atom N550, 1.5 GHz (dual core, x86)
GPU: Intel GMA 3150, 200 MHz (dual core)
RAM: 2GB
Resolution: 1024 x 600
Rom: android-x86-4.3-20130725 Jelly Bean 4.3, rooted

Offline littleguy

  • Moderator
  • double
  • *****
  • Posts: 1945
    • View Profile
Re: SDL 2.0
« Reply #13 on: March 24, 2013, 05:37:05 PM »
Where did you pull the SDL source?  I pulled using
Code: [Select]
hg clone http://hg.libsdl.org/SDL but I get a huge diff with what you posted to github.  And not just cosmetic diffs... dozens of function signatures are different.
2012 Nexus 7, rooted stock Lollipop
Samsung Galaxy Victory, rooted stock Jelly Bean
Xperia PLAY, stock Gingerbread
OUYA, retail version

Offline Paul

  • Administrator
  • double
  • *****
  • Posts: 3499
  • Developer
    • View Profile
    • PaulsCode.Com
Re: SDL 2.0
« Reply #14 on: March 24, 2013, 05:39:39 PM »
I am using build 6894.  I pulled it a couple weeks ago when I started the port.  It won't take much to upgrade - I'm just trying to get it working first.
Device: Samsung Galaxy Nexus i515
CPU: TI OMAP4460, 1.2 GHz (dual core, ARM Cortex-A9)
GPU: PowerVR SGX540, 307 MHz
RAM: 1 GB
Resolution: 720 x 1280
Rom: omni-4.4.4-20141014-toro-FML KitKat 4.4.4, rooted

Device: Eee PC 1015PEM
CPU: Intel Atom N550, 1.5 GHz (dual core, x86)
GPU: Intel GMA 3150, 200 MHz (dual core)
RAM: 2GB
Resolution: 1024 x 600
Rom: android-x86-4.3-20130725 Jelly Bean 4.3, rooted