Skip to content

Commit c420f04

Browse files
authored
Merge pull request #3206 from secondlife/brad/extra-develop-merge
extraFPS -> develop merge
2 parents f42391b + 89b5b1f commit c420f04

19 files changed

+114
-57
lines changed

indra/llrender/llgl.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,6 +1258,7 @@ bool LLGLManager::initGL()
12581258
glGetIntegerv(GL_MAX_INTEGER_SAMPLES, &mMaxIntegerSamples);
12591259
glGetIntegerv(GL_MAX_SAMPLE_MASK_WORDS, &mMaxSampleMaskWords);
12601260
glGetIntegerv(GL_MAX_SAMPLES, &mMaxSamples);
1261+
glGetIntegerv(GL_MAX_VARYING_VECTORS, &mMaxVaryingVectors);
12611262
glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, &mMaxUniformBlockSize);
12621263

12631264
// sanity clamp max uniform block size to 64k just in case

indra/llrender/llgl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ class LLGLManager
8989
S32 mGLMaxTextureSize;
9090
F32 mMaxAnisotropy = 0.f;
9191
S32 mMaxUniformBlockSize = 0;
92+
S32 mMaxVaryingVectors = 0;
9293

9394
// GL 4.x capabilities
9495
bool mHasCubeMapArray = false;

indra/newview/app_settings/settings.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16385,16 +16385,16 @@
1638516385
<key>Value</key>
1638616386
<integer>1</integer>
1638716387
</map>
16388-
<key>RenderVintageMode</key>
16388+
<key>RenderDisableVintageMode</key>
1638916389
<map>
1639016390
<key>Comment</key>
16391-
<string>Disable different rendering pipeline features to improve performance on older machines that makes the world look closer to how it used to prior to V7.</string>
16391+
<string>Enables additional rendering pipeline features on newer machines such as HDR and emissive textures on PBR content.</string>
1639216392
<key>Persist</key>
1639316393
<integer>1</integer>
1639416394
<key>Type</key>
1639516395
<string>Boolean</string>
1639616396
<key>Value</key>
16397-
<integer>0</integer>
16397+
<integer>1</integer>
1639816398
</map>
1639916399
</map>
1640016400
</llsd>

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -544,8 +544,10 @@ vec3 pbrCalcPointLightOrSpotLight(vec3 diffuseColor, vec3 specularColor,
544544
pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, lv, nl, diffPunc, specPunc);
545545
color = intensity * clamp(nl * (diffPunc + specPunc), vec3(0), vec3(10));
546546
}
547-
548-
return color;
547+
float final_scale = 1.0;
548+
if (classic_mode > 0)
549+
final_scale = 0.9;
550+
return color * final_scale;
549551
}
550552

551553
void calcDiffuseSpecular(vec3 baseColor, float metallic, inout vec3 diffuseColor, inout vec3 specularColor)
@@ -576,22 +578,25 @@ vec3 pbrBaseLight(vec3 diffuseColor, vec3 specularColor, float metallic, vec3 v,
576578
// Depending on the sky, we combine these differently.
577579
if (classic_mode > 0)
578580
{
581+
irradiance.rgb = srgb_to_linear(irradiance * 0.9); // BINGO
582+
579583
// Reconstruct the diffuse lighting that we do for blinn-phong materials here.
580584
// A special note about why we do some really janky stuff for classic mode.
581585
// Since adding classic mode, we've moved the lambertian diffuse multiply out from pbrPunctual and instead handle it in the different light type calcs.
582-
// For classic mode, this baiscally introduces a double multiplication that we need to somehow avoid
583-
// Using one of the old mobile gamma correction tricks (val * val to "linearize", sqrt(val) to bring back into sRGB), we can _mostly_ avert this
584586
// This will never be 100% correct, but at the very least we can make it look mostly correct with legacy skies and classic mode.
585587

586-
float da = pow(sqrt(nl), 1.2);
588+
float da = pow(nl, 1.2);
587589

588590
vec3 sun_contrib = vec3(min(da, scol));
589591

590592
// Multiply by PI to account for lambertian diffuse colors. Otherwise things will be too dark when lit by the sun on legacy skies.
591-
sun_contrib = srgb_to_linear(color.rgb * 0.9 + linear_to_srgb(sun_contrib) * sunlit * 0.7) * M_PI;
593+
sun_contrib = srgb_to_linear(linear_to_srgb(sun_contrib) * sunlit * 0.7) * M_PI;
592594

593595
// Manually recombine everything here. We have to separate the shading to ensure that lighting is able to more closely match blinn-phong.
594-
color.rgb = srgb_to_linear(iblDiff) + clamp(sun_contrib * (da * (diffPunc.rgb + specPunc.rgb) * scol), vec3(0), vec3(10));
596+
vec3 finalAmbient = irradiance.rgb * diffuseColor.rgb; // BINGO
597+
vec3 finalSun = clamp(sun_contrib * ((diffPunc.rgb + specPunc.rgb) * scol), vec3(0), vec3(10)); // QUESTIONABLE BINGO?
598+
color.rgb = srgb_to_linear(linear_to_srgb(finalAmbient) + (linear_to_srgb(finalSun) * 1.1));
599+
//color.rgb = sun_contrib * diffuseColor.rgb;
595600
}
596601
else
597602
{

indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,10 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec
163163

164164
// no spec for alpha shader...
165165
}
166-
col = max(col, vec3(0));
166+
float final_scale = 1.0;
167+
if (classic_mode > 0)
168+
final_scale = 0.9;
169+
col = max(col * final_scale, vec3(0));
167170
return col;
168171
}
169172

@@ -241,7 +244,8 @@ void main()
241244
vec3 atten;
242245

243246
calcAtmosphericVarsLinear(pos.xyz, norm, light_dir, sunlit, amblit, additive, atten);
244-
247+
if (classic_mode > 0)
248+
sunlit *= 1.35;
245249
vec3 sunlit_linear = sunlit;
246250
vec3 amblit_linear = amblit;
247251

@@ -296,11 +300,14 @@ void main()
296300
color.rgb = applySkyAndWaterFog(pos.xyz, additive, atten, color).rgb;
297301

298302
#endif // #else // FOR_IMPOSTOR
299-
303+
float final_scale = 1;
304+
if (classic_mode > 0)
305+
final_scale = 1.1;
300306
#ifdef IS_HUD
301307
color.rgb = linear_to_srgb(color.rgb);
308+
final_scale = 1;
302309
#endif
303310

304-
frag_color = max(color, vec4(0));
311+
frag_color = max(color * final_scale, vec4(0));
305312
}
306313

indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ uniform sampler2D lightMap;
4343
uniform int sun_up_factor;
4444
uniform vec3 sun_dir;
4545
uniform vec3 moon_dir;
46+
uniform int classic_mode;
4647

4748
out vec4 frag_color;
4849

@@ -160,7 +161,8 @@ void main()
160161
vec3 additive;
161162
vec3 atten;
162163
calcAtmosphericVarsLinear(pos.xyz, norm, light_dir, sunlit, amblit, additive, atten);
163-
164+
if (classic_mode > 0)
165+
sunlit *= 1.35;
164166
vec3 sunlit_linear = sunlit;
165167

166168
vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5;
@@ -212,8 +214,10 @@ void main()
212214
color.rgb = applySkyAndWaterFog(pos.xyz, additive, atten, vec4(color, 1.0)).rgb;
213215

214216
float a = basecolor.a*vertex_color.a;
215-
216-
frag_color = max(vec4(color.rgb,a), vec4(0));
217+
float final_scale = 1;
218+
if (classic_mode > 0)
219+
final_scale = 1.1;
220+
frag_color = max(vec4(color.rgb * final_scale,a), vec4(0));
217221
}
218222

219223
#else

indra/newview/app_settings/shaders/class3/deferred/materialF.glsl

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,10 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe
178178
}
179179
}
180180
}
181-
182-
return max(col, vec3(0.0, 0.0, 0.0));
181+
float final_scale = 1.0;
182+
if (classic_mode > 0)
183+
final_scale = 0.9;
184+
return max(col * final_scale, vec3(0.0, 0.0, 0.0));
183185
}
184186

185187
#else
@@ -329,7 +331,8 @@ void main()
329331
vec3 additive;
330332
vec3 atten;
331333
calcAtmosphericVarsLinear(pos.xyz, norm.xyz, light_dir, sunlit, amblit, additive, atten);
332-
334+
if (classic_mode > 0)
335+
sunlit *= 1.35;
333336
vec3 sunlit_linear = sunlit;
334337
vec3 amblit_linear = amblit;
335338

@@ -418,8 +421,10 @@ void main()
418421
glare *= 1.0-emissive;
419422
glare = min(glare, 1.0);
420423
float al = max(diffcol.a, glare) * vertex_color.a;
421-
422-
frag_color = max(vec4(color, al), vec4(0));
424+
float final_scale = 1;
425+
if (classic_mode > 0)
426+
final_scale = 1.1;
427+
frag_color = max(vec4(color * final_scale, al), vec4(0));
423428

424429
#else // mode is not DIFFUSE_ALPHA_MODE_BLEND, encode to gbuffer
425430
// deferred path // See: C++: addDeferredAttachment(), shader: softenLightF.glsl

indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ uniform vec4 light_col[LIGHT_COUNT]; // .a = falloff
3737
uniform vec2 screen_res;
3838
uniform float far_z;
3939
uniform mat4 inv_proj;
40+
uniform int classic_mode;
4041

4142
in vec4 vary_fragcoord;
4243

@@ -168,8 +169,10 @@ void main()
168169
}
169170
}
170171
}
171-
172-
frag_color.rgb = max(final_color, vec3(0));
172+
float final_scale = 1.0;
173+
if (classic_mode > 0)
174+
final_scale = 0.9;
175+
frag_color.rgb = max(final_color * final_scale, vec3(0));
173176
frag_color.a = 0.0;
174177

175178
#ifdef IS_AMD_CARD

indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ in vec3 trans_center;
4242
uniform vec2 screen_res;
4343

4444
uniform mat4 inv_proj;
45+
uniform int classic_mode;
4546

4647
void calcHalfVectors(vec3 lv, vec3 n, vec3 v, out vec3 h, out vec3 l, out float nh, out float nl, out float nv, out float vh, out float lightDist);
4748
float calcLegacyDistanceAttenuation(float distance, float falloff);
@@ -147,7 +148,9 @@ void main()
147148
discard;
148149
}
149150
}
150-
151-
frag_color.rgb = max(final_color, vec3(0));
151+
float final_scale = 1.0;
152+
if (classic_mode > 0)
153+
final_scale = 0.9;
154+
frag_color.rgb = max(final_color * final_scale, vec3(0));
152155
frag_color.a = 0.0;
153156
}

indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ void main()
152152

153153
calcAtmosphericVarsLinear(pos.xyz, gb.normal, light_dir, sunlit, amblit, additive, atten);
154154

155+
if (classic_mode > 0)
156+
sunlit *= 1.35;
157+
155158
vec3 sunlit_linear = sunlit;
156159
vec3 amblit_linear = amblit;
157160

@@ -221,7 +224,7 @@ void main()
221224
da = pow(da,1.2);
222225
vec3 sun_contrib = vec3(min(da, scol));
223226

224-
color.rgb = srgb_to_linear(color.rgb * 0.9 + linear_to_srgb(sun_contrib) * sunlit_linear * 0.7);
227+
color.rgb = srgb_to_linear(color.rgb * 0.9 + (linear_to_srgb(sun_contrib) * sunlit_linear * 0.7));
225228
sunlit_linear = srgb_to_linear(sunlit_linear);
226229
}
227230
else
@@ -269,6 +272,9 @@ void main()
269272
}
270273

271274
//color.r = classic_mode > 0 ? 1.0 : 0.0;
272-
frag_color.rgb = max(color.rgb, vec3(0)); //output linear since local lights will be added to this shader's results
275+
float final_scale = 1;
276+
if (classic_mode > 0)
277+
final_scale = 1.1;
278+
frag_color.rgb = max(color.rgb * final_scale, vec3(0)); //output linear since local lights will be added to this shader's results
273279
frag_color.a = 0.0;
274280
}

0 commit comments

Comments
 (0)