Skip to content

Commit d65fb7c

Browse files
authored
Drop emissive on old Intel GPUs (#3110)
* #3103 Add the ability to disable the emissive buffer for older GPUs with low memory bandwidth. * #3135 Add a "vintage" mode for slower GPUs * #2719 Fix for skies being overbrightened * #2632 Do not apply tonemapping on legacy skies
1 parent 7ef6e8f commit d65fb7c

Some content is hidden

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

58 files changed

+846
-252
lines changed

indra/llinventory/llsettingssky.cpp

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ void LLSettingsSky::blend(LLSettingsBase::ptr_t &end, F64 blendf)
601601

602602
mSettingFlags |= other->mSettingFlags;
603603

604-
mCanAutoAdjust = false; // no point?
604+
mCanAutoAdjust = other->mCanAutoAdjust;
605605

606606
mSunRotation = slerp((F32)blendf, mSunRotation, other->mSunRotation);
607607
mMoonRotation = slerp((F32)blendf, mMoonRotation, other->mMoonRotation);
@@ -1177,6 +1177,11 @@ void LLSettingsSky::loadValuesFromLLSD()
11771177
mReflectionProbeAmbiance = (F32)settings[SETTING_REFLECTION_PROBE_AMBIANCE].asReal();
11781178
}
11791179

1180+
mHDRMax = 2.0f;
1181+
mHDRMin = 0.5f;
1182+
mHDROffset = 1.0f;
1183+
mTonemapMix = 1.0f;
1184+
11801185
mSunTextureId = settings[SETTING_SUN_TEXTUREID].asUUID();
11811186
mMoonTextureId = settings[SETTING_MOON_TEXTUREID].asUUID();
11821187
mCloudTextureId = settings[SETTING_CLOUD_TEXTUREID].asUUID();
@@ -2027,6 +2032,38 @@ F32 LLSettingsSky::getGamma() const
20272032
return mGamma;
20282033
}
20292034

2035+
F32 LLSettingsSky::getHDRMin() const
2036+
{
2037+
if (mCanAutoAdjust)
2038+
return 0.f;
2039+
2040+
return mHDRMin;
2041+
}
2042+
2043+
F32 LLSettingsSky::getHDRMax() const
2044+
{
2045+
if (mCanAutoAdjust)
2046+
return 0.f;
2047+
2048+
return mHDRMax;
2049+
}
2050+
2051+
F32 LLSettingsSky::getHDROffset() const
2052+
{
2053+
if (mCanAutoAdjust)
2054+
return 1.0f;
2055+
2056+
return mHDROffset;
2057+
}
2058+
2059+
F32 LLSettingsSky::getTonemapMix() const
2060+
{
2061+
if (mCanAutoAdjust)
2062+
return 0.0f;
2063+
2064+
return mTonemapMix;
2065+
}
2066+
20302067
void LLSettingsSky::setGamma(F32 val)
20312068
{
20322069
mGamma = val;

indra/llinventory/llsettingssky.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,11 @@ class LLSettingsSky: public LLSettingsBase
209209

210210
F32 getGamma() const;
211211

212+
F32 getHDRMin() const;
213+
F32 getHDRMax() const;
214+
F32 getHDROffset() const;
215+
F32 getTonemapMix() const;
216+
212217
void setGamma(F32 val);
213218

214219
LLColor3 getGlow() const;
@@ -380,6 +385,10 @@ class LLSettingsSky: public LLSettingsBase
380385
F32 mCloudVariance;
381386
F32 mCloudShadow;
382387
F32 mCloudScale;
388+
F32 mTonemapMix;
389+
F32 mHDROffset;
390+
F32 mHDRMax;
391+
F32 mHDRMin;
383392
LLVector2 mScrollRate;
384393
LLColor3 mCloudPosDensity1;
385394
LLColor3 mCloudPosDensity2;

indra/llrender/llglslshader.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1866,6 +1866,23 @@ void LLGLSLShader::uniform3f(const LLStaticHashedString& uniform, GLfloat x, GLf
18661866
}
18671867
}
18681868

