tksuoran's picture

Graphicsmode Exception that should never happen

One of my testers reported this:

Graphicsmode exception

He is running on
Win7
Intel(r) core tm 2 quad Q9300
Nvidia 9800GT(512 MB)
2x2048MB DDR2

Will get driver version when he reports it.

Inline Images
Graphics mode exception

Comments

Comment viewing options

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

This exception is raised when OpenTK fails to find any available modes through WGL or GDI. It might indicate a permission issue: try running a minimal OpenTK application from a local hard drive to exclude that possibility.

tksuoran's picture

Thanks, I will try. Would it be possible to check for these permissions programmatically?

tksuoran's picture

Now I'm getting this on one machine, even when run as admin. Any ideas?

---------------------------
Neure Sandbox - Generic Error
---------------------------
An error has occurred.
Please report this to tksuoran@gmail.com
You can press CTRL-C to copy text from this window.
Thank you.

OpenTK.Graphics.GraphicsContextException: Requested GraphicsMode not available. SetPixelFormat error: 87

at OpenTK.Platform.Windows.WinGLContext.SetGraphicsModePFD(GraphicsMode mode, WinWindowInfo window)

at OpenTK.Platform.Windows.WinGLContext..ctor(GraphicsMode format, WinWindowInfo window, IGraphicsContext sharedContext, Int32 major, Int32 minor, GraphicsContextFlags flags)

at OpenTK.Platform.Windows.WinFactory.CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, Boolean directRendering, Int32 major, Int32 minor, GraphicsContextFlags flags)

at OpenTK.Graphics.GraphicsContext..ctor(GraphicsMode mode, IWindowInfo window, Int32 major, Int32 minor, GraphicsContextFlags flags)

at OpenTK.GameWindow..ctor(Int32 width, Int32 height, GraphicsMode mode, String title, GameWindowFlags options, DisplayDevice device, Int32 major, Int32 minor, GraphicsContextFlags flags, IGraphicsContext sharedContext)

at OpenTK.GameWindow..ctor(Int32 width, Int32 height, GraphicsMode mode, String title, GameWindowFlags options, DisplayDevice device, Int32 major, Int32 minor, GraphicsContextFlags flags)

at Sandbox.Sandbox..ctor(DisplayDevice display)

at Sandbox.Sandbox.Main(String[] args)
---------------------------
OK
---------------------------

the Fiddler's picture

Win32 error 87 is "ERROR_INVALID_PARAMETER: The parameter is incorrect." What GraphicsMode parameters are you requesting?

tksuoran's picture

Ah, I see. I was asking for

new GraphicsMode(
new ColorFormat(8, 8, 8, 0), // r g b a
24, 8, 4 /* depth stencil msaa */
),

Not all drivers support 4x msaa for example..

the Fiddler's picture

The latest SVN version contains is much more robust in handling unsupported modes. It will gradually relax parameters (least important first) until it finds a supported configuration.

Might be worth checking out.

c2woody's picture

Btw. can the mode currently be forced to be a non-AA mode? I think specifying 0 will allow anything.

the Fiddler's picture

A value of 0 will result in AA not being set in the pixel format parameters. This will result in no AA unless overridden by the driver (in which case there's nothing we can do).

c2woody's picture
Quote:

This will result in no AA unless overridden by the driver (in which case there's nothing we can do).

The code in ModeSelector looks like in the ==0 case it does not care about the AA samples in the mode:
(samples != 0 ? current.Samples >= samples : true)

Also currently if the mode list contains two almost-identical modes that differ only in the stencil and AA samples (first has both enabled, second has both disabled) the parameter relaxing does not continue when stencil was requested (mode is accepted) even though relaxing the stencil parameter could fulfil the AA-disabled request.

The reason I'm asking about forcing an AA-disabled mode is that in some case that's absolutely necessary as far as I know, like when feedback through color selection is required (any anti-aliasing technique kills this).

tksuoran's picture

You could use a specific framebuffer object for color selection, and keep the default frame buffer potentially multisampled.