title: HLSL custom bitpacking not working correctly
body: <p>I'm a bit of a noob with Directx but i have been trying to get this custom bitpacking working all day. I'm trying to pack a float4 and another float into a uint. The float4 is a color and the float is a depth value. I want to use 6 bits each for the color, and the remaining 8 bits for depth. Precision is not important. I thought I understood what i was doing, but when unpacking, it just keeps returning all zeros. Is this even possible? The pixel format is R16G16B16A16_FLOAT.</p>
  
  <p>Here is the code</p>
  
  <pre><code>uint PackColorAndDepthToUint(float4 Color, float Depth)
  {
  
      uint4 u = (int4) (Color * float4(255, 255, 255, 1.0f));
      uint packedOutput = (u.a &lt;&lt; 26) | (u.b &lt;&lt; 20) | (u.g &lt;&lt; 14) | (u.r &lt;&lt; 8) | asuint(Depth * 255);
      return packedOutput;
  }
  
  void UnpackColorAndDepthFromUint(uint packedInput, out float4 Color, out float Depth)
  {
      uint d = (packedInput &amp; 255);
      Depth = ((float) d / 255);
      uint r = (((packedInput &gt;&gt; 8)) &amp; 64);
      uint g = (((packedInput &gt;&gt; 14)) &amp; 64);
      uint b = (((packedInput &gt;&gt; 20)) &amp; 64);
      uint a = (((packedInput &gt;&gt; 26)) &amp; 64);
      uint4 co = uint4(r, g, b, a);
  
      Color = (((float4) co) / float4(255, 255, 255, 1.0f));
  }
  </code></pre>
  
  <p>if anyone can point me in the right direction i would appreciate it!</p>