| Summary: | Screen blink between the two last display | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Taiki <taiki> |
| Component: | render | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | major | ||
| Priority: | P2 | CC: | taiki |
| Version: | 2.0.0 | ||
| Hardware: | x86_64 | ||
| OS: | All | ||
| Attachments: | Testcase | ||
|
Description
Taiki
2013-09-02 21:40:02 UTC
I made some researches, it seems that as DirectX isn't installed, D3D isn't available and the SDL fallback on OpenGL.
In WIN_GL_LoadLibrary, SDL try to load openGL32.dll using LoadLibrary("OPENGL32.DLL").
The problem seems to be than even if this file exist in System32 & SysWOW64, SDL fails at load it, can you look into that?
Okay, first change which fix things: src/video/windows/SDL_windowsopengl.c:WIN_GL_LoadLibrary:88 The function receive an argument named path which is supposed to contain the path to opengl32.dll. In the case it's null, SDL will first try to load it from the environment variables then from an hard coded string. Path is from type char also know on Windows as LPTCSTR. path is then converted to wchar (LPTSTR) by WIN_UTF8ToString, sent to the variable named wpath which is then sent to LoadLibrary, in order to load OpenGL32.dll The problem is that LoadLibrary expects to receive an argument from type LPTCSTR (http://msdn.microsoft.com/library/ms684175(VS.85).aspx). That make this call fail and the OpenGL loading to fail. I've no idea how it worked before (still investigating) but I guess it silently fallen back to DirectX which explain my failures when DirectX isn't installed. I don't have anything to generate a patch but the fix is quite straightforward: -LPTSTR wpath; ... -wpath = WIN_UTF8ToString(path); -_this->gl_config.dll_handle = LoadLibrary(wpath); +_this->gl_config.dll_handle = LoadLibrary(path); -SDL_free(wpath); My previous patch fixed some weired issues when compiled but doesn't seems related to my core issue. I'm wondering, WIN_GL_SwapWindow seems to be the core of SDL_RenderPresent and use SwapBuffers. Is it possible that there is two buffers of the display and SDL_RenderCopy only affect the hidden one? So if I add an element to the window, it won't get added to the current window but rather on a previous screen? The latest snapshot should have better OpenGL library loading behavior. Can you confirm? http://www.libsdl.org/tmp/SDL-2.0.zip With regard to multiple context behavior, can you attach a sample program (or a link to your source) so I can see what you're doing? Thanks! The library load properly but still behave strangely. An example of the problem is attached Freetype & SDL_TTF were recompiled manually without any change, I removed haptic & audio support from SDL via the header: /* Enable various audio drivers #define SDL_AUDIO_DRIVER_DSOUND 1 #define SDL_AUDIO_DRIVER_XAUDIO2 1 #define SDL_AUDIO_DRIVER_WINMM 1 #define SDL_AUDIO_DRIVER_DISK 1 #define SDL_AUDIO_DRIVER_DUMMY 1 /* Enable various input drivers #define SDL_JOYSTICK_DINPUT 1 #define SDL_HAPTIC_DINPUT 1*/ #define SDL_AUDIO_DISABLED 1 #define SDL_JOYSTICK_DISABLED 1 #define SDL_HAPTIC_DISABLED 1 Created attachment 1388 [details]
Testcase
Also, to get the issue, you need to prevent SDL from loading DirectX, which it'll try to do even if it's asked not to do. (remove DLL from System32 and SysWOW64 was enough) The bug is also reproductible on OSX Reproductible on OSX 10.8 & 10.9, I assume the underlying bug is present on every OpenGL implementation... I believe this is fixed in the latest SDL snapshot: http://www.libsdl.org/tmp/SDL-2.0.zip Please reopen the bug if you're still having issues. Thanks! |