Author Topic: GLideN64 Android port  (Read 121898 times)

Offline Gonetz

  • Developer
  • long
  • *****
  • Posts: 104
    • View Profile
Re: GLideN64 Android port
« Reply #315 on: June 06, 2015, 12:01:19 PM »
You can build the project and deploy it to the device. That is enough.

So, you found that if you set texture format for color frame buffer to GL_RGB, it works.
If you also will set texture format for monochrome frame buffers to GL_RGB, you will get working dynamic shadows.

However, I want to find a way to make your Tegra4 work with RGBA texture format. This is important for some games, e.g. Lego Racers. With RGB buffer you will get black squares over racers in that game.

Let's make test version of FBOTextureFormats::init()

Code: [Select]
void FBOTextureFormats::init()
{
#ifdef GLES2
monochromeInternalFormat = GL_RGB;
monochromeFormat = GL_RGB;
monochromeType = GL_UNSIGNED_SHORT_5_6_5;
monochromeFormatBytes = 2;

    depthInternalFormat = GL_DEPTH_COMPONENT;
      depthFormat = GL_DEPTH_COMPONENT;
      depthType = GL_UNSIGNED_INT;
      depthFormatBytes = 2;

const char * extensions = (const char *)glGetString(GL_EXTENSIONS);

if (strstr(extensions, "GL_OES_rgb8_rgba8") != NULL) {
LOG(LOG_ERROR, "GL_OES_rgb8_rgba8 supported. Use RGBA color buffer.\n");
colorInternalFormat = GL_RGBA;
colorFormat = GL_RGBA;
colorType = GL_UNSIGNED_BYTE;
colorFormatBytes = 4;
} else {
LOG(LOG_ERROR, "GL_OES_rgb8_rgba8 not supported. Use RGB color buffer.\n");
colorInternalFormat = GL_RGB;
colorFormat = GL_RGB;
colorType = GL_UNSIGNED_SHORT_5_6_5;
colorFormatBytes = 2;
}
#endif
}

What do you use to build the project? Eclipse? Do you know how to open adb log and see device output?
I put log messages to know if GL_OES_rgb8_rgba8 extension is supported.
Please check for that string in the log. It should be printed on rom start.

Offline fzurita

  • Moderator
  • double
  • *****
  • Posts: 558
    • View Profile
Re: GLideN64 Android port
« Reply #316 on: June 06, 2015, 09:38:18 PM »
You can build the project and deploy it to the device. That is enough.

So, you found that if you set texture format for color frame buffer to GL_RGB, it works.
If you also will set texture format for monochrome frame buffers to GL_RGB, you will get working dynamic shadows.

However, I want to find a way to make your Tegra4 work with RGBA texture format. This is important for some games, e.g. Lego Racers. With RGB buffer you will get black squares over racers in that game.

Let's make test version of FBOTextureFormats::init()

Code: [Select]
void FBOTextureFormats::init()
{
#ifdef GLES2
monochromeInternalFormat = GL_RGB;
monochromeFormat = GL_RGB;
monochromeType = GL_UNSIGNED_SHORT_5_6_5;
monochromeFormatBytes = 2;

    depthInternalFormat = GL_DEPTH_COMPONENT;
      depthFormat = GL_DEPTH_COMPONENT;
      depthType = GL_UNSIGNED_INT;
      depthFormatBytes = 2;

const char * extensions = (const char *)glGetString(GL_EXTENSIONS);

if (strstr(extensions, "GL_OES_rgb8_rgba8") != NULL) {
LOG(LOG_ERROR, "GL_OES_rgb8_rgba8 supported. Use RGBA color buffer.\n");
colorInternalFormat = GL_RGBA;
colorFormat = GL_RGBA;
colorType = GL_UNSIGNED_BYTE;
colorFormatBytes = 4;
} else {
LOG(LOG_ERROR, "GL_OES_rgb8_rgba8 not supported. Use RGB color buffer.\n");
colorInternalFormat = GL_RGB;
colorFormat = GL_RGB;
colorType = GL_UNSIGNED_SHORT_5_6_5;
colorFormatBytes = 2;
}
#endif
}

