title: Passing colors through a pixel shader in HLSL
body: <p>I have have a pixel shader that should simply pass the input color through, but instead I am getting a constant result. I think my syntax might be the problem. Here is the shader:</p>
  
  <pre><code>struct PixelShaderInput
  {
      float3 color : COLOR;
  };
  
  struct PixelShaderOutput
  {
      float4 color : SV_TARGET0;
  };
  
  PixelShaderOutput main(PixelShaderInput input)
  {
      PixelShaderOutput output; 
      output.color.rgba = float4(input.color, 1.0f); // input.color is 0.5, 0.5, 0.5; output is black
      // output.color.rgba = float4(0.5f, 0.5f, 0.5f, 1); // output is gray
      return output;
  }
  </code></pre>
  
  <p>For testing, I have the vertex shader that precedes this in the pipleline passing a COLOR parameter of 0.5, 0.5, 0.5. Stepping through the pixel shader in VisualStudio, input.color has the correct values, and these are being assinged to output.color correctly. However when rendered, the vertices that use this shader are all black. </p>
  
  <p>Here is the vertex shader element description:</p>
  
  <pre><code>const D3D11_INPUT_ELEMENT_DESC vertexDesc[] = 
  {
      { "POSITION",   0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
      { "COLOR",      0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
      { "TEXCOORD",   0, DXGI_FORMAT_R32G32_FLOAT,    0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
  };
  </code></pre>
  
  <p>I'm not sure if it's important that the vertex shader takes colors as RGB outputs the same, but the pixel shader outputs RGBA. The alpha layer is working correctly at least. </p>
  
  <p>If I comment out that first assignment, the one using input.color, and uncomment the other assignment, with the explicit values, then the rendered pixels are gray (as expected). </p>
  
  <p>Any ideas on what I'm doing wrong here? </p>
  
  <p>I'm using shader model 4 level 9_1, with optimizations disabled and debug info enabled. </p>