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

Offline Kris

  • Developer
  • int
  • *****
  • Posts: 91
    • View Profile
Glide GL ES 2.0 Port (WIP)
« on: March 27, 2013, 10:31:21 PM »
This is a work-in-progress version of a OpenGL ES 2.0 compatible version of the glide64mk2 plugin.

Source: https://github.com/paulscode/mupen64plus-ae/tree/Metricity/glide

https://bitbucket.org/Metricity/mupen64plus-ae

This is an early version, expect performance and graphical issues.


Java Changes:
   Added option to select glide plugin.

Changes from glide64mk2:
Glitch64/combiner.cpp:
   Alpha Test implemented in shader.
   Custom attributes instead of unsupported built-in attributes (gl_Vertex, gl_MultiTexCoord, gl_Fog, gl_Color).

Glitch64/geometry.cpp:
   Vertex arrays used instead of glBegin/glEnd.
   Some calculations are done in the vertex shader so the data can be passed without being modified.
   
Glitch64/main.cpp:
   Android context and swapbuffers.

Glitch64/textures.cpp:
   Use supported texture formats.


Status
Working, perhaps with some issues:
   Geometry, Textures, Shaders, Fog, Alpha Test, Framebuffer
Significant issues:
   Depth buffer related glitches. (On Adreno, OK on PC)
High-res textures:
   This uses boost and is not setup to compile. I have compiled it previously but never got around to testing it.
Screen Size:
   You need to set Width and Height in mupen64plus.cfg [Video-General]
Performance:
   Work on performance hasn't begun and I know of a few places where some easy fixes/optimizations can be made.



My thanks to the original developers and maintainers: Dave2001,Sergey 'Gonetz' Lipski,Gugaman,Hiroshi 'KoolSmoky' Morii, warhaft, ecsv

This is work in progress and I hope to fix the mentioned issues.

Looking forward to your feedback and queries.
   
« Last Edit: April 17, 2013, 09:50:41 PM by Kris »

Offline littleguy

  • Moderator
  • double
  • *****
  • Posts: 1945
    • View Profile
Re: Glide
« Reply #1 on: March 27, 2013, 10:33:02 PM »
Stoked!!!  Looking forward to trying it out!
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
« Reply #2 on: March 27, 2013, 10:47:31 PM »
Funny, I just started looking at glide today, just seeing how many source files I could get to compile while flying blind.  I knew a lot of the gl stuff would balk but I wasn't expecting to have such trouble with boost.  Dependency hell.  I eventually determined a fairly minimal subset of boost that would get the GlideHQ source to compile.  But when I reopened eclipse the indexer crashed and burned.  I was tinkering with the eclipse heap settings when this showed up in my inbox.  Judging by your comments, did you wall off the boost dependency or something?

One of the other things I'm looking at right now is the SDL startup mechanics used by mupen-AE, to see if we can simplify it at all, or even revert somehow to the vanilla mupen mechanics.  If I make any progress I'll keep you posted, would be nice to not have so many custom AE-specific changes to the upstream source.

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
« Reply #3 on: March 27, 2013, 11:09:57 PM »
Funny, I just started looking at glide today, just seeing how many source files I could get to compile while flying blind.  I knew a lot of the gl stuff would balk but I wasn't expecting to have such trouble with boost.  Dependency hell.  I eventually determined a fairly minimal subset of boost that would get the GlideHQ source to compile.  But when I reopened eclipse the indexer crashed and burned.  I was tinkering with the eclipse heap settings when this showed up in my inbox.  Judging by your comments, did you wall off the boost dependency or something?

I know the feeling, I had plenty of troubles with boost but did have everything compiling, it was only earlier today I looked at eliminating it to make it easier for people to test. It turned out to be really simple and I wish I knew it earlier see the changes to Glide64/TexCache.cpp and Glide64/rdp.h.

