From 013a7130011f72ab0c124dba87376b9862a95461 Mon Sep 17 00:00:00 2001 From: Howard Stearns Date: Fri, 2 Sep 2022 15:44:19 -0700 Subject: SL-17967 - slightly more meaningful ogl error reporting --- indra/llrender/llshadermgr.cpp | 13 +++++-------- indra/newview/llfeaturemanager.cpp | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 43d59f7b43..96e83e6fbe 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -592,7 +592,7 @@ void LLShaderMgr::dumpShaderSource(U32 shader_code_count, GLchar** shader_code_t LL_CONT << LL_ENDL; } -void LLShaderMgr::dumpObjectLog(GLuint ret, BOOL warns, const std::string& filename) +void LLShaderMgr::dumpObjectLog(GLuint ret, BOOL warns, const std::string& filename) { std::string log = get_object_log(ret); std::string fname = filename; @@ -985,11 +985,6 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev fclose(file); - error = glGetError(); - if (error != GL_NO_ERROR) - { - LL_WARNS("HRS") << "WTF? Should be no error here: " << error << LL_ENDL; - } //create shader object GLuint ret = glCreateShader(type); @@ -1069,7 +1064,7 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev return ret; } -BOOL LLShaderMgr::linkProgramObject(GLuint obj, BOOL suppress_errors) +BOOL LLShaderMgr::linkProgramObject(GLuint obj, BOOL suppress_errors) { //check for errors glLinkProgram(obj); @@ -1079,6 +1074,8 @@ BOOL LLShaderMgr::linkProgramObject(GLuint obj, BOOL suppress_errors) { //an error occured, print log LL_SHADER_LOADING_WARNS() << "GLSL Linker Error:" << LL_ENDL; + dumpObjectLog(obj, TRUE, "linker"); + return success; } std::string log = get_object_log(obj); @@ -1178,7 +1175,7 @@ void LLShaderMgr::initAttribsAndUniforms() mReservedUniforms.push_back("emissiveColor"); mReservedUniforms.push_back("metallicFactor"); mReservedUniforms.push_back("roughnessFactor"); - + mReservedUniforms.push_back("diffuseMap"); mReservedUniforms.push_back("altDiffuseMap"); mReservedUniforms.push_back("specularMap"); diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp index e934041e2e..826d4892ef 100644 --- a/indra/newview/llfeaturemanager.cpp +++ b/indra/newview/llfeaturemanager.cpp @@ -607,7 +607,7 @@ void LLFeatureManager::applyFeatures(bool skipFeatures) void LLFeatureManager::setGraphicsLevel(U32 level, bool skipFeatures) { LLViewerShaderMgr::sSkipReload = true; - + flush_glerror(); // Whatever may have already happened (e.g., to cause us to change), don't let confuse it with new initializations. applyBaseMasks(); // if we're passed an invalid level, default to "Low" -- cgit v1.2.3 From cf8e1b2ac4614c0b4f8211f980214f5e823a672c Mon Sep 17 00:00:00 2001 From: Howard Stearns Date: Fri, 2 Sep 2022 16:01:38 -0700 Subject: SL-17967 - do not crash on zero-sized materials --- indra/newview/llgltfmateriallist.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp index af00cdd05f..b2d223a3e8 100644 --- a/indra/newview/llgltfmateriallist.cpp +++ b/indra/newview/llgltfmateriallist.cpp @@ -56,9 +56,16 @@ LLGLTFMaterial* LLGLTFMaterialList::getMaterial(const LLUUID& id) } LLFileSystem file(id, asset_type, LLFileSystem::READ); + auto size = file.getSize(); + if (!size) + { + LL_DEBUGS() << "Zero size material." << LL_ENDL; + mat->unref(); + return; + } std::vector buffer; - buffer.resize(file.getSize()); + buffer.resize(size); file.read((U8*)&buffer[0], buffer.size()); LLSD asset; -- cgit v1.2.3 From a6c385a8cbcd6083ce28277fc263f7140c9df5cd Mon Sep 17 00:00:00 2001 From: Howard Stearns Date: Fri, 2 Sep 2022 17:21:44 -0700 Subject: SL-17967 - bad copypasta --- indra/llrender/llglslshader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 7be1fd0702..91d756c0d1 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -969,7 +969,7 @@ BOOL LLGLSLShader::mapUniforms(const vector * uniforms) { // See slide 35 and more of https://docs.huihoo.com/apple/wwdc/2011/session_420__advances_in_opengl_for_mac_os_x_lion.pdf static const GLuint BLOCKBINDING = 1; //picked by us //Get the index, similar to a uniform location - GLuint UBOBlockIndex = glGetUniformBlockIndex(mProgramObject, "UBO"); + GLuint UBOBlockIndex = glGetUniformBlockIndex(mProgramObject, "ReflectionProbes"); //Set this index to a binding index glUniformBlockBinding(mProgramObject, UBOBlockIndex, BLOCKBINDING); } -- cgit v1.2.3