who set the w_component value of sv_position vector4 ?

Mar 22, 2013 at 3:22 AM
Edited Mar 22, 2013 at 3:25 AM
  1. here is a VertexShader in dtk and I found no one set any value to w_component of position.
    // Vertex shader: basic.
    VSOutput VSBasic(VSInput vin)
    {
    VSOutput vout;

    CommonVSOutput cout = ComputeCommonVSOutput(vin.Position);
    SetCommonVSOutputParams;

    return vout;
    }
  2. if I Draw vertex of VertexPositionColor there is still no one set value to w_component(just x\y\z) .
    { "SV_Position", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
    { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
  3. then who sets the value of w_component is mysterious to me.
Coordinator
Mar 22, 2013 at 6:07 AM
w value defaults to 1 if the input layout provides less than all 4 channels.
Mar 23, 2013 at 12:56 PM
This eliminates the confusion,thanks!