21 minutes ago, komilll said:What's the difference between .fx and .vs/.ps? Can I modify .fx on runtime and continue to use it?
.fx files are being compiled with the HLSL compiler in Visual Studio, so there is no need to compile all shaders when you start your program - which might take a minute if you have a lot of shaders. And you are not giving away your shader source code to players. Or students. Our professor at university had put the shader code as text into the example program that should just show us how it should look. We could simply look up all the strings to find the code and then use it for our homework which was writing those exact shaders. ?
21 minutes ago, komilll said:I had no idea, I wasn't thinking about it back then. However, do you still recommend using std::array<float> or C-style array instead of storing XMFLOAT4 in buffer struct? Or is it ok for feature level 10.0?
XMFLOAT4 is fine, it doesn't require alignment. XMVECTOR and XMMATRIX need the 16 bit alignment for the math operations, including copying afaik. If you only put the structs containing them on the stack and use Map, you are fine if you use __declspec(align(16)) for the structs. But in many cases you need 3 or less components and should use XMFLOAT3 etc. anyway. If you ever want to add DirectX 9 support for people using antiquated hardware this will break though.