
deleting shaders, programs, etc...
Posted Friday, 6 July, 2012 - 12:32 by lid6j86 inHow expensive are the calls to delete shaders, programs, etc...?
is it better to keep the program around if it's going to be used a lot, or to just create it every time I'm about to use it, then delete it immediately afterward? Does creating and destroying them every frame cost that much? (this question also applies to VBO's, etc...)


Comments
Re: deleting shaders, programs, etc...
It is of course more performant to keep the resources and reuse them. The pipeline of shader program creation involves compiling, linking and uploading the program to the video card, which is a very large overhead. This is even more significant for buffers such as VBOs, because they store potentially much more data than just a few bytes of shader instructions. The transfer between CPU and GPU is usually the main bottleneck of an application, so you should aim for a minimum GL calls and data uploads and downloads (i.e. GL.Get* commands, for example). You should even try to use the same shader for different objects, if possible, to minimize program switching at runtime.
Re: deleting shaders, programs, etc...
question in regards to VBOs then, I've had no problem attaching multidimensional arrays to VBOs, but I'm getting an error putting a jagged array in there, with it saying "The type 'OpenTK.Vector3[]' must be a non-nullable value type".
is there something special I need to do with jagged arrays?
by the way, I think I owe an apology to most of the regulars on here, I've posted a lot of stupid questions... half of which i was able to answer on my own, half of which were sort of dumb. anyways, thank you for the help!
Re: deleting shaders, programs, etc...
question in regards to VBOs then, I've had no problem attaching multidimensional arrays to VBOs, but I'm getting an error putting a jagged array in there, with it saying "The type 'OpenTK.Vector3[]' must be a non-nullable value type".
Does this help you?
Re: deleting shaders, programs, etc...
I just ended up changing it into a multidimensional array instead of a jagged, got the end result i was looking for anyway