Mupen64 Plus libretro ongoing development

Something for maister to look into - this requires some source edits -

go to glide2gl/src/Glide64/Main.cpp

Go to the part that says this -

   if (
         strstr(name, (const char *)"Blast Corps")
         || strstr(name, (const char *)"ZELDA MAJORA'S MASK")
         || strstr(name, (const char *)"ZELDA")
         || strstr(name, (const char *)"MASK")
         || strstr(name, (const char *)"Banjo-Kazooie")
         || strstr(name, (const char *)"MARIOKART64")
         || strstr(name, (const char *)"Quake")
         || strstr(name, (const char *)"Perfect Dark")
      )
      settings.frame_buffer = 1;

Change it to:

   if (
         strstr(name, (const char *)"Blast Corps")
         || strstr(name, (const char *)"ZELDA MAJORA'S MASK")
         || strstr(name, (const char *)"ZELDA")
         || strstr(name, (const char *)"MASK")
         || strstr(name, (const char *)"Banjo-Kazooie")
         || strstr(name, (const char *)"MARIOKART64")
         || strstr(name, (const char *)"Quake")
         || strstr(name, (const char *)"Perfect Dark")
      )
{
      settings.frame_buffer = 1;
      settings.frame_buffer |= fb_hwfbe;
}

Now recompile the Mupen64plus core. Make sure you are running RetroArch with GL_DEBUG=1.

Play Zelda OOT. Press Start ingame to go to the subscreen.

You should see some errrors now in the RA Phoenix Log related to the hardware framebuffer emulation. I will list them -

RetroArch [WARN] :: [GL debug (Medium, API, Performance)]: Failed to fast clear depth due to scissor being enabled. Possible 5% performance win if avoided.

RetroArch [ERROR] :: [GL debug (High, API, Error)]: GL_INVALID_OPERATION in glFramebufferTexture2DEXT(texture target mismatch) RetroArch [ERROR] :: [GL debug (High, API, Error)]: GL_INVALID_OPERATION in glFramebufferTexture2DEXT(texture target mismatch) RetroArch [WARN] :: [GL debug (Medium, API, Performance)]: Failed to fast clear depth due to scissor being enabled. Possible 5% performance win if avoided.

RetroArch [ERROR] :: [GL debug (High, API, Error)]: GL_INVALID_OPERATION in glFramebufferTexture2DEXT(texture target mismatch) RetroArch [ERROR] :: [GL debug (High, API, Error)]: GL_INVALID_OPERATION in glFramebufferTexture2DEXT(texture target mismatch) RetroArch [ERROR] :: [GL debug (High, API, Error)]: GL_INVALID_OPERATION in glFramebufferTexture2DEXT(texture target mismatch) RetroArch [ERROR] :: [GL debug (High, API, Error)]: GL_INVALID_OPERATION in glFramebufferTexture2DEXT(texture target mismatch) RetroArch [WARN] :: [GL debug (Medium, API, Performance)]: Recompiling fragment shader for program 55

RetroArch [WARN] :: [GL debug (Medium, API, Performance)]: fragment color clamping 1->0

RetroArch [WARN] :: [GL debug (Medium, API, Performance)]: FS compile took 2.106 ms and stalled the GPU

RetroArch [WARN] :: [GL debug (Medium, API, Other)]: FBO incomplete: color attachment incomplete [0]

RetroArch [WARN] :: [GL debug (Medium, API, Other)]: FBO incomplete: color attachment incomplete [0]

RetroArch [ERROR] :: [GL debug (High, API, Error)]: GL_INVALID_FRAMEBUFFER_OPERATION in glDrawArrays(incomplete framebuffer) RetroArch [WARN] :: [GL debug (Medium, API, Other)]: FBO incomplete: color attachment incomplete [0]

RetroArch [WARN] :: [GL debug (Medium, API, Performance)]: Recompiling fragment shader for program 59

Perhaps the previous changes to how FBOs work screwed some things up or do we need to wrap glFramebuffer2DExt and friends as well in our OpenGL state machine?

Started logging all the glUniform* calls - I defined HAVE_HWFBE in Glide64/Main.cpp, defined LOG_GL_CALLS in Glitch64/main.h and let the intro run in Conker’s Bad Fur Day.

This is the error log:

RetroArch [ERROR] :: [GL debug (High, API, Error)]: GL_INVALID_OPERATION in glUniform(type mismatch) OpenGL error 00000502, at glide2gl/src/Glitch64/combiner.c:664 - for glUniform4f(constant_color_location, texture_env_color[0], texture_env_color[1], texture_env_color[2], texture_env_color[3]) RetroArch [ERROR] :: [GL debug (High, API, Error)]: GL_INVALID_OPERATION in glFramebufferTexture2DEXT(texture target mismatch) OpenGL error 00000502, at glide2gl/src/Glitch64/combiner.c:2769 - for glUniform4f(ccolor0_location, ccolor0[0], ccolor0[1], ccolor0[2], ccolor0[3])