• Advertisement
Sign in to follow this  

trying to speed up render of model ?

This topic is 2486 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)

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
Sign in to follow this  

  • Advertisement