brad/2744 handle shader errors (#3105)
* Partial solution to secondlife/viewer#2744 crash with better error handling. Handles shader compile errors better, and should turn crash into an LL_ERRS assertion failure. Strengthed more assertions and improved shader error line numbers * Even more error handling to get a handle on crash secondlife/viewer#2744 * Improved GLSL correctness on Intel chips that lack OpenGL 4.6 support. secondlife/viewer#2744 * Removed non-working fallback code for gDeferredPostProgram * Fixed incorrect llmax callmaster
parent
c654dac4b7
commit
7be9c43f28
|
|
@ -1046,7 +1046,7 @@ void LLGLSLShader::bind()
|
|||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER;
|
||||
|
||||
llassert(mProgramObject != 0);
|
||||
llassert_always(mProgramObject != 0);
|
||||
|
||||
gGL.flush();
|
||||
|
||||
|
|
@ -1069,6 +1069,9 @@ void LLGLSLShader::bind()
|
|||
LLShaderMgr::instance()->updateShaderUniforms(this);
|
||||
mUniformsDirty = false;
|
||||
}
|
||||
|
||||
llassert_always(sCurBoundShaderPtr != nullptr);
|
||||
llassert_always(sCurBoundShader == mProgramObject);
|
||||
}
|
||||
|
||||
void LLGLSLShader::bind(U8 variant)
|
||||
|
|
|
|||
|
|
@ -1569,7 +1569,8 @@ void LLRender::flush()
|
|||
if (mCount > 0)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
|
||||
llassert(LLGLSLShader::sCurBoundShaderPtr != nullptr);
|
||||
llassert_always(LLGLSLShader::sCurBoundShaderPtr != nullptr);
|
||||
|
||||
if (!mUIOffset.empty())
|
||||
{
|
||||
sUICalls++;
|
||||
|
|
|
|||
|
|
@ -559,17 +559,11 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev
|
|||
}
|
||||
else if (major_version == 3)
|
||||
{
|
||||
if (minor_version < 10)
|
||||
if (minor_version <= 29)
|
||||
{
|
||||
shader_code_text[shader_code_count++] = strdup("#version 300\n");
|
||||
}
|
||||
else if (minor_version <= 19)
|
||||
{
|
||||
shader_code_text[shader_code_count++] = strdup("#version 310\n");
|
||||
}
|
||||
else if (minor_version <= 29)
|
||||
{
|
||||
shader_code_text[shader_code_count++] = strdup("#version 320\n");
|
||||
// OpenGL 3.2 had GLSL version 1.50. anything after that the version numbers match.
|
||||
// https://www.khronos.org/opengl/wiki/Core_Language_(GLSL)#OpenGL_and_GLSL_versions
|
||||
shader_code_text[shader_code_count++] = strdup("#version 150\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1150,7 +1150,7 @@ vec3 linear_to_srgb(vec3 cl);
|
|||
AF3 ASignedF3(AF3 m){return ASatF3(m*AF3_(A_INFN_F));}
|
||||
AF4 ASignedF4(AF4 m){return ASatF4(m*AF4_(A_INFN_F));}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
AF1 AGtZeroF1(AF1 m){return ASatF1(m*AF1_(A_INFP_F));}
|
||||
// #2744 avoid constant overflow AF1 AGtZeroF1(AF1 m){return ASatF1(m*AF1_(A_INFP_F));}
|
||||
AF2 AGtZeroF2(AF2 m){return ASatF2(m*AF2_(A_INFP_F));}
|
||||
AF3 AGtZeroF3(AF3 m){return ASatF3(m*AF3_(A_INFP_F));}
|
||||
AF4 AGtZeroF4(AF4 m){return ASatF4(m*AF4_(A_INFP_F));}
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ vec4 prefilterEnvMap(vec3 R)
|
|||
float totalWeight = 0.0;
|
||||
float envMapDim = float(textureSize(reflectionProbes, 0).s);
|
||||
float roughness = mipLevel/max_probe_lod;
|
||||
int numSamples = max(int(PROBE_FILTER_SAMPLES*roughness), 1);
|
||||
uint numSamples = uint(max(PROBE_FILTER_SAMPLES*roughness, 1));
|
||||
|
||||
float numMips = max_probe_lod+1;
|
||||
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ void main()
|
|||
|
||||
vec4 collectedColor = vec4(0);
|
||||
|
||||
float w = tapScreenSpaceReflection(4, tc, pos, norm.xyz, collectedColor, diffuseMap, 0);
|
||||
float w = tapScreenSpaceReflection(4, tc, pos, norm.xyz, collectedColor, diffuseMap, 0.f);
|
||||
|
||||
collectedColor.rgb *= specCol.rgb;
|
||||
|
||||
|
|
|
|||
|
|
@ -655,6 +655,21 @@ void LLFeatureManager::applyBaseMasks()
|
|||
if (gGLManager.mIsIntel)
|
||||
{
|
||||
maskFeatures("Intel");
|
||||
if (gGLManager.mGLVersion < 4.59f)
|
||||
{
|
||||
// if we don't have OpenGL 4.6 on intel, set it to OpenGL 3.3
|
||||
// we also want to trigger the GL3 fallbacks on these chipsets
|
||||
// this is expected to be mainly pre-Haswell Intel HD Graphics 4X00 and 5X00.
|
||||
// A lot of these chips claim 4.3 or 4.4 support, but don't seem to work.
|
||||
// https://code.blender.org/2019/04/supported-gpus-in-blender-2-80/
|
||||
// https://docs.blender.org/manual/en/latest/troubleshooting/gpu/windows/intel.html#legacy-intel-hd-4000-5000
|
||||
// https://www.intel.com/content/www/us/en/support/articles/000005524/graphics.html
|
||||
// this will disable things like reflection probes, HDR, FXAA and SMAA
|
||||
gGLManager.mGLVersion = llmin(gGLManager.mGLVersion, 3.33f);
|
||||
// and select GLSL version for OpenGL 3.3
|
||||
gGLManager.mGLSLVersionMajor = 3;
|
||||
gGLManager.mGLSLVersionMinor = 30;
|
||||
}
|
||||
}
|
||||
if (gGLManager.mIsApple)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2501,7 +2501,14 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gCASProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER));
|
||||
gCASProgram.mShaderFiles.push_back(make_pair("deferred/CASF.glsl", GL_FRAGMENT_SHADER));
|
||||
gCASProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
gCASProgram.createShader();
|
||||
success = gCASProgram.createShader();
|
||||
// llassert(success);
|
||||
if (!success)
|
||||
{
|
||||
LL_WARNS() << "Failed to create shader '" << gCASProgram.mName << "', disabling!" << LL_ENDL;
|
||||
// continue as if this shader never happened
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (success)
|
||||
|
|
|
|||
|
|
@ -1436,15 +1436,24 @@ void LLPipeline::createLUTBuffers()
|
|||
|
||||
mPbrBrdfLut.allocate(512, 512, GL_RG16F);
|
||||
mPbrBrdfLut.bindTarget();
|
||||
gDeferredGenBrdfLutProgram.bind();
|
||||
|
||||
gGL.begin(LLRender::TRIANGLE_STRIP);
|
||||
gGL.vertex2f(-1, -1);
|
||||
gGL.vertex2f(-1, 1);
|
||||
gGL.vertex2f(1, -1);
|
||||
gGL.vertex2f(1, 1);
|
||||
gGL.end();
|
||||
gGL.flush();
|
||||
if (gDeferredGenBrdfLutProgram.isComplete())
|
||||
{
|
||||
gDeferredGenBrdfLutProgram.bind();
|
||||
llassert_always(LLGLSLShader::sCurBoundShaderPtr != nullptr);
|
||||
|
||||
gGL.begin(LLRender::TRIANGLE_STRIP);
|
||||
gGL.vertex2f(-1, -1);
|
||||
gGL.vertex2f(-1, 1);
|
||||
gGL.vertex2f(1, -1);
|
||||
gGL.vertex2f(1, 1);
|
||||
gGL.end();
|
||||
gGL.flush();
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS("Brad") << gDeferredGenBrdfLutProgram.mName << " failed to load, cannot be used!" << LL_ENDL;
|
||||
}
|
||||
|
||||
gDeferredGenBrdfLutProgram.unbind();
|
||||
mPbrBrdfLut.flush();
|
||||
|
|
|
|||
Loading…
Reference in New Issue