mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -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)::
|
bool CLP(ShaderContext)::
|
||||||
glsl_compile_shader(Shader::ShaderType type) {
|
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;
|
GLuint handle = 0;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Shader::ST_vertex:
|
case Shader::ST_vertex:
|
||||||
@ -2514,7 +2523,7 @@ glsl_compile_shader(Shader::ShaderType type) {
|
|||||||
}
|
}
|
||||||
if (!handle) {
|
if (!handle) {
|
||||||
GLCAT.error()
|
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();
|
_glgsg->report_my_gl_errors();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -2533,8 +2542,8 @@ glsl_compile_shader(Shader::ShaderType type) {
|
|||||||
|
|
||||||
if (status != GL_TRUE) {
|
if (status != GL_TRUE) {
|
||||||
GLCAT.error()
|
GLCAT.error()
|
||||||
<< "An error occurred while compiling GLSL shader "
|
<< "An error occurred while compiling GLSL " << types[type]
|
||||||
<< _shader->get_filename(type) << ":\n";
|
<< "shader " << _shader->get_filename(type) << ":\n";
|
||||||
glsl_report_shader_errors(handle, type, true);
|
glsl_report_shader_errors(handle, type, true);
|
||||||
_glgsg->_glDeleteShader(handle);
|
_glgsg->_glDeleteShader(handle);
|
||||||
_glgsg->report_my_gl_errors();
|
_glgsg->report_my_gl_errors();
|
||||||
@ -2629,12 +2638,18 @@ glsl_compile_and_link() {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (GLCAT.is_debug()) {
|
||||||
|
GLCAT.debug()
|
||||||
|
<< "Linking GLSL shader " << _shader->get_filename() << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
_glgsg->_glLinkProgram(_glsl_program);
|
_glgsg->_glLinkProgram(_glsl_program);
|
||||||
|
|
||||||
GLint status;
|
GLint status;
|
||||||
_glgsg->_glGetProgramiv(_glsl_program, GL_LINK_STATUS, &status);
|
_glgsg->_glGetProgramiv(_glsl_program, GL_LINK_STATUS, &status);
|
||||||
if (status != GL_TRUE) {
|
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);
|
glsl_report_program_errors(_glsl_program, true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user