I'm new with shaders so this might be a wierd question, but does it make sense to make it possible to use the same shader with different buffers and even with differen buffer layouts?
5 replies to this topic
Sponsor:
#6 Moderators - Reputation: 5462
Posted 03 March 2012 - 08:28 PM
In D3D10/D3D11 you're okay as long as the vertex buffer has at least the elements required by the vertex shader, and you always use an input layout created for vertex layout/vertex shader input signature combination. If the vertex buffer doesn't have an element required by the vertex shader, then creating the input layout will fail. So in other words it's okay for a vertex buffer to have too many elements, but not for it to have not enough elements. In D3D9 if you don't have enough elements in your vertex buffer the runtime will just supply 0's for those values, however if you have the debug runtimes enabled it will spew warnings about it.
I'm not sure how it works in OpenGL, so I can't comment on that.
I'm not sure how it works in OpenGL, so I can't comment on that.