1869+
void LLGLSLShader::uniform4f(const LLStaticHashedString& uniform, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
1870+
{
1871+
LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER;
1872+
GLint location = getUniformLocation(uniform);
1873+
1874+
if (location >= 0)
1875+
{
1876+
const auto& iter = mValue.find(location);
1877+
LLVector4 vec(x, y, z, w);
1878+
if (iter == mValue.end() || shouldChange(iter->second, vec))
1879+
{
1880+
glUniform4f(location, x, y, z, w);
1881+
mValue[location] = vec;
1882+
}
1883+
}
1884+
}
1885+
18691886
void LLGLSLShader::uniform1fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v)
18701887
{
18711888
LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER;

indra/llrender/llglslshader.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class LLShaderFeatures
5252
bool hasAmbientOcclusion = false;
5353
bool hasSrgb = false;
5454
bool isDeferred = false;
55+
bool hasFullGBuffer = false;
5556
bool hasScreenSpaceReflections = false;
5657
bool hasAlphaMask = false;
5758
bool hasReflectionProbes = false;
@@ -221,6 +222,7 @@ class LLGLSLShader
221222
void uniform1f(const LLStaticHashedString& uniform, GLfloat v);
222223
void uniform2f(const LLStaticHashedString& uniform, GLfloat x, GLfloat y);
223224
void uniform3f(const LLStaticHashedString& uniform, GLfloat x, GLfloat y, GLfloat z);
225+
void uniform4f(const LLStaticHashedString& uniform, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
224226
void uniform1fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v);
225227
void uniform2fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v);
226228
void uniform3fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v);

indra/llrender/llimagegl.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,8 @@ void LLImageGL::initClass(LLWindow* window, S32 num_catagories, bool skip_analyz
259259
if (thread_texture_loads || thread_media_updates)
260260
{
261261
LLImageGLThread::createInstance(window);
262-
LLImageGLThread::sEnabledTextures = thread_texture_loads;
263-
LLImageGLThread::sEnabledMedia = thread_media_updates;
262+
LLImageGLThread::sEnabledTextures = gGLManager.mGLVersion > 3.95f ? thread_texture_loads : false;
263+
LLImageGLThread::sEnabledMedia = gGLManager.mGLVersion > 3.95f ? thread_media_updates : false;
264264
}
265265
}
266266

@@ -332,6 +332,7 @@ S32 LLImageGL::dataFormatBits(S32 dataformat)
332332
case GL_RGB8: return 24;
333333
case GL_RGBA: return 32;
334334
case GL_RGBA8: return 32;
335+
case GL_RGB10_A2: return 32;
335336
case GL_SRGB_ALPHA: return 32;
336337
case GL_BGRA: return 32; // Used for QuickTime media textures on the Mac
337338
case GL_DEPTH_COMPONENT: return 24;

indra/llrender/llshadermgr.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,14 @@ bool LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
223223
}
224224
}
225225

226+
if (features->hasFullGBuffer)
227+
{
228+
if (!shader->attachFragmentObject("deferred/gbufferUtil.glsl"))
229+
{
230+
return false;
231+
}
232+
}
233+
226234
if (features->hasScreenSpaceReflections || features->hasReflectionProbes)
227235
{
228236
if (!shader->attachFragmentObject("deferred/screenSpaceReflUtil.glsl"))
@@ -606,7 +614,7 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev
606614
extra_code_text[extra_code_count++] = strdup("#define GBUFFER_FLAG_HAS_ATMOS 0.34\n"); // bit 0
607615
extra_code_text[extra_code_count++] = strdup("#define GBUFFER_FLAG_HAS_PBR 0.67\n"); // bit 1
608616
extra_code_text[extra_code_count++] = strdup("#define GBUFFER_FLAG_HAS_HDRI 1.0\n"); // bit 2
609-
extra_code_text[extra_code_count++] = strdup("#define GET_GBUFFER_FLAG(flag) (abs(norm.w-flag)< 0.1)\n");
617+
extra_code_text[extra_code_count++] = strdup("#define GET_GBUFFER_FLAG(data, flag) (abs(data-flag)< 0.1)\n");
610618

611619
if (defines)
612620
{
@@ -717,6 +725,9 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev
717725
}
718726
}
719727

