mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 18:03:56 -04:00
Improve debug information when compiling GLSL shaders
This commit is contained in:
parent
8822ac0b05
commit
a573a11d90
@ -2479,6 +2479,15 @@ glsl_report_program_errors(GLuint program, bool fatal) {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool CLP(ShaderContext)::
|
||||
glsl_compile_shader(Shader::ShaderType type) {
|
||||
static const char *types[] = {"", "vertex ", "fragment ", "geometry ",
|
||||
"tessellation control ", "tessellation evaluation ", "compute ", ""};
|
||||
|
||||
if (GLCAT.is_debug()) {
|
||||
GLCAT.debug()
|
||||
<< "Compiling GLSL " << types[type] << "shader "
|
||||
<< _shader->get_filename(type) << "\n";
|
||||
}
|
||||
|
||||
GLuint handle = 0;
|
||||
switch (type) {
|
||||
case Shader::ST_vertex:
|
||||
@ -2514,7 +2523,7 @@ glsl_compile_shader(Shader::ShaderType type) {
|
||||
}
|
||||
if (!handle) {
|
||||
GLCAT.error()
|
||||
<< "Could not create a GLSL shader of the requested type.\n";
|
||||
<< "Could not create a GLSL " << types[type] << "shader.\n";
|
||||
_glgsg->report_my_gl_errors();
|
||||
return false;
|
||||
}
|
||||
@ -2533,8 +2542,8 @@ glsl_compile_shader(Shader::ShaderType type) {
|
||||
|
||||
if (status != GL_TRUE) {
|
||||
GLCAT.error()
|
||||
<< "An error occurred while compiling GLSL shader "
|
||||
<< _shader->get_filename(type) << ":\n";
|
||||
<< "An error occurred while compiling GLSL " << types[type]
|
||||
<< "shader " << _shader->get_filename(type) << ":\n";
|
||||
glsl_report_shader_errors(handle, type, true);
|
||||
_glgsg->_glDeleteShader(handle);
|
||||
_glgsg->report_my_gl_errors();
|
||||
@ -2629,12 +2638,18 @@ glsl_compile_and_link() {
|
||||
}
|
||||
#endif
|
||||
|
||||
if (GLCAT.is_debug()) {
|
||||
GLCAT.debug()
|
||||
<< "Linking GLSL shader " << _shader->get_filename() << "\n";
|
||||
}
|
||||
|
||||
_glgsg->_glLinkProgram(_glsl_program);
|
||||
|
||||
GLint status;
|
||||
_glgsg->_glGetProgramiv(_glsl_program, GL_LINK_STATUS, &status);
|
||||
if (status != GL_TRUE) {
|
||||
GLCAT.error() << "An error occurred while linking GLSL shader program!\n";
|
||||
GLCAT.error() << "An error occurred while linking GLSL shader "
|
||||
<< _shader->get_filename() << "\n";
|
||||
glsl_report_program_errors(_glsl_program, true);
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user