I've been trying to get Flycast to work on the Rpi4 but always run into the same problem.
The graphics are all glitched (2d graphics, textures) 3d models are fine (See screenshots at bottom of the issue).
I've tried building with: platform=classic_armv7_a7 make -j4
and platform=classic_armv8_a35 make -j4
After that I decided to add the rpi4 to the makefile and it looks like this:
else ifneq (,$(findstring rpi4,$(platform)))
CFLAGS += -march=armv8-a+crc -mtune=cortex-a72 -mfpu=neon-fp-armv8 -mfloat-abi=hard
CXXFLAGS += -march=armv8-a+crc -mtune=cortex-a72 -mfpu=neon-fp-armv8 -mfloat-abi=hard
HAVE_LTCG = 0
endif
HAVE_LTCG=0 is needed because otherwise it won't compile.
These 3 builds succesfully built but all give me the same problem (See screenshots below).
Tested it with 2 different bios files. Both have the correct MD5
Did I do anything wrong? Or is this a bug on the Rpi4?


I wish I could help but I've never seen anything like this. Could be an issue with the GL driver or the way flycast uses it. There are some differences between GL and GLES with regards to texture formats but this wouldn't cause such a corruption.
Can you post a log?
Yeah sure! Here you go!
http://paste.debian.net/1089867/
issue is due to the shader caching
i'm not an expert of GL ES but my understanding is that the shader caching currently implemented also cache the uniforms
adding at the end of PipelineShader *GetProgram(...)
glcache.UseProgram(shader->program);
ShaderUniforms.Set(shader);
(and also commenting ShaderUniforms.Set(s); line 584 in bool CompilePipelineShader(PipelineShader *s))
did solved the issue completely on RPI4
made a pull request to flycast
https://github.com/libretro/flycast/pull/582
not sure if those must be done to flycast or reicast, patch is there anyway with rpi4 makefle and more robust fix to handle fog
This should now be fixed. Please reopen if needed.
I disabled this workaround on the RPI4 with raspbian buster and Mesa 19.3.2 which is now included and couldn't see any issues, so this may no longer be required. To be sure, what is a good test case? (I wasn't sure what the shots were from in the original post).
@joolswills Those glitches were happening to all the games that I tried at the time, but the game from the screenshot is Soul Calibur (I googled the name of the song that's shown).
Thanks. I'm pretty sure this workaround isn't needed then anymore as that game looked fine. Ikaruga and Rez also.
I removed the flag in https://github.com/libretro/flycast/commit/8288faeb4cefabc5a65a8334322dfa7cc5fdf81f
Most helpful comment
issue is due to the shader caching
i'm not an expert of GL ES but my understanding is that the shader caching currently implemented also cache the uniforms
adding at the end of PipelineShader *GetProgram(...)
glcache.UseProgram(shader->program);
ShaderUniforms.Set(shader);
(and also commenting ShaderUniforms.Set(s); line 584 in bool CompilePipelineShader(PipelineShader *s))
did solved the issue completely on RPI4