Dealing with GL reflection I'm planning the port of our DX based renderer to OpenGL. The target will be Desktop OpenGL 4.x. For DX we use shader reflection but as far as I know OpenGL just has glGetProgramInterfaceiv , glGetUniform and frieds. Theres also SPIR-V (I have never worked with it).

My main concerns right now are:


Using gl*: it will be done at runtime, so this will be potentially slow as there are a lot of shaders to load (+ the interface is ugly as fuck). EDIT: I guess this could be done on a prebuild step too (?).
Use SPIR-V: means that we need to add another build step and I don't see much doc around. 


I would like to hear advice from people with experience with this.
Thanks a lot!
opengl has several methods that together let you reflect the shader IO.

However it is much simpler if the shader IO is uniform across all your shaders. IOW have a set of default bindings/locations for everything. Then you only need some meta data for each shader where you deviate from those defaults for some reason.

You then only need to query that the binding exists to see whether you need to provide the data. This has the added bonus that if an input gets optimized out you'll not waste time giving data it doesn't need.