diff options
| author | Rye <rye@lindenlab.com> | 2025-01-23 23:10:57 -0500 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-23 23:10:57 -0500 | 
| commit | aa02a5b3f44243e55f85e121d7d53e96e94a7422 (patch) | |
| tree | dc1f37243597961c9389746fb0a12bb8c8e5d71c /indra/llrender | |
| parent | 4ff56cfac8e3aaf1459c656306e2c18e7f63eaeb (diff) | |
| parent | 4763195e186f8c56c2ee92d4e0154c95aa011997 (diff) | |
Merge pull request #3468 from secondlife/rye/forever-3339
 Fall back mul_mat4_vec3 to scalar implementation to attempt crash mitigation 
Diffstat (limited to 'indra/llrender')
| -rw-r--r-- | indra/llrender/llrender.cpp | 22 | 
1 files changed, 12 insertions, 10 deletions
| diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 1d53850f74..1dc87a66ce 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -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));  } @@ -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; @@ -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); @@ -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  } | 
