Author Topic: Glide GL ES 2.0 Port (WIP)  (Read 44113 times)

Offline littleguy

  • Moderator
  • double
  • *****
  • Posts: 1945
    • View Profile
Re: Glide GL ES 2.0 Port (WIP)
« Reply #60 on: April 17, 2013, 11:35:14 AM »
I printed out the shader program source code and looks like the program is getting truncated before it compiles -- in the first shader the trailing '}' gets chopped off, leading to a malformed program, which the driver then balks at (still seems like it should be a graceful failure though).  I'm going to work through the strings and concatenations and see if I can figure out the reason for the truncation.

Edit: It might be a preprocessor concatenation error, not necessarily a strcat() error...
Edit2: Definitely something weird going on in the preprocessor.  Not concatenating #defined strings properly.
« Last Edit: April 17, 2013, 11:59:42 AM by littleguy »
2012 Nexus 7, rooted stock Lollipop
Samsung Galaxy Victory, rooted stock Jelly Bean
Xperia PLAY, stock Gingerbread
OUYA, retail version

Offline Kris

  • Developer
  • int
  • *****
  • Posts: 91
    • View Profile
Re: Glide GL ES 2.0 Port (WIP)
« Reply #61 on: April 17, 2013, 03:00:45 PM »
There could be a bug there but I'd be more inclined to think it is just a problem with the log method handling long strings, var-args or newlines. There a bad mix between 1024 and 4096 buffers which might be the culprit. I think each plugin defines a few log methods then there is mupens which has a few callbacks then there are the changes to use logcat instead of print it's all a bit messy really.

I think it is just the nvidia driver crashing because 'gl_FragDepth = ... ' is illegal.

I pushed a related fix that I did a while ago to check the shaders compile and link ok, ironically I didn't push it earlier as I knew the part were discussing now would output a msg for every device. It's not a fix for the tegra problems though, I would just stick with the version you did with it commented out.
« Last Edit: April 17, 2013, 03:05:52 PM by Kris »

Offline littleguy

  • Moderator
  • double
  • *****
  • Posts: 1945
    • View Profile
Re: Glide GL ES 2.0 Port (WIP)
« Reply #62 on: April 17, 2013, 03:52:23 PM »
Yeah, I think you're right about the log limiting the output.  Maybe the cleanest way to deal with this is to just surround that whole block with #ifndef ANDROID .... #endif to minimize diff/conflict with upstream.
2012 Nexus 7, rooted stock Lollipop
Samsung Galaxy Victory, rooted stock Jelly Bean
Xperia PLAY, stock Gingerbread
OUYA, retail version

Offline Kris

  • Developer
  • int
  • *****
  • Posts: 91
    • View Profile
Re: Glide GL ES 2.0 Port (WIP)
« Reply #63 on: April 17, 2013, 07:06:26 PM »
That remote testing payed off, with it running I noticed problems beyond what I saw in the screenshots like the smeared texture coordinates, this reminded me of the same issue with rice and by using high precision for the vertex attributes it works ok.

I will try and find the appropriate offset values for different devices next, and either comment out the code causing crashes on nvidia or let littleguy do it.

The latest commit works with SDL 2 (not tested 1 yet) and as littleguy mentioned using the CoreVideo functions now works so I will revert that code back.

I do think it's kinda cool using a device based in another country to fix a bug  8)
« Last Edit: April 17, 2013, 07:17:34 PM by Kris »

Offline littleguy

  • Moderator
  • double
  • *****
  • Posts: 1945
    • View Profile
Re: Glide GL ES 2.0 Port (WIP)
« Reply #64 on: April 17, 2013, 07:45:13 PM »
I'm happy to help with whatever.  Should we mirror your work over to github now?  Would be nice to have everything in one place but I can work with it either way.
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: 3495
  • Developer
    • View Profile
    • PaulsCode.Com
Re: Glide GL ES 2.0 Port (WIP)
« Reply #65 on: April 17, 2013, 08:55:30 PM »
@Kris I gave you write access to the github repository, if you want to bring it over yourself.
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 Kris

  • Developer
  • int
  • *****
  • Posts: 91
    • View Profile
Re: Glide GL ES 2.0 Port (WIP)
« Reply #66 on: April 17, 2013, 09:47:11 PM »
I'm happy to help with whatever.  Should we mirror your work over to github now?  Would be nice to have everything in one place but I can work with it either way.
@Kris I gave you write access to the github repository, if you want to bring it over yourself.
Done.

Offline littleguy

  • Moderator
  • double
  • *****
  • Posts: 1945
    • View Profile
Re: Glide GL ES 2.0 Port (WIP)
« Reply #67 on: April 17, 2013, 09:49:56 PM »
Awesome, thanks Kris.
2012 Nexus 7, rooted stock Lollipop
Samsung Galaxy Victory, rooted stock Jelly Bean
Xperia PLAY, stock Gingerbread
OUYA, retail version

Offline littleguy

  • Moderator
  • double
  • *****
  • Posts: 1945
    • View Profile
