summaryrefslogtreecommitdiff
path: root/indra/llrender/llshadermgr.cpp
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2022-09-02 21:05:53 -0500
committerDave Parks <davep@lindenlab.com>2022-09-02 21:05:53 -0500
commit60cc58fbfc23efe133dca3797188462d1b2ae5ab (patch)
treebf050523965b27aa052267cb4ba583fcf223f04c /indra/llrender/llshadermgr.cpp
parent4c2b80fd00c545cf2e288520c8cf5fa1379d75b4 (diff)
SL-17967 Fix for confounding program and shader objects when fetching logs and fix for gl errors on AMD windows
Diffstat (limited to 'indra/llrender/llshadermgr.cpp')
-rw-r--r--indra/llrender/llshadermgr.cpp42
1 files changed, 38 insertions, 4 deletions
diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp
index 96e83e6fbe..5293166ec3 100644
--- a/indra/llrender/llshadermgr.cpp
+++ b/indra/llrender/llshadermgr.cpp
@@ -558,7 +558,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
//============================================================================
// Load Shader
-static std::string get_object_log(GLuint ret)
+static std::string get_shader_log(GLuint ret)
{
std::string res;
@@ -569,13 +569,46 @@ static std::string get_object_log(GLuint ret)
{
//the log could be any size, so allocate appropriately
GLchar* log = new GLchar[length];
- glGetProgramInfoLog(ret, length, &length, log);
+ glGetShaderInfoLog(ret, length, &length, log);
res = std::string((char *)log);
delete[] log;
}
return res;
}
+static std::string get_program_log(GLuint ret)
+{
+ std::string res;
+
+ //get log length
+ GLint length;
+ glGetProgramiv(ret, GL_INFO_LOG_LENGTH, &length);
+ if (length > 0)
+ {
+ //the log could be any size, so allocate appropriately
+ GLchar* log = new GLchar[length];
+ glGetProgramInfoLog(ret, length, &length, log);
+ res = std::string((char*)log);
+ delete[] log;
+ }
+ return res;
+}
+
+// get the info log for the given object, be it a shader or program object
+// NOTE: ret MUST be a shader OR a program object
+static std::string get_object_log(GLuint ret)
+{
+ if (glIsProgram(ret))
+ {
+ return get_program_log(ret);
+ }
+ else
+ {
+ llassert(glIsShader(ret));
+ return get_shader_log(ret);
+ }
+}
+
//dump shader source for debugging
void LLShaderMgr::dumpShaderSource(U32 shader_code_count, GLchar** shader_code_text)
{
@@ -594,7 +627,8 @@ void LLShaderMgr::dumpShaderSource(U32 shader_code_count, GLchar** shader_code_t
void LLShaderMgr::dumpObjectLog(GLuint ret, BOOL warns, const std::string& filename)
{
- std::string log = get_object_log(ret);
+ std::string log;
+ log = get_object_log(ret);
std::string fname = filename;
if (filename.empty())
{
@@ -1078,7 +1112,7 @@ BOOL LLShaderMgr::linkProgramObject(GLuint obj, BOOL suppress_errors)
return success;
}
- std::string log = get_object_log(obj);
+ std::string log = get_program_log(obj);
LLStringUtil::toLower(log);
if (log.find("software") != std::string::npos)
{