Skip to content

Commit fc9805f

Browse files
authored
Merge pull request #4935 from RyeMutt/rye/lnxfixlines
Improve fix for line width crashes under certain Mesa GL drivers
2 parents a5bf53f + 6fccf06 commit fc9805f

File tree

3 files changed

+3
-15
lines changed

3 files changed

+3
-15
lines changed

indra/llrender/llgl.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,11 +1326,7 @@ bool LLGLManager::initGL()
13261326
glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, &mMaxUniformBlockSize);
13271327

13281328
// If outside the allowed range, glLineWidth fails with "invalid value".
1329-
// On Darwin, the range is [1, 1].
1330-
GLfloat line_width_range[2]{0.f};
1331-
glGetFloatv(GL_SMOOTH_LINE_WIDTH_RANGE, line_width_range);
1332-
mMinSmoothLineWidth = line_width_range[0];
1333-
mMaxSmoothLineWidth = line_width_range[1];
1329+
glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, mAliasedLineRange.mV);
13341330

13351331
// sanity clamp max uniform block size to 64k just in case
13361332
// there's some implementation that reports a crazy value

indra/llrender/llgl.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ class LLGLManager
9292
F32 mMaxAnisotropy = 0.f;
9393
S32 mMaxUniformBlockSize = 0;
9494
S32 mMaxVaryingVectors = 0;
95-
F32 mMinSmoothLineWidth = 1.f;
96-
F32 mMaxSmoothLineWidth = 1.f;
95+
LLVector2 mAliasedLineRange = LLVector2(1.f, 1.f);
9796

9897
// GL 4.x capabilities
9998
bool mHasCubeMapArray = false;

indra/llrender/llrender.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1930,14 +1930,7 @@ void LLRender::setLineWidth(F32 width)
19301930
{
19311931
gGL.flush();
19321932

1933-
if(sGLCoreProfile)
1934-
{
1935-
width = 1.f;
1936-
}
1937-
else
1938-
{
1939-
width = llclamp(width, gGLManager.mMinSmoothLineWidth, gGLManager.mMaxSmoothLineWidth);
1940-
}
1933+
width = llclamp(width, gGLManager.mAliasedLineRange[0], gGLManager.mAliasedLineRange[1]);
19411934
if(mLineWidth != width)
19421935
{
19431936
mLineWidth = width;

0 commit comments

Comments
 (0)