Quote:Original post by MJP
Quote:Original post by undead
I subspect the 2-pass technique has the potential to be a bit faster on D3D9 because a smart graphics driver could avoid an extra "vertex format/vertex shader input" linkage (as long as the VB is untouched and the vertex shader inputs are the same for both passes).
That doesn't really make sense, since the driver has no knowledge of techniques are passes. Those are purely user-side constructs that are part of the effects framework. Either way the driver will only know that you switched shaders.
It seems you have a (strong) point.
I still wonder if the single technique is faster, as my reasoning can be applied to the effect framework.
I was referring to this part of D3D10 documentation:
Quote:
Mapping the vertex data to the shader inputs with an input layout is a new way of doing things in Direct3D 10 that improves performance.
In Direct3D 10 the vertex data is mapped to the shader inputs when the input layout object is created, whereas in Direct3D 9 this mapping was done at Draw time based on the currently bound vertex declarations, vertex buffers, and vertex shaders. Doing this mapping when the input layout object is created reduces or eliminates extra linkage work for drivers at Draw time because this re-mapping is no longer necessary.
I was wondering if somewhere (it could be the effect framework itself) a part of code could verify if the vertex shader inputs are the same for both passes and skip the unnecessary linking for the second pass until another technique is in use.
After all a technique is in use between Begin/End pairs and the technique itself can know if its passes have compatible vertex shader inputs. So to just have a list of vertex shader input formats would allow the effect framework to perform such an optimization. 3 passes, one vertex shader input format.. et voila!
If it's impossible to do it because D3D API always performs linkage after a draw call, then I'm forced to believe sending a set of N draw calls, one after another without changing shader or VB forces N re-links!!!
Wow.. it would be a very bad way to draw stuff!!!
If it's the case, then I understand why they changed this mechanism... :)