Yes, the other way is fine; you can have extra components in the vertex buffer that are not used by the vertex shader. There may under some circumstances be a performance penalty involved in this (relative to having a vertex buffer with only the components you actually need), but the rendering will work correctly.
But if the other way is fine, the fact that I have to pass the byteCode of a compiled shader to the CreateInputLayout function it makes me wonder ...
[in] const D3D11_INPUT_ELEMENT_DESC *pInputElementDescs,
[in] UINT NumElements,
[in] const void *pShaderBytecodeWithInputSignature,
[in] SIZE_T BytecodeLength,
[out] ID3D11InputLayout **ppInputLayout
And the next logical conclusion is that because I'm considering the input layout creation process decoupled from the vertex shader input signature, then when I'll create the input layout I might need to keep a dummy vertex shader just to have the byteCode around.
a vertex shader like this could be used to have a valid bytecode:
float4 VS(in float4 pos : POSITION) : SV_Position
The CreateInputLayout will generate a warning if the vertex input parameters doesn't match that signature (just the POSITION), I'll ignore the warning and I'll have my inputLayout created.
Still, this makes me wonder that even though this approach could work it looks so unnatural to me !!!
I feel that might not be the right way to go ...