1) used to grab data from the shaders (possibly for debugging purposes)
2) used to validate if 2 more shaders are compatible with each other. so in the case of a vertex shader and a pixel shader, it can be used to see if the vs' output struct matches ps' input struct?
and lastly I'm not too sure about this one :
3) used to dynamically create constant buffers in the renderer? With shader reflection, you can see what constant buffers and its variables are in that particular shader (as well as texture buffers). But even though you know the variable's type, name, etc, how exactly do you use that data to dynamically create a constant buffer?
My other questions are :
It seems like shader reflection is completely optional and isn't required to create a constant buffer?
When defining a "hard-coded" constant buffer, do the variables in the application
//.cppstruct CB_VS_PER_OBJECT{ D3DXMATRIX m_WorldViewProj; D3DXMATRIX m_World;};
have to exactly match the constant buffer in the shader (order and type)?
//.fxcbuffer cbPerObject : register( b0 ){ matrix g_mWorldViewProjection : packoffset( c0 ); matrix g_mWorld : packoffset( c4 );};