diff options
author | Graham Linden <graham@lindenlab.com> | 2018-12-19 14:59:19 -0800 |
---|---|---|
committer | Graham Linden <graham@lindenlab.com> | 2018-12-19 14:59:19 -0800 |
commit | 07bff3129adaabb90f09b71fa65c8be0c3ecef5d (patch) | |
tree | f807675a310273551dcb325227f4f7b41dfa7528 /indra/newview/llviewershadermgr.cpp | |
parent | 0b357e457b8abac6cd0154bcd5001ac6c2b184bf (diff) |
Add new shaders for advanced atmo SH env lighting calcs.
Diffstat (limited to 'indra/newview/llviewershadermgr.cpp')
-rw-r--r-- | indra/newview/llviewershadermgr.cpp | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index bb3ad4bea6..9a62ab232d 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -242,6 +242,10 @@ LLGLSLShader gDeferredSkinnedFullbrightShinyProgram; LLGLSLShader gDeferredSkinnedFullbrightProgram; LLGLSLShader gNormalMapGenProgram; +LLGLSLShader gDeferredGenSkyShProgram; +LLGLSLShader gDeferredGatherSkyShProgram; +LLGLSLShader gDeferredShVisProgram; + // Deferred materials shaders LLGLSLShader gDeferredMaterialProgram[LLMaterial::SHADER_COUNT*2]; LLGLSLShader gDeferredMaterialWaterProgram[LLMaterial::SHADER_COUNT*2]; @@ -350,6 +354,9 @@ LLViewerShaderMgr::LLViewerShaderMgr() : mShaderList.push_back(&gDeferredWLCloudProgram); mShaderList.push_back(&gDeferredWLMoonProgram); mShaderList.push_back(&gDeferredWLSunProgram); + mShaderList.push_back(&gDeferredGenSkyShProgram); + mShaderList.push_back(&gDeferredGatherSkyShProgram); + mShaderList.push_back(&gDeferredShVisProgram); } LLViewerShaderMgr::~LLViewerShaderMgr() @@ -1276,6 +1283,10 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredMaterialProgram[i].unload(); gDeferredMaterialWaterProgram[i].unload(); } + + gDeferredGenSkyShProgram.unload(); + gDeferredGatherSkyShProgram.unload(); + gDeferredShVisProgram.unload(); return TRUE; } @@ -2287,6 +2298,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() { gDeferredCoFProgram.mName = "Deferred CoF Shader"; gDeferredCoFProgram.mShaderFiles.clear(); + gDeferredCoFProgram.mFeatures.isDeferred = true; gDeferredCoFProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER_ARB)); gDeferredCoFProgram.mShaderFiles.push_back(make_pair("deferred/cofF.glsl", GL_FRAGMENT_SHADER_ARB)); gDeferredCoFProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; @@ -2363,6 +2375,42 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() llassert(success); } + if (success && gAtmosphere && (mShaderLevel[SHADER_WINDLIGHT] > 2)) + { + gDeferredGenSkyShProgram.mName = "Deferred Generate Sky Indirect SH Program"; + gDeferredGenSkyShProgram.mFeatures.decodesNormal = true; + + gDeferredGenSkyShProgram.mShaderFiles.clear(); + gDeferredGenSkyShProgram.mShaderFiles.push_back(make_pair("deferred/genSkyShV.glsl", GL_VERTEX_SHADER_ARB)); + gDeferredGenSkyShProgram.mShaderFiles.push_back(make_pair("deferred/genSkyShF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDeferredGenSkyShProgram.mShaderLevel = mShaderLevel[SHADER_WINDLIGHT]; + gDeferredGenSkyShProgram.mExtraLinkObject = gAtmosphere->getAtmosphericShaderForLink(); + success = gDeferredGenSkyShProgram.createShader(NULL, NULL); + llassert(success); + } + + if (success && gAtmosphere && (mShaderLevel[SHADER_WINDLIGHT] > 2)) + { + gDeferredGatherSkyShProgram.mName = "Deferred Gather Sky Indirect SH Program"; + gDeferredGatherSkyShProgram.mShaderFiles.clear(); + gDeferredGatherSkyShProgram.mShaderFiles.push_back(make_pair("deferred/gatherSkyShV.glsl", GL_VERTEX_SHADER_ARB)); + gDeferredGatherSkyShProgram.mShaderFiles.push_back(make_pair("deferred/gatherSkyShF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDeferredGatherSkyShProgram.mShaderLevel = 3; + success = gDeferredGatherSkyShProgram.createShader(NULL, NULL); + llassert(success); + } + + if (success) + { + gDeferredShVisProgram.mName = "Deferred SH Vis Program"; + gDeferredShVisProgram.mShaderFiles.clear(); + gDeferredShVisProgram.mShaderFiles.push_back(make_pair("deferred/shVisV.glsl", GL_VERTEX_SHADER_ARB)); + gDeferredShVisProgram.mShaderFiles.push_back(make_pair("deferred/shVisF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDeferredShVisProgram.mShaderLevel = 3; + success = gDeferredShVisProgram.createShader(NULL, NULL); + llassert(success); + } + if (success) { gDeferredWLSunProgram.mName = "Deferred Windlight Sun Program"; @@ -3745,7 +3793,7 @@ BOOL LLViewerShaderMgr::loadShadersWindLight() #if USE_ADVANCED_ATMOSPHERICS // disabled until we can determine why low-end machines crash during this init... - if (mVertexShaderLevel[SHADER_WINDLIGHT] > 1) + if (gSavedSettings.getBOOL("RenderUseAdvancedAtmospherics") && mShaderLevel[SHADER_WINDLIGHT] > 2) { // Prepare precomputed atmospherics textures using libatmosphere LLAtmosphere::initClass(); |