I did an draft of the post when I thought people would need to build boost which had some pointers:
Quote
I used the version at https://github.com/mcxiaoke/boost-ndk
Configured it to build with gcc4.6 by modifiying boost\tools\build\v2\user-config.jam
Then built the required modules `b2 -a --with-system --with-thread --with-filesystem toolset=gcc-android4.6 link=static runtime-link=static target-os=linux --stagedir=android --layout=system`
There is another boost for android that seems more popular by MysticTreeGames but I had problems with it.

Here is the user-config.jam
Code: [Select]
import os ;

if [ os.name ] = CYGWIN || [ os.name ] = NT
{
        androidPlatform = windows ;
}

else if [ os.name ] = LINUX
{
        androidPlatform = linux-x86 ;
}

else if [ os.name ] = MACOSX
{
        androidPlatform = darwin-x86 ;

}

modules.poke : NO_BZIP2 : 1 ;

ANDROID_NDK = .....................;
using gcc : android4.6 :
    $(ANDROID_NDK)/toolchains/arm-linux-androideabi-4.6/prebuilt/$(androidPlatform)/bin/arm-linux-androideabi-g++ :
    <archiver>$(ANDROID_NDK)/toolchains/arm-linux-androideabi-4.6/prebuilt/$(androidPlatform)/bin/arm-linux-androideabi-ar
    <ranlib>$(ANDROID_NDK)/toolchains/arm-linux-androideabi-4.6/prebuilt/$(androidPlatform)/bin/arm-linux-androideabi-ranlib
    <compileflags>--sysroot=$(ANDROID_NDK)/platforms/android-9/arch-arm
    <compileflags>-I$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/4.6/include
    <compileflags>-I$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include
<compileflags>-L$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/4.6/libs
    <compileflags>-DNDEBUG
    <compileflags>-D__GLIBC__
    <compileflags>-DBOOST_NO_INTRINSIC_WCHAR_T
<compileflags>-DPAGE_SIZE=2048
<compileflags>-lgnustl_static
<compileflags>-lsupc++
    <compileflags>-mthumb
    <compileflags>-fno-strict-aliasing
    <compileflags>-O2
        ;

Also check some of the commented out parts in the makefile for how I set it up.

I only eliminated it as it complicated the build process so it will return at some stage. I will test to see if it actually works soon.


Offline littleguy

  • Moderator
  • double
  • *****
  • Posts: 1945
    • View Profile
Re: Glide GL ES 2.0 Port (WIP)
« Reply #4 on: March 27, 2013, 11:13:42 PM »
Priceless.  Thanks!
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 #5 on: March 28, 2013, 12:07:35 AM »
Setting width and height in the cfg doesn't seem to work anymore it was only a temporary method anyway. I had wanted to post it a few days ago but have been sorting out the release instead of doing any of the obvious small fixes.

I had done most of my testing with other dependencies and build settings and was used to it running slower so I was unsure about the performance but now it seems better.

Offline Paul

  • Administrator
  • double
  • *****
  • Posts: 3471
  • Developer
    • View Profile
    • PaulsCode.Com
Re: Glide GL ES 2.0 Port (WIP)
« Reply #6 on: March 28, 2013, 07:48:00 AM »
Great work, Kris!  You've made some amazing progress!
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: Glide GL ES 2.0 Port (WIP)
« Reply #7 on: March 28, 2013, 08:12:11 AM »
Cool, I just got around to actually pulling and building.  It took me a while to realize that you're using git (not hg) on bitbucket... kept getting hg 404 errors. ;)  Is there a reason you didn't branch (or fork) directly in github?

For those of you who (like me) are still working on your gitfu, you can do the following to pull Kris' work into your github-originated local repo:
Spoiler: git • show

Add bitbucket as a second remote: [code]git remote add [Metricity/glide] bitbucket https://bitbucket.org/Metricity/mupen64plus-ae[/code]
Adding [the-stuff-in-brackets] will only track Kris' glide branch, while omitting it will track all the branches (most of which are already tracked from origin).

Fetch the remote bitbucket branch(es): [code]git fetch --all[/code]

Checkout Kris' branch: [code]git checkout -B Metricity/glide bitbucket/Metricity/glide[/code]

From there you can checkout, branch, merge, etc. as always. 

