Skip to content
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

SolveSpace v3 empty black window (AMD Adrenalin 22.7.1 or Later Driver OpenGL 3 problem). Fixed in 23.4.1 #1278

Open
quangduyitx opened this issue Aug 8, 2022 · 40 comments

Comments

@quangduyitx
Copy link

System information

  • SolveSpace version: v3.1 70bde63
  • Operating system: windows 10 64
    Screenshot 2022-08-08 122731
    Screenshot 2022-08-08 122919
    Screenshot 2022-08-08 122936

Expected behavior

show interface to use

Actual behavior

an empty black window

Additional information

@ruevs
Copy link
Member

ruevs commented Aug 8, 2022

Does one of these versions https://github.com/ruevs/solvespace/releases work? They are compiled for OpenGL 1.

If they do you should update your video card drivers and this issue would be the same as #1036.

@ruevs ruevs added the Win32 label Aug 8, 2022
@quangduyitx
Copy link
Author

Does one of these versions https://github.com/ruevs/solvespace/releases work? They are compiled for OpenGL 1.

If they do you should update your video card drivers and this issue would be the same as #1036.

it worked, I think the error is caused by AMD Adrenalin 22.7.1 Driver
it has OpenGL API 4.6 and openGL Driver 22.0.7 Beta

@ruevs
Copy link
Member

ruevs commented Aug 8, 2022

Hmm this is the latest... https://www.amd.com/en/support/kb/release-notes/rn-rad-win-22-7-1

I'm not sure how to proceed in troubleshooting this...

@ruevs
Copy link
Member

ruevs commented Aug 8, 2022

@phkahler
Copy link
Member

phkahler commented Aug 8, 2022

Yikes! That hardware is newer than my solvespace development machine - Zen1+ Raven Ridge 2400G.

Edit: I'm on Linux.

@quangduyitx
Copy link
Author

Would you be willing to downgrade to 22.5.1 and try?

https://www.amd.com/en/support/apu/amd-ryzen-processors/amd-ryzen-3-mobile-processors-radeon-graphics/amd-ryzen-3-4300u

downgrade to 22.5.1, worked.
AMD Adrenalin 22.7.1 Driver gives error
Screenshot 2022-08-09 014941

@ruevs ruevs changed the title SolveSpace version: v3 empty black window SolveSpace version: v3 empty black window (AMD Adrenalin 22.7.1 Driver OpenGL 3 problem) Aug 8, 2022
@ruevs
Copy link
Member

ruevs commented Aug 8, 2022

Very intetesting! They do mention a huge OpenGL speed up (in Minecraft) in the release notes for 22.7.1. I wonder if someone else with an AMD video card/APU will have the same problem or it is specific to this system?

@jackzelenkin
Copy link

I have the same issue with rx6400 card and adrenalin 22.8.1. Downgrading adrenalin to 22.5.1 does solve it.

@qutefox
Copy link

qutefox commented Sep 14, 2022

I am having the same issue. Only a black screen.
image
image
image

@qutefox
Copy link

qutefox commented Sep 15, 2022

Downgrading to AMD Adrenalin 22.5.1 Driver worked:
image

@ruevs ruevs pinned this issue Sep 19, 2022
@ruevs ruevs changed the title SolveSpace version: v3 empty black window (AMD Adrenalin 22.7.1 Driver OpenGL 3 problem) SolveSpace v3 empty black window (AMD Adrenalin 22.7.1 or Later Driver OpenGL 3 problem) Sep 19, 2022
@SimonGolding
Copy link

Hi I'm having the same issue, so have decided to get my cross compiler (Ubuntu Mate in a VirtualBox) going to help with testing. I just finished compiling (with debug) and tested it to confirm it has the same issue as the precompiled version.

for the sake of it I load a file as was surprised to find the model showed up. The Property Browser and all tool menus are still missing but the shaded model show up and I can select surfaces.

image

No error messages were printed to the console. So any suggestion on where to test would be appreciated

@ruevs
Copy link
Member

ruevs commented Nov 15, 2022

