From 6143594db6ed7ff803f4305e5ca39b8c5f1c2f34 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Tue, 18 Jun 2013 10:24:36 -0500 Subject: [PATCH] [Android] Qualcomm glGetShaderInfoLog returns a max of 1024 bytes(tested) for the log, and glGetShaderiv with GL_INFO_LOG_LENGTH /always/ returns 0 on compile failure. --- Source/Core/VideoCommon/Src/DriverDetails.cpp | 1 + Source/Core/VideoCommon/Src/DriverDetails.h | 10 ++++++++++ .../Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp | 10 ++++------ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Source/Core/VideoCommon/Src/DriverDetails.cpp b/Source/Core/VideoCommon/Src/DriverDetails.cpp index 8d3c2d9cf7..51b5275a5f 100644 --- a/Source/Core/VideoCommon/Src/DriverDetails.cpp +++ b/Source/Core/VideoCommon/Src/DriverDetails.cpp @@ -28,6 +28,7 @@ namespace DriverDetails BugInfo m_qualcommbugs[] = { {BUG_NODYNUBOACCESS, 300, 14.0, -1.0}, {BUG_BROKENCENTROID, 300, 14.0, -1.0}, + {BUG_BROKENINFOLOG, 300, -1.0, -1.0}, }; std::map, BugInfo> m_bugs; diff --git a/Source/Core/VideoCommon/Src/DriverDetails.h b/Source/Core/VideoCommon/Src/DriverDetails.h index 524825f10b..c3bfc25ec5 100644 --- a/Source/Core/VideoCommon/Src/DriverDetails.h +++ b/Source/Core/VideoCommon/Src/DriverDetails.h @@ -42,6 +42,16 @@ namespace DriverDetails // When MSAA is disabled, it acts like a regular in/out // Tends to cause the driver to render full white or black BUG_BROKENCENTROID, + // Bug: INFO_LOG_LENGTH broken + // Affected devices: Qualcomm/Adreno + // Started Version: ? (Noticed on v14) + // Ended Version: -1 + // When compiling a shader, it is important that when it fails, + // you first get the length of the information log prior to grabbing it. + // This allows you to allocate an array to store all of the log + // Adreno devices /always/ return 0 when querying GL_INFO_LOG_LENGTH + // They also max out at 1024 bytes(1023 characters + null terminator) for the log + BUG_BROKENINFOLOG, }; // Initializes our internal vendor, device family, and driver version diff --git a/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp b/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp index c482c13900..c16cf69aae 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp @@ -335,15 +335,13 @@ GLuint ProgramShaderCache::CompileSingleShader (GLuint type, const char* code ) glGetShaderiv(result, GL_COMPILE_STATUS, &compileStatus); GLsizei length = 0; glGetShaderiv(result, GL_INFO_LOG_LENGTH, &length); + + if (DriverDetails::HasBug(DriverDetails::BUG_BROKENINFOLOG)) + length = 1024; + if (compileStatus != GL_TRUE || (length > 1 && DEBUG_GLSL)) { GLsizei charsWritten; -#ifdef USE_GLES3 - // This is a bug in the Qualcomm OpenGL Driver - // The length returned is garbage length so we need to set a default max - // XXX: Check if qualcomm driver here - length = 1024; // Qualcomm driver maxes out at 512 bytes returned from glGetShaderInfoLog anyway -#endif GLchar* infoLog = new GLchar[length]; glGetShaderInfoLog(result, length, &charsWritten, infoLog); ERROR_LOG(VIDEO, "PS Shader info log:\n%s", infoLog);