728+
// Master definition can be found in deferredUtil.glsl
729+
extra_code_text[extra_code_count++] = strdup("struct GBufferInfo { vec4 albedo; vec4 specular; vec3 normal; vec4 emissive; float gbufferFlag; float envIntensity; };\n");
730+
720731
//copy file into memory
721732
enum {
722733
flag_write_to_out_of_extra_block_area = 0x01
@@ -1249,6 +1260,7 @@ void LLShaderMgr::initAttribsAndUniforms()
12491260
mReservedUniforms.push_back("sky_hdr_scale");
12501261
mReservedUniforms.push_back("sky_sunlight_scale");
12511262
mReservedUniforms.push_back("sky_ambient_scale");
1263+
mReservedUniforms.push_back("classic_mode");
12521264
mReservedUniforms.push_back("blue_horizon");
12531265
mReservedUniforms.push_back("blue_density");
12541266
mReservedUniforms.push_back("haze_horizon");

indra/llrender/llshadermgr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ class LLShaderMgr
121121
SKY_HDR_SCALE, // "sky_hdr_scale"
122122
SKY_SUNLIGHT_SCALE, // "sky_sunlight_scale"
123123
SKY_AMBIENT_SCALE, // "sky_ambient_scale"
124+
CLASSIC_MODE, // "classic_mode"
124125
BLUE_HORIZON, // "blue_horizon"
125126
BLUE_DENSITY, // "blue_density"
126127
HAZE_HORIZON, // "haze_horizon"

indra/newview/app_settings/settings.xml

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7717,6 +7717,17 @@
77177717
<key>Value</key>
77187718
<integer>0</integer>
77197719
</map>
7720+
<key>RenderEnableEmissiveBuffer</key>
7721+
<map>
7722+
<key>Comment</key>
7723+
<string>Enable emissive buffer in gbuffer. Should only be disabled in GL3 mode.</string>
7724+
<key>Persist</key>
7725+
<integer>1</integer>
7726+
<key>Type</key>
7727+
<string>Boolean</string>
7728+
<key>Value</key>
7729+
<integer>1</integer>
7730+
</map>
77207731
<key>RenderHDRIExposure</key>
77217732
<map>
77227733
<key>Comment</key>
@@ -7764,7 +7775,7 @@
77647775
<key>RenderMaxOpenGLVersion</key>
77657776
<map>
77667777
<key>Comment</key>
7767-
<string>Maximum OpenGL version to attempt use (minimum 3.2 maximum 4.6). Requires restart.</string>
7778+
<string>Maximum OpenGL version to attempt use (minimum 3.1 maximum 4.6). Requires restart.</string>
77687779
<key>Persist</key>
77697780
<integer>1</integer>
77707781
<key>Type</key>
@@ -9234,14 +9245,25 @@
92349245
<key>RenderSkySunlightScale</key>
92359246
<map>
92369247
<key>Comment</key>
9237-
<string>Sunlight scale fudge factor for matching with pre-PBR viewer</string>
9248+
<string>Sunlight scale fudge factor for matching with pre-PBR viewer when HDR is disabled</string>
92389249
<key>Persist</key>
9239-
<integer>1</integer>
9250+
<integer>0</integer>
92409251
<key>Type</key>
92419252
<string>F32</string>
92429253
<key>Value</key>
92439254
<real>1.0</real>
92449255
</map>
9256+
<key>RenderHDRSkySunlightScale</key>
9257+
<map>
9258+
<key>Comment</key>
9259+
<string>Sunlight scale fudge factor for matching with pre-PBR viewer when HDR is enabled</string>
9260+
<key>Persist</key>
9261+
<integer>0</integer>
9262+
<key>Type</key>
9263+
<string>F32</string>
9264+
<key>Value</key>
9265+
<real>1.0</real>
9266+
</map>
92459267
<key>RenderSkyAmbientScale</key>
92469268
<map>
92479269
<key>Comment</key>
@@ -9251,7 +9273,7 @@
92519273
<key>Type</key>
92529274
<string>F32</string>
92539275
<key>Value</key>
9254-
<real>0.7</real>
9276+
<real>1.0</real>
92559277
</map>
92569278

92579279
<key>RenderReflectionProbeMaxLocalLightAmbiance</key>
@@ -16049,5 +16071,16 @@
1604916071
<key>Value</key>
1605016072
<integer>1</integer>
1605116073
</map>
16074+
<key>RenderVintageMode</key>
16075+
<map>
16076+
<key>Comment</key>
16077+
<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>
16078+
<key>Persist</key>
16079+
<integer>1</integer>
16080+
<key>Type</key>
16081+
<string>Boolean</string>
16082+
<key>Value</key>
16083+
<integer>0</integer>
16084+
</map>
1605216085
</map>
1605316086
</llsd>

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +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);
39+
vec4 encodeNormal(vec3 n, float env, float gbuffer_flag);
4040

