Jump to content
  • Advertisement
Sign in to follow this  
thedodgeruk

trying to speed up render of model ?

This topic is 2609 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts



void CRenderManager::RenderModel(SMesh* meshPointer, SShader* shaderPointer)
{
if (!meshPointer->m_HasGeometry)
return;

m_meshPointerNew = meshPointer;

if (m_meshPointerOld != m_meshPointerNew) // runs about 15% faster with this
{
m_meshPointerOld = m_meshPointerNew;

// Select vertex and index buffer - assuming all data will be as triangle lists
UINT offset = 0;
g_pd3dDevice->IASetVertexBuffers( 0, 1, &meshPointer->m_VertexBuffer, &meshPointer->m_VertexSize, &offset );
g_pd3dDevice->IASetInputLayout( meshPointer->m_VertexLayout );
g_pd3dDevice->IASetIndexBuffer( meshPointer->m_IndexBuffer, DXGI_FORMAT_R16_UINT, 0 );
g_pd3dDevice->IASetPrimitiveTopology( D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST );
}

// Render the model. All the data and shader variables are prepared, now select the technique to use and draw.
// The loop is for advanced techniques that need multiple passes - we will only use techniques with one pass
D3D10_TECHNIQUE_DESC techDesc;
shaderPointer->m_shaderTechniqueMap->GetDesc( &techDesc );
for( UINT p = 0; p < techDesc.Passes; ++p )
{
shaderPointer->m_shaderTechniqueMap->GetPassByIndex( p )->Apply( 0 );
g_pd3dDevice->DrawIndexed( meshPointer->m_NumIndices, 0, 0 );
}
}



cant figure out how to make this run faster , is there any other obviuos ways ?

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!