OpenGL Initialization is very slow

Discussion created by pillum on Feb 7, 2012
Latest reply on Feb 8, 2012 by pillum



I am programming a multi-platform game engine for windows/mac/linux/android/etc.

and I've found out, that it is taking up to 300ms to initialize OpenGL and the window.


My Testing Systems were Windows 7 x64 and Windows Developer Preview x64.


Especially the shader compiler is not very performant. My profiling results are:


Radeon 6850HD with Catalyst 12.2:


139.64msec for ChoosePixelFormat

75.9328msec for wglCreateContext


Compiling 4 shader (very simple shader)



Linking them in a Program



All in all it was around 950ms

With program binary loading instead of saving

it was only 2msec for the whole shader initialization process but still 250ms for creating the program/context/window.


But even with a not so powerful notebook with integrated Intel/Nvidia 425M GPU

the entire process took only 60ms with shader compiling

and 40ms with binary loading.

(I also noticed, that AMD is not checking if the program binary is correct. If it isn't a valid binary, it just segfaults.

Also AMD binaries are 4x the size of Nvidia Binary. Although Nvidia saves the shader source in ASM and AMD in raw text, still the size should be much smaller.)


Even with all the Context and PixelFormat Stuff!


AMD may have the better hardware, but you need to really improve your drivers.

You also see the faults of their driver if you want to use Blender with their new and shiny OpenCL Renderer named "Cycles".

Catalyst is still not able to compile it with all the functions activated for months.

Neither the CPU nor the GPU compiler can, you only can use simple clay rendering.

Even my Intel CPU OpenCL compiler can do this...


I hope that the AMD engineer read this topic and improve their driver a lot.


For the others: Is there any way I can circumvent the call to ChoosePixelFormat without knowing the pixelformatid I need to use?


Thank you, for spending time reading the text