diff options
author | Dave Parks <davep@lindenlab.com> | 2023-03-30 14:53:01 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2023-03-30 14:53:01 -0500 |
commit | e8114dbe14cc71664f6a27bbe727ff8c25fbc643 (patch) | |
tree | a88fba730b0fd67beb0be360e82e8fe707e34e6c /indra | |
parent | 3494a61ebf6d9d5c5c68d4679dc8c9133f8c14f0 (diff) |
SL-19517 Fix for RenderReflectionProbeCount other than 256 causing black reflections.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl | 10 | ||||
-rw-r--r-- | indra/newview/llreflectionmapmanager.cpp | 28 | ||||
-rw-r--r-- | indra/newview/llviewershadermgr.cpp | 20 |
3 files changed, 35 insertions, 23 deletions
diff --git a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl index 7a5676e0ab..ec7a2f4768 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl @@ -35,6 +35,8 @@ uniform sampler2D sceneMap; uniform int cube_snapshot; uniform float max_probe_lod; +#define MAX_REFMAP_COUNT 256 // must match LL_MAX_REFLECTION_PROBE_COUNT + layout (std140) uniform ReflectionProbes { // list of OBBs for user override probes @@ -42,18 +44,18 @@ layout (std140) uniform ReflectionProbes // for each box refBox[i]... /// box[0..2] - plane 0 .. 2 in [A,B,C,D] notation // box[3][0..2] - plane thickness - mat4 refBox[REFMAP_COUNT]; + mat4 refBox[MAX_REFMAP_COUNT]; // list of bounding spheres for reflection probes sorted by distance to camera (closest first) - vec4 refSphere[REFMAP_COUNT]; + vec4 refSphere[MAX_REFMAP_COUNT]; // extra parameters (currently only .x used for probe ambiance) - vec4 refParams[REFMAP_COUNT]; + vec4 refParams[MAX_REFMAP_COUNT]; // index of cube map in reflectionProbes for a corresponding reflection probe // e.g. cube map channel of refSphere[2] is stored in refIndex[2] // refIndex.x - cubemap channel in reflectionProbes // refIndex.y - index in refNeighbor of neighbor list (index is ivec4 index, not int index) // refIndex.z - number of neighbors // refIndex.w - priority, if negative, this probe has a box influence - ivec4 refIndex[REFMAP_COUNT]; + ivec4 refIndex[MAX_REFMAP_COUNT]; // neighbor list data (refSphere indices, not cubemap array layer) ivec4 refNeighbor[1024]; diff --git a/indra/newview/llreflectionmapmanager.cpp b/indra/newview/llreflectionmapmanager.cpp index e9df67c724..624eead68e 100644 --- a/indra/newview/llreflectionmapmanager.cpp +++ b/indra/newview/llreflectionmapmanager.cpp @@ -1006,11 +1006,15 @@ void LLReflectionMapManager::renderDebug() void LLReflectionMapManager::initReflectionMaps() { - if (mTexture.isNull()) + static LLCachedControl<S32> probe_count(gSavedSettings, "RenderReflectionProbeCount", LL_MAX_REFLECTION_PROBE_COUNT); + + U32 count = llclamp((S32) probe_count, 1, LL_MAX_REFLECTION_PROBE_COUNT); + + if (mTexture.isNull() || mReflectionProbeCount != count) { + mReflectionProbeCount = count; mProbeResolution = nhpo2(llclamp(gSavedSettings.getU32("RenderReflectionProbeResolution"), (U32)64, (U32)512)); mMaxProbeLOD = log2f(mProbeResolution) - 1.f; // number of mips - 1 - mReflectionProbeCount = llclamp(gSavedSettings.getS32("RenderReflectionProbeCount"), 1, LL_MAX_REFLECTION_PROBE_COUNT); mTexture = new LLCubeMapArray(); @@ -1019,6 +1023,26 @@ void LLReflectionMapManager::initReflectionMaps() mIrradianceMaps = new LLCubeMapArray(); mIrradianceMaps->allocate(LL_IRRADIANCE_MAP_RESOLUTION, 3, mReflectionProbeCount, FALSE); + + // reset probe state + mUpdatingFace = 0; + mUpdatingProbe = nullptr; + mRadiancePass = false; + mRealtimeRadiancePass = false; + mDefaultProbe = nullptr; + + for (auto& probe : mProbes) + { + probe->mComplete = false; + probe->mProbeIndex = -1; + probe->mCubeArray = nullptr; + probe->mCubeIndex = -1; + } + + for (bool& is_free : mCubeFree) + { + is_free = true; + } } if (mVertexBuffer.isNull()) diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 93f4d22ff8..d1f6392eae 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -401,30 +401,16 @@ void LLViewerShaderMgr::setShaders() llassert((gGLManager.mGLSLVersionMajor > 1 || gGLManager.mGLSLVersionMinor >= 10)); - //bool canRenderDeferred = true; // DEPRECATED -- LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred"); - //bool hasWindLightShaders = true; // DEPRECATED -- LLFeatureManager::getInstance()->isFeatureAvailable("WindLightUseAtmosShaders"); - bool doingWindLight = true; //DEPRECATED -- hasWindLightShaders&& gSavedSettings.getBOOL("WindLightUseAtmosShaders"); - + S32 light_class = 3; S32 interface_class = 2; S32 env_class = 2; S32 obj_class = 2; S32 effect_class = 2; - S32 wl_class = 1; + S32 wl_class = 2; S32 water_class = 3; S32 deferred_class = 3; - if (doingWindLight) - { - // user has disabled WindLight in their settings, downgrade - // windlight shaders to stub versions. - wl_class = 2; - } - else - { - light_class = 2; - } - // Trigger a full rebuild of the fallback skybox / cubemap if we've toggled windlight shaders if (!wl_class || (mShaderLevel[SHADER_WINDLIGHT] != wl_class && gSky.mVOSkyp.notNull())) { @@ -670,7 +656,7 @@ std::string LLViewerShaderMgr::loadBasicShaders() bool has_reflection_probes = gSavedSettings.getBOOL("RenderReflectionsEnabled") && gGLManager.mGLVersion > 3.99f; - S32 probe_count = gSavedSettings.getS32("RenderReflectionProbeCount"); + S32 probe_count = llclamp(gSavedSettings.getS32("RenderReflectionProbeCount"), 1, LL_MAX_REFLECTION_PROBE_COUNT); if (ambient_kill) { |