-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No textures and depth issues on Raspberry Pi 3 (GLES 2) #1665
Comments
I have several devices where GLES 2.0 still works correctly. My gut guess would be that it's the YUV shader changes that are breaking the RPI. Second possibility would be the shader "performance improvement" that we had a little while back. |
Dunno if this adds any insight - but when loading, a message "INIT NOISE TEXTURES" appears, which did not appear before these glitches started happening. also - issue started no earlier than this month (nov 2017) |
Quite recent. Have you tried to enable legacy blending? |
@dankcushions do you have access to the GLideN64 log file? Do you see any errors there? |
i already had it enabled.
i will check these out tonight! |
A user on rpi forum asserts the following regarding log file in association with this issue: "the glide log shows these two lines constantly repeating: Async color buffer copies are not supported on GLES2 |
I don't have my Raspberry Pi anymore but I'll try and get the GLES2 version running on my laptop to see if I can reproduce this tomorrow @cptbananas those 2 warnings are not related to this issue, it is just warning about a couple features that aren't supported on the Raspberry Pi |
@loganmc10 I have tried it in a couple GLES 2.0 devices and I didn't have this issue. This may be RPI specific, maybe their GPU drivers specific. |
Probably the case, the GPU drivers on the Raspberry Pi are garbage. On Linux I can actually disable certain extensions so I'll try and "simulate" the RPI as close as possible, but it may be a driver bug |
I have no problem with vc4 mesa driver. So the vc4 firmware blob has a problem or a recent change is not compatible with VC hacks/macros. I will bisect if i have some time. |
Ah ok good to know, does RetroPie have plans to start using the Mesa driver? |
As an option, but not yet. |
This seems be be the offending commit causing the plugin to fail on Pi: c5c0fbe |
That's a good find. That would imply that the issue should be fixed if you disable shader storage. Have you tried that? |
I've just checked mupen64plus.cfg, and EnableShadersStorage was already set to "False". If you were referring to something else, then I apologize. |
Yeah, that's what I meant. It may take some debugging work an actual device to see what's wrong. It seems to work fine in other GLES 2.0 devices that don't support shader storage. |
Looking at bad commit, I see a possible inconsistency in shader cache behaviour - it tries to load/save the cache depending on whether the feature is supported, without looking at whether we want the feature to be used via the current configuration. This patch fixes the segfault and doesn't show any graphical distortion when applied to c5c0fbe:
However, applying this against the latest master commit doesn't resolve the issue of missing textures. |
Update: the above issue with the shader cache may not be directly related to this issue (but perhaps needs to be fixed also?). That commit introduced a segmentation fault. This commit is actually what introduced corrupted textures: 77ffe61 |
77ffe61 Can't introduce corrupted textures. It splits gDPInfo::OtherMode::textureConvert 3bit field on 3 1bit fields. gDPInfo::OtherMode::textureConvert was not used for rendering, and this commit does not change the situation. Next commit, adc2b54 do use these bits. @fzurita tested in on GLES2 devices, and this commit was included to master.
by Do the same for ShaderFragmentReadTex1 |
You're right - adc2b54 is the actual commit causing the problem. I misidentified it due to the shader cache from the previous build being loaded each time. Unfortunately, your proposed change was not enough to fix the texture corruption - there's no change to the texture corruption after applying this change - and I made sure to delete the shader cache before testing.
I tried applying this change against the head of this commit, and current master - doesn't help in either case. |
@psyke83 Hmm. readTex function changed too by this commit. Previously it used either hardware bilinear filtering or shader filter3point. Later I added shader for bilinear filtering. May be it causes the issue. Try to revert readTex to old state: in class ShaderReadtex : public ShaderPart
If TextureFilter is really the problem, you will get textures, but only unfiltered, because hardware biliner filtering is disabled. |
Unfortunately, I see no visual difference when readTex is changed - with or without the previous change that forces readTex in instead of of YUV_Convert. P.S. I noticed the attribution in the comments of that commit to twinaphex; that's interesting, as I think that lr-mupen64plus may have similar graphical corruption when the gliden64 option is selected in the core options. I don't have it installed this moment to confirm for certain though. |
@psyke83
If it will help - need to carefuly check what was changed in Textures.cpp and return these changes step by step until you will find what breaks texturing. |
I won't have time to return to testing for a few hours, but so far, this is what gets textures to display when applied against adc2b54 or master:
Using TextureFilter in readTex() as you earlier suggested didn't work, and for some reason, the standard bilinear filtering code path needed to be forced, or else the texture problem persisted. P.S. YUV_Convert does cause issues, but for the test case (Super Mario 64), it only seems to affect a few minor elements such as the star transition effect, missing "PRESS START", incorrect shadow rendering on characters. The majority of textures do display if that code is left in. |
Are you able to view GLSL compiler errors generated by the driver? |
They should get printed out into gliden64.log I believe |
Ah, I figured it printed debug to stdout. These lines are repeated in my log:
|
@psyke83 After looking closely at commit fzurita@f71d714 I don't see why it's necessary. The plugin should be able to generate a bunch of shaders from the keys file just fine even in GLES 2.0 where shader storage is not supported. Your back trace is crashing in a strange spot that doesn't make much sense. It's crashing specifically in this line:
|
I already forgot my own code :( |
Please test again from ea00991 |
No difference, unfortunately. Perhaps this is an issue with GCC 6 on Pi, as I'm using Raspbian stretch & noticed some build warnings related to the CombinerKey function. Here's the build log: https://gist.github.com/psyke83/d3a06a1bd3d06e52cb45b930d3039c4a |
I see no warnings. There are some notes: |
If std::map::operator[] does not work right with your compiler, you may replace |
That appears to have worked. I'm no longer seeing any segmentation faults upon successive emulator launches, and the GLideN64.xxx.GLES.keys files are being created properly in the shader cache folder. Thanks! |
@gonetz that is very interesting, that should work the same... |
@fzurita Do you see the difference? insert(pair(key,value)) updates map only if there is no element with this key yet. I agree, that for GLideN64 code it must be the same because the code does m_combiners.find(key) first.
|
deleted - answered my own question. :) |
I tried adding the logging, but no relevant logging appears in the gliden64.log when launching Majora's Mask. Notes:
|
I set wrong format for 64bit integer. Right code:
I put this code instead of I removed old files in shaders folder and run Zelda MM intro with mupen64plus. Shaders storage option enabled. No "duplicated shader" errors in log file.
It is correct. I got the same content. So, on my system the code works as expected. I suggest you to take latest master,
make clear rebuild, clear mupen64plus shaders folder, remove old gliden64.log and run again. If you will reproduce the problem after that, something is bad with gcc you are using. My only guess is that std::map implementation is broken. |
Testing against your latest master branch at commit 509ee7e (as with my previous test), and I still can't trigger any duplicate logs. My testing procedure:
Complete diff:
This is the gcc version that I'm using which is the default on Raspbian stretch (all packages up to date):
I'll try installing & setting gcc-4.9 as the default and see if a full rebuild remedies the issue. I'll also try reverting to jessie entirely if the stretch gcc 4.9 exhibits the same issue. Thanks for the assistance and I'll keep you updated. |
Maybe it's some kind of memory corruption issue. The Valgrind program would give a clue if it is. I'll try running it against the latest master. |
Just to confirm, rebuilding just the GlideN64 plugin against stretch's gcc 4.9 resolves the segmentation fault with the shader cache, so @gonetz's guess about gcc 6 being bad is likely to be true. I'll try to do more research and see if it's a problem specific to gcc 6.3.0 or perhaps Raspbian's changes against upstream. @fzurita,
I have to kill -9 the valgrind process as it doesn't respond to control codes or a regular KILL signal. Perhaps I'll revert back to jessie to see if valgrind has the same behaviour. |
Valgrind is very intensive. It's possible that the Raspberry pi just can't keep up. |
Following up on our previous discussion - I haven't been able to get valgrind working on the Raspberry Pi or get much further in debugging the issue. Would this change possibly be superior to using the std::map::insert? It also avoids the crash on the Pi:
The next release of RetroPie will be based on Raspbian stretch, so if you prefer not to move away from std::map::operator[], I can propose patching this in the RetroPie build system - but you're going to get bug reports from non-RetroPie Pi users, as new Pi firmware updates are only being released for stretch and more people will be using this distribution version soon. |
Crash seems reproducible only on gcc 6.3.0 via Rasbian stretch, but the workaround should not negatively impact other systems. See: gonetz/GLideN64#1665
May be reverted later - see: gonetz/GLideN64#1665
Crash seems reproducible only on gcc 6.3.0 via Rasbian stretch, but the workaround should not negatively impact other systems. See: gonetz/GLideN64#1665
Is this still and issue? Sorry, I can‘t compile it to test it myself. |
The Raspberry Pi still has an ugly hack in place to fix some depth issues. Someone could try removing that code and see if there are still issues. Maybe that workaround isn't needed anymore |
@loganmc10 |
May be reverted later - see: gonetz/GLideN64#1665
Crash seems reproducible only on gcc 6.3.0 via Rasbian stretch, but the workaround should not negatively impact other systems. See: gonetz/GLideN64#1665
May be reverted later - see: gonetz/GLideN64#1665
Crash seems reproducible only on gcc 6.3.0 via Rasbian stretch, but the workaround should not negatively impact other systems. See: gonetz/GLideN64#1665
I presume it's to do with the shader cache changes but haven't had a chance to bisect yet. Is this RPI specific or all GLES2?
The text was updated successfully, but these errors were encountered: