Skip to content

Commit d636984

Browse files
committed
Add debug info for shader compilation/link time
Also make sure to display the full shader name rather than just the main shader.
1 parent 96f0611 commit d636984

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/engine/renderer/gl_shader.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1321,9 +1321,11 @@ void GLShaderManager::CompileGPUShaders( GLShader *shader, shaderProgram_t *prog
13211321
}
13221322

13231323
Log::Debug( "building %s shader permutation with macro: %s",
1324-
shader->GetMainShaderName(),
1324+
shader->GetName(),
13251325
compileMacros.empty() ? "none" : compileMacros );
13261326

1327+
const int start = Sys::Milliseconds();
1328+
13271329
// add them
13281330
std::string vertexShaderTextWithMacros = macrosString + shader->_vertexShaderText;
13291331
std::string fragmentShaderTextWithMacros = macrosString + shader->_fragmentShaderText;
@@ -1356,6 +1358,8 @@ void GLShaderManager::CompileGPUShaders( GLShader *shader, shaderProgram_t *prog
13561358
&GLWorldHeader },
13571359
GL_COMPUTE_SHADER );
13581360
}
1361+
1362+
Log::Debug( "Compilation: %i ms", Sys::Milliseconds() - start );
13591363
}
13601364

13611365
void GLShaderManager::CompileAndLinkGPUShaderProgram( GLShader *shader, shaderProgram_t *program,
@@ -1375,8 +1379,11 @@ void GLShaderManager::CompileAndLinkGPUShaderProgram( GLShader *shader, shaderPr
13751379
glAttachShader( program->program, program->CS );
13761380
}
13771381

1382+
const int start = Sys::Milliseconds();
13781383
BindAttribLocations( program->program );
13791384
LinkProgram( program->program );
1385+
1386+
Log::Debug( "Link: %i ms", Sys::Milliseconds() - start );
13801387
}
13811388

13821389
// This will generate all the extra code for material system shaders

0 commit comments

Comments
 (0)