From e803bbc0db695abe73de9797510ba22646528e23 Mon Sep 17 00:00:00 2001 From: Rye Date: Mon, 27 Oct 2025 02:55:56 -0400 Subject: Modernize viewer alignment macros to use alignas and fix misaligned class issues reported by ubsan/asan Signed-off-by: Rye --- indra/newview/llspatialpartition.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'indra/newview/llspatialpartition.cpp') diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index f3cfbd9565..4ba47aa4da 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -3625,12 +3625,11 @@ bool LLSpatialPartition::isVisible(const LLVector3& v) return true; } -LL_ALIGN_PREFIX(16) -class LLOctreeIntersect : public LLOctreeTraveler> +class alignas(16) LLOctreeIntersect : public LLOctreeTraveler> { public: - LL_ALIGN_16(LLVector4a mStart); - LL_ALIGN_16(LLVector4a mEnd); + LLVector4a mStart; + LLVector4a mEnd; S32 *mFaceHit; LLVector4a *mIntersection; @@ -3780,7 +3779,7 @@ public: return false; } -} LL_ALIGN_POSTFIX(16); +}; LLDrawable* LLSpatialPartition::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, bool pick_transparent, -- cgit v1.3 From e2f5e149c29b51c1091c1d96251a700ec87315ee Mon Sep 17 00:00:00 2001 From: Rye Date: Tue, 28 Oct 2025 05:55:39 -0400 Subject: Fix deprecated opengl draw commands Signed-off-by: Rye --- indra/newview/lldrawpoolterrain.cpp | 373 ----------------------------------- indra/newview/lldrawpoolterrain.h | 3 - indra/newview/llspatialpartition.cpp | 5 +- 3 files changed, 2 insertions(+), 379 deletions(-) (limited to 'indra/newview/llspatialpartition.cpp') diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp index 5e676bc5b3..d75b8d0ac6 100644 --- a/indra/newview/lldrawpoolterrain.cpp +++ b/indra/newview/lldrawpoolterrain.cpp @@ -636,379 +636,6 @@ void LLDrawPoolTerrain::hilightParcelOwners() } -void LLDrawPoolTerrain::renderFull4TU() -{ - // Hack! Get the region that this draw pool is rendering from! - LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion(); - LLVLComposition *compp = regionp->getComposition(); - LLViewerTexture *detail_texture0p = compp->mDetailTextures[0]; - LLViewerTexture *detail_texture1p = compp->mDetailTextures[1]; - LLViewerTexture *detail_texture2p = compp->mDetailTextures[2]; - LLViewerTexture *detail_texture3p = compp->mDetailTextures[3]; - - LLVector3d region_origin_global = gAgent.getRegion()->getOriginGlobal(); - F32 offset_x = (F32)fmod(region_origin_global.mdV[VX], 1.0/(F64)sDetailScale)*sDetailScale; - F32 offset_y = (F32)fmod(region_origin_global.mdV[VY], 1.0/(F64)sDetailScale)*sDetailScale; - - LLVector4 tp0, tp1; - - tp0.setVec(sDetailScale, 0.0f, 0.0f, offset_x); - tp1.setVec(0.0f, sDetailScale, 0.0f, offset_y); - - gGL.blendFunc(LLRender::BF_ONE_MINUS_SOURCE_ALPHA, LLRender::BF_SOURCE_ALPHA); - - //---------------------------------------------------------------------------- - // Pass 1/1 - - // - // Stage 0: detail texture 0 - // - gGL.getTexUnit(0)->activate(); - gGL.getTexUnit(0)->bind(detail_texture0p); - - glEnable(GL_TEXTURE_GEN_S); - glEnable(GL_TEXTURE_GEN_T); - glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - - glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV); - glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV); - - // - // Stage 1: Generate alpha ramp for detail0/detail1 transition - // - - gGL.getTexUnit(1)->bind(m2DAlphaRampImagep.get()); - gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(1)->activate(); - - // - // Stage 2: Interpolate detail1 with existing based on ramp - // - gGL.getTexUnit(2)->bind(detail_texture1p); - gGL.getTexUnit(2)->enable(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(2)->activate(); - - glEnable(GL_TEXTURE_GEN_S); - glEnable(GL_TEXTURE_GEN_T); - glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV); - glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV); - - // - // Stage 3: Modulate with primary (vertex) color for lighting - // - gGL.getTexUnit(3)->bind(detail_texture1p); - gGL.getTexUnit(3)->enable(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(3)->activate(); - - gGL.getTexUnit(0)->activate(); - - // GL_BLEND disabled by default - drawLoop(); - - //---------------------------------------------------------------------------- - // Second pass - - // Stage 0: Write detail3 into base - // - gGL.getTexUnit(0)->activate(); - gGL.getTexUnit(0)->bind(detail_texture3p); - - glEnable(GL_TEXTURE_GEN_S); - glEnable(GL_TEXTURE_GEN_T); - glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV); - glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV); - - // - // Stage 1: Generate alpha ramp for detail2/detail3 transition - // - gGL.getTexUnit(1)->bind(m2DAlphaRampImagep); - gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(1)->activate(); - - // Set the texture matrix - gGL.matrixMode(LLRender::MM_TEXTURE); - gGL.loadIdentity(); - gGL.translatef(-2.f, 0.f, 0.f); - - // - // Stage 2: Interpolate detail2 with existing based on ramp - // - gGL.getTexUnit(2)->bind(detail_texture2p); - gGL.getTexUnit(2)->enable(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(2)->activate(); - - glEnable(GL_TEXTURE_GEN_S); - glEnable(GL_TEXTURE_GEN_T); - glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV); - glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV); - - // - // Stage 3: Generate alpha ramp for detail1/detail2 transition - // - gGL.getTexUnit(3)->bind(m2DAlphaRampImagep); - gGL.getTexUnit(3)->enable(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(3)->activate(); - - // Set the texture matrix - gGL.matrixMode(LLRender::MM_TEXTURE); - gGL.loadIdentity(); - gGL.translatef(-1.f, 0.f, 0.f); - gGL.matrixMode(LLRender::MM_MODELVIEW); - - gGL.getTexUnit(0)->activate(); - { - LLGLEnable blend(GL_BLEND); - drawLoop(); - } - - LLVertexBuffer::unbind(); - // Disable multitexture - gGL.getTexUnit(3)->unbind(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(3)->disable(); - gGL.getTexUnit(3)->activate(); - - gGL.matrixMode(LLRender::MM_TEXTURE); - gGL.loadIdentity(); - gGL.matrixMode(LLRender::MM_MODELVIEW); - - gGL.getTexUnit(2)->unbind(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(2)->disable(); - gGL.getTexUnit(2)->activate(); - - glDisable(GL_TEXTURE_GEN_S); - glDisable(GL_TEXTURE_GEN_T); - gGL.matrixMode(LLRender::MM_TEXTURE); - gGL.loadIdentity(); - gGL.matrixMode(LLRender::MM_MODELVIEW); - - gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(1)->disable(); - gGL.getTexUnit(1)->activate(); - - gGL.matrixMode(LLRender::MM_TEXTURE); - gGL.loadIdentity(); - gGL.matrixMode(LLRender::MM_MODELVIEW); - - // Restore blend state - gGL.setSceneBlendType(LLRender::BT_ALPHA); - - //---------------------------------------------------------------------------- - // Restore Texture Unit 0 defaults - - gGL.getTexUnit(0)->activate(); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - - glDisable(GL_TEXTURE_GEN_S); - glDisable(GL_TEXTURE_GEN_T); - gGL.matrixMode(LLRender::MM_TEXTURE); - gGL.loadIdentity(); - gGL.matrixMode(LLRender::MM_MODELVIEW); -} - -void LLDrawPoolTerrain::renderFull2TU() -{ - // Hack! Get the region that this draw pool is rendering from! - LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion(); - LLVLComposition *compp = regionp->getComposition(); - LLViewerTexture *detail_texture0p = compp->mDetailTextures[0]; - LLViewerTexture *detail_texture1p = compp->mDetailTextures[1]; - LLViewerTexture *detail_texture2p = compp->mDetailTextures[2]; - LLViewerTexture *detail_texture3p = compp->mDetailTextures[3]; - - LLVector3d region_origin_global = gAgent.getRegion()->getOriginGlobal(); - F32 offset_x = (F32)fmod(region_origin_global.mdV[VX], 1.0/(F64)sDetailScale)*sDetailScale; - F32 offset_y = (F32)fmod(region_origin_global.mdV[VY], 1.0/(F64)sDetailScale)*sDetailScale; - - LLVector4 tp0, tp1; - - tp0.setVec(sDetailScale, 0.0f, 0.0f, offset_x); - tp1.setVec(0.0f, sDetailScale, 0.0f, offset_y); - - gGL.blendFunc(LLRender::BF_ONE_MINUS_SOURCE_ALPHA, LLRender::BF_SOURCE_ALPHA); - - //---------------------------------------------------------------------------- - // Pass 1/4 - - // - // Stage 0: Render detail 0 into base - // - gGL.getTexUnit(0)->bind(detail_texture0p); - glEnable(GL_TEXTURE_GEN_S); - glEnable(GL_TEXTURE_GEN_T); - glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - - glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV); - glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV); - - drawLoop(); - - //---------------------------------------------------------------------------- - // Pass 2/4 - - // - // Stage 0: Generate alpha ramp for detail0/detail1 transition - // - gGL.getTexUnit(0)->bind(m2DAlphaRampImagep); - - glDisable(GL_TEXTURE_GEN_S); - glDisable(GL_TEXTURE_GEN_T); - - // - // Stage 1: Write detail1 - // - gGL.getTexUnit(1)->bind(detail_texture1p); - gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(1)->activate(); - - glEnable(GL_TEXTURE_GEN_S); - glEnable(GL_TEXTURE_GEN_T); - glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV); - glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV); - - gGL.getTexUnit(0)->activate(); - { - LLGLEnable blend(GL_BLEND); - drawLoop(); - } - //---------------------------------------------------------------------------- - // Pass 3/4 - - // - // Stage 0: Generate alpha ramp for detail1/detail2 transition - // - gGL.getTexUnit(0)->bind(m2DAlphaRampImagep); - - // Set the texture matrix - gGL.matrixMode(LLRender::MM_TEXTURE); - gGL.loadIdentity(); - gGL.translatef(-1.f, 0.f, 0.f); - gGL.matrixMode(LLRender::MM_MODELVIEW); - - // - // Stage 1: Write detail2 - // - gGL.getTexUnit(1)->bind(detail_texture2p); - gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(1)->activate(); - - glEnable(GL_TEXTURE_GEN_S); - glEnable(GL_TEXTURE_GEN_T); - glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV); - glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV); - - { - LLGLEnable blend(GL_BLEND); - drawLoop(); - } - - //---------------------------------------------------------------------------- - // Pass 4/4 - - // - // Stage 0: Generate alpha ramp for detail2/detail3 transition - // - gGL.getTexUnit(0)->activate(); - gGL.getTexUnit(0)->bind(m2DAlphaRampImagep); - // Set the texture matrix - gGL.matrixMode(LLRender::MM_TEXTURE); - gGL.loadIdentity(); - gGL.translatef(-2.f, 0.f, 0.f); - gGL.matrixMode(LLRender::MM_MODELVIEW); - - // Stage 1: Write detail3 - gGL.getTexUnit(1)->bind(detail_texture3p); - gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(1)->activate(); - - glEnable(GL_TEXTURE_GEN_S); - glEnable(GL_TEXTURE_GEN_T); - glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV); - glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV); - - gGL.getTexUnit(0)->activate(); - { - LLGLEnable blend(GL_BLEND); - drawLoop(); - } - - // Restore blend state - gGL.setSceneBlendType(LLRender::BT_ALPHA); - - // Disable multitexture - - gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(1)->disable(); - gGL.getTexUnit(1)->activate(); - - glDisable(GL_TEXTURE_GEN_S); - glDisable(GL_TEXTURE_GEN_T); - gGL.matrixMode(LLRender::MM_TEXTURE); - gGL.loadIdentity(); - gGL.matrixMode(LLRender::MM_MODELVIEW); - - //---------------------------------------------------------------------------- - // Restore Texture Unit 0 defaults - - gGL.getTexUnit(0)->activate(); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - glDisable(GL_TEXTURE_GEN_S); - glDisable(GL_TEXTURE_GEN_T); - gGL.matrixMode(LLRender::MM_TEXTURE); - gGL.loadIdentity(); - gGL.matrixMode(LLRender::MM_MODELVIEW); -} - - -void LLDrawPoolTerrain::renderSimple() -{ - LLVector4 tp0, tp1; - - //---------------------------------------------------------------------------- - // Pass 1/1 - - // Stage 0: Base terrain texture pass - mTexturep->addTextureStats(1024.f*1024.f); - - gGL.getTexUnit(0)->activate(); - gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(0)->bind(mTexturep); - - LLVector3 origin_agent = mDrawFace[0]->getDrawable()->getVObj()->getRegion()->getOriginAgent(); - F32 tscale = 1.f/256.f; - tp0.setVec(tscale, 0.f, 0.0f, -1.f*(origin_agent.mV[0]/256.f)); - tp1.setVec(0.f, tscale, 0.0f, -1.f*(origin_agent.mV[1]/256.f)); - - sShader->uniform4fv(LLShaderMgr::OBJECT_PLANE_S, 1, tp0.mV); - sShader->uniform4fv(LLShaderMgr::OBJECT_PLANE_T, 1, tp1.mV); - - drawLoop(); - - //---------------------------------------------------------------------------- - // Restore Texture Unit 0 defaults - - gGL.getTexUnit(0)->activate(); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.matrixMode(LLRender::MM_TEXTURE); - gGL.loadIdentity(); - gGL.matrixMode(LLRender::MM_MODELVIEW); -} - //============================================================================ void LLDrawPoolTerrain::renderOwnership() diff --git a/indra/newview/lldrawpoolterrain.h b/indra/newview/lldrawpoolterrain.h index 23cf253b6a..49fccc168f 100644 --- a/indra/newview/lldrawpoolterrain.h +++ b/indra/newview/lldrawpoolterrain.h @@ -73,11 +73,8 @@ public: protected: void boostTerrainDetailTextures(); - void renderSimple(); void renderOwnership(); - void renderFull2TU(); - void renderFull4TU(); void renderFullShader(); void renderFullShaderTextures(); void renderFullShaderPBR(bool use_local_materials = false); diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 4ba47aa4da..bc57b71022 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -2491,12 +2491,11 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume, bool wireframe llassert(LLGLSLShader::sCurBoundShader != 0); LLVertexBuffer::unbind(); - glVertexPointer(3, GL_FLOAT, 16, phys_volume->mHullPoints); gGL.diffuseColor4fv(color.mV); - gGL.syncMatrices(); - glDrawElements(GL_TRIANGLES, phys_volume->mNumHullIndices, GL_UNSIGNED_SHORT, phys_volume->mHullIndices); + + LLVertexBuffer::drawElements(LLRender::TRIANGLES, phys_volume->mHullPoints, nullptr, phys_volume->mNumHullIndices, phys_volume->mHullIndices); } else { -- cgit v1.3 From 14bf0509efad36650e6157975cd5e0d77e64183b Mon Sep 17 00:00:00 2001 From: Rye Date: Tue, 28 Oct 2025 22:20:37 -0400 Subject: Fix invalid calls to glLineWidth on some linux GL drivers Signed-off-by: Rye --- indra/llrender/llgl.cpp | 7 +++++++ indra/llrender/llgl.h | 2 ++ indra/llrender/llrender.cpp | 18 ++++++++++++++++++ indra/llrender/llrender.h | 5 ++++- indra/llrender/llrender2dutils.cpp | 15 +++------------ indra/newview/llface.cpp | 2 +- indra/newview/llfasttimerview.cpp | 6 ++---- indra/newview/llglsandbox.cpp | 12 +++++------- indra/newview/llmodelpreview.cpp | 16 ++++++++-------- indra/newview/llselectmgr.cpp | 2 +- indra/newview/llsnapshotlivepreview.cpp | 4 ++-- indra/newview/llspatialpartition.cpp | 20 +++++++------------- indra/newview/llviewerparceloverlay.cpp | 2 +- indra/newview/llvoavatar.cpp | 2 +- indra/newview/pipeline.cpp | 21 ++++++++++----------- 15 files changed, 72 insertions(+), 62 deletions(-) (limited to 'indra/newview/llspatialpartition.cpp') diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index f5f70c2935..7b8eb7809e 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -1261,6 +1261,13 @@ bool LLGLManager::initGL() glGetIntegerv(GL_MAX_VARYING_VECTORS, &mMaxVaryingVectors); glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, &mMaxUniformBlockSize); + // If outside the allowed range, glLineWidth fails with "invalid value". + // On Darwin, the range is [1, 1]. + GLfloat line_width_range[2]{0.f}; + glGetFloatv(GL_SMOOTH_LINE_WIDTH_RANGE, line_width_range); + mMinSmoothLineWidth = line_width_range[0]; + mMaxSmoothLineWidth = line_width_range[1]; + // sanity clamp max uniform block size to 64k just in case // there's some implementation that reports a crazy value mMaxUniformBlockSize = llmin(mMaxUniformBlockSize, 65536); diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h index e2e6e92e59..b7cd3df3c8 100644 --- a/indra/llrender/llgl.h +++ b/indra/llrender/llgl.h @@ -90,6 +90,8 @@ public: F32 mMaxAnisotropy = 0.f; S32 mMaxUniformBlockSize = 0; S32 mMaxVaryingVectors = 0; + F32 mMinSmoothLineWidth = 1.f; + F32 mMaxSmoothLineWidth = 1.f; // GL 4.x capabilities bool mHasCubeMapArray = false; diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 3f1dc3d3c1..970a9f6975 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -1923,6 +1923,24 @@ void LLRender::diffuseColor4ub(U8 r, U8 g, U8 b, U8 a) } } +void LLRender::setLineWidth(F32 width) +{ + gGL.flush(); + + if(sGLCoreProfile) + { + width = 1.f; + } + else + { + width = llclamp(width, gGLManager.mMinSmoothLineWidth, gGLManager.mMaxSmoothLineWidth); + } + if(mLineWidth != width) + { + mLineWidth = width; + glLineWidth(width); + } +} void LLRender::debugTexUnits(void) { diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index 8da0bde578..bc1fb3ce40 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -467,6 +467,8 @@ public: LLLightState* getLight(U32 index); void setAmbientLightColor(const LLColor4& color); + void setLineWidth(F32 width); + LLTexUnit* getTexUnit(U32 index); U32 getCurrentTexUnitIndex(void) const { return mCurrTextureUnitIndex; } @@ -512,7 +514,8 @@ private: U32 mCount; U32 mMode; U32 mCurrTextureUnitIndex; - bool mCurrColorMask[4]; + bool mCurrColorMask[4]; + F32 mLineWidth = 1.f; LLPointer mBuffer; LLStrider mVerticesp; diff --git a/indra/llrender/llrender2dutils.cpp b/indra/llrender/llrender2dutils.cpp index 5b08c29d64..e9d2212a67 100644 --- a/indra/llrender/llrender2dutils.cpp +++ b/indra/llrender/llrender2dutils.cpp @@ -833,8 +833,7 @@ void gl_line_3d( const LLVector3& start, const LLVector3& end, const LLColor4& c { gGL.color4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], color.mV[VALPHA]); - gGL.flush(); - glLineWidth(2.5f); + gGL.setLineWidth(2.5f); gGL.begin(LLRender::LINES); { @@ -843,7 +842,7 @@ void gl_line_3d( const LLVector3& start, const LLVector3& end, const LLColor4& c } gGL.end(); - LLRender2D::setLineWidth(1.f); + gGL.setLineWidth(1.f); } void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, bool filled, F32 start_angle, F32 end_angle) @@ -1798,16 +1797,8 @@ void LLRender2D::loadIdentity() // static void LLRender2D::setLineWidth(F32 width) { - gGL.flush(); - // If outside the allowed range, glLineWidth fails with "invalid value". - // On Darwin, the range is [1, 1]. - static GLfloat range[2]{0.0}; - if (range[1] == 0) - { - glGetFloatv(GL_SMOOTH_LINE_WIDTH_RANGE, range); - } width *= lerp(LLRender::sUIGLScaleFactor.mV[VX], LLRender::sUIGLScaleFactor.mV[VY], 0.5f); - glLineWidth(llclamp(width, range[0], range[1])); + gGL.setLineWidth(width); } LLPointer LLRender2D::getUIImageByID(const LLUUID& image_id, S32 priority) diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index f08ef8d24a..6f825c6a81 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -646,7 +646,7 @@ void LLFace::renderOneWireframe(const LLColor4 &color, F32 fogCfx, bool wirefram LLGLEnable offset(GL_POLYGON_OFFSET_LINE); glPolygonOffset(3.f, 3.f); - glLineWidth(5.f); + gGL.setLineWidth(5.f); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); renderFace(mDrawablep, this); } diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index 8056983c7c..cce6eeb19d 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -1057,8 +1057,7 @@ void LLFastTimerView::drawLineGraph() //fatten highlighted timer if (mHoverID == idp) { - gGL.flush(); - glLineWidth(3); + gGL.setLineWidth(3); } llassert(idp->getIndex() < sTimerColors.size()); @@ -1118,8 +1117,7 @@ void LLFastTimerView::drawLineGraph() if (mHoverID == idp) { - gGL.flush(); - glLineWidth(1); + gGL.setLineWidth(1.f); } if (idp->getTreeNode().mCollapsed) diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index 112008172e..cb1068943e 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -728,8 +728,7 @@ void LLViewerObjectList::renderObjectBeacons() S32 line_width = debug_beacon.mLineWidth; if (line_width != last_line_width) { - gGL.flush(); - glLineWidth( (F32)line_width ); + gGL.setLineWidth( (F32)line_width ); last_line_width = line_width; } @@ -758,8 +757,7 @@ void LLViewerObjectList::renderObjectBeacons() S32 line_width = debug_beacon.mLineWidth; if (line_width != last_line_width) { - gGL.flush(); - glLineWidth( (F32)line_width ); + gGL.setLineWidth( (F32)line_width ); last_line_width = line_width; } @@ -773,7 +771,7 @@ void LLViewerObjectList::renderObjectBeacons() } gGL.flush(); - glLineWidth(1.f); + gGL.setLineWidth(1.f); for (std::vector::iterator iter = mDebugBeacons.begin(); iter != mDebugBeacons.end(); ++iter) { @@ -808,7 +806,7 @@ void LLSky::renderSunMoonBeacons(const LLVector3& pos_agent, const LLVector3& di { pos_end.mV[i] = pos_agent.mV[i] + (50 * direction.mV[i]); } - glLineWidth((GLfloat)LLPipeline::DebugBeaconLineWidth); + gGL.setLineWidth((GLfloat)LLPipeline::DebugBeaconLineWidth); gGL.begin(LLRender::LINES); color.mV[3] *= 0.5f; gGL.color4fv(color.mV); @@ -819,7 +817,7 @@ void LLSky::renderSunMoonBeacons(const LLVector3& pos_agent, const LLVector3& di gGL.end(); gGL.flush(); - glLineWidth(1.f); + gGL.setLineWidth(1.f); } diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index 91a7daad1d..ed5ab35439 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -3597,11 +3597,11 @@ bool LLModelPreview::render() gGL.diffuseColor4fv(PREVIEW_EDGE_COL.mV); if (show_edges) { - glLineWidth(PREVIEW_EDGE_WIDTH); + gGL.setLineWidth(PREVIEW_EDGE_WIDTH); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts() - 1, buffer->getNumIndices(), 0); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - glLineWidth(1.f); + gGL.setLineWidth(1.f); } buffer->unmapBuffer(); } @@ -3724,12 +3724,12 @@ bool LLModelPreview::render() buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts() - 1, buffer->getNumIndices(), 0); gGL.diffuseColor4fv(PREVIEW_PSYH_EDGE_COL.mV); - glLineWidth(PREVIEW_PSYH_EDGE_WIDTH); + gGL.setLineWidth(PREVIEW_PSYH_EDGE_WIDTH); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts() - 1, buffer->getNumIndices(), 0); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - glLineWidth(1.f); + gGL.setLineWidth(1.f); buffer->unmapBuffer(); } @@ -3741,7 +3741,7 @@ bool LLModelPreview::render() // only do this if mDegenerate was set in the preceding mesh checks [Check this if the ordering ever breaks] if (mHasDegenerate) { - glLineWidth(PREVIEW_DEG_EDGE_WIDTH); + gGL.setLineWidth(PREVIEW_DEG_EDGE_WIDTH); glPointSize(PREVIEW_DEG_POINT_SIZE); gPipeline.enableLightsFullbright(); //show degenerate triangles @@ -3811,7 +3811,7 @@ bool LLModelPreview::render() gGL.popMatrix(); } - glLineWidth(1.f); + gGL.setLineWidth(1.f); glPointSize(1.f); gPipeline.enableLightsPreview(); gGL.setSceneBlendType(LLRender::BT_ALPHA); @@ -3933,11 +3933,11 @@ bool LLModelPreview::render() { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.diffuseColor4fv(PREVIEW_EDGE_COL.mV); - glLineWidth(PREVIEW_EDGE_WIDTH); + gGL.setLineWidth(PREVIEW_EDGE_WIDTH); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); buffer->draw(LLRender::TRIANGLES, buffer->getNumIndices(), 0); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - glLineWidth(1.f); + gGL.setLineWidth(1.f); } } } diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 4762fc555d..a624682e11 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -6614,7 +6614,7 @@ void LLSelectMgr::renderSilhouettes(bool for_hud) gGL.popMatrix(); gGL.popMatrix(); - glLineWidth(1.f); + gGL.setLineWidth(1.f); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); if (shader) diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp index 9b6a87e68d..58a443ab23 100644 --- a/indra/newview/llsnapshotlivepreview.cpp +++ b/indra/newview/llsnapshotlivepreview.cpp @@ -238,11 +238,11 @@ void LLSnapshotLivePreview::drawPreviewRect(S32 offset_x, S32 offset_y, LLColor4 { F32 line_width ; glGetFloatv(GL_LINE_WIDTH, &line_width) ; - glLineWidth(2.0f * line_width) ; + gGL.setLineWidth(2.0f * line_width) ; LLColor4 color(0.0f, 0.0f, 0.0f, 1.0f) ; gl_rect_2d( mPreviewRect.mLeft + offset_x, mPreviewRect.mTop + offset_y, mPreviewRect.mRight + offset_x, mPreviewRect.mBottom + offset_y, color, false ) ; - glLineWidth(line_width) ; + gGL.setLineWidth(line_width) ; //draw four alpha rectangles to cover areas outside of the snapshot image if(!mKeepAspectRatio) diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index bc57b71022..2dc2810861 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -1658,13 +1658,11 @@ void renderOctree(LLSpatialGroup* group) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); gGL.diffuseColor4f(1,0,0,group->mBuilt); - gGL.flush(); - glLineWidth(5.f); + gGL.setLineWidth(5.f); const LLVector4a* bounds = group->getObjectBounds(); drawBoxOutline(bounds[0], bounds[1]); - gGL.flush(); - glLineWidth(1.f); + gGL.setLineWidth(1.f); gGL.flush(); const LLVOAvatar* lastAvatar = nullptr; @@ -1973,13 +1971,11 @@ void renderBoundingBox(LLDrawable* drawable, bool set_color = true) LLViewerObject* vobj = drawable->getVObj(); if (vobj && vobj->onActiveList()) { - gGL.flush(); - glLineWidth(llmax(4.f*sinf(gFrameTimeSeconds*2.f)+1.f, 1.f)); - //glLineWidth(4.f*(sinf(gFrameTimeSeconds*2.f)*0.25f+0.75f)); + gGL.setLineWidth(llmax(4.f*sinf(gFrameTimeSeconds*2.f)+1.f, 1.f)); + //gGL.setLineWidth(4.f*(sinf(gFrameTimeSeconds*2.f)*0.25f+0.75f)); stop_glerror(); drawBoxOutline(pos,size); - gGL.flush(); - glLineWidth(1.f); + gGL.setLineWidth(1.f); } else { @@ -2887,8 +2883,7 @@ public: if (i == 1) { - gGL.flush(); - glLineWidth(3.f); + gGL.setLineWidth(3.f); } gGL.begin(LLRender::TRIANGLES); @@ -2906,8 +2901,7 @@ public: if (i == 1) { - gGL.flush(); - glLineWidth(1.f); + gGL.setLineWidth(1.f); } } } diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp index e36ad0e722..cf92850762 100755 --- a/indra/newview/llviewerparceloverlay.cpp +++ b/indra/newview/llviewerparceloverlay.cpp @@ -809,7 +809,7 @@ void LLViewerParcelOverlay::renderPropertyLinesOnMinimap(F32 scale_pixels_per_me const S32 GRIDS_PER_EDGE = mParcelGridsPerEdge; gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - glLineWidth(1.0f); + gGL.setLineWidth(1.0f); gGL.color4fv(parcel_outline_color); for (S32 i = 0; i <= GRIDS_PER_EDGE; i++) { diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 25b7c58733..c9d6dfa1af 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5438,7 +5438,7 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color, S32 diffuse_channel) gGL.begin(LLRender::LINES); gGL.color4f(1.f,1.f,1.f,1.f); F32 thickness = llmax(F32(5.0f-5.0f*(gFrameTimeSeconds-mLastImpostorUpdateFrameTime)),1.0f); - glLineWidth(thickness); + gGL.setLineWidth(thickness); gGL.vertex3fv((pos+left-up).mV); gGL.vertex3fv((pos-left-up).mV); gGL.vertex3fv((pos-left-up).mV); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index e74da42180..be7c57015c 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -4342,7 +4342,7 @@ void LLPipeline::renderPhysicsDisplay() LLGLEnable polygon_offset_line(GL_POLYGON_OFFSET_LINE); glPolygonOffset(3.f, 3.f); - glLineWidth(3.f); + gGL.setLineWidth(3.f); LLGLEnable blend(GL_BLEND); gGL.setSceneBlendType(LLRender::BT_ALPHA); @@ -4384,7 +4384,7 @@ void LLPipeline::renderPhysicsDisplay() glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); } } - glLineWidth(1.f); + gGL.setLineWidth(1.f); gDebugProgram.unbind(); } @@ -4468,8 +4468,7 @@ void LLPipeline::renderDebug() //NavMesh if ( pathfindingConsole->isRenderNavMesh() ) { - gGL.flush(); - glLineWidth(2.0f); + gGL.setLineWidth(2.0f); LLGLEnable cull(GL_CULL_FACE); LLGLDisable blend(GL_BLEND); @@ -4493,7 +4492,7 @@ void LLPipeline::renderDebug() gGL.flush(); glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); - glLineWidth(1.0f); + gGL.setLineWidth(1.0f); gGL.flush(); } //User designated path @@ -4608,11 +4607,11 @@ void LLPipeline::renderDebug() gPathfindingProgram.uniform1f(sTint, 1.f); gPathfindingProgram.uniform1f(sAlphaScale, 1.f); - glLineWidth(gSavedSettings.getF32("PathfindingLineWidth")); + gGL.setLineWidth(gSavedSettings.getF32("PathfindingLineWidth")); LLGLDisable blendOut(GL_BLEND); llPathingLibInstance->renderNavMeshShapesVBO( render_order[i] ); gGL.flush(); - glLineWidth(1.f); + gGL.setLineWidth(1.f); } glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); @@ -4635,7 +4634,7 @@ void LLPipeline::renderDebug() LLGLEnable blend(GL_BLEND); LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_GREATER); gGL.flush(); - glLineWidth(2.0f); + gGL.setLineWidth(2.0f); LLGLEnable cull(GL_CULL_FACE); gPathfindingProgram.uniform1f(sTint, gSavedSettings.getF32("PathfindingXRayTint")); @@ -4662,7 +4661,7 @@ void LLPipeline::renderDebug() gPathfindingProgram.bind(); gGL.flush(); - glLineWidth(1.0f); + gGL.setLineWidth(1.0f); } glPolygonOffset(0.f, 0.f); @@ -4955,7 +4954,7 @@ void LLPipeline::renderDebug() } /*gGL.flush(); - glLineWidth(16-i*2); + gGL.setLineWidth(16-i*2); for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); iter != LLWorld::getInstance()->getRegionList().end(); ++iter) { @@ -4973,7 +4972,7 @@ void LLPipeline::renderDebug() } } gGL.flush(); - glLineWidth(1.f);*/ + gGL.setLineWidth(1.f);*/ } } -- cgit v1.3