Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: AdmiralRalwood on July 20, 2016, 12:53:41 pm

Title: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: AdmiralRalwood on July 20, 2016, 12:53:41 pm
Recent nightly builds of FRED (specifically, the ones since the antipodes merge) haven't been working because of a problem in SDL2. I've compiled a modified version of the DLL (using a patch originally written by m!m almost three years ago for antipodes) that allows FRED to work.

Download here. - Starting with the August 2nd nightly build, the included SDL2.dll file has been updated and this should be superfluous.

Download and extract to the same folder as FRED. I didn't really screw around with the default settings in CMake, so it's possible I missed some option that's important to let it work on some people's computers; if FRED still doesn't work with this DLL file, let me know (also let me know if it makes FSO stop working; if it runs with the regular 2.0.4 DLL but not mine, I've probably ****ed something up).
Title: Re: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: Spoon on July 20, 2016, 01:16:24 pm
FRED doesn't work for me with either SDL2.dll, with this version I get this error:

Error: Current GL Version of 1.1 is less than the required version of 1.2.
Switch video modes or update your drivers.
File: gropengl.cpp
Line: 1460

Error: The required OpenGL extension 'GL_ARB_multitexture' is not supported by your current driver version or graphics card.

File: gropenglextension.cpp
Line: 381


So just to be in the clear, I did update my graphics drivers (something I havent done this year) just now, to see if there was any difference. But alas, even with the most recent nvidia drivers it gives me that error. (On a GTX 760)
Title: Re: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: AdmiralRalwood on July 20, 2016, 02:41:04 pm
Error: Current GL Version of 1.1 is less than the required version of 1.2.
:wtf: No GTX 760 should be limited to OpenGL 1.1, and if it was, then FSO itself shouldn't run (because it performs the same OpenGL version check). Do you have an intelgrated that FRED might be trying to use instead of your GTX 760?
Title: Re: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: Goober5000 on July 20, 2016, 10:53:09 pm
That reminds me of the old error where FSO would only check the minor version number, so it thought that 2.1 was 1.1.  But that was fixed ages ago.  (Unless it came back as a zombie.)
Title: Re: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: Yarn on July 22, 2016, 08:25:34 pm
I'm getting this same problem with my GTX 960. I use a desktop with no integrated graphics, so this isn't caused by a failure to switch away from integrated graphics.

Modifying the code so that the OpenGL lines are printed before the error is reached reveals something interesting. If I run FS2 with this code, this is what those lines look like:
Code: [Select]
  OpenGL Vendor    : NVIDIA Corporation
  OpenGL Renderer  : GeForce GTX 960/PCIe/SSE2
  OpenGL Version   : 4.5.0 NVIDIA 368.81

However, if I run FRED2, this is the result:
Code: [Select]
  OpenGL Vendor    : Microsoft Corporation
  OpenGL Renderer  : GDI Generic
  OpenGL Version   : 1.1.0