Edit: Don't forget to reload your assets (Settings->Advanced->Reload app resources)
« Last Edit: March 28, 2013, 08:15:30 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 #8 on: March 28, 2013, 08:34:20 AM »
I used bitbucket because I already had an account but mainly because I was expecting to need to add hundreds of files for boost and Regal and I wanted it separate as they would have been +400mb. As these are not necessary anymore I plan to use github as you mentioned.

Offline littleguy

  • Moderator
  • double
  • *****
  • Posts: 1945
    • View Profile
Re: Glide GL ES 2.0 Port (WIP)
« Reply #9 on: March 28, 2013, 08:38:28 AM »
I used bitbucket because I already had an account but mainly because I was expecting to need to add hundreds of files for boost and Regal and I wanted it separate as they would have been +400mb. As these are not necessary anymore I plan to use github as you mentioned.

Ah, yes, thanks for sparing me all that data!

I made a local branch and merged the latest master without conflict. :D   I do get an FC however when I load a game so I'll have to check into it some more.  I'll post the logcat since I'm guessing you'll be interested, but please don't take this to be a support request (I can probably track it down on my own).

Spoiler: logcat • show
[code]
03-28 09:16:54.815: I/GameSurface(29639): surfaceCreated:
03-28 09:16:54.815: I/GameSurface(29639): surfaceChanged:
03-28 09:16:54.815: I/input-android(29639): jniInitInput()
03-28 09:16:54.815: I/SDL(29639): SDL_Android_Init()
03-28 09:16:54.825: V/front-end(29639): Using Android data folder '/storage/emulated/0/Android/data/paulscode.android.mupen64plusae' for config read/write functions
03-28 09:16:54.825: V/front_end(29639):  __  __                         __   _  _   ____  _             
03-28 09:16:54.825: V/front_end(29639): |  \/  |_   _ _ __   ___ _ __  / /_ | || | |  _ \| |_   _ ___
03-28 09:16:54.825: V/front_end(29639): | |\/| | | | | '_ \ / _ \ '_ \| '_ \| || |_| |_) | | | | / __| 
03-28 09:16:54.825: V/front_end(29639): | |  | | |_| | |_) |  __/ | | | (_) |__   _|  __/| | |_| \__ \ 
03-28 09:16:54.825: V/front_end(29639): |_|  |_|\__,_| .__/ \___|_| |_|\___/   |_| |_|   |_|\__,_|___/ 
03-28 09:16:54.825: V/front_end(29639):              |_|         http://code.google.com/p/mupen64plus/ 
03-28 09:16:54.825: V/front_end(29639): Mupen64Plus Console User-Interface Version 1.99.5
03-28 09:16:54.825: V/front_end(29639): UI-Console: attached to core library 'Mupen64Plus Core' version 1.99.5
03-28 09:16:54.825: V/front_end(29639): UI-Console:             Includes support for Dynamic Recompiler.
03-28 09:16:54.825: V/front_end(29639): Core: Updating parameter set version in 'Core' config section to 1.01
03-28 09:16:55.315: V/front_end(29639): Core: Goodname: Super Mario 64 (U) [!]
03-28 09:16:55.315: V/front_end(29639): Core: Name: SUPER MARIO 64     
03-28 09:16:55.315: V/front_end(29639): Core: MD5: 20B854B239203BAF6C961B850A4A51A2
03-28 09:16:55.315: V/front_end(29639): Core: CRC: 635a2bff 8b022326
03-28 09:16:55.315: V/front_end(29639): Core: Imagetype: .z64 (native)
03-28 09:16:55.325: V/front_end(29639): Core: Rom size: 8388608 bytes (or 8 Mb or 64 Megabits)
03-28 09:16:55.325: V/front_end(29639): Core: Version: 1444
03-28 09:16:55.325: V/front_end(29639): Core: Manufacturer: Nintendo
03-28 09:16:55.325: V/front_end(29639): Core: Country: USA
03-28 09:16:55.325: V/front_end(29639): UI-Console Status: Cheat codes disabled.
03-28 09:16:55.325: V/front_end(29639): UI-Console: using Video plugin: 'Glide64mk2 Video Plugin' v1.99.4
03-28 09:16:55.325: V/front_end(29639): UI-Console: using Audio plugin: 'Mupen64Plus SDL Audio Plugin' v1.99.5
03-28 09:16:55.325: V/front_end(29639): UI-Console: using Input plugin: 'Mupen64Plus Android Input Plugin' v1.0.0
03-28 09:16:55.325: V/front_end(29639): UI-Console: using RSP plugin: 'Hacktarux/Azimer High-Level Emulation RSP Plugin' v1.99.5
03-28 09:16:55.325: V/front_end(29639): Video: opening data/Glide64mk2.ini
03-28 09:16:55.435: V/front_end(29639): Video: Using TEXUMA extension.
03-28 09:16:55.435: I/SDL(29639): [STUB] GL_LoadLibrary
03-28 09:16:55.435: V/GameSurface(29639): Starting up OpenGL ES 2.0
03-28 09:16:55.445: I/SDL(29639): [STUB] GL_SetSwapInterval
03-28 09:16:55.445: I/SDL(29639): [STUB] GL_GetSwapInterval
03-28 09:16:55.485: V/front_end(29639): Video: Your video card doesn't support GL_ARB_texture_env_combine extension
03-28 09:16:55.485: V/front_end(29639): Video: Your video card doesn't support GL_ARB_multitexture extension
03-28 09:16:55.485: V/front_end(29639): Video: Your video card doesn't support GL_ARB_texture_mirrored_repeat extension
03-28 09:16:55.485: V/front_end(29639): Video: use_fbo 1
03-28 09:16:55.485: V/front_end(29639): Video: <<UNPRINTABLE-CHARACTERS>>
03-28 09:16:55.485: V/front_end(29639): Video: Compile OK shader 5
03-28 09:16:55.505: A/libc(29639): Fatal signal 11 (SIGSEGV) at 0x5469e1da (code=2), thread 29665 (d.mupen64plusae)
[/code]
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 #10 on: March 28, 2013, 09:17:34 AM »
I had it building with recent versions it's just I had a black screen so I went back. I don't know if it is the changes to SDL or GameSurface that caused me problems. Not sure about the crash did you try it without merging the later code?

