Sign in to follow this  
wilfrid

Vertex attributes default values ?

Recommended Posts

wilfrid    650

If I create a vertex buffer with data like this (code from DirectX SDK Tutorial07):

 

    SimpleVertex vertices[] =
    {
        { XMFLOAT3( -1.0f, 1.0f, -1.0f ), XMFLOAT2( 0.0f, 0.0f ) },
        { XMFLOAT3( 1.0f, 1.0f, -1.0f ), XMFLOAT2( 1.0f, 0.0f ) },
        { XMFLOAT3( 1.0f, 1.0f, 1.0f ), XMFLOAT2( 1.0f, 1.0f ) },
        { XMFLOAT3( -1.0f, 1.0f, 1.0f ), XMFLOAT2( 0.0f, 1.0f ) },
        // ... etc

    };

 

 

Bind it with this input layout:

 

    D3D11_INPUT_ELEMENT_DESC layout[] =
    {
        { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
        { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 },
    };

 

 

To this vertex shader input in the shader:

 

    struct VS_INPUT
    {
        float4 Pos : POSITION;
        float2 Tex : TEXCOORD0;
    };

 

 

Then is it guaranteed by D3D specification that the 4th component of the Pos attribute (Pos.w) in the shader will be 0.0 ?

 

I cannot find definitive information about it.

 

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this