Skip to content

Commit

Permalink
Merge branch 'release/2024.12-ForeverFPS' into geenz/legacy-water-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Geenz authored Jan 30, 2025
2 parents 7bdfaed + fd577e3 commit 9f4672b
Show file tree
Hide file tree
Showing 29 changed files with 255 additions and 165 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/tag-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ jobs:
- name: Update Tag
uses: actions/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
# use a real access token instead of GITHUB_TOKEN default.
# required so that the results of this tag creation can trigger the build workflow
# https://stackoverflow.com/a/71372524
# https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow
# this token will need to be renewed anually in January
github-token: ${{ secrets.LL_TAG_RELEASE_TOKEN }}
script: |
github.rest.git.createRef({
owner: context.repo.owner,
Expand Down
1 change: 1 addition & 0 deletions indra/llcommon/llerror.h
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ namespace LLError
class LLUserWarningMsg
{
public:
// error codes, tranlates to last_exec states like LAST_EXEC_OTHER_CRASH
typedef enum
{
ERROR_OTHER = 0,
Expand Down
13 changes: 13 additions & 0 deletions indra/llmath/llvector4a.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ class LLRotation;
#include <assert.h>
#include "llpreprocessor.h"
#include "llmemory.h"
#include "glm/vec3.hpp"
#include "glm/vec4.hpp"
#include "glm/gtc/type_ptr.hpp"

///////////////////////////////////
// FIRST TIME USERS PLEASE READ
Expand Down Expand Up @@ -364,6 +367,16 @@ class alignas(16) LLVector4a

inline operator LLQuad() const;

explicit inline operator glm::vec3() const
{
return glm::make_vec3(getF32ptr());
};

explicit inline operator glm::vec4() const
{
return glm::make_vec4(getF32ptr());
};

private:
LLQuad mQ{};
};
Expand Down
51 changes: 51 additions & 0 deletions indra/llmath/v3math.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
#include "llmath.h"

#include "llsd.h"

#include "glm/vec3.hpp"
#include "glm/vec4.hpp"
#include "glm/gtc/type_ptr.hpp"

class LLVector2;
class LLVector4;
class LLVector4a;
Expand Down Expand Up @@ -66,6 +71,11 @@ class LLVector3
explicit LLVector3(const LLVector4a& vec); // Initializes LLVector4 to (vec[0]. vec[1], vec[2])
explicit LLVector3(const LLSD& sd);

// GLM interop
explicit LLVector3(const glm::vec3& vec); // Initializes LLVector3 to (vec[0]. vec[1], vec[2])
explicit LLVector3(const glm::vec4& vec); // Initializes LLVector3 to (vec[0]. vec[1], vec[2])
explicit inline operator glm::vec3() const; // Initializes glm::vec3 to (vec[0]. vec[1], vec[2])
explicit inline operator glm::vec4() const; // Initializes glm::vec4 to (vec[0]. vec[1], vec[2], 1)

LLSD getValue() const;

Expand All @@ -92,6 +102,8 @@ class LLVector3
inline void set(const F32 *vec); // Sets LLVector3 to vec
const LLVector3& set(const LLVector4 &vec);
const LLVector3& set(const LLVector3d &vec);// Sets LLVector3 to vec
inline void set(const glm::vec4& vec); // Sets LLVector3 to vec
inline void set(const glm::vec3& vec); // Sets LLVector3 to vec

inline void setVec(F32 x, F32 y, F32 z); // deprecated
inline void setVec(const LLVector3 &vec); // deprecated
Expand Down Expand Up @@ -190,6 +202,20 @@ inline LLVector3::LLVector3(const F32 *vec)
mV[VZ] = vec[VZ];
}

inline LLVector3::LLVector3(const glm::vec3& vec)
{
mV[VX] = vec.x;
mV[VY] = vec.y;
mV[VZ] = vec.z;
}

inline LLVector3::LLVector3(const glm::vec4& vec)
{
mV[VX] = vec.x;
mV[VY] = vec.y;
mV[VZ] = vec.z;
}

/*
inline LLVector3::LLVector3(const LLVector3 &copy)
{
Expand Down Expand Up @@ -259,6 +285,20 @@ inline void LLVector3::set(const F32 *vec)
mV[2] = vec[2];
}

inline void LLVector3::set(const glm::vec4& vec)
{
mV[VX] = vec.x;
mV[VY] = vec.y;
mV[VZ] = vec.z;
}

inline void LLVector3::set(const glm::vec3& vec)
{
mV[VX] = vec.x;
mV[VY] = vec.y;
mV[VZ] = vec.z;
}

// deprecated
inline void LLVector3::setVec(F32 x, F32 y, F32 z)
{
Expand Down Expand Up @@ -471,6 +511,17 @@ inline LLVector3 operator-(const LLVector3 &a)
return LLVector3( -a.mV[0], -a.mV[1], -a.mV[2] );
}

inline LLVector3::operator glm::vec3() const
{
// Do not use glm::make_vec3 it can result in a buffer overrun on some platforms due to glm::vec3 being a simd vector internally
return glm::vec3(mV[VX], mV[VY], mV[VZ]);
}

inline LLVector3::operator glm::vec4() const
{
return glm::vec4(mV[VX], mV[VY], mV[VZ], 1.f);
}

inline F32 dist_vec(const LLVector3 &a, const LLVector3 &b)
{
F32 x = a.mV[0] - b.mV[0];
Expand Down
51 changes: 51 additions & 0 deletions indra/llmath/v4math.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
#include "v3math.h"
#include "v2math.h"

#include "glm/vec3.hpp"
#include "glm/vec4.hpp"
#include "glm/gtc/type_ptr.hpp"

class LLMatrix3;
class LLMatrix4;
class LLQuaternion;
Expand Down Expand Up @@ -73,6 +77,11 @@ class LLVector4
mV[3] = (F32)sd[3].asReal();
}

// GLM interop
explicit LLVector4(const glm::vec3& vec); // Initializes LLVector4 to (vec, 1)
explicit LLVector4(const glm::vec4& vec); // Initializes LLVector4 to vec
explicit operator glm::vec3() const; // Initializes glm::vec3 to (vec[0]. vec[1], vec[2])
explicit operator glm::vec4() const; // Initializes glm::vec4 to (vec[0]. vec[1], vec[2], vec[3])

inline bool isFinite() const; // checks to see if all values of LLVector3 are finite

Expand All @@ -85,6 +94,8 @@ class LLVector4
inline void set(const LLVector4 &vec); // Sets LLVector4 to vec
inline void set(const LLVector3 &vec, F32 w = 1.f); // Sets LLVector4 to LLVector3 vec
inline void set(const F32 *vec); // Sets LLVector4 to vec
inline void set(const glm::vec4& vec); // Sets LLVector4 to vec
inline void set(const glm::vec3& vec, F32 w = 1.f); // Sets LLVector4 to LLVector3 vec with w defaulted to 1

inline void setVec(F32 x, F32 y, F32 z); // deprecated
inline void setVec(F32 x, F32 y, F32 z, F32 w); // deprecated
Expand Down Expand Up @@ -223,6 +234,21 @@ inline LLVector4::LLVector4(const LLSD &sd)
setValue(sd);
}

inline LLVector4::LLVector4(const glm::vec3& vec)
{
mV[VX] = vec.x;
mV[VY] = vec.y;
mV[VZ] = vec.z;
mV[VW] = 1.f;
}

inline LLVector4::LLVector4(const glm::vec4& vec)
{
mV[VX] = vec.x;
mV[VY] = vec.y;
mV[VZ] = vec.z;
mV[VW] = vec.w;
}

inline bool LLVector4::isFinite() const
{
Expand Down Expand Up @@ -297,6 +323,21 @@ inline void LLVector4::set(const F32 *vec)
mV[VW] = vec[VW];
}

inline void LLVector4::set(const glm::vec4& vec)
{
mV[VX] = vec.x;
mV[VY] = vec.y;
mV[VZ] = vec.z;
mV[VW] = vec.w;
}

inline void LLVector4::set(const glm::vec3& vec, F32 w)
{
mV[VX] = vec.x;
mV[VY] = vec.y;
mV[VZ] = vec.z;
mV[VW] = w;
}

// deprecated
inline void LLVector4::setVec(F32 x, F32 y, F32 z)
Expand Down Expand Up @@ -466,6 +507,16 @@ inline LLVector4 operator-(const LLVector4 &a)
return LLVector4( -a.mV[VX], -a.mV[VY], -a.mV[VZ] );
}

inline LLVector4::operator glm::vec3() const
{
return glm::vec3(mV[VX], mV[VY], mV[VZ]);
}

inline LLVector4::operator glm::vec4() const
{
return glm::make_vec4(mV);
}

inline F32 dist_vec(const LLVector4 &a, const LLVector4 &b)
{
LLVector4 vec = a - b;
Expand Down
22 changes: 12 additions & 10 deletions indra/llrender/llrender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -737,9 +737,8 @@ void LLLightState::setPosition(const LLVector4& position)
++gGL.mLightHash;
mPosition = position;
//transform position by current modelview matrix
glm::vec4 pos(glm::make_vec4(position.mV));
const glm::mat4& mat = gGL.getModelviewMatrix();
pos = mat * pos;
glm::vec4 pos(position);
pos = gGL.getModelviewMatrix() * pos;
mPosition.set(glm::value_ptr(pos));
}

Expand Down Expand Up @@ -794,7 +793,7 @@ void LLLightState::setSpotDirection(const LLVector3& direction)
++gGL.mLightHash;

//transform direction by current modelview matrix
glm::vec3 dir(glm::make_vec3(direction.mV));
glm::vec3 dir(direction);
const glm::mat3 mat(gGL.getModelviewMatrix());
dir = mat * dir;

Expand Down Expand Up @@ -2088,12 +2087,14 @@ void set_last_projection(const glm::mat4& mat)

glm::vec3 mul_mat4_vec3(const glm::mat4& mat, const glm::vec3& vec)
{
//const float w = vec[0] * mat[0][3] + vec[1] * mat[1][3] + vec[2] * mat[2][3] + mat[3][3];
//return glm::vec3(
// (vec[0] * mat[0][0] + vec[1] * mat[1][0] + vec[2] * mat[2][0] + mat[3][0]) / w,
// (vec[0] * mat[0][1] + vec[1] * mat[1][1] + vec[2] * mat[2][1] + mat[3][1]) / w,
// (vec[0] * mat[0][2] + vec[1] * mat[1][2] + vec[2] * mat[2][2] + mat[3][2]) / w
//);
#if 1 // SIMD path results in strange crashes. Fall back to scalar for now.
const float w = vec[0] * mat[0][3] + vec[1] * mat[1][3] + vec[2] * mat[2][3] + mat[3][3];
return glm::vec3(
(vec[0] * mat[0][0] + vec[1] * mat[1][0] + vec[2] * mat[2][0] + mat[3][0]) / w,
(vec[0] * mat[0][1] + vec[1] * mat[1][1] + vec[2] * mat[2][1] + mat[3][1]) / w,
(vec[0] * mat[0][2] + vec[1] * mat[1][2] + vec[2] * mat[2][2] + mat[3][2]) / w
);
#else
LLVector4a x, y, z, s, t, p, q;
x.splat(vec.x);
Expand Down Expand Up @@ -2123,4 +2124,5 @@ glm::vec3 mul_mat4_vec3(const glm::mat4& mat, const glm::vec3& vec)
res.setAdd(x, z);
res.div(q);
return glm::make_vec3(res.getF32ptr());
#endif
}
3 changes: 3 additions & 0 deletions indra/llrender/llshadermgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev

if (filename.empty())
{
LL_WARNS("ShaderLoading") << "tried loading empty filename" << LL_ENDL;
return 0;
}

Expand Down Expand Up @@ -923,6 +924,8 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev
}
LL_WARNS("ShaderLoading") << "Failed to load " << filename << LL_ENDL;
}

LL_DEBUGS("ShaderLoading") << "loadShaderFile() completed, ret: " << U32(ret) << LL_ENDL;
return ret;
}

Expand Down
4 changes: 2 additions & 2 deletions indra/newview/gltfscenemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -975,9 +975,9 @@ void renderAssetDebug(LLViewerObject* obj, Asset* asset)

LLVector4a t;
agent_to_asset.affineTransform(gDebugRaycastStart, t);
start = glm::make_vec4(t.getF32ptr());
start = vec4(t);
agent_to_asset.affineTransform(gDebugRaycastEnd, t);
end = glm::make_vec4(t.getF32ptr());
end = vec4(t);

start.w = end.w = 1.0;

Expand Down
11 changes: 8 additions & 3 deletions indra/newview/llappearancemgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,9 +537,14 @@ LLUpdateAppearanceOnDestroy::~LLUpdateAppearanceOnDestroy()

selfStopPhase("update_appearance_on_destroy");

LLAppearanceMgr::instance().updateAppearanceFromCOF(mEnforceItemRestrictions,
mEnforceOrdering,
mPostUpdateFunc);
//avoid calling an update inside coroutine
bool force_restrictions(mEnforceItemRestrictions);
bool enforce_ordering(mEnforceOrdering);
nullary_func_t post_update_func(mPostUpdateFunc);
doOnIdleOneTime([force_restrictions,enforce_ordering,post_update_func]()
{
LLAppearanceMgr::instance().updateAppearanceFromCOF(force_restrictions, enforce_ordering, post_update_func);
});
}
}

Expand Down
34 changes: 10 additions & 24 deletions indra/newview/llappviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,6 @@ const int MAX_MARKER_LENGTH = 1024;
const std::string MARKER_FILE_NAME("SecondLife.exec_marker");
const std::string START_MARKER_FILE_NAME("SecondLife.start_marker");
const std::string ERROR_MARKER_FILE_NAME("SecondLife.error_marker");
const std::string LLERROR_MARKER_FILE_NAME("SecondLife.llerror_marker");
const std::string LOGOUT_MARKER_FILE_NAME("SecondLife.logout_marker");
static bool gDoDisconnect = false;
static std::string gLaunchFileOnQuit;
Expand Down Expand Up @@ -2220,6 +2219,7 @@ bool LLAppViewer::initThreads()
return true;
}

// Callback for all LL_ERROR calls
void errorCallback(LLError::ELevel level, const std::string &error_string)
{
if (level == LLError::LEVEL_ERROR)
Expand All @@ -2235,9 +2235,18 @@ void errorCallback(LLError::ELevel level, const std::string &error_string)
// haven't actually trashed anything yet, we can afford to write the whole
// static info file.
LLAppViewer::instance()->writeDebugInfo();

std::string error_marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, ERROR_MARKER_FILE_NAME);
if (!LLAPRFile::isExist(error_marker_file, NULL, LL_APR_RB))
{
// If marker doesn't exist, create a marker with llerror code for next launch
// otherwise don't override existing file
LLAppViewer::instance()->createErrorMarker(LAST_EXEC_LLERROR_CRASH);
}
}
}

// Callback for LLError::LLUserWarningMsg
void errorHandler(const std::string& title_string, const std::string& message_string, S32 code)
{
if (!message_string.empty())
Expand Down Expand Up @@ -3939,29 +3948,6 @@ void LLAppViewer::processMarkerFiles()
}
LLAPRFile::remove(logout_marker_file);
}
// further refine based on whether or not a marker created during an llerr crash is found
std::string llerror_marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, LLERROR_MARKER_FILE_NAME);
if(LLAPRFile::isExist(llerror_marker_file, NULL, LL_APR_RB))
{
if (markerIsSameVersion(llerror_marker_file))
{
if ( gLastExecEvent == LAST_EXEC_LOGOUT_FROZE )
{
gLastExecEvent = LAST_EXEC_LOGOUT_CRASH;
LL_INFOS("MarkerFile") << "LLError marker '"<< llerror_marker_file << "' crashed, setting LastExecEvent to LOGOUT_CRASH" << LL_ENDL;
}
else
{
gLastExecEvent = LAST_EXEC_LLERROR_CRASH;
LL_INFOS("MarkerFile") << "LLError marker '"<< llerror_marker_file << "' crashed, setting LastExecEvent to LLERROR_CRASH" << LL_ENDL;
}
}
else
{
LL_INFOS("MarkerFile") << "LLError marker '"<< llerror_marker_file << "' found, but versions did not match" << LL_ENDL;
}
LLAPRFile::remove(llerror_marker_file);
}
// and last refine based on whether or not a marker created during a non-llerr crash is found
std::string error_marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, ERROR_MARKER_FILE_NAME);
if(LLAPRFile::isExist(error_marker_file, NULL, LL_APR_RB))
Expand Down
Loading

0 comments on commit 9f4672b

Please sign in to comment.