summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NORSPEC-207.patch164
-rwxr-xr-xindra/llmath/llvector4a.inl20
-rwxr-xr-xindra/llmath/llvolume.cpp83
-rwxr-xr-xindra/llrender/llrendertarget.cpp4
-rwxr-xr-xindra/newview/app_settings/settings.xml12
-rwxr-xr-xindra/newview/llpanelvolume.cpp12
-rwxr-xr-xindra/newview/lltexturectrl.cpp13
-rwxr-xr-xindra/newview/llvovolume.cpp6
8 files changed, 105 insertions, 209 deletions
diff --git a/NORSPEC-207.patch b/NORSPEC-207.patch
deleted file mode 100644
index a1c1447bda..0000000000
--- a/NORSPEC-207.patch
+++ /dev/null
@@ -1,164 +0,0 @@
-diff -r fe4bab01522e indra/llprimitive/llrendermaterialtable.cpp
---- a/indra/llprimitive/llrendermaterialtable.cpp Wed May 15 17:57:21 2013 +0000
-+++ b/indra/llprimitive/llrendermaterialtable.cpp Wed May 22 14:23:04 2013 -0700
-@@ -184,6 +184,44 @@
- }
- }
-
-+// 'v' is an integer value for 100ths of radians (don't ask...)
-+//
-+void LLRenderMaterialEntry::LLRenderMaterial::setSpecularMapRotation(S32 v) const
-+{
-+ // Store the fact that we're using the new rotation rep
-+ //
-+ m_flags |= kNewSpecularMapRotation;
-+
-+ // Store 'sign bit' in our m_flags
-+ //
-+ m_flags &= ~kSpecularMapRotationNegative;
-+ m_flags |= (specularMapRotation < 0) ? kSpecularMapRotationNegative : 0;
-+
-+ specularRotation = abs(specularRotation);
-+ specularRotation = llmin(specularRotation, MAX_MATERIAL_MAP_ROTATION);
-+
-+ m_specularRotation = (U16)(abs(specularMapRotation));
-+}
-+
-+// 'v' is an integer value for 100ths of radians (don't ask...)
-+//
-+void LLRenderMaterialEntry::LLRenderMaterial::setNormalMapRotation(S32 v) const
-+{
-+
-+ // Store the fact that we're using the new rep for this material
-+ //
-+ m_flags |= kNewNormalMapRotation;
-+
-+ // Store 'sign bit' in our m_flags
-+ //
-+ m_flags &= ~kNormalMapRotationNegative;
-+ m_flags |= (normalMapRotation < 0) ? kNormalMapRotationNegative : 0;
-+
-+ normalRotation = abs(normalRotation);
-+ normalRotation = llmin(normalRotation, MAX_MATERIAL_MAP_ROTATION);
-+
-+ m_normalRotation = (U16)(abs(normalMapRotation));
-+}
-
- void LLRenderMaterialEntry::LLRenderMaterial::asLLSD( LLSD& dest ) const
- {
-@@ -193,20 +231,45 @@
- dest["NormOffsetY"] = (S32)m_normalOffsetY;
- dest["NormRepeatX"] = m_normalRepeatX;
- dest["NormRepeatY"] = m_normalRepeatY;
-- dest["NormRotation"] = (S32)m_normalRotation;
-+
-+ S32 value = (S32)m_normalMapRotation;
-+
-+ // If we don't have the flag for new rotations set,
-+ // then we need to convert it now
-+ if (!(m_flags & kNewNormalMapRotation))
-+ {
-+ F32 old_radians = ((F32)m_normalMapRotation / 10000.0f)
-+ S32 new_val = (S32)(old_radians * 100.0f);
-+ setNormalMapRotation(new_Val);
-+ }
-+
-+ dest["NormRotation"] = (m_flags & kNormalMapRotationNegative) ? -(S32)m_normalRotation : (S32)m_normalRotation;
-
- dest["SpecOffsetX"] = (S32)m_specularOffsetX;
- dest["SpecOffsetY"] = (S32)m_specularOffsetY;
- dest["SpecRepeatX"] = m_specularRepeatX;
- dest["SpecRepeatY"] = m_specularRepeatY;
-- dest["SpecRotation"] = (S32)m_specularRotation;
-+
-+
-+ value = (S32)m_specularRotation;
-+
-+ // If we don't have the flag for new rotations set,
-+ // then we need to convert it now
-+ if (!(m_flags & kNewSpecularMapRotation))
-+ {
-+ F32 old_radians = ((F32)m_specularMapRotation / 10000.0f)
-+ S32 new_val = (S32)(old_radians * 100.0f);
-+ setSpecularMapRotation(new_Val);
-+ }
-+
-+ dest["SpecRotation"] = (m_flags & kSpecularMapRotationNegative) ? -(S32)m_specularRotation : (S32)m_specularRotation;
-
- dest["SpecMap"] = m_specularMap;
- dest["SpecColor"] = m_specularLightColor.getValue();
- dest["SpecExp"] = (S32)m_specularLightExponent;
- dest["EnvIntensity"] = (S32)m_environmentIntensity;
- dest["AlphaMaskCutoff"] = (S32)m_alphaMaskCutoff;
-- dest["DiffuseAlphaMode"] = (S32)m_diffuseAlphaMode;
-+ dest["DiffuseAlphaMode"] = (S32)(m_diffuseAlphaMode & 0xF);
-
- }
-
-@@ -217,7 +280,10 @@
- m_normalOffsetY = (U16)materialDefinition["NormOffsetY"].asInteger();
- m_normalRepeatX = materialDefinition["NormRepeatX"].asInteger();
- m_normalRepeatY = materialDefinition["NormRepeatY"].asInteger();
-- m_normalRotation = (U16)materialDefinition["NormRotation"].asInteger();
-+
-+ S32 normalRotation = materialDefinition["NormRotation"].asInteger();
-+
-+ setNormalMapRotation(normalRotation);
-
- m_specularMap = materialDefinition["SpecMap"].asUUID();
-
-@@ -225,7 +291,10 @@
- m_specularOffsetY = (U16)materialDefinition["SpecOffsetY"].asInteger();
- m_specularRepeatX = materialDefinition["SpecRepeatX"].asInteger();
- m_specularRepeatY = materialDefinition["SpecRepeatY"].asInteger();
-- m_specularRotation = (U16)materialDefinition["SpecRotation"].asInteger();
-+
-+ S32 specularRotation = materialDefinition["SpecRotation"].asInteger();
-+
-+ setSpecularMapRotation(specularRotation);
-
- m_specularLightColor.setValue( materialDefinition["SpecColor"] );
- m_specularLightExponent = (U8)materialDefinition["SpecExp"].asInteger();
-diff -r fe4bab01522e indra/llprimitive/llrendermaterialtable.h
---- a/indra/llprimitive/llrendermaterialtable.h Wed May 15 17:57:21 2013 +0000
-+++ b/indra/llprimitive/llrendermaterialtable.h Wed May 22 14:23:04 2013 -0700
-@@ -89,11 +89,17 @@
-
- void computeID();
-
-+
- struct LLRenderMaterial
- {
- void asLLSD( LLSD& dest ) const;
- void setFromLLSD( const LLSD& materialDefinition );
-
-+ void setNormalMapRotation(S32 v);
-+ void setSpecularMapRotation(S32 v);
-+
-+ const S32 MAX_MATERIAL_MAP_ROTATION = 62800;
-+
- // 36 bytes
- LLUUID m_normalMap;
- LLUUID m_specularMap;
-@@ -119,7 +125,20 @@
- U8 m_specularLightExponent;
- U8 m_environmentIntensity;
- U8 m_alphaMaskCutoff;
-- U8 m_diffuseAlphaMode;
-+ U8 m_diffuseAlphaMode : 4;
-+ U8 m_flags : 4;
-+ };
-+
-+ // Flags stored in LLRenderMaterial::m_flags to differentiate 'old' rotation format
-+ // which doesn't handle negative or large rotations correctly from new format.
-+ // All ancient materials will have these flags unset as the values for diffuseAlphaMode
-+ // from which the bits were stolen never used more than the bottom 2 bits.
-+ //
-+ enum RenderMaterialFlags {
-+ kNewNormalMapRotation = 0x1,
-+ kNewSpecularMapRotation = 0x2,
-+ kNormalMapRotationNegative = 0x4,
-+ kSpecularMapRotationNegative = 0x8
- };
-
- friend struct eastl::hash<LLRenderMaterial>;
diff --git a/indra/llmath/llvector4a.inl b/indra/llmath/llvector4a.inl
index 7c52ffef21..558fe09323 100755
--- a/indra/llmath/llvector4a.inl
+++ b/indra/llmath/llvector4a.inl
@@ -409,6 +409,26 @@ inline void LLVector4a::normalize3fast()
mQ = _mm_mul_ps( mQ, approxRsqrt );
}
+inline void LLVector4a::normalize3fast_checked(LLVector4a* d)
+{
+ if (!isFinite3())
+ {
+ *this = d ? *d : LLVector4a(0,1,0,1);
+ return;
+ }
+
+ LLVector4a lenSqrd; lenSqrd.setAllDot3( *this, *this );
+
+ if (lenSqrd.getF32ptr()[0] <= FLT_EPSILON)
+ {
+ *this = d ? *d : LLVector4a(0,1,0,1);
+ return;
+ }
+
+ const LLQuad approxRsqrt = _mm_rsqrt_ps(lenSqrd.mQ);
+ mQ = _mm_mul_ps( mQ, approxRsqrt );
+}
+
// Return true if this vector is normalized with respect to x,y,z up to tolerance
inline LLBool32 LLVector4a::isNormalized3( F32 tolerance ) const
{
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp
index 14cebfe5aa..58cac57e7f 100755
--- a/indra/llmath/llvolume.cpp
+++ b/indra/llmath/llvolume.cpp
@@ -4472,6 +4472,9 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices,
continue; //skip degenerate face
}
+ LLVector4a default_norm;
+ default_norm.set(0,1,0,1);
+
//for each edge
for (S32 k = 0; k < 3; k++) {
S32 index = face.mEdge[j*3+k];
@@ -4493,14 +4496,14 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices,
norm_mat.rotate(n[v1], t);
- t.normalize3fast();
+ t.normalize3fast_checked(&default_norm);
normals.push_back(LLVector3(t[0], t[1], t[2]));
mat.affineTransform(v[v2], t);
vertices.push_back(LLVector3(t[0], t[1], t[2]));
norm_mat.rotate(n[v2], t);
- t.normalize3fast();
+ t.normalize3fast_checked(&default_norm);
normals.push_back(LLVector3(t[0], t[1], t[2]));
}
}
@@ -6096,6 +6099,9 @@ BOOL LLVolumeFace::createUnCutCubeCap(LLVolume* volume, BOOL partial_build)
{
VertexData corners[4];
VertexData baseVert;
+ LLVector4a default_norm;
+ default_norm.set(0,1,0,1);
+
for(S32 t = 0; t < 4; t++)
{
corners[t].getPosition().load3( mesh[offset + (grid_size*t)].mPos.mV);
@@ -6108,8 +6114,8 @@ BOOL LLVolumeFace::createUnCutCubeCap(LLVolume* volume, BOOL partial_build)
lhs.setSub(corners[1].getPosition(), corners[0].getPosition());
LLVector4a rhs;
rhs.setSub(corners[2].getPosition(), corners[1].getPosition());
- baseVert.getNormal().setCross3(lhs, rhs);
- baseVert.getNormal().normalize3fast();
+ baseVert.getNormal().setCross3(lhs, rhs);
+ baseVert.getNormal().normalize3fast_checked(&default_norm);
}
if(!(mTypeMask & TOP_MASK))
@@ -6559,17 +6565,12 @@ BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build)
d1.setSub(mPositions[mIndices[2]], mPositions[mIndices[0]]);
LLVector4a normal;
- normal.setCross3(d0,d1);
-
- if (normal.dot3(normal).getF32() > F_APPROXIMATELY_ZERO)
- {
- normal.normalize3fast();
- }
- else
- { //degenerate, make up a value
- normal.set(0,0,1);
- }
+ LLVector4a default_norm;
+ default_norm.set(0,1,0,1);
+ normal.setCross3(d0,d1);
+ normal.normalize3fast_checked(&default_norm);
+
llassert(llfinite(normal.getF32ptr()[0]));
llassert(llfinite(normal.getF32ptr()[1]));
llassert(llfinite(normal.getF32ptr()[2]));
@@ -6611,11 +6612,13 @@ void LLVolumeFace::createTangents()
CalculateTangentArray(mNumVertices, mPositions, mNormals, mTexCoords, mNumIndices/3, mIndices, mTangents);
//normalize tangents
+ LLVector4a default_norm;
+ default_norm.set(0,1,0,1);
for (U32 i = 0; i < mNumVertices; i++)
{
//binorm[i].normalize3fast();
//bump map/planar projection code requires normals to be normalized
- mNormals[i].normalize3fast();
+ mNormals[i].normalize3fast_checked(&default_norm);
}
}
}
@@ -6793,6 +6796,9 @@ void LLVolumeFace::appendFace(const LLVolumeFace& face, LLMatrix4& mat_in, LLMat
mat.loadu(mat_in);
norm_mat.loadu(norm_mat_in);
+ LLVector4a default_norm;
+ default_norm.set(0,1,0,1);
+
for (U32 i = 0; i < face.mNumVertices; ++i)
{
//transform appended face position and store
@@ -6800,7 +6806,7 @@ void LLVolumeFace::appendFace(const LLVolumeFace& face, LLMatrix4& mat_in, LLMat
//transform appended face normal and store
norm_mat.rotate(src_norm[i], dst_norm[i]);
- dst_norm[i].normalize3fast();
+ dst_norm[i].normalize3fast_checked(&default_norm);
//copy appended face texture coordinate
dst_tc[i] = src_tc[i];
@@ -7213,42 +7219,41 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build)
void CalculateTangentArray(U32 vertexCount, const LLVector4a *vertex, const LLVector4a *normal,
const LLVector2 *texcoord, U32 triangleCount, const U16* index_array, LLVector4a *tangent)
{
- //LLVector4a *tan1 = new LLVector4a[vertexCount * 2];
LLVector4a* tan1 = (LLVector4a*) ll_aligned_malloc_16(vertexCount*2*sizeof(LLVector4a));
- LLVector4a* tan2 = tan1 + vertexCount;
+ LLVector4a* tan2 = tan1 + vertexCount;
memset(tan1, 0, vertexCount*2*sizeof(LLVector4a));
- for (U32 a = 0; a < triangleCount; a++)
- {
- U32 i1 = *index_array++;
- U32 i2 = *index_array++;
- U32 i3 = *index_array++;
+ for (U32 a = 0; a < triangleCount; a++)
+ {
+ U32 i1 = *index_array++;
+ U32 i2 = *index_array++;
+ U32 i3 = *index_array++;
- const LLVector4a& v1 = vertex[i1];
- const LLVector4a& v2 = vertex[i2];
- const LLVector4a& v3 = vertex[i3];
+ const LLVector4a& v1 = vertex[i1];
+ const LLVector4a& v2 = vertex[i2];
+ const LLVector4a& v3 = vertex[i3];
- const LLVector2& w1 = texcoord[i1];
- const LLVector2& w2 = texcoord[i2];
- const LLVector2& w3 = texcoord[i3];
+ const LLVector2& w1 = texcoord[i1];
+ const LLVector2& w2 = texcoord[i2];
+ const LLVector2& w3 = texcoord[i3];
const F32* v1ptr = v1.getF32ptr();
const F32* v2ptr = v2.getF32ptr();
const F32* v3ptr = v3.getF32ptr();
- float x1 = v2ptr[0] - v1ptr[0];
- float x2 = v3ptr[0] - v1ptr[0];
- float y1 = v2ptr[1] - v1ptr[1];
- float y2 = v3ptr[1] - v1ptr[1];
- float z1 = v2ptr[2] - v1ptr[2];
- float z2 = v3ptr[2] - v1ptr[2];
+ float x1 = v2ptr[0] - v1ptr[0];
+ float x2 = v3ptr[0] - v1ptr[0];
+ float y1 = v2ptr[1] - v1ptr[1];
+ float y2 = v3ptr[1] - v1ptr[1];
+ float z1 = v2ptr[2] - v1ptr[2];
+ float z2 = v3ptr[2] - v1ptr[2];
- float s1 = w2.mV[0] - w1.mV[0];
- float s2 = w3.mV[0] - w1.mV[0];
- float t1 = w2.mV[1] - w1.mV[1];
- float t2 = w3.mV[1] - w1.mV[1];
+ float s1 = w2.mV[0] - w1.mV[0];
+ float s2 = w3.mV[0] - w1.mV[0];
+ float t1 = w2.mV[1] - w1.mV[1];
+ float t2 = w3.mV[1] - w1.mV[1];
F32 rd = s1*t2-s2*t1;
diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp
index 6e22712b94..09ef780424 100755
--- a/indra/llrender/llrendertarget.cpp
+++ b/indra/llrender/llrendertarget.cpp
@@ -572,8 +572,10 @@ void LLRenderTarget::copyContentsToFramebuffer(LLRenderTarget& source, S32 srcX0
{
if (!source.mFBO)
{
- llerrs << "Cannot copy framebuffer contents for non FBO render targets." << llendl;
+ llwarns << "Cannot copy framebuffer contents for non FBO render targets." << llendl;
+ return;
}
+
{
GLboolean write_depth = mask & GL_DEPTH_BUFFER_BIT ? TRUE : FALSE;
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 344079b640..ebb01fb330 100755
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -8592,6 +8592,18 @@
</array>
</map>
+ <key>RenderSpecularPrecision</key>
+ <map>
+ <key>Comment</key>
+ <string>Force 32-bit floating point LUT</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>U32</string>
+ <key>Value</key>
+ <real>0</real>
+ </map>
+
<key>RenderSpecularResX</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp
index 02d363d795..a1d60b5b16 100755
--- a/indra/newview/llpanelvolume.cpp
+++ b/indra/newview/llpanelvolume.cpp
@@ -710,9 +710,19 @@ void LLPanelVolume::onLightCancelColor(const LLSD& data)
void LLPanelVolume::onLightCancelTexture(const LLSD& data)
{
LLTextureCtrl* LightTextureCtrl = getChild<LLTextureCtrl>("light texture control");
+
if (LightTextureCtrl)
{
- LightTextureCtrl->setImageAssetID(mLightSavedTexture);
+ LightTextureCtrl->setImageAssetID(LLUUID::null);
+ }
+
+ LLVOVolume *volobjp = (LLVOVolume *) mObject.get();
+ if(volobjp)
+ {
+ // Cancel the light texture as requested
+ // NORSPEC-292
+ //
+ volobjp->setLightTextureID(LLUUID::null);
}
}
diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp
index 4676f7b251..2b1ed5858a 100755
--- a/indra/newview/lltexturectrl.cpp
+++ b/indra/newview/lltexturectrl.cpp
@@ -133,7 +133,8 @@ public:
PermissionMask getFilterPermMask();
void updateFilterPermMask();
void commitIfImmediateSet();
-
+ void commitCancel();
+
void onFilterEdit(const std::string& search_string );
void setCanApply(bool can_preview, bool can_apply);
@@ -706,6 +707,14 @@ void LLFloaterTexturePicker::commitIfImmediateSet()
}
}
+void LLFloaterTexturePicker::commitCancel()
+{
+ if (!mNoCopyTextureSelected && mOwner && mCanApply)
+ {
+ mOwner->onFloaterCommit(LLTextureCtrl::TEXTURE_CANCEL);
+ }
+}
+
// static
void LLFloaterTexturePicker::onBtnSetToDefault(void* userdata)
{
@@ -733,7 +742,7 @@ void LLFloaterTexturePicker::onBtnNone(void* userdata)
{
LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
self->setImageID( LLUUID::null );
- self->commitIfImmediateSet();
+ self->commitCancel();
}
/*
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 685f854573..d890548710 100755
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -2590,6 +2590,7 @@ void LLVOVolume::setLightTextureID(LLUUID id)
if (hasLightTexture())
{
setParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE, FALSE, true);
+ parameterChanged(LLNetworkData::PARAMS_LIGHT_IMAGE, true);
mLightTexture = NULL;
}
}
@@ -2607,7 +2608,8 @@ void LLVOVolume::setSpotLightParams(LLVector3 params)
void LLVOVolume::setIsLight(BOOL is_light)
{
- if (is_light != getIsLight())
+ BOOL was_light = getIsLight();
+ if (is_light != was_light)
{
if (is_light)
{
@@ -2792,7 +2794,7 @@ void LLVOVolume::updateSpotLightPriority()
bool LLVOVolume::isLightSpotlight() const
{
LLLightImageParams* params = (LLLightImageParams*) getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE);
- if (params)
+ if (params && getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE))
{
return params->isLightSpotlight();
}