summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan "Geenz" Goodman <geenz@geenzo.com>2023-03-27 15:06:27 -0700
committerJonathan "Geenz" Goodman <geenz@geenzo.com>2023-03-27 15:06:27 -0700
commit91a9a94df115fa2a69abb6cb1a6eacb569f08eef (patch)
tree5afcc8e94c37d0aa5dc680ce32b0510ba429ef69
parent6c554c9c92a0150fdf5a177bf33269eac8341d02 (diff)
parentc20058b7a7207cb80426796d9d77864c696a5eec (diff)
Merge branch 'DRTVWR-559' of https://github.com/secondlife/viewer into DRTVWR-559
-rwxr-xr-xdoc/contributions.txt1
-rwxr-xr-xindra/llcorehttp/tests/test_llcorehttp_peer.py1
-rw-r--r--indra/llmath/llcamera.cpp222
-rw-r--r--indra/llmath/llcamera.h9
-rw-r--r--indra/llprimitive/llgltfmaterial.cpp10
-rw-r--r--indra/llprimitive/llgltfmaterial.h16
-rw-r--r--indra/llprimitive/llmaterial.cpp2
-rw-r--r--indra/llprimitive/lltextureentry.cpp27
-rw-r--r--indra/llrender/llimagegl.cpp50
-rw-r--r--indra/newview/app_settings/settings.xml59
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl29
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/moonF.glsl30
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/skyF.glsl28
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/starsF.glsl15
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl21
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl5
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl20
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl6
-rw-r--r--indra/newview/featuretable.txt16
-rw-r--r--indra/newview/featuretable_mac.txt16
-rw-r--r--indra/newview/llenvironment.cpp8
-rw-r--r--indra/newview/llfetchedgltfmaterial.cpp12
-rw-r--r--indra/newview/llfetchedgltfmaterial.h4
-rw-r--r--indra/newview/llgltfmateriallist.cpp30
-rw-r--r--indra/newview/lllocalgltfmaterials.cpp31
-rw-r--r--indra/newview/lllocalgltfmaterials.h5
-rw-r--r--indra/newview/llmaterialeditor.cpp9
-rw-r--r--indra/newview/llpanelface.cpp112
-rw-r--r--indra/newview/llreflectionmapmanager.cpp2
-rw-r--r--indra/newview/llviewerobject.cpp63
-rw-r--r--indra/newview/llviewerobject.h1
-rw-r--r--indra/newview/llvieweroctree.cpp4
-rwxr-xr-xindra/newview/llviewerregion.cpp16
-rw-r--r--indra/newview/llviewerregion.h4
-rw-r--r--indra/newview/llvovolume.cpp31
-rw-r--r--indra/newview/pipeline.cpp39
-rw-r--r--indra/newview/pipeline.h3
-rw-r--r--indra/newview/skins/default/xui/en/floater_material_editor.xml1
42 files changed, 436 insertions, 534 deletions
diff --git a/doc/contributions.txt b/doc/contributions.txt
index 5b5ca64d37..99c2242275 100755
--- a/doc/contributions.txt
+++ b/doc/contributions.txt
@@ -19,6 +19,7 @@ Agathos Frascati
CT-317
CT-352
Ai Austin
+ SL-19399
Aiko Ying
Aimee Trescothick
SNOW-227
diff --git a/indra/llcorehttp/tests/test_llcorehttp_peer.py b/indra/llcorehttp/tests/test_llcorehttp_peer.py
index 778de90962..185e8e25c6 100755
--- a/indra/llcorehttp/tests/test_llcorehttp_peer.py
+++ b/indra/llcorehttp/tests/test_llcorehttp_peer.py
@@ -38,7 +38,6 @@ from io import StringIO
from http.server import HTTPServer, BaseHTTPRequestHandler
-from llbase.fastest_elementtree import parse as xml_parse
from llbase import llsd
# we're in llcorehttp/tests ; testrunner.py is found in llmessage/tests
diff --git a/indra/llmath/llcamera.cpp b/indra/llmath/llcamera.cpp
index 9034182072..18d704dd0f 100644
--- a/indra/llmath/llcamera.cpp
+++ b/indra/llmath/llcamera.cpp
@@ -311,104 +311,6 @@ int LLCamera::sphereInFrustumQuick(const LLVector3 &sphere_center, const F32 rad
return 0;
}
-// HACK: This version is still around because the version below doesn't work
-// unless the agent planes are initialized.
-// Return 1 if sphere is in frustum, 2 if fully in frustum, otherwise 0.
-// NOTE: 'center' is in absolute frame.
-int LLCamera::sphereInFrustumOld(const LLVector3 &sphere_center, const F32 radius) const
-{
- // Returns 1 if sphere is in frustum, 0 if not.
- // modified so that default view frust is along X with Z vertical
- F32 x, y, z, rightDist, leftDist, topDist, bottomDist;
-
- // Subtract the view position
- //LLVector3 relative_center;
- //relative_center = sphere_center - getOrigin();
- LLVector3 rel_center(sphere_center);
- rel_center -= mOrigin;
-
- bool all_in = TRUE;
-
- // Transform relative_center.x to camera frame
- x = mXAxis * rel_center;
- if (x < MIN_NEAR_PLANE - radius)
- {
- return 0;
- }
- else if (x < MIN_NEAR_PLANE + radius)
- {
- all_in = FALSE;
- }
-
- if (x > mFarPlane + radius)
- {
- return 0;
- }
- else if (x > mFarPlane - radius)
- {
- all_in = FALSE;
- }
-
- // Transform relative_center.y to camera frame
- y = mYAxis * rel_center;
-
- // distance to plane is the dot product of (x, y, 0) * plane_normal
- rightDist = x * mLocalPlanes[PLANE_RIGHT][VX] + y * mLocalPlanes[PLANE_RIGHT][VY];
- if (rightDist < -radius)
- {
- return 0;
- }
- else if (rightDist < radius)
- {
- all_in = FALSE;
- }
-
- leftDist = x * mLocalPlanes[PLANE_LEFT][VX] + y * mLocalPlanes[PLANE_LEFT][VY];
- if (leftDist < -radius)
- {
- return 0;
- }
- else if (leftDist < radius)
- {
- all_in = FALSE;
- }
-
- // Transform relative_center.y to camera frame
- z = mZAxis * rel_center;
-
- topDist = x * mLocalPlanes[PLANE_TOP][VX] + z * mLocalPlanes[PLANE_TOP][VZ];
- if (topDist < -radius)
- {
- return 0;
- }
- else if (topDist < radius)
- {
- all_in = FALSE;
- }
-
- bottomDist = x * mLocalPlanes[PLANE_BOTTOM][VX] + z * mLocalPlanes[PLANE_BOTTOM][VZ];
- if (bottomDist < -radius)
- {
- return 0;
- }
- else if (bottomDist < radius)
- {
- all_in = FALSE;
- }
-
- if (all_in)
- {
- return 2;
- }
-
- return 1;
-}
-
-
-// HACK: This (presumably faster) version only currently works if you set up the
-// frustum planes using GL. At some point we should get those planes through another
-// mechanism, and then we can get rid of the "old" version above.
-
// Return 1 if sphere is in frustum, 2 if fully in frustum, otherwise 0.
// NOTE: 'center' is in absolute frame.
int LLCamera::sphereInFrustum(const LLVector3 &sphere_center, const F32 radius) const
@@ -463,65 +365,6 @@ F32 LLCamera::heightInPixels(const LLVector3 &center, F32 radius ) const
}
}
-// If pos is visible, return the distance from pos to the camera.
-// Use fudge distance to scale rad against top/bot/left/right planes
-// Otherwise, return -distance
-F32 LLCamera::visibleDistance(const LLVector3 &pos, F32 rad, F32 fudgedist, U32 planemask) const
-{
- if (mFixedDistance > 0)
- {
- return mFixedDistance;
- }
- LLVector3 dvec = pos - mOrigin;
- // Check visibility
- F32 dist = dvec.magVec();
- if (dist > rad)
- {
- F32 dp,tdist;
- dp = dvec * mXAxis;
- if (dp < -rad)
- return -dist;
-
- rad *= fudgedist;
- LLVector3 tvec(pos);
- for (int p=0; p<PLANE_NUM; p++)
- {
- if (!(planemask & (1<<p)))
- continue;
- tdist = -(mWorldPlanes[p].dist(tvec));
- if (tdist > rad)
- return -dist;
- }
- }
- return dist;
-}
-
-// Like visibleDistance, except uses mHorizPlanes[], which are left and right
-// planes perpindicular to (0,0,1) in world space
-F32 LLCamera::visibleHorizDistance(const LLVector3 &pos, F32 rad, F32 fudgedist, U32 planemask) const
-{
- if (mFixedDistance > 0)
- {
- return mFixedDistance;
- }
- LLVector3 dvec = pos - mOrigin;
- // Check visibility
- F32 dist = dvec.magVec();
- if (dist > rad)
- {
- rad *= fudgedist;
- LLVector3 tvec(pos);
- for (int p=0; p<HORIZ_PLANE_NUM; p++)
- {
- if (!(planemask & (1<<p)))
- continue;
- F32 tdist = -(mHorizPlanes[p].dist(tvec));
- if (tdist > rad)
- return -dist;
- }
- }
- return dist;
-}
// ---------------- friends and operators ----------------
@@ -536,18 +379,6 @@ std::ostream& operator<<(std::ostream &s, const LLCamera &C)
s << " Aspect = " << C.getAspect() << "\n";
s << " NearPlane = " << C.mNearPlane << "\n";
s << " FarPlane = " << C.mFarPlane << "\n";
- s << " TopPlane = " << C.mLocalPlanes[LLCamera::PLANE_TOP][VX] << " "
- << C.mLocalPlanes[LLCamera::PLANE_TOP][VY] << " "
- << C.mLocalPlanes[LLCamera::PLANE_TOP][VZ] << "\n";
- s << " BottomPlane = " << C.mLocalPlanes[LLCamera::PLANE_BOTTOM][VX] << " "
- << C.mLocalPlanes[LLCamera::PLANE_BOTTOM][VY] << " "
- << C.mLocalPlanes[LLCamera::PLANE_BOTTOM][VZ] << "\n";
- s << " LeftPlane = " << C.mLocalPlanes[LLCamera::PLANE_LEFT][VX] << " "
- << C.mLocalPlanes[LLCamera::PLANE_LEFT][VY] << " "
- << C.mLocalPlanes[LLCamera::PLANE_LEFT][VZ] << "\n";
- s << " RightPlane = " << C.mLocalPlanes[LLCamera::PLANE_RIGHT][VX] << " "
- << C.mLocalPlanes[LLCamera::PLANE_RIGHT][VY] << " "
- << C.mLocalPlanes[LLCamera::PLANE_RIGHT][VZ] << "\n";
s << "}";
return s;
}
@@ -675,26 +506,6 @@ void LLCamera::calcRegionFrustumPlanes(const LLVector3& shift, F32 far_clip_dist
void LLCamera::calculateFrustumPlanes(F32 left, F32 right, F32 top, F32 bottom)
{
- LLVector3 a, b, c;
-
- // For each plane we need to define 3 points (LLVector3's) in camera view space.
- // The order in which we pass the points to planeFromPoints() matters, because the
- // plane normal has a degeneracy of 2; we want it pointing _into_ the frustum.
-
- a.setVec(0.0f, 0.0f, 0.0f);
- b.setVec(mFarPlane, right, top);
- c.setVec(mFarPlane, right, bottom);
- mLocalPlanes[PLANE_RIGHT].setVec(a, b, c);
-
- c.setVec(mFarPlane, left, top);
- mLocalPlanes[PLANE_TOP].setVec(a, c, b);
-
- b.setVec(mFarPlane, left, bottom);
- mLocalPlanes[PLANE_LEFT].setVec(a, b, c);
-
- c.setVec(mFarPlane, right, bottom);
- mLocalPlanes[PLANE_BOTTOM].setVec( a, c, b);
-
//calculate center and radius squared of frustum in world absolute coordinates
static LLVector3 const X_AXIS(1.f, 0.f, 0.f);
mFrustCenter = X_AXIS*mFarPlane*0.5f;
@@ -718,39 +529,6 @@ void LLCamera::calculateFrustumPlanesFromWindow(F32 x1, F32 y1, F32 x2, F32 y2)
calculateFrustumPlanes(left, right, top, bottom);
}
-void LLCamera::calculateWorldFrustumPlanes()
-{
- F32 d;
- LLVector3 center = mOrigin - mXAxis*mNearPlane;
- mWorldPlanePos = center;
- LLVector3 pnorm;
- for (int p = 0; p < PLANE_NUM; p++)
- {
- mLocalPlanes[p].getVector3(pnorm);
- LLVector3 norm = rotateToAbsolute(pnorm);
- norm.normVec();
- d = -(center * norm);
- mWorldPlanes[p] = LLPlane(norm, d);
- }
- // horizontal planes, perpindicular to (0,0,1);
- LLVector3 zaxis(0, 0, 1.0f);
- F32 yaw = getYaw();
- {
- LLVector3 tnorm;
- mLocalPlanes[PLANE_LEFT].getVector3(tnorm);
- tnorm.rotVec(yaw, zaxis);
- d = -(mOrigin * tnorm);
- mHorizPlanes[HORIZ_PLANE_LEFT] = LLPlane(tnorm, d);
- }
- {
- LLVector3 tnorm;
- mLocalPlanes[PLANE_RIGHT].getVector3(tnorm);
- tnorm.rotVec(yaw, zaxis);
- d = -(mOrigin * tnorm);
- mHorizPlanes[HORIZ_PLANE_RIGHT] = LLPlane(tnorm, d);
- }
-}
-
// NOTE: this is the OpenGL matrix that will transform the default OpenGL view
// (-Z=at, Y=up) to the default view of the LLCamera class (X=at, Z=up):
//
diff --git a/indra/llmath/llcamera.h b/indra/llmath/llcamera.h
index d0afa0e88f..27eaa614c9 100644
--- a/indra/llmath/llcamera.h
+++ b/indra/llmath/llcamera.h
@@ -131,14 +131,10 @@ private:
S32 mViewHeightInPixels; // for ViewHeightInPixels() only
F32 mNearPlane;
F32 mFarPlane;
- LL_ALIGN_16(LLPlane mLocalPlanes[PLANE_NUM]);
F32 mFixedDistance; // Always return this distance, unless < 0
LLVector3 mFrustCenter; // center of frustum and radius squared for ultra-quick exclusion test
F32 mFrustRadiusSquared;
- LL_ALIGN_16(LLPlane mWorldPlanes[PLANE_NUM]);
- LL_ALIGN_16(LLPlane mHorizPlanes[HORIZ_PLANE_NUM]);
-
U32 mPlaneCount; //defaults to 6, if setUserClipPlane is called, uses user supplied clip plane in
LLVector3 mWorldPlanePos; // Position of World Planes (may be offset from camera)
@@ -184,7 +180,6 @@ public:
return atan2f(mXAxis[VZ], xylen);
}
- const LLPlane& getWorldPlane(S32 index) const { return mWorldPlanes[index]; }
const LLVector3& getWorldPlanePos() const { return mWorldPlanePos; }
// Copy mView, mAspect, mNearPlane, and mFarPlane to buffer.
@@ -200,7 +195,6 @@ public:
// Returns 1 if partly in, 2 if fully in.
// NOTE: 'center' is in absolute frame.
- S32 sphereInFrustumOld(const LLVector3 &center, const F32 radius) const;
S32 sphereInFrustum(const LLVector3 &center, const F32 radius) const;
S32 pointInFrustum(const LLVector3 &point) const { return sphereInFrustum(point, 0.0f); }
S32 sphereInFrustumFull(const LLVector3 &center, const F32 radius) const { return sphereInFrustum(center, radius); }
@@ -217,8 +211,6 @@ public:
F32 heightInPixels(const LLVector3 &center, F32 radius ) const;
// return the distance from pos to camera if visible (-distance if not visible)
- F32 visibleDistance(const LLVector3 &pos, F32 rad, F32 fudgescale = 1.0f, U32 planemask = PLANE_ALL_MASK) const;
- F32 visibleHorizDistance(const LLVector3 &pos, F32 rad, F32 fudgescale = 1.0f, U32 planemask = HORIZ_PLANE_ALL_MASK) const;
void setFixedDistance(F32 distance) { mFixedDistance = distance; }
friend std::ostream& operator<<(std::ostream &s, const LLCamera &C);
@@ -227,7 +219,6 @@ protected:
void calculateFrustumPlanes();
void calculateFrustumPlanes(F32 left, F32 right, F32 top, F32 bottom);
void calculateFrustumPlanesFromWindow(F32 x1, F32 y1, F32 x2, F32 y2);
- void calculateWorldFrustumPlanes();
} LL_ALIGN_POSTFIX(16);
diff --git a/indra/llprimitive/llgltfmaterial.cpp b/indra/llprimitive/llgltfmaterial.cpp
index 62b693919c..f3aa5b0648 100644
--- a/indra/llprimitive/llgltfmaterial.cpp
+++ b/indra/llprimitive/llgltfmaterial.cpp
@@ -692,3 +692,13 @@ void LLGLTFMaterial::applyOverride(const LLGLTFMaterial& override_mat)
}
}
}
+
+LLUUID LLGLTFMaterial::getHash() const
+{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
+ // HACK - hash the bytes of this object but don't include the ref count
+ LLUUID hash;
+ HBXXH128::digest(hash, (unsigned char*)this + sizeof(LLRefCount), sizeof(*this) - sizeof(LLRefCount));
+ return hash;
+}
+
diff --git a/indra/llprimitive/llgltfmaterial.h b/indra/llprimitive/llgltfmaterial.h
index b453b91e67..bdabd657e1 100644
--- a/indra/llprimitive/llgltfmaterial.h
+++ b/indra/llprimitive/llgltfmaterial.h
@@ -41,6 +41,8 @@ namespace tinygltf
class Model;
}
+class LLTextureEntry;
+
class LLGLTFMaterial : public LLRefCount
{
public:
@@ -115,14 +117,7 @@ public:
bool mOverrideAlphaMode = false;
// get a UUID based on a hash of this LLGLTFMaterial
- LLUUID getHash() const
- {
- LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- // HACK - hash the bytes of this object but don't include the ref count
- LLUUID hash;
- HBXXH128::digest(hash, (unsigned char*)this + sizeof(S32), sizeof(this) - sizeof(S32));
- return hash;
- }
+ LLUUID getHash() const;
//setters for various members (will clamp to acceptable ranges)
// for_override - set to true if this value is being set as part of an override (important for handling override to default value)
@@ -200,6 +195,11 @@ public:
// True if setBaseMaterial() was just called
bool isClearedForBaseMaterial();
+ // For local materials, they have to keep track of where
+ // they are assigned to for full updates
+ virtual void addTextureEntry(LLTextureEntry* te) {};
+ virtual void removeTextureEntry(LLTextureEntry* te) {};
+
private:
template<typename T>
void setFromTexture(const tinygltf::Model& model, const T& texture_info, TextureInfo texture_info_id);
diff --git a/indra/llprimitive/llmaterial.cpp b/indra/llprimitive/llmaterial.cpp
index a694a666c6..37525e4a3d 100644
--- a/indra/llprimitive/llmaterial.cpp
+++ b/indra/llprimitive/llmaterial.cpp
@@ -481,7 +481,7 @@ LLUUID LLMaterial::getHash() const
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
// HACK - hash the bytes of this LLMaterial, but trim off the S32 in LLRefCount
LLUUID id;
- HBXXH128::digest(id, (unsigned char*)this + sizeof(S32), sizeof(this) - sizeof(S32));
+ HBXXH128::digest(id, (unsigned char*)this + sizeof(LLRefCount), sizeof(*this) - sizeof(LLRefCount));
return id;
}
diff --git a/indra/llprimitive/lltextureentry.cpp b/indra/llprimitive/lltextureentry.cpp
index 49f67918f8..a665db378b 100644
--- a/indra/llprimitive/lltextureentry.cpp
+++ b/indra/llprimitive/lltextureentry.cpp
@@ -112,7 +112,15 @@ LLTextureEntry &LLTextureEntry::operator=(const LLTextureEntry &rhs)
mMaterialID = rhs.mMaterialID;
+ if (mGLTFMaterial)
+ {
+ mGLTFMaterial->removeTextureEntry(this);
+ }
mGLTFMaterial = rhs.mGLTFMaterial;
+ if (mGLTFMaterial)
+ {
+ mGLTFMaterial->addTextureEntry(this);
+ }
if (rhs.mGLTFMaterialOverrides.notNull())
{
@@ -155,6 +163,12 @@ LLTextureEntry::~LLTextureEntry()
delete mMediaEntry;
mMediaEntry = NULL;
}
+
+ if (mGLTFMaterial)
+ {
+ mGLTFMaterial->removeTextureEntry(this);
+ mGLTFMaterial = NULL;
+ }
}
bool LLTextureEntry::operator!=(const LLTextureEntry &rhs) const
@@ -524,7 +538,20 @@ void LLTextureEntry::setGLTFMaterial(LLGLTFMaterial* material, bool local_origin
// NOTE: if you're hitting this assert, try to make sure calling code is using LLViewerObject::setRenderMaterialID
llassert(!local_origin || getGLTFMaterialOverride() == nullptr || getGLTFMaterialOverride()->isClearedForBaseMaterial());
+ if (mGLTFMaterial)
+ {
+ // Local materials have to keep track
+ // due to update mechanics
+ mGLTFMaterial->removeTextureEntry(this);
+ }
+
mGLTFMaterial = material;
+
+ if (mGLTFMaterial)
+ {
+ mGLTFMaterial->addTextureEntry(this);
+ }
+
if (mGLTFMaterial == nullptr)
{
setGLTFRenderMaterial(nullptr);
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index f4b580c490..5b0690bc79 100644
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -1100,15 +1100,9 @@ void LLImageGL::postAddToAtlas()
stop_glerror();
}
-// Equivalent to calling glSetSubImage2D(target, miplevel, x_offset, y_offset, width, height, pixformat, pixtype, src)
-// However, instead there are multiple calls to glSetSubImage2D on smaller slices of the image
-void subImageLines(U32 target, S32 miplevel, S32 x_offset, S32 y_offset, S32 width, S32 height, U32 pixformat, U32 pixtype, const U8* src)
+U32 type_width_from_pixtype(U32 pixtype)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
-
- U32 components = LLImageGL::dataFormatComponents(pixformat);
U32 type_width = 0;
-
switch (pixtype)
{
case GL_UNSIGNED_BYTE:
@@ -1128,12 +1122,22 @@ void subImageLines(U32 target, S32 miplevel, S32 x_offset, S32 y_offset, S32 wid
default:
LL_ERRS() << "Unknown type: " << pixtype << LL_ENDL;
}
+ return type_width;
+}
+
+// Equivalent to calling glSetSubImage2D(target, miplevel, x_offset, y_offset, width, height, pixformat, pixtype, src), assuming the total width of the image is data_width
+// However, instead there are multiple calls to glSetSubImage2D on smaller slices of the image
+void subImageLines(U32 target, S32 miplevel, S32 x_offset, S32 y_offset, S32 width, S32 height, U32 pixformat, U32 pixtype, const U8* src, S32 data_width)
+{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- const U32 line_width = width * components * type_width;
+ U32 components = LLImageGL::dataFormatComponents(pixformat);
+ U32 type_width = type_width_from_pixtype(pixtype);
+
+ const U32 line_width = data_width * components * type_width;
const U32 y_offset_end = y_offset + height;
- for (U32 y = y_offset; y < y_offset_end; ++y)
+ for (U32 y_pos = y_offset; y_pos < y_offset_end; ++y_pos)
{
- const S32 y_pos = y + y_offset;
glTexSubImage2D(target, miplevel, x_offset, y_pos, width, 1, pixformat, pixtype, src);
src += line_width;
}
@@ -1213,29 +1217,29 @@ BOOL LLImageGL::setSubImage(const U8* datap, S32 data_width, S32 data_height, S3
stop_glerror();
}
- datap += (y_pos * data_width + x_pos) * getComponents();
+ const U8* sub_datap = datap + (y_pos * data_width + x_pos) * getComponents();
// Update the GL texture
BOOL res = gGL.getTexUnit(0)->bindManual(mBindTarget, tex_name);
if (!res) LL_ERRS() << "LLImageGL::setSubImage(): bindTexture failed" << LL_ENDL;
stop_glerror();
-//#if LL_DARWIN
-// const bool use_sub_image = false;
-//#else
-// const bool use_sub_image = !isCompressed();
-//#endif
- //if (!use_sub_image)
+#if LL_DARWIN
+ const bool use_sub_image = false;
+#else
+ const bool use_sub_image = !isCompressed();
+#endif
+ if (!use_sub_image)
{
// *TODO: Why does this work here, in setSubImage, but not in
// setManualImage? Maybe because it only gets called with the
// dimensions of the full image? Or because the image is never
// compressed?
- glTexSubImage2D(mTarget, 0, x_pos, y_pos, width, height, mFormatPrimary, mFormatType, datap);
+ glTexSubImage2D(mTarget, 0, x_pos, y_pos, width, height, mFormatPrimary, mFormatType, sub_datap);
+ }
+ else
+ {
+ subImageLines(mTarget, 0, x_pos, y_pos, width, height, mFormatPrimary, mFormatType, sub_datap, data_width);
}
- //else
- //{
- // subImageLines(mTarget, 0, x_pos, y_pos, width, height, mFormatPrimary, mFormatType, datap);
- //}
gGL.getTexUnit(0)->disable();
stop_glerror();
@@ -1475,7 +1479,7 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt
if (src)
{
LL_PROFILE_ZONE_NAMED("glTexImage2D copy");
- subImageLines(target, miplevel, 0, 0, width, height, pixformat, pixtype, src);
+ subImageLines(target, miplevel, 0, 0, width, height, pixformat, pixtype, src, width);
}
}
alloc_tex_image(width, height, pixformat);
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 8996b1dd4f..e0662b8115 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -9002,37 +9002,6 @@
<key>Value</key>
<integer>1</integer>
</map>
-
- <key>RenderShadowNearDist</key>
- <map>
- <key>Comment</key>
- <string>Near clip plane of shadow camera (affects precision of depth shadows).</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>Vector3</string>
- <key>Value</key>
- <array>
- <real>256</real>
- <real>256</real>
- <real>256</real>
- </array>
- </map>
- <key>RenderShadowClipPlanes</key>
- <map>
- <key>Comment</key>
- <string>Near clip plane split distances for shadow map frusta.</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>Vector3</string>
- <key>Value</key>
- <array>
- <real>1.0</real>
- <real>12.0</real>
- <real>32.0</real>
- </array>
- </map>
<key>RenderShadowSplitExponent</key>
<map>
<key>Comment</key>
@@ -9048,21 +9017,6 @@
<real>2.0</real>
</array>
</map>
- <key>RenderShadowOrthoClipPlanes</key>
- <map>
- <key>Comment</key>
- <string>Near clip plane split distances for orthographic shadow map frusta.</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>Vector3</string>
- <key>Value</key>
- <array>
- <real>4.0</real>
- <real>8.0</real>
- <real>24.0</real>
- </array>
- </map>
<key>RenderShadowProjOffset</key>
<map>
<key>Comment</key>
@@ -10402,7 +10356,7 @@
<key>Type</key>
<string>F32</string>
<key>Value</key>
- <real>32</real>
+ <real>16</real>
</map>
<key>RenderTonemapper</key>
<map>
@@ -14261,6 +14215,17 @@
<key>Value</key>
<integer>1</integer>
</map>
+ <key>RenderOcclusionTimeout</key>
+ <map>
+ <key>Comment</key>
+ <string>Maximum number of frames to wait on an occlusion query before forcibly reading it back</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>S32</string>
+ <key>Value</key>
+ <integer>8</integer>
+ </map>
<key>UseObjectCacheOcclusion</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl
index fe796a054d..e0e97bb938 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl
@@ -24,19 +24,15 @@
*/
/*[EXTRA_CODE_HERE]*/
-#ifdef DEFINE_GL_FRAGCOLOR
-out vec4 frag_data[3];
-#else
-#define frag_data gl_FragData
-#endif
+out vec4 frag_data[4];
/////////////////////////////////////////////////////////////////////////
// The fragment shader for the sky
/////////////////////////////////////////////////////////////////////////
-VARYING vec3 vary_CloudColorSun;
-VARYING vec3 vary_CloudColorAmbient;
-VARYING float vary_CloudDensity;
+in vec3 vary_CloudColorSun;
+in vec3 vary_CloudColorAmbient;
+in float vary_CloudDensity;
uniform sampler2D cloud_noise_texture;
uniform sampler2D cloud_noise_texture_next;
@@ -46,16 +42,16 @@ uniform vec3 cloud_pos_density2;
uniform float cloud_scale;
uniform float cloud_variance;
-VARYING vec2 vary_texcoord0;
-VARYING vec2 vary_texcoord1;
-VARYING vec2 vary_texcoord2;
-VARYING vec2 vary_texcoord3;
-VARYING float altitude_blend_factor;
+in vec2 vary_texcoord0;
+in vec2 vary_texcoord1;
+in vec2 vary_texcoord2;
+in vec2 vary_texcoord3;
+in float altitude_blend_factor;
vec4 cloudNoise(vec2 uv)
{
- vec4 a = texture2D(cloud_noise_texture, uv);
- vec4 b = texture2D(cloud_noise_texture_next, uv);
+ vec4 a = texture(cloud_noise_texture, uv);
+ vec4 b = texture(cloud_noise_texture_next, uv);
vec4 cloud_noise_sample = mix(a, b, blend_factor);
return cloud_noise_sample;
}
@@ -118,8 +114,9 @@ void main()
color.rgb *= 2.0;
/// Gamma correct for WL (soft clip effect).
- frag_data[0] = vec4(color.rgb, alpha1);
+ 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);
+ frag_data[3] = vec4(color.rgb, alpha1);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl
index 41dd485fae..fabc61eb5e 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl
@@ -27,11 +27,7 @@
/*[EXTRA_CODE_HERE]*/
-#ifdef DEFINE_GL_FRAGCOLOR
-out vec4 frag_data[3];
-#else
-#define frag_data gl_FragData
-#endif
+out vec4 frag_data[4];
uniform vec4 color;
uniform vec3 moonlight_color;
@@ -39,12 +35,7 @@ uniform vec3 moon_dir;
uniform float moon_brightness;
uniform sampler2D diffuseMap;
-VARYING vec2 vary_texcoord0;
-
-vec3 srgb_to_linear(vec3 c);
-
-/// Soft clips the light with a gamma correction
-vec3 scaleSoftClip(vec3 light);
+in vec2 vary_texcoord0;
void main()
{
@@ -53,24 +44,25 @@ void main()
if( moon_dir.z > 0 )
fade = clamp( moon_dir.z*moon_dir.z*4.0, 0.0, 1.0 );
- vec4 c = texture2D(diffuseMap, vary_texcoord0.xy);
+ vec4 c = texture(diffuseMap, vary_texcoord0.xy);
// SL-14113 Don't write to depth; prevent moon's quad from hiding stars which should be visible
// Moon texture has transparent pixels <0x55,0x55,0x55,0x00>
if (c.a <= 2./255.) // 0.00784
+ {
discard;
+ }
-// c.rgb = srgb_to_linear(c.rgb);
- c.rgb *= moonlight_color.rgb;
- c.rgb *= moon_brightness;
- c.rgb *= fade;
- c.a *= fade;
+ c.rgb *= moonlight_color.rgb;
+ c.rgb *= moon_brightness;
- c.rgb = scaleSoftClip(c.rgb);
+ c.rgb *= fade;
+ c.a *= fade;
- frag_data[0] = vec4(c.rgb, c.a);
+ frag_data[0] = vec4(0);
frag_data[1] = vec4(0.0);
frag_data[2] = vec4(0.0, 0.0, 0.0, GBUFFER_FLAG_HAS_ATMOS);
+ frag_data[3] = vec4(c.rgb, c.a);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
index 930338cefb..cc4c3b5dce 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
@@ -22,12 +22,10 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
-/*[EXTRA_CODE_HERE]*/
// Inputs
-VARYING vec3 vary_HazeColor;
-VARYING float vary_LightNormPosDot;
+in vec3 vary_HazeColor;
+in float vary_LightNormPosDot;
uniform sampler2D rainbow_map;
uniform sampler2D halo_map;
@@ -36,11 +34,9 @@ uniform float moisture_level;
uniform float droplet_radius;
uniform float ice_level;
-#ifdef DEFINE_GL_FRAGCOLOR
-out vec4 frag_data[3];
-#else
-#define frag_data gl_FragData
-#endif
+out vec4 frag_data[4];
+
+vec3 srgb_to_linear(vec3 c);
/////////////////////////////////////////////////////////////////////////
// The fragment shader for the sky
@@ -63,19 +59,16 @@ vec3 rainbow(float d)
d = clamp(d, 0.0, 0.25) + interior_coord;
float rad = (droplet_radius - 5.0f) / 1024.0f;
- return pow(texture2D(rainbow_map, vec2(rad+0.5, d)).rgb, vec3(1.8)) * moisture_level;
+ return pow(texture(rainbow_map, vec2(rad+0.5, d)).rgb, vec3(1.8)) * moisture_level;
}
vec3 halo22(float d)
{
d = clamp(d, 0.1, 1.0);
float v = sqrt(clamp(1 - (d * d), 0, 1));
- return texture2D(halo_map, vec2(0, v)).rgb * ice_level;
+ return texture(halo_map, vec2(0, v)).rgb * ice_level;
}
-/// Soft clips the light with a gamma correction
-vec3 scaleSoftClip(vec3 light);
-
void main()
{
// Potential Fill-rate optimization. Add cloud calculation
@@ -91,11 +84,10 @@ void main()
color.rgb += rainbow(optic_d);
color.rgb += halo_22;
color.rgb *= 2.;
- color.rgb = scaleSoftClip(color.rgb);
- // Gamma correct for WL (soft clip effect).
- frag_data[0] = vec4(color.rgb, 1.0);
- frag_data[1] = vec4(0.0,0.0,0.0,0.0);
+ frag_data[0] = vec4(0);
+ frag_data[1] = vec4(0);
frag_data[2] = vec4(0.0,0.0,0.0,GBUFFER_FLAG_SKIP_ATMOS); //1.0 in norm.w masks off fog
+ frag_data[3] = vec4(color.rgb, 1.0);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl
index cdafdba15c..4f1756c367 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl
@@ -25,15 +25,11 @@
/*[EXTRA_CODE_HERE]*/
-#ifdef DEFINE_GL_FRAGCOLOR
-out vec4 frag_data[3];
-#else
-#define frag_data gl_FragData
-#endif
+out vec4 frag_data[4];
-VARYING vec4 vertex_color;
-VARYING vec2 vary_texcoord0;
-VARYING vec2 screenpos;
+in vec4 vertex_color;
+in vec2 vary_texcoord0;
+in vec2 screenpos;
uniform sampler2D diffuseMap;
uniform float blend_factor;
@@ -62,8 +58,9 @@ void main()
col.a = (col.a * factor) * 32.0f;
col.a *= twinkle();
- frag_data[0] = col;
+ 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);
+ frag_data[3] = col;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl
index e35ea83f0a..a85e6ebc66 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl
@@ -27,36 +27,29 @@
/*[EXTRA_CODE_HERE]*/
-#ifdef DEFINE_GL_FRAGCOLOR
-out vec4 frag_data[3];
-#else
-#define frag_data gl_FragData
-#endif
+out vec4 frag_data[4];
vec3 srgb_to_linear(vec3 c);
-vec3 fullbrightAtmosTransport(vec3 light);
-vec3 fullbrightScaleSoftClip(vec3 light);
uniform sampler2D diffuseMap;
uniform sampler2D altDiffuseMap;
uniform float blend_factor; // interp factor between sunDisc A/B
-VARYING vec2 vary_texcoord0;
-VARYING float sun_fade;
+in vec2 vary_texcoord0;
+in float sun_fade;
void main()
{
- vec4 sunDiscA = texture2D(diffuseMap, vary_texcoord0.xy);
- vec4 sunDiscB = texture2D(altDiffuseMap, vary_texcoord0.xy);
+ vec4 sunDiscA = texture(diffuseMap, vary_texcoord0.xy);
+ vec4 sunDiscB = texture(altDiffuseMap, vary_texcoord0.xy);
vec4 c = mix(sunDiscA, sunDiscB, blend_factor);
- //c.rgb = fullbrightAtmosTransport(c.rgb);
- c.rgb = fullbrightScaleSoftClip(c.rgb);
// SL-9806 stars poke through
//c.a *= sun_fade;
- frag_data[0] = c;
+ 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);
+ frag_data[3] = c;
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl b/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl
index b6f080739e..a1839d4a67 100644
--- a/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl
@@ -151,7 +151,7 @@ vec4 prefilterEnvMap(vec3 R)
// Solid angle of 1 pixel across all cube faces
float omegaP = 4.0 * PI / (6.0 * envMapDim * envMapDim);
// Biased (+1.0) mip level for better result
- float mipLevel = roughness == 0.0 ? 0.0 : max(0.5 * log2(omegaS / omegaP) + 1.0, 0.0f);
+ float mipLevel = roughness == 0.0 ? 0.0 : clamp(0.5 * log2(omegaS / omegaP) + 1.0, 0.0f, max_probe_lod);
color += textureLod(reflectionProbes, vec4(L, sourceIdx), mipLevel) * dotNL;
totalWeight += dotNL;
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
index ef35bf3fd7..e7322c14fb 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
@@ -79,7 +79,6 @@ vec3 srgb_to_linear(vec3 c);
vec3 linear_to_srgb(vec3 c);
vec2 encode_normal (vec3 n);
-vec3 scaleSoftClipFragLinear(vec3 l);
vec3 atmosFragLightingLinear(vec3 light, vec3 additive, vec3 atten);
void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, out vec3 sunlit, out vec3 amblit, out vec3 atten, out vec3 additive);
@@ -279,7 +278,6 @@ void main()
color.rgb = linear_to_srgb(color.rgb);
color.rgb = atmosFragLightingLinear(color.rgb, additive, atten);
- color.rgb = scaleSoftClipFragLinear(color.rgb);
color.rgb = srgb_to_linear(color.rgb);
vec4 light = vec4(0,0,0,0);
diff --git a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl
index 7d8f9c218d..0fb30559d4 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl
@@ -37,7 +37,6 @@ uniform sampler2D depthMap;
uniform sampler2D diffuseRect;
uniform sampler2D specularRect;
uniform sampler2D emissiveRect; // PBR linear packed Occlusion, Roughness, Metal. See: pbropaqueF.glsl
-uniform sampler2D noiseMap;
uniform sampler2D lightFunc;
uniform vec3 env_mat[3];
@@ -132,9 +131,6 @@ void main()
}
else
{
-
- float noise = texture2D(noiseMap, tc).b;
-
diffuse = srgb_to_linear(diffuse);
spec.rgb = srgb_to_linear(spec.rgb);
@@ -154,7 +150,6 @@ void main()
float fa = light_col[i].a;
float dist_atten = calcLegacyDistanceAttenuation(dist, fa);
- dist_atten *= noise;
float lit = nl * dist_atten;
diff --git a/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl
index 5ed8a75e0e..30b7895157 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl
@@ -41,7 +41,6 @@ uniform sampler2D normalMap;
uniform sampler2D emissiveRect; // PBR linear packed Occlusion, Roughness, Metal. See: pbropaqueF.glsl
uniform samplerCube environmentMap;
uniform sampler2D lightMap;
-uniform sampler2D noiseMap;
uniform sampler2D projectionMap; // rgba
uniform sampler2D lightFunc;
@@ -187,7 +186,6 @@ void main()
diffuse = srgb_to_linear(diffuse);
spec.rgb = srgb_to_linear(spec.rgb);
- float noise = texture2D(noiseMap, tc).b;
if (proj_tc.z > 0.0 &&
proj_tc.x < 1.0 &&
proj_tc.y < 1.0 &&
@@ -199,7 +197,7 @@ void main()
if (nl > 0.0)
{
- lit = nl * dist_atten * noise;
+ lit = nl * dist_atten;
dlit = getProjectedLightDiffuseColor( l_dist, proj_tc.xy );
@@ -209,7 +207,7 @@ void main()
amb_da += (nl*0.5+0.5) /* * (1.0-shadow) */ * proj_ambiance;
}
- amb_rgb = getProjectedLightAmbiance( amb_da, dist_atten, lit, nl, noise, proj_tc.xy );
+ amb_rgb = getProjectedLightAmbiance( amb_da, dist_atten, lit, nl, 1.0, proj_tc.xy );
final_color += diffuse.rgb * amb_rgb;
}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl
index 9b5cb39883..7a5676e0ab 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl
@@ -92,6 +92,7 @@ bool shouldSampleProbe(int i, vec3 pos)
return false;
}
+ // never allow automatic probes to encroach on box probes
sample_automatic = false;
}
else
@@ -426,25 +427,19 @@ void boxIntersectDebug(vec3 origin, vec3 pos, int i, inout vec4 col)
// dir - normal to be weighted
// origin - center of sphere probe
// r - radius of probe influence volume
-// min_da - minimum angular attenuation coefficient
// i - index of probe in refSphere
// dw - distance weight
-float sphereWeight(vec3 pos, vec3 dir, vec3 origin, float r, float min_da, int i, out float dw)
+float sphereWeight(vec3 pos, vec3 dir, vec3 origin, float r, int i, out float dw)
{
float r1 = r * 0.5; // 50% of radius (outer sphere to start interpolating down)
vec3 delta = pos.xyz - origin;
float d2 = max(length(delta), 0.001);
- float r2 = r1; //r1 * r1;
-
- //float atten = 1.0 - max(d2 - r2, 0.0) / max((rr - r2), 0.001);
- float atten = 1.0 - max(d2 - r2, 0.0) / max((r - r2), 0.001);
+ float atten = 1.0 - max(d2 - r1, 0.0) / max((r - r1), 0.001);
float w = 1.0 / d2;
dw = w * atten * max(r, 1.0)*4;
- atten *= max(dot(normalize(-delta), dir), min_da);
-
w *= atten;
return w;
@@ -481,7 +476,7 @@ vec3 tapRefMap(vec3 pos, vec3 dir, out float w, out float dw, float lod, vec3 c,
refIndex[i].w < 1 ? 4096.0*4096.0 : // <== effectively disable parallax correction for automatically placed probes to keep from bombing the world with obvious spheres
rr);
- w = sphereWeight(pos, dir, refSphere[i].xyz, r, 0.25, i, dw);
+ w = sphereWeight(pos, dir, refSphere[i].xyz, r, i, dw);
}
v -= c;
@@ -521,7 +516,7 @@ vec3 tapIrradianceMap(vec3 pos, vec3 dir, out float w, out float dw, vec3 c, int
refIndex[i].w < 1 ? 4096.0*4096.0 : // <== effectively disable parallax correction for automatically placed probes to keep from bombing the world with obvious spheres
rr);
- w = sphereWeight(pos, dir, refSphere[i].xyz, r, 0.001, i, dw);
+ w = sphereWeight(pos, dir, refSphere[i].xyz, r, i, dw);
}
v -= c;
@@ -559,7 +554,6 @@ vec3 sampleProbes(vec3 pos, vec3 dir, float lod)
float dw = 0;
vec3 refcol;
-
{
refcol = tapRefMap(pos, dir, w, dw, lod, refSphere[i].xyz, i);
@@ -653,7 +647,7 @@ void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv,
vec2 tc, vec3 pos, vec3 norm, float glossiness)
{
// TODO - don't hard code lods
- float reflection_lods = max_probe_lod-1;
+ float reflection_lods = max_probe_lod;
preProbeSample(pos);
vec3 refnormpersp = reflect(pos.xyz, norm.xyz);
@@ -732,7 +726,7 @@ void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout
vec3 refnormpersp = reflect(pos.xyz, norm.xyz);
ambenv = sampleProbeAmbient(pos, norm);
-
+
if (glossiness > 0.0)
{
float lod = (1.0-glossiness)*reflection_lods;
diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
index dfd1d47b3e..0e3ebd1534 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
@@ -211,7 +211,7 @@ void main()
else if (!GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_ATMOS))
{
//should only be true of WL sky, just port over base color value
- color = srgb_to_linear(baseColor.rgb);
+ color = srgb_to_linear(texture2D(emissiveRect, tc).rgb);
}
else
{
diff --git a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl
index 3d8b95b882..33ea2129cf 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl
@@ -51,7 +51,6 @@ uniform sampler2D normalMap;
uniform sampler2D emissiveRect; // PBR linear packed Occlusion, Roughness, Metal. See: pbropaqueF.glsl
uniform samplerCube environmentMap;
uniform sampler2D lightMap;
-uniform sampler2D noiseMap;
uniform sampler2D projectionMap; // rgba
uniform sampler2D lightFunc;
@@ -193,7 +192,6 @@ void main()
diffuse = srgb_to_linear(diffuse);
spec.rgb = srgb_to_linear(spec.rgb);
- float noise = texture2D(noiseMap, tc).b;
if (proj_tc.z > 0.0 &&
proj_tc.x < 1.0 &&
proj_tc.y < 1.0 &&
@@ -205,7 +203,7 @@ void main()
if (nl > 0.0)
{
- lit = nl * dist_atten * noise;
+ lit = nl * dist_atten;
dlit = getProjectedLightDiffuseColor( l_dist, proj_tc.xy );
@@ -214,7 +212,7 @@ void main()
amb_da += (nl*0.5+0.5) /* * (1.0-shadow) */ * proj_ambiance;
}
- vec3 amb_rgb = getProjectedLightAmbiance( amb_da, dist_atten, lit, nl, noise, proj_tc.xy );
+ vec3 amb_rgb = getProjectedLightAmbiance( amb_da, dist_atten, lit, nl, 1.0, proj_tc.xy );
final_color += diffuse.rgb*amb_rgb;
#if DEBUG_LEG_LIGHT_TYPE
final_color = vec3(0,0.5,0);
diff --git a/indra/newview/featuretable.txt b/indra/newview/featuretable.txt
index 020c7bbc74..14d8d3fae5 100644
--- a/indra/newview/featuretable.txt
+++ b/indra/newview/featuretable.txt
@@ -1,4 +1,4 @@
-version 51
+version 52
// 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
@@ -109,6 +109,7 @@ RenderScreenSpaceReflections 1 0
list LowMid
RenderAnisotropic 1 0
RenderAvatarLODFactor 1 0.5
+RenderAvatarMaxNonImpostors 1 5
RenderAvatarMaxComplexity 1 100000
RenderAvatarPhysicsLODFactor 1 0.75
RenderFarClip 1 96
@@ -136,6 +137,7 @@ RenderScreenSpaceReflections 1 0
list Mid
RenderAnisotropic 1 1
RenderAvatarLODFactor 1 1.0
+RenderAvatarMaxNonImpostors 1 7
RenderAvatarMaxComplexity 1 200000
RenderAvatarPhysicsLODFactor 1 1.0
RenderFarClip 1 128
@@ -147,7 +149,7 @@ RenderTransparentWater 1 0
RenderTerrainDetail 1 1
RenderTerrainLODFactor 1 2.0
RenderTreeLODFactor 1 0.5
-RenderVolumeLODFactor 1 1.125
+RenderVolumeLODFactor 1 1.25
RenderDeferredSSAO 1 0
RenderUseAdvancedAtmospherics 1 0
RenderShadowDetail 1 0
@@ -163,6 +165,7 @@ RenderScreenSpaceReflections 1 0
list MidHigh
RenderAnisotropic 1 1
RenderAvatarLODFactor 1 1.0
+RenderAvatarMaxNonImpostors 1 9
RenderAvatarMaxComplexity 1 250000
RenderAvatarPhysicsLODFactor 1 1.0
RenderFarClip 1 128
@@ -174,7 +177,7 @@ RenderTransparentWater 1 1
RenderTerrainDetail 1 1
RenderTerrainLODFactor 1 2.0
RenderTreeLODFactor 1 0.5
-RenderVolumeLODFactor 1 1.125
+RenderVolumeLODFactor 1 1.375
RenderDeferredSSAO 1 0
RenderUseAdvancedAtmospherics 1 0
RenderShadowDetail 1 0
@@ -190,6 +193,7 @@ RenderScreenSpaceReflections 1 0
list High
RenderAnisotropic 1 1
RenderAvatarLODFactor 1 1.0
+RenderAvatarMaxNonImpostors 1 11
RenderAvatarMaxComplexity 1 300000
RenderAvatarPhysicsLODFactor 1 1.0
RenderFarClip 1 128
@@ -201,7 +205,7 @@ RenderTransparentWater 1 1
RenderTerrainDetail 1 1
RenderTerrainLODFactor 1 2.0
RenderTreeLODFactor 1 0.5
-RenderVolumeLODFactor 1 1.125
+RenderVolumeLODFactor 1 1.5
RenderDeferredSSAO 1 1
RenderUseAdvancedAtmospherics 1 0
RenderShadowDetail 1 0
@@ -217,6 +221,7 @@ RenderScreenSpaceReflections 1 0
list HighUltra
RenderAnisotropic 1 1
RenderAvatarLODFactor 1 1.0
+RenderAvatarMaxNonImpostors 1 16
RenderAvatarMaxComplexity 1 350000
RenderAvatarPhysicsLODFactor 1 1.0
RenderFarClip 1 128
@@ -228,7 +233,7 @@ RenderTerrainDetail 1 1
RenderTerrainLODFactor 1 2.0
RenderTransparentWater 1 1
RenderTreeLODFactor 1 0.5
-RenderVolumeLODFactor 1 1.125
+RenderVolumeLODFactor 1 1.75
RenderDeferredSSAO 1 1
RenderUseAdvancedAtmospherics 1 0
RenderShadowDetail 1 2
@@ -244,6 +249,7 @@ RenderScreenSpaceReflections 1 0
list Ultra
RenderAnisotropic 1 1
RenderAvatarLODFactor 1 1.0
+RenderAvatarMaxNonImpostors 1 16
RenderAvatarPhysicsLODFactor 1 1.0
RenderFarClip 1 256
RenderFlexTimeFactor 1 1.0
diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt
index dbb33b3997..b7a0ac6e28 100644
--- a/indra/newview/featuretable_mac.txt
+++ b/indra/newview/featuretable_mac.txt
@@ -1,4 +1,4 @@
-version 46
+version 47
// 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
@@ -107,6 +107,7 @@ RenderScreenSpaceReflections 1 0
list LowMid
RenderAnisotropic 1 0
RenderAvatarLODFactor 1 0.5
+RenderAvatarMaxNonImpostors 1 5
RenderAvatarMaxComplexity 1 100000
RenderAvatarPhysicsLODFactor 1 0.75
RenderFarClip 1 96
@@ -134,6 +135,7 @@ RenderScreenSpaceReflections 1 0
list Mid
RenderAnisotropic 1 1
RenderAvatarLODFactor 1 1.0
+RenderAvatarMaxNonImpostors 1 7
RenderAvatarMaxComplexity 1 200000
RenderAvatarPhysicsLODFactor 1 1.0
RenderFarClip 1 128
@@ -145,7 +147,7 @@ RenderTerrainDetail 1 1
RenderTerrainLODFactor 1 2.0
RenderTransparentWater 1 1
RenderTreeLODFactor 1 0.5
-RenderVolumeLODFactor 1 1.125
+RenderVolumeLODFactor 1 1.25
RenderDeferredSSAO 1 0
RenderUseAdvancedAtmospherics 1 0
RenderShadowDetail 1 0
@@ -161,6 +163,7 @@ RenderScreenSpaceReflections 1 0
list MidHigh
RenderAnisotropic 1 1
RenderAvatarLODFactor 1 1.0
+RenderAvatarMaxNonImpostors 1 9
RenderAvatarMaxComplexity 1 250000
RenderAvatarPhysicsLODFactor 1 1.0
RenderFarClip 1 128
@@ -172,7 +175,7 @@ RenderTerrainDetail 1 1
RenderTerrainLODFactor 1 2.0
RenderTransparentWater 1 1
RenderTreeLODFactor 1 0.5
-RenderVolumeLODFactor 1 1.125
+RenderVolumeLODFactor 1 1.375
RenderDeferredSSAO 1 0
RenderUseAdvancedAtmospherics 1 0
RenderShadowDetail 1 0
@@ -188,6 +191,7 @@ RenderScreenSpaceReflections 1 0
list High
RenderAnisotropic 1 1
RenderAvatarLODFactor 1 1.0
+RenderAvatarMaxNonImpostors 1 11
RenderAvatarMaxComplexity 1 300000
RenderAvatarPhysicsLODFactor 1 1.0
RenderFarClip 1 128
@@ -199,7 +203,7 @@ RenderTerrainDetail 1 1
RenderTerrainLODFactor 1 2.0
RenderTransparentWater 1 1
RenderTreeLODFactor 1 0.5
-RenderVolumeLODFactor 1 1.125
+RenderVolumeLODFactor 1 1.5
RenderDeferredSSAO 1 1
RenderUseAdvancedAtmospherics 1 0
RenderShadowDetail 1 0
@@ -215,6 +219,7 @@ RenderScreenSpaceReflections 1 0
list HighUltra
RenderAnisotropic 1 1
RenderAvatarLODFactor 1 1.0
+RenderAvatarMaxNonImpostors 1 16
RenderAvatarMaxComplexity 1 350000
RenderAvatarPhysicsLODFactor 1 1.0
RenderFarClip 1 128
@@ -226,7 +231,7 @@ RenderTerrainDetail 1 1
RenderTerrainLODFactor 1 2.0
RenderTransparentWater 1 1
RenderTreeLODFactor 1 0.5
-RenderVolumeLODFactor 1 1.125
+RenderVolumeLODFactor 1 1.75
RenderDeferredSSAO 1 1
RenderShadowDetail 1 2
RenderUseAdvancedAtmospherics 1 0
@@ -242,6 +247,7 @@ RenderScreenSpaceReflections 1 0
list Ultra
RenderAnisotropic 1 1
RenderAvatarLODFactor 1 1.0
+RenderAvatarMaxNonImpostors 1 16
RenderAvatarPhysicsLODFactor 1 1.0
RenderFarClip 1 256
RenderFlexTimeFactor 1 1.0
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp
index d88f0f9847..84ddb3ca99 100644
--- a/indra/newview/llenvironment.cpp
+++ b/indra/newview/llenvironment.cpp
@@ -812,7 +812,7 @@ const F64Seconds LLEnvironment::TRANSITION_SLOW(10.0f);
const F64Seconds LLEnvironment::TRANSITION_ALTITUDE(5.0f);
const LLUUID LLEnvironment::KNOWN_SKY_SUNRISE("01e41537-ff51-2f1f-8ef7-17e4df760bfb");
-const LLUUID LLEnvironment::KNOWN_SKY_MIDDAY("6c83e853-e7f8-cad7-8ee6-5f31c453721c");
+const LLUUID LLEnvironment::KNOWN_SKY_MIDDAY("e4391f43-74d6-d889-19fb-99a4a3ad6c5c");
const LLUUID LLEnvironment::KNOWN_SKY_SUNSET("084e26cd-a900-28e8-08d0-64a9de5c15e2");
const LLUUID LLEnvironment::KNOWN_SKY_MIDNIGHT("8a01b97a-cb20-c1ea-ac63-f7ea84ad0090");
@@ -1758,7 +1758,11 @@ void LLEnvironment::updateGLVariablesForSettings(LLShaderUniforms* uniforms, con
{ // maximize and remove tinting if this is an irradiance map render pass and the parameter feeds into the sky background color
auto max_vec = [](LLVector4 col)
{
- col.mV[0] = col.mV[1] = col.mV[2] = llmax(llmax(col.mV[0], col.mV[1]), col.mV[2]);
+ LLColor3 color(col);
+ F32 h, s, l;
+ color.calcHSL(&h, &s, &l);
+
+ col.mV[0] = col.mV[1] = col.mV[2] = l;
return col;
};
diff --git a/indra/newview/llfetchedgltfmaterial.cpp b/indra/newview/llfetchedgltfmaterial.cpp
index 80074cc655..2e71b4fa87 100644
--- a/indra/newview/llfetchedgltfmaterial.cpp
+++ b/indra/newview/llfetchedgltfmaterial.cpp
@@ -46,6 +46,18 @@ LLFetchedGLTFMaterial::~LLFetchedGLTFMaterial()
}
+LLFetchedGLTFMaterial& LLFetchedGLTFMaterial::operator=(const LLFetchedGLTFMaterial& rhs)
+{
+ LLGLTFMaterial::operator =(rhs);
+
+ mBaseColorTexture = rhs.mBaseColorTexture;
+ mNormalTexture = rhs.mNormalTexture;
+ mMetallicRoughnessTexture = rhs.mMetallicRoughnessTexture;
+ mEmissiveTexture = rhs.mEmissiveTexture;
+
+ return *this;
+}
+
void LLFetchedGLTFMaterial::bind(LLViewerTexture* media_tex)
{
// glTF 2.0 Specification 3.9.4. Alpha Coverage
diff --git a/indra/newview/llfetchedgltfmaterial.h b/indra/newview/llfetchedgltfmaterial.h
index 96f7fbea8e..1668657281 100644
--- a/indra/newview/llfetchedgltfmaterial.h
+++ b/indra/newview/llfetchedgltfmaterial.h
@@ -39,6 +39,8 @@ public:
LLFetchedGLTFMaterial();
virtual ~LLFetchedGLTFMaterial();
+ LLFetchedGLTFMaterial& operator=(const LLFetchedGLTFMaterial& rhs);
+
// If this material is loaded, fire the given function
void onMaterialComplete(std::function<void()> material_complete);
@@ -46,6 +48,8 @@ public:
// media_tex - optional media texture that may override the base color texture
void bind(LLViewerTexture* media_tex = nullptr);
+ bool isFetching() const { return mFetching; }
+
// Textures used for fetching/rendering
LLPointer<LLViewerFetchedTexture> mBaseColorTexture;
LLPointer<LLViewerFetchedTexture> mNormalTexture;
diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp
index 4051521ad4..9c78e48cab 100644
--- a/indra/newview/llgltfmateriallist.cpp
+++ b/indra/newview/llgltfmateriallist.cpp
@@ -157,8 +157,8 @@ public:
// receive override data from simulator via LargeGenericMessage
// message should have:
// object_id - UUID of LLViewerObject
- // side - S32 index of texture entry
- // gltf_json - String of GLTF json for override data
+ // sides - array of S32 indices of texture entries
+ // gltf_json - array of corresponding Strings of GLTF json for override data
LLSD message;
@@ -366,6 +366,8 @@ void LLGLTFMaterialList::queueOverrideUpdate(const LLUUID& id, S32 side, LLGLTFM
void LLGLTFMaterialList::applyQueuedOverrides(LLViewerObject* obj)
{
LL_PROFILE_ZONE_SCOPED;
+
+ llassert(obj);
const LLUUID& id = obj->getID();
auto iter = mQueuedOverrides.find(id);
@@ -376,15 +378,33 @@ void LLGLTFMaterialList::applyQueuedOverrides(LLViewerObject* obj)
{
if (overrides[i].notNull())
{
- if (!obj->getTE(i) || !obj->getTE(i)->getGLTFMaterial())
- { // object doesn't have its base GLTF material yet, don't apply override (yet)
+ if (!obj->getTE(i))
+ { // object is incomplete
+ return;
+ }
+
+ if (!obj->getTE(i)->getGLTFMaterial())
+ {
+ // doesn't have its base GLTF material yet, don't apply override(yet)
return;
}
- obj->setTEGLTFMaterialOverride(i, overrides[i]);
+
+ S32 status = obj->setTEGLTFMaterialOverride(i, overrides[i]);
+ if (status == TEM_CHANGE_NONE)
+ {
+ // can't apply this yet, since failure to change the material override
+ // probably means the base material is still being fetched. leave in
+ // the queue for later
+ //obj->setDebugText("early out 3");
+ return;
+ }
+
if (obj->getTE(i)->isSelected())
{
handle_gltf_override_message.doSelectionCallbacks(id, i);
}
+ // success!
+ overrides[i] = nullptr;
}
}
diff --git a/indra/newview/lllocalgltfmaterials.cpp b/indra/newview/lllocalgltfmaterials.cpp
index 996b168262..d464ea0571 100644
--- a/indra/newview/lllocalgltfmaterials.cpp
+++ b/indra/newview/lllocalgltfmaterials.cpp
@@ -45,6 +45,7 @@
#include "llmaterialmgr.h"
#include "llnotificationsutil.h"
#include "llscrolllistctrl.h"
+#include "lltextureentry.h"
#include "lltinygltfhelper.h"
#include "llviewertexture.h"
@@ -118,6 +119,15 @@ S32 LLLocalGLTFMaterial::getIndexInFile() const
return mMaterialIndex;
}
+void LLLocalGLTFMaterial::addTextureEntry(LLTextureEntry* te)
+{
+ mTextureEntires.insert(te);
+}
+void LLLocalGLTFMaterial::removeTextureEntry(LLTextureEntry* te)
+{
+ mTextureEntires.erase(te);
+}
+
/* update functions */
bool LLLocalGLTFMaterial::updateSelf()
{
@@ -154,6 +164,27 @@ bool LLLocalGLTFMaterial::updateSelf()
gGLTFMaterialList.addMaterial(mWorldID, this);
mUpdateRetries = LL_LOCAL_UPDATE_RETRIES;
+
+ for (LLTextureEntry* entry : mTextureEntires)
+ {
+ // Normally a change in applied material id is supposed to
+ // drop overrides thus reset material, but local materials
+ // currently reuse their existing asset id, and purpose is
+ // to preview how material will work in-world, overrides
+ // included, so do an override to render update instead.
+ LLGLTFMaterial* override_mat = entry->getGLTFMaterialOverride();
+ if (override_mat)
+ {
+ // do not create a new material, reuse existing pointer
+ LLFetchedGLTFMaterial* render_mat = (LLFetchedGLTFMaterial*)entry->getGLTFRenderMaterial();
+ if (render_mat)
+ {
+ *render_mat = *this;
+ render_mat->applyOverride(*override_mat);
+ }
+ }
+ }
+
updated = true;
}
diff --git a/indra/newview/lllocalgltfmaterials.h b/indra/newview/lllocalgltfmaterials.h
index 6919b9b4b2..1442b83a40 100644
--- a/indra/newview/lllocalgltfmaterials.h
+++ b/indra/newview/lllocalgltfmaterials.h
@@ -34,6 +34,7 @@
class LLScrollListCtrl;
class LLGLTFMaterial;
class LLViewerObject;
+class LLTextureEntry;
class LLLocalGLTFMaterial : public LLFetchedGLTFMaterial
{
@@ -48,6 +49,9 @@ public: /* accessors */
LLUUID getWorldID() const;
S32 getIndexInFile() const;
+ void addTextureEntry(LLTextureEntry* te) override;
+ void removeTextureEntry(LLTextureEntry* te) override;
+
public:
bool updateSelf();
@@ -77,6 +81,7 @@ private: /* members */
ELinkStatus mLinkStatus;
S32 mUpdateRetries;
S32 mMaterialIndex; // Single file can have more than one
+ std::set<LLTextureEntry*> mTextureEntires;
};
class LLLocalGLTFMaterialTimer : public LLEventTimer
diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp
index 4cdc503af8..609d8ea5d7 100644
--- a/indra/newview/llmaterialeditor.cpp
+++ b/indra/newview/llmaterialeditor.cpp
@@ -2045,6 +2045,15 @@ void LLMaterialEditor::loadMaterial(const tinygltf::Model &model_in, const std::
setFromGltfMetaData(filename, model_in, index);
+ if (getDoubleSided())
+ {
+ // SL-19392 Double sided materials double the number of pixels that must be rasterized,
+ // and a great many tools that export GLTF simply leave double sided enabled whether
+ // or not it is necessary.
+ LL_DEBUGS("MaterialEditor") << "Defaulting Double Sided to disabled on import" << LL_ENDL;
+ setDoubleSided(false);
+ }
+
markChangesUnsaved(U32_MAX);
if (open_floater)
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index cb7bc7b5df..dd3fdf91d9 100644
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -1282,7 +1282,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/)
LLCheckBoxCtrl* cb_planar_align = getChild<LLCheckBoxCtrl>("checkbox planar align");
align_planar = (cb_planar_align && cb_planar_align->get());
- bool enabled = (editable && isIdenticalPlanarTexgen() && (!pbr_selected || texture_info_selected));
+ bool enabled = (editable && isIdenticalPlanarTexgen() && !texture_info_selected);
childSetValue("checkbox planar align", align_planar && enabled);
childSetVisible("checkbox planar align", enabled);
childSetEnabled("checkbox planar align", enabled);
@@ -1826,10 +1826,7 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material,
const bool show_pbr = mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR && mComboMatMedia->getEnabled();
if (show_pbr)
{
- const U32 pbr_type = findChild<LLRadioGroup>("radio_pbr_type")->getSelectedIndex();
- const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(pbr_type);
- const bool show_texture_info = texture_info != LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT;
- const bool new_state = show_texture_info && has_pbr_capabilities && has_pbr_material;
+ const bool new_state = has_pbr_capabilities && has_pbr_material;
LLUICtrl* gltfCtrlTextureScaleU = getChild<LLUICtrl>("gltfTextureScaleU");
LLUICtrl* gltfCtrlTextureScaleV = getChild<LLUICtrl>("gltfTextureScaleV");
@@ -1858,11 +1855,6 @@ void LLPanelFace::updateVisibilityGLTF()
const U32 pbr_type = radio_pbr_type->getSelectedIndex();
const bool show_pbr_render_material_id = show_pbr && (pbr_type == PBRTYPE_RENDER_MATERIAL_ID);
- const bool show_pbr_base_color = show_pbr && (pbr_type == PBRTYPE_BASE_COLOR);
- const bool show_pbr_normal = show_pbr && (pbr_type == PBRTYPE_NORMAL);
- const bool show_pbr_metallic_roughness = show_pbr && (pbr_type == PBRTYPE_METALLIC_ROUGHNESS);
- const bool show_pbr_emissive = show_pbr && (pbr_type == PBRTYPE_EMISSIVE);
- const bool show_pbr_transform = show_pbr_base_color || show_pbr_normal || show_pbr_metallic_roughness || show_pbr_emissive;
getChildView("pbr_control")->setVisible(show_pbr_render_material_id);
@@ -1870,11 +1862,11 @@ void LLPanelFace::updateVisibilityGLTF()
getChildView("edit_selected_pbr")->setVisible(show_pbr_render_material_id);
getChildView("save_selected_pbr")->setVisible(show_pbr_render_material_id);
- getChildView("gltfTextureScaleU")->setVisible(show_pbr_transform);
- getChildView("gltfTextureScaleV")->setVisible(show_pbr_transform);
- getChildView("gltfTextureRotation")->setVisible(show_pbr_transform);
- getChildView("gltfTextureOffsetU")->setVisible(show_pbr_transform);
- getChildView("gltfTextureOffsetV")->setVisible(show_pbr_transform);
+ getChildView("gltfTextureScaleU")->setVisible(show_pbr);
+ getChildView("gltfTextureScaleV")->setVisible(show_pbr);
+ getChildView("gltfTextureRotation")->setVisible(show_pbr);
+ getChildView("gltfTextureOffsetU")->setVisible(show_pbr);
+ getChildView("gltfTextureOffsetV")->setVisible(show_pbr);
}
void LLPanelFace::updateCopyTexButton()
@@ -2731,14 +2723,14 @@ void LLPanelFace::updateVisibility()
const bool show_pbr = mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR && mComboMatMedia->getEnabled();
const U32 pbr_type = findChild<LLRadioGroup>("radio_pbr_type")->getSelectedIndex();
const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(pbr_type);
- const bool show_texture_info = show_pbr && texture_info != LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT;
+ const bool show_pbr_asset = show_pbr && texture_info == LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT;
radio_mat_type->setVisible(show_material);
// Shared material controls
- getChildView("checkbox_sync_settings")->setVisible(show_material || show_media || show_texture_info);
- getChildView("tex gen")->setVisible(show_material || show_media || show_texture_info);
- getChildView("combobox texgen")->setVisible(show_material || show_media || show_texture_info);
+ getChildView("checkbox_sync_settings")->setVisible(show_material || show_media);
+ getChildView("tex gen")->setVisible(show_material || show_media || show_pbr_asset);
+ getChildView("combobox texgen")->setVisible(show_material || show_media || show_pbr_asset);
getChildView("button align textures")->setVisible(show_material || show_media);
// Media controls
@@ -4654,7 +4646,8 @@ void LLPanelFace::updateGLTFTextureTransform(float value, U32 pbr_type, std::fun
{
U32 texture_info_start;
U32 texture_info_end;
- if (gSavedSettings.getBOOL("SyncMaterialSettings"))
+ const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(pbr_type);
+ if (texture_info == LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT)
{
texture_info_start = 0;
texture_info_end = LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT;
@@ -4685,11 +4678,20 @@ void LLPanelFace::setMaterialOverridesFromSelection()
{
const U32 pbr_type = findChild<LLRadioGroup>("radio_pbr_type")->getSelectedIndex();
const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(pbr_type);
+ U32 texture_info_start;
+ U32 texture_info_end;
if (texture_info == LLGLTFMaterial::TextureInfo::GLTF_TEXTURE_INFO_COUNT)
{
- return;
+ texture_info_start = 0;
+ texture_info_end = LLGLTFMaterial::TextureInfo::GLTF_TEXTURE_INFO_COUNT;
+ }
+ else
+ {
+ texture_info_start = texture_info;
+ texture_info_end = texture_info + 1;
}
+ bool read_transform = true;
LLGLTFMaterial::TextureTransform transform;
bool scale_u_same = true;
bool scale_v_same = true;
@@ -4697,26 +4699,56 @@ void LLPanelFace::setMaterialOverridesFromSelection()
bool offset_u_same = true;
bool offset_v_same = true;
- readSelectedGLTFMaterial<float>([&](const LLGLTFMaterial* mat)
- {
- return mat ? mat->mTextureTransform[texture_info].mScale[VX] : 0.f;
- }, transform.mScale[VX], scale_u_same, true, 1e-3f);
- readSelectedGLTFMaterial<float>([&](const LLGLTFMaterial* mat)
- {
- return mat ? mat->mTextureTransform[texture_info].mScale[VY] : 0.f;
- }, transform.mScale[VY], scale_v_same, true, 1e-3f);
- readSelectedGLTFMaterial<float>([&](const LLGLTFMaterial* mat)
+ for (U32 i = texture_info_start; i < texture_info_end; ++i)
{
- return mat ? mat->mTextureTransform[texture_info].mRotation : 0.f;
- }, transform.mRotation, rotation_same, true, 1e-3f);
- readSelectedGLTFMaterial<float>([&](const LLGLTFMaterial* mat)
- {
- return mat ? mat->mTextureTransform[texture_info].mOffset[VX] : 0.f;
- }, transform.mOffset[VX], offset_u_same, true, 1e-3f);
- readSelectedGLTFMaterial<float>([&](const LLGLTFMaterial* mat)
- {
- return mat ? mat->mTextureTransform[texture_info].mOffset[VY] : 0.f;
- }, transform.mOffset[VY], offset_v_same, true, 1e-3f);
+ LLGLTFMaterial::TextureTransform this_transform;
+ bool this_scale_u_same = true;
+ bool this_scale_v_same = true;
+ bool this_rotation_same = true;
+ bool this_offset_u_same = true;
+ bool this_offset_v_same = true;
+
+ readSelectedGLTFMaterial<float>([&](const LLGLTFMaterial* mat)
+ {
+ return mat ? mat->mTextureTransform[i].mScale[VX] : 0.f;
+ }, this_transform.mScale[VX], this_scale_u_same, true, 1e-3f);
+ readSelectedGLTFMaterial<float>([&](const LLGLTFMaterial* mat)
+ {
+ return mat ? mat->mTextureTransform[i].mScale[VY] : 0.f;
+ }, this_transform.mScale[VY], this_scale_v_same, true, 1e-3f);
+ readSelectedGLTFMaterial<float>([&](const LLGLTFMaterial* mat)
+ {
+ return mat ? mat->mTextureTransform[i].mRotation : 0.f;
+ }, this_transform.mRotation, this_rotation_same, true, 1e-3f);
+ readSelectedGLTFMaterial<float>([&](const LLGLTFMaterial* mat)
+ {
+ return mat ? mat->mTextureTransform[i].mOffset[VX] : 0.f;
+ }, this_transform.mOffset[VX], this_offset_u_same, true, 1e-3f);
+ readSelectedGLTFMaterial<float>([&](const LLGLTFMaterial* mat)
+ {
+ return mat ? mat->mTextureTransform[i].mOffset[VY] : 0.f;
+ }, this_transform.mOffset[VY], this_offset_v_same, true, 1e-3f);
+
+ scale_u_same = scale_u_same && this_scale_u_same;
+ scale_v_same = scale_v_same && this_scale_v_same;
+ rotation_same = rotation_same && this_rotation_same;
+ offset_u_same = offset_u_same && this_offset_u_same;
+ offset_v_same = offset_v_same && this_offset_v_same;
+
+ if (read_transform)
+ {
+ read_transform = false;
+ transform = this_transform;
+ }
+ else
+ {
+ scale_u_same = scale_u_same && (this_transform.mScale[VX] == transform.mScale[VX]);
+ scale_v_same = scale_v_same && (this_transform.mScale[VY] == transform.mScale[VY]);
+ rotation_same = rotation_same && (this_transform.mRotation == transform.mRotation);
+ offset_u_same = offset_u_same && (this_transform.mOffset[VX] == transform.mOffset[VX]);
+ offset_v_same = offset_v_same && (this_transform.mOffset[VY] == transform.mOffset[VY]);
+ }
+ }
LLUICtrl* gltfCtrlTextureScaleU = getChild<LLUICtrl>("gltfTextureScaleU");
LLUICtrl* gltfCtrlTextureScaleV = getChild<LLUICtrl>("gltfTextureScaleV");
diff --git a/indra/newview/llreflectionmapmanager.cpp b/indra/newview/llreflectionmapmanager.cpp
index c664dbbe9e..58ce571505 100644
--- a/indra/newview/llreflectionmapmanager.cpp
+++ b/indra/newview/llreflectionmapmanager.cpp
@@ -1018,7 +1018,7 @@ void LLReflectionMapManager::initReflectionMaps()
mTexture->allocate(mProbeResolution, 3, mReflectionProbeCount + 2);
mIrradianceMaps = new LLCubeMapArray();
- mIrradianceMaps->allocate(LL_IRRADIANCE_MAP_RESOLUTION, 4, mReflectionProbeCount, FALSE);
+ mIrradianceMaps->allocate(LL_IRRADIANCE_MAP_RESOLUTION, 3, mReflectionProbeCount, FALSE);
}
if (mVertexBuffer.isNull())
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index fd3c8de3e9..1c53bddb62 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -4961,6 +4961,22 @@ void LLViewerObject::updateTEMaterialTextures(U8 te)
if (mat == nullptr && mat_id.notNull())
{
mat = (LLFetchedGLTFMaterial*) gGLTFMaterialList.getMaterial(mat_id);
+ if (mat->isFetching())
+ { // material is not loaded yet, rebuild draw info when the object finishes loading
+ mat->onMaterialComplete([id=getID()]
+ {
+ LLViewerObject* obj = gObjectList.findObject(id);
+ if (obj)
+ {
+ LLViewerRegion* region = obj->getRegion();
+ if(region)
+ {
+ region->loadCacheMiscExtras(obj->getLocalID());
+ }
+ obj->markForUpdate(FALSE);
+ }
+ });
+ }
getTE(te)->setGLTFMaterial(mat);
}
else if (mat_id.isNull() && mat != nullptr)
@@ -5368,24 +5384,30 @@ S32 LLViewerObject::setTEGLTFMaterialOverride(U8 te, LLGLTFMaterial* override_ma
LLFetchedGLTFMaterial* src_mat = (LLFetchedGLTFMaterial*) tep->getGLTFMaterial();
+ // if override mat exists, we must also have a source mat
if (!src_mat)
- { // we can get into this state if an override has arrived before the viewer has
+ {
+ // we can get into this state if an override has arrived before the viewer has
// received or handled an update, return TEM_CHANGE_NONE to signal to LLGLTFMaterialList that it
// should queue the update for later
return retval;
}
- tep->setGLTFMaterialOverride(override_mat);
+ if(src_mat->isFetching())
+ {
+ // if still fetching, we need to wait until it is done and try again
+ return retval;
+ }
- // if override mat exists, we must also have a source mat
- llassert(override_mat ? bool(src_mat) : true);
+ tep->setGLTFMaterialOverride(override_mat);
- if (override_mat && src_mat)
+ if (override_mat)
{
LLFetchedGLTFMaterial* render_mat = new LLFetchedGLTFMaterial(*src_mat);
render_mat->applyOverride(*override_mat);
tep->setGLTFRenderMaterial(render_mat);
retval = TEM_CHANGE_TEXTURE;
+
}
else if (tep->setGLTFRenderMaterial(nullptr))
{
@@ -5680,6 +5702,23 @@ void LLViewerObject::setDebugText(const std::string &utf8text)
updateText();
}
+void LLViewerObject::appendDebugText(const std::string &utf8text)
+{
+ if (utf8text.empty() && !mText)
+ {
+ return;
+ }
+
+ if (!mText)
+ {
+ initHudText();
+ }
+ mText->addLine(utf8text, LLColor4::white);
+ mText->setZCompare(FALSE);
+ mText->setDoFade(FALSE);
+ updateText();
+}
+
void LLViewerObject::initHudText()
{
mText = (LLHUDText *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_TEXT);
@@ -7242,12 +7281,14 @@ void LLViewerObject::setRenderMaterialID(S32 te_in, const LLUUID& id, bool updat
}
else
{
- LLPointer<LLViewerObject> this_ptr = this;
- new_material->onMaterialComplete([this_ptr]() mutable {
- if (this_ptr->isDead()) { return; }
-
- this_ptr->rebuildMaterial();
- });
+ new_material->onMaterialComplete([obj_id = getID()]()
+ {
+ LLViewerObject* obj = gObjectList.findObject(obj_id);
+ if (obj)
+ {
+ obj->rebuildMaterial();
+ }
+ });
}
// predictively update LLRenderMaterialParams (don't wait for server)
diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h
index 560c51139b..e647fdd045 100644
--- a/indra/newview/llviewerobject.h
+++ b/indra/newview/llviewerobject.h
@@ -442,6 +442,7 @@ public:
void sendMaterialUpdate() const;
void setDebugText(const std::string &utf8text);
+ void appendDebugText(const std::string &utf8text);
void initHudText();
void restoreHudText();
void setIcon(LLViewerTexture* icon_image);
diff --git a/indra/newview/llvieweroctree.cpp b/indra/newview/llvieweroctree.cpp
index d1d23cfb8e..a2d8d30fb2 100644
--- a/indra/newview/llvieweroctree.cpp
+++ b/indra/newview/llvieweroctree.cpp
@@ -1131,7 +1131,9 @@ void LLOcclusionCullingGroup::checkOcclusion()
mOcclusionCheckCount[LLViewerCamera::sCurCameraID]++;
}
- if (available || mOcclusionCheckCount[LLViewerCamera::sCurCameraID] > 4)
+ static LLCachedControl<S32> occlusion_timeout(gSavedSettings, "RenderOcclusionTimeout", 4);
+
+ if (available || mOcclusionCheckCount[LLViewerCamera::sCurCameraID] > occlusion_timeout)
{
mOcclusionCheckCount[LLViewerCamera::sCurCameraID] = 0;
GLuint query_result; // Will be # samples drawn, or a boolean depending on mHasOcclusionQuery2 (both are type GLuint)
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index afe48f01b5..dd4ff50259 100755
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -823,7 +823,7 @@ void LLViewerRegion::saveObjectCache()
// Map of LLVOCacheEntry takes time to release, store map for cleanup on idle
sRegionCacheCleanup.insert(mImpl->mCacheMap.begin(), mImpl->mCacheMap.end());
mImpl->mCacheMap.clear();
- // TODO - probably need to do the same for overrides cache
+ // TODO - probably need to do the same for overrides cache
}
void LLViewerRegion::sendMessage()
@@ -1151,6 +1151,8 @@ void LLViewerRegion::killCacheEntry(LLVOCacheEntry* entry, bool for_rendering)
entry->setState(LLVOCacheEntry::INACTIVE);
entry->removeOctreeEntry();
entry->setValid(FALSE);
+
+ // TODO kill extras/material overrides cache too
}
//physically delete the cache entry
@@ -1862,6 +1864,9 @@ LLViewerObject* LLViewerRegion::addNewObject(LLVOCacheEntry* entry)
//should not hit here any more, but does not hurt either, just put it back to active list
addActiveCacheEntry(entry);
}
+
+ loadCacheMiscExtras(entry->getLocalID());
+
return obj;
}
@@ -2759,7 +2764,7 @@ bool LLViewerRegion::probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss
entry->setValid();
decodeBoundingInfo(entry);
- loadCacheMiscExtras(local_id, entry, crc);
+ //loadCacheMiscExtras(local_id, entry, crc);
return true;
}
@@ -2876,6 +2881,7 @@ void LLViewerRegion::dumpCache()
{
LL_INFOS() << "Changes " << i << " " << change_bin[i] << LL_ENDL;
}
+ // TODO - add overrides cache too
}
void LLViewerRegion::unpackRegionHandshake()
@@ -3544,15 +3550,11 @@ std::string LLViewerRegion::getSimHostName()
return std::string("...");
}
-void LLViewerRegion::loadCacheMiscExtras(U32 local_id, LLVOCacheEntry * entry, U32 crc)
+void LLViewerRegion::loadCacheMiscExtras(U32 local_id)
{
auto iter = mImpl->mGLTFOverridesJson.find(local_id);
if (iter != mImpl->mGLTFOverridesJson.end())
{
LLGLTFMaterialList::loadCacheOverrides(iter->second);
}
- else
- {
- LL_DEBUGS("GLTF") << "cache miss for handle: " << mHandle << " local_id:" << local_id << LL_ENDL;
- }
}
diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h
index ec507fb982..b132a3a5f3 100644
--- a/indra/newview/llviewerregion.h
+++ b/indra/newview/llviewerregion.h
@@ -423,9 +423,9 @@ private:
void decodeBoundingInfo(LLVOCacheEntry* entry);
bool isNonCacheableObjectCreated(U32 local_id);
- void loadCacheMiscExtras(U32 local_id, LLVOCacheEntry * entry, U32 crc);
-
public:
+ void loadCacheMiscExtras(U32 local_id);
+
struct CompareDistance
{
bool operator()(const LLViewerRegion* const& lhs, const LLViewerRegion* const& rhs)
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index d1f4fa1c7a..77849c668a 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -5416,7 +5416,8 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
if (gltf_mat)
{
- // nothing to do, render pools will reference the GLTF material
+ // just remember the material ID, render pools will reference the GLTF material
+ draw_info->mMaterialID = mat_id;
}
else if (mat)
{
@@ -5472,6 +5473,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
llassert(type != LLRenderPass::PASS_BUMP || (info->mVertexBuffer->getTypeMask() & LLVertexBuffer::MAP_TANGENT) != 0);
llassert(type != LLRenderPass::PASS_NORMSPEC || info->mNormalMap.notNull());
+ llassert(type != LLRenderPass::PASS_SPECMAP || (info->mVertexBuffer->getTypeMask() & LLVertexBuffer::MAP_TEXCOORD2) != 0);
}
void LLVolumeGeometryManager::getGeometry(LLSpatialGroup* group)
@@ -5669,6 +5671,12 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
continue;
}
+ // HACK -- brute force this check every time a drawable gets rebuilt
+ for (S32 i = 0; i < drawablep->getNumFaces(); ++i)
+ {
+ vobj->updateTEMaterialTextures(i);
+ }
+
// apply any pending material overrides
gGLTFMaterialList.applyQueuedOverrides(vobj);
@@ -5753,9 +5761,6 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
{
continue;
}
-
- // HACK -- brute force this check every time a drawable gets rebuilt
- vobj->updateTEMaterialTextures(i);
#if 0
#if LL_RELEASE_WITH_DEBUG_INFO
const LLUUID pbr_id( "49c88210-7238-2a6b-70ac-92d4f35963cf" );
@@ -6655,12 +6660,28 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
LLRenderPass::PASS_NORMSPEC_EMISSIVE,
};
- U32 mask = mat->getShaderMask();
+ U32 alpha_mode = mat->getDiffuseAlphaMode();
+ if (!distance_sort && alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND)
+ { // HACK - this should never happen, but sometimes we get a material that thinks it has alpha blending when it ought not
+ alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE;
+ }
+ U32 mask = mat->getShaderMask(alpha_mode);
+
+ U32 vb_mask = facep->getVertexBuffer()->getTypeMask();
+
+ // HACK - this should also never happen, but sometimes we get here and the material thinks it has a specmap now
+ // even though it didn't appear to have a specmap when the face was added to the list of faces
+ if ((mask & 0x4) && !(vb_mask & LLVertexBuffer::MAP_TEXCOORD2))
+ {
+ mask &= ~0x4;
+ }
llassert(mask < sizeof(pass)/sizeof(U32));
mask = llmin(mask, (U32)(sizeof(pass)/sizeof(U32)-1));
+ // if this is going into alpha pool, distance sort MUST be true
+ llassert(pass[mask] == LLRenderPass::PASS_ALPHA ? distance_sort : true);
registerFace(group, facep, pass[mask]);
}
}
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 18b0192346..a53b3aac8e 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -202,9 +202,6 @@ LLVector3 LLPipeline::RenderShadowGaussian;
F32 LLPipeline::RenderShadowBlurDistFactor;
bool LLPipeline::RenderDeferredAtmospheric;
F32 LLPipeline::RenderHighlightFadeTime;
-LLVector3 LLPipeline::RenderShadowClipPlanes;
-LLVector3 LLPipeline::RenderShadowOrthoClipPlanes;
-LLVector3 LLPipeline::RenderShadowNearDist;
F32 LLPipeline::RenderFarClip;
LLVector3 LLPipeline::RenderShadowSplitExponent;
F32 LLPipeline::RenderShadowErrorCutoff;
@@ -558,9 +555,6 @@ void LLPipeline::init()
connectRefreshCachedSettingsSafe("RenderShadowBlurDistFactor");
connectRefreshCachedSettingsSafe("RenderDeferredAtmospheric");
connectRefreshCachedSettingsSafe("RenderHighlightFadeTime");
- connectRefreshCachedSettingsSafe("RenderShadowClipPlanes");
- connectRefreshCachedSettingsSafe("RenderShadowOrthoClipPlanes");
- connectRefreshCachedSettingsSafe("RenderShadowNearDist");
connectRefreshCachedSettingsSafe("RenderFarClip");
connectRefreshCachedSettingsSafe("RenderShadowSplitExponent");
connectRefreshCachedSettingsSafe("RenderShadowErrorCutoff");
@@ -1043,9 +1037,6 @@ void LLPipeline::refreshCachedSettings()
RenderShadowBlurDistFactor = gSavedSettings.getF32("RenderShadowBlurDistFactor");
RenderDeferredAtmospheric = gSavedSettings.getBOOL("RenderDeferredAtmospheric");
RenderHighlightFadeTime = gSavedSettings.getF32("RenderHighlightFadeTime");
- RenderShadowClipPlanes = gSavedSettings.getVector3("RenderShadowClipPlanes");
- RenderShadowOrthoClipPlanes = gSavedSettings.getVector3("RenderShadowOrthoClipPlanes");
- RenderShadowNearDist = gSavedSettings.getVector3("RenderShadowNearDist");
RenderFarClip = gSavedSettings.getF32("RenderFarClip");
RenderShadowSplitExponent = gSavedSettings.getVector3("RenderShadowSplitExponent");
RenderShadowErrorCutoff = gSavedSettings.getF32("RenderShadowErrorCutoff");
@@ -9277,27 +9268,12 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
glh::matrix4f view[6];
glh::matrix4f proj[6];
- //clip contains parallel split distances for 3 splits
- LLVector3 clip = RenderShadowClipPlanes;
-
LLVector3 caster_dir(environment.getIsSunUp() ? mSunDir : mMoonDir);
- //F32 slope_threshold = gSavedSettings.getF32("RenderShadowSlopeThreshold");
-
- //far clip on last split is minimum of camera view distance and 128
- mSunClipPlanes = LLVector4(clip, clip.mV[2] * clip.mV[2]/clip.mV[1]);
-
- clip = RenderShadowOrthoClipPlanes;
- mSunOrthoClipPlanes = LLVector4(clip, clip.mV[2]*clip.mV[2]/clip.mV[1]);
-
- //currently used for amount to extrude frusta corners for constructing shadow frusta
- //LLVector3 n = RenderShadowNearDist;
- //F32 nearDist[] = { n.mV[0], n.mV[1], n.mV[2], n.mV[2] };
-
//put together a universal "near clip" plane for shadow frusta
LLPlane shadow_near_clip;
{
- LLVector3 p = gAgent.getPositionAgent();
+ LLVector3 p = camera.getOrigin(); // gAgent.getPositionAgent();
p += caster_dir * RenderFarClip*2.f;
shadow_near_clip.setVec(p, caster_dir);
}
@@ -9318,9 +9294,6 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
up = camera.getUpAxis();
}
- /*LLVector3 left = up%at;
- up = at%left;*/
-
up.normVec();
at.normVec();
@@ -9403,6 +9376,14 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
mSunClipPlanes.mV[0] *= 1.25f; //bump back first split for transition padding
}
+ if (gCubeSnapshot)
+ { // stretch clip planes for reflection probe renders to reduce number of shadow passes
+ mSunClipPlanes.mV[1] = mSunClipPlanes.mV[2];
+ mSunClipPlanes.mV[2] = mSunClipPlanes.mV[3];
+ mSunClipPlanes.mV[3] *= 1.5f;
+ }
+
+
// convenience array of 4 near clip plane distances
F32 dist[] = { near_clip, mSunClipPlanes.mV[0], mSunClipPlanes.mV[1], mSunClipPlanes.mV[2], mSunClipPlanes.mV[3] };
@@ -9419,7 +9400,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
}
else
{
- for (S32 j = 0; j < 4; j++)
+ for (S32 j = 0; j < (gCubeSnapshot ? 2 : 4); j++)
{
if (!hasRenderDebugMask(RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot)
{
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index 0faa0c3f20..4cefb719fd 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -999,9 +999,6 @@ public:
static F32 RenderShadowBlurDistFactor;
static bool RenderDeferredAtmospheric;
static F32 RenderHighlightFadeTime;
- static LLVector3 RenderShadowClipPlanes;
- static LLVector3 RenderShadowOrthoClipPlanes;
- static LLVector3 RenderShadowNearDist;
static F32 RenderFarClip;
static LLVector3 RenderShadowSplitExponent;
static F32 RenderShadowErrorCutoff;
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 1c58ea6977..a6a401f43e 100644
--- a/indra/newview/skins/default/xui/en/floater_material_editor.xml
+++ b/indra/newview/skins/default/xui/en/floater_material_editor.xml
@@ -29,7 +29,6 @@
color="DkGray2"
opaque="true"
tab_stop="true"
- border="false"
reserve_scroll_corner="false">
<panel
name="panel_material"