The new versions of OpenGL bring many new features in order to fill the gap between OpenGL and Direct3D 11 functionalities. OpenGL 4.0 offers the Shader Model 5.0 support and all SM5 hardware (GeForce GTX 480/470 and Radeon HD 5000 series) will be able to run SM5 shaders.
Two important features of SM5/D3D11 are tessellation and object oriented concepts in the shading language. Tessellation is now accessible viathe GL_ARB_tessellation_shader extension that provides concepts similar to D3D11 tessellation:
- OpenGL 4.0: Tessellation Control Shader – Direct3D 11: hull shader
- OpenGL 4.0 and Direct3D 11: Fixed-function tessellation primitive generator
- OpenGL 4.0: Tessellation Evaluation Shader – Direct3D 11: domain shader
The object-oriented concept of SM5 is brought by the GL_ARB_shader_subroutine extension:
This extension adds support to shaders for “indirect subroutine calls”, where a single shader can include many subroutines and dynamically select through the API which subroutine is called from each call site. Switching subroutines dynamically in this fashion can avoid the cost of recompiling and managing multiple shaders, while still retaining most of the performance of specialized shaders.
OpenGL brings also the support of double precision floating point data within shaders. The FP64 is accessible via the GL_ARB_gpu_shader_fp64:
This extension allows GLSL shaders to use double-precision floating-point data types, including vectors and matrices of doubles. Doubles may be used as inputs, outputs, and uniforms.
Another powerful feature of OpenGL is the GL_ARB_draw_indirect. In short this feature allows to generate instanced draw commands with the GPU on-the-fly. Combined with GL_ARB_transform_feedback3 (also part of GL 4.0 features), GL_ARB_draw_indirect will allow to write a scene management system completely based on the GPU.
For more detailed explanations about the new features of OpenGL 4.0, I recommend you to read Daniel Rákos’s article: A brief preview of the new features introduced by OpenGL 3.3 and 4.0.