Sign in to follow this  

trying to speed up render of model ?

Recommended Posts


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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this