summaryrefslogtreecommitdiff
path: root/indra/llrender/llgl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llrender/llgl.cpp')
-rw-r--r--indra/llrender/llgl.cpp67
1 files changed, 24 insertions, 43 deletions
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index 2f2c58ce73..6988e55034 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -50,10 +50,9 @@
#include "llglheaders.h"
#include "llglslshader.h"
-#include "llvertexbuffer.h"
-#include "llcontrol.h"
-extern LLControlGroup gSavedSettings;
-
+#include "glm/glm.hpp"
+#include <glm/gtc/matrix_access.hpp>
+#include "glm/gtc/type_ptr.hpp"
#if LL_WINDOWS
#include "lldxhardware.h"
@@ -1002,7 +1001,6 @@ LLGLManager::LLGLManager() :
mIsAMD(false),
mIsNVIDIA(false),
mIsIntel(false),
- mIsApple(false),
#if LL_DARWIN
mIsMobileGF(false),
#endif
@@ -1177,10 +1175,10 @@ bool LLGLManager::initGL()
mGLVendorShort = "INTEL";
mIsIntel = true;
}
- else if(mGLVendor.find("APPLE") != std::string::npos)
+ else if (mGLVendor.find("APPLE") != std::string::npos)
{
mGLVendorShort = "APPLE";
- mIsApple = TRUE;
+ mIsApple = true;
}
else
{
@@ -1281,18 +1279,6 @@ bool LLGLManager::initGL()
initGLStates();
- U32 MPVBufferOptiMode = gSavedSettings.getU32("MPVBufferOptiMode");
- if (MPVBufferOptiMode == 0)
- {
- if(mIsApple) MPVBufferOptiMode = 2;
- else MPVBufferOptiMode = 1;
- gSavedSettings.setU32("MPVBufferOptiMode",MPVBufferOptiMode);
- }
- LLVertexBuffer::sMappingMode = MPVBufferOptiMode;
- //LLRender::sMappingMode = MPVBufferOptiMode;
-
- LL_INFOS() << "milo init sMappingMode " << MPVBufferOptiMode << LL_ENDL;
-
return true;
}
@@ -1409,7 +1395,6 @@ void LLGLManager::asLLSD(LLSD& info)
info["is_ati"] = mIsAMD; // note, do not rename is_ati to is_amd without coordinating with DW
info["is_nvidia"] = mIsNVIDIA;
info["is_intel"] = mIsIntel;
- info["is_apple"] = mIsApple;
info["gl_renderer"] = mGLRenderer;
}
@@ -2736,7 +2721,7 @@ void parse_glsl_version(S32& major, S32& minor)
LLStringUtil::convertToS32(minor_str, minor);
}
-LLGLUserClipPlane::LLGLUserClipPlane(const LLPlane& p, const glh::matrix4f& modelview, const glh::matrix4f& projection, bool apply)
+LLGLUserClipPlane::LLGLUserClipPlane(const LLPlane& p, const glm::mat4& modelview, const glm::mat4& projection, bool apply)
{
mApply = apply;
@@ -2763,13 +2748,12 @@ void LLGLUserClipPlane::disable()
void LLGLUserClipPlane::setPlane(F32 a, F32 b, F32 c, F32 d)
{
- glh::matrix4f& P = mProjection;
- glh::matrix4f& M = mModelview;
+ const glm::mat4& P = mProjection;
+ const glm::mat4& M = mModelview;
- glh::matrix4f invtrans_MVP = (P * M).inverse().transpose();
- glh::vec4f oplane(a,b,c,d);
- glh::vec4f cplane;
- invtrans_MVP.mult_matrix_vec(oplane, cplane);
+ glm::mat4 invtrans_MVP = glm::transpose(glm::inverse(P*M));
+ glm::vec4 oplane(a,b,c,d);
+ glm::vec4 cplane = invtrans_MVP * oplane;
cplane /= fabs(cplane[2]); // normalize such that depth is not scaled
cplane[3] -= 1;
@@ -2777,13 +2761,13 @@ void LLGLUserClipPlane::setPlane(F32 a, F32 b, F32 c, F32 d)
if(cplane[2] < 0)
cplane *= -1;
- glh::matrix4f suffix;
- suffix.set_row(2, cplane);
- glh::matrix4f newP = suffix * P;
+ glm::mat4 suffix;
+ suffix = glm::row(suffix, 2, cplane);
+ glm::mat4 newP = suffix * P;
gGL.matrixMode(LLRender::MM_PROJECTION);
gGL.pushMatrix();
- gGL.loadMatrix(newP.m);
- gGLObliqueProjectionInverse = LLMatrix4(newP.inverse().transpose().m);
+ gGL.loadMatrix(glm::value_ptr(newP));
+ gGLObliqueProjectionInverse = LLMatrix4(glm::value_ptr(glm::transpose(glm::inverse(newP))));
gGL.matrixMode(LLRender::MM_MODELVIEW);
}
@@ -2796,7 +2780,7 @@ LLGLDepthTest::LLGLDepthTest(GLboolean depth_enabled, GLboolean write_enabled, G
: mPrevDepthEnabled(sDepthEnabled), mPrevDepthFunc(sDepthFunc), mPrevWriteEnabled(sWriteEnabled)
{
stop_glerror();
-
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
checkState();
if (!depth_enabled)
@@ -2829,6 +2813,7 @@ LLGLDepthTest::LLGLDepthTest(GLboolean depth_enabled, GLboolean write_enabled, G
LLGLDepthTest::~LLGLDepthTest()
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
checkState();
if (sDepthEnabled != mPrevDepthEnabled )
{
@@ -2879,31 +2864,27 @@ void LLGLDepthTest::checkState()
LLGLSquashToFarClip::LLGLSquashToFarClip()
{
- glh::matrix4f proj = get_current_projection();
+ glm::mat4 proj = get_current_projection();
setProjectionMatrix(proj, 0);
}
-LLGLSquashToFarClip::LLGLSquashToFarClip(glh::matrix4f& P, U32 layer)
+LLGLSquashToFarClip::LLGLSquashToFarClip(const glm::mat4& P, U32 layer)
{
setProjectionMatrix(P, layer);
}
-
-void LLGLSquashToFarClip::setProjectionMatrix(glh::matrix4f& projection, U32 layer)
+void LLGLSquashToFarClip::setProjectionMatrix(glm::mat4 projection, U32 layer)
{
-
F32 depth = 0.99999f - 0.0001f * layer;
- for (U32 i = 0; i < 4; i++)
- {
- projection.element(2, i) = projection.element(3, i) * depth;
- }
+ glm::vec4 P_row_3 = glm::row(projection, 3) * depth;
+ projection = glm::row(projection, 2, P_row_3);
LLRender::eMatrixMode last_matrix_mode = gGL.getMatrixMode();
gGL.matrixMode(LLRender::MM_PROJECTION);
gGL.pushMatrix();
- gGL.loadMatrix(projection.m);
+ gGL.loadMatrix(glm::value_ptr(projection));
gGL.matrixMode(last_matrix_mode);
}