title: HLSL: Getting texture dimensions in a pixel shader
body: <p>I have a texture and I need to know its dimensions within a pixel shader. This seems like a job for <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/bb509693%28v=vs.85%29.aspx" rel="nofollow">GetDimensions</a>. Here's the code:</p>
  
  <pre><code>Texture2D t: register(t4);
  ...
  float w;
  float h;
  t.GetDimensions(w, h);
  </code></pre>
  
  <p>However, this results in an error:</p>
  
  <blockquote>
    <p>X4532: cannot map expression to pixel shader instruction set</p>
  </blockquote>
  
  <p>This error doesn't seem to be documented anywhere. Am I using the function incorrectly? Is there a different technique that I should use?</p>
  
  <p>I'm working in shader model 4.0 level 9_1, via DirectX. </p>