Dears, I am facing a performance problem when I try to access cell 42 and 43 in XMMATRIX define in DirectXMath.h. The frames dropped by 100 FPS.

Here is my code:

for (int index = 0; index < m_CopyOfCascadeConfig.m_nCascadeLevels; ++index)
        XMMATRIX mShadowTexture = m_matShadowProj[index] * dxmatTextureScale * dxmatTextureTranslation;

        XMStoreFloat4x4(&mShadowTextureFlt, mShadowTexture);

        // This is the line that cause the performance drop
        pcbAllShadowConstants->m_vCascadeOffset[index] =
            XMVectorSet(mShadowTextureFlt._41, mShadowTextureFlt._42, mShadowTextureFlt._43, 0.0);

I also tried to use the folowing but no hope:

pcbAllShadowConstants->m_vCascadeOffset[index] = mShadowTexture.r[3];

Any suggestes will be appreciated.

  • 2
    \$\begingroup\$ "Dropped by 100 FPS" is not... not a statement of how much time something took. If you dropped from 1 million FPS to 999900 FPS then... it's irrelevant, move on to other things! If you dropped from 101 to 1 then it's an actual issue. Are you sure this is an issue? \$\endgroup\$ – Elva Mar 21 '19 at 16:26
  • \$\begingroup\$ What happens if you do pcbAllShadowConstants->m_vCascadeOffset[index] = XMVectorSet(0,0,0,0); - the slow down you describe is more likely to come from updating the constant buffer. \$\endgroup\$ – Maximus Minimus Mar 21 '19 at 17:54
  • \$\begingroup\$ It is dropped from 650 FPS to 550 FPS \$\endgroup\$ – Ahmed Elhamy Mar 23 '19 at 9:58
  • \$\begingroup\$ Yes, When I tried XMVectorSet(0,0,0,0) FPS goes to 650 FPS, when I tried by above code it is dropped to 550 FPS again. \$\endgroup\$ – Ahmed Elhamy Mar 23 '19 at 9:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.