If you have a shader for some technique, it happens quite often, that you need the resolution of a certain texture the shader uses (RTV). Now I was wondering, since there are two methods to get this resolution, which one is actually faster. Consider the following:
1) I simply query the dimension of the texture inside the shader (lets make it a pixelshader - executed many times) using texture.GetDimension(w, h);
2) I could also pass the proper dimensions via a cbuffer. This would need an additional float2. Take the case, where the cbuffer is updated every frame (regardless of if the texture-dimension is added or not), and therefore only the additional bandwidth for transferring and the loading instruction inside the shader "hit" the performance.
Now what do you think is the faster way to this? Or is the performance difference negligible (therefore one simply uses the more comfort method)?