Don't exceed the supported line width

master
Ansariel 2020-10-18 02:18:22 +02:00
parent ac94268e5e
commit 16c14ea4cb
2 changed files with 22 additions and 1 deletions

View File

@ -1097,7 +1097,11 @@ LLRender::LLRender()
mMode(LLRender::TRIANGLES),
mCurrTextureUnitIndex(0),
mMaxAnisotropy(0.f),
mLineWidth(1.f) // <FS> Line width OGL core profile fix by Rye Mutt
mLineWidth(1.f), // <FS> Line width OGL core profile fix by Rye Mutt
// <FS:Ansariel> Don't ignore OpenGL max line width
mMaxLineWidthSmooth(1.f),
mMaxLineWidthAliased(1.f)
// </FS:Ansariel>
{
mTexUnits.reserve(LL_NUM_TEXTURE_LAYERS);
for (U32 i = 0; i < LL_NUM_TEXTURE_LAYERS; i++)
@ -1163,6 +1167,15 @@ void LLRender::init()
initVB();
// </FS:Ansariel>
stop_glerror();
// <FS:Ansariel> Don't ignore OpenGL max line width
GLint range[2];
glGetIntegerv(GL_ALIASED_LINE_WIDTH_RANGE, range);
mMaxLineWidthAliased = F32(range[1]);
glGetIntegerv(GL_SMOOTH_LINE_WIDTH_RANGE, range);
mMaxLineWidthSmooth = F32(range[1]);
stop_glerror();
// </FS:Ansariel>
}
void LLRender::shutdown()
@ -1896,6 +1909,10 @@ void LLRender::setLineWidth(F32 line_width)
{
line_width = 1.f;
}
else if (line_width > 1.f)
{
line_width = llmin(line_width, glIsEnabled(GL_LINE_SMOOTH) ? mMaxLineWidthSmooth : mMaxLineWidthAliased);
}
if (mLineWidth != line_width || mDirty)
{
if (mMode == LLRender::LINES || mMode == LLRender::LINE_STRIP)

View File

@ -502,6 +502,10 @@ private:
eCompareFunc mCurrAlphaFunc;
F32 mCurrAlphaFuncVal;
F32 mLineWidth; // <FS> Line width OGL core profile fix by Rye Mutt
// <FS:Ansariel> Don't ignore OpenGL max line width
F32 mMaxLineWidthSmooth;
F32 mMaxLineWidthAliased;
// </FS:Ansariel>
LLPointer<LLVertexBuffer> mBuffer;
LLStrider<LLVector3> mVerticesp;