locked
Vertex data default value?

    General discussion

  • Vertex Layout in CPP

    D3D11_INPUT_ELEMENT_DESC tangentspacevertexlayout[] =

       {

           {"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},

         

    But The HLSL code is DIFFERENT in June.2010 DXSDK and the new metro samples.

    A. In Metro DX tutorial:
    VS_INPUT  { float3 position;}

    mul(float4(position,1.0f),mWorld)

    ----------------------

    B. In DXSDK  2010:
    VS_INPUT  { float4 position;} //position.w is default 1.0 ?

    mul(position,mWorld)

    ---------------------

    A has 2 more instructions than B,




    mov r1.xyz, v0.xyzx 

    mov r1.w, l(1.000000) 





    The results are the same.  Which one is better,  Is B faster?

    Are all devices support the default value 1.0 for undefined vector data?








    Sunday, April 1, 2012 4:08 PM

All replies

  • B is faster, but does metro support B? 

    NEU_ShieldEdge

    Monday, April 2, 2012 8:46 AM
  • B is OK in metro as I tested on my NV GTX570
    • Edited by Raptor K Monday, April 2, 2012 9:02 AM
    Monday, April 2, 2012 9:01 AM