4141
void main()
4242
{
@@ -52,7 +52,10 @@ void main()
5252
frag_data[0] = vec4(diff.rgb, 0.0);
5353
frag_data[1] = vec4(0,0,0,0);
5454
vec3 nvn = normalize(vary_normal);
55-
frag_data[2] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
55+
frag_data[2] = encodeNormal(nvn.xyz, 0, GBUFFER_FLAG_HAS_ATMOS);
56+
57+
#if defined(HAS_EMISSIVE)
5658
frag_data[3] = vec4(0);
59+
#endif
5760
}
5861

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

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ in vec2 vary_texcoord0;
4040
in vec3 vary_position;
4141

4242
void mirrorClip(vec3 pos);
43-
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
43+
vec4 encodeNormal(vec3 n, float env, float gbuffer_flag);
4444

4545
void main()
4646
{
@@ -52,18 +52,21 @@ void main()
5252
{
5353
discard;
5454
}
55-
col *= vertex_color;
55+
col *= vertex_color;
5656

57-
vec3 norm = texture(bumpMap, vary_texcoord0.xy).rgb * 2.0 - 1.0;
57+
vec3 norm = texture(bumpMap, vary_texcoord0.xy).rgb * 2.0 - 1.0;
5858

59-
vec3 tnorm = vec3(dot(norm,vary_mat0),
60-
dot(norm,vary_mat1),
61-
dot(norm,vary_mat2));
59+
vec3 tnorm = vec3(dot(norm,vary_mat0),
60+
dot(norm,vary_mat1),
61+
dot(norm,vary_mat2));
6262

63-
frag_data[0] = vec4(col.rgb, 0.0);
64-
frag_data[1] = vertex_color.aaaa; // spec
65-
//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
66-
vec3 nvn = normalize(tnorm);
67-
frag_data[2] = encodeNormal(nvn, GBUFFER_FLAG_HAS_ATMOS);
68-
frag_data[3] = vec4(vertex_color.a, 0, 0, 0);
63+
frag_data[0] = vec4(col.rgb, 0.0);
64+
frag_data[1] = vertex_color.aaaa; // spec
65+
//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
66+
vec3 nvn = normalize(tnorm);
67+
frag_data[2] = encodeNormal(nvn, vertex_color.a, GBUFFER_FLAG_HAS_ATMOS);
68+
69+
#if defined(HAS_EMISSIVE)
70+
frag_data[3] = vec4(0, 0, 0, 0);
71+
#endif
6972
}

0 commit comments

Comments
 (0)