# XMMATRIX performance

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)
{

// This is the line that cause the performance drop
}


I also tried to use the folowing but no hope:

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


Any suggestes will be appreciated.

• "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? – Elva Mar 21 '19 at 16:26
• 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. – Maximus Minimus Mar 21 '19 at 17:54
• It is dropped from 650 FPS to 550 FPS – Ahmed Elhamy Mar 23 '19 at 9:58
• 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. – Ahmed Elhamy Mar 23 '19 at 9:59