Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Item {

property var previewing: previewMediaUuid != helpers.QVariantFromUuidString("") ? previewMediaUuid == currentPlayhead.mediaUuid : false

# uri requires triple slash before drive letter on Windows, since this is the root.
// uri requires triple slash before drive letter on Windows, since this is the root.
property var thumbSrcRoot: Qt.platform.os === "windows" ? "image://thumbnail/file:///" : "image://thumbnail/file://"

FileSystemBrowserScanResultsModel {
Expand Down
6 changes: 6 additions & 0 deletions src/ui/opengl/src/opengl_viewport_renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,12 @@ void OpenGLViewportRenderer::draw_image(
const Imath::M44f &viewport_to_image_space,
const float viewport_du_dx) {

// active_shader_program_ can be null if even the fallback "no image" shader
// failed to compile/link (e.g. a driver issue) - bind_textures() already
// treats this as nothing-to-draw, so match that here rather than
// dereferencing a null program.
if (!active_shader_program_)
return;

active_shader_program_->use();

Expand Down
42 changes: 30 additions & 12 deletions src/ui/opengl/src/shader_program_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -573,9 +573,15 @@ GLuint compile_frag_shader(const std::string fragmentSource) {
GLint maxLength = 0;
glGetShaderiv(fragmentShader, GL_INFO_LOG_LENGTH, &maxLength);

// The maxLength includes the NULL character
std::vector<GLchar> infoLog(maxLength);
glGetShaderInfoLog(fragmentShader, maxLength, &maxLength, &infoLog[0]);
// The maxLength includes the NULL character. Some drivers report a
// compile failure but leave the info log empty, so guard against
// that instead of dereferencing an empty vector's data().
std::string info_log_str = "(no info log provided by driver)";
if (maxLength > 0) {
std::vector<GLchar> infoLog(maxLength);
glGetShaderInfoLog(fragmentShader, maxLength, &maxLength, infoLog.data());
info_log_str.assign(infoLog.data());
}

// We don't need the shader anymore.
glDeleteShader(fragmentShader);
Expand All @@ -592,7 +598,7 @@ GLuint compile_frag_shader(const std::string fragmentSource) {
// Use the infoLog as you see fit.
std::stringstream e;
e << "Fragment shader error:\n\n"
<< infoLog.data() << "\n\nin program: \n\n"
<< info_log_str << "\n\nin program: \n\n"
<< source_with_linenumbers;
throw std::runtime_error(e.str().c_str());
}
Expand All @@ -618,17 +624,23 @@ GLuint compile_vertex_shader(const std::string vertexSource) {
GLint maxLength = 0;
glGetShaderiv(vertexShader, GL_INFO_LOG_LENGTH, &maxLength);

// The maxLength includes the NULL character
std::vector<GLchar> infoLog(maxLength);
glGetShaderInfoLog(vertexShader, maxLength, &maxLength, &infoLog[0]);
// The maxLength includes the NULL character. Some drivers report a
// compile failure but leave the info log empty, so guard against
// that instead of dereferencing an empty vector's data().
std::string info_log_str = "(no info log provided by driver)";
if (maxLength > 0) {
std::vector<GLchar> infoLog(maxLength);
glGetShaderInfoLog(vertexShader, maxLength, &maxLength, infoLog.data());
info_log_str.assign(infoLog.data());
}

// We don't need the shader anymore.
glDeleteShader(vertexShader);

// Use the infoLog as you see fit.
std::stringstream e;
e << "Vertex shader error:\n\n"
<< infoLog.data() << "\n\nin program: \n\n"
<< info_log_str << "\n\nin program: \n\n"
<< vertexSource;
throw std::runtime_error(e.str().c_str());

Expand Down Expand Up @@ -832,9 +844,15 @@ void GLShaderProgram::compile(const bool force_combine_frag_shaders) {
GLint maxLength = 0;
glGetProgramiv(program_, GL_INFO_LOG_LENGTH, &maxLength);

// The maxLength includes the NULL character
std::vector<GLchar> infoLog(maxLength);
glGetProgramInfoLog(program_, maxLength, &maxLength, &infoLog[0]);
// The maxLength includes the NULL character. Some drivers report a
// link failure but leave the info log empty, so guard against that
// instead of dereferencing an empty vector's data().
std::string info_log_str = "(no info log provided by driver)";
if (maxLength > 0) {
std::vector<GLchar> infoLog(maxLength);
glGetProgramInfoLog(program_, maxLength, &maxLength, infoLog.data());
info_log_str.assign(infoLog.data());
}

// Detach shaders after failed link .... (not clear if this is correct,
// but no errors have been observed)
Expand All @@ -861,7 +879,7 @@ void GLShaderProgram::compile(const bool force_combine_frag_shaders) {

// Use the infoLog as you see fit.
std::stringstream e;
e << "Shader link error:\n\n" << infoLog.data();
e << "Shader link error:\n\n" << info_log_str;

std::for_each(
fragment_shaders_.begin(),
Expand Down