What do you use to build the project? Eclipse? Do you know how to open adb log and see device output?
I put log messages to know if GL_OES_rgb8_rgba8 extension is supported.
Please check for that string in the log. It should be printed on rom start.

Yes, I'm using Eclipse. I know how to view the adb log and view device output. OK, I'll try this when I get a chance and tell you what it looks like.

Offline fzurita

  • Moderator
  • double
  • *****
  • Posts: 558
    • View Profile
Re: GLideN64 Android port
« Reply #317 on: June 07, 2015, 12:54:25 AM »
You can build the project and deploy it to the device. That is enough.

So, you found that if you set texture format for color frame buffer to GL_RGB, it works.
If you also will set texture format for monochrome frame buffers to GL_RGB, you will get working dynamic shadows.

However, I want to find a way to make your Tegra4 work with RGBA texture format. This is important for some games, e.g. Lego Racers. With RGB buffer you will get black squares over racers in that game.

Let's make test version of FBOTextureFormats::init()

Code: [Select]
void FBOTextureFormats::init()
{
#ifdef GLES2
monochromeInternalFormat = GL_RGB;
monochromeFormat = GL_RGB;
monochromeType = GL_UNSIGNED_SHORT_5_6_5;
monochromeFormatBytes = 2;

    depthInternalFormat = GL_DEPTH_COMPONENT;
      depthFormat = GL_DEPTH_COMPONENT;
      depthType = GL_UNSIGNED_INT;
      depthFormatBytes = 2;

const char * extensions = (const char *)glGetString(GL_EXTENSIONS);

if (strstr(extensions, "GL_OES_rgb8_rgba8") != NULL) {
LOG(LOG_ERROR, "GL_OES_rgb8_rgba8 supported. Use RGBA color buffer.\n");
colorInternalFormat = GL_RGBA;
colorFormat = GL_RGBA;
colorType = GL_UNSIGNED_BYTE;
colorFormatBytes = 4;
} else {
LOG(LOG_ERROR, "GL_OES_rgb8_rgba8 not supported. Use RGB color buffer.\n");
colorInternalFormat = GL_RGB;
colorFormat = GL_RGB;
colorType = GL_UNSIGNED_SHORT_5_6_5;
colorFormatBytes = 2;
}
#endif
}

What do you use to build the project? Eclipse? Do you know how to open adb log and see device output?
I put log messages to know if GL_OES_rgb8_rgba8 extension is supported.
Please check for that string in the log. It should be printed on rom start.

This code worked fine. And I'm getting this in logcat:

06-07 01:52:22.393: D/GLideN64(23138): GL_OES_rgb8_rgba8 supported. Use RGBA color buffer.

Also, i just realized that this code is identical to Mali 400. i must had done something wrong first time i tried that.
« Last Edit: June 07, 2015, 01:15:02 AM by fzurita »

Offline retroben

  • float
  • ****
  • Posts: 432
    • View Profile
Re: GLideN64 Android port
« Reply #318 on: June 07, 2015, 02:21:16 PM »
I find it strange that Native resolution (1080P for me) runs sluggishly while setting it to one size below at 960x720 causes a major speed increase.
I have Yoshi Story running at 60fps on 960x720 on zoom with FBEmulation enabled while it was a
pathetically slow 30-20fps or less at Native resolution.

Maybe there is a remedy to fix that Native resolution bottleneck?

Offline Gonetz

  • Developer
  • long
  • *****
  • Posts: 104
    • View Profile
Re: GLideN64 Android port
« Reply #319 on: June 08, 2015, 06:59:00 AM »

This code worked fine. And I'm getting this in logcat:

06-07 01:52:22.393: D/GLideN64(23138): GL_OES_rgb8_rgba8 supported. Use RGBA color buffer.

Also, i just realized that this code is identical to Mali 400. i must had done something wrong first time i tried that.

Excellent! Yes, you're right. If GL_OES_rgb8_rgba8 extension is supported, the setup is identical to Mali 400.
Thus, your GPU drivers have the same issue as Mali-400 ones - texture internal format must be the same as texture format in glTexImage2D call. Otherwise texture won't initialize. Actually, this issue is not a problem [have lack of words here]. I mean, if I'll use this code for all GLES2 devices, it should work. I'll make an update asap.