Re: Glide GL ES 2.0 Port (WIP)
« Reply #68 on: April 17, 2013, 10:05:17 PM »
I'll post my additions on a separate branch tonight.
2012 Nexus 7, rooted stock Lollipop
Samsung Galaxy Victory, rooted stock Jelly Bean
Xperia PLAY, stock Gingerbread
OUYA, retail version

Offline littleguy

  • Moderator
  • double
  • *****
  • Posts: 1945
    • View Profile
Re: Glide GL ES 2.0 Port (WIP)
« Reply #69 on: April 17, 2013, 11:20:33 PM »
Ok, pushed.

I branched from the commit prior to Kris's merge with SDL2.  That allowed me to cherry pick the fixes and my additions and keep with SDL 1.3.  Then as a last step I made another branch that combines glide and SDL2.  Just a safety precaution to help isolate bugs better.  I didn't cherry pick the adreno polygon offset change, since it seemed more experimental (plus would regress some non-adreno devices).  We might want to make a separate branch if we want to get serious with testing offset values.

A few changes I made:
 - Polished up the makefile to match the others, and put it in the "official" mupen plugin dir structure.
 - I took a less aggressive approach to the tegra segfault bugfix, only omitting a small portion of the code, and doing it with #ifndef ANDROID rather than comments (easier to diff with upstream)
 - When I did the merge with master, I did it in the reverse direction so that the changeset was smaller and easier to read.
 - Separated some merges/changes into separate commits for clarity.

I consider these branches completely public, so do with them as you please.  I'll probably make my own "tinkering" branches off of these.
2012 Nexus 7, rooted stock Lollipop
Samsung Galaxy Victory, rooted stock Jelly Bean
Xperia PLAY, stock Gingerbread
OUYA, retail version

Offline xperia64

  • Moderator
  • double
  • *****
  • Posts: 591
    • View Profile
    • My Apps
Re: Glide GL ES 2.0 Port (WIP)
« Reply #70 on: April 24, 2013, 08:13:16 PM »
Animal Forest/Dobutsu no Mori inventory screen is buggy: http://imgur.com/58ZFqJZ
I don't mind the messed up colors but the black square in the upper left corner needs to be fixed.
For some reason when you dismiss the inventory, your character (in the center of the black square) appears fine. I do not believe it is a framebuffer issue but I could be mistaken.

Offline Kris

  • Developer
  • int
  • *****
  • Posts: 91
    • View Profile
Re: Glide GL ES 2.0 Port (WIP)
« Reply #71 on: April 26, 2013, 12:31:58 PM »
Animal Forest/Dobutsu no Mori inventory screen is buggy: http://imgur.com/58ZFqJZ
I don't mind the messed up colors but the black square in the upper left corner needs to be fixed.
For some reason when you dismiss the inventory, your character (in the center of the black square) appears fine. I do not believe it is a framebuffer issue but I could be mistaken.
Those issues do seem to happen on the PC too, I've seen the incorrect colours in other plugins too so maybe some pixelformat has problems.

Offline littleguy

  • Moderator
  • double
  • *****
  • Posts: 1945
    • View Profile
Re: Glide GL ES 2.0 Port (WIP)
« Reply #72 on: April 26, 2013, 02:27:08 PM »
Has anyone tried using this to locate bottlenecks?
http://developer.android.com/tools/help/gltracer.html

Only works for Android 4.1 and up, though there seems to be a bug with it in the latest JB version.  Any dev out there with a 4.1 device?
2012 Nexus 7, rooted stock Lollipop
Samsung Galaxy Victory, rooted stock Jelly Bean
Xperia PLAY, stock Gingerbread
OUYA, retail version

Offline Kris

  • Developer
  • int
  • *****
  • Posts: 91
    • View Profile
Re: Glide GL ES 2.0 Port (WIP)
« Reply #73 on: April 26, 2013, 03:28:21 PM »
Has anyone tried using this to locate bottlenecks?
http://developer.android.com/tools/help/gltracer.html

Only works for Android 4.1 and up, though there seems to be a bug with it in the latest JB version.  Any dev out there with a 4.1 device?
It's much more basic than the tools provided by the gpu vendors. The adreno profiler was good when I used it on WebOS although when I tried it on android it was more unstable and had gfx problems. Tools for gl in general seem to be lacking compared to the directx ones.

Large parts of the of all the gfx plugins are executed on the cpu anyway including tasks like transform and lighting which is usually done on the gpu.


Offline littleguy

  • Moderator
  • double
  • *****
  • Posts: 1945
    • View Profile
Re: Glide GL ES 2.0 Port (WIP)
« Reply #74 on: April 26, 2013, 03:32:50 PM »
I see.  Well I expected most of the bottlenecks would be inside the GPU calculations but thought perhaps a profiling tool could shed insight into what's consuming the most time.  Then again almost all my gl experience is with old 1.x and immediate mode.  Maybe shader programs make it harder to profile....
2012 Nexus 7, rooted stock Lollipop
Samsung Galaxy Victory, rooted stock Jelly Bean
Xperia PLAY, stock Gingerbread
OUYA, retail version