Skip to content

Commit 0f281c7

Browse files
committed
Merge remote-tracking branch 'origin/release/2024.09-ExtraFPS' into develop
# Conflicts: # indra/newview/featuretable.txt # indra/newview/llfloaterimsessiontab.h # indra/newview/pipeline.cpp
2 parents 0f33d75 + 2b25553 commit 0f281c7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+346
-174
lines changed

indra/llcommon/llprocessor.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,8 @@ class LLProcessorInfoDarwinImpl : public LLProcessorInfoImpl
692692
memset(cpu_vendor, 0, len);
693693
sysctlbyname("machdep.cpu.vendor", (void*)cpu_vendor, &len, NULL, 0);
694694
cpu_vendor[0x1f] = 0;
695-
setInfo(eVendor, cpu_vendor);
695+
// M series CPUs don't provide this field so if empty, just fall back to Apple.
696+
setInfo(eVendor, (cpu_vendor[0] != '\0') ? cpu_vendor : "Apple");
696697

697698
setInfo(eStepping, getSysctlInt("machdep.cpu.stepping"));
698699
setInfo(eModel, getSysctlInt("machdep.cpu.model"));

indra/llcommon/llsdjson.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,16 @@ LLSD LlsdFromJson(const boost::json::value& val)
6363
case boost::json::kind::array:
6464
{
6565
result = LLSD::emptyArray();
66-
auto& array = val.as_array();
66+
const boost::json::array& array = val.as_array();
67+
size_t size = array.size();
6768
// allocate elements 0 .. (size() - 1) to avoid incremental allocation
6869
if (! array.empty())
6970
{
70-
result[array.size() - 1] = LLSD();
71+
result[size - 1] = LLSD();
7172
}
72-
for (const auto &element : array)
73+
for (size_t i = 0; i < size; i++)
7374
{
74-
result.append(LlsdFromJson(element));
75+
result[i] = (LlsdFromJson(array[i]));
7576
}
7677
break;
7778
}

indra/llinventory/llsettingswater.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ void LLSettingsWater::loadValuesFromLLSD()
133133
mWave1Dir = LLVector2(settings[SETTING_WAVE1_DIR]);
134134
mWave2Dir = LLVector2(settings[SETTING_WAVE2_DIR]);
135135

136-
mNormalMapID = getNormalMapID();
137-
mTransparentTextureID = getTransparentTextureID();
136+
mNormalMapID = settings[SETTING_NORMAL_MAP].asUUID();
137+
mTransparentTextureID = settings[SETTING_TRANSPARENT_TEXTURE].asUUID();
138138
}
139139

140140
void LLSettingsWater::saveValuesToLLSD()

indra/llrender/llimagegl.cpp

Lines changed: 27 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2179,15 +2179,15 @@ void LLImageGL::analyzeAlpha(const void* data_in, U32 w, U32 h)
21792179
// this will mid-skew the data (and thus increase the chances of not
21802180
// being used as a mask) from high-frequency alpha maps which
21812181
// suffer the worst from aliasing when used as alpha masks.
2182-
if (w >= 4 && h >= 4)
2182+
if (w >= 2 && h >= 2)
21832183
{
2184-
llassert(w%4 == 0);
2185-
llassert(h%4 == 0);
2184+
llassert(w % 2 == 0);
2185+
llassert(h % 2 == 0);
21862186
const GLubyte* rowstart = ((const GLubyte*) data_in) + mAlphaOffset;
2187-
for (U32 y = 0; y < h; y+=4)
2187+
for (U32 y = 0; y < h; y += 2)
21882188
{
21892189
const GLubyte* current = rowstart;
2190-
for (U32 x = 0; x < w; x+=4)
2190+
for (U32 x = 0; x < w; x += 2)
21912191
{
21922192
const U32 s1 = current[0];
21932193
alphatotal += s1;
@@ -2210,8 +2210,7 @@ void LLImageGL::analyzeAlpha(const void* data_in, U32 w, U32 h)
22102210
sample[asum/(16*4)] += 4;
22112211
}
22122212

2213-
2214-
rowstart += 4 * w * mAlphaStride;
2213+
rowstart += 2 * w * mAlphaStride;
22152214
}
22162215
length *= 2; // we sampled everything twice, essentially
22172216
}
@@ -2453,41 +2452,32 @@ bool LLImageGL::scaleDown(S32 desired_discard)
24532452

