title: How to make a sampler2D struct with dynamic values?
body: <p>Here's my scenario:</p>
  
  <pre><code>texture diffuseMap;
  
  sampler2D diffuseSampler = sampler_state {
      Texture = &lt;diffuseMap&gt;;
      Filter = MIN_MAG_MIP_LINEAR;
      AddressU = WRAP;
      AddressV = WRAP;
  };
  </code></pre>
  
  <p>I would like to be able to change the <code>diffuseSampler</code> Filter value <strong>from within my C# application</strong> by passing a parameter to my effect. Here is how I pictured it:</p>
  
  <pre><code>#define __DiffuseFilterLinear      0x0
  #define __DiffuseFilterAnisotropic 0x1
  #define __DiffuseFilterNearest     0x2
  
  int diffuseMapFilter; // Here's where I'll assign, via my application,
                        // a hex value corresponding to one of the three
                        // #defines above
  </code></pre>
  
  <p>Then, inside <code>diffuseSampler</code>, I would like to achieve the equivalent to setting the Filter value using conditionals, like so:</p>
  
  <pre><code>sampler2D diffuseSampler = sampler_state {
      Texture = &lt;diffuseMap&gt;;
  
      // Conditionals to pick the right Filter value
      switch (diffuseMapFilter)
      {
      case __DiffuseFilterLinear:
          Filter = MIN_MAG_MIP_LINEAR;
          break;
      case __DiffuseFilterAnisotropic:
          Filter = ANISOTROPIC;
          break;
      case __DiffuseFilterNearest:
          Filter = MIN_MAG_MIP_POINT;
          break;
      }
  
      AddressU = WRAP;
      AddressV = WRAP;
  };
  </code></pre>
  
  <p>I know trying to insert a switch block inside a sampler struct is probably an heresy, but I think it illustrates what I am trying to do.</p>
  
  <p>How can I set the <code>diffuseSampler</code> Filter value according to the <code>diffuseMapFilter</code> parameter?</p>