summaryrefslogtreecommitdiff
path: root/indra
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
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')
-rw-r--r--indra/llrender/llgl.cpp10
-rw-r--r--indra/llrender/llglslshader.cpp11
-rw-r--r--indra/llrender/llrender.cpp4
-rw-r--r--indra/llrender/llshadermgr.cpp42
4 files changed, 54 insertions, 13 deletions
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index 3dfedbe2cf..44b5a040d9 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -86,13 +86,13 @@ void APIENTRY gl_debug_callback(GLenum source,
const GLchar* message,
GLvoid* userParam)
{
- if (severity != GL_DEBUG_SEVERITY_HIGH_ARB // &&
- //severity != GL_DEBUG_SEVERITY_MEDIUM_ARB &&
- //severity != GL_DEBUG_SEVERITY_LOW_ARB
+ /*if (severity != GL_DEBUG_SEVERITY_HIGH_ARB // &&
+ severity != GL_DEBUG_SEVERITY_MEDIUM_ARB &&
+ severity != GL_DEBUG_SEVERITY_LOW_ARB
)
{ //suppress out-of-spec messages sent by nvidia driver (mostly vertexbuffer hints)
return;
- }
+ }*/
if (severity == GL_DEBUG_SEVERITY_HIGH_ARB)
{
@@ -1628,7 +1628,7 @@ void LLGLManager::initExtensions()
mHasMipMapGeneration = mHasFramebufferObject || mGLVersion >= 1.4f;
mHasBlendFuncSeparate = ExtensionExists("GL_EXT_blend_func_separate", gGLHExts.mSysExts);
- mHasDebugOutput = ExtensionExists("GL_ARB_debug_output", gGLHExts.mSysExts);
+ mHasDebugOutput = mGLVersion >= 4.3f ? TRUE : FALSE;
mHasTransformFeedback = mGLVersion >= 4.f ? TRUE : FALSE;
#endif
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp
index 91d756c0d1..bc349c2015 100644
--- a/indra/llrender/llglslshader.cpp
+++ b/indra/llrender/llglslshader.cpp
@@ -348,13 +348,20 @@ void LLGLSLShader::unloadInternal()
if (mProgramObject)
{
GLuint obj[1024];
- GLsizei count;
+ GLsizei count = 0;
glGetAttachedShaders(mProgramObject, 1024, &count, obj);
for (GLsizei i = 0; i < count; i++)
{
glDetachShader(mProgramObject, obj[i]);
- glDeleteShader(obj[i]);
+ }
+
+ for (GLsizei i = 0; i < count; i++)
+ {
+ if (glIsShader(obj[i]))
+ {
+ glDeleteShader(obj[i]);
+ }
}
glDeleteProgram(mProgramObject);
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index 1f060b674f..471dbce1dd 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -876,8 +876,8 @@ void LLRender::init()
if (gGLManager.mHasDebugOutput && gDebugGL)
{ //setup debug output callback
//glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_LOW_ARB, 0, NULL, GL_TRUE);
- glDebugMessageCallback((GLDEBUGPROCARB) gl_debug_callback, NULL);
- glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
+ glDebugMessageCallback((GLDEBUGPROC) gl_debug_callback, NULL);
+ glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
}
#endif
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)
{