-------------------------------------------------------------------------------------- Compiles the shaders in the list --------------------------------------------------------------------------------------
| 2394 | // Compiles the shaders in the list |
| 2395 | //-------------------------------------------------------------------------------------- |
| 2396 | void ShaderCache::CompileShaders() |
| 2397 | { |
| 2398 | Shader* pShader = NULL; |
| 2399 | unsigned int uNumWorkThreads = 0; |
| 2400 | |
| 2401 | EnterCriticalSection( &m_CompileShaders_CriticalSection ); |
| 2402 | |
| 2403 | while (m_CompileList.size()) |
| 2404 | { |
| 2405 | bool bRemove = false; |
| 2406 | |
| 2407 | Sleep( 1 ); |
| 2408 | |
| 2409 | for (std::list<Shader*>::iterator it = m_CompileList.begin(); it != m_CompileList.end(); it++) |
| 2410 | { |
| 2411 | |
| 2412 | Sleep( 1 ); |
| 2413 | if (bRemove) |
| 2414 | { |
| 2415 | m_CompileList.remove( pShader ); |
| 2416 | bRemove = false; |
| 2417 | } |
| 2418 | |
| 2419 | pShader = *it; |
| 2420 | |
| 2421 | pShader->m_wsCompileStatus = L"Waiting to Compile..."; |
| 2422 | |
| 2423 | if (uNumWorkThreads < m_uNumCPUCoresToUse) |
| 2424 | { |
| 2425 | if (pShader->m_bBeingProcessed == false) |
| 2426 | { |
| 2427 | bRemove = true; |
| 2428 | pShader->m_wsCompileStatus = L"Compiling Shader"; |
| 2429 | CompileShader( pShader ); |
| 2430 | |
| 2431 | pShader->m_bBeingProcessed = true; |
| 2432 | |
| 2433 | m_CompileCheckList.push_back( pShader ); |
| 2434 | |
| 2435 | uNumWorkThreads++; |
| 2436 | } |
| 2437 | } |
| 2438 | else |
| 2439 | { |
| 2440 | // else break out of the for loop, and let this batch of work finish |
| 2441 | break; |
| 2442 | } |
| 2443 | } |
| 2444 | |
| 2445 | if (bRemove) |
| 2446 | { |
| 2447 | m_CompileList.remove( pShader ); |
| 2448 | bRemove = false; |
| 2449 | } |
| 2450 | |
| 2451 | if (m_bAbort) |
| 2452 | { |
| 2453 | break; |
nothing calls this directly
no test coverage detected