Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Crash on startup when using dock station.  (Read 10746 times)

0 Members and 1 Guest are viewing this topic.

ThreeDumps

  • Newbie
  • *
  • Posts: 34
    • View Profile
Crash on startup when using dock station.
« on: July 27, 2021, 12:14:58 am »
I use USB dock station with 2 monitors attached to it.

When I run app disconnected, it starts and run properly.
When I run app connected, it crash.
When I run app disconnected, then connect after app started, run properly.

internal class Program
{
    public static void Main(string[] args)
    {
         var window = new RenderWindow(new VideoMode(200,200), "test");
    }
}

Code: [Select]
Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at SFML.Graphics.RenderWindow.sfRenderWindow_createUnicode(VideoMode Mode, IntPtr Title, Styles Style, ContextSettings& Params)
   at SFML.Graphics.RenderWindow..ctor(VideoMode mode, String title, Styles style, ContextSettings settings)
   at SFML.Graphics.RenderWindow..ctor(VideoMode mode, String title)
   at Guids.Client.Program.Main(String[] args) in **[not important]**/Program.cs:line 10


eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Crash on startup when using dock station.
« Reply #1 on: August 05, 2021, 11:58:45 am »
Hard to say what's going on here.
You'd need to dig deeper into CSFML or SFML itself to see where the crash happens.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

ThreeDumps

  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: Crash on startup when using dock station.
« Reply #2 on: August 11, 2021, 09:26:51 pm »
Damn, sounds like a journey.

I had some time this evening so, well, I compiled SFML from source code and that's result:

Code: [Select]
Exception thrown at 0x0000000000000000 in Project1.exe: 0xC0000005: Access violation executing location 0x0000000000000000.

Exception happens in:
WINGDIAPI int   WINAPI ChoosePixelFormat( _In_ HDC hdc, _In_ CONST PIXELFORMATDESCRIPTOR *ppfd);

WglContext.cpp:402

// Get the pixel format that best matches our requirements
bestFormat = ChoosePixelFormat(deviceContext, &descriptor);
 

Code: [Select]
0000000000000000() Unknown
  ig9icd64.dll!00007ffc394ea950() Unknown
  ig9icd64.dll!00007ffc394dc4b4() Unknown
  ig9icd64.dll!00007ffc394c1a34() Unknown
  opengl32.dll!00007ffcea5a32bb() Unknown
  opengl32.dll!00007ffcea5a0e3f() Unknown
  opengl32.dll!00007ffcea5a331c() Unknown
  opengl32.dll!00007ffcea5bf4f0() Unknown
  opengl32.dll!00007ffcea5c0511() Unknown
  opengl32.dll!00007ffcea5bf913() Unknown
  gdi32full.dll!00007ffd1fa92449() Unknown
sfml-window-d-2.dll!sf::priv::WglContext::selectBestPixelFormat(HDC__ * deviceContext, unsigned int bitsPerPixel, const sf::ContextSettings & settings, bool pbuffer) Line 402 C++
  sfml-window-d-2.dll!sf::priv::WglContext::setDevicePixelFormat(unsigned int bitsPerPixel) Line 412 C++
  sfml-window-d-2.dll!sf::priv::WglContext::createSurface(sf::priv::WglContext * shared, unsigned int width, unsigned int height, unsigned int bitsPerPixel) Line 576 C++
  sfml-window-d-2.dll!sf::priv::WglContext::WglContext(sf::priv::WglContext * shared) Line 99 C++
  sfml-window-d-2.dll!sf::priv::GlContext::initResource() Line 259 C++
  sfml-window-d-2.dll!sf::GlResource::GlResource() Line 38 C++
  sfml-window-d-2.dll!sf::Window::Window() Line 49 C++
  sfml-graphics-d-2.dll!sf::RenderWindow::RenderWindow(sf::VideoMode mode, const sf::String & title, unsigned int style, const sf::ContextSettings & settings) Line 45 C++
  Project1.exe!main() Line 5 C++



eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Crash on startup when using dock station.
« Reply #3 on: August 11, 2021, 09:44:40 pm »
You Intel Graphics driver seems to try and access a nullptr? ;D

Ensure you're not running in a VM and that your Intel Graphics driver is up to date (check the official Intel website). And if you have dual GPU, you should be able to specify on which GPU your application is running.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

ThreeDumps

  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: Crash on startup when using dock station.
« Reply #4 on: August 11, 2021, 10:42:01 pm »
I have two graphics cards, but with docking station it is three drivers (display adapters).

I checked if cards behave same on dock, so small update:
Without docking station I'm able to run SFML app on both graphic cards.
With docking station I'm able to run SFML app only on integrated card (Intel HD Graphics 630), but not on hi performance (NVIDIA GeForce GTX 1060).

Not sure in what context display adapter for dock stations works (Kensington USB3.0 Video Dock).

All drivers are updated.

I had similar issue (not able to run on hi-perf card when screens are connected by docking station) for one game in beta, but after official release it was working properly.

If its bug in integrated card driver it should not work on both (dock and without dock)
If its bug in hi-perf card it should not work on both (dock and without dock)
If its bug in dock station it should not work when dock station is plugged in.

But it don't work only on dock + hi-perf.

From your perspective it seems that issue is in driver and there is nothing what can be done in SFML?

How can I check with what driver SFML communicating is? It's strange that after connecting docking station (with two screens) Hi-Perf GPU driver start working in different way.