summaryrefslogtreecommitdiff
path: root/indra/llrender/llrender.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llrender/llrender.cpp')
-rw-r--r--indra/llrender/llrender.cpp46
1 files changed, 33 insertions, 13 deletions
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index 1d53850f74..cbb178b6f8 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -84,10 +84,16 @@ static thread_local std::list<LLVertexBufferData> *sBufferDataList = nullptr;
static const GLenum sGLTextureType[] =
{
GL_TEXTURE_2D,
+#if GL_VERSION_3_1
GL_TEXTURE_RECTANGLE,
+#endif
GL_TEXTURE_CUBE_MAP,
+#if GL_VERSION_4_0
GL_TEXTURE_CUBE_MAP_ARRAY,
+#endif
+#if GL_VERSION_3_2
GL_TEXTURE_2D_MULTISAMPLE,
+#endif
GL_TEXTURE_3D
};
@@ -511,21 +517,22 @@ void LLTexUnit::setTextureFilteringOption(LLTexUnit::eTextureFilterOptions optio
}
}
- if (gGLManager.mGLVersion >= 4.59f)
+ if (gGLManager.mHasAnisotropic)
{
if (LLImageGL::sGlobalUseAnisotropic && option == TFO_ANISOTROPIC)
{
- glTexParameterf(sGLTextureType[mCurrTexType], GL_TEXTURE_MAX_ANISOTROPY, gGLManager.mMaxAnisotropy);
+ glTexParameterf(sGLTextureType[mCurrTexType], GL_TEXTURE_MAX_ANISOTROPY_EXT, gGLManager.mMaxAnisotropy);
}
else
{
- glTexParameterf(sGLTextureType[mCurrTexType], GL_TEXTURE_MAX_ANISOTROPY, 1.f);
+ glTexParameterf(sGLTextureType[mCurrTexType], GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.f);
}
}
}
GLint LLTexUnit::getTextureSource(eTextureBlendSrc src)
{
+#if GL_VERSION_1_3
switch(src)
{
// All four cases should return the same value.
@@ -540,8 +547,10 @@ GLint LLTexUnit::getTextureSource(eTextureBlendSrc src)
case TBS_TEX_ALPHA:
case TBS_ONE_MINUS_TEX_COLOR:
case TBS_ONE_MINUS_TEX_ALPHA:
+#endif
return GL_TEXTURE;
+#if GL_VERSION_1_3
// All four cases should return the same value.
case TBS_VERT_COLOR:
case TBS_VERT_ALPHA:
@@ -560,6 +569,7 @@ GLint LLTexUnit::getTextureSource(eTextureBlendSrc src)
LL_WARNS() << "Unknown eTextureBlendSrc: " << src << ". Using Vertex Color instead." << LL_ENDL;
return GL_PRIMARY_COLOR;
}
+#endif
}
GLint LLTexUnit::getTextureSourceType(eTextureBlendSrc src, bool isAlpha)
@@ -606,7 +616,9 @@ void LLTexUnit::setColorScale(S32 scale)
{
mCurrColorScale = scale;
gGL.flush();
+#if GL_VERSION_1_1
glTexEnvi( GL_TEXTURE_ENV, GL_RGB_SCALE, scale );
+#endif
}
}
@@ -616,7 +628,9 @@ void LLTexUnit::setAlphaScale(S32 scale)
{
mCurrAlphaScale = scale;
gGL.flush();
+#if GL_VERSION_1_1
glTexEnvi( GL_TEXTURE_ENV, GL_ALPHA_SCALE, scale );
+#endif
}
}
@@ -737,9 +751,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 +807,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;
@@ -868,7 +881,9 @@ bool LLRender::init(bool needs_vertex_buffer)
glCullFace(GL_BACK);
// necessary for reflection maps
+#if GL_VERSION_3_2
glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
+#endif
#if LL_WINDOWS
if (glGenVertexArrays == nullptr)
@@ -2021,9 +2036,11 @@ void LLRender::debugTexUnits(void)
case LLTexUnit::TT_TEXTURE:
LL_CONT << "Texture 2D";
break;
+#if GL_VERSION_3_1
case LLTexUnit::TT_RECT_TEXTURE:
LL_CONT << "Texture Rectangle";
break;
+#endif
case LLTexUnit::TT_CUBE_MAP:
LL_CONT << "Cube Map";
break;
@@ -2088,12 +2105,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 +2142,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
}