It seems like FRED2 somehow isn't initializing OpenGL properly, even though FS2 is.
Title: Re: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: Spoon on July 30, 2016, 09:54:00 pm
Any update on this?
Title: Re: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: AdmiralRalwood on July 31, 2016, 02:14:10 pm
Any update on this?
Are you still having this problem since PR 679 (https://github.com/scp-fs2open/fs2open.github.com/pull/679/) was merged?
Title: Re: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: Yarn on July 31, 2016, 03:09:26 pm
Any update on this?
Are you still having this problem since PR 679 (https://github.com/scp-fs2open/fs2open.github.com/pull/679/) was merged?
Yes, because, as I said earlier (http://www.hard-light.net/forums/index.php?topic=92292.msg1824229#msg1824229), the problem is not due to a failure to switch away from integrated graphics; even if you have a dedicated graphics card and nothing else, the problem still exists.
Title: Re: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: AdmiralRalwood on July 31, 2016, 09:04:57 pm
Yes, because, as I said earlier (http://www.hard-light.net/forums/index.php?topic=92292.msg1824229#msg1824229), the problem is not due to a failure to switch away from integrated graphics; even if you have a dedicated graphics card and nothing else, the problem still exists.
I was asking Spoon because I wanted to know if Spoon was still having the problem, because if he isn't then the two of you aren't having the same problem and figuring that out is an important step in the troubleshooting process.
Title: Re: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: Spoon on August 01, 2016, 11:11:06 am
Thanks to m|m making me a new fred build, can confirm that
Error: Current GL Version of 1.1 is less than the required version of 1.2.
Switch video modes or update your drivers.
File: gropengl.cpp
Line: 1460

Is still a thing.
Title: Re: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: m!m on August 01, 2016, 11:35:37 am
This may be caused by an Nvidia driver bug. The E and I have AMD GPUs and we do not experience this issue. Spoon and Axem have Nvidia GPUs and the issue occurs for them. However, DahBlount also has a Nvdia GPU and doesn't encounter this issue.
Title: Re: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: AdmiralRalwood on August 01, 2016, 02:43:53 pm
Well, at the very least I can confirm that my AMD doesn't have the same problem...
Title: Re: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: Bryan See on August 02, 2016, 12:15:08 am
But, when FRED2Open is inactive for some time, it crashes. Have anyone had the same problem as me?
Title: Re: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: chief1983 on August 02, 2016, 09:47:04 am
Any special requirement to reproduce this with Nvidia?  My GTX 970 runs a FRED build I made last night just fine, with the MediaVPs 2014 (pretty sure anyway, the Ulysses it starts up with looks a lot prettier than retail).  Bryan, if it makes you happy I'll try to just leave the window open for a while minimized and see if it crashes.
Title: Re: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: AdmiralRalwood on August 02, 2016, 12:20:31 pm
The SDL2.dll file included with the nightlies has been updated, so I've removed the download link; this thread can probably be unpinned now.
Title: Re: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: jg18 on August 02, 2016, 01:05:53 pm
But, when FRED2Open is inactive for some time, it crashes. Have anyone had the same problem as me?
I believe this is a known issue (http://www.hard-light.net/forums/index.php?topic=86773.0).
Title: Re: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: Yarn on August 02, 2016, 01:34:15 pm
Any special requirement to reproduce this with Nvidia?  My GTX 970 runs a FRED build I made last night just fine, with the MediaVPs 2014 (pretty sure anyway, the Ulysses it starts up with looks a lot prettier than retail).
Which operating system are you running? (I'm running Windows 7 64-bit.)
Title: Re: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: chief1983 on August 02, 2016, 01:57:14 pm
Windows 10 x64, just upgraded a couple weeks ago, didn't remember having any FRED issues before that but maybe haven't run it in a while.
Title: Re: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: Spoon on August 02, 2016, 03:59:58 pm
Which operating system are you running? (I'm running Windows 7 64-bit.)
Same
Title: Re: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: Solatar on August 02, 2016, 09:34:57 pm
I've got a GTX 960, Windows 10 64-bit, same issue with FRED not loading (the OpenGl version err). I have one of those alienware alpha was-supposed-to-be-steam-box things. Is there any way I can be helpful other than just adding on that I'm experiencing it?

I tried it on the most recent nightly, just to be sure.
Title: Re: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: karajorma on August 03, 2016, 10:56:17 am
I'm also getting the same issue on my GTX 660M but I'm on Windows 10.

Debugging shows that I'm being reported as having Open GL 1.1.0 even though I'm running on Geforce drivers v368.81
Title: Re: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: DahBlount on August 04, 2016, 09:43:45 pm
And now this is happening to me as well. Go figure.

Don't know what changed for me to start getting it to be honest.
Title: Re: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: karajorma on August 05, 2016, 02:34:36 am
If I run FS2 and breakpoint at the call to glGetString() I get "4.5.0 NVIDIA 368.81"

If I run FRED I get "1.1.0"

I have no idea where it's getting that value from or why it's different from the value that FS2 returns.
Title: Re: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: m!m on August 05, 2016, 03:14:14 am
It looks like the FRED startup doesn't initialize SDL correctly. Since we don't use the SDL provided main function in FRED we need to call SDL_SetMainReady(). I made the necessary changes in a branch (https://github.com/asarium/fs2open.github.com/tree/fix/fredSDLMain) but I can't test it because the error does not appear for me.
Title: Re: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: Phantom Hoover on August 05, 2016, 03:18:32 am
at this rate we're going to get FRED to feature parity on windows and linux
Title: Re: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: karajorma on August 05, 2016, 05:17:37 am
It looks like the FRED startup doesn't initialize SDL correctly. Since we don't use the SDL provided main function in FRED we need to call SDL_SetMainReady(). I made the necessary changes in a branch (https://github.com/asarium/fs2open.github.com/tree/fix/fredSDLMain) but I can't test it because the error does not appear for me.

I would test it but using git even when using SourceTree instead of TortoiseGit my workflow goes something like this.

1. Load SourceTree
2. Try to do something with git
3. Get an error message about my current repository
4. Try to fix it
5. Get an error message about whatever I'm trying to pull into my repository
6. Try to fix it
7. Fail to fix it. Shout at the computer that I don't know why I bother trying to be an SCP programmer any more
8. Go for a walk to calm down
9. Wait 2 days, return to 1.
Title: Re: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: m!m on August 08, 2016, 02:38:13 am
DahBlount has reported that #764 (https://github.com/scp-fs2open/fs2open.github.com/pull/764) fixes the issue. The next nightly will contain this fix.
Title: Re: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: chief1983 on August 08, 2016, 08:12:33 am
So by fixes it, does this mean we don't need the custom dll after all?  I lost track of whether this issue was related to the dll or not.
Title: Re: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: m!m on August 08, 2016, 08:14:56 am
The issue wasn't directly related to the DLL but the custom DLL was needed for OpenGL support in FRED. Since we don't use SDL for that anymore we don't need custom DLLs anymore.
Title: Re: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: karajorma on August 09, 2016, 03:12:11 pm
Doesn't seem to have solved it for me. FRED now stops with

Code: [Select]
Assert: "(size_t)uniform_index < uniforms.size()"
File: gropenglstate.cpp
Line: 1317

ntdll.dll! ZwWaitForSingleObject + 12 bytes
KERNELBASE.dll! WaitForSingleObject + 18 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! SCP_DumpStack + 347 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! dump_stacktrace + 87 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! os::dialogs::AssertMessage + 669 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! opengl_uniform_state::setUniformi + 109 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! opengl_shader_compile_deferred_light_shader + 126 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! opengl_shader_init + 401 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! gr_opengl_init + 750 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! gr_init_sub + 2074 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! gr_init + 1413 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! fred_init + 294 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! CFREDView::OnCreate + 194 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! CWnd::OnWndMsg + 3269 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! CWnd::WindowProc + 86 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! AfxCallWndProc + 296 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! AfxWndProc + 181 bytes
USER32.dll! SetManipulationInputTarget + 83 bytes
USER32.dll! CallWindowProcW + 768 bytes
USER32.dll! DispatchMessageW + 1328 bytes
USER32.dll! SetRectEmpty + 256 bytes
ntdll.dll! KiUserCallbackDispatcher + 54 bytes
USER32.dll! CreateWindowExW + 409 bytes
USER32.dll! CreateWindowExA + 56 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! IsolationAwareCreateWindowExA + 198 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! CWnd::CreateEx + 391 bytes
[...]
[ This info is in the clipboard so you can paste it somewhere now ]


Use Debug to break into Debugger, Exit will close the application.

ntdll.dll! ZwWaitForSingleObject + 12 bytes
KERNELBASE.dll! WaitForSingleObject + 18 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! SCP_DumpStack + 347 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! dump_stacktrace + 87 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! os::dialogs::Error + 230 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! os::dialogs::AssertMessage + 881 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! opengl_uniform_state::setUniformi + 109 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! opengl_shader_compile_deferred_light_shader + 126 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! opengl_shader_init + 401 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! gr_opengl_init + 750 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! gr_init_sub + 2074 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! gr_init + 1413 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! fred_init + 294 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! CFREDView::OnCreate + 194 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! CWnd::OnWndMsg + 3269 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! CWnd::WindowProc + 86 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! AfxCallWndProc + 296 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! AfxWndProc + 181 bytes
USER32.dll! SetManipulationInputTarget + 83 bytes
USER32.dll! CallWindowProcW + 768 bytes
USER32.dll! DispatchMessageW + 1328 bytes
USER32.dll! SetRectEmpty + 256 bytes
ntdll.dll! KiUserCallbackDispatcher + 54 bytes
USER32.dll! CreateWindowExW + 409 bytes
USER32.dll! CreateWindowExA + 56 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! IsolationAwareCreateWindowExA + 198 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! CWnd::CreateEx + 391 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! CWnd::Create + 247 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! CFrameWnd::CreateView + 434 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! CFrameWnd::OnCreateClient + 45 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! CFrameWnd::OnCreateHelper + 93 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! CFrameWnd::OnCreate + 119 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! CMainFrame::OnCreate + 48 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! CWnd::OnWndMsg + 3269 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! CWnd::WindowProc + 86 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! AfxCallWndProc + 296 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! AfxWndProc + 181 bytes
USER32.dll! SetManipulationInputTarget + 83 bytes
USER32.dll! CallWindowProcW + 768 bytes
USER32.dll! DispatchMessageW + 1328 bytes
USER32.dll! SetRectEmpty + 256 bytes
ntdll.dll! KiUserCallbackDispatcher + 54 bytes
USER32.dll! CreateWindowExW + 409 bytes
USER32.dll! CreateWindowExA + 56 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! IsolationAwareCreateWindowExA + 198 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! CWnd::CreateEx + 391 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! CFrameWnd::Create + 304 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! CFrameWnd::LoadFrame + 349 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! CDocTemplate::CreateNewFrame + 419 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! CSingleDocTemplate::OpenDocumentFile + 478 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! CSingleDocTemplate::OpenDocumentFile + 64 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! CDocManager::OnFileNew + 385 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! CWinApp::OnFileNew + 69 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! CFREDApp::InitInstance + 1868 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! AfxWinMain + 188 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! WinMain + 24 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! invoke_main + 30 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! __scrt_common_main_seh + 336 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! __scrt_common_main + 13 bytes
fred2_open_3_7_5_AVX-DEBUG.exe! WinMainCRTStartup + 8 bytes
KERNEL32.DLL! BaseThreadInitThunk + 36 bytes
ntdll.dll! RtlUnicodeStringToInteger + 595 bytes
ntdll.dll! RtlUnicodeStringToInteger + 542 bytes

As if to make things better, FS2 is now crashing out with the same error.

EDIT: Okay now it's getting stranger. Nightly builds run except for the fast debug of FRED. That one doesn't even crash out.
Title: Re: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: Yarn on August 12, 2016, 01:06:50 pm
EDIT: Okay now it's getting stranger. Nightly builds run except for the fast debug of FRED. That one doesn't even crash out.
This happens to me too. It's only the fast debug that has this problem, not the regular debug build; I verified this with builds that I compiled.
Title: Re: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: m!m on August 12, 2016, 01:30:48 pm
The FastDebug configuration was wrongly configured. I submitted a PR which fixes the issue: https://github.com/scp-fs2open/fs2open.github.com/pull/803
Title: Re: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: Bryan See on August 27, 2016, 08:46:10 am
I got the latest nightly build, but I'm still getting the same OpenGL display device initialisation failure. Even on FastDebug. That's really frustrating.

EDIT: I've forget to add this, even the earlier SDL2 dll file still cannot get FRED2_Open to start up, because of the same problem. I'm using the latest Windows 10 updated with an Anniversary Update.
Title: Re: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: AdmiralRalwood on August 27, 2016, 05:50:42 pm
I got the latest nightly build, but I'm still getting the same OpenGL display device initialisation failure. Even on FastDebug.
Please post your fs2_open.log file.  Instructions on how to do this can be found in this post.
Title: Re: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: Bryan See on September 01, 2016, 12:00:58 am
It's not the fs2_open.log file. It's the fred2_open.log file. It's included here.

[attachment deleted by admin]
Title: Re: SDL2.dll for recent FRED2_Open 3.7.5 nightlies
Post by: AdmiralRalwood on September 01, 2016, 01:12:03 am
Code: [Select]
ERROR: FRED code can only create compatibility profiles!
This has already been fixed (https://github.com/scp-fs2open/fs2open.github.com/pull/916); use a more recent nightly build.