Offline Gonetz

  • Developer
  • long
  • *****
  • Posts: 104
    • View Profile
Re: GLideN64 Android port
« Reply #320 on: June 08, 2015, 07:03:46 AM »
I find it strange that Native resolution (1080P for me) runs sluggishly while setting it to one size below at 960x720 causes a major speed increase.
I have Yoshi Story running at 60fps on 960x720 on zoom with FBEmulation enabled while it was a
pathetically slow 30-20fps or less at Native resolution.

Maybe there is a remedy to fix that Native resolution bottleneck?

Do you have speed increase/decrease only with 2D games like Yoshi Story, or with all titles?

Offline retroben

  • float
  • ****
  • Posts: 432
    • View Profile
Re: GLideN64 Android port
« Reply #321 on: June 15, 2015, 11:08:22 PM »
Just my luck when the forum went down. ::)

Even Banjo-Tooie is faster with fluid smooth 60fps in Heggy's on GLideN64 while FBEmulation is enabled.
(no frameskip code 8007913F 0001)
It still does go slower on my FireTV when in the same situations as other plugins,such as looking at a large distance.

Offline Gonetz

  • Developer
  • long
  • *****
  • Posts: 104
    • View Profile
Re: GLideN64 Android port
« Reply #322 on: June 16, 2015, 08:52:44 AM »
The forum is finally recovered! Great!

I've made few important fixes while it was dawn:
- fixed issues in GLES3.1 shaders. Now my shaders compiled not only on Shield.
- add optimization for read from color frame buffer to RAM, commit 68941f6c
Speed increased circa 4 times and now EnableCopyColorFromRDRAM can be used in some games without noticeable speed drop. Thanks to Lars Bishop from NVidia, who discovered the source of the slowdown in my code and fixed it.


Offline retroben

  • float
  • ****
  • Posts: 432
    • View Profile
Re: GLideN64 Android port
« Reply #323 on: June 16, 2015, 11:11:14 AM »
Would this speed increase include GLES2 and despite native resolution bottleneck?

Glad to see you're still here even with all the lost time from the forum being down. ;D

Offline Gonetz

  • Developer
  • long
  • *****
  • Posts: 104
    • View Profile
Re: GLideN64 Android port
« Reply #324 on: June 17, 2015, 05:58:54 AM »
No, buffers read disabled for GLES2.

Offline retroben

  • float
  • ****
  • Posts: 432
    • View Profile
Re: GLideN64 Android port
« Reply #325 on: June 17, 2015, 10:41:54 AM »
So only in relation to that feature,I see.

Offline Gillou68310

  • Developer
  • long
  • *****
  • Posts: 112
    • View Profile
Re: GLideN64 Android port
« Reply #326 on: June 17, 2015, 11:05:57 AM »
@Gonetz master won't build on android here's the log ;) 

Code: [Select]
17:59:32 **** Build of configuration Default for project SplashActivity ****
"C:\\Android\\android-ndk-r10e\\ndk-build.cmd" all
Android NDK: WARNING: APP_PLATFORM android-9 is larger than android:minSdkVersion 7 in ./AndroidManifest.xml   
[armeabi-v7a] Install        : libSDL2.so => libs/armeabi-v7a/libSDL2.so
[armeabi-v7a] Install        : libae-exports.so => libs/armeabi-v7a/libae-exports.so
[armeabi-v7a] Install        : libae-imports.so => libs/armeabi-v7a/libae-imports.so
[armeabi-v7a] Install        : libfreetype.so => libs/armeabi-v7a/libfreetype.so
[armeabi-v7a] Install        : libmupen64plus-audio-sdl.so => libs/armeabi-v7a/libmupen64plus-audio-sdl.so
[armeabi-v7a] Install        : libmupen64plus-audio-sles.so => libs/armeabi-v7a/libmupen64plus-audio-sles.so
[armeabi-v7a] Install        : libmupen64plus-core.so => libs/armeabi-v7a/libmupen64plus-core.so
[armeabi-v7a] Install        : libmupen64plus-input-android.so => libs/armeabi-v7a/libmupen64plus-input-android.so
[armeabi-v7a] Install        : libmupen64plus-rsp-hle.so => libs/armeabi-v7a/libmupen64plus-rsp-hle.so
[armeabi-v7a] Install        : libmupen64plus-ui-console.so => libs/armeabi-v7a/libmupen64plus-ui-console.so
[armeabi-v7a] Install        : libmupen64plus-video-glide64mk2.so => libs/armeabi-v7a/libmupen64plus-video-glide64mk2.so
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= 3DMath.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= Combiner.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= CommonPluginAPI.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= Config.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= CRC.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= DepthBuffer.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= F3D.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= F3DDKR.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= F3DEX2CBFD.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= F3DEX2.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= F3DEX.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= F3DPD.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= F3DSWSE.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= F3DWRUS.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= FrameBuffer.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= GBI.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= gDP.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= GLideN64.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= glState.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= gSP.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= Keys.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= L3D.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= L3DEX2.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= L3DEX.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= MupenPlusPluginAPI.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= N64.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= OpenGL.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= PostProcessor.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= RDP.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= RSP.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= S2DEX2.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= S2DEX.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= Textures.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= Turbo3D.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= VI.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= ZSort.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= ShaderUtils.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= CommonAPIImpl_common.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= CommonAPIImpl_mupenplus.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= Config_mupenplus.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= MupenPlusAPIImpl.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= OpenGL_mupenplus.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= TextDrawer.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= UniformSet.cpp
[armeabi-v7a] Compile++ arm  : mupen64plus-video-gliden64-gles20 <= GLSLCombiner_gles2.cpp
jni/./mupen64plus-video-gliden64/src/GLES2/GLSLCombiner_gles2.cpp: In member function 'void ShaderCombiner::_locateUniforms()':
jni/./mupen64plus-video-gliden64/src/GLES2/GLSLCombiner_gles2.cpp:281:16: error: 'struct ShaderCombiner::UniformLocation' has no member named 'uPrimitiveLod'
  LocateUniform(uPrimitiveLod);
                ^
jni/./mupen64plus-video-gliden64/src/GLES2/GLSLCombiner_gles2.cpp:253:13: note: in definition of macro 'LocateUniform'
  m_uniforms.A.loc = glGetUniformLocation(m_program, #A);
             ^
jni/./mupen64plus-video-gliden64/src/GLES2/GLSLCombiner_gles2.cpp: In member function 'void ShaderCombiner::updateLOD(bool)':
jni/./mupen64plus-video-gliden64/src/GLES2/GLSLCombiner_gles2.cpp:435:15: error: 'struct ShaderCombiner::UniformLocation' has no member named 'uPrimitiveLod'
    m_uniforms.uPrimitiveLod.set(gDP.primColor.l, _bForce);
               ^
make.exe: *** [obj/local/armeabi-v7a/objs/mupen64plus-video-gliden64-gles20/./mupen64plus-video-gliden64/src/GLES2/GLSLCombiner_gles2.o] Error 1

18:00:43 Build Finished (took 1m:10s.986ms)


Offline Gonetz

  • Developer
  • long
  • *****
  • Posts: 104
    • View Profile
Re: GLideN64 Android port
« Reply #327 on: June 18, 2015, 01:11:05 AM »
Fixed in rev. db38b2f

Offline Gillou68310

  • Developer
  • long
  • *****
  • Posts: 112
    • View Profile
Re: GLideN64 Android port
« Reply #328 on: June 18, 2015, 02:55:56 AM »
Thanks ;)

I updated master with latest gliden64 changes.

Offline retroben

  • float
  • ****
  • Posts: 432
    • View Profile
Re: GLideN64 Android port
« Reply #329 on: June 18, 2015, 05:24:44 AM »
Conker now has proper model visibility on FBEmulation with GLES2,but the pause menu image doesn't render,it is just solid white background.
Still think polygon offset hack should be made available on GLideN64 to clean up the remaining see-through issues that appear to match when compared to the other plugins.