Merge branch 'release/2024.09-ExtraFPS' of https://github.com/secondlife/viewer

# Conflicts:
#	indra/newview/app_settings/settings.xml
#	indra/newview/pipeline.cpp
master
Ansariel 2024-11-13 11:31:28 +01:00
commit 1531b28979
32 changed files with 214 additions and 109 deletions

View File

@ -692,7 +692,8 @@ private:
memset(cpu_vendor, 0, len);
sysctlbyname("machdep.cpu.vendor", (void*)cpu_vendor, &len, NULL, 0);
cpu_vendor[0x1f] = 0;
setInfo(eVendor, cpu_vendor);
// M series CPUs don't provide this field so if empty, just fall back to Apple.
setInfo(eVendor, (cpu_vendor[0] != '\0') ? cpu_vendor : "Apple");
setInfo(eStepping, getSysctlInt("machdep.cpu.stepping"));
setInfo(eModel, getSysctlInt("machdep.cpu.model"));

View File

@ -2179,15 +2179,15 @@ void LLImageGL::analyzeAlpha(const void* data_in, U32 w, U32 h)
// this will mid-skew the data (and thus increase the chances of not
// being used as a mask) from high-frequency alpha maps which
// suffer the worst from aliasing when used as alpha masks.
if (w >= 4 && h >= 4)
if (w >= 2 && h >= 2)
{
llassert(w%4 == 0);
llassert(h%4 == 0);
llassert(w % 2 == 0);
llassert(h % 2 == 0);
const GLubyte* rowstart = ((const GLubyte*) data_in) + mAlphaOffset;
for (U32 y = 0; y < h; y+=4)
for (U32 y = 0; y < h; y += 2)
{
const GLubyte* current = rowstart;
for (U32 x = 0; x < w; x+=4)
for (U32 x = 0; x < w; x += 2)
{
const U32 s1 = current[0];
alphatotal += s1;
@ -2210,8 +2210,7 @@ void LLImageGL::analyzeAlpha(const void* data_in, U32 w, U32 h)
sample[asum/(16*4)] += 4;
}
rowstart += 4 * w * mAlphaStride;
rowstart += 2 * w * mAlphaStride;
}
length *= 2; // we sampled everything twice, essentially
}
@ -2456,41 +2455,32 @@ bool LLImageGL::scaleDown(S32 desired_discard)
if (gGLManager.mDownScaleMethod == 0)
{ // use an FBO to downscale the texture
// allocate new texture
U32 temp_texname = 0;
generateTextures(1, &temp_texname);
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, temp_texname, true);
{
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("scaleDown - glTexImage2D");
glTexImage2D(mTarget, 0, mFormatInternal, desired_width, desired_height, 0, mFormatPrimary, mFormatType, NULL);
}
// account for new texture getting created
alloc_tex_image(desired_width, desired_height, mFormatInternal, 1);
// Use render-to-texture to scale down the texture
{
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("scaleDown - glFramebufferTexture2D");
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, mTarget, temp_texname, 0);
}
glViewport(0, 0, desired_width, desired_height);
// draw a full screen triangle
gGL.getTexUnit(0)->bind(this);
glDrawArrays(GL_TRIANGLES, 0, 3);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
if (gGL.getTexUnit(0)->bind(this, true, true))
{
glDrawArrays(GL_TRIANGLES, 0, 3);
// delete old texture and assign new texture name
deleteTextures(1, &mTexName);
mTexName = temp_texname;
free_tex_image(mTexName);
glTexImage2D(mTarget, 0, mFormatInternal, desired_width, desired_height, 0, mFormatPrimary, mFormatType, nullptr);
glCopyTexSubImage2D(mTarget, 0, 0, 0, 0, 0, desired_width, desired_height);
alloc_tex_image(desired_width, desired_height, mFormatInternal, 1);
if (mHasMipMaps)
{ // generate mipmaps if needed
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("scaleDown - glGenerateMipmap");
gGL.getTexUnit(0)->bind(this);
glGenerateMipmap(mTarget);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
mTexOptionsDirty = true;
if (mHasMipMaps)
{ // generate mipmaps if needed
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("scaleDown - glGenerateMipmap");
gGL.getTexUnit(0)->bind(this);
glGenerateMipmap(mTarget);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
}
}
else
{
LL_WARNS_ONCE("LLImageGL") << "Failed to bind texture for downscaling." << LL_ENDL;
return false;
}
}
else

View File

@ -273,11 +273,13 @@ static GLuint gen_buffer()
{
LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("gen buffer");
sIndex = pool_size;
#if !LL_DARWIN
if (!gGLManager.mIsAMD)
{
glGenBuffers(pool_size, sNamePool);
}
else
#endif
{ // work around for AMD driver bug
for (U32 i = 0; i < pool_size; ++i)
{
@ -959,6 +961,10 @@ void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const
void LLVertexBuffer::initClass(LLWindow* window)
{
llassert(sVBOPool == nullptr);
LL_INFOS() << "VBO Pooling Disabled" << LL_ENDL;
sVBOPool = new LLAppleVBOPool();
if (gGLManager.mIsApple)
{
LL_INFOS() << "VBO Pooling Disabled" << LL_ENDL;

View File

@ -11249,7 +11249,7 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Type</key>
<string>U32</string>
<key>Value</key>
<integer>1</integer>
<integer>0</integer>
</map>
<key>RenderDebugTextureBind</key>
<map>
@ -23175,6 +23175,17 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Value</key>
<integer>0</integer>
</map>
<key>RenderHDREnabled</key>
<map>
<key>Comment</key>
<string>Enable HDR rendering.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FSNetMapPhantomOpacity</key>
<map>

View File

@ -36,6 +36,7 @@ in vec2 vary_texcoord0;
in vec3 vary_position;
void mirrorClip(vec3 pos);
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
void main()
{
@ -51,7 +52,7 @@ void main()
frag_data[0] = vec4(diff.rgb, 0.0);
frag_data[1] = vec4(0,0,0,0);
vec3 nvn = normalize(vary_normal);
frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
frag_data[2] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
frag_data[3] = vec4(0);
}

View File

@ -40,6 +40,8 @@ in vec2 vary_texcoord0;
in vec3 vary_position;
void mirrorClip(vec3 pos);
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
void main()
{
mirrorClip(vary_position);
@ -62,6 +64,6 @@ void main()
frag_data[1] = vertex_color.aaaa; // spec
//frag_data[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested
vec3 nvn = normalize(tnorm);
frag_data[2] = vec4(nvn, GBUFFER_FLAG_HAS_ATMOS);
frag_data[2] = encodeNormal(nvn, GBUFFER_FLAG_HAS_ATMOS);
frag_data[3] = vec4(vertex_color.a, 0, 0, 0);
}

View File

@ -75,6 +75,9 @@ const float ONE_OVER_PI = 0.3183098861;
vec3 srgb_to_linear(vec3 cs);
vec3 atmosFragLightingLinear(vec3 light, vec3 additive, vec3 atten);
vec4 decodeNormal(vec4 norm);
float calcLegacyDistanceAttenuation(float distance, float falloff)
{
float dist_atten = 1.0 - clamp((distance + falloff)/(1.0 + falloff), 0.0, 1.0);
@ -145,8 +148,7 @@ vec2 getScreenCoordinate(vec2 screenpos)
vec4 getNorm(vec2 screenpos)
{
vec4 norm = texture(normalMap, screenpos.xy);
norm.xyz = normalize(norm.xyz);
vec4 norm = decodeNormal(texture(normalMap, screenpos.xy));
return norm;
}

View File

@ -39,6 +39,8 @@ in vec2 vary_texcoord0;
void mirrorClip(vec3 pos);
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
void main()
{
mirrorClip(vary_position);
@ -53,7 +55,7 @@ void main()
frag_data[0] = vec4(col.rgb, 0.0);
frag_data[1] = vec4(0,0,0,0); // spec
vec3 nvn = normalize(vary_normal);
frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
frag_data[2] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
frag_data[3] = vec4(0);
}

View File

@ -36,6 +36,7 @@ in vec4 vertex_color;
in vec2 vary_texcoord0;
void mirrorClip(vec3 pos);
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
void main()
{
@ -51,6 +52,6 @@ void main()
frag_data[0] = vec4(col.rgb, 0.0);
frag_data[1] = vec4(0,0,0,0);
vec3 nvn = normalize(vary_normal);
frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
frag_data[2] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
frag_data[3] = vec4(0);
}

View File

@ -33,6 +33,7 @@ uniform sampler2D diffuseMap;
in vec3 vary_normal;
in vec2 vary_texcoord0;
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
void main()
{
@ -46,7 +47,7 @@ void main()
frag_data[0] = vec4(col.rgb, 0.0);
frag_data[1] = vec4(0,0,0,0); // spec
vec3 nvn = normalize(vary_normal);
frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
frag_data[2] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
frag_data[3] = vec4(0);
}

View File

@ -35,6 +35,7 @@ in vec2 vary_texcoord0;
in vec3 vary_position;
void mirrorClip(vec3 pos);
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
void main()
{
@ -42,9 +43,8 @@ void main()
vec3 col = vertex_color.rgb * texture(diffuseMap, vary_texcoord0.xy).rgb;
frag_data[0] = vec4(col, 0.0);
frag_data[1] = vertex_color.aaaa; // spec
//frag_data[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested
vec3 nvn = normalize(vary_normal);
frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
frag_data[2] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
frag_data[3] = vec4(vertex_color.a, 0, 0, 0);
}

View File

@ -33,6 +33,8 @@ in vec2 vary_texcoord0;
in vec3 vary_position;
void mirrorClip(vec3 pos);
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
vec3 linear_to_srgb(vec3 c);
void main()
@ -46,6 +48,6 @@ void main()
frag_data[0] = vec4(col, 0.0);
frag_data[1] = vec4(spec, vertex_color.a); // spec
vec3 nvn = normalize(vary_normal);
frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
frag_data[2] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
frag_data[3] = vec4(vertex_color.a, 0, 0, 0);
}

View File

@ -43,3 +43,15 @@ void mirrorClip(vec3 pos)
}
}
vec4 encodeNormal(vec3 norm, float gbuffer_flag)
{
return vec4(norm * 0.5 + 0.5, gbuffer_flag);
}
vec4 decodeNormal(vec4 norm)
{
norm.xyz = norm.xyz * 2.0 - 1.0;
return norm;
}

View File

@ -38,6 +38,8 @@ in vec2 vary_texcoord0;
vec3 linear_to_srgb(vec3 c);
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
void main()
{
vec4 col = texture(diffuseMap, vary_texcoord0.xy);

View File

@ -61,6 +61,7 @@ uniform vec4 clipPlane;
uniform float clipSign;
void mirrorClip(vec3 pos);
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
uniform mat3 normal_matrix;
@ -113,7 +114,7 @@ void main()
// See: C++: addDeferredAttachments(), GLSL: softenLightF
frag_data[0] = max(vec4(col, 0.0), vec4(0)); // Diffuse
frag_data[1] = max(vec4(spec.rgb,0.0), vec4(0)); // PBR linear packed Occlusion, Roughness, Metal.
frag_data[2] = vec4(tnorm, GBUFFER_FLAG_HAS_PBR); // normal, environment intensity, flags
frag_data[2] = encodeNormal(tnorm, GBUFFER_FLAG_HAS_PBR); // normal, environment intensity, flags
frag_data[3] = max(vec4(emissive,0), vec4(0)); // PBR sRGB Emissive
}

View File

@ -162,6 +162,7 @@ in vec4[2] vary_coords;
#endif
void mirrorClip(vec3 position);
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
float terrain_mix(TerrainMix tm, vec4 tms4);
@ -429,7 +430,7 @@ void main()
#endif
frag_data[0] = max(vec4(pbr_mix.col.xyz, 0.0), vec4(0)); // Diffuse
frag_data[1] = max(vec4(mix_orm.rgb, base_color_factor_alpha), vec4(0)); // PBR linear packed Occlusion, Roughness, Metal.
frag_data[2] = vec4(tnorm, GBUFFER_FLAG_HAS_PBR); // normal, flags
frag_data[2] = encodeNormal(tnorm, GBUFFER_FLAG_HAS_PBR); // normal, flags
frag_data[3] = max(vec4(mix_emissive,0), vec4(0)); // PBR sRGB Emissive
}

View File

@ -39,6 +39,7 @@ in vec4 vary_texcoord0;
in vec4 vary_texcoord1;
void mirrorClip(vec3 position);
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
void main()
{
@ -60,7 +61,7 @@ void main()
frag_data[0] = max(outColor, vec4(0));
frag_data[1] = vec4(0.0,0.0,0.0,-1.0);
vec3 nvn = normalize(vary_normal);
frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
frag_data[2] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
frag_data[3] = vec4(0);
}

View File

@ -37,6 +37,8 @@ in vec3 vary_position;
uniform float minimum_alpha;
void mirrorClip(vec3 pos);
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
void main()
{
mirrorClip(vary_position);
@ -49,6 +51,6 @@ void main()
frag_data[0] = vec4(vertex_color.rgb*col.rgb, 0.0);
frag_data[1] = vec4(0,0,0,0);
vec3 nvn = normalize(vary_normal);
frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
frag_data[2] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
frag_data[3] = vec4(0);
}

View File

@ -64,6 +64,8 @@ in vec2 base_color_uv;
in vec2 emissive_uv;
void mirrorClip(vec3 pos);
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
vec3 linear_to_srgb(vec3 c);
vec3 srgb_to_linear(vec3 c);
// ==================================
@ -241,7 +243,7 @@ void main()
#else
frag_data[0] = max(vec4(basecolor.rgb, 0.0), vec4(0));
frag_data[1] = max(vec4(orm.rgb,0.0), vec4(0));
frag_data[2] = vec4(norm, GBUFFER_FLAG_HAS_PBR);
frag_data[2] = encodeNormal(norm, GBUFFER_FLAG_HAS_PBR);
frag_data[3] = max(vec4(emissive,0), vec4(0));
#endif
#endif

View File

@ -51,6 +51,7 @@ uniform mat3 normal_matrix;
in vec3 vary_position;
void mirrorClip(vec3 pos);
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
@ -414,7 +415,7 @@ void main()
frag_data[0] = max(vec4(diffcol.rgb, emissive), vec4(0)); // gbuffer is sRGB for legacy materials
frag_data[1] = max(vec4(spec.rgb, glossiness), vec4(0)); // XYZ = Specular color. W = Specular exponent.
frag_data[2] = vec4(norm, flag); // XY = Normal. Z = Env. intensity. W = 1 skip atmos (mask off fog)
frag_data[2] = encodeNormal(norm, flag); // XY = Normal. Z = Env. intensity. W = 1 skip atmos (mask off fog)
frag_data[3] = vec4(env, 0, 0, 0);
#endif

View File

@ -27,6 +27,8 @@
out vec4 frag_color;
vec4 decodeNormal(vec4 norm);
uniform sampler2D diffuseRect;
uniform sampler2D specularRect;
uniform sampler2D emissiveRect; // PBR linear packed Occlusion, Roughness, Metal. See: pbropaqueF.glsl

View File

@ -79,7 +79,7 @@ RenderHeroProbeResolution 1 2048
RenderHeroProbeDistance 1 16
RenderHeroProbeUpdateRate 1 6
RenderHeroProbeConservativeUpdateMultiplier 1 16
RenderDownScaleMethod 1 1
RenderDownScaleMethod 1 0
RenderCASSharpness 1 1
RenderExposure 1 4
RenderTonemapType 1 1

View File

@ -79,7 +79,7 @@ RenderHeroProbeResolution 1 2048
RenderHeroProbeDistance 1 16
RenderHeroProbeUpdateRate 1 6
RenderHeroProbeConservativeUpdateMultiplier 1 16
RenderDownScaleMethod 1 1
RenderDownScaleMethod 1 0
RenderCASSharpness 1 1
RenderExposure 1 4
RenderTonemapType 1 1

View File

@ -1,4 +1,4 @@
version 62
version 63
// The version number above should be incremented IF AND ONLY IF some
// change has been made that is sufficiently important to justify
// resetting the graphics preferences of all users to the recommended
@ -68,8 +68,8 @@ RenderFSAASamples 1 3
RenderMaxTextureIndex 1 16
RenderGLContextCoreProfile 1 1
RenderGLMultiThreadedTextures 1 0
RenderGLMultiThreadedMedia 1 1
RenderAppleUseMultGL 1 1
RenderGLMultiThreadedMedia 1 0
RenderAppleUseMultGL 1 0
RenderReflectionsEnabled 1 1
RenderReflectionProbeDetail 1 2
RenderScreenSpaceReflections 1 1
@ -408,8 +408,8 @@ RenderFSAASamples 1 0
// AppleGPU and NonAppleGPU can be thought of as Apple silicon vs Intel Mac
list AppleGPU
RenderGLMultiThreadedMedia 1 1
RenderAppleUseMultGL 1 1
RenderGLMultiThreadedMedia 1 0
RenderAppleUseMultGL 1 0
list NonAppleGPU
RenderGLMultiThreadedMedia 1 0

View File

@ -463,6 +463,11 @@ void LLReflectionMapManager::update()
LLReflectionMap* LLReflectionMapManager::addProbe(LLSpatialGroup* group)
{
if (gGLManager.mGLVersion < 4.05f)
{
return nullptr;
}
LLReflectionMap* probe = new LLReflectionMap();
probe->mGroup = group;

View File

@ -1388,12 +1388,15 @@ void LLViewerRegion::updateReflectionProbes(bool full_update)
mReflectionMaps[idx] = gPipeline.mReflectionMapManager.addProbe();
}
LLVector3 probe_origin = LLVector3(x, y, llmax(water_height, mImpl->mLandp->resolveHeightRegion(x, y)));
probe_origin.mV[2] += hover_height;
probe_origin += origin;
if (mReflectionMaps[idx])
{
LLVector3 probe_origin = LLVector3(x, y, llmax(water_height, mImpl->mLandp->resolveHeightRegion(x, y)));
probe_origin.mV[2] += hover_height;
probe_origin += origin;
mReflectionMaps[idx]->mOrigin.load3(probe_origin.mV);
mReflectionMaps[idx]->mRadius = probe_radius;
mReflectionMaps[idx]->mOrigin.load3(probe_origin.mV);
mReflectionMaps[idx]->mRadius = probe_radius;
}
}
}
}

View File

@ -2513,7 +2513,7 @@ bool LLViewerShaderMgr::loadShadersDeferred()
}
}
if (success)
if (success && gGLManager.mGLVersion > 4.05f)
{
gCASProgram.mName = "Contrast Adaptive Sharpening Shader";
gCASProgram.mFeatures.hasSrgb = true;

View File

@ -564,7 +564,9 @@ void LLViewerTexture::updateClass()
if (sEvaluationTimer.getElapsedTimeF32() > MEMORY_CHECK_WAIT_TIME)
{
static LLCachedControl<F32> low_mem_min_discard_increment(gSavedSettings, "RenderLowMemMinDiscardIncrement", .1f);
sDesiredDiscardBias += (F32) low_mem_min_discard_increment * (F32) gFrameIntervalSeconds;
F32 increment = low_mem_min_discard_increment + llmax(over_pct, 0.f);
sDesiredDiscardBias += increment * gFrameIntervalSeconds;
}
}
else
@ -625,7 +627,7 @@ void LLViewerTexture::updateClass()
last_desired_discard_bias = sDesiredDiscardBias;
was_backgrounded = true;
}
sDesiredDiscardBias = 4.f;
sDesiredDiscardBias = 5.f;
}
}
else
@ -639,7 +641,7 @@ void LLViewerTexture::updateClass()
}
}
sDesiredDiscardBias = llclamp(sDesiredDiscardBias, 1.f, 4.f);
sDesiredDiscardBias = llclamp(sDesiredDiscardBias, 1.f, 5.f);
LLViewerTexture::sFreezeImageUpdates = false;
}

View File

@ -439,6 +439,8 @@ public:
/*virtual*/bool isActiveFetching() override; //is actively in fetching by the fetching pipeline.
virtual bool scaleDown() { return false; };
bool mCreatePending = false; // if true, this is in gTextureList.mCreateTextureList
mutable bool mDownScalePending = false; // if true, this is in gTextureList.mDownScaleQueue
@ -565,12 +567,12 @@ public:
LLViewerLODTexture(const LLUUID& id, FTType f_type, const LLHost& host = LLHost(), bool usemipmaps = true);
LLViewerLODTexture(const std::string& url, FTType f_type, const LLUUID& id, bool usemipmaps = true);
/*virtual*/ S8 getType() const;
S8 getType() const override;
// Process image stats to determine priority/quality requirements.
/*virtual*/ void processTextureStats();
void processTextureStats() override;
bool isUpdateFrozen() ;
bool scaleDown();
bool scaleDown() override;
private:
void init(bool firstinit) ;

View File

@ -1065,8 +1065,32 @@ F32 LLViewerTextureList::updateImagesCreateTextures(F32 max_time)
LLTimer create_timer;
while (!mCreateTextureList.empty())
{
LLViewerFetchedTexture* imagep = mCreateTextureList.front();
llassert(imagep->mCreatePending);
imagep->createTexture();
imagep->postCreateTexture();
imagep->mCreatePending = false;
mCreateTextureList.pop();
if (imagep->getDiscardLevel() < imagep->getDesiredDiscardLevel())
{
LL_WARNS_ONCE("Texture") << "Texture will be downscaled immediately after loading." << LL_ENDL;
imagep->scaleDown();
}
if (create_timer.getElapsedTimeF32() > max_time)
{
break;
}
}
if (!mDownScaleQueue.empty() && gPipeline.mDownResMap.isComplete())
{
LLGLDisable blend(GL_BLEND);
gGL.setColorMask(true, true);
// just in case we downres textures, bind downresmap and copy program
gPipeline.mDownResMap.bindTarget();
gCopyProgram.bind();
@ -1080,6 +1104,7 @@ F32 LLViewerTextureList::updateImagesCreateTextures(F32 max_time)
// freeze.
S32 min_count = (S32)mCreateTextureList.size() / 20 + 5;
create_timer.reset();
while (!mDownScaleQueue.empty())
{
LLViewerFetchedTexture* image = mDownScaleQueue.front();
@ -1104,25 +1129,6 @@ F32 LLViewerTextureList::updateImagesCreateTextures(F32 max_time)
gPipeline.mDownResMap.flush();
}
// do at least 5 and make sure we don't get too far behind even if it violates
// the time limit. Textures pending creation have a copy of their texture data
// in system memory, so we don't want to let them pile up.
S32 min_count = (S32) mCreateTextureList.size() / 20 + 5;
while (!mCreateTextureList.empty())
{
LLViewerFetchedTexture *imagep = mCreateTextureList.front();
llassert(imagep->mCreatePending);
imagep->createTexture();
imagep->postCreateTexture();
imagep->mCreatePending = false;
mCreateTextureList.pop();
if (create_timer.getElapsedTimeF32() > max_time && --min_count <= 0)
{
break;
}
}
return create_timer.getElapsedTimeF32();
}

View File

@ -6200,7 +6200,23 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
{
if (gltf_mat != nullptr)
{
add_face(sPbrFaces, pbr_count, facep);
// In theory, we should never actually get here with alpha blending.
// How this is supposed to work is we check if the surface is alpha blended, and we assign it to the
// alpha draw pool. For rigged meshes, this apparently may not happen consistently. For now, just
// discard it here if the alpha is 0 (fully transparent) to achieve parity with blinn-phong materials in
// function.
bool should_render = true;
if (gltf_mat->mAlphaMode == LLGLTFMaterial::ALPHA_MODE_BLEND)
{
if (gltf_mat->mBaseColor.mV[3] == 0.0f)
{
should_render = false;
}
}
if (should_render)
{
add_face(sPbrFaces, pbr_count, facep);
}
}
else
{

View File

@ -367,10 +367,22 @@ void validate_framebuffer_object();
// target -- RenderTarget to add attachments to
bool addDeferredAttachments(LLRenderTarget& target, bool for_impostor = false)
{
U32 orm = GL_RGBA;
U32 norm = GL_RGBA16F;
U32 emissive = GL_RGB16F;
bool hdr = gSavedSettings.getBOOL("RenderHDREnabled") && gGLManager.mGLVersion > 4.05f;
if (!hdr)
{
norm = GL_RGBA;
emissive = GL_RGB;
}
bool valid = true
&& target.addColorAttachment(GL_RGBA) // frag-data[1] specular OR PBR ORM
&& target.addColorAttachment(GL_RGBA16F) // frag_data[2] normal+fogmask, See: class1\deferred\materialF.glsl & softenlight
&& target.addColorAttachment(GL_RGB16F); // frag_data[3] PBR emissive OR material env intensity
&& target.addColorAttachment(orm) // frag-data[1] specular OR PBR ORM
&& target.addColorAttachment(norm) // frag_data[2] normal+fogmask, See: class1\deferred\materialF.glsl & softenlight
&& target.addColorAttachment(emissive); // frag_data[3] PBR emissive OR material env intensity
return valid;
}
@ -851,6 +863,9 @@ LLPipeline::eFBOStatus LLPipeline::doAllocateScreenBuffer(U32 resX, U32 resY)
bool LLPipeline::allocateScreenBufferInternal(U32 resX, U32 resY)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY;
bool hdr = gGLManager.mGLVersion > 4.05f && gSavedSettings.getBOOL("RenderHDREnabled");
if (mRT == &mMainRT)
{ // hacky -- allocate auxillary buffer
@ -915,7 +930,7 @@ bool LLPipeline::allocateScreenBufferInternal(U32 resX, U32 resY)
if (!mRT->deferredScreen.allocate(resX, resY, GL_RGBA, true)) return false;
if (!addDeferredAttachments(mRT->deferredScreen)) return false;
GLuint screenFormat = GL_RGBA16F;
GLuint screenFormat = hdr ? GL_RGBA16F : GL_RGBA;
if (!mRT->screen.allocate(resX, resY, screenFormat)) return false;
@ -926,7 +941,7 @@ bool LLPipeline::allocateScreenBufferInternal(U32 resX, U32 resY)
if (shadow_detail > 0 || ssao || RenderDepthOfField || RlvActions::hasPostProcess())
// </FS:Beq>
{ //only need mRT->deferredLight for shadows OR ssao OR dof OR fxaa
if (!mRT->deferredLight.allocate(resX, resY, GL_RGBA16F)) return false;
if (!mRT->deferredLight.allocate(resX, resY, screenFormat)) return false;
}
else
{
@ -960,22 +975,22 @@ bool LLPipeline::allocateScreenBufferInternal(U32 resX, U32 resY)
}
//water reflection texture (always needed as scratch space whether or not transparent water is enabled)
mWaterDis.allocate(resX, resY, GL_RGBA16F, true);
mWaterDis.allocate(resX, resY, screenFormat, true);
if(RenderScreenSpaceReflections)
{
mSceneMap.allocate(resX, resY, GL_RGBA16F, true);
mSceneMap.allocate(resX, resY, screenFormat, true);
}
else
{
mSceneMap.release();
}
mPostMap.allocate(resX, resY, GL_RGBA16F);
mPostMap.allocate(resX, resY, screenFormat);
// used to scale down textures
// See LLViwerTextureList::updateImagesCreateTextures and LLImageGL::scaleDown
mDownResMap.allocate(4, 4, GL_RGBA);
mDownResMap.allocate(1024, 1024, GL_RGBA);
mBakeMap.allocate(LLAvatarAppearanceDefines::SCRATCH_TEX_WIDTH, LLAvatarAppearanceDefines::SCRATCH_TEX_HEIGHT, GL_RGBA);
}
@ -4215,6 +4230,13 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
LLGLState::checkStates(GL_FALSE);
}
// turn off atmospherics and water haze for low detail reflection probe
static LLCachedControl<S32> probe_level(gSavedSettings, "RenderReflectionProbeLevel", 0);
bool low_detail_probe = probe_level == 0 && gCubeSnapshot;
done_atmospherics = done_atmospherics || low_detail_probe;
done_water_haze = done_water_haze || low_detail_probe;
while ( iter1 != mPools.end() )
{
LLDrawPool *poolp = *iter1;
@ -8054,15 +8076,20 @@ void LLPipeline::renderFinalize()
gGL.setColorMask(true, true);
glClearColor(0, 0, 0, 0);
copyScreenSpaceReflections(&mRT->screen, &mSceneMap);
bool hdr = gGLManager.mGLVersion > 4.05f && gSavedSettings.getBOOL("RenderHDREnabled");
generateLuminance(&mRT->screen, &mLuminanceMap);
if (hdr)
{
copyScreenSpaceReflections(&mRT->screen, &mSceneMap);
generateExposure(&mLuminanceMap, &mExposureMap);
generateLuminance(&mRT->screen, &mLuminanceMap);
tonemap(&mRT->screen, &mPostMap);
generateExposure(&mLuminanceMap, &mExposureMap);
applyCAS(&mPostMap, &mRT->screen);
tonemap(&mRT->screen, &mPostMap);
applyCAS(&mPostMap, &mRT->screen);
}
generateSMAABuffers(&mRT->screen);
@ -8680,8 +8707,9 @@ void LLPipeline::renderDeferredLighting()
}
static LLCachedControl<S32> local_light_count(gSavedSettings, "RenderLocalLightCount", 256);
static LLCachedControl<S32> probe_level(gSavedSettings, "RenderReflectionProbeLevel", 0);
if (local_light_count > 0)
if (local_light_count > 0 && (!gCubeSnapshot || probe_level > 0))
{
gGL.setSceneBlendType(LLRender::BT_ADD);
std::list<LLVector4> fullscreen_lights;