summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rwxr-xr-xindra/lib/python/indra/util/llmanifest.py2
-rw-r--r--indra/llinventory/llsettingssky.cpp39
-rw-r--r--indra/llinventory/llsettingssky.h9
-rw-r--r--indra/llprimitive/lldaeloader.cpp122
-rw-r--r--indra/llrender/llglslshader.cpp17
-rw-r--r--indra/llrender/llglslshader.h2
-rw-r--r--indra/llrender/llimagegl.cpp5
-rw-r--r--indra/llrender/llshadermgr.cpp14
-rw-r--r--indra/llrender/llshadermgr.h1
-rw-r--r--indra/llrender/llvertexbuffer.cpp3
-rw-r--r--indra/newview/CMakeLists.txt41
-rw-r--r--indra/newview/app_settings/settings.xml41
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl27
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl8
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl82
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl9
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl9
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/exposureF.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/gbufferUtil.glsl59
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/globalF.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/highlightF.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl5
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/materialF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/moonF.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/pbrterrainF.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/skyF.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/starsF.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl5
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/treeF.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class1/gltf/pbrmetallicroughnessF.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class1/gltf/pbrmetallicroughnessV.glsl49
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/occlusionF.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl15
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl15
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/hazeF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/materialF.glsl9
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl31
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl33
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl81
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl36
-rw-r--r--indra/newview/app_settings/shaders/class3/environment/waterF.glsl36
-rw-r--r--indra/newview/featuretable.txt36
-rw-r--r--indra/newview/featuretable_mac.txt13
-rw-r--r--indra/newview/llenvironment.cpp2
-rw-r--r--indra/newview/llface.cpp6
-rw-r--r--indra/newview/llfeaturemanager.cpp13
-rw-r--r--indra/newview/llfetchedgltfmaterial.h6
-rw-r--r--indra/newview/llfloaterpreferencesgraphicsadvanced.cpp12
-rw-r--r--indra/newview/llmaterialeditor.cpp22
-rw-r--r--indra/newview/llmodelpreview.cpp9
-rw-r--r--indra/newview/llmodelpreview.h1
-rw-r--r--indra/newview/lloutfitgallery.cpp48
-rw-r--r--indra/newview/lloutfitgallery.h1
-rw-r--r--indra/newview/llreflectionmapmanager.cpp7
-rw-r--r--indra/newview/llsettingsvo.cpp8
-rw-r--r--indra/newview/lltexturefetch.cpp2
-rw-r--r--indra/newview/llviewercontrol.cpp20
-rw-r--r--indra/newview/llviewerdisplay.cpp25
-rw-r--r--indra/newview/llviewershadermgr.cpp146
-rw-r--r--indra/newview/llviewertexture.cpp2
-rw-r--r--indra/newview/llvlcomposition.cpp28
-rw-r--r--indra/newview/llvlcomposition.h17
-rw-r--r--indra/newview/llvotree.cpp12
-rw-r--r--indra/newview/llvovolume.cpp45
-rw-r--r--indra/newview/pipeline.cpp51
-rw-r--r--indra/newview/skins/default/xui/en/floater_material_editor.xml3
-rw-r--r--indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml14
-rw-r--r--indra/newview/skins/default/xui/en/strings.xml5
-rwxr-xr-xindra/newview/viewer_manifest.py52
79 files changed, 1113 insertions, 429 deletions
diff --git a/indra/lib/python/indra/util/llmanifest.py b/indra/lib/python/indra/util/llmanifest.py
index 38de9c7cf1..1bd65eb57d 100755
--- a/indra/lib/python/indra/util/llmanifest.py
+++ b/indra/lib/python/indra/util/llmanifest.py
@@ -637,7 +637,7 @@ class LLManifest(object, metaclass=LLManifestRegistry):
'vers':'_'.join(self.args['version'])}
print("Creating unpacked file:", unpacked_file_name)
# could add a gz here but that doubles the time it takes to do this step
- tf = tarfile.open(self.src_path_of(unpacked_file_name), 'w:')
+ tf = tarfile.open(self.build_path_of(unpacked_file_name), 'w:')
# add the entire installation package, at the very top level
tf.add(self.get_dst_prefix(), "")
tf.close()
diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp
index 03beebd9e1..a9b83657b7 100644
--- a/indra/llinventory/llsettingssky.cpp
+++ b/indra/llinventory/llsettingssky.cpp
@@ -602,7 +602,7 @@ void LLSettingsSky::blend(LLSettingsBase::ptr_t &end, F64 blendf)
mSettingFlags |= other->mSettingFlags;
- mCanAutoAdjust = false; // no point?
+ mCanAutoAdjust = other->mCanAutoAdjust;
mSunRotation = slerp((F32)blendf, mSunRotation, other->mSunRotation);
mMoonRotation = slerp((F32)blendf, mMoonRotation, other->mMoonRotation);
@@ -1178,6 +1178,11 @@ void LLSettingsSky::loadValuesFromLLSD()
mReflectionProbeAmbiance = (F32)settings[SETTING_REFLECTION_PROBE_AMBIANCE].asReal();
}
+ mHDRMax = 2.0f;
+ mHDRMin = 0.5f;
+ mHDROffset = 1.0f;
+ mTonemapMix = 1.0f;
+
mSunTextureId = settings[SETTING_SUN_TEXTUREID].asUUID();
mMoonTextureId = settings[SETTING_MOON_TEXTUREID].asUUID();
mCloudTextureId = settings[SETTING_CLOUD_TEXTUREID].asUUID();
@@ -2028,6 +2033,38 @@ F32 LLSettingsSky::getGamma() const
return mGamma;
}
+F32 LLSettingsSky::getHDRMin() const
+{
+ if (mCanAutoAdjust)
+ return 0.f;
+
+ return mHDRMin;
+}
+
+F32 LLSettingsSky::getHDRMax() const
+{
+ if (mCanAutoAdjust)
+ return 0.f;
+
+ return mHDRMax;
+}
+
+F32 LLSettingsSky::getHDROffset() const
+{
+ if (mCanAutoAdjust)
+ return 1.0f;
+
+ return mHDROffset;
+}
+
+F32 LLSettingsSky::getTonemapMix() const
+{
+ if (mCanAutoAdjust)
+ return 0.0f;
+
+ return mTonemapMix;
+}
+
void LLSettingsSky::setGamma(F32 val)
{
mGamma = val;
diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h
index 38c0368423..8d73c35ff3 100644
--- a/indra/llinventory/llsettingssky.h
+++ b/indra/llinventory/llsettingssky.h
@@ -209,6 +209,11 @@ public:
F32 getGamma() const;
+ F32 getHDRMin() const;
+ F32 getHDRMax() const;
+ F32 getHDROffset() const;
+ F32 getTonemapMix() const;
+
void setGamma(F32 val);
LLColor3 getGlow() const;
@@ -380,6 +385,10 @@ protected:
F32 mCloudVariance;
F32 mCloudShadow;
F32 mCloudScale;
+ F32 mTonemapMix;
+ F32 mHDROffset;
+ F32 mHDRMax;
+ F32 mHDRMin;
LLVector2 mScrollRate;
LLColor3 mCloudPosDensity1;
LLColor3 mCloudPosDensity2;
diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp
index 7fa4230237..0759447902 100644
--- a/indra/llprimitive/lldaeloader.cpp
+++ b/indra/llprimitive/lldaeloader.cpp
@@ -2080,79 +2080,83 @@ void LLDAELoader::processElement( daeElement* element, bool& badElement, DAE* da
{
if (domMesh* mesh = daeSafeCast<domMesh>(geo->getDescendant(daeElement::matchType(domMesh::ID()))))
{
- for (LLModel* model : mModelsMap.find(mesh)->second)
+ dae_model_map::iterator it = mModelsMap.find(mesh);
+ if (it != mModelsMap.end())
{
- LLMatrix4 transformation = mTransform;
+ for (LLModel* model : it->second)
+ {
+ LLMatrix4 transformation = mTransform;
- if (mTransform.determinant() < 0)
- { //negative scales are not supported
- LL_INFOS() << "Negative scale detected, unsupported transform. domInstance_geometry: " << getElementLabel(instance_geo) << LL_ENDL;
- LLSD args;
- args["Message"] = "NegativeScaleTrans";
- args["LABEL"] = getElementLabel(instance_geo);
- mWarningsArray.append(args);
+ if (mTransform.determinant() < 0)
+ { //negative scales are not supported
+ LL_INFOS() << "Negative scale detected, unsupported transform. domInstance_geometry: " << getElementLabel(instance_geo) << LL_ENDL;
+ LLSD args;
+ args["Message"] = "NegativeScaleTrans";
+ args["LABEL"] = getElementLabel(instance_geo);
+ mWarningsArray.append(args);
- badElement = true;
- }
+ badElement = true;
+ }
- LLModelLoader::material_map materials = getMaterials(model, instance_geo, dae);
-
- // adjust the transformation to compensate for mesh normalization
- LLVector3 mesh_scale_vector;
- LLVector3 mesh_translation_vector;
- model->getNormalizedScaleTranslation(mesh_scale_vector, mesh_translation_vector);
-
- LLMatrix4 mesh_translation;
- mesh_translation.setTranslation(mesh_translation_vector);
- mesh_translation *= transformation;
- transformation = mesh_translation;
-
- LLMatrix4 mesh_scale;
- mesh_scale.initScale(mesh_scale_vector);
- mesh_scale *= transformation;
- transformation = mesh_scale;
-
- if (transformation.determinant() < 0)
- { //negative scales are not supported
- LL_INFOS() << "Negative scale detected, unsupported post-normalization transform. domInstance_geometry: " << getElementLabel(instance_geo) << LL_ENDL;
- LLSD args;
- args["Message"] = "NegativeScaleNormTrans";
- args["LABEL"] = getElementLabel(instance_geo);
- mWarningsArray.append(args);
- badElement = true;
- }
+ LLModelLoader::material_map materials = getMaterials(model, instance_geo, dae);
+
+ // adjust the transformation to compensate for mesh normalization
+ LLVector3 mesh_scale_vector;
+ LLVector3 mesh_translation_vector;
+ model->getNormalizedScaleTranslation(mesh_scale_vector, mesh_translation_vector);
+
+ LLMatrix4 mesh_translation;
+ mesh_translation.setTranslation(mesh_translation_vector);
+ mesh_translation *= transformation;
+ transformation = mesh_translation;
+
+ LLMatrix4 mesh_scale;
+ mesh_scale.initScale(mesh_scale_vector);
+ mesh_scale *= transformation;
+ transformation = mesh_scale;
+
+ if (transformation.determinant() < 0)
+ { //negative scales are not supported
+ LL_INFOS() << "Negative scale detected, unsupported post-normalization transform. domInstance_geometry: " << getElementLabel(instance_geo) << LL_ENDL;
+ LLSD args;
+ args["Message"] = "NegativeScaleNormTrans";
+ args["LABEL"] = getElementLabel(instance_geo);
+ mWarningsArray.append(args);
+ badElement = true;
+ }
- std::string label;
+ std::string label;
- if (model->mLabel.empty())
- {
- label = getLodlessLabel(instance_geo);
+ if (model->mLabel.empty())
+ {
+ label = getLodlessLabel(instance_geo);
- llassert(!label.empty());
+ llassert(!label.empty());
- if (model->mSubmodelID)
- {
- label += (char)((int)'a' + model->mSubmodelID);
- }
+ if (model->mSubmodelID)
+ {
+ label += (char)((int)'a' + model->mSubmodelID);
+ }
- model->mLabel = label + lod_suffix[mLod];
- }
- else
- {
- // Don't change model's name if possible, it will play havoc with scenes that already use said model.
- size_t ext_pos = getSuffixPosition(model->mLabel);
- if (ext_pos != -1)
- {
- label = model->mLabel.substr(0, ext_pos);
+ model->mLabel = label + lod_suffix[mLod];
}
else
{
- label = model->mLabel;
+ // Don't change model's name if possible, it will play havoc with scenes that already use said model.
+ size_t ext_pos = getSuffixPosition(model->mLabel);
+ if (ext_pos != -1)
+ {
+ label = model->mLabel.substr(0, ext_pos);
+ }
+ else
+ {
+ label = model->mLabel;
+ }
}
- }
- mScene[transformation].push_back(LLModelInstance(model, label, transformation, materials));
- stretch_extents(model, transformation);
+ mScene[transformation].push_back(LLModelInstance(model, label, transformation, materials));
+ stretch_extents(model, transformation);
+ }
}
}
}
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp
index f6539b8d03..3d7bf500f1 100644
--- a/indra/llrender/llglslshader.cpp
+++ b/indra/llrender/llglslshader.cpp
@@ -1904,6 +1904,23 @@ void LLGLSLShader::uniform3f(const LLStaticHashedString& uniform, GLfloat x, GLf
}
}
+void LLGLSLShader::uniform4f(const LLStaticHashedString& uniform, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER;
+ GLint location = getUniformLocation(uniform);
+
+ if (location >= 0)
+ {
+ const auto& iter = mValue.find(location);
+ LLVector4 vec(x, y, z, w);
+ if (iter == mValue.end() || shouldChange(iter->second, vec))
+ {
+ glUniform4f(location, x, y, z, w);
+ mValue[location] = vec;
+ }
+ }
+}
+
void LLGLSLShader::uniform1fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER;
diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h
index 2d669c70a9..58c456f134 100644
--- a/indra/llrender/llglslshader.h
+++ b/indra/llrender/llglslshader.h
@@ -52,6 +52,7 @@ public:
bool hasAmbientOcclusion = false;
bool hasSrgb = false;
bool isDeferred = false;
+ bool hasFullGBuffer = false;
bool hasScreenSpaceReflections = false;
bool hasAlphaMask = false;
bool hasReflectionProbes = false;
@@ -221,6 +222,7 @@ public:
void uniform1f(const LLStaticHashedString& uniform, GLfloat v);
void uniform2f(const LLStaticHashedString& uniform, GLfloat x, GLfloat y);
void uniform3f(const LLStaticHashedString& uniform, GLfloat x, GLfloat y, GLfloat z);
+ void uniform4f(const LLStaticHashedString& uniform, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
void uniform1fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v);
void uniform2fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v);
void uniform3fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v);
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index 08c05a0771..d0d55b8526 100644
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -259,8 +259,8 @@ void LLImageGL::initClass(LLWindow* window, S32 num_catagories, bool skip_analyz
if (thread_texture_loads || thread_media_updates)
{
LLImageGLThread::createInstance(window);
- LLImageGLThread::sEnabledTextures = thread_texture_loads;
- LLImageGLThread::sEnabledMedia = thread_media_updates;
+ LLImageGLThread::sEnabledTextures = gGLManager.mGLVersion > 3.95f ? thread_texture_loads : false;
+ LLImageGLThread::sEnabledMedia = gGLManager.mGLVersion > 3.95f ? thread_media_updates : false;
}
}
@@ -350,6 +350,7 @@ S32 LLImageGL::dataFormatBits(S32 dataformat)
case GL_RGB8: return 24;
case GL_RGBA: return 32;
case GL_RGBA8: return 32;
+ case GL_RGB10_A2: return 32;
#if GL_VERSION_2_1
case GL_SRGB_ALPHA: return 32;
case GL_BGRA: return 32; // Used for QuickTime media textures on the Mac
diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp
index e02dd4771e..47f1032c34 100644
--- a/indra/llrender/llshadermgr.cpp
+++ b/indra/llrender/llshadermgr.cpp
@@ -223,6 +223,14 @@ bool LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
}
}
+ if (features->hasFullGBuffer)
+ {
+ if (!shader->attachFragmentObject("deferred/gbufferUtil.glsl"))
+ {
+ return false;
+ }
+ }
+
if (features->hasScreenSpaceReflections || features->hasReflectionProbes)
{
if (!shader->attachFragmentObject("deferred/screenSpaceReflUtil.glsl"))
@@ -606,7 +614,7 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev
extra_code_text[extra_code_count++] = strdup("#define GBUFFER_FLAG_HAS_ATMOS 0.34\n"); // bit 0
extra_code_text[extra_code_count++] = strdup("#define GBUFFER_FLAG_HAS_PBR 0.67\n"); // bit 1
extra_code_text[extra_code_count++] = strdup("#define GBUFFER_FLAG_HAS_HDRI 1.0\n"); // bit 2
- extra_code_text[extra_code_count++] = strdup("#define GET_GBUFFER_FLAG(flag) (abs(norm.w-flag)< 0.1)\n");
+ extra_code_text[extra_code_count++] = strdup("#define GET_GBUFFER_FLAG(data, flag) (abs(data-flag)< 0.1)\n");
if (defines)
{
@@ -717,6 +725,9 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev
}
}
+ // Master definition can be found in deferredUtil.glsl
+ extra_code_text[extra_code_count++] = strdup("struct GBufferInfo { vec4 albedo; vec4 specular; vec3 normal; vec4 emissive; float gbufferFlag; float envIntensity; };\n");
+
//copy file into memory
enum {
flag_write_to_out_of_extra_block_area = 0x01
@@ -1249,6 +1260,7 @@ void LLShaderMgr::initAttribsAndUniforms()
mReservedUniforms.push_back("sky_hdr_scale");
mReservedUniforms.push_back("sky_sunlight_scale");
mReservedUniforms.push_back("sky_ambient_scale");
+ mReservedUniforms.push_back("classic_mode");
mReservedUniforms.push_back("blue_horizon");
mReservedUniforms.push_back("blue_density");
mReservedUniforms.push_back("haze_horizon");
diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h
index 0eb9db6715..34bd73a42e 100644
--- a/indra/llrender/llshadermgr.h
+++ b/indra/llrender/llshadermgr.h
@@ -121,6 +121,7 @@ public:
SKY_HDR_SCALE, // "sky_hdr_scale"
SKY_SUNLIGHT_SCALE, // "sky_sunlight_scale"
SKY_AMBIENT_SCALE, // "sky_ambient_scale"
+ CLASSIC_MODE, // "classic_mode"
BLUE_HORIZON, // "blue_horizon"
BLUE_DENSITY, // "blue_density"
HAZE_HORIZON, // "haze_horizon"
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index cc0329c6f8..96569a33e9 100644
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -945,9 +945,6 @@ void LLVertexBuffer::initClass(LLWindow* window)
{
llassert(sVBOPool == nullptr);
- LL_INFOS() << "VBO Pooling Disabled" << LL_ENDL;
- sVBOPool = new LLAppleVBOPool();
-
//if (gGLManager.mIsApple)
if(0)
{
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index e14ed53c07..629acba055 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -1823,6 +1823,47 @@ if (WINDOWS)
add_dependencies(${VIEWER_BINARY_NAME} stage_third_party_libs llcommon llwebrtc copy_w_viewer_manifest)
+ # Useful for remote debugging or profiling if set to target a shared drive. for example, brad sets it to "dist/secondlife" to deploy under
+ # the build tree (and then I share that directory) or "f:/dist/secondlife" to deploy to a network mounted drive (although this can be slow).
+ # this will also create an "unpacked" tarball at build-<platform>/newview/unpacked_<platform>_7_1_11_<build num>.tar
+ set(LOCAL_DIST_DIR "" CACHE PATH "Path for 'local' unpacked copy of viewer distribution to be deployed to.")
+ set(product SecondLife-${ARCH}-${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION})
+ if(IS_DIRECTORY ${LOCAL_DIST_DIR})
+ add_custom_command(
+ OUTPUT ${LOCAL_DIST_DIR}/.${product}.copy_touched
+ COMMAND ${PYTHON_EXECUTABLE}
+ ARGS
+ ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
+ "--actions=\"copy package unpacked\""
+ --arch=${ARCH}
+ --artwork=${ARTWORK_DIR}
+ "--bugsplat=${BUGSPLAT_DB}"
+ "--openal=${USE_OPENAL}"
+ "--tracy=${USE_TRACY}"
+ --build=${CMAKE_CURRENT_BINARY_DIR}
+ --buildtype=$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,${CMAKE_BUILD_TYPE}>
+ "--channel=${VIEWER_CHANNEL}"
+ --configuration=$<CONFIG>
+ --dest=${LOCAL_DIST_DIR}
+ --grid=${GRID}
+ --source=${CMAKE_CURRENT_SOURCE_DIR}
+ --versionfile=${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt
+ --touch=${LOCAL_DIST_DIR}/.${product}.copy_touched
+ DEPENDS
+ ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
+ stage_third_party_libs
+ llwebrtc
+ ${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt
+ ${COPY_INPUT_DEPENDENCIES}
+ ${VIEWER_BINARY_NAME}
+ COMMENT "Performing viewer_manifest local dist copy"
+ )
+
+ add_custom_target(copy_local_dist_viewer_manifest ALL DEPENDS ${LOCAL_DIST_DIR}/.${product}.copy_touched)
+ elseif (NOT LOCAL_DIST_DIR STREQUAL "")
+ message(FATAL_ERROR "LOCAL_DIST_DIR ${LOCAL_DIST_DIR} specified but is not valid target directory to copy viewer distribution into. Please create the directory and try again")
+ endif () # IS_DIRECTORY ${LOCAL_DIST_DIR}
+
if (EXISTS ${CMAKE_SOURCE_DIR}/copy_win_scripts)
add_dependencies(${VIEWER_BINARY_NAME} copy_win_scripts)
endif (EXISTS ${CMAKE_SOURCE_DIR}/copy_win_scripts)
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index f4c8e50e46..42ed222643 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -7783,6 +7783,17 @@
<key>Value</key>
<integer>0</integer>
</map>
+ <key>RenderEnableEmissiveBuffer</key>
+ <map>
+ <key>Comment</key>
+ <string>Enable emissive buffer in gbuffer. Should only be disabled in GL3 mode.</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>1</integer>
+ </map>
<key>RenderHDRIExposure</key>
<map>
<key>Comment</key>
@@ -7830,7 +7841,7 @@
<key>RenderMaxOpenGLVersion</key>
<map>
<key>Comment</key>
- <string>Maximum OpenGL version to attempt use (minimum 3.2 maximum 4.6). Requires restart.</string>
+ <string>Maximum OpenGL version to attempt use (minimum 3.1 maximum 4.6). Requires restart.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
@@ -9300,14 +9311,25 @@
<key>RenderSkySunlightScale</key>
<map>
<key>Comment</key>
- <string>Sunlight scale fudge factor for matching with pre-PBR viewer</string>
+ <string>Sunlight scale fudge factor for matching with pre-PBR viewer when HDR is disabled</string>
<key>Persist</key>
- <integer>1</integer>
+ <integer>0</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>1.0</real>
</map>
+ <key>RenderHDRSkySunlightScale</key>
+ <map>
+ <key>Comment</key>
+ <string>Sunlight scale fudge factor for matching with pre-PBR viewer when HDR is enabled</string>
+ <key>Persist</key>
+ <integer>0</integer>
+ <key>Type</key>
+ <string>F32</string>
+ <key>Value</key>
+ <real>1.0</real>
+ </map>
<key>RenderSkyAmbientScale</key>
<map>
<key>Comment</key>
@@ -9317,7 +9339,7 @@
<key>Type</key>
<string>F32</string>
<key>Value</key>
- <real>0.7</real>
+ <real>1.0</real>
</map>
<key>RenderReflectionProbeMaxLocalLightAmbiance</key>
@@ -16454,5 +16476,16 @@
<key>Value</key>
<integer>1</integer>
</map>
+ <key>RenderVintageMode</key>
+ <map>
+ <key>Comment</key>
+ <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>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>0</integer>
+ </map>
</map>
</llsd>
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl
index 32b768cc63..cc4cd8366c 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl
@@ -36,7 +36,7 @@ in vec2 vary_texcoord0;
in vec3 vary_position;
void mirrorClip(vec3 pos);
-vec4 encodeNormal(vec3 norm, float gbuffer_flag);
+vec4 encodeNormal(vec3 n, float env, float gbuffer_flag);
void main()
{
@@ -52,7 +52,10 @@ 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] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
+ frag_data[2] = encodeNormal(nvn.xyz, 0, GBUFFER_FLAG_HAS_ATMOS);
+
+#if defined(HAS_EMISSIVE)
frag_data[3] = vec4(0);
+#endif
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl b/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl
index 79c1b392e9..a2341a80ab 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl
@@ -40,7 +40,7 @@ in vec2 vary_texcoord0;
in vec3 vary_position;
void mirrorClip(vec3 pos);
-vec4 encodeNormal(vec3 norm, float gbuffer_flag);
+vec4 encodeNormal(vec3 n, float env, float gbuffer_flag);
void main()
{
@@ -52,18 +52,21 @@ void main()
{
discard;
}
- col *= vertex_color;
+ col *= vertex_color;
- vec3 norm = texture(bumpMap, vary_texcoord0.xy).rgb * 2.0 - 1.0;
+ vec3 norm = texture(bumpMap, vary_texcoord0.xy).rgb * 2.0 - 1.0;
- vec3 tnorm = vec3(dot(norm,vary_mat0),
- dot(norm,vary_mat1),
- dot(norm,vary_mat2));
+ vec3 tnorm = vec3(dot(norm,vary_mat0),
+ dot(norm,vary_mat1),
+ dot(norm,vary_mat2));
- frag_data[0] = vec4(col.rgb, 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(tnorm);
- frag_data[2] = encodeNormal(nvn, GBUFFER_FLAG_HAS_ATMOS);
- frag_data[3] = vec4(vertex_color.a, 0, 0, 0);
+ frag_data[0] = vec4(col.rgb, 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(tnorm);
+ frag_data[2] = encodeNormal(nvn, vertex_color.a, GBUFFER_FLAG_HAS_ATMOS);
+
+#if defined(HAS_EMISSIVE)
+ frag_data[3] = vec4(0, 0, 0, 0);
+#endif
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl
index 450d4c4c4a..8c51b4a36b 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl
@@ -114,9 +114,15 @@ void main()
color.rgb *= 2.0;
/// Gamma correct for WL (soft clip effect).
- frag_data[0] = vec4(0);
+
frag_data[1] = vec4(0.0,0.0,0.0,0.0);
frag_data[2] = vec4(0,0,0,GBUFFER_FLAG_SKIP_ATMOS);
+
+#if defined(HAS_EMISSIVE)
+ frag_data[0] = vec4(0);
frag_data[3] = vec4(color.rgb, alpha1);
+#else
+ frag_data[0] = vec4(color.rgb, alpha1);
+#endif
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
index 0e8d8d010b..86a78f3687 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
@@ -48,8 +48,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
-uniform sampler2D normalMap;
-uniform sampler2D depthMap;
+uniform sampler2D normalMap;
+uniform sampler2D depthMap;
uniform sampler2D projectionMap; // rgba
uniform sampler2D brdfLut;
@@ -62,6 +62,8 @@ uniform float proj_lod ; // (number of mips in proj map)
uniform float proj_range; // range between near clip and far clip plane of projection
uniform float proj_ambiance;
+uniform int classic_mode;
+
// light params
uniform vec3 color; // light_color
uniform float size; // light_size
@@ -73,11 +75,11 @@ const float M_PI = 3.14159265;
const float ONE_OVER_PI = 0.3183098861;
vec3 srgb_to_linear(vec3 cs);
+vec3 linear_to_srgb(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);
@@ -152,6 +154,12 @@ vec4 getNorm(vec2 screenpos)
return norm;
}
+vec4 getNormRaw(vec2 screenpos)
+{
+ vec4 norm = texture(normalMap, screenpos.xy);
+ return norm;
+}
+
// get linear depth value given a depth buffer sample d and znear and zfar values
float linearDepth(float d, float znear, float zfar)
{
@@ -352,13 +360,15 @@ vec2 BRDF(float NoV, float roughness)
}
// set colorDiffuse and colorSpec to the results of GLTF PBR style IBL
-vec3 pbrIbl(vec3 diffuseColor,
+void pbrIbl(vec3 diffuseColor,
vec3 specularColor,
vec3 radiance, // radiance map sample
vec3 irradiance, // irradiance map sample
float ao, // ambient occlusion factor
float nv, // normal dot view vector
- float perceptualRough)
+ float perceptualRough,
+ out vec3 diffuseOut,
+ out vec3 specularOut)
{
// retrieve a scale and bias to F0. See [1], Figure 3
vec2 brdf = BRDF(clamp(nv, 0.0, 1.0), 1.0-perceptualRough);
@@ -368,7 +378,8 @@ vec3 pbrIbl(vec3 diffuseColor,
vec3 diffuse = diffuseLight * diffuseColor;
vec3 specular = specularLight * (specularColor * brdf.x + brdf.y);
- return (diffuse + specular) * ao;
+ diffuseOut = diffuse * ao;
+ specularOut = specular * ao;
}
@@ -431,12 +442,15 @@ float microfacetDistribution(PBRInfo pbrInputs)
return roughnessSq / (M_PI * f * f);
}
-vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
+void pbrPunctual(vec3 diffuseColor, vec3 specularColor,
float perceptualRoughness,
float metallic,
vec3 n, // normal
vec3 v, // surface point to camera
- vec3 l) //surface point to light
+ vec3 l,
+ out float nl,
+ out vec3 diff,
+ out vec3 spec) //surface point to light
{
// make sure specular highlights from punctual lights don't fall off of polished surfaces
perceptualRoughness = max(perceptualRoughness, 8.0/255.0);
@@ -485,10 +499,11 @@ vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
// Calculation of analytical lighting contribution
vec3 diffuseContrib = (1.0 - F) * diffuse(pbrInputs);
vec3 specContrib = F * G * D / (4.0 * NdotL * NdotV);
- // Obtain final intensity as reflectance (BRDF) scaled by the energy of the light (cosine law)
- vec3 color = NdotL * (diffuseContrib + specContrib);
- return clamp(color, vec3(0), vec3(10));
+ nl = NdotL;
+
+ diff = diffuseContrib;
+ spec = specContrib;
}
vec3 pbrCalcPointLightOrSpotLight(vec3 diffuseColor, vec3 specularColor,
@@ -522,7 +537,12 @@ vec3 pbrCalcPointLightOrSpotLight(vec3 diffuseColor, vec3 specularColor,
vec3 intensity = spot_atten * dist_atten * lightColor * 3.0; //magic number to balance with legacy materials
- color = intensity*pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, lv);
+ float nl = 0;
+ vec3 diffPunc = vec3(0);
+ vec3 specPunc = vec3(0);
+
+ pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, lv, nl, diffPunc, specPunc);
+ color = intensity * clamp(nl * (diffPunc + specPunc), vec3(0), vec3(10));
}
return color;
@@ -541,10 +561,44 @@ vec3 pbrBaseLight(vec3 diffuseColor, vec3 specularColor, float metallic, vec3 v,
vec3 color = vec3(0);
float NdotV = clamp(abs(dot(norm, v)), 0.001, 1.0);
+ vec3 iblDiff = vec3(0);
+ vec3 iblSpec = vec3(0);
+ pbrIbl(diffuseColor, specularColor, radiance, irradiance, ao, NdotV, perceptualRoughness, iblDiff, iblSpec);
+
+ color += iblDiff;
+
+ // For classic mode, we use a special version of pbrPunctual that basically gives us a deconstructed form of the lighting.
+ float nl = 0;
+ vec3 diffPunc = vec3(0);
+ vec3 specPunc = vec3(0);
+ pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, norm, v, normalize(light_dir), nl, diffPunc, specPunc);
- color += pbrIbl(diffuseColor, specularColor, radiance, irradiance, ao, NdotV, perceptualRoughness);
+ // Depending on the sky, we combine these differently.
+ if (classic_mode > 0)
+ {
+ // Reconstruct the diffuse lighting that we do for blinn-phong materials here.
+ // A special note about why we do some really janky stuff for classic mode.
+ // Since adding classic mode, we've moved the lambertian diffuse multiply out from pbrPunctual and instead handle it in the different light type calcs.
+ // For classic mode, this baiscally introduces a double multiplication that we need to somehow avoid
+ // 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
+ // This will never be 100% correct, but at the very least we can make it look mostly correct with legacy skies and classic mode.
+
+ float da = pow(sqrt(nl), 1.2);
+
+ vec3 sun_contrib = vec3(min(da, scol));
+
+ // Multiply by PI to account for lambertian diffuse colors. Otherwise things will be too dark when lit by the sun on legacy skies.
+ sun_contrib = srgb_to_linear(color.rgb * 0.9 + linear_to_srgb(sun_contrib) * sunlit * 0.7) * M_PI;
+
+ // Manually recombine everything here. We have to separate the shading to ensure that lighting is able to more closely match blinn-phong.
+ color.rgb = srgb_to_linear(iblDiff) + clamp(sun_contrib * (da * (diffPunc.rgb + specPunc.rgb) * scol), vec3(0), vec3(10));
+ }
+ else
+ {
+ color += clamp(nl * (diffPunc + specPunc), vec3(0), vec3(10)) * sunlit * 3.0 * scol;
+ }
- color += pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, norm, v, normalize(light_dir)) * sunlit * 3.0 * scol; //magic number to balance with legacy materials
+ color.rgb += iblSpec.rgb;
color += colorEmissive;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl
index fadf06d592..1307ee3bcc 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl
@@ -39,7 +39,7 @@ in vec2 vary_texcoord0;
void mirrorClip(vec3 pos);
-vec4 encodeNormal(vec3 norm, float gbuffer_flag);
+vec4 encodeNormal(vec3 n, float env, float gbuffer_flag);
void main()
{
@@ -55,7 +55,10 @@ 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] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
+ frag_data[2] = encodeNormal(nvn.xyz, 0, GBUFFER_FLAG_HAS_ATMOS);
+
+#if defined(HAS_EMISSIVE)
frag_data[3] = vec4(0);
+#endif
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl
index 10d06da416..5415ee80d0 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl
@@ -36,7 +36,7 @@ in vec4 vertex_color;
in vec2 vary_texcoord0;
void mirrorClip(vec3 pos);
-vec4 encodeNormal(vec3 norm, float gbuffer_flag);
+vec4 encodeNormal(vec3 n, float env, float gbuffer_flag);
void main()
{
@@ -52,6 +52,9 @@ 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] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
+ frag_data[2] = encodeNormal(nvn.xyz, 0, GBUFFER_FLAG_HAS_ATMOS);
+
+#if defined(HAS_EMISSIVE)
frag_data[3] = vec4(0);
+#endif
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl
index f7c8fc9596..d2ef7888a3 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl
@@ -33,7 +33,7 @@ uniform sampler2D diffuseMap;
in vec3 vary_normal;
in vec2 vary_texcoord0;
-vec4 encodeNormal(vec3 norm, float gbuffer_flag);
+vec4 encodeNormal(vec3 n, float env, float gbuffer_flag);
void main()
{
@@ -47,7 +47,10 @@ 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] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
+ frag_data[2] = encodeNormal(nvn.xyz, 0, GBUFFER_FLAG_HAS_ATMOS);
+
+#if defined(HAS_EMISSIVE)
frag_data[3] = vec4(0);
+#endif
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl
index d83f5a3145..85573d3baf 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl
@@ -35,7 +35,7 @@ in vec2 vary_texcoord0;
in vec3 vary_position;
void mirrorClip(vec3 pos);
-vec4 encodeNormal(vec3 norm, float gbuffer_flag);
+vec4 encodeNormal(vec3 n, float env, float gbuffer_flag);
void main()
{
@@ -44,7 +44,10 @@ void main()
frag_data[0] = vec4(col, 0.0);
frag_data[1] = vertex_color.aaaa; // spec
vec3 nvn = normalize(vary_normal);
- frag_data[2] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
- frag_data[3] = vec4(vertex_color.a, 0, 0, 0);
+ frag_data[2] = encodeNormal(nvn.xyz, vertex_color.a, GBUFFER_FLAG_HAS_ATMOS);
+
+#if defined(HAS_EMISSIVE)
+ frag_data[3] = vec4(0, 0, 0, 0);
+#endif
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl
index 6d8943e7ae..ad4efc863b 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl
@@ -33,7 +33,7 @@ in vec2 vary_texcoord0;
in vec3 vary_position;
void mirrorClip(vec3 pos);
-vec4 encodeNormal(vec3 norm, float gbuffer_flag);
+vec4 encodeNormal(vec3 n, float env, float gbuffer_flag);
vec3 linear_to_srgb(vec3 c);
@@ -48,6 +48,9 @@ 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] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
- frag_data[3] = vec4(vertex_color.a, 0, 0, 0);
+ frag_data[2] = encodeNormal(nvn.xyz, vertex_color.a, GBUFFER_FLAG_HAS_ATMOS);
+
+#if defined(HAS_EMISSIVE)
+ frag_data[3] = vec4(0, 0, 0, 0);
+#endif
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/exposureF.glsl b/indra/newview/app_settings/shaders/class1/deferred/exposureF.glsl
index 67890032df..e4d89827f1 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/exposureF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/exposureF.glsl
@@ -35,7 +35,8 @@ uniform sampler2D exposureMap;
uniform float dt;
uniform vec2 noiseVec;
-uniform vec3 dynamic_exposure_params;
+uniform vec4 dynamic_exposure_params;
+uniform vec4 dynamic_exposure_params2;
float lum(vec3 col)
{
@@ -53,11 +54,11 @@ void main()
L /= max_L;
L = pow(L, 2.0);
float s = mix(dynamic_exposure_params.z, dynamic_exposure_params.y, L);
-
#ifdef USE_LAST_EXPOSURE
float prev = texture(exposureMap, vec2(0.5,0.5)).r;
- s = mix(prev, s, min(dt*2.0*abs(prev-s), 0.04));
+ float speed = -log(dynamic_exposure_params.w) / dynamic_exposure_params2.w;
+ s = mix(prev, s, 1 - exp(-speed * dt));
#endif
frag_color = max(vec4(s, s, s, dt), vec4(0.0));
diff --git a/indra/newview/app_settings/shaders/class1/deferred/gbufferUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/gbufferUtil.glsl
new file mode 100644
index 0000000000..1ccc6e9fbc
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/deferred/gbufferUtil.glsl
@@ -0,0 +1,59 @@
+/**
+ * @file class1/deferred/gbufferUtil.glsl
+ *
+ * $LicenseInfo:firstyear=2024&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+uniform sampler2D diffuseRect;
+uniform sampler2D specularRect;
+
+#if defined(HAS_EMISSIVE)
+uniform sampler2D emissiveRect;
+#endif
+
+vec4 getNormRaw(vec2 screenpos);
+vec4 decodeNormal(vec4 norm);
+
+GBufferInfo getGBuffer(vec2 screenpos)
+{
+ GBufferInfo ret;
+ vec4 diffInfo = vec4(0);
+ vec4 specInfo = vec4(0);
+ vec4 emissInfo = vec4(0);
+
+ diffInfo = texture(diffuseRect, screenpos.xy);
+ specInfo = texture(specularRect, screenpos.xy);
+ vec4 normInfo = getNormRaw(screenpos);
+
+#if defined(HAS_EMISSIVE)
+ emissInfo = texture(emissiveRect, screenpos.xy);
+#endif
+
+ ret.albedo = diffInfo;
+ ret.normal = decodeNormal(normInfo).xyz;
+ ret.specular = specInfo;
+ ret.envIntensity = normInfo.b;
+ ret.gbufferFlag = normInfo.w;
+ ret.emissive = emissInfo;
+
+ return ret;
+}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/globalF.glsl b/indra/newview/app_settings/shaders/class1/deferred/globalF.glsl
index 16120508d5..9060d358cf 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/globalF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/globalF.glsl
@@ -43,15 +43,19 @@ void mirrorClip(vec3 pos)
}
}
-vec4 encodeNormal(vec3 norm, float gbuffer_flag)
+vec4 encodeNormal(vec3 n, float env, float gbuffer_flag)
{
- return vec4(norm * 0.5 + 0.5, gbuffer_flag);
+ float f = sqrt(8 * n.z + 8);
+ return vec4(n.xy / f + 0.5, env, gbuffer_flag);
}
vec4 decodeNormal(vec4 norm)
{
- norm.xyz = norm.xyz * 2.0 - 1.0;
- return norm;
+ vec2 fenc = norm.xy*4-2;
+ float f = dot(fenc,fenc);
+ float g = sqrt(1-f/4);
+ vec4 n;
+ n.xy = fenc*g;
+ n.z = 1-f/2;
+ return n;
}
-
-
diff --git a/indra/newview/app_settings/shaders/class1/deferred/highlightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/highlightF.glsl
index 5c09950712..ca8c4caf16 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/highlightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/highlightF.glsl
@@ -35,5 +35,8 @@ void main()
frag_data[0] = color*texture(diffuseMap, vary_texcoord0.xy);
frag_data[1] = vec4(0.0);
frag_data[2] = vec4(0.0, 1.0, 0.0, GBUFFER_FLAG_SKIP_ATMOS);
+
+#if defined(HAS_EMISSIVE)
frag_data[3] = vec4(0);
+#endif
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl
index a6bca68cb0..9493afcc5e 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl
@@ -38,7 +38,7 @@ in vec2 vary_texcoord0;
vec3 linear_to_srgb(vec3 c);
-vec4 encodeNormal(vec3 norm, float gbuffer_flag);
+vec4 encodeNormal(vec3 n, float env, float gbuffer_flag);
void main()
{
@@ -55,5 +55,8 @@ void main()
frag_data[0] = vec4(col.rgb, 0.0);
frag_data[1] = spec;
frag_data[2] = vec4(norm.xyz, GBUFFER_FLAG_HAS_ATMOS);
+
+#if defined(HAS_EMISSIVE)
frag_data[3] = vec4(0);
+#endif
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl b/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl
index 3432bf07ef..4acab159cb 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl
@@ -51,8 +51,8 @@ void main()
vec4 norm = texture(normalMap, tc);
- if (!GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_HDRI) &&
- !GET_GBUFFER_FLAG(GBUFFER_FLAG_SKIP_ATMOS))
+ if (!GET_GBUFFER_FLAG(norm.w, GBUFFER_FLAG_HAS_HDRI) &&
+ !GET_GBUFFER_FLAG(norm.w, GBUFFER_FLAG_SKIP_ATMOS))
{
// Apply the diffuse luminance scale to objects but not the sky
// Prevents underexposing when looking at bright environments
diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
index c23729ef30..855fe69693 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
@@ -44,7 +44,9 @@ void main()
frag_data[0] = vec4(0.5, 0, 1, 0); // gbuffer is sRGB for legacy materials
frag_data[1] = vec4(0); // XYZ = Specular color. W = Specular exponent.
frag_data[2] = vec4(0); // XY = Normal. Z = Env. intensity. W = 1 skip atmos (mask off fog)
+#if defined(HAS_EMISSIVE)
frag_data[3] = vec4(0);
#endif
+#endif
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl
index 585de99e1d..29b4aafc03 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl
@@ -56,7 +56,13 @@ void main()
frag_data[0] = vec4(0);
frag_data[1] = vec4(0.0);
frag_data[2] = vec4(0.0, 0.0, 0.0, GBUFFER_FLAG_SKIP_ATMOS);
+
+#if defined(HAS_EMISSIVE)
+ frag_data[0] = vec4(0);
frag_data[3] = vec4(c.rgb, c.a);
+#else
+ frag_data[0] = vec4(c.rgb, c.a);
+#endif
// Added and commented out for a ground truth. Do not uncomment - Geenz
//gl_FragDepth = 0.999985f;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl
index c0d4c387af..dd9e883fdf 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl
@@ -61,7 +61,7 @@ uniform vec4 clipPlane;
uniform float clipSign;
void mirrorClip(vec3 pos);
-vec4 encodeNormal(vec3 norm, float gbuffer_flag);
+vec4 encodeNormal(vec3 n, float env, float gbuffer_flag);
uniform mat3 normal_matrix;
@@ -114,8 +114,11 @@ 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] = encodeNormal(tnorm, GBUFFER_FLAG_HAS_PBR); // normal, environment intensity, flags
+ frag_data[2] = encodeNormal(tnorm, 0, GBUFFER_FLAG_HAS_PBR); // normal, environment intensity, flags
+
+#if defined(HAS_EMISSIVE)
frag_data[3] = max(vec4(emissive,0), vec4(0)); // PBR sRGB Emissive
+#endif
}
#else
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbrterrainF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbrterrainF.glsl
index b434479511..1b90cf9fde 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pbrterrainF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pbrterrainF.glsl
@@ -162,7 +162,7 @@ in vec4[2] vary_coords;
#endif
void mirrorClip(vec3 position);
-vec4 encodeNormal(vec3 norm, float gbuffer_flag);
+vec4 encodeNormal(vec3 n, float env, float gbuffer_flag);
float terrain_mix(TerrainMix tm, vec4 tms4);
@@ -430,7 +430,10 @@ 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] = encodeNormal(tnorm, GBUFFER_FLAG_HAS_PBR); // normal, flags
+ frag_data[2] = encodeNormal(tnorm, 0, GBUFFER_FLAG_HAS_PBR); // normal, flags
+
+#if defined(HAS_EMISSIVE)
frag_data[3] = max(vec4(mix_emissive,0), vec4(0)); // PBR sRGB Emissive
+#endif
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl
index 6791fe44d9..e77e972873 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl
@@ -25,7 +25,7 @@
// debug stub
-float random (vec2 uv)
+float random (vec2 uv)
{
return 0.f;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
index 41e42b5173..7639a5e6fc 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
@@ -117,8 +117,13 @@ void main()
frag_data[2] = vec4(0.0,0.0,0.0,GBUFFER_FLAG_SKIP_ATMOS);
}
- frag_data[0] = vec4(0);
frag_data[1] = vec4(0);
+
+#if defined(HAS_EMISSIVE)
+ frag_data[0] = vec4(0);
frag_data[3] = vec4(color.rgb, 1.0);
+#else
+ frag_data[0] = vec4(color.rgb, 1.0);
+#endif
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl
index 6f45adc68d..dac272c686 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl
@@ -58,9 +58,14 @@ void main()
col.a = (col.a * factor) * 32.0f;
col.a *= twinkle();
- frag_data[0] = vec4(0);
frag_data[1] = vec4(0.0f);
frag_data[2] = vec4(0.0, 1.0, 0.0, GBUFFER_FLAG_SKIP_ATMOS);
+
+#if defined(HAS_EMISSIVE)
+ frag_data[0] = vec4(0);
frag_data[3] = col;
+#else
+ frag_data[0] = col;
+#endif
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl
index e3441add35..6dce67d2c5 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl
@@ -48,6 +48,11 @@ void main()
frag_data[0] = vec4(0);
frag_data[1] = vec4(0.0f);
frag_data[2] = vec4(0.0, 1.0, 0.0, GBUFFER_FLAG_SKIP_ATMOS);
+#if defined(HAS_EMISSIVE)
+ frag_data[0] = vec4(0);
frag_data[3] = c;
+#else
+ frag_data[0] = c;
+#endif
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl b/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl
index 5ff84b5937..ff6f1c0ba3 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl
@@ -39,7 +39,7 @@ in vec4 vary_texcoord0;
in vec4 vary_texcoord1;
void mirrorClip(vec3 position);
-vec4 encodeNormal(vec3 norm, float gbuffer_flag);
+vec4 encodeNormal(vec3 n, float env, float gbuffer_flag);
void main()
{
@@ -61,7 +61,10 @@ 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] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
+ frag_data[2] = encodeNormal(nvn.xyz, 0, GBUFFER_FLAG_HAS_ATMOS);
+
+#if defined(HAS_EMISSIVE)
frag_data[3] = vec4(0);
+#endif
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl
index 0894eff660..a96c8bada5 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl
@@ -37,7 +37,7 @@ in vec3 vary_position;
uniform float minimum_alpha;
void mirrorClip(vec3 pos);
-vec4 encodeNormal(vec3 norm, float gbuffer_flag);
+vec4 encodeNormal(vec3 n, float env, float gbuffer_flag);
void main()
{
@@ -51,6 +51,9 @@ 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] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
+ frag_data[2] = encodeNormal(nvn.xyz, 0, GBUFFER_FLAG_HAS_ATMOS);
+
+#if defined(HAS_EMISSIVE)
frag_data[3] = vec4(0);
+#endif
}
diff --git a/indra/newview/app_settings/shaders/class1/gltf/pbrmetallicroughnessF.glsl b/indra/newview/app_settings/shaders/class1/gltf/pbrmetallicroughnessF.glsl
index 1d8a92bac7..daab7c1911 100644
--- a/indra/newview/app_settings/shaders/class1/gltf/pbrmetallicroughnessF.glsl
+++ b/indra/newview/app_settings/shaders/class1/gltf/pbrmetallicroughnessF.glsl
@@ -64,7 +64,7 @@ in vec2 base_color_uv;
in vec2 emissive_uv;
void mirrorClip(vec3 pos);
-vec4 encodeNormal(vec3 norm, float gbuffer_flag);
+vec4 encodeNormal(vec3 n, float env, float gbuffer_flag);
vec3 linear_to_srgb(vec3 c);
vec3 srgb_to_linear(vec3 c);
@@ -243,8 +243,11 @@ 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] = encodeNormal(norm, GBUFFER_FLAG_HAS_PBR);
+ frag_data[2] = encodeNormal(norm, 0, GBUFFER_FLAG_HAS_PBR);
+
+//#if defined(HAS_EMISSIVE)
frag_data[3] = max(vec4(emissive,0), vec4(0));
+//#endif
#endif
#endif
diff --git a/indra/newview/app_settings/shaders/class1/gltf/pbrmetallicroughnessV.glsl b/indra/newview/app_settings/shaders/class1/gltf/pbrmetallicroughnessV.glsl
index 6a628bc852..f55b83d056 100644
--- a/indra/newview/app_settings/shaders/class1/gltf/pbrmetallicroughnessV.glsl
+++ b/indra/newview/app_settings/shaders/class1/gltf/pbrmetallicroughnessV.glsl
@@ -197,7 +197,7 @@ out vec3 vary_fragcoord;
layout (std140) uniform GLTFJoints
{
- mat3x4 gltf_joints[MAX_NODES_PER_GLTF_OBJECT];
+ vec4 gltf_joints[MAX_NODES_PER_GLTF_OBJECT];
};
@@ -210,27 +210,22 @@ mat4 getGLTFTransform()
vec4 w = weight4;
- uint i1 = joint.x;
- uint i2 = joint.y;
- uint i3 = joint.z;
- uint i4 = joint.w;
+ uint i1 = joint.x*3u;
+ uint i2 = joint.y*3u;
+ uint i3 = joint.z*3u;
+ uint i4 = joint.w*3u;
- mat3 mat = mat3(gltf_joints[i1])*w.x;
- mat += mat3(gltf_joints[i2])*w.y;
- mat += mat3(gltf_joints[i3])*w.z;
- mat += mat3(gltf_joints[i4])*w.w;
-
- vec3 trans = vec3(gltf_joints[i1][0].w,gltf_joints[i1][1].w,gltf_joints[i1][2].w)*w.x;
- trans += vec3(gltf_joints[i2][0].w,gltf_joints[i2][1].w,gltf_joints[i2][2].w)*w.y;
- trans += vec3(gltf_joints[i3][0].w,gltf_joints[i3][1].w,gltf_joints[i3][2].w)*w.z;
- trans += vec3(gltf_joints[i4][0].w,gltf_joints[i4][1].w,gltf_joints[i4][2].w)*w.w;
+ // lerp the joints
+ vec4 v0 = gltf_joints[i1+0u] * w.x + gltf_joints[i2+0u] * w.y + gltf_joints[i3+0u] * w.z + gltf_joints[i4+0u] * w.w;
+ vec4 v1 = gltf_joints[i1+1u] * w.x + gltf_joints[i2+1u] * w.y + gltf_joints[i3+1u] * w.z + gltf_joints[i4+1u] * w.w;
+ vec4 v2 = gltf_joints[i1+2u] * w.x + gltf_joints[i2+2u] * w.y + gltf_joints[i3+2u] * w.z + gltf_joints[i4+2u] * w.w;
+ //unpack into return matrix
mat4 ret;
-
- ret[0] = vec4(mat[0], 0);
- ret[1] = vec4(mat[1], 0);
- ret[2] = vec4(mat[2], 0);
- ret[3] = vec4(trans, 1.0);
+ ret[0] = vec4(v0.xyz, 0);
+ ret[1] = vec4(v1.xyz, 0);
+ ret[2] = vec4(v2.xyz, 0);
+ ret[3] = vec4(v0.w, v1.w, v2.w, 1.0);
return ret;
}
@@ -239,7 +234,7 @@ mat4 getGLTFTransform()
layout (std140) uniform GLTFNodes
{
- mat3x4 gltf_nodes[MAX_NODES_PER_GLTF_OBJECT];
+ vec4 gltf_nodes[MAX_NODES_PER_GLTF_OBJECT];
};
uniform int gltf_node_id = 0;
@@ -247,13 +242,17 @@ uniform int gltf_node_id = 0;
mat4 getGLTFTransform()
{
mat4 ret;
- mat3x4 src = gltf_nodes[gltf_node_id];
+ int idx = gltf_node_id*3;
+
+ vec4 src0 = gltf_nodes[idx+0];
+ vec4 src1 = gltf_nodes[idx+1];
+ vec4 src2 = gltf_nodes[idx+2];
- ret[0] = vec4(src[0].xyz, 0);
- ret[1] = vec4(src[1].xyz, 0);
- ret[2] = vec4(src[2].xyz, 0);
+ ret[0] = vec4(src0.xyz, 0);
+ ret[1] = vec4(src1.xyz, 0);
+ ret[2] = vec4(src2.xyz, 0);
- ret[3] = vec4(src[0].w, src[1].w, src[2].w, 1);
+ ret[3] = vec4(src0.w, src1.w, src2.w, 1);
return ret;
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/occlusionF.glsl b/indra/newview/app_settings/shaders/class1/interface/occlusionF.glsl
index ee821d3884..b63dba3cc9 100644
--- a/indra/newview/app_settings/shaders/class1/interface/occlusionF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/occlusionF.glsl
@@ -31,5 +31,8 @@ void main()
frag_data[0] = vec4(0, 0, 0, 0);
frag_data[1] = vec4(0, 0, 0, 0);
frag_data[2] = vec4(1, 0, 0, GBUFFER_FLAG_HAS_PBR);
+
+#if defined(HAS_EMISSIVE)
frag_data[3] = vec4(1, 0, 0, 0);
+#endif
}
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
index af10ecce9a..02108a9ec1 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
@@ -41,6 +41,7 @@ uniform float scene_light_strength;
uniform float sun_moon_glow_factor;
uniform float sky_sunlight_scale;
uniform float sky_ambient_scale;
+uniform int classic_mode;
float getAmbientClamp() { return 1.0f; }
@@ -121,7 +122,7 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou
// brightness of surface both sunlight and ambient
sunlit = sunlight.rgb;
- amblit = tmpAmbient;
+ amblit = pow(tmpAmbient.rgb, vec3(0.9)) * 0.57;
additive *= vec3(1.0 - combined_haze);
@@ -142,18 +143,22 @@ float ambientLighting(vec3 norm, vec3 light_dir)
return ambient;
}
-
// return lit amblit in linear space, leave sunlit and additive in sRGB space
void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, out vec3 sunlit, out vec3 amblit, out vec3 additive,
out vec3 atten)
{
calcAtmosphericVars(inPositionEye, light_dir, 1.0, sunlit, amblit, additive, atten);
+ amblit *= ambientLighting(norm, light_dir);
+
+ if (classic_mode < 1)
+ {
+ amblit = srgb_to_linear(amblit);
+ sunlit = srgb_to_linear(sunlit);
+ }
+
// multiply to get similar colors as when the "scaleSoftClip" implementation was doubling color values
// (allows for mixing of light sources other than sunlight e.g. reflection probes)
sunlit *= sky_sunlight_scale;
amblit *= sky_ambient_scale;
-
- amblit = srgb_to_linear(amblit);
- amblit *= ambientLighting(norm, light_dir);
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
index f4a8051427..95110005dc 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
@@ -111,13 +111,6 @@ vec3 pbrBaseLight(vec3 diffuseColor,
vec3 additive,
vec3 atten);
-vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
- float perceptualRoughness,
- float metallic,
- vec3 n, // normal
- vec3 v, // surface point to camera
- vec3 l); //surface point to light
-
vec3 pbrCalcPointLightOrSpotLight(vec3 diffuseColor, vec3 specularColor,
float perceptualRoughness,
float metallic,
diff --git a/indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl
index 35848ff4cd..2657b2b54e 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl
@@ -32,12 +32,13 @@ uniform samplerCube environmentMap;
uniform mat3 env_mat;
vec3 srgb_to_linear(vec3 c);
+vec3 linear_to_srgb(vec3 c);
void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv,
vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent, vec3 amblit_linear)
{
- ambenv = vec3(reflection_probe_ambiance * 0.25);
-
+ ambenv = mix(ambenv, vec3(reflection_probe_ambiance * 0.25), reflection_probe_ambiance);
+
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
vec3 env_vec = env_mat * refnormpersp;
glossenv = srgb_to_linear(texture(environmentMap, env_vec).rgb);
@@ -58,23 +59,23 @@ vec4 sampleReflectionProbesDebug(vec3 pos)
void sampleReflectionProbesLegacy(out vec3 ambenv, out vec3 glossenv, out vec3 legacyenv,
vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent, vec3 amblit_linear)
{
- ambenv = vec3(reflection_probe_ambiance * 0.25);
-
+ ambenv = mix(ambenv, vec3(reflection_probe_ambiance * 0.25), reflection_probe_ambiance);
+
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
vec3 env_vec = env_mat * refnormpersp;
- legacyenv = srgb_to_linear(texture(environmentMap, env_vec).rgb);
+ legacyenv = texture(environmentMap, env_vec).rgb;
glossenv = legacyenv;
}
void applyGlossEnv(inout vec3 color, vec3 glossenv, vec4 spec, vec3 pos, vec3 norm)
{
-
+
}
void applyLegacyEnv(inout vec3 color, vec3 legacyenv, vec4 spec, vec3 pos, vec3 norm, float envIntensity)
{
- color = mix(color.rgb, legacyenv*1.5, envIntensity);
+ color = srgb_to_linear(mix(linear_to_srgb(color.rgb), legacyenv*2.0, envIntensity));
}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/hazeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/hazeF.glsl
index 7b82aa1a0d..487db0a6ae 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/hazeF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/hazeF.glsl
@@ -64,8 +64,6 @@ void main()
calcAtmosphericVarsLinear(pos.xyz, norm.xyz, light_dir, sunlit, amblit, additive, atten);
- vec3 sunlit_linear = srgb_to_linear(sunlit);
-
// mask off atmospherics below water (when camera is under water)
bool do_atmospherics = false;
diff --git a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl
index fb541ab51d..140bd731ff 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl
@@ -51,7 +51,7 @@ uniform mat3 normal_matrix;
in vec3 vary_position;
void mirrorClip(vec3 pos);
-vec4 encodeNormal(vec3 norm, float gbuffer_flag);
+vec4 encodeNormal(vec3 n, float env, float gbuffer_flag);
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
@@ -415,8 +415,11 @@ 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] = encodeNormal(norm, flag); // XY = Normal. Z = Env. intensity. W = 1 skip atmos (mask off fog)
- frag_data[3] = vec4(env, 0, 0, 0);
+ frag_data[2] = encodeNormal(norm, env, flag); // XY = Normal. Z = Env. intensity. W = 1 skip atmos (mask off fog)
+
+#if defined(HAS_EMISSIVE)
+ frag_data[3] = vec4(0, 0, 0, 0);
+#endif
#endif
}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl
index 4ed778371f..8db3bcd363 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl
@@ -27,9 +27,6 @@
out vec4 frag_color;
-uniform sampler2D diffuseRect;
-uniform sampler2D specularRect;
-uniform sampler2D emissiveRect; // PBR linear packed Occlusion, Roughness, Metal. See: pbropaqueF.glsl
uniform sampler2D lightFunc;
uniform vec3 env_mat[3];
@@ -55,13 +52,17 @@ vec3 srgb_to_linear(vec3 c);
// Util
vec3 hue_to_rgb(float hue);
-vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
+void pbrPunctual(vec3 diffuseColor, vec3 specularColor,
float perceptualRoughness,
float metallic,
vec3 n, // normal
vec3 v, // surface point to camera
- vec3 l); //surface point to light
+ vec3 l, // surface point to light
+ out float nl,
+ out vec3 diff,
+ out vec3 spec);
+GBufferInfo getGBuffer(vec2 screenpos);
void main()
{
@@ -73,18 +74,19 @@ void main()
discard;
}
- vec4 norm = getNorm(tc); // need `norm.w` for GET_GBUFFER_FLAG()
- vec3 n = norm.xyz;
+ GBufferInfo gb = getGBuffer(tc);
- vec4 spec = texture(specularRect, tc);
- vec3 diffuse = texture(diffuseRect, tc).rgb;
+ vec3 n = gb.normal;
+
+ vec4 spec = gb.specular;
+ vec3 diffuse = gb.albedo.rgb;
vec3 h, l, v = -normalize(pos);
float nh, nv, vh, lightDist;
- if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR))
+ if (GET_GBUFFER_FLAG(gb.gbufferFlag, GBUFFER_FLAG_HAS_PBR))
{
- vec3 colorEmissive = texture(emissiveRect, tc).rgb;
+ vec3 colorEmissive = gb.emissive.rgb;
vec3 orm = spec.rgb;
float perceptualRoughness = orm.g;
float metallic = orm.b;
@@ -113,8 +115,11 @@ void main()
float dist_atten = calcLegacyDistanceAttenuation(dist, falloff);
vec3 intensity = dist_atten * lightColor * 3.25;
-
- final_color += intensity*pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, lv);
+ float nl = 0;
+ vec3 diff = vec3(0);
+ vec3 specPunc = vec3(0);
+ pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, lv, nl, diff, specPunc);
+ final_color += intensity * clamp(nl * (diff + specPunc), vec3(0), vec3(10));
}
}
}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl
index 6c13757149..987089fcc9 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl
@@ -27,9 +27,6 @@
out vec4 frag_color;
-uniform sampler2D diffuseRect;
-uniform sampler2D specularRect;
-uniform sampler2D emissiveRect; // PBR linear packed Occlusion, Roughness, Metal. See: pbropaqueF.glsl
uniform sampler2D lightFunc;
uniform vec3 env_mat[3];
@@ -57,24 +54,29 @@ vec2 getScreenCoord(vec4 clip);
vec3 srgb_to_linear(vec3 c);
float getDepth(vec2 tc);
-vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
+void pbrPunctual(vec3 diffuseColor, vec3 specularColor,
float perceptualRoughness,
float metallic,
vec3 n, // normal
vec3 v, // surface point to camera
- vec3 l); //surface point to light
+ vec3 l, // surface point to light
+ out float nl,
+ out vec3 diff,
+ out vec3 spec);
+
+GBufferInfo getGBuffer(vec2 screenpos);
void main()
{
vec3 final_color = vec3(0);
vec2 tc = getScreenCoord(vary_fragcoord);
vec3 pos = getPosition(tc).xyz;
+ GBufferInfo gb = getGBuffer(tc);
- vec4 norm = getNorm(tc); // need `norm.w` for GET_GBUFFER_FLAG()
- vec3 n = norm.xyz;
+ vec3 n = gb.normal;
- vec3 diffuse = texture(diffuseRect, tc).rgb;
- vec4 spec = texture(specularRect, tc);
+ vec3 diffuse = gb.albedo.rgb;
+ vec4 spec = gb.specular;
// Common half vectors calcs
vec3 lv = trans_center.xyz-pos;
@@ -89,9 +91,9 @@ void main()
float dist = lightDist / size;
float dist_atten = calcLegacyDistanceAttenuation(dist, falloff);
- if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR))
+ if (GET_GBUFFER_FLAG(gb.gbufferFlag, GBUFFER_FLAG_HAS_PBR))
{
- vec3 colorEmissive = texture(emissiveRect, tc).rgb;
+ vec3 colorEmissive = gb.emissive.rgb;
vec3 orm = spec.rgb;
float perceptualRoughness = orm.g;
float metallic = orm.b;
@@ -104,7 +106,14 @@ void main()
vec3 specularColor = mix(f0, baseColor.rgb, metallic);
vec3 intensity = dist_atten * color * 3.25; // Legacy attenuation, magic number to balance with legacy materials
- final_color += intensity*pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, normalize(lv));
+
+ float nl = 0;
+ vec3 diffPunc = vec3(0);
+ vec3 specPunc = vec3(0);
+
+ pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, normalize(lv), nl, diffPunc, specPunc);
+
+ final_color += intensity* clamp(nl * (diffPunc + specPunc), vec3(0), vec3(10));
}
else
{
diff --git a/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostF.glsl b/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostF.glsl
index dc135243a6..5eda28bd8a 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostF.glsl
@@ -66,7 +66,7 @@ void main()
vec4 fcol = texture(diffuseMap, tc);
- if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR))
+ if (GET_GBUFFER_FLAG(norm.w, GBUFFER_FLAG_HAS_PBR))
{
vec3 orm = specCol.rgb;
float perceptualRoughness = orm.g;
diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
index 802d049e74..ae6c23be05 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
@@ -23,16 +23,12 @@
* $/LicenseInfo$
*/
+/*[EXTRA_CODE_HERE]*/
+
#define FLT_MAX 3.402823466e+38
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
-
const float M_PI = 3.14159265;
#if defined(HAS_SUN_SHADOW) || defined(HAS_SSAO)
@@ -56,6 +52,8 @@ uniform mat3 ssao_effect_mat;
uniform vec3 sun_dir;
uniform vec3 moon_dir;
uniform int sun_up_factor;
+uniform int classic_mode;
+
in vec2 vary_fragcoord;
uniform mat4 inv_proj;
@@ -105,13 +103,7 @@ vec3 pbrBaseLight(vec3 diffuseColor,
vec3 additive,
vec3 atten);
-vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
- float perceptualRoughness,
- float metallic,
- vec3 n, // normal
- vec3 v, // surface point to camera
- vec3 l); //surface point to light
-
+GBufferInfo getGBuffer(vec2 screenpos);
void adjustIrradiance(inout vec3 irradiance, float ambocc)
{
@@ -128,13 +120,15 @@ void main()
vec2 tc = vary_fragcoord.xy;
float depth = getDepth(tc.xy);
vec4 pos = getPositionWithDepth(tc, depth);
- vec4 norm = getNorm(tc);
- vec3 colorEmissive = texture(emissiveRect, tc).rgb;
- float envIntensity = colorEmissive.r;
+
+ GBufferInfo gb = getGBuffer(tc);
+
+ vec3 colorEmissive = gb.emissive.rgb;
+ float envIntensity = gb.envIntensity;
vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir;
- vec4 baseColor = texture(diffuseRect, tc);
- vec4 spec = texture(specularRect, tc); // NOTE: PBR linear Emissive
+ vec4 baseColor = gb.albedo;
+ vec4 spec = gb.specular; // NOTE: PBR linear Emissive
#if defined(HAS_SUN_SHADOW) || defined(HAS_SSAO)
vec2 scol_ambocc = texture(lightMap, vary_fragcoord.xy).rg;
@@ -159,26 +153,26 @@ void main()
vec3 additive;
vec3 atten;
- calcAtmosphericVarsLinear(pos.xyz, norm.xyz, light_dir, sunlit, amblit, additive, atten);
+ calcAtmosphericVarsLinear(pos.xyz, gb.normal, light_dir, sunlit, amblit, additive, atten);
- vec3 sunlit_linear = srgb_to_linear(sunlit);
+ vec3 sunlit_linear = sunlit;
vec3 amblit_linear = amblit;
- vec3 irradiance = vec3(0);
vec3 radiance = vec3(0);
- if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR))
+ if (GET_GBUFFER_FLAG(gb.gbufferFlag, GBUFFER_FLAG_HAS_PBR))
{
vec3 orm = spec.rgb;
float perceptualRoughness = orm.g;
float metallic = orm.b;
float ao = orm.r;
+ vec3 irradiance = amblit_linear;
// PBR IBL
float gloss = 1.0 - perceptualRoughness;
- sampleReflectionProbes(irradiance, radiance, tc, pos.xyz, norm.xyz, gloss, false, amblit_linear);
+ sampleReflectionProbes(irradiance, radiance, tc, pos.xyz, gb.normal, gloss, false, amblit_linear);
adjustIrradiance(irradiance, ambocc);
@@ -187,17 +181,21 @@ void main()
calcDiffuseSpecular(baseColor.rgb, metallic, diffuseColor, specularColor);
vec3 v = -normalize(pos.xyz);
- color = pbrBaseLight(diffuseColor, specularColor, metallic, v, norm.xyz, perceptualRoughness, light_dir, sunlit_linear, scol, radiance, irradiance, colorEmissive, ao, additive, atten);
+ color = pbrBaseLight(diffuseColor, specularColor, metallic, v, gb.normal, perceptualRoughness, light_dir, sunlit_linear, scol, radiance, irradiance, colorEmissive, ao, additive, atten);
}
- else if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_HDRI))
+ else if (GET_GBUFFER_FLAG(gb.gbufferFlag, GBUFFER_FLAG_HAS_HDRI))
{
// actual HDRI sky, just copy color value
color = colorEmissive.rgb;
}
- else if (GET_GBUFFER_FLAG(GBUFFER_FLAG_SKIP_ATMOS))
+ else if (GET_GBUFFER_FLAG(gb.gbufferFlag, GBUFFER_FLAG_SKIP_ATMOS))
{
//should only be true of WL sky, port over base color value and scale for fake HDR
+#if defined(HAS_EMISSIVE)
color = colorEmissive.rgb;
+#else
+ color = baseColor.rgb;
+#endif
color = srgb_to_linear(color);
color *= sky_hdr_scale;
}
@@ -208,31 +206,43 @@ void main()
spec.rgb = srgb_to_linear(spec.rgb);
- float da = clamp(dot(norm.xyz, light_dir.xyz), 0.0, 1.0);
+ float da = clamp(dot(gb.normal, light_dir.xyz), 0.0, 1.0);
- vec3 irradiance = vec3(0);
+ vec3 irradiance = amblit;
vec3 glossenv = vec3(0);
vec3 legacyenv = vec3(0);
- sampleReflectionProbesLegacy(irradiance, glossenv, legacyenv, tc, pos.xyz, norm.xyz, spec.a, envIntensity, false, amblit_linear);
+ sampleReflectionProbesLegacy(irradiance, glossenv, legacyenv, tc, pos.xyz, gb.normal, spec.a, envIntensity, false, amblit_linear);
adjustIrradiance(irradiance, ambocc);
// apply lambertian IBL only (see pbrIbl)
color.rgb = irradiance;
- vec3 sun_contrib = min(da, scol) * sunlit_linear;
- color.rgb += sun_contrib;
+ if (classic_mode > 0)
+ {
+ da = pow(da,1.2);
+ vec3 sun_contrib = vec3(min(da, scol));
+
+ color.rgb = srgb_to_linear(color.rgb * 0.9 + linear_to_srgb(sun_contrib) * sunlit_linear * 0.7);
+ sunlit_linear = srgb_to_linear(sunlit_linear);
+ }
+ else
+ {
+ vec3 sun_contrib = min(da, scol) * sunlit_linear;
+ color.rgb += sun_contrib;
+ }
+
color.rgb *= baseColor.rgb;
- vec3 refnormpersp = reflect(pos.xyz, norm.xyz);
+ vec3 refnormpersp = reflect(pos.xyz, gb.normal);
if (spec.a > 0.0)
{
vec3 lv = light_dir.xyz;
vec3 h, l, v = -normalize(pos.xyz);
float nh, nl, nv, vh, lightDist;
- vec3 n = norm.xyz;
+ vec3 n = gb.normal;
calcHalfVectors(lv, n, v, h, l, nh, nl, nv, vh, lightDist);
if (nl > 0.0 && nh > 0.0)
@@ -249,7 +259,7 @@ void main()
}
// add radiance map
- applyGlossEnv(color, glossenv, spec, pos.xyz, norm.xyz);
+ applyGlossEnv(color, glossenv, spec, pos.xyz, gb.normal);
}
@@ -257,10 +267,11 @@ void main()
if (envIntensity > 0.0)
{ // add environment map
- applyLegacyEnv(color, legacyenv, spec, pos.xyz, norm.xyz, envIntensity);
+ applyLegacyEnv(color, legacyenv, spec, pos.xyz, gb.normal, envIntensity);
}
}
+ //color.r = classic_mode > 0 ? 1.0 : 0.0;
frag_color.rgb = max(color.rgb, vec3(0)); //output linear since local lights will be added to this shader's results
frag_color.a = 0.0;
}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl
index bc4d36d10d..78db8ccf5b 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl
@@ -27,9 +27,6 @@
out vec4 frag_color;
-uniform sampler2D diffuseRect;
-uniform sampler2D specularRect;
-uniform sampler2D emissiveRect; // PBR linear packed Occlusion, Roughness, Metal. See: pbropaqueF.glsl
uniform samplerCube environmentMap;
uniform sampler2D lightMap;
uniform sampler2D lightFunc;
@@ -80,12 +77,17 @@ vec4 getPosition(vec2 pos_screen);
const float M_PI = 3.14159265;
-vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
+void pbrPunctual(vec3 diffuseColor, vec3 specularColor,
float perceptualRoughness,
float metallic,
vec3 n, // normal
vec3 v, // surface point to camera
- vec3 l); //surface point to light
+ vec3 l, // surface point to light
+ out float nl,
+ out vec3 diff,
+ out vec3 spec);
+
+GBufferInfo getGBuffer(vec2 screenpos);
void main()
{
@@ -118,8 +120,9 @@ void main()
shadow = clamp(shadow, 0.0, 1.0);
}
- vec4 norm = getNorm(tc);
- vec3 n = norm.xyz;
+ GBufferInfo gb = getGBuffer(tc);
+
+ vec3 n = gb.normal;
float dist_atten = calcLegacyDistanceAttenuation(dist, falloff);
if (dist_atten <= 0.0)
@@ -132,14 +135,14 @@ void main()
float nh, nl, nv, vh, lightDist;
calcHalfVectors(lv, n, v, h, l, nh, nl, nv, vh, lightDist);
- vec3 diffuse = texture(diffuseRect, tc).rgb;
- vec4 spec = texture(specularRect, tc);
+ vec3 diffuse = gb.albedo.rgb;
+ vec4 spec = gb.specular;
vec3 dlit = vec3(0, 0, 0);
vec3 slit = vec3(0, 0, 0);
vec3 amb_rgb = vec3(0);
- if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR))
+ if (GET_GBUFFER_FLAG(gb.gbufferFlag, GBUFFER_FLAG_HAS_PBR))
{
vec3 orm = spec.rgb;
float perceptualRoughness = orm.g;
@@ -151,6 +154,8 @@ void main()
diffuseColor *= 1.0 - metallic;
vec3 specularColor = mix(f0, baseColor.rgb, metallic);
+ vec3 diffPunc = vec3(0);
+ vec3 specPunc = vec3(0);
// We need this additional test inside a light's frustum since a spotlight's ambiance can be applied
if (proj_tc.x > 0.0 && proj_tc.x < 1.0
@@ -168,16 +173,21 @@ void main()
dlit = getProjectedLightDiffuseColor( l_dist, proj_tc.xy );
vec3 intensity = dist_atten * dlit * 3.25 * shadow; // Legacy attenuation, magic number to balance with legacy materials
- final_color += intensity*pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, lv);
+
+ pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, normalize(lv), nl, diffPunc, specPunc);
+
+ final_color += intensity * clamp(nl * (diffPunc + specPunc), vec3(0), vec3(10));
}
amb_rgb = getProjectedLightAmbiance( amb_da, dist_atten, lit, nl, 1.0, proj_tc.xy ) * 3.25; //magic number to balance with legacy ambiance
- final_color += amb_rgb * pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, -lv);
+ pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, normalize(lv), nl, diffPunc, specPunc);
+
+ final_color += amb_rgb * clamp(nl * (diffPunc + specPunc), vec3(0), vec3(10));
}
}
else
{
- float envIntensity = texture(emissiveRect, tc).r;
+ float envIntensity = gb.envIntensity;
diffuse = srgb_to_linear(diffuse);
spec.rgb = srgb_to_linear(spec.rgb);
diff --git a/indra/newview/app_settings/shaders/class3/environment/waterF.glsl b/indra/newview/app_settings/shaders/class3/environment/waterF.glsl
index 03da5b020f..84c287fc50 100644
--- a/indra/newview/app_settings/shaders/class3/environment/waterF.glsl
+++ b/indra/newview/app_settings/shaders/class3/environment/waterF.glsl
@@ -42,20 +42,25 @@ vec2 BRDF(float NoV, float roughness);
void calcDiffuseSpecular(vec3 baseColor, float metallic, inout vec3 diffuseColor, inout vec3 specularColor);
-vec3 pbrIbl(vec3 diffuseColor,
+void pbrIbl(vec3 diffuseColor,
vec3 specularColor,
vec3 radiance, // radiance map sample
vec3 irradiance, // irradiance map sample
float ao, // ambient occlusion factor
float nv, // normal dot view vector
- float perceptualRoughness);
-
-vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
float perceptualRoughness,
- float metallic,
- vec3 n, // normal
- vec3 v, // surface point to camera
- vec3 l); //surface point to light
+ out vec3 diffuse,
+ out vec3 specular);
+
+void pbrPunctual(vec3 diffuseColor, vec3 specularColor,
+ float perceptualRoughness,
+ float metallic,
+ vec3 n, // normal
+ vec3 v, // surface point to camera
+ vec3 l, // surface point to light
+ out float nl,
+ out vec3 diff,
+ out vec3 spec);
vec3 pbrBaseLight(vec3 diffuseColor,
vec3 specularColor,
@@ -257,13 +262,20 @@ void main()
float NdotV = clamp(abs(dot(norm, v)), 0.001, 1.0);
- vec3 punctual = pbrPunctual(vec3(0), specularColor, 0.1, metallic, normalize(wavef+up*max(dist, 32.0)/32.0*(1.0-vdu)), v, normalize(light_dir));
+ float nl = 0;
+ vec3 diffPunc = vec3(0);
+ vec3 specPunc = vec3(0);
- vec3 color = punctual * sunlit_linear * 2.75 * shadow;
+ pbrPunctual(vec3(0), specularColor, 0.1, metallic, normalize(wavef+up*max(dist, 32.0)/32.0*(1.0-vdu)), v, normalize(light_dir), nl, diffPunc, specPunc);
- vec3 ibl = pbrIbl(vec3(0), vec3(1), radiance, vec3(0), ao, NdotV, 0.0);
+ vec3 punctual = clamp(nl * (diffPunc + specPunc), vec3(0), vec3(10));
+
+ vec3 color = punctual * sunlit_linear * 2.75 * shadow;
+ vec3 iblDiff;
+ vec3 iblSpec;
+ pbrIbl(vec3(0), vec3(1), radiance, vec3(0), ao, NdotV, 0.0, iblDiff, iblSpec);
- color += ibl;
+ color += iblDiff + iblSpec;
float nv = clamp(abs(dot(norm.xyz, v)), 0.001, 1.0);
vec2 brdf = BRDF(clamp(nv, 0.0, 1.0), 1.0);
diff --git a/indra/newview/featuretable.txt b/indra/newview/featuretable.txt
index de04db9a64..bd7c11a52f 100644
--- a/indra/newview/featuretable.txt
+++ b/indra/newview/featuretable.txt
@@ -1,4 +1,4 @@
-version 64
+version 71
// 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
@@ -84,6 +84,9 @@ RenderCASSharpness 1 1
RenderExposure 1 4
RenderTonemapType 1 1
RenderTonemapMix 1 1
+RenderEnableEmissiveBuffer 1 1
+RenderHDREnabled 1 1
+RenderVintageMode 1 1
//
// Low Graphics Settings
@@ -100,7 +103,7 @@ RenderGlowResolutionPow 1 8
RenderLocalLightCount 1 8
RenderMaxPartCount 1 0
RenderTransparentWater 1 0
-RenderReflectionsEnabled 1 1
+RenderReflectionsEnabled 1 0
RenderReflectionProbeDetail 1 0
RenderTerrainDetail 1 0
RenderTerrainLODFactor 1 1
@@ -124,6 +127,9 @@ RenderCASSharpness 1 0
RenderExposure 1 1
RenderTonemapType 1 1
RenderTonemapMix 1 0.7
+RenderEnableEmissiveBuffer 1 0
+RenderHDREnabled 1 0
+RenderVintageMode 1 1
//
// Medium Low Graphics Settings
@@ -164,6 +170,9 @@ RenderCASSharpness 1 0
RenderExposure 1 1
RenderTonemapType 1 1
RenderTonemapMix 1 0.7
+RenderEnableEmissiveBuffer 1 1
+RenderHDREnabled 1 1
+RenderVintageMode 1 0
//
// Medium Graphics Settings (standard)
@@ -204,6 +213,9 @@ RenderCASSharpness 1 0
RenderExposure 1 1
RenderTonemapType 1 1
RenderTonemapMix 1 0.7
+RenderEnableEmissiveBuffer 1 1
+RenderHDREnabled 1 1
+RenderVintageMode 1 0
//
// Medium High Graphics Settings
@@ -244,6 +256,9 @@ RenderCASSharpness 1 0
RenderExposure 1 1
RenderTonemapType 1 1
RenderTonemapMix 1 0.7
+RenderEnableEmissiveBuffer 1 1
+RenderHDREnabled 1 1
+RenderVintageMode 1 0
//
// High Graphics Settings (SSAO + sun shadows)
@@ -284,6 +299,9 @@ RenderCASSharpness 1 0.4
RenderExposure 1 1
RenderTonemapType 1 1
RenderTonemapMix 1 0.7
+RenderEnableEmissiveBuffer 1 1
+RenderHDREnabled 1 1
+RenderVintageMode 1 0
//
// High Ultra Graphics Settings (deferred + SSAO + all shadows)
@@ -324,6 +342,9 @@ RenderCASSharpness 1 0.4
RenderExposure 1 1
RenderTonemapType 1 1
RenderTonemapMix 1 0.7
+RenderEnableEmissiveBuffer 1 1
+RenderHDREnabled 1 1
+RenderVintageMode 1 0
//
// Ultra graphics (REALLY PURTY!)
@@ -364,6 +385,9 @@ RenderCASSharpness 1 0.4
RenderExposure 1 1
RenderTonemapType 1 1
RenderTonemapMix 1 0.7
+RenderEnableEmissiveBuffer 1 1
+RenderHDREnabled 1 1
+RenderVintageMode 1 0
//
// Class Unknown Hardware (unknown)
@@ -372,6 +396,8 @@ list Unknown
RenderShadowDetail 1 0
RenderDeferredSSAO 1 0
RenderMirrors 1 0
+RenderEnableEmissiveBuffer 1 0
+RenderVintageMode 1 1
//
// VRAM > 512MB
@@ -394,6 +420,7 @@ RenderDeferredSSAO 0 0
RenderShadowDetail 0 0
RenderReflectionProbeDetail 0 -1
RenderMirrors 0 0
+RenderVintageMode 1 1
list Intel
RenderAnisotropic 1 0
@@ -412,6 +439,11 @@ RenderFSAASamples 0 0
RenderReflectionsEnabled 0 0
RenderReflectionProbeDetail 0 0
RenderMirrors 0 0
+RenderEnableEmissiveBuffer 1 0
+RenderGLMultiThreadedTextures 0 0
+RenderGLMultiThreadedMedia 0 0
+RenderHDREnabled 1 0
+RenderVintageMode 1 1
list TexUnit16orLess
RenderTerrainPBRDetail 1 -1
diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt
index c5c2bb3e2d..a11a08f752 100644
--- a/indra/newview/featuretable_mac.txt
+++ b/indra/newview/featuretable_mac.txt
@@ -1,4 +1,4 @@
-version 63
+version 65
// 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
@@ -83,6 +83,7 @@ RenderCASSharpness 1 1
RenderExposure 1 1
RenderTonemapType 1 1
RenderTonemapMix 1 1
+RenderVintageMode 1 1
//
// Low Graphics Settings
@@ -123,6 +124,7 @@ RenderCASSharpness 1 0
RenderExposure 1 1
RenderTonemapType 1 1
RenderTonemapMix 1 0.7
+RenderVintageMode 1 1
//
@@ -164,6 +166,7 @@ RenderCASSharpness 1 0
RenderExposure 1 1
RenderTonemapType 1 1
RenderTonemapMix 1 0.7
+RenderVintageMode 1 0
//
// Medium Graphics Settings (standard)
@@ -204,6 +207,7 @@ RenderCASSharpness 1 0
RenderExposure 1 1
RenderTonemapType 1 1
RenderTonemapMix 1 0.7
+RenderVintageMode 1 0
//
// Medium High Graphics Settings
@@ -244,6 +248,7 @@ RenderCASSharpness 1 0
RenderExposure 1 1
RenderTonemapType 1 1
RenderTonemapMix 1 0.7
+RenderVintageMode 1 0
//
// High Graphics Settings (SSAO + sun shadows)
@@ -284,6 +289,7 @@ RenderCASSharpness 1 0
RenderExposure 1 1
RenderTonemapType 1 1
RenderTonemapMix 1 0.7
+RenderVintageMode 1 0
//
// High Ultra Graphics Settings (SSAO + all shadows)
@@ -324,6 +330,7 @@ RenderCASSharpness 1 0.4
RenderExposure 1 1
RenderTonemapType 1 1
RenderTonemapMix 1 0.7
+RenderVintageMode 1 0
//
// Ultra graphics (REALLY PURTY!)
@@ -364,6 +371,7 @@ RenderCASSharpness 1 0.4
RenderExposure 1 1
RenderTonemapType 1 1
RenderTonemapMix 1 0.7
+RenderVintageMode 1 0
//
// Class Unknown Hardware (unknown)
@@ -372,6 +380,7 @@ list Unknown
RenderShadowDetail 1 0
RenderDeferredSSAO 1 0
RenderMirrors 1 0
+RenderVintageMode 1 1
//
@@ -393,6 +402,7 @@ RenderTerrainDetail 1 0
RenderDeferredSSAO 0 0
RenderShadowDetail 0 0
RenderMirrors 0 0
+RenderVintageMode 1 1
list TexUnit8orLess
RenderDeferredSSAO 0 0
@@ -421,3 +431,4 @@ RenderFSAASamples 0 0
RenderReflectionProbeDetail 0 0
RenderReflectionsEnabled 0 0
RenderMirrors 0 0
+RenderVintageMode 1 1
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp
index 05bd704556..0017a724ea 100644
--- a/indra/newview/llenvironment.cpp
+++ b/indra/newview/llenvironment.cpp
@@ -816,7 +816,7 @@ const F64Seconds LLEnvironment::TRANSITION_ALTITUDE(5.0f);
const LLUUID LLEnvironment::KNOWN_SKY_SUNRISE("01e41537-ff51-2f1f-8ef7-17e4df760bfb");
const LLUUID LLEnvironment::KNOWN_SKY_MIDDAY("c46226b4-0e43-5a56-9708-d27ca1df3292");
-const LLUUID LLEnvironment::KNOWN_SKY_LEGACY_MIDDAY("cef49723-0292-af49-9b14-9598a616b8a3");
+const LLUUID LLEnvironment::KNOWN_SKY_LEGACY_MIDDAY("6c83e853-e7f8-cad7-8ee6-5f31c453721c");
const LLUUID LLEnvironment::KNOWN_SKY_SUNSET("084e26cd-a900-28e8-08d0-64a9de5c15e2");
const LLUUID LLEnvironment::KNOWN_SKY_MIDNIGHT("8a01b97a-cb20-c1ea-ac63-f7ea84ad0090");
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp
index 7717dba1af..e06127c1c8 100644
--- a/indra/newview/llface.cpp
+++ b/indra/newview/llface.cpp
@@ -2221,9 +2221,11 @@ bool LLFace::calcPixelArea(F32& cos_angle_to_view_dir, F32& radius)
if (rigInfo.needsUpdate())
{
LLVOVolume* vo_volume = (LLVOVolume*)mVObjp.get();
- LLVOAvatar* avatar = mVObjp->getAvatar();
const LLMeshSkinInfo* skin = vo_volume->getSkinInfo();
- LLSkinningUtil::updateRiggingInfo(skin, avatar, face);
+ if (skin)
+ {
+ LLSkinningUtil::updateRiggingInfo(skin, avatar, face);
+ }
}
// calculate the world space bounding box of the face by combining the bounding boxes of all the joints
diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp
index 7a99702e27..b25ef02e13 100644
--- a/indra/newview/llfeaturemanager.cpp
+++ b/indra/newview/llfeaturemanager.cpp
@@ -655,7 +655,8 @@ void LLFeatureManager::applyBaseMasks()
if (gGLManager.mIsIntel)
{
maskFeatures("Intel");
- if (gGLManager.mGLVersion < 4.59f)
+ // check against 3.33 to avoid applying this fallback twice
+ if (gGLManager.mGLVersion < 4.59f && gGLManager.mGLVersion > 3.33f)
{
// if we don't have OpenGL 4.6 on intel, set it to OpenGL 3.3
// we also want to trigger the GL3 fallbacks on these chipsets
@@ -665,10 +666,12 @@ void LLFeatureManager::applyBaseMasks()
// https://docs.blender.org/manual/en/latest/troubleshooting/gpu/windows/intel.html#legacy-intel-hd-4000-5000
// https://www.intel.com/content/www/us/en/support/articles/000005524/graphics.html
// this will disable things like reflection probes, HDR, FXAA and SMAA
+ LL_INFOS("RenderInit") << "Applying Intel integrated pre-Haswell fallback. Downgrading feature usage to OpenGL 3.3" << LL_ENDL;
gGLManager.mGLVersion = llmin(gGLManager.mGLVersion, 3.33f);
- // and select GLSL version for OpenGL 3.3
+ gGLManager.mGLVersionString += " 3.3 fallback"; // for ViewerStats reporting
+ // and select GLSL version for OpenGL 3.2
gGLManager.mGLSLVersionMajor = 3;
- gGLManager.mGLSLVersionMinor = 30;
+ gGLManager.mGLSLVersionMinor = 20;
}
}
if (gGLManager.mIsApple)
@@ -702,6 +705,10 @@ void LLFeatureManager::applyBaseMasks()
if (gGLManager.mGLVersion < 3.99f)
{
maskFeatures("GL3");
+
+ // make sure to disable background context activity in GL3 mode
+ LLImageGLThread::sEnabledMedia = false;
+ LLImageGLThread::sEnabledTextures = false;
}
// now mask by gpu string
diff --git a/indra/newview/llfetchedgltfmaterial.h b/indra/newview/llfetchedgltfmaterial.h
index 634a4853b0..4a33b9f05f 100644
--- a/indra/newview/llfetchedgltfmaterial.h
+++ b/indra/newview/llfetchedgltfmaterial.h
@@ -31,10 +31,14 @@
#include "llviewertexture.h"
class LLGLSLShader;
+class LLGLTFMaterialList;
+class LLTerrainMaterials;
class LLFetchedGLTFMaterial: public LLGLTFMaterial
{
- friend class LLGLTFMaterialList; // for lifetime management
+ // for lifetime management
+ friend class LLGLTFMaterialList;
+ friend class LLTerrainMaterials;
public:
LLFetchedGLTFMaterial();
virtual ~LLFetchedGLTFMaterial();
diff --git a/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp b/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp
index daa3d7e3be..e29ea0c39a 100644
--- a/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp
+++ b/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp
@@ -318,6 +318,18 @@ void LLFloaterPreferenceGraphicsAdvanced::disableUnavailableSettings()
ctrl_shadows->setValue(0);
shadows_text->setEnabled(false);
}
+
+ // Vintage mode
+ LLCachedControl<bool> is_vintage(gSavedSettings, "RenderVintageMode");
+ LLSliderCtrl* tonemapMix = getChild<LLSliderCtrl>("TonemapMix");
+ LLComboBox* tonemapSelect = getChild<LLComboBox>("TonemapType");
+ LLTextBox* tonemapLabel = getChild<LLTextBox>("TonemapTypeText");
+ LLSliderCtrl* exposureSlider = getChild<LLSliderCtrl>("RenderExposure");
+
+ tonemapSelect->setEnabled(!is_vintage);
+ tonemapLabel->setEnabled(!is_vintage);
+ tonemapMix->setEnabled(!is_vintage);
+ exposureSlider->setEnabled(!is_vintage);
}
void LLFloaterPreferenceGraphicsAdvanced::refreshEnabledState()
diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp
index dde238eddb..1e3a328464 100644
--- a/indra/newview/llmaterialeditor.cpp
+++ b/indra/newview/llmaterialeditor.cpp
@@ -1976,21 +1976,21 @@ void LLMaterialEditor::loadMaterialFromFile(const std::string& filename, S32 ind
return;
}
- LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor");
-
if (index >= 0)
{
// Prespecified material
+ LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor");
me->loadMaterial(model_in, filename, index);
}
else if (model_in.materials.size() == 1)
{
- // Only one, just load it
+ // Only one material, just load it
+ LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor");
me->loadMaterial(model_in, filename, 0);
}
else
{
- // Promt user to select material
+ // Multiple materials, Promt user to select material
std::list<std::string> material_list;
std::vector<tinygltf::Material>::const_iterator mat_iter = model_in.materials.begin();
std::vector<tinygltf::Material>::const_iterator mat_end = model_in.materials.end();
@@ -2008,15 +2008,19 @@ void LLMaterialEditor::loadMaterialFromFile(const std::string& filename, S32 ind
}
}
- material_list.push_back(me->getString("material_batch_import_text"));
+ material_list.push_back(LLTrans::getString("material_batch_import_text"));
LLFloaterComboOptions::showUI(
- [me, model_in, filename](const std::string& option, S32 index)
+ [model_in, filename](const std::string& option, S32 index)
{
- me->loadMaterial(model_in, filename, index);
+ if (index >= 0) // -1 on cancel
+ {
+ LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor");
+ me->loadMaterial(model_in, filename, index);
+ }
},
- me->getString("material_selection_title"),
- me->getString("material_selection_text"),
+ LLTrans::getString("material_selection_title"),
+ LLTrans::getString("material_selection_text"),
material_list
);
}
diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp
index 7de16e0056..e04262715d 100644
--- a/indra/newview/llmodelpreview.cpp
+++ b/indra/newview/llmodelpreview.cpp
@@ -227,6 +227,8 @@ LLModelPreview::~LLModelPreview()
}
mBaseModel.clear();
mBaseScene.clear();
+
+ LLLoadedCallbackEntry::cleanUpCallbackList(&mCallbackTextureList);
}
void LLModelPreview::updateDimentionsAndOffsets()
@@ -553,7 +555,7 @@ void LLModelPreview::rebuildUploadData()
{
// in case user provided a missing file later
texture->setIsMissingAsset(false);
- texture->setLoadedCallback(LLModelPreview::textureLoadedCallback, 0, true, false, this, NULL, false);
+ texture->setLoadedCallback(LLModelPreview::textureLoadedCallback, 0, true, false, this, &mCallbackTextureList, false);
texture->forceToSaveRawImage(0, F32_MAX);
texture->updateFetch();
if (mModelLoader)
@@ -3130,8 +3132,6 @@ LLJoint* LLModelPreview::lookupJointByName(const std::string& str, void* opaque)
U32 LLModelPreview::loadTextures(LLImportMaterial& material, void* opaque)
{
- (void)opaque;
-
if (material.mDiffuseMapFilename.size())
{
material.mOpaqueData = new LLPointer< LLViewerFetchedTexture >;
@@ -3145,7 +3145,8 @@ U32 LLModelPreview::loadTextures(LLImportMaterial& material, void* opaque)
}
// Todo: might cause a crash if preview gets closed before we get the callback.
// Use a callback list or guard callback in some way
- tex->setLoadedCallback(LLModelPreview::textureLoadedCallback, 0, true, false, opaque, NULL, false);
+ LLModelPreview* preview = (LLModelPreview*)opaque;
+ tex->setLoadedCallback(LLModelPreview::textureLoadedCallback, 0, true, false, opaque, &preview->mCallbackTextureList, false);
tex->forceToSaveRawImage(0, F32_MAX);
material.setDiffuseMap(tex->getID()); // record tex ID
return 1;
diff --git a/indra/newview/llmodelpreview.h b/indra/newview/llmodelpreview.h
index c615070105..e236d7ced7 100644
--- a/indra/newview/llmodelpreview.h
+++ b/indra/newview/llmodelpreview.h
@@ -316,6 +316,7 @@ protected:
LLMeshUploadThread::instance_list mUploadData;
std::set<LLViewerFetchedTexture * > mTextureSet;
+ LLLoadedCallbackEntry::source_callback_list_t mCallbackTextureList;
//map of vertex buffers to models (one vertex buffer in vector per face in model
std::map<LLModel*, std::vector<LLPointer<LLVertexBuffer> > > mVertexBuffer[LLModel::NUM_LODS + 1];
diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp
index 72fb9464d8..b1d5cd9e16 100644
--- a/indra/newview/lloutfitgallery.cpp
+++ b/indra/newview/lloutfitgallery.cpp
@@ -55,8 +55,15 @@
static LLPanelInjector<LLOutfitGallery> t_outfit_gallery("outfit_gallery");
-#define MAX_OUTFIT_PHOTO_WIDTH 256
-#define MAX_OUTFIT_PHOTO_HEIGHT 256
+// The maximum resolution at which to load the outfit photo. If the given
+// texture has a higher resolution, tell the texture streaming system to
+// only load the resolution needed. An in-world object may request to load
+// the texture at a higher resolution, but that won't affect textures
+// loaded with LLViewerTexture::FETCHED_TEXTURE. (see
+// LLOutfitGalleryItem::setImageAssetId and also
+// LLViewerTexture::LOD_TEXTURE)
+#define MAX_OUTFIT_PHOTO_LOAD_WIDTH 256
+#define MAX_OUTFIT_PHOTO_LOAD_HEIGHT 256
const S32 GALLERY_ITEMS_PER_ROW_MIN = 2;
@@ -979,28 +986,18 @@ void LLOutfitGalleryItem::draw()
border.mRight = border.mRight + 1;
gl_rect_2d(border, border_color, false);
- // If the floater is focused, don't apply its alpha to the texture (STORM-677).
- const F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency();
if (mTexturep)
{
- if (mImageUpdatePending && mTexturep->getDiscardLevel() >= 0)
- {
- mImageUpdatePending = false;
- if (mTexturep->getOriginalWidth() > MAX_OUTFIT_PHOTO_WIDTH || mTexturep->getOriginalHeight() > MAX_OUTFIT_PHOTO_HEIGHT)
- {
- setDefaultImage();
- }
- }
- else
- {
- LLRect interior = border;
- interior.stretch(-1);
+ LLRect interior = border;
+ interior.stretch(-1);
- gl_draw_scaled_image(interior.mLeft - 1, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep, UI_VERTEX_COLOR % alpha);
+ // Pump the priority
+ const F32 stats = (F32)llmin(interior.getWidth() * interior.getHeight(), MAX_OUTFIT_PHOTO_LOAD_WIDTH * MAX_OUTFIT_PHOTO_LOAD_HEIGHT);
+ mTexturep->addTextureStats(stats);
- // Pump the priority
- mTexturep->addTextureStats((F32)(interior.getWidth() * interior.getHeight()));
- }
+ // If the floater is focused, don't apply its alpha to the texture (STORM-677).
+ const F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency();
+ gl_draw_scaled_image(interior.mLeft - 1, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep, UI_VERTEX_COLOR % alpha);
}
}
@@ -1128,14 +1125,18 @@ bool LLOutfitGalleryItem::openOutfitsContent()
bool LLOutfitGalleryItem::setImageAssetId(LLUUID image_asset_id)
{
- LLPointer<LLViewerFetchedTexture> texture = LLViewerTextureManager::getFetchedTexture(image_asset_id, FTT_DEFAULT, MIPMAP_YES, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
- if (texture && texture->getOriginalWidth() <= MAX_OUTFIT_PHOTO_WIDTH && texture->getOriginalHeight() <= MAX_OUTFIT_PHOTO_HEIGHT)
+ LLPointer<LLViewerFetchedTexture> texture = LLViewerTextureManager::getFetchedTexture(image_asset_id, FTT_DEFAULT, MIPMAP_YES, LLGLTexture::BOOST_NONE, LLViewerTexture::FETCHED_TEXTURE);
+ if (texture)
{
mImageAssetId = image_asset_id;
mTexturep = texture;
+ // *TODO: There was previously logic which attempted to toggle
+ // visibility of the preview icon based on certain conditions,
+ // however these conditions either did not make sense or were not
+ // applicable due to texture streaming. Maybe we should only hide
+ // the preview icon if the texture has at least one mip loaded.
mPreviewIcon->setVisible(false);
mDefaultImage = false;
- mImageUpdatePending = (texture->getDiscardLevel() == -1);
return true;
}
return false;
@@ -1152,7 +1153,6 @@ void LLOutfitGalleryItem::setDefaultImage()
mImageAssetId.setNull();
mPreviewIcon->setVisible(true);
mDefaultImage = true;
- mImageUpdatePending = false;
}
LLContextMenu* LLOutfitGalleryContextMenu::createMenu()
diff --git a/indra/newview/lloutfitgallery.h b/indra/newview/lloutfitgallery.h
index fa441ff209..541ea2f9d4 100644
--- a/indra/newview/lloutfitgallery.h
+++ b/indra/newview/lloutfitgallery.h
@@ -266,7 +266,6 @@ private:
bool mSelected;
bool mWorn;
bool mDefaultImage;
- bool mImageUpdatePending;
bool mHidden;
std::string mOutfitName;
};
diff --git a/indra/newview/llreflectionmapmanager.cpp b/indra/newview/llreflectionmapmanager.cpp
index 82bcfdc0af..ad8d6ff7bf 100644
--- a/indra/newview/llreflectionmapmanager.cpp
+++ b/indra/newview/llreflectionmapmanager.cpp
@@ -463,7 +463,7 @@ void LLReflectionMapManager::update()
LLReflectionMap* LLReflectionMapManager::addProbe(LLSpatialGroup* group)
{
- if (gGLManager.mGLVersion < 4.05f)
+ if (gGLManager.mGLVersion < 4.05f || !LLPipeline::sReflectionProbesEnabled)
{
return nullptr;
}
@@ -579,6 +579,11 @@ LLReflectionMap* LLReflectionMapManager::registerSpatialGroup(LLSpatialGroup* gr
LLReflectionMap* LLReflectionMapManager::registerViewerObject(LLViewerObject* vobj)
{
+ if (!LLPipeline::sReflectionProbesEnabled)
+ {
+ return nullptr;
+ }
+
llassert(vobj != nullptr);
LLReflectionMap* probe = new LLReflectionMap();
diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp
index fee0bbcda4..b1bef4c4d8 100644
--- a/indra/newview/llsettingsvo.cpp
+++ b/indra/newview/llsettingsvo.cpp
@@ -794,6 +794,7 @@ void LLSettingsVOSky::applySpecial(void *ptarget, bool force)
F32 g = getGamma();
+ static LLCachedControl<bool> hdr(gSavedSettings, "RenderHDREnabled");
static LLCachedControl<bool> should_auto_adjust(gSavedSettings, "RenderSkyAutoAdjustLegacy", true);
static LLCachedControl<F32> auto_adjust_ambient_scale(gSavedSettings, "RenderSkyAutoAdjustAmbientScale", 0.75f);
static LLCachedControl<F32> auto_adjust_hdr_scale(gSavedSettings, "RenderSkyAutoAdjustHDRScale", 2.f);
@@ -801,10 +802,15 @@ void LLSettingsVOSky::applySpecial(void *ptarget, bool force)
static LLCachedControl<F32> auto_adjust_blue_density_scale(gSavedSettings, "RenderSkyAutoAdjustBlueDensityScale", 1.f);
static LLCachedControl<F32> auto_adjust_sun_color_scale(gSavedSettings, "RenderSkyAutoAdjustSunColorScale", 1.f);
static LLCachedControl<F32> sunlight_scale(gSavedSettings, "RenderSkySunlightScale", 1.5f);
+ static LLCachedControl<F32> sunlight_hdr_scale(gSavedSettings, "RenderHDRSkySunlightScale", 1.5f);
static LLCachedControl<F32> ambient_scale(gSavedSettings, "RenderSkyAmbientScale", 1.5f);
- shader->uniform1f(LLShaderMgr::SKY_SUNLIGHT_SCALE, sunlight_scale);
+ // sky is a "classic" sky following pre SL 7.0 shading
+ bool classic_mode = psky->canAutoAdjust();
+
+ shader->uniform1f(LLShaderMgr::SKY_SUNLIGHT_SCALE, hdr ? sunlight_hdr_scale : sunlight_scale);
shader->uniform1f(LLShaderMgr::SKY_AMBIENT_SCALE, ambient_scale);
+ shader->uniform1i(LLShaderMgr::CLASSIC_MODE, classic_mode);
F32 probe_ambiance = getReflectionProbeAmbiance();
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index ed91214bd0..dd1be028cd 100644
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -537,7 +537,6 @@ private:
F32 mImagePriority; // should map to max virtual size
F32 mRequestedPriority;
S32 mDesiredDiscard;
- S32 mSimRequestedDiscard;
S32 mRequestedDiscard;
S32 mLoadedDiscard;
S32 mDecodedDiscard;
@@ -870,7 +869,6 @@ LLTextureFetchWorker::LLTextureFetchWorker(LLTextureFetch* fetcher,
mImagePriority(priority),
mRequestedPriority(0.f),
mDesiredDiscard(-1),
- mSimRequestedDiscard(-1),
mRequestedDiscard(-1),
mLoadedDiscard(-1),
mDecodedDiscard(-1),
diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp
index 865d7fd442..c4afaac476 100644
--- a/indra/newview/llviewercontrol.cpp
+++ b/indra/newview/llviewercontrol.cpp
@@ -243,6 +243,23 @@ static bool handleReleaseGLBufferChanged(const LLSD& newvalue)
return true;
}
+static bool handleEnableEmissiveChanged(const LLSD& newvalue)
+{
+ return handleReleaseGLBufferChanged(newvalue) && handleSetShaderChanged(newvalue);
+}
+
+static bool handleEnableClassicMode(const LLSD& newvalue)
+{
+ gSavedSettings.setBOOL("RenderEnableEmissiveBuffer", !newvalue.asBoolean());
+ gSavedSettings.setBOOL("RenderHDREnabled", !newvalue.asBoolean());
+ return true;
+}
+
+static bool handleEnableHDR(const LLSD& newvalue)
+{
+ return handleReleaseGLBufferChanged(newvalue) && handleSetShaderChanged(newvalue);
+}
+
static bool handleLUTBufferChanged(const LLSD& newvalue)
{
if (gPipeline.isInit())
@@ -780,6 +797,9 @@ void settings_setup_listeners()
setting_setup_signal_listener(gSavedSettings, "RenderGlow", handleSetShaderChanged);
setting_setup_signal_listener(gSavedSettings, "RenderGlowResolutionPow", handleReleaseGLBufferChanged);
setting_setup_signal_listener(gSavedSettings, "RenderGlowHDR", handleReleaseGLBufferChanged);
+ setting_setup_signal_listener(gSavedSettings, "RenderEnableEmissiveBuffer", handleEnableEmissiveChanged);
+ setting_setup_signal_listener(gSavedSettings, "RenderVintageMode", handleEnableClassicMode);
+ setting_setup_signal_listener(gSavedSettings, "RenderHDREnabled", handleEnableHDR);
setting_setup_signal_listener(gSavedSettings, "RenderGlowNoise", handleSetShaderChanged);
setting_setup_signal_listener(gSavedSettings, "RenderGammaFull", handleSetShaderChanged);
setting_setup_signal_listener(gSavedSettings, "RenderVolumeLODFactor", handleVolumeLODChanged);
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index 5b3bc6e0c0..24f1be3d1c 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -957,30 +957,17 @@ void display(bool rebuild, F32 zoom_factor, int subfield, bool for_snapshot)
gGL.setColorMask(true, true);
- if (LLPipeline::sRenderDeferred)
+ gPipeline.mRT->deferredScreen.bindTarget();
+ if (gUseWireframe)
{
- gPipeline.mRT->deferredScreen.bindTarget();
- if (gUseWireframe)
- {
- F32 g = 0.5f;
- glClearColor(g, g, g, 1.f);
- }
- else
- {
- glClearColor(1, 0, 1, 1);
- }
- gPipeline.mRT->deferredScreen.clear();
+ F32 g = 0.5f;
+ glClearColor(g, g, g, 1.f);
}
else
{
- gPipeline.mRT->screen.bindTarget();
- if (LLPipeline::sUnderWaterRender && !gPipeline.canUseWindLightShaders())
- {
- const LLColor4 &col = LLEnvironment::instance().getCurrentWater()->getWaterFogColor();
- glClearColor(col.mV[0], col.mV[1], col.mV[2], 0.f);
- }
- gPipeline.mRT->screen.clear();
+ glClearColor(1, 0, 1, 1);
}
+ gPipeline.mRT->deferredScreen.clear();
gGL.setColorMask(true, false);
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index cdebb08b18..83386eb1ec 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -256,6 +256,16 @@ static bool make_rigged_variant(LLGLSLShader& shader, LLGLSLShader& riggedShader
return riggedShader.createShader();
}
+static void add_common_permutations(LLGLSLShader* shader)
+{
+ LLCachedControl<bool> emissive(gSavedSettings, "RenderEnableEmissiveBuffer", false);
+
+ if (emissive)
+ {
+ shader->addPermutation("HAS_EMISSIVE", "1");
+ }
+}
+
static bool make_gltf_variant(LLGLSLShader& shader, LLGLSLShader& variant, bool alpha_blend, bool rigged, bool unlit, bool multi_uv, bool use_sun_shadow)
{
@@ -772,6 +782,13 @@ std::string LLViewerShaderMgr::loadBasicShaders()
attribs["MAX_JOINTS_PER_MESH_OBJECT"] =
std::to_string(LLSkinningUtil::getMaxJointCount());
+ LLCachedControl<bool> emissive(gSavedSettings, "RenderEnableEmissiveBuffer", false);
+
+ if (emissive)
+ {
+ attribs["HAS_EMISSIVE"] = "1";
+ }
+
bool ssr = gSavedSettings.getBOOL("RenderScreenSpaceReflections");
bool mirrors = gSavedSettings.getBOOL("RenderMirrors");
@@ -852,6 +869,7 @@ std::string LLViewerShaderMgr::loadBasicShaders()
index_channels.push_back(-1); shaders.push_back( make_pair( "environment/waterFogF.glsl", mShaderLevel[SHADER_WATER] ) );
index_channels.push_back(-1); shaders.push_back( make_pair( "environment/srgbF.glsl", mShaderLevel[SHADER_ENVIRONMENT] ) );
index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/deferredUtil.glsl", 1) );
+ index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/gbufferUtil.glsl", 1) );
index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/globalF.glsl", 1));
index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/shadowUtil.glsl", 1) );
index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/aoUtil.glsl", 1) );
@@ -1175,6 +1193,7 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredHighlightProgram.mShaderFiles.push_back(make_pair("interface/highlightV.glsl", GL_VERTEX_SHADER));
gDeferredHighlightProgram.mShaderFiles.push_back(make_pair("deferred/highlightF.glsl", GL_FRAGMENT_SHADER));
gDeferredHighlightProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
+ add_common_permutations(&gDeferredHighlightProgram);
success = gDeferredHighlightProgram.createShader();
}
@@ -1187,6 +1206,7 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredDiffuseProgram.mShaderFiles.push_back(make_pair("deferred/diffuseIndexedF.glsl", GL_FRAGMENT_SHADER));
gDeferredDiffuseProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
gDeferredDiffuseProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ add_common_permutations(&gDeferredDiffuseProgram);
success = make_rigged_variant(gDeferredDiffuseProgram, gDeferredSkinnedDiffuseProgram);
success = success && gDeferredDiffuseProgram.createShader();
}
@@ -1199,6 +1219,7 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredDiffuseAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/diffuseAlphaMaskIndexedF.glsl", GL_FRAGMENT_SHADER));
gDeferredDiffuseAlphaMaskProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
gDeferredDiffuseAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ add_common_permutations(&gDeferredDiffuseAlphaMaskProgram);
success = make_rigged_variant(gDeferredDiffuseAlphaMaskProgram, gDeferredSkinnedDiffuseAlphaMaskProgram);
success = success && gDeferredDiffuseAlphaMaskProgram.createShader();
}
@@ -1210,6 +1231,7 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredNonIndexedDiffuseAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/diffuseV.glsl", GL_VERTEX_SHADER));
gDeferredNonIndexedDiffuseAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/diffuseAlphaMaskF.glsl", GL_FRAGMENT_SHADER));
gDeferredNonIndexedDiffuseAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ add_common_permutations(&gDeferredNonIndexedDiffuseAlphaMaskProgram);
success = gDeferredNonIndexedDiffuseAlphaMaskProgram.createShader();
llassert(success);
}
@@ -1221,6 +1243,7 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderFiles.push_back(make_pair("deferred/diffuseNoColorV.glsl", GL_VERTEX_SHADER));
gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderFiles.push_back(make_pair("deferred/diffuseAlphaMaskNoColorF.glsl", GL_FRAGMENT_SHADER));
gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ add_common_permutations(&gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram);
success = gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.createShader();
llassert(success);
}
@@ -1232,6 +1255,7 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredBumpProgram.mShaderFiles.push_back(make_pair("deferred/bumpV.glsl", GL_VERTEX_SHADER));
gDeferredBumpProgram.mShaderFiles.push_back(make_pair("deferred/bumpF.glsl", GL_FRAGMENT_SHADER));
gDeferredBumpProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ add_common_permutations(&gDeferredBumpProgram);
success = make_rigged_variant(gDeferredBumpProgram, gDeferredSkinnedBumpProgram);
success = success && gDeferredBumpProgram.createShader();
llassert(success);
@@ -1297,6 +1321,7 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredMaterialProgram[i].addPermutation("HAS_SUN_SHADOW", "1");
}
+ add_common_permutations(&gDeferredMaterialProgram[i]);
gDeferredMaterialProgram[i].mFeatures.hasSrgb = true;
gDeferredMaterialProgram[i].mFeatures.calculatesAtmospherics = true;
@@ -1340,6 +1365,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredPBROpaqueProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
gDeferredPBROpaqueProgram.clearPermutations();
+ add_common_permutations(&gDeferredPBROpaqueProgram);
+
success = make_rigged_variant(gDeferredPBROpaqueProgram, gDeferredSkinnedPBROpaqueProgram);
if (success)
{
@@ -1361,6 +1388,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gGLTFPBRMetallicRoughnessProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
gGLTFPBRMetallicRoughnessProgram.clearPermutations();
+ add_common_permutations(&gGLTFPBRMetallicRoughnessProgram);
+
success = make_gltf_variants(gGLTFPBRMetallicRoughnessProgram, use_sun_shadow);
//llassert(success);
@@ -1383,6 +1412,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gPBRGlowProgram.mShaderFiles.push_back(make_pair("deferred/pbrglowF.glsl", GL_FRAGMENT_SHADER));
gPBRGlowProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ add_common_permutations(&gPBRGlowProgram);
+
success = make_rigged_variant(gPBRGlowProgram, gPBRGlowSkinnedProgram);
if (success)
{
@@ -1402,13 +1433,13 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gHUDPBROpaqueProgram.clearPermutations();
gHUDPBROpaqueProgram.addPermutation("IS_HUD", "1");
+ add_common_permutations(&gHUDPBROpaqueProgram);
+
success = gHUDPBROpaqueProgram.createShader();
llassert(success);
}
-
-
if (success)
{
LLGLSLShader* shader = &gDeferredPBRAlphaProgram;
@@ -1438,6 +1469,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
shader->addPermutation("HAS_EMISSIVE_MAP", "1");
shader->addPermutation("USE_VERTEX_COLOR", "1");
+ add_common_permutations(shader);
+
if (use_sun_shadow)
{
shader->addPermutation("HAS_SUN_SHADOW", "1");
@@ -1475,6 +1508,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
shader->addPermutation("IS_HUD", "1");
+ add_common_permutations(shader);
+
shader->mShaderLevel = mShaderLevel[SHADER_DEFERRED];
success = shader->createShader();
llassert(success);
@@ -1507,6 +1542,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
shader->addPermutation("TERRAIN_PBR_DETAIL", llformat("%d", detail));
shader->addPermutation("TERRAIN_PAINT_TYPE", llformat("%d", paint_type));
shader->addPermutation("TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT", llformat("%d", mapping));
+
+ add_common_permutations(shader);
+
success = success && shader->createShader();
llassert(success);
}
@@ -1519,6 +1557,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredTreeProgram.mShaderFiles.push_back(make_pair("deferred/treeV.glsl", GL_VERTEX_SHADER));
gDeferredTreeProgram.mShaderFiles.push_back(make_pair("deferred/treeF.glsl", GL_FRAGMENT_SHADER));
gDeferredTreeProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+
+ add_common_permutations(&gDeferredTreeProgram);
+
success = gDeferredTreeProgram.createShader();
}
@@ -1554,6 +1595,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredImpostorProgram.mShaderFiles.push_back(make_pair("deferred/impostorV.glsl", GL_VERTEX_SHADER));
gDeferredImpostorProgram.mShaderFiles.push_back(make_pair("deferred/impostorF.glsl", GL_FRAGMENT_SHADER));
gDeferredImpostorProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+
+ add_common_permutations(&gDeferredImpostorProgram);
+
success = gDeferredImpostorProgram.createShader();
llassert(success);
}
@@ -1562,6 +1606,7 @@ bool LLViewerShaderMgr::loadShadersDeferred()
{
gDeferredLightProgram.mName = "Deferred Light Shader";
gDeferredLightProgram.mFeatures.isDeferred = true;
+ gDeferredLightProgram.mFeatures.hasFullGBuffer = true;
gDeferredLightProgram.mFeatures.hasShadows = true;
gDeferredLightProgram.mFeatures.hasSrgb = true;
@@ -1572,6 +1617,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredLightProgram.clearPermutations();
+ add_common_permutations(&gDeferredLightProgram);
+
success = gDeferredLightProgram.createShader();
llassert(success);
}
@@ -1582,6 +1629,7 @@ bool LLViewerShaderMgr::loadShadersDeferred()
{
gDeferredMultiLightProgram[i].mName = llformat("Deferred MultiLight Shader %d", i);
gDeferredMultiLightProgram[i].mFeatures.isDeferred = true;
+ gDeferredMultiLightProgram[i].mFeatures.hasFullGBuffer = true;
gDeferredMultiLightProgram[i].mFeatures.hasShadows = true;
gDeferredMultiLightProgram[i].mFeatures.hasSrgb = true;
@@ -1592,6 +1640,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredMultiLightProgram[i].mShaderLevel = mShaderLevel[SHADER_DEFERRED];
gDeferredMultiLightProgram[i].addPermutation("LIGHT_COUNT", llformat("%d", i+1));
+ add_common_permutations(&gDeferredMultiLightProgram[i]);
+
success = gDeferredMultiLightProgram[i].createShader();
llassert(success);
}
@@ -1603,6 +1653,7 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredSpotLightProgram.mShaderFiles.clear();
gDeferredSpotLightProgram.mFeatures.hasSrgb = true;
gDeferredSpotLightProgram.mFeatures.isDeferred = true;
+ gDeferredSpotLightProgram.mFeatures.hasFullGBuffer = true;
gDeferredSpotLightProgram.mFeatures.hasShadows = true;
gDeferredSpotLightProgram.clearPermutations();
@@ -1610,6 +1661,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/spotLightF.glsl", GL_FRAGMENT_SHADER));
gDeferredSpotLightProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ add_common_permutations(&gDeferredSpotLightProgram);
+
success = gDeferredSpotLightProgram.createShader();
llassert(success);
}
@@ -1619,6 +1672,7 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredMultiSpotLightProgram.mName = "Deferred MultiSpotLight Shader";
gDeferredMultiSpotLightProgram.mFeatures.hasSrgb = true;
gDeferredMultiSpotLightProgram.mFeatures.isDeferred = true;
+ gDeferredMultiSpotLightProgram.mFeatures.hasFullGBuffer = true;
gDeferredMultiSpotLightProgram.mFeatures.hasShadows = true;
gDeferredMultiSpotLightProgram.clearPermutations();
@@ -1628,6 +1682,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredMultiSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/spotLightF.glsl", GL_FRAGMENT_SHADER));
gDeferredMultiSpotLightProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ add_common_permutations(&gDeferredMultiSpotLightProgram);
+
success = gDeferredMultiSpotLightProgram.createShader();
llassert(success);
}
@@ -1655,6 +1711,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredSunProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER));
gDeferredSunProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ add_common_permutations(&gDeferredSunProgram);
+
success = gDeferredSunProgram.createShader();
llassert(success);
}
@@ -1670,6 +1728,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredSunProbeProgram.mShaderFiles.push_back(make_pair("deferred/sunLightF.glsl", GL_FRAGMENT_SHADER));
gDeferredSunProbeProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ add_common_permutations(&gDeferredSunProbeProgram);
+
success = gDeferredSunProbeProgram.createShader();
llassert(success);
}
@@ -1684,6 +1744,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredBlurLightProgram.mShaderFiles.push_back(make_pair("deferred/blurLightF.glsl", GL_FRAGMENT_SHADER));
gDeferredBlurLightProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ add_common_permutations(&gDeferredBlurLightProgram);
+
success = gDeferredBlurLightProgram.createShader();
llassert(success);
}
@@ -1738,6 +1800,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
shader->addPermutation("HAS_SUN_SHADOW", "1");
}
+ add_common_permutations(shader);
+
if (rigged)
{
shader->addPermutation("HAS_SKIN", "1");
@@ -1803,6 +1867,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
shader->addPermutation("HAS_SUN_SHADOW", "1");
}
+ add_common_permutations(shader);
+
shader->mRiggedVariant = &gDeferredSkinnedAlphaImpostorProgram;
shader->mShaderLevel = mShaderLevel[SHADER_DEFERRED];
if (!rigged)
@@ -1831,6 +1897,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredAvatarEyesProgram.mShaderFiles.push_back(make_pair("deferred/avatarEyesV.glsl", GL_VERTEX_SHADER));
gDeferredAvatarEyesProgram.mShaderFiles.push_back(make_pair("deferred/diffuseF.glsl", GL_FRAGMENT_SHADER));
gDeferredAvatarEyesProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+
+ add_common_permutations(&gDeferredAvatarEyesProgram);
+
success = gDeferredAvatarEyesProgram.createShader();
llassert(success);
}
@@ -1847,6 +1916,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredFullbrightProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightV.glsl", GL_VERTEX_SHADER));
gDeferredFullbrightProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightF.glsl", GL_FRAGMENT_SHADER));
gDeferredFullbrightProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+
+ add_common_permutations(&gDeferredFullbrightProgram);
+
success = make_rigged_variant(gDeferredFullbrightProgram, gDeferredSkinnedFullbrightProgram);
success = gDeferredFullbrightProgram.createShader();
llassert(success);
@@ -1866,6 +1938,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gHUDFullbrightProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
gHUDFullbrightProgram.clearPermutations();
gHUDFullbrightProgram.addPermutation("IS_HUD", "1");
+
+ add_common_permutations(&gHUDFullbrightProgram);
+
success = gHUDFullbrightProgram.createShader();
llassert(success);
}
@@ -1884,6 +1959,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredFullbrightAlphaMaskProgram.clearPermutations();
gDeferredFullbrightAlphaMaskProgram.addPermutation("HAS_ALPHA_MASK","1");
gDeferredFullbrightAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+
+ add_common_permutations(&gDeferredFullbrightAlphaMaskProgram);
+
success = make_rigged_variant(gDeferredFullbrightAlphaMaskProgram, gDeferredSkinnedFullbrightAlphaMaskProgram);
success = success && gDeferredFullbrightAlphaMaskProgram.createShader();
llassert(success);
@@ -1903,6 +1981,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gHUDFullbrightAlphaMaskProgram.clearPermutations();
gHUDFullbrightAlphaMaskProgram.addPermutation("HAS_ALPHA_MASK", "1");
gHUDFullbrightAlphaMaskProgram.addPermutation("IS_HUD", "1");
+
+ add_common_permutations(&gHUDFullbrightAlphaMaskProgram);
+
gHUDFullbrightAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
success = gHUDFullbrightAlphaMaskProgram.createShader();
llassert(success);
@@ -1923,6 +2004,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredFullbrightAlphaMaskAlphaProgram.clearPermutations();
gDeferredFullbrightAlphaMaskAlphaProgram.addPermutation("HAS_ALPHA_MASK", "1");
gDeferredFullbrightAlphaMaskAlphaProgram.addPermutation("IS_ALPHA", "1");
+
+ add_common_permutations(&gDeferredFullbrightAlphaMaskAlphaProgram);
+
gDeferredFullbrightAlphaMaskAlphaProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
success = make_rigged_variant(gDeferredFullbrightAlphaMaskAlphaProgram, gDeferredSkinnedFullbrightAlphaMaskAlphaProgram);
success = success && gDeferredFullbrightAlphaMaskAlphaProgram.createShader();
@@ -1945,6 +2029,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gHUDFullbrightAlphaMaskAlphaProgram.addPermutation("HAS_ALPHA_MASK", "1");
gHUDFullbrightAlphaMaskAlphaProgram.addPermutation("IS_ALPHA", "1");
gHUDFullbrightAlphaMaskAlphaProgram.addPermutation("IS_HUD", "1");
+
+ add_common_permutations(&gHUDFullbrightAlphaMaskAlphaProgram);
+
gHUDFullbrightAlphaMaskAlphaProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
success = success && gHUDFullbrightAlphaMaskAlphaProgram.createShader();
llassert(success);
@@ -1963,6 +2050,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredFullbrightShinyProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightShinyF.glsl", GL_FRAGMENT_SHADER));
gDeferredFullbrightShinyProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
gDeferredFullbrightShinyProgram.mFeatures.hasReflectionProbes = true;
+
+ add_common_permutations(&gDeferredFullbrightShinyProgram);
+
success = make_rigged_variant(gDeferredFullbrightShinyProgram, gDeferredSkinnedFullbrightShinyProgram);
success = success && gDeferredFullbrightShinyProgram.createShader();
llassert(success);
@@ -1983,6 +2073,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gHUDFullbrightShinyProgram.mFeatures.hasReflectionProbes = true;
gHUDFullbrightShinyProgram.clearPermutations();
gHUDFullbrightShinyProgram.addPermutation("IS_HUD", "1");
+
+ add_common_permutations(&gHUDFullbrightShinyProgram);
+
success = gHUDFullbrightShinyProgram.createShader();
llassert(success);
}
@@ -1998,6 +2091,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredEmissiveProgram.mShaderFiles.push_back(make_pair("deferred/emissiveV.glsl", GL_VERTEX_SHADER));
gDeferredEmissiveProgram.mShaderFiles.push_back(make_pair("deferred/emissiveF.glsl", GL_FRAGMENT_SHADER));
gDeferredEmissiveProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+
+ add_common_permutations(&gDeferredEmissiveProgram);
+
success = make_rigged_variant(gDeferredEmissiveProgram, gDeferredSkinnedEmissiveProgram);
success = success && gDeferredEmissiveProgram.createShader();
llassert(success);
@@ -2012,10 +2108,12 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredSoftenProgram.mFeatures.hasAtmospherics = true;
gDeferredSoftenProgram.mFeatures.hasGamma = true;
gDeferredSoftenProgram.mFeatures.isDeferred = true;
+ gDeferredSoftenProgram.mFeatures.hasFullGBuffer = true;
gDeferredSoftenProgram.mFeatures.hasShadows = use_sun_shadow;
gDeferredSoftenProgram.mFeatures.hasReflectionProbes = mShaderLevel[SHADER_DEFERRED] > 2;
gDeferredSoftenProgram.clearPermutations();
+ add_common_permutations(&gDeferredSoftenProgram);
gDeferredSoftenProgram.mShaderFiles.push_back(make_pair("deferred/softenLightV.glsl", GL_VERTEX_SHADER));
gDeferredSoftenProgram.mShaderFiles.push_back(make_pair("deferred/softenLightF.glsl", GL_FRAGMENT_SHADER));
@@ -2052,6 +2150,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gHazeProgram.mShaderFiles.push_back(make_pair("deferred/softenLightV.glsl", GL_VERTEX_SHADER));
gHazeProgram.mShaderFiles.push_back(make_pair("deferred/hazeF.glsl", GL_FRAGMENT_SHADER));
+ add_common_permutations(&gHazeProgram);
+
gHazeProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
success = gHazeProgram.createShader();
@@ -2076,6 +2176,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gHazeWaterProgram.mShaderFiles.push_back(make_pair("deferred/waterHazeV.glsl", GL_VERTEX_SHADER));
gHazeWaterProgram.mShaderFiles.push_back(make_pair("deferred/waterHazeF.glsl", GL_FRAGMENT_SHADER));
+ add_common_permutations(&gHazeWaterProgram);
+
gHazeWaterProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
success = gHazeWaterProgram.createShader();
@@ -2105,6 +2207,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredSkinnedShadowProgram.mShaderFiles.push_back(make_pair("deferred/shadowSkinnedV.glsl", GL_VERTEX_SHADER));
gDeferredSkinnedShadowProgram.mShaderFiles.push_back(make_pair("deferred/shadowF.glsl", GL_FRAGMENT_SHADER));
gDeferredSkinnedShadowProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+
+ add_common_permutations(&gDeferredSkinnedShadowProgram);
+
// gDeferredSkinnedShadowProgram.addPermutation("DEPTH_CLAMP", "1"); // disable depth clamp for now
success = gDeferredSkinnedShadowProgram.createShader();
llassert(success);
@@ -2136,6 +2241,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredShadowFullbrightAlphaMaskProgram.clearPermutations();
gDeferredShadowFullbrightAlphaMaskProgram.addPermutation("DEPTH_CLAMP", "1");
gDeferredShadowFullbrightAlphaMaskProgram.addPermutation("IS_FULLBRIGHT", "1");
+
+ add_common_permutations(&gDeferredShadowFullbrightAlphaMaskProgram);
+
gDeferredShadowFullbrightAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
success = make_rigged_variant(gDeferredShadowFullbrightAlphaMaskProgram, gDeferredSkinnedShadowFullbrightAlphaMaskProgram);
success = success && gDeferredShadowFullbrightAlphaMaskProgram.createShader();
@@ -2165,6 +2273,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredShadowGLTFAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/pbrShadowAlphaMaskF.glsl", GL_FRAGMENT_SHADER));
gDeferredShadowGLTFAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
gDeferredShadowGLTFAlphaMaskProgram.clearPermutations();
+
+ add_common_permutations(&gDeferredShadowGLTFAlphaMaskProgram);
+
success = make_rigged_variant(gDeferredShadowGLTFAlphaMaskProgram, gDeferredSkinnedShadowGLTFAlphaMaskProgram);
success = success && gDeferredShadowGLTFAlphaMaskProgram.createShader();
llassert(success);
@@ -2178,6 +2289,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredShadowGLTFAlphaBlendProgram.mShaderFiles.push_back(make_pair("deferred/pbrShadowAlphaBlendF.glsl", GL_FRAGMENT_SHADER));
gDeferredShadowGLTFAlphaBlendProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
gDeferredShadowGLTFAlphaBlendProgram.clearPermutations();
+
+ add_common_permutations(&gDeferredShadowGLTFAlphaBlendProgram);
+
success = make_rigged_variant(gDeferredShadowGLTFAlphaBlendProgram, gDeferredSkinnedShadowGLTFAlphaBlendProgram);
success = success && gDeferredShadowGLTFAlphaBlendProgram.createShader();
llassert(success);
@@ -2231,6 +2345,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredTerrainProgram.mShaderFiles.clear();
gDeferredTerrainProgram.mShaderFiles.push_back(make_pair("deferred/terrainV.glsl", GL_VERTEX_SHADER));
gDeferredTerrainProgram.mShaderFiles.push_back(make_pair("deferred/terrainF.glsl", GL_FRAGMENT_SHADER));
+
+ add_common_permutations(&gDeferredTerrainProgram);
+
gDeferredTerrainProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
success = gDeferredTerrainProgram.createShader();
llassert(success);
@@ -2244,6 +2361,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredAvatarProgram.mShaderFiles.push_back(make_pair("deferred/avatarV.glsl", GL_VERTEX_SHADER));
gDeferredAvatarProgram.mShaderFiles.push_back(make_pair("deferred/avatarF.glsl", GL_FRAGMENT_SHADER));
gDeferredAvatarProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+
+ add_common_permutations(&gDeferredAvatarProgram);
+
success = gDeferredAvatarProgram.createShader();
llassert(success);
}
@@ -2277,6 +2397,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredAvatarAlphaProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ add_common_permutations(&gDeferredAvatarAlphaProgram);
+
success = gDeferredAvatarAlphaProgram.createShader();
llassert(success);
@@ -2419,7 +2541,7 @@ bool LLViewerShaderMgr::loadShadersDeferred()
}
}
- if (success)
+ if (gGLManager.mGLVersion > 3.15f && success)
{
std::vector<std::pair<std::string, std::string>> quality_levels = { {"SMAA_PRESET_LOW", "Low"},
{"SMAA_PRESET_MEDIUM", "Medium"},
@@ -2586,6 +2708,7 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gEnvironmentMapProgram.clearPermutations();
gEnvironmentMapProgram.addPermutation("HAS_HDRI", "1");
+ add_common_permutations(&gEnvironmentMapProgram);
gEnvironmentMapProgram.mShaderFiles.push_back(make_pair("deferred/skyV.glsl", GL_VERTEX_SHADER));
gEnvironmentMapProgram.mShaderFiles.push_back(make_pair("deferred/skyF.glsl", GL_FRAGMENT_SHADER));
gEnvironmentMapProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
@@ -2609,6 +2732,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredWLSkyProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
gDeferredWLSkyProgram.mShaderGroup = LLGLSLShader::SG_SKY;
+ add_common_permutations(&gDeferredWLSkyProgram);
+
success = gDeferredWLSkyProgram.createShader();
llassert(success);
}
@@ -2627,6 +2752,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredWLCloudProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
gDeferredWLCloudProgram.mShaderGroup = LLGLSLShader::SG_SKY;
gDeferredWLCloudProgram.addConstant( LLGLSLShader::SHADER_CONST_CLOUD_MOON_DEPTH ); // SL-14113
+
+ add_common_permutations(&gDeferredWLCloudProgram);
+
success = gDeferredWLCloudProgram.createShader();
llassert(success);
}
@@ -2644,6 +2772,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredWLSunProgram.mShaderFiles.push_back(make_pair("deferred/sunDiscF.glsl", GL_FRAGMENT_SHADER));
gDeferredWLSunProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
gDeferredWLSunProgram.mShaderGroup = LLGLSLShader::SG_SKY;
+
+ add_common_permutations(&gDeferredWLSunProgram);
+
success = gDeferredWLSunProgram.createShader();
llassert(success);
}
@@ -2663,6 +2794,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredWLMoonProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
gDeferredWLMoonProgram.mShaderGroup = LLGLSLShader::SG_SKY;
gDeferredWLMoonProgram.addConstant( LLGLSLShader::SHADER_CONST_CLOUD_MOON_DEPTH ); // SL-14113
+
+ add_common_permutations(&gDeferredWLMoonProgram);
+
success = gDeferredWLMoonProgram.createShader();
llassert(success);
}
@@ -2676,6 +2810,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredStarProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
gDeferredStarProgram.mShaderGroup = LLGLSLShader::SG_SKY;
gDeferredStarProgram.addConstant( LLGLSLShader::SHADER_CONST_STAR_DEPTH ); // SL-14113
+
+ add_common_permutations(&gDeferredWLSkyProgram);
+
success = gDeferredStarProgram.createShader();
llassert(success);
}
@@ -2718,6 +2855,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gDeferredBufferVisualProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER));
gDeferredBufferVisualProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredVisualizeBuffers.glsl", GL_FRAGMENT_SHADER));
gDeferredBufferVisualProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+
+ add_common_permutations(&gDeferredBufferVisualProgram);
+
success = gDeferredBufferVisualProgram.createShader();
}
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index 03c586b270..4a15b8624a 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -1557,8 +1557,8 @@ void LLViewerFetchedTexture::postCreateTexture()
if (!needsToSaveRawImage())
{
mNeedsAux = false;
- destroyRawImage();
}
+ destroyRawImage(); // will save raw image if needed
mNeedsCreateTexture = false;
}
diff --git a/indra/newview/llvlcomposition.cpp b/indra/newview/llvlcomposition.cpp
index 077e6e6cb1..3441e25c6a 100644
--- a/indra/newview/llvlcomposition.cpp
+++ b/indra/newview/llvlcomposition.cpp
@@ -102,14 +102,6 @@ namespace
}
};
-LLTerrainMaterials::LLTerrainMaterials()
-{
- for (S32 i = 0; i < ASSET_COUNT; ++i)
- {
- mMaterialTexturesSet[i] = false;
- }
-}
-
LLTerrainMaterials::~LLTerrainMaterials()
{
unboost();
@@ -199,7 +191,6 @@ void LLTerrainMaterials::setDetailAssetID(S32 asset, const LLUUID& id)
LLPointer<LLFetchedGLTFMaterial>& mat = mDetailMaterials[asset];
mat = id.isNull() ? nullptr : gGLTFMaterialList.getMaterial(id);
mDetailRenderMaterials[asset] = nullptr;
- mMaterialTexturesSet[asset] = false;
}
const LLGLTFMaterial* LLTerrainMaterials::getMaterialOverride(S32 asset) const
@@ -262,11 +253,17 @@ bool LLTerrainMaterials::makeMaterialsReady(bool boost, bool strict)
if (!material_asset_ready(mat)) { continue; }
LLPointer<LLFetchedGLTFMaterial>& render_mat = mDetailRenderMaterials[i];
+ // This will be mutated by materialTexturesReady, due to the way that
+ // function is implemented.
+ bool render_material_textures_set = bool(render_mat);
if (!render_mat)
{
render_mat = new LLFetchedGLTFMaterial();
*render_mat = *mat;
// This render_mat is effectively already loaded, because it gets its data from mat.
+ // However, its textures may not be loaded yet.
+ render_mat->materialBegin();
+ render_mat->materialComplete(true);
LLPointer<LLGLTFMaterial>& override_mat = mDetailMaterialOverrides[i];
if (override_mat)
@@ -275,7 +272,8 @@ bool LLTerrainMaterials::makeMaterialsReady(bool boost, bool strict)
}
}
- ready[i] = materialTexturesReady(render_mat, mMaterialTexturesSet[i], boost, strict);
+ ready[i] = materialTexturesReady(render_mat, render_material_textures_set, boost, strict);
+ llassert(render_material_textures_set);
}
#if 1
@@ -414,16 +412,6 @@ bool LLTerrainMaterials::materialTexturesReady(LLPointer<LLFetchedGLTFMaterial>&
return true;
}
-// Boost the loading priority of every known texture in the material
-// Return true when ready to use
-// static
-bool LLTerrainMaterials::makeMaterialReady(LLPointer<LLFetchedGLTFMaterial> &mat, bool &textures_set, bool boost, bool strict)
-{
- if (!material_asset_ready(mat)) { return false; }
-
- return materialTexturesReady(mat, textures_set, boost, strict);
-}
-
// static
const LLUUID (&LLVLComposition::getDefaultTextures())[ASSET_COUNT]
{
diff --git a/indra/newview/llvlcomposition.h b/indra/newview/llvlcomposition.h
index f15f9bff6a..b7cba0a093 100644
--- a/indra/newview/llvlcomposition.h
+++ b/indra/newview/llvlcomposition.h
@@ -27,18 +27,17 @@
#ifndef LL_LLVLCOMPOSITION_H
#define LL_LLVLCOMPOSITION_H
+#include "llfetchedgltfmaterial.h"
+#include "llimage.h"
+#include "llpointer.h"
+#include "llterrainpaintmap.h"
#include "llviewerlayer.h"
#include "llviewershadermgr.h"
#include "llviewertexture.h"
-#include "llpointer.h"
-
-#include "llimage.h"
class LLSurface;
class LLViewerFetchedTexture;
-class LLGLTFMaterial;
-class LLFetchedGLTFMaterial;
class LLModifyRegion
{
@@ -52,7 +51,7 @@ class LLTerrainMaterials : public LLModifyRegion
public:
friend class LLDrawPoolTerrain;
- LLTerrainMaterials();
+ LLTerrainMaterials() {}
virtual ~LLTerrainMaterials();
void apply(const LLModifyRegion& other);
@@ -93,15 +92,15 @@ protected:
static bool makeTextureReady(LLPointer<LLViewerFetchedTexture>& tex, bool boost);
// strict = true -> all materials must be sufficiently loaded
// strict = false -> at least one material must be loaded
- static bool makeMaterialReady(LLPointer<LLFetchedGLTFMaterial>& mat, bool& textures_set, bool boost, bool strict);
- // *NOTE: Prefer calling makeMaterialReady if mat is known to be LLFetchedGLTFMaterial
static bool materialTexturesReady(LLPointer<LLFetchedGLTFMaterial>& mat, bool& textures_set, bool boost, bool strict);
LLPointer<LLViewerFetchedTexture> mDetailTextures[ASSET_COUNT];
+ // *NOTE: Unlike mDetailRenderMaterials, the textures in this are not
+ // guaranteed to be set or loaded after a true return from
+ // makeMaterialsReady.
LLPointer<LLFetchedGLTFMaterial> mDetailMaterials[ASSET_COUNT];
LLPointer<LLGLTFMaterial> mDetailMaterialOverrides[ASSET_COUNT];
LLPointer<LLFetchedGLTFMaterial> mDetailRenderMaterials[ASSET_COUNT];
- bool mMaterialTexturesSet[ASSET_COUNT];
U32 mPaintType = TERRAIN_PAINT_TYPE_HEIGHTMAP_WITH_NOISE;
LLPointer<LLViewerTexture> mPaintMap;
diff --git a/indra/newview/llvotree.cpp b/indra/newview/llvotree.cpp
index 14b4273b02..cfb15b42c4 100644
--- a/indra/newview/llvotree.cpp
+++ b/indra/newview/llvotree.cpp
@@ -1167,9 +1167,15 @@ void LLVOTree::updateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax)
pos.load3(center.mV);
mDrawable->setPositionGroup(pos);
- LLFace* facep = mDrawable->getFace(0);
- facep->mExtents[0] = newMin;
- facep->mExtents[1] = newMax;
+ if (mDrawable->getNumFaces() > 0)
+ {
+ LLFace* facep = mDrawable->getFace(0);
+ if (facep)
+ {
+ facep->mExtents[0] = newMin;
+ facep->mExtents[1] = newMax;
+ }
+ }
}
bool LLVOTree::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, S32 face, bool pick_transparent, bool pick_rigged, bool pick_unselectable, S32 *face_hitp,
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 5d5c7f9aae..ba506da720 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -639,6 +639,15 @@ void LLVOVolume::animateTextures()
if (!facep->mTextureMatrix)
{
facep->mTextureMatrix = new LLMatrix4();
+ if (facep->getVirtualSize() > MIN_TEX_ANIM_SIZE)
+ {
+ // Fix the one edge case missed in
+ // LLVOVolume::updateTextureVirtualSize when the
+ // mTextureMatrix is not yet present
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_TCOORD);
+ mDrawable->getSpatialGroup()->dirtyGeom();
+ gPipeline.markRebuild(mDrawable->getSpatialGroup());
+ }
}
LLMatrix4& tex_mat = *facep->mTextureMatrix;
@@ -784,7 +793,24 @@ void LLVOVolume::updateTextureVirtualSize(bool forced)
LLFace* face = mDrawable->getFace(i);
if (!face) continue;
const LLTextureEntry *te = face->getTextureEntry();
- LLViewerTexture *imagep = face->getTexture();
+ LLViewerTexture *imagep = nullptr;
+ U32 ch_min;
+ U32 ch_max;
+ if (!te->getGLTFRenderMaterial())
+ {
+ ch_min = LLRender::DIFFUSE_MAP;
+ ch_max = LLRender::SPECULAR_MAP;
+ }
+ else
+ {
+ ch_min = LLRender::BASECOLOR_MAP;
+ ch_max = LLRender::EMISSIVE_MAP;
+ }
+ for (U32 ch = ch_min; (!imagep && ch <= ch_max); ++ch)
+ {
+ // Get _a_ non-null texture if possible (usually diffuse/basecolor, but could be something else)
+ imagep = face->getTexture(ch);
+ }
if (!imagep || !te ||
face->mExtents[0].equals3(face->mExtents[1]))
{
@@ -812,12 +838,25 @@ void LLVOVolume::updateTextureVirtualSize(bool forced)
// if the face has gotten small enough to turn off texture animation and texture
// animation is running, rebuild the render batch for this face to turn off
// texture animation
+ // Do the opposite when the face gets big enough.
+ // If a face is animatable, it will always have non-null mTextureMatrix
+ // pointer defined after the first call to LLVOVolume::animateTextures,
+ // although the animation is not always turned on.
if (face->mTextureMatrix != NULL)
{
- if ((vsize < MIN_TEX_ANIM_SIZE && old_size > MIN_TEX_ANIM_SIZE) ||
- (vsize > MIN_TEX_ANIM_SIZE && old_size < MIN_TEX_ANIM_SIZE))
+ if ((vsize > MIN_TEX_ANIM_SIZE) != (old_size > MIN_TEX_ANIM_SIZE))
{
gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_TCOORD);
+ // dirtyGeom+markRebuild tells the engine to call
+ // LLVolumeGeometryManager::rebuildGeom, which rebuilds the
+ // LLDrawInfo for the spatial group containing this LLFace,
+ // safely copying the mTextureMatrix from the LLFace the the
+ // LLDrawInfo. While it's not ideal to call it here, prims with
+ // animated faces get moved to a smaller partition to reduce
+ // side-effects of their updates (see shrinkWrap in
+ // LLVOVolume::animateTextures).
+ mDrawable->getSpatialGroup()->dirtyGeom();
+ gPipeline.markRebuild(mDrawable->getSpatialGroup());
}
}
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index af0bd013b2..0723f736b2 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -350,17 +350,22 @@ bool addDeferredAttachments(LLRenderTarget& target, bool for_impostor = false)
U32 emissive = GL_RGB16F;
bool hdr = gSavedSettings.getBOOL("RenderHDREnabled") && gGLManager.mGLVersion > 4.05f;
+ LLCachedControl<bool> has_emissive(gSavedSettings, "RenderEnableEmissiveBuffer", false);
if (!hdr)
{
- norm = GL_RGBA;
+ norm = GL_RGB10_A2;
emissive = GL_RGB;
}
- bool valid = true
- && 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
+ bool valid = true;
+ valid = valid && target.addColorAttachment(orm); // frag-data[1] specular OR PBR ORM
+ valid = valid && target.addColorAttachment(norm);
+ if (has_emissive)
+ {
+ valid = valid && target.addColorAttachment(emissive); // frag_data[3] PBR emissive OR material env intensity
+ }
+
return valid;
}
@@ -847,7 +852,7 @@ bool LLPipeline::allocateScreenBufferInternal(U32 resX, U32 resY)
GLuint screenFormat = hdr ? GL_RGBA16F : GL_RGBA;
- if (!mRT->screen.allocate(resX, resY, screenFormat)) return false;
+ if (!mRT->screen.allocate(resX, resY, GL_RGBA16F)) return false;
mRT->deferredScreen.shareDepthBuffer(mRT->screen);
@@ -7101,28 +7106,35 @@ void LLPipeline::generateExposure(LLRenderTarget* src, LLRenderTarget* dst, bool
static LLStaticHashedString dt("dt");
static LLStaticHashedString noiseVec("noiseVec");
static LLStaticHashedString dynamic_exposure_params("dynamic_exposure_params");
+ static LLStaticHashedString dynamic_exposure_params2("dynamic_exposure_params2");
+ static LLStaticHashedString dynamic_exposure_e("dynamic_exposure_enabled");
+ static LLCachedControl<bool> should_auto_adjust(gSavedSettings, "RenderSkyAutoAdjustLegacy", false);
+ static LLCachedControl<bool> dynamic_exposure_enabled(gSavedSettings, "RenderDynamicExposureEnabled", true);
static LLCachedControl<F32> dynamic_exposure_coefficient(gSavedSettings, "RenderDynamicExposureCoefficient", 0.175f);
- static LLCachedControl<bool> should_auto_adjust(gSavedSettings, "RenderSkyAutoAdjustLegacy", true);
+ static LLCachedControl<F32> dynamic_exposure_speed_error(gSavedSettings, "RenderDynamicExposureSpeedError", 0.1f);
+ static LLCachedControl<F32> dynamic_exposure_speed_target(gSavedSettings, "RenderDynamicExposureSpeedTarget", 2.f);
LLSettingsSky::ptr_t sky = LLEnvironment::instance().getCurrentSky();
F32 probe_ambiance = LLEnvironment::instance().getCurrentSky()->getReflectionProbeAmbiance(should_auto_adjust);
- F32 exp_min = 1.f;
- F32 exp_max = 1.f;
+ F32 exp_min = sky->getHDRMin();
+ F32 exp_max = sky->getHDRMax();
- if (probe_ambiance > 0.f)
+ if (dynamic_exposure_enabled)
{
- F32 hdr_scale = sqrtf(LLEnvironment::instance().getCurrentSky()->getGamma()) * 2.f;
-
- if (hdr_scale > 1.f)
- {
- exp_min = 1.f / hdr_scale;
- exp_max = hdr_scale;
- }
+ exp_min = sky->getHDROffset() - exp_min;
+ exp_max = sky->getHDROffset() + exp_max;
+ }
+ else
+ {
+ exp_min = sky->getHDROffset();
+ exp_max = sky->getHDROffset();
}
+
shader->uniform1f(dt, gFrameIntervalSeconds);
shader->uniform2f(noiseVec, ll_frand() * 2.0f - 1.0f, ll_frand() * 2.0f - 1.0f);
- shader->uniform3f(dynamic_exposure_params, dynamic_exposure_coefficient, exp_min, exp_max);
+ shader->uniform4f(dynamic_exposure_params, dynamic_exposure_coefficient, exp_min, exp_max, dynamic_exposure_speed_error);
+ shader->uniform4f(dynamic_exposure_params2, sky->getHDROffset(), exp_min, exp_max, dynamic_exposure_speed_target);
mScreenTriangleVB->setBuffer();
mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
@@ -7182,7 +7194,7 @@ void LLPipeline::tonemap(LLRenderTarget* src, LLRenderTarget* dst)
shader.uniform1i(tonemap_type, tonemap_type_setting);
static LLCachedControl<F32> tonemap_mix_setting(gSavedSettings, "RenderTonemapMix", 1.f);
- shader.uniform1f(tonemap_mix, tonemap_mix_setting);
+ shader.uniform1f(tonemap_mix, psky->getTonemapMix());
mScreenTriangleVB->setBuffer();
mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
@@ -8523,6 +8535,7 @@ void LLPipeline::renderDeferredLighting()
soften_shader.uniform1f(ssao_max_str, ssao_max);
LLEnvironment &environment = LLEnvironment::instance();
+
soften_shader.uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0);
soften_shader.uniform3fv(LLShaderMgr::LIGHTNORM, 1, environment.getClampedLightNorm().mV);
diff --git a/indra/newview/skins/default/xui/en/floater_material_editor.xml b/indra/newview/skins/default/xui/en/floater_material_editor.xml
index a6a401f43e..21ceeafeea 100644
--- a/indra/newview/skins/default/xui/en/floater_material_editor.xml
+++ b/indra/newview/skins/default/xui/en/floater_material_editor.xml
@@ -13,9 +13,6 @@
title="[MATERIAL_NAME]">
<string name="no_upload_fee_string">no upload fee</string>
<string name="upload_fee_string">L$[FEE] upload fee</string>
- <string name="material_selection_title">Material selection</string>
- <string name="material_selection_text">Select material:</string>
- <string name="material_batch_import_text">--- Bulk Upload All ---</string>
<string name="material_override_title">Editing Material</string>
<scroll_container
diff --git a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml
index e81ff7f343..aeaa8370ac 100644
--- a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml
+++ b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml
@@ -684,6 +684,20 @@
function="Pref.RenderOptionUpdate" />
</check_box>
+ <check_box
+ control_name="RenderVintageMode"
+ height="16"
+ initial_value="false"
+ label="Vintage Mode"
+ layout="topleft"
+ left="420"
+ name="VintageMode"
+ top_delta="20"
+ width="240">
+ <check_box.commit_callback
+ function="Pref.RenderOptionUpdate" />
+ </check_box>
+
<text
type="string"
length="1"
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index ad68bd8d81..44da9a8dac 100644
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -4318,7 +4318,10 @@ name="Command_360_Capture_Tooltip">Capture a 360 equirectangular image</string>
<!-- PBR Materials -->
<string name="Material Texture Name Header">Textures present this material: </string>
-
+ <string name="material_selection_title">Material selection</string>
+ <string name="material_selection_text">Select material:</string>
+ <string name="material_batch_import_text">--- Bulk Upload All ---</string>
+
<!-- Conversation log messages -->
<string name="logging_calls_disabled_log_empty">
Conversations are not being logged. To begin keeping a log, choose "Save: Log only" or "Save: Log and transcripts" under Preferences > Chat.
diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
index 8089abd7fd..fcf5a37364 100755
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -504,30 +504,34 @@ class Windows_x86_64_Manifest(ViewerManifest):
if self.is_packaging_viewer():
# Find secondlife-bin.exe in the 'configuration' dir, then rename it to the result of final_exe.
self.path(src='%s/secondlife-bin.exe' % self.args['configuration'], dst=self.final_exe())
- # Emit the whole app image as one of the GitHub step outputs. We
- # want the whole app -- but NOT the extraneous build products that
- # get tossed into the same directory, such as the installer and
- # the symbols tarball, so add exclusions. When we feed
- # upload-artifact multiple absolute pathnames, even just for
- # exclusion, it ends up creating several extraneous directory
- # levels within the artifact -- so try using only relative paths.
- # One problem: as of right now, our current directory os.getcwd()
- # is not the same as the initial working directory for this job
- # step, meaning paths relative to our os.getcwd() won't work for
- # the subsequent upload-artifact step. We're a couple directory
- # levels down. Try adjusting for those when specifying the base
- # for self.relpath().
- appbase = self.relpath(
- self.get_dst_prefix(),
- base=os.path.join(os.getcwd(), os.pardir, os.pardir))
- self.set_github_output('viewer_app', appbase,
- # except for this stuff
- *(('!' + os.path.join(appbase, pattern))
- for pattern in (
- 'secondlife-bin.*',
- '*_Setup.exe',
- '*.bat',
- '*.tar.xz')))
+
+ GITHUB_OUTPUT = os.getenv('GITHUB_OUTPUT')
+ if GITHUB_OUTPUT:
+ # Emit the whole app image as one of the GitHub step outputs. We
+ # want the whole app -- but NOT the extraneous build products that
+ # get tossed into the same directory, such as the installer and
+ # the symbols tarball, so add exclusions. When we feed
+ # upload-artifact multiple absolute pathnames, even just for
+ # exclusion, it ends up creating several extraneous directory
+ # levels within the artifact -- so try using only relative paths.
+ # One problem: as of right now, our current directory os.getcwd()
+ # is not the same as the initial working directory for this job
+ # step, meaning paths relative to our os.getcwd() won't work for
+ # the subsequent upload-artifact step. We're a couple directory
+ # levels down. Try adjusting for those when specifying the base
+ # for self.relpath().
+ appbase = self.relpath(
+ self.get_dst_prefix(),
+ base=os.path.join(os.getcwd(), os.pardir, os.pardir),
+ symlink=True)
+ self.set_github_output('viewer_app', appbase,
+ # except for this stuff
+ *(('!' + os.path.join(appbase, pattern))
+ for pattern in (
+ 'secondlife-bin.*',
+ '*_Setup.exe',
+ '*.bat',
+ '*.tar.xz')))
with self.prefix(src=os.path.join(pkgdir, "VMP")):
# include the compiled launcher scripts so that it gets included in the file_list