Heya guys!
I have this function:
1 2 3 4 5 6 7 8 9 10 11
|
mgBool Visible;
Visible = CCameraManager::Instance()->GetCurrent()->IsSphereVisible(m_BoundingSphere);
Visible = TRUE;
if (Visible)
{
MeshVector::const_iterator It;
for ( It = m_Meshes.begin(); It != m_Meshes.end(); ++It )
{
(*It)->Render();
}
}
|
This is how my Model::Render looks, i'm currently rendering 250models at 70fps with that code but if i remove the line: Visible = TRUE, i go down to around 8fps when looking at all my models(should be same thing as when i had Visible = TRUE) tho some times, if i look away from all the models and then back i can get 70fps, then i look away and back at them again it can go down to 8fps again if I'm unlucky, seems completely random.
Things I've tried that didn't change anything:
Moved the IsSphereVisible to update and saved it in a member variable
Ran IsSphereVisible 10times per model to make sure that function didn't have some weird impact but i stayed at around 70fps as long as i had Visible = TRUE.
It's not a cache problem since i can do loads of calucations in before rendering each model as long as i set Visible = TRUE before the if-check.
Made the Visible volatile to make sure it wasn't a target of any optimizations, didn't do any difference
Tried in Release config as well, going from 250 to 10fps there.
Tried exchanging my IsSphereVisible to a randomize if it should be rendered or not, same problem
Tried rebuilding
Tried rebooting
I honestly have no clue what more i could even try, this doesn't feel like it should be happening and would like to see if any of you got any ideas.
[Edit]
More things I've tried:
Looking at the dissembly, nothing weird there.
Done some profiling and it doesn't even seem to be the Model::Render function that takes more time, it's the D3D::EndRender(all i do there is present on the swapchain).
The framerate drop will only happen if atleast one model as been culled(not sent to directx rendering pipeline) So if i start my program where all the models are visible in the camera it's fine i can look around without getting any issues, but as soon as my IsSphereVisible has returned false once, the framerate usually drops to the ground.
[/Edit]