|
@@ -425,13 +425,13 @@ void APIENTRY DebugOutputCallback(GLenum
|
|
|
case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: type_str = "Deprecated"; break;
|
|
|
case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: type_str = "Undefined behaviour"; break;
|
|
|
case GL_DEBUG_TYPE_PERFORMANCE: type_str = "Performance"; break;
|
|
|
case GL_DEBUG_TYPE_PORTABILITY: type_str = "Portability"; break;
|
|
|
}
|
|
|
|
|
|
DEBUG(driver, 6, "OpenGL: %s (%s) - %s", type_str, severity_str, message);
|
|
|
Debug(driver, 6, "OpenGL: {} ({}) - {}", type_str, severity_str, message);
|
|
|
}
|
|
|
|
|
|
/** Enable OpenGL debug messages if supported. */
|
|
|
void SetupDebugOutput()
|
|
|
{
|
|
|
#ifndef NO_DEBUG_MESSAGES
|
|
@@ -533,13 +533,13 @@ const char *OpenGLBackend::Init(const Di
|
|
|
const char *ver = (const char *)_glGetString(GL_VERSION);
|
|
|
const char *vend = (const char *)_glGetString(GL_VENDOR);
|
|
|
const char *renderer = (const char *)_glGetString(GL_RENDERER);
|
|
|
|
|
|
if (ver == nullptr || vend == nullptr || renderer == nullptr) return "OpenGL not supported";
|
|
|
|
|
|
DEBUG(driver, 1, "OpenGL driver: %s - %s (%s)", vend, renderer, ver);
|
|
|
Debug(driver, 1, "OpenGL driver: {} - {} ({})", vend, renderer, ver);
|
|
|
|
|
|
#ifndef GL_ALLOW_SOFTWARE_RENDERER
|
|
|
/* Don't use MESA software rendering backends as they are slower than
|
|
|
* just using a non-OpenGL video driver. */
|
|
|
if (strncmp(renderer, "llvmpipe", 8) == 0 || strncmp(renderer, "softpipe", 8) == 0) return "Software renderer detected, not using OpenGL";
|
|
|
#endif
|
|
@@ -581,28 +581,28 @@ const char *OpenGLBackend::Init(const Di
|
|
|
this->persistent_mapping_supported = IsOpenGLVersionAtLeast(3, 0) && (IsOpenGLVersionAtLeast(4, 4) || IsOpenGLExtensionSupported("GL_ARB_buffer_storage"));
|
|
|
#ifndef NO_GL_BUFFER_SYNC
|
|
|
this->persistent_mapping_supported = this->persistent_mapping_supported && (IsOpenGLVersionAtLeast(3, 2) || IsOpenGLExtensionSupported("GL_ARB_sync"));
|
|
|
#endif
|
|
|
|
|
|
if (this->persistent_mapping_supported && !BindPersistentBufferExtensions()) {
|
|
|
DEBUG(driver, 1, "OpenGL claims to support persistent buffer mapping but doesn't export all functions, not using persistent mapping.");
|
|
|
Debug(driver, 1, "OpenGL claims to support persistent buffer mapping but doesn't export all functions, not using persistent mapping.");
|
|
|
this->persistent_mapping_supported = false;
|
|
|
}
|
|
|
if (this->persistent_mapping_supported) DEBUG(driver, 3, "OpenGL: Using persistent buffer mapping");
|
|
|
if (this->persistent_mapping_supported) Debug(driver, 3, "OpenGL: Using persistent buffer mapping");
|
|
|
|
|
|
/* Check maximum texture size against screen resolution. */
|
|
|
GLint max_tex_size = 0;
|
|
|
_glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_tex_size);
|
|
|
if (std::max(screen_res.width, screen_res.height) > (uint)max_tex_size) return "Max supported texture size is too small";
|
|
|
|
|
|
/* Check available texture units. */
|
|
|
GLint max_tex_units = 0;
|
|
|
_glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &max_tex_units);
|
|
|
if (max_tex_units < 4) return "Not enough simultaneous textures supported";
|
|
|
|
|
|
DEBUG(driver, 2, "OpenGL shading language version: %s, texture units = %d", (const char *)_glGetString(GL_SHADING_LANGUAGE_VERSION), (int)max_tex_units);
|
|
|
Debug(driver, 2, "OpenGL shading language version: {}, texture units = {}", (const char *)_glGetString(GL_SHADING_LANGUAGE_VERSION), (int)max_tex_units);
|
|
|
|
|
|
if (!this->InitShaders()) return "Failed to initialize shaders";
|
|
|
|
|
|
/* Setup video buffer texture. */
|
|
|
_glGenTextures(1, &this->vid_texture);
|
|
|
_glBindTexture(GL_TEXTURE_2D, this->vid_texture);
|
|
@@ -758,13 +758,13 @@ static bool VerifyShader(GLuint shader)
|
|
|
|
|
|
/* Output log if there is one. */
|
|
|
GLint log_len = 0;
|
|
|
_glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &log_len);
|
|
|
if (log_len > 0) {
|
|
|
_glGetShaderInfoLog(shader, log_len, nullptr, log_buf.Allocate(log_len));
|
|
|
DEBUG(driver, result != GL_TRUE ? 0 : 2, "%s", log_buf.GetBuffer()); // Always print on failure.
|
|
|
Debug(driver, result != GL_TRUE ? 0 : 2, "{}", log_buf.GetBuffer()); // Always print on failure.
|
|
|
}
|
|
|
|
|
|
return result == GL_TRUE;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -781,13 +781,13 @@ static bool VerifyProgram(GLuint program
|
|
|
|
|
|
/* Output log if there is one. */
|
|
|
GLint log_len = 0;
|
|
|
_glGetProgramiv(program, GL_INFO_LOG_LENGTH, &log_len);
|
|
|
if (log_len > 0) {
|
|
|
_glGetProgramInfoLog(program, log_len, nullptr, log_buf.Allocate(log_len));
|
|
|
DEBUG(driver, result != GL_TRUE ? 0 : 2, "%s", log_buf.GetBuffer()); // Always print on failure.
|
|
|
Debug(driver, result != GL_TRUE ? 0 : 2, "{}", log_buf.GetBuffer()); // Always print on failure.
|
|
|
}
|
|
|
|
|
|
return result == GL_TRUE;
|
|
|
}
|
|
|
|
|
|
/**
|