Offline littleguy

  • Moderator
  • double
  • *****
  • Posts: 1945
    • View Profile
Re: Glide GL ES 2.0 Port (WIP)
« Reply #11 on: March 28, 2013, 09:38:35 AM »
Yeah I was going to try that this evening.  That might be all it is.  As I said, don't sweat it right now.
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: 3471
  • Developer
    • View Profile
    • PaulsCode.Com
Re: Glide GL ES 2.0 Port (WIP)
« Reply #12 on: March 28, 2013, 10:18:40 AM »
BTW, are you looking only for developer feedback at this particular stage, or are you ready to start reaching out to testers yet?  I've been compiling a list of emails for folks with various devices who have volunteered to test the new video plug-in (when it gets to that stage)
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 #13 on: March 28, 2013, 01:25:20 PM »
BTW, are you looking only for developer feedback at this particular stage, or are you ready to start reaching out to testers yet?  I've been compiling a list of emails for folks with various devices who have volunteered to test the new video plug-in (when it gets to that stage)
I was used to it running at 5fps and thought the first version would be tricky to build but as I removed the dependencies and tried a non-debug build with a 2-3x improvement we're closer than I thought. On a high end device it might be playable already.

When it is working with the latest version and the depth and screensize issues are fixed testing would be great. Until then anyone is welcome to post an early apk I just didn't want to be swamped with issues when I know there are problems affecting all or many games.

Offline Paul

  • Administrator
  • double
  • *****
  • Posts: 3471
  • Developer
    • View Profile
    • PaulsCode.Com
Re: Glide GL ES 2.0 Port (WIP)
« Reply #14 on: March 28, 2013, 01:40:04 PM »
Ok, sure.  I'll hold of on the big test for now until a few more of the big issues are worked out.

Anyone who wants a "work in progress" apk in the mean time, just PM me and I'll send you a link.
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