This is very interesting. So no error messages appeared when you ran the debug version that you built from a command prompt?

Another interesting test - if you run an OpenGL 1 version how does it behave?

@ruevs
Copy link
Member

ruevs commented Nov 15, 2022

As for places to look at - if the OpenGL 1 version works then the offending code has to be in

https://github.com/solvespace/solvespace/blob/master/src/render/rendergl3.cpp

Maybe here:

void OpenGl3Renderer::DrawVectorText(const std::string &text, double height,

and here:

void OpenGl3Renderer::DrawPixmap(std::shared_ptr<const Pixmap> pm,

Or perhaps something to do with the Z buffer and the layers?

static void ssglDepthRange(Canvas::Layer layer, int zIndex) {

https://registry.khronos.org/OpenGL-Refpages/gl4/html/glClearDepth.xhtml

@SimonGolding
Copy link

image

So my debug compiled version on the left and the OpenGL V1 on the right.

image
My system detail for completeness, I will have a look into the suggested code when i get a moment.

@Asdow
Copy link

Asdow commented Nov 17, 2022

Hi.

This same issue is plaguing several users of Blender and downgrading to the aforementioned 22.5.1 drivers fix it, so it is not restricted to only this software. The newest Adrenalin 22.11.1 release notes list "OpenGL applications using MSAA may see visual corruption." in its fixed issues, but I haven't tested to see if it affects solvespace or blender yet.

This was the issue that the driver update references.
https://www.reddit.com/r/Amd/comments/yfnknt/amd_adrenalin_edition_22103_optional_released/iu6fmfl/?context=3

@K900
Copy link

K900 commented Nov 17, 2022

It is unfortunately not fixed on 22.11.1.

@ruevs ruevs closed this as completed Nov 17, 2022
@ruevs
Copy link
Member

ruevs commented Nov 17, 2022

@Asdow Thanks for pointing out the problem in Blender.
Here is the issue for reference:
https://developer.blender.org/T100096
According to it 22.6.1 also works. Would one of you verify that this is the case with SolveSpace as well?

Also can those of you who currently have the problem try the Web version of SolveSpace? It uses the same OpenGL 3 renderer, so it would be interesting if the extra layer of indirection through the browser makes a difference. Maybe try all your browsers?

@ruevs ruevs reopened this Nov 17, 2022
@ruevs ruevs added the UI label Nov 17, 2022
@optlink
Copy link

optlink commented Nov 17, 2022

I have the problem with 22.11.1. The web version works on Edge for me.

@ruevs
Copy link
Member

ruevs commented Nov 23, 2022

On the Blender bug someone posted a possible solution. Can any (all) of you check if it solves the problem for SolveSpace?

Laurent (Soy55) added a comment.Wed, Nov 23, 1:37 PM

Find the real culprit. you absolutely need have MSAA set as "Use appliccation settting" in the AMD driver. reverted to 22.11.1 and it work.

René (ShockHazard1) added a comment.Wed, Nov 23, 3:22 PM

I can confirm the statement @Laurent (Soy55), because I tested it after his hint.
The issue is solved, if the AMD driver use for MSAA the option "application settings" or "expand application settings". This works on the fly and Blender needs just a restart.

@phkahler
Copy link
Member

This issue is affecting a lot more than Solvespace and Blender:

https://www.reddit.com/r/Amd/comments/wabgn3/opengl_msaa_wireframe_bug_in_2271_driver/

It looks to me like AMD broke something and probably needs to revert a change, and someone is yelling "but performance!" Yeah, we all struggle to make things better without breaking stuff ;-)

@Asdow
Copy link

Asdow commented Nov 23, 2022

On the Blender bug someone posted a possible solution. Can any (all) of you check if it solves the problem for SolveSpace?

Setting Antialiasing to Use application settings fixes the bug on the newest drivers with Blender, but not with solvespace for me. I wonder if solvespace is using some sort of openGL call related MSAA by default that blender does not?

Oh, and the web version of solvespace works for me on Firefox, albeit I didn't check whether changing the antialiasing setting could reproduce the glitch there as well

@ruevs
Copy link
Member

ruevs commented Nov 23, 2022

To sum up:

  • The complete OpenGL rewrite in Adrenalin 22.7.1 breaks SolveSpace, Blender and many other OpenGL applications.
  • The fix in 22.11.1 and the MSAA option do not fix SolveSpace, but they fix Blender.
  • The Web version and the OpenGL 1 versions always work.

This leads me to believe it may be related to our rather ancient (2016) fork of Angle that OpenGL 3 goes through on Windows. I tried to quickly update it but it is a pain to adjust the CMake configuration... If I find the time to do it I'll post a version with "modern" Angle to test.

@phkahler
Copy link
Member

@ruevs it would be nice to use an upstream version of Angle too, and dump our old one.

@majso
Copy link

majso commented Feb 19, 2023

fyi: I've tested with driver 22.11.2 and got same result with black screen

@fred777
Copy link

fred777 commented Feb 23, 2023

Same issue with Adrenaline driver 23.2.2 on Win10 and RX6800XT. Tried different custom AA settings for solvespace without luck.

@dan0h
Copy link

dan0h commented Feb 23, 2023

Same issue for me, Adrenalin driver 23.2.2, Win11, 6900XT, interestingly FreeCADLink is also borked, but if I select the "Experimental" render cache, it fixes the issue - in FreeCADLink its characterised by crazy random lines shooting from the geometry. OpenGL 1 SolveSpace works fine.

@Slaw6820
Copy link

Hey guys,
as a quick workaround from this code part:

if(eglDisplay == EGL_NO_DISPLAY) {
ssassert(eglBindAPI(EGL_OPENGL_ES_API), "Cannot bind EGL API");
EGLBoolean initialized = EGL_FALSE;
for(auto &platformType : {
// Try platform types from least to most amount of software translation required.
std::make_pair("OpenGL ES", EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE),
std::make_pair("OpenGL", EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE),
std::make_pair("Direct3D 11", EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE),
std::make_pair("Direct3D 9", EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE),
}) {
dbp("Initializing ANGLE with %s backend", platformType.first);
EGLint displayAttributes[] = {
EGL_PLATFORM_ANGLE_TYPE_ANGLE, platformType.second,
EGL_NONE
};
eglDisplay = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, hDc,

You can comment out or remove this line

std::make_pair("OpenGL ES", EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE),

to disable OGL ES context creation and recompile the project.
Then it works :)

@phkahler
Copy link
Member

phkahler commented Mar 9, 2023

I'm way out of my teritory but questioning this code snippet from rendergl3.cpp:

    switch(pm->format) {
        case Pixmap::Format::RGBA: format = GL_RGBA;  break;
        case Pixmap::Format::RGB:  format = GL_RGB;   break;
#if defined(HAVE_GLES)
        case Pixmap::Format::A:    format = GL_ALPHA; break;
#else
        case Pixmap::Format::A:    format = GL_RED;   break;
#endif
        case Pixmap::Format::BGRA:
        case Pixmap::Format::BGR:
            ssassert(false, "Unexpected pixmap format");

Wondering if having Format::A set format = GL_RED in all cases helps. I don't think so though. Given the definitions here:
https://registry.khronos.org/OpenGL-Refpages/es3.1/html/glTexImage2D.xhtml
I'm not sure how GL_ALPHA and GL_RED could possibly be alternatives for each other as suggested in our code.

@ruevs
Copy link
Member

ruevs commented Apr 2, 2023

Intel finally has released a new driver for the AMD Radeon™ RX Vega M GH in my i7-8809G so now I can reproduce the problem. Will post more when I have time to debug it.

Note to self.

@Slaw6820
Copy link

Slaw6820 commented Apr 5, 2023

@ruevs
New AMD driver exposes new extension: WGL_EXT_create_context_es2_profile
This causes app to use EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE, but previously app was using EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE. Seems like app or driver has issue with the OGL ES, so per my last post, just disable it as a workaround. Then app would take the same route on both old and new driver.

Hey guys, as a quick workaround from this code part:

if(eglDisplay == EGL_NO_DISPLAY) {
ssassert(eglBindAPI(EGL_OPENGL_ES_API), "Cannot bind EGL API");
EGLBoolean initialized = EGL_FALSE;
for(auto &platformType : {
// Try platform types from least to most amount of software translation required.
std::make_pair("OpenGL ES", EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE),
std::make_pair("OpenGL", EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE),
std::make_pair("Direct3D 11", EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE),
std::make_pair("Direct3D 9", EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE),
}) {
dbp("Initializing ANGLE with %s backend", platformType.first);
EGLint displayAttributes[] = {
EGL_PLATFORM_ANGLE_TYPE_ANGLE, platformType.second,
EGL_NONE
};
eglDisplay = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, hDc,

You can comment out or remove this line

std::make_pair("OpenGL ES", EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE),

to disable OGL ES context creation and recompile the project. Then it works :)

@ruevs
Copy link
Member

ruevs commented Apr 5, 2023

New AMD driver exposes new extension: WGL_EXT_create_context_es2_profile
This causes app to use EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE, but previously app was using EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE. Seems like app or driver has issue with the OGL ES, so per my last post, just disable it as a workaround. Then app would take the same route on both old and new driver.

@Slaw6820 I did try your workaround (as soon as I could reproduce the problem) and it works. Thanks a lot!

What is bothering me is why does it fail with "EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE" when on a browser the web version is probably using the same profile.

I debugged it a bit and I think I narrowed it down to a missing extension that our (ancient) Angle expects but the driver does not provide. However I am not completely sure - this is the first time I am touching the OpenGL code. I'm not on that machine right now so I can not say what the extension was.

@FlashSystems
Copy link

AMD seems to have fixed the problem: After updating to Adrenalin 23.4.1 the 3.1 stable build is working again on my Radeon RX550.

@Slaw6820
Copy link

@ruevs

I debugged it a bit and I think I narrowed it down to a missing extension that our (ancient) Angle expects but the driver does not provide. However I am not completely sure - this is the first time I am touching the OpenGL code. I'm not on that machine right now so I can not say what the extension was.

Curious if any progress on that. What extension is expected?

@bruce965
Copy link

bruce965 commented May 1, 2023

Hope this can be helpful to anyone still facing this issue...

A temporary solution (only for computers where the display is connected to the motherboard port and not directly to the GPU) is to disable the GPU from the Device Manager, forcing the whole system to run through CPU soft-rendering.

Another less aggressive temporary solution is to use Mesa3D drivers for Windows, basically bypassing the GPU and using the CPU to soft-render everything. This is a per-app setting, thus it doesn't affect the whole system, and works well enough for me. This is my current approach.

@Miguel-Rodrigues
Copy link

Miguel-Rodrigues commented May 15, 2023

It was just a matter of time for AMD to resolve their issue. It is now working for version Adrenaline 23.4.3

Windows 10 Pro
Ryzen 5800x
Radeon 6600xt

image

image

@ruevs ruevs changed the title SolveSpace v3 empty black window (AMD Adrenalin 22.7.1 or Later Driver OpenGL 3 problem) SolveSpace v3 empty black window (AMD Adrenalin 22.7.1 or Later Driver OpenGL 3 problem). Fixed in 23.4.1 May 16, 2023
@ilobs
Copy link

ilobs commented Sep 16, 2023

So I seem to be having the same problem with 23.9.1 on my G14 with an CPU
AMD Ryzen 9 6900HS with an AMD Radeon RX 6700S. Is anyone else having the same issue again?

@cowboycasey
Copy link

Just found this thread and I am also having the same issue.. Thought I was loosing my mind and could not see anything... Just updated to the newest version and still not working.. Followed the instructions above by disabling the GPU and using software and it works great..
image
image

@TerryGeng
Copy link

This problem persists with 23.9.2 on AMD Radeon RX 6400.

@TerryGeng
Copy link

Seems that 23.10.2 fixed this issue again.

@cowboycasey
Copy link

I just loaded 23.9.2 and it is working for me without disabling..

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests