I have a pixel shader that should just skip the input color, but instead I get a consistent result. I think my syntax could be a problem. Here is the shader:
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);
return output;
}
For testing, I have a vertex shader that precedes this in pipleline, passing the COLOR parameter of 0.5, 0.5, 0.5. Coming through a pixel shader in VisualStudio, input.color has the correct values, and they are correctly processed by output.color. However, when rendering the vertices that use this shader are all black.
Here is a description of the vertex shader element:
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 },
};
I'm not sure if it matters that the vertex shader accepts colors, since RGB produces the same thing, but the pixel shader outputs RGBA. The alpha layer works as a minimum.
, input.color , , ( ).
, ?
4 9_1, .