Readd probe count setting (#3793)
* Readd max probe count. Disable dynamic probe allocation by default (for now).master
parent
7fc9c0baa4
commit
5e5d466628
|
|
@ -105,6 +105,36 @@ LLCubeMapArray::LLCubeMapArray()
|
|||
|
||||
}
|
||||
|
||||
LLCubeMapArray::LLCubeMapArray(LLCubeMapArray& lhs, U32 width, U32 count) : mTextureStage(0)
|
||||
{
|
||||
mWidth = width;
|
||||
mCount = count;
|
||||
|
||||
// Allocate a new cubemap array with the same criteria as the incoming cubemap array
|
||||
allocate(mWidth, lhs.mImage->getComponents(), count, lhs.mImage->getUseMipMaps(), lhs.mHDR);
|
||||
|
||||
// Copy each cubemap from the incoming array to the new array
|
||||
U32 min_count = std::min(count, lhs.mCount);
|
||||
for (U32 i = 0; i < min_count * 6; ++i)
|
||||
{
|
||||
U32 src_resolution = lhs.mWidth;
|
||||
U32 dst_resolution = mWidth;
|
||||
{
|
||||
GLint components = GL_RGB;
|
||||
if (mImage->getComponents() == 4)
|
||||
components = GL_RGBA;
|
||||
GLint format = GL_RGB;
|
||||
|
||||
// Handle different resolutions by scaling the image
|
||||
LLPointer<LLImageRaw> src_image = new LLImageRaw(lhs.mWidth, lhs.mWidth, lhs.mImage->getComponents());
|
||||
glGetTexImage(GL_TEXTURE_CUBE_MAP_ARRAY, 0, components, GL_UNSIGNED_BYTE, src_image->getData());
|
||||
|
||||
LLPointer<LLImageRaw> scaled_image = src_image->scaled(mWidth, mWidth);
|
||||
glTexSubImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, 0, 0, i, mWidth, mWidth, 1, components, GL_UNSIGNED_BYTE, scaled_image->getData());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LLCubeMapArray::~LLCubeMapArray()
|
||||
{
|
||||
}
|
||||
|
|
@ -115,6 +145,8 @@ void LLCubeMapArray::allocate(U32 resolution, U32 components, U32 count, bool us
|
|||
mWidth = resolution;
|
||||
mCount = count;
|
||||
|
||||
mHDR = hdr;
|
||||
|
||||
LLImageGL::generateTextures(1, &texname);
|
||||
|
||||
mImage = new LLImageGL(resolution, resolution, components, use_mips);
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ class LLCubeMapArray : public LLRefCount
|
|||
{
|
||||
public:
|
||||
LLCubeMapArray();
|
||||
LLCubeMapArray(LLCubeMapArray& lhs, U32 width, U32 count);
|
||||
|
||||
static GLenum sTargets[6];
|
||||
|
||||
|
|
@ -73,4 +74,5 @@ protected:
|
|||
U32 mWidth = 0;
|
||||
U32 mCount = 0;
|
||||
S32 mTextureStage;
|
||||
bool mHDR;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9087,6 +9087,17 @@
|
|||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>RenderReflectionProbeDynamicAllocation</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Enable dynamic allocation of reflection probes. -1 means no dynamic allocation. Sets a buffer to allocate when a dynamic allocation occurs otherwise.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>S32</string>
|
||||
<key>Value</key>
|
||||
<integer>-1</integer>
|
||||
</map>
|
||||
<key>RenderReflectionProbeCount</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
// class3/environment/waterF.glsl
|
||||
|
||||
#define WATER_MINIMAL 1
|
||||
#define SHORELINE_FADE 1
|
||||
|
||||
out vec4 frag_color;
|
||||
|
||||
|
|
@ -264,7 +265,7 @@ void main()
|
|||
|
||||
// Calculate some distance fade in the water to better assist with refraction blending and reducing the refraction texture's "disconnect".
|
||||
#ifdef SHORELINE_FADE
|
||||
fade = max(0,min(1, (pos.z - refPos.z) / 10))
|
||||
fade = max(0,min(1, (pos.z - refPos.z) / 10));
|
||||
#else
|
||||
fade = 1 * water_mask;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@ RenderTonemapType 1 1
|
|||
RenderTonemapMix 1 1
|
||||
RenderDisableVintageMode 1 1
|
||||
RenderMaxTextureResolution 1 2048
|
||||
RenderReflectionProbeCount 1 256
|
||||
|
||||
//
|
||||
// Low Graphics Settings
|
||||
|
|
@ -128,6 +129,7 @@ RenderTonemapType 1 1
|
|||
RenderTonemapMix 1 0.7
|
||||
RenderDisableVintageMode 1 0
|
||||
RenderMaxTextureResolution 1 512
|
||||
RenderReflectionProbeCount 1 1
|
||||
|
||||
//
|
||||
// Medium Low Graphics Settings
|
||||
|
|
@ -170,6 +172,7 @@ RenderTonemapType 1 1
|
|||
RenderTonemapMix 1 0.7
|
||||
RenderDisableVintageMode 1 0
|
||||
RenderMaxTextureResolution 1 1024
|
||||
RenderReflectionProbeCount 1 32
|
||||
|
||||
//
|
||||
// Medium Graphics Settings (standard)
|
||||
|
|
@ -211,6 +214,7 @@ RenderExposure 1 1
|
|||
RenderTonemapType 1 1
|
||||
RenderTonemapMix 1 0.7
|
||||
RenderMaxTextureResolution 1 2048
|
||||
RenderReflectionProbeCount 1 64
|
||||
|
||||
//
|
||||
// Medium High Graphics Settings
|
||||
|
|
@ -252,6 +256,7 @@ RenderExposure 1 1
|
|||
RenderTonemapType 1 1
|
||||
RenderTonemapMix 1 0.7
|
||||
RenderMaxTextureResolution 1 2048
|
||||
RenderReflectionProbeCount 1 64
|
||||
|
||||
//
|
||||
// High Graphics Settings (SSAO + sun shadows)
|
||||
|
|
@ -293,6 +298,7 @@ RenderExposure 1 1
|
|||
RenderTonemapType 1 1
|
||||
RenderTonemapMix 1 0.7
|
||||
RenderMaxTextureResolution 1 2048
|
||||
RenderReflectionProbeCount 1 128
|
||||
|
||||
//
|
||||
// High Ultra Graphics Settings (deferred + SSAO + all shadows)
|
||||
|
|
@ -334,6 +340,7 @@ RenderExposure 1 1
|
|||
RenderTonemapType 1 1
|
||||
RenderTonemapMix 1 0.7
|
||||
RenderMaxTextureResolution 1 2048
|
||||
RenderReflectionProbeCount 1 256
|
||||
|
||||
//
|
||||
// Ultra graphics (REALLY PURTY!)
|
||||
|
|
@ -375,6 +382,7 @@ RenderExposure 1 1
|
|||
RenderTonemapType 1 1
|
||||
RenderTonemapMix 1 0.7
|
||||
RenderMaxTextureResolution 1 2048
|
||||
RenderReflectionProbeCount 1 256
|
||||
|
||||
//
|
||||
// Class Unknown Hardware (unknown)
|
||||
|
|
@ -408,6 +416,7 @@ RenderReflectionProbeDetail 0 -1
|
|||
RenderMirrors 0 0
|
||||
RenderDisableVintageMode 1 0
|
||||
RenderMaxTextureResolution 1 2048
|
||||
RenderReflectionProbeCount 0 0
|
||||
|
||||
list Intel
|
||||
RenderAnisotropic 1 0
|
||||
|
|
@ -429,6 +438,7 @@ RenderMirrors 0 0
|
|||
RenderGLMultiThreadedTextures 0 0
|
||||
RenderGLMultiThreadedMedia 0 0
|
||||
RenderDisableVintageMode 1 0
|
||||
RenderReflectionProbeCount 0 0
|
||||
|
||||
list TexUnit16orLess
|
||||
RenderTerrainPBRDetail 1 -1
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@ RenderTonemapMix 1 1
|
|||
RenderDisableVintageMode 1 1
|
||||
RenderDownScaleMethod 1 0
|
||||
RenderMaxTextureResolution 1 2048
|
||||
RenderReflectionProbeCount 1 256
|
||||
|
||||
//
|
||||
// Low Graphics Settings
|
||||
|
|
@ -128,6 +129,7 @@ RenderTonemapType 1 1
|
|||
RenderTonemapMix 1 0.7
|
||||
RenderDisableVintageMode 1 0
|
||||
RenderMaxTextureResolution 1 512
|
||||
RenderReflectionProbeCount 1 1
|
||||
|
||||
//
|
||||
// Medium Low Graphics Settings
|
||||
|
|
@ -170,6 +172,7 @@ RenderTonemapType 1 1
|
|||
RenderTonemapMix 1 0.7
|
||||
RenderDisableVintageMode 1 0
|
||||
RenderMaxTextureResolution 1 1024
|
||||
RenderReflectionProbeCount 1 32
|
||||
|
||||
//
|
||||
// Medium Graphics Settings (standard)
|
||||
|
|
@ -211,6 +214,7 @@ RenderExposure 1 1
|
|||
RenderTonemapType 1 1
|
||||
RenderTonemapMix 1 0.7
|
||||
RenderMaxTextureResolution 1 2048
|
||||
RenderReflectionProbeCount 1 64
|
||||
|
||||
//
|
||||
// Medium High Graphics Settings
|
||||
|
|
@ -252,6 +256,7 @@ RenderExposure 1 1
|
|||
RenderTonemapType 1 1
|
||||
RenderTonemapMix 1 0.7
|
||||
RenderMaxTextureResolution 1 2048
|
||||
RenderReflectionProbeCount 1 64
|
||||
|
||||
//
|
||||
// High Graphics Settings (SSAO + sun shadows)
|
||||
|
|
@ -293,6 +298,7 @@ RenderExposure 1 1
|
|||
RenderTonemapType 1 1
|
||||
RenderTonemapMix 1 0.7
|
||||
RenderMaxTextureResolution 1 2048
|
||||
RenderReflectionProbeCount 1 128
|
||||
|
||||
//
|
||||
// High Ultra Graphics Settings (SSAO + all shadows)
|
||||
|
|
@ -334,6 +340,7 @@ RenderExposure 1 1
|
|||
RenderTonemapType 1 1
|
||||
RenderTonemapMix 1 0.7
|
||||
RenderMaxTextureResolution 1 2048
|
||||
RenderReflectionProbeCount 1 256
|
||||
|
||||
//
|
||||
// Ultra graphics (REALLY PURTY!)
|
||||
|
|
@ -375,6 +382,7 @@ RenderExposure 1 1
|
|||
RenderTonemapType 1 1
|
||||
RenderTonemapMix 1 0.7
|
||||
RenderMaxTextureResolution 1 2048
|
||||
RenderReflectionProbeCount 1 256
|
||||
|
||||
//
|
||||
// Class Unknown Hardware (unknown)
|
||||
|
|
@ -407,6 +415,7 @@ RenderShadowDetail 0 0
|
|||
RenderMirrors 0 0
|
||||
RenderDisableVintageMode 1 0
|
||||
RenderMaxTextureResolution 1 2048
|
||||
RenderReflectionProbeCount 0 0
|
||||
|
||||
list TexUnit8orLess
|
||||
RenderDeferredSSAO 0 0
|
||||
|
|
@ -447,6 +456,7 @@ RenderReflectionProbeDetail 0 0
|
|||
RenderReflectionsEnabled 0 0
|
||||
RenderMirrors 0 0
|
||||
RenderDisableVintageMode 1 0
|
||||
RenderReflectionProbeCount 0 0
|
||||
|
||||
list VaryingVectors16orLess
|
||||
RenderTerrainPBRPlanarSampleCount 1 1
|
||||
|
|
|
|||
|
|
@ -224,48 +224,54 @@ void LLReflectionMapManager::update()
|
|||
|
||||
static LLCachedControl<S32> sDetail(gSavedSettings, "RenderReflectionProbeDetail", -1);
|
||||
static LLCachedControl<S32> sLevel(gSavedSettings, "RenderReflectionProbeLevel", 3);
|
||||
static LLCachedControl<U32> sReflectionProbeCount(gSavedSettings, "RenderReflectionProbeCount", 256U);
|
||||
static LLCachedControl<S32> sProbeDynamicAllocation(gSavedSettings, "RenderReflectionProbeDynamicAllocation", -1);
|
||||
mResetFade = llmin((F32)(mResetFade + gFrameIntervalSeconds * 2.f), 1.f);
|
||||
|
||||
// Once every 20 frames, update the dynamic probe count.
|
||||
if (gFrameCount % 20)
|
||||
{
|
||||
U32 probe_count_temp = mDynamicProbeCount;
|
||||
if (sLevel == 0)
|
||||
if (sProbeDynamicAllocation > -1)
|
||||
{
|
||||
mDynamicProbeCount = 1;
|
||||
}
|
||||
else if (sLevel == 1)
|
||||
{
|
||||
mDynamicProbeCount = (U32)mProbes.size();
|
||||
if (sLevel == 0)
|
||||
{
|
||||
mDynamicProbeCount = 1;
|
||||
}
|
||||
else if (sLevel == 1)
|
||||
{
|
||||
mDynamicProbeCount = (U32)mProbes.size();
|
||||
}
|
||||
else if (sLevel == 2)
|
||||
{
|
||||
mDynamicProbeCount = llmax((U32)mProbes.size(), 128);
|
||||
}
|
||||
else
|
||||
{
|
||||
mDynamicProbeCount = 256;
|
||||
}
|
||||
|
||||
}
|
||||
else if (sLevel == 2)
|
||||
{
|
||||
mDynamicProbeCount = llmax((U32)mProbes.size(), 128);
|
||||
if (sProbeDynamicAllocation > 1)
|
||||
{
|
||||
// Round mDynamicProbeCount to the nearest increment of 16
|
||||
mDynamicProbeCount = ((mDynamicProbeCount + sProbeDynamicAllocation / 2) / sProbeDynamicAllocation) * 16;
|
||||
mDynamicProbeCount = llclamp(mDynamicProbeCount, 1, sReflectionProbeCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
mDynamicProbeCount = llclamp(mDynamicProbeCount + sProbeDynamicAllocation, 1, sReflectionProbeCount);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mDynamicProbeCount = 256;
|
||||
mDynamicProbeCount = sReflectionProbeCount;
|
||||
}
|
||||
|
||||
// Round mDynamicProbeCount to the nearest increment of 32
|
||||
mDynamicProbeCount = ((mDynamicProbeCount + 16) / 32) * 32;
|
||||
mDynamicProbeCount = llclamp(mDynamicProbeCount, 1, LL_MAX_REFLECTION_PROBE_COUNT);
|
||||
mDynamicProbeCount = llmin(mDynamicProbeCount, LL_MAX_REFLECTION_PROBE_COUNT);
|
||||
|
||||
if (mDynamicProbeCount < probe_count_temp * 1.1 && mDynamicProbeCount > probe_count_temp * 0.9)
|
||||
mDynamicProbeCount = probe_count_temp;
|
||||
else
|
||||
mGlobalFadeTarget = 0.f;
|
||||
if (mDynamicProbeCount != probe_count_temp)
|
||||
mResetFade = 1.f;
|
||||
}
|
||||
|
||||
if (mGlobalFadeTarget < mResetFade)
|
||||
mResetFade = llmax(mGlobalFadeTarget, mResetFade - (F32)gFrameIntervalSeconds * 2);
|
||||
else
|
||||
mResetFade = llmin(mGlobalFadeTarget, mResetFade + (F32)gFrameIntervalSeconds * 2);
|
||||
|
||||
if (mResetFade == mGlobalFadeTarget)
|
||||
{
|
||||
initReflectionMaps();
|
||||
}
|
||||
initReflectionMaps();
|
||||
|
||||
static LLCachedControl<bool> render_hdr(gSavedSettings, "RenderHDREnabled", true);
|
||||
|
||||
|
|
@ -356,6 +362,7 @@ void LLReflectionMapManager::update()
|
|||
probe->mCubeArray = nullptr;
|
||||
probe->mCubeIndex = -1;
|
||||
probe->mComplete = false;
|
||||
probe->mFadeIn = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1418,8 +1425,6 @@ void LLReflectionMapManager::initReflectionMaps()
|
|||
}
|
||||
|
||||
gEXRImage = nullptr;
|
||||
mGlobalFadeTarget = 1.f;
|
||||
mResetFade = -0.125f;
|
||||
mReset = false;
|
||||
mReflectionProbeCount = mDynamicProbeCount;
|
||||
mProbeResolution = probe_resolution;
|
||||
|
|
@ -1429,15 +1434,25 @@ void LLReflectionMapManager::initReflectionMaps()
|
|||
mTexture->getWidth() != mProbeResolution ||
|
||||
mReflectionProbeCount + 2 != mTexture->getCount())
|
||||
{
|
||||
mTexture = new LLCubeMapArray();
|
||||
if (mTexture)
|
||||
{
|
||||
mTexture = new LLCubeMapArray(*mTexture, mProbeResolution, mReflectionProbeCount + 2);
|
||||
|
||||
static LLCachedControl<bool> render_hdr(gSavedSettings, "RenderHDREnabled", true);
|
||||
mIrradianceMaps = new LLCubeMapArray(*mIrradianceMaps, LL_IRRADIANCE_MAP_RESOLUTION, mReflectionProbeCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
mTexture = new LLCubeMapArray();
|
||||
|
||||
// store mReflectionProbeCount+2 cube maps, final two cube maps are used for render target and radiance map generation source)
|
||||
mTexture->allocate(mProbeResolution, 3, mReflectionProbeCount + 2, true, render_hdr);
|
||||
static LLCachedControl<bool> render_hdr(gSavedSettings, "RenderHDREnabled", true);
|
||||
|
||||
mIrradianceMaps = new LLCubeMapArray();
|
||||
mIrradianceMaps->allocate(LL_IRRADIANCE_MAP_RESOLUTION, 3, mReflectionProbeCount, false, render_hdr);
|
||||
// store mReflectionProbeCount+2 cube maps, final two cube maps are used for render target and radiance map generation
|
||||
// source)
|
||||
mTexture->allocate(mProbeResolution, 3, mReflectionProbeCount + 2, true, render_hdr);
|
||||
|
||||
mIrradianceMaps = new LLCubeMapArray();
|
||||
mIrradianceMaps->allocate(LL_IRRADIANCE_MAP_RESOLUTION, 3, mReflectionProbeCount, false, render_hdr);
|
||||
}
|
||||
}
|
||||
|
||||
// reset probe state
|
||||
|
|
@ -1457,6 +1472,7 @@ void LLReflectionMapManager::initReflectionMaps()
|
|||
probe->mCubeArray = nullptr;
|
||||
probe->mCubeIndex = -1;
|
||||
probe->mNeighbors.clear();
|
||||
probe->mFadeIn = 0;
|
||||
}
|
||||
|
||||
mCubeFree.clear();
|
||||
|
|
|
|||
|
|
@ -858,6 +858,51 @@
|
|||
value="3"/>
|
||||
</combo_box>
|
||||
|
||||
<text
|
||||
type="string"
|
||||
length="1"
|
||||
follows="left|top"
|
||||
height="16"
|
||||
layout="topleft"
|
||||
left="420"
|
||||
name="ReflectionProbeCount"
|
||||
text_readonly_color="LabelDisabledColor"
|
||||
top_delta="22"
|
||||
width="128">
|
||||
Max Reflection Probes:
|
||||
</text>
|
||||
|
||||
<combo_box
|
||||
control_name="RenderReflectionProbeCount"
|
||||
height="18"
|
||||
layout="topleft"
|
||||
label="Max. Reflection Probes:"
|
||||
left_delta="130"
|
||||
top_delta="0"
|
||||
name="ProbeCount"
|
||||
width="150">
|
||||
<combo_box.item
|
||||
label="None"
|
||||
name="1"
|
||||
value="1"/>
|
||||
<combo_box.item
|
||||
label="Low"
|
||||
name="32"
|
||||
value="32"/>
|
||||
<combo_box.item
|
||||
label="Medium"
|
||||
name="64"
|
||||
value="64"/>
|
||||
<combo_box.item
|
||||
label="High"
|
||||
name="128"
|
||||
value="128"/>
|
||||
<combo_box.item
|
||||
label="Ultra"
|
||||
name="256"
|
||||
value="256"/>
|
||||
</combo_box>
|
||||
|
||||
<slider
|
||||
control_name="RenderExposure"
|
||||
decimal_digits="1"
|
||||
|
|
|
|||
Loading…
Reference in New Issue