
Problems with improper resource cleanup
Posted Wednesday, 16 June, 2010 - 23:36 by sgsrules inI recently added multiple render targets to my engine, i also use 16x multisampling. Everything works fine until i quit and try to restart the app. If i enable multisampling i get a opengl error dialogue box that says:
Your hardware configuration does not meet the minimum specifications needed to run the application. The application must close.
please visit etc....
Eventhough it worked fine on the first run. At this point if i restart my pc i can get it working again, until i quit and try to run it again. So i'm guessing that by restarting my pc i'm clearing out the video ram or anything else that still might be resident so the cause of the issue is improper resource cleanup. Ii've made sure i deleted all my textures, framebuffers, vbos, vaos etc etc. And whouldn't the driver clean up any leftovers when the glcontext is destroyed anyways? I'm manually calling glcontext.Dispose(); after resource cleanup.
All my buffers reports that they are complete and without errors.
Another note of interest is that i only get this error when i render to more than one buffer at once using gldrawbuffers and if i use 16x msaa, if i use 8x msaa or lower or just render to one target there are no errors.
I


Comments
Re: Problems with improper resource cleanup
You are probably running into a bug within your video driver. You should try updating your drivers to make sure they are the latest.
Re: Problems with improper resource cleanup
I already tried updating to the latest nvidia drivers dated 6/15/10. same issue.
i'm deleting my buffers and other stuff by using
GL.DeleteFrameBuffers(1, fboid);
where fboid: int[] fboid = new int[1];
Which i'm sure is correct. and i'm not doing this from a finalizer i'm making all the delete calls myself.
Re: Problems with improper resource cleanup
I have had such a problem before two or three years, with a uptodate system (windows), with uptodate drivers (nvidia) and some opengl-apps, not self-written. With some other opengl-apps (self-written or not) these problem was not existing.
From one day to another day, without changing something (so far as I know), these problems are gone. :-?
But that is not a great help for you, I know.
Is there a difference if you let run your app under different conditions (with/without ide, debug/release)?
Re: Problems with improper resource cleanup
If you are using OpenGL 3.x+, you should call
GL.GenFrameBuffersto create buffer ids.Other than that, try running with the debug version of OpenTK.dll, which will check and inform you of any OpenGL errors (that may otherwise go unnoticed). This is a great time saver for complex applications.
You can find the debug version under opentk-1.0/Binaries/OpenTK/Debug.
Re: Problems with improper resource cleanup
I'm using GL.GenFrameBuffers to create my ids. Can you set opentk to debug mode when you create your context? I use the following to create my context:
will changing
GlContext = new GraphicsContext(t, nWindow.WindowInfo, 3, 2, GraphicsContextFlags.Default);to
GlContext = new GraphicsContext(t, nWindow.WindowInfo, 3, 2, GraphicsContextFlags.Debug);do the same thing as using the debug version of opentk? How is this different than using glgeterror or checking buffer completeness?
Re: Problems with improper resource cleanup
GraphicsContextFlags.Debugis related to the concept of "debug" contexts. It was added in OpenGL 3.0 but AFAIK AMD is the only one to actually support this (via the AMD_debug_output extension).The debug version of OpenTK adds extra debugging information and compile-time
GL.GetError()checks to all OpenGL calls. It's useful as a debugging aide during application development (i.e., are you checkingGL.GetError()during resource cleanup? You might be getting some error that confuses the driver.)In all likelihood, this is a driver bug. Does this issue appear on different hardware?
Edit: what video card, OS and drivers are you using? Is your app running in 32bit or 64bit mode?
Re: Problems with improper resource cleanup
Here's some info on my setup:
Windows 7 64bit
nvidia gtx260
257.21 nvidia drivers
intel quad core 3.2 ghz
4gb ram
Opengl 3.2 core profile.
I'm compiling in 64bit mode. The fbos i'm creating are:
1920x1080 16xMSAA RGBA16f with two attachments. this is used for my initial pass.
I've also got another 1920x1080 no msaa RGBA16f with 3 attachments to resolve the msaa and for postprocessing and then there's some smaller sized fbos but i turned those off for now for debugging.
If i turn the resolution down i don't get any errors but unfortunately my final renders have to be at 1080p with 16xMSAA.
BTW once again thanks for all your help, i'm going to check for errors during resource cleanup as you suggested .
**Edit** checked for errors using debug mode(Man i wish i would have know about that before); i ran into one invalid enumerator but it was unrelated. I traced through my whole code and it looks like it is able to render one frame with msaa on but the second time it makes a call to GlContext.SwapBuffers(); it crashes. here's some of my code:
msaa fbo setup:
I Then Bind the fbo with
normally i draw my scene but i turned all that off for debugging.
unbind fbo and swap buffers:
I then normally resolve the samples in a shader and apply post processing etc but i stripped all that out for debugging. Thats pretty much everything i've got code posted for my glcontext creation above.
Re: Problems with improper resource cleanup
Can you please post the stacktrace for the crash? Use the debug version of OpenTK.dll *and* OpenTK.pdb (found in the same folders) to obtain line numbers. Maybe this could shed some light into the issue.
Re: Problems with improper resource cleanup
Does the .pdb file get loaded when i load the debug opetk.dll? I don't get a stacktrace when it crashes, just the nvidia driver error dialogue box pops up i hit ok and it closes my app and stops the debugging. I did notice a few weird things in my debug window when i normally open and close it:
these last two warnings:
Seem to indicate that it's not releasing the context.
**Edit **
I added a call to INativeWindow.Dispose() and that got rid of the warnings but i'm still having the same problem. I also noticed that now it started crashing after msaa has been on for a while, it renders a few frames and then i get the driver error
Re: Problems with improper resource cleanup
This is definitely a driver issue. I ran the app on another machine running windows xp and a 8800gtx, no problems. Ran the same app on the same machine with windows 7... nvidia driver crash. At this point i'm kinda wishing i would've never switched to windows 7 because of all the driver issues i've been having, stuff like texturesize and texelfetch didn't even work until the latest driver revision i had to use the developer opengl 3.3 drivers. So until nvidia fixes this issue i'm stuck with 8x msaa or rendering stuff on my xp machine. How does one go about reporting something like this to nvidia and more importantly will it really matter?