thorrablot's picture

OpenTK CreateContextAttribsARB crash using NVidia Quadro 4000, Windows 7 (x86)

This issue seems to come up occasionally when I searched the forumsm e.g. here

I'm getting an occasional, intermittent access violation in Wgl.Delegates.CreateContextAttribsARB.Invoke when running a suite of automated integration tests. The platform configuration is as follows:

Windows 7 Enterprise, 32-bit, SP1
NVidia Quadro 4000
Driver: occurs on both 276.14 and 285.58 (latest)

I have not seen this problem when running the same test suite on other NV hardware (e.g. NVS 3100M/259.22)

Has anyone else encountered this issue with recent/new NV hardware and OpenTK? I'm creating my own GC for this application.

10/25/2011 09:39:03 --  Info : Error: Exception  -  System.AccessViolationException - Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at OpenTK.Platform.Windows.Wgl.Delegates.CreateContextAttribsARB.Invoke(IntPtr hDC, IntPtr hShareContext, Int32* attribList)
   at OpenTK.Platform.Windows.Wgl.Arb.CreateContextAttribs(IntPtr hDC, IntPtr hShareContext, Int32[] attribList) in C:\src_noscm\OpenTK_1.0\Source\OpenTK\Platform\Windows\Bindings\Wgl.cs:line 551
   at OpenTK.Platform.Windows.WinGLContext..ctor(GraphicsMode format, WinWindowInfo window, IGraphicsContext sharedContext, Int32 major, Int32 minor, GraphicsContextFlags flags) in C:\src_noscm\OpenTK_1.0\Source\OpenTK\Platform\Windows\WinGLContext.cs:line 113
   at OpenTK.Platform.Windows.WinFactory.CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, Boolean directRendering, Int32 major, Int32 minor, GraphicsContextFlags flags) in C:\src_noscm\OpenTK_1.0\Source\OpenTK\Platform\Windows\WinFactory.cs:line 53
   at OpenTK.Graphics.GraphicsContext..ctor(GraphicsMode mode, IWindowInfo window, Int32 major, Int32 minor, GraphicsContextFlags flags) in C:\src_noscm\OpenTK_1.0\Source\OpenTK\Graphics\GraphicsContext.cs:line 115
   at OpenTK.Platform.Windows.WinGraphicsMode.SelectGraphicsModeARB(ColorFormat color, Int32 depth, Int32 stencil, Int32 samples, ColorFormat accum, Int32 buffers, Boolean stereo) in C:\src_noscm\OpenTK_1.0\Source\OpenTK\Platform\Windows\WinGraphicsMode.cs:line 158
   at OpenTK.Platform.Windows.WinGraphicsMode.SelectGraphicsMode(ColorFormat color, Int32 depth, Int32 stencil, Int32 samples, ColorFormat accum, Int32 buffers, Boolean stereo) in C:\src_noscm\OpenTK_1.0\Source\OpenTK\Platform\Windows\WinGraphicsMode.cs:line 70
   at OpenTK.Graphics.GraphicsMode.LazySelectGraphicsMode() in C:\src_noscm\OpenTK_1.0\Source\OpenTK\Graphics\GraphicsMode.cs:line 346
   at OpenTK.Graphics.GraphicsMode.get_Index() in C:\src_noscm\OpenTK_1.0\Source\OpenTK\Graphics\GraphicsMode.cs:line 183
   at OpenTK.Graphics.GraphicsMode.ToString() in C:\src_noscm\OpenTK_1.0\Source\OpenTK\Graphics\GraphicsMode.cs:line 367
   at System.Text.StringBuilder.AppendFormat(IFormatProvider provider, String format, Object[] args)
   at System.String.Format(IFormatProvider provider, String format, Object[] args)
   at System.Diagnostics.Debug.Print(String format, Object[] args)
   at OpenTK.Graphics.GraphicsContext..ctor(GraphicsMode mode, IWindowInfo window, Int32 major, Int32 minor, GraphicsContextFlags flags) in C:\src_noscm\OpenTK_1.0\Source\OpenTK\Graphics\GraphicsContext.cs:line 94
   at OpenTK.Graphics.GraphicsContext..ctor(GraphicsMode mode, IWindowInfo window) in C:\src_noscm\OpenTK_1.0\Source\OpenTK\Graphics\GraphicsContext.cs:line 59
...(my app layer below)

This is acquiring an RGB10_A2 PixelFormat (on a DisplayPort connected DeepColor display)

I haven't been able to get a Debug dump of the failure yet. When working correctly (i.e. no CreateContextAttribsARB access violation), the Debug output looks like this:

Detected configuration: Windows / .Net
Creating GraphicsContext.
    DisplayDevice 1 (primary) supports 411 resolutions.
    DisplayDevice 2 (secondary) supports 0 resolutions.
    Creating default GraphicsMode (32, 16, 0, 0, 0, 2, False).
    Creating GraphicsContext.
        Device context: 1661010224
        Selecting pixel format... GraphicsMode: Index: 11, Color: 24 (8880), Depth: 0, Stencil: 0, Samples: 0, Accum: 64 (16161616), Buffers: 2, Stereo: False
        IWindowInfo: Windows.WindowInfo: Handle 133258, Parent (Windows.WindowInfo: Handle 591982, Parent (null))
        GraphicsContextFlags: Default
        Requested version: 1.0
        Loaded opengl32.dll: 1502806016
        OpenGL will be bound to handle: 133258
        Setting pixel format... 11
        Creating temporary context for wgl extensions.
        Load extensions for OpenTK.Platform.Windows.Wgl... 50 extensions loaded in 10 ms.
        Load extensions for OpenTK.Platform.Windows.Wgl... 50 extensions loaded in 0 ms.
        Using WGL_ARB_create_context... success!
        success! (id: 131072)
    Selecting pixel format (ARB)... success!
    Disposing context 131072.
    Destroying window: Windows.WindowInfo: Handle 591982, Parent (null)
    GraphicsMode: Index: 256, Color: 32 (1010102), Depth: 0, Stencil: 0, Samples: 0, Accum: 64 (16161616), Buffers: 2, Stereo: False
    IWindowInfo: Windows.WindowInfo: Handle 133220, Parent (null)
    GraphicsContextFlags: Default
    Requested version: 1.0
    OpenGL will be bound to handle: 133220
    Setting pixel format... 256
    Using WGL_ARB_create_context... success!
    success! (id: 196608)
Load extensions for OpenTK.Platform.Windows.Wgl... 50 extensions loaded in 1 ms.
Loading extensions for OpenTK.Graphics.OpenGL.GL... 1900 extensions loaded in 211.432 ms.
Disposing context 196608.
Creating GraphicsContext.
    GraphicsMode: Index: 256, Color: 32 (1010102), Depth: 0, Stencil: 0, Samples: 0, Accum: 64 (16161616), Buffers: 2, Stereo: False
    IWindowInfo: Windows.WindowInfo: Handle 198756, Parent (null)
    GraphicsContextFlags: Default
    Requested version: 1.0
    OpenGL will be bound to handle: 198756
    Setting pixel format... 256
    Using WGL_ARB_create_context... success!
    success! (id: 262144)
Disposing context 262144.
...

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

Can you please compile the latest code from svn? It contains some changes that might influence this behavior.

thorrablot's picture

Yes - I've pulled it down and will run some tests tonight.

thorrablot's picture

Good news - I've run our automated suite 4 times against the svn head now without generating the CreateContextAttribsARB crash on this system, so this is encouraging. There were a couple other unexpected changes to the API I had to code around. I'll send a message about those.

What's the timeline for the next release?