24542453
if (gGLManager.mDownScaleMethod == 0)
24552454
{ // use an FBO to downscale the texture
2456-
// allocate new texture
2457-
U32 temp_texname = 0;
2458-
generateTextures(1, &temp_texname);
2459-
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, temp_texname, true);
2460-
{
2461-
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("scaleDown - glTexImage2D");
2462-
glTexImage2D(mTarget, 0, mFormatInternal, desired_width, desired_height, 0, mFormatPrimary, mFormatType, NULL);
2463-
}
2464-
2465-
// account for new texture getting created
2466-
alloc_tex_image(desired_width, desired_height, mFormatInternal, 1);
2467-
2468-
// Use render-to-texture to scale down the texture
2469-
{
2470-
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("scaleDown - glFramebufferTexture2D");
2471-
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, mTarget, temp_texname, 0);
2472-
}
2473-
24742455
glViewport(0, 0, desired_width, desired_height);
24752456

24762457
// draw a full screen triangle
2477-
gGL.getTexUnit(0)->bind(this);
2478-
glDrawArrays(GL_TRIANGLES, 0, 3);
2479-
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
2458+
if (gGL.getTexUnit(0)->bind(this, true, true))
2459+
{
2460+
glDrawArrays(GL_TRIANGLES, 0, 3);
24802461

2481-
// delete old texture and assign new texture name
2482-
deleteTextures(1, &mTexName);
2483-
mTexName = temp_texname;
2462+
free_tex_image(mTexName);
2463+
glTexImage2D(mTarget, 0, mFormatInternal, desired_width, desired_height, 0, mFormatPrimary, mFormatType, nullptr);
2464+
glCopyTexSubImage2D(mTarget, 0, 0, 0, 0, 0, desired_width, desired_height);
2465+
alloc_tex_image(desired_width, desired_height, mFormatInternal, 1);
24842466

2485-
if (mHasMipMaps)
2486-
{ // generate mipmaps if needed
2487-
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("scaleDown - glGenerateMipmap");
2488-
gGL.getTexUnit(0)->bind(this);
2489-
glGenerateMipmap(mTarget);
2490-
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
2467+
mTexOptionsDirty = true;
2468+
2469+
if (mHasMipMaps)
2470+
{ // generate mipmaps if needed
2471+
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("scaleDown - glGenerateMipmap");
2472+
gGL.getTexUnit(0)->bind(this);
2473+
glGenerateMipmap(mTarget);
2474+
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
2475+
}
2476+
}
2477+
else
2478+
{
2479+
LL_WARNS_ONCE("LLImageGL") << "Failed to bind texture for downscaling." << LL_ENDL;
2480+
return false;
24912481
}
24922482
}
24932483
else

indra/llrender/llvertexbuffer.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,11 +272,13 @@ static GLuint gen_buffer()
272272
{
273273
LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("gen buffer");
274274
sIndex = pool_size;
275+
#if !LL_DARWIN
275276
if (!gGLManager.mIsAMD)
276277
{
277278
glGenBuffers(pool_size, sNamePool);
278279
}
279280
else
281+
#endif
280282
{ // work around for AMD driver bug
281283
for (U32 i = 0; i < pool_size; ++i)
282284
{
@@ -942,6 +944,10 @@ void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const
942944
void LLVertexBuffer::initClass(LLWindow* window)
943945
{
944946
llassert(sVBOPool == nullptr);
947+
948+
LL_INFOS() << "VBO Pooling Disabled" << LL_ENDL;
949+
sVBOPool = new LLAppleVBOPool();
950+
945951
if (gGLManager.mIsApple)
946952
{
947953
LL_INFOS() << "VBO Pooling Disabled" << LL_ENDL;

indra/newview/app_settings/settings.xml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8040,7 +8040,7 @@
80408040
<key>Type</key>
80418041
<string>U32</string>
80428042
<key>Value</key>
8043-
<integer>1</integer>
8043+
<integer>0</integer>
80448044
</map>
80458045
<key>RenderDebugTextureBind</key>
80468046
<map>
@@ -16352,5 +16352,16 @@
1635216352
<key>Value</key>
1635316353
<integer>0</integer>
1635416354
</map>
16355+
<key>RenderHDREnabled</key>
16356+
<map>
16357+
<key>Comment</key>
16358+
<string>Enable HDR rendering.</string>
16359+
<key>Persist</key>
16360+
<integer>1</integer>
16361+
<key>Type</key>
16362+
<string>Boolean</string>
16363+
<key>Value</key>
16364+
<integer>1</integer>
16365+
</map>
1635516366
</map>
1635616367
</llsd>

indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ in vec2 vary_texcoord0;
3636
in vec3 vary_position;
3737

3838
void mirrorClip(vec3 pos);
39+
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
3940

4041
void main()
4142
{
@@ -51,7 +52,7 @@ void main()
5152
frag_data[0] = vec4(diff.rgb, 0.0);
5253
frag_data[1] = vec4(0,0,0,0);
5354
vec3 nvn = normalize(vary_normal);
54-
frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
55+
frag_data[2] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
5556
frag_data[3] = vec4(0);
5657
}
5758

indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ in vec2 vary_texcoord0;
4040
in vec3 vary_position;
4141

4242
void mirrorClip(vec3 pos);
43+
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
44+
4345
void main()
4446
{
4547
mirrorClip(vary_position);
@@ -62,6 +64,6 @@ void main()
6264
frag_data[1] = vertex_color.aaaa; // spec
6365
//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
6466
vec3 nvn = normalize(tnorm);
65-
frag_data[2] = vec4(nvn, GBUFFER_FLAG_HAS_ATMOS);
67+
frag_data[2] = encodeNormal(nvn, GBUFFER_FLAG_HAS_ATMOS);
6668
frag_data[3] = vec4(vertex_color.a, 0, 0, 0);
6769
}

indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ const float ONE_OVER_PI = 0.3183098861;
7575
vec3 srgb_to_linear(vec3 cs);
7676
vec3 atmosFragLightingLinear(vec3 light, vec3 additive, vec3 atten);
7777

78+
vec4 decodeNormal(vec4 norm);
79+
80+
7881
float calcLegacyDistanceAttenuation(float distance, float falloff)
7982
{
8083
float dist_atten = 1.0 - clamp((distance + falloff)/(1.0 + falloff), 0.0, 1.0);
@@ -145,8 +148,7 @@ vec2 getScreenCoordinate(vec2 screenpos)
145148

146149
vec4 getNorm(vec2 screenpos)
147150
{
148-
vec4 norm = texture(normalMap, screenpos.xy);
149-
norm.xyz = normalize(norm.xyz);
151+
vec4 norm = decodeNormal(texture(normalMap, screenpos.xy));
150152
return norm;
151153
}
152154

indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ in vec2 vary_texcoord0;
3939

4040
void mirrorClip(vec3 pos);
4141

42+
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
43+
4244
void main()
4345
{
4446
mirrorClip(vary_position);
@@ -53,7 +55,7 @@ void main()
5355
frag_data[0] = vec4(col.rgb, 0.0);
5456
frag_data[1] = vec4(0,0,0,0); // spec
5557
vec3 nvn = normalize(vary_normal);
56-
frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
58+
frag_data[2] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
5759
frag_data[3] = vec4(0);
5860
}
5961

0 commit comments

Comments
 (0)