Skip to content

Commit

Permalink
Merge pull request #134 from kirides/kirides-patch-shader-compilation
Browse files Browse the repository at this point in the history
temporarily disable multicore shader compilation
  • Loading branch information
kirides committed Mar 30, 2023
2 parents 7ee4dd9 + dde9de4 commit 8a15974
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions D3D11Engine/D3D11ShaderManager.cpp
Expand Up @@ -649,18 +649,23 @@ XRESULT D3D11ShaderManager::CompileShader( const ShaderInfo& si ) {

/** Loads/Compiles Shaderes from list */
XRESULT D3D11ShaderManager::LoadShaders() {
size_t numThreads = std::thread::hardware_concurrency();
// Temporarily disable multi-core shader compilation

/*size_t numThreads = std::thread::hardware_concurrency();
if ( numThreads > 1 ) {
numThreads = numThreads - 1;
}
auto compilationTP = std::make_unique<ThreadPool>( numThreads );
LogInfo() << "Compiling/Reloading shaders with " << compilationTP->getNumThreads() << " threads";
*/
LogInfo() << "Compiling/Reloading shaders";
for ( const ShaderInfo& si : Shaders ) {
compilationTP->enqueue( [this, si]() { CompileShader( si ); } );
CompileShader( si );
// compilationTP->enqueue( [this, si]() { CompileShader( si ); } );
}

// Join all threads (call Threadpool destructor)
compilationTP.reset();
// compilationTP.reset();

return XR_SUCCESS;
}
Expand Down

0 comments on commit 8a15974

Please sign in to comment.