From 5b9cb5bba3c12b1b5c86ba56d43ccf06b83edc14 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Tue, 22 Aug 2023 20:50:31 +0800 Subject: Can link to libglvnd, no need to set LEGACY pref --- indra/llrender/llrender.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/llrender/llrender.cpp') diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 72cca1f2a2..ba776f3b2f 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -122,7 +122,7 @@ void LLTexUnit::refreshState(void) gGL.flush(); - glActiveTextureARB(GL_TEXTURE0_ARB + mIndex); + glActiveTexture(GL_TEXTURE0_ARB + mIndex); if (mCurrTexType != TT_NONE) { @@ -143,7 +143,7 @@ void LLTexUnit::activate(void) if ((S32)gGL.mCurrTextureUnitIndex != mIndex || gGL.mDirty) { gGL.flush(); - glActiveTextureARB(GL_TEXTURE0_ARB + mIndex); + glActiveTexture(GL_TEXTURE0_ARB + mIndex); gGL.mCurrTextureUnitIndex = mIndex; } } @@ -187,7 +187,7 @@ void LLTexUnit::bindFast(LLTexture* texture) { LLImageGL* gl_tex = texture->getGLTexture(); - glActiveTextureARB(GL_TEXTURE0_ARB + mIndex); + glActiveTexture(GL_TEXTURE0_ARB + mIndex); gGL.mCurrTextureUnitIndex = mIndex; mCurrTexture = gl_tex->getTexName(); if (!mCurrTexture) -- cgit v1.2.3 From ed44bcf9f763a7d1f7549eb1f03d8aa7fb933ef7 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Tue, 5 Sep 2023 23:14:03 +0800 Subject: Preprocess non portable GL funcs & macros so that implementations that don't include a certain GL implementation won't fail trying to compile the code. --- indra/llrender/llrender.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'indra/llrender/llrender.cpp') diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index ba776f3b2f..84ef895ee4 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -69,9 +69,13 @@ static const U32 LL_NUM_LIGHT_UNITS = 8; static const GLenum sGLTextureType[] = { GL_TEXTURE_2D, +#if GL_VERSION_3_1 GL_TEXTURE_RECTANGLE_ARB, +#endif GL_TEXTURE_CUBE_MAP_ARB, +#if GL_VERSION_3_2 GL_TEXTURE_2D_MULTISAMPLE, +#endif GL_TEXTURE_3D }; @@ -537,6 +541,7 @@ void LLTexUnit::setTextureFilteringOption(LLTexUnit::eTextureFilterOptions optio GLint LLTexUnit::getTextureSource(eTextureBlendSrc src) { +#if GL_VERSION_1_3 switch(src) { // All four cases should return the same value. @@ -551,8 +556,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: @@ -571,6 +578,7 @@ GLint LLTexUnit::getTextureSource(eTextureBlendSrc src) LL_WARNS() << "Unknown eTextureBlendSrc: " << src << ". Using Vertex Color instead." << LL_ENDL; return GL_PRIMARY_COLOR_ARB; } +#endif } GLint LLTexUnit::getTextureSourceType(eTextureBlendSrc src, bool isAlpha) @@ -617,7 +625,9 @@ void LLTexUnit::setColorScale(S32 scale) { mCurrColorScale = scale; gGL.flush(); +#if GL_VERSION_1_1 glTexEnvi( GL_TEXTURE_ENV, GL_RGB_SCALE, scale ); +#endif } } @@ -627,7 +637,9 @@ void LLTexUnit::setAlphaScale(S32 scale) { mCurrAlphaScale = scale; gGL.flush(); +#if GL_VERSION_1_1 glTexEnvi( GL_TEXTURE_ENV, GL_ALPHA_SCALE, scale ); +#endif } } @@ -1995,10 +2007,12 @@ void LLRender::diffuseColor3f(F32 r, F32 g, F32 b) { shader->uniform4f(LLShaderMgr::DIFFUSE_COLOR, r,g,b,1.f); } +#if GL_VERSION_1_1 else { glColor3f(r,g,b); } +#endif } void LLRender::diffuseColor3fv(const F32* c) @@ -2010,10 +2024,12 @@ void LLRender::diffuseColor3fv(const F32* c) { shader->uniform4f(LLShaderMgr::DIFFUSE_COLOR, c[0], c[1], c[2], 1.f); } +#if GL_VERSION_1_1 else { glColor3fv(c); } +#endif } void LLRender::diffuseColor4f(F32 r, F32 g, F32 b, F32 a) @@ -2025,10 +2041,12 @@ void LLRender::diffuseColor4f(F32 r, F32 g, F32 b, F32 a) { shader->uniform4f(LLShaderMgr::DIFFUSE_COLOR, r,g,b,a); } +#if GL_VERSION_1_1 else { glColor4f(r,g,b,a); } +#endif } void LLRender::diffuseColor4fv(const F32* c) @@ -2040,10 +2058,12 @@ void LLRender::diffuseColor4fv(const F32* c) { shader->uniform4fv(LLShaderMgr::DIFFUSE_COLOR, 1, c); } +#if GL_VERSION_1_1 else { glColor4fv(c); } +#endif } void LLRender::diffuseColor4ubv(const U8* c) @@ -2055,10 +2075,12 @@ void LLRender::diffuseColor4ubv(const U8* c) { shader->uniform4f(LLShaderMgr::DIFFUSE_COLOR, c[0]/255.f, c[1]/255.f, c[2]/255.f, c[3]/255.f); } +#if GL_VERSION_1_1 else { glColor4ubv(c); } +#endif } void LLRender::diffuseColor4ub(U8 r, U8 g, U8 b, U8 a) @@ -2070,10 +2092,12 @@ void LLRender::diffuseColor4ub(U8 r, U8 g, U8 b, U8 a) { shader->uniform4f(LLShaderMgr::DIFFUSE_COLOR, r/255.f, g/255.f, b/255.f, a/255.f); } +#if GL_VERSION_1_1 else { glColor4ub(r,g,b,a); } +#endif } -- cgit v1.2.3 From 6b3198347f0b48738d3ebaab2c415f1d12cd525f Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Wed, 6 Sep 2023 10:51:41 +0800 Subject: Lose the _ARB suffix from many macros so the macros can be used on platforms that don't have ARB specs. --- indra/llrender/llrender.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'indra/llrender/llrender.cpp') diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 84ef895ee4..7c6b091ac5 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -72,7 +72,7 @@ static const GLenum sGLTextureType[] = #if GL_VERSION_3_1 GL_TEXTURE_RECTANGLE_ARB, #endif - GL_TEXTURE_CUBE_MAP_ARB, + GL_TEXTURE_CUBE_MAP, #if GL_VERSION_3_2 GL_TEXTURE_2D_MULTISAMPLE, #endif @@ -126,7 +126,7 @@ void LLTexUnit::refreshState(void) gGL.flush(); - glActiveTexture(GL_TEXTURE0_ARB + mIndex); + glActiveTexture(GL_TEXTURE0 + mIndex); if (mCurrTexType != TT_NONE) { @@ -147,7 +147,7 @@ void LLTexUnit::activate(void) if ((S32)gGL.mCurrTextureUnitIndex != mIndex || gGL.mDirty) { gGL.flush(); - glActiveTexture(GL_TEXTURE0_ARB + mIndex); + glActiveTexture(GL_TEXTURE0 + mIndex); gGL.mCurrTextureUnitIndex = mIndex; } } @@ -191,7 +191,7 @@ void LLTexUnit::bindFast(LLTexture* texture) { LLImageGL* gl_tex = texture->getGLTexture(); - glActiveTexture(GL_TEXTURE0_ARB + mIndex); + glActiveTexture(GL_TEXTURE0 + mIndex); gGL.mCurrTextureUnitIndex = mIndex; mCurrTexture = gl_tex->getTexName(); if (!mCurrTexture) @@ -343,7 +343,7 @@ bool LLTexUnit::bind(LLCubeMap* cubeMap) activate(); enable(LLTexUnit::TT_CUBE_MAP); mCurrTexture = cubeMap->mImages[0]->getTexName(); - glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, mCurrTexture); + glBindTexture(GL_TEXTURE_CUBE_MAP, mCurrTexture); mHasMipMaps = cubeMap->mImages[0]->mHasMipMaps; cubeMap->mImages[0]->updateBindStats(cubeMap->mImages[0]->mTextureMemory); if (cubeMap->mImages[0]->mTexOptionsDirty) @@ -473,7 +473,7 @@ void LLTexUnit::setTextureAddressMode(eTextureAddressMode mode) glTexParameteri (sGLTextureType[mCurrTexType], GL_TEXTURE_WRAP_T, sGLAddressMode[mode]); if (mCurrTexType == TT_CUBE_MAP) { - glTexParameteri (GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_R, sGLAddressMode[mode]); + glTexParameteri (GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, sGLAddressMode[mode]); } } @@ -650,10 +650,10 @@ void LLTexUnit::debugTextureUnit(void) if (mIndex < 0) return; GLint activeTexture; - glGetIntegerv(GL_ACTIVE_TEXTURE_ARB, &activeTexture); - if ((GL_TEXTURE0_ARB + mIndex) != activeTexture) + glGetIntegerv(GL_ACTIVE_TEXTURE, &activeTexture); + if ((GL_TEXTURE0 + mIndex) != activeTexture) { - U32 set_unit = (activeTexture - GL_TEXTURE0_ARB); + U32 set_unit = (activeTexture - GL_TEXTURE0); LL_WARNS() << "Incorrect Texture Unit! Expected: " << set_unit << " Actual: " << mIndex << LL_ENDL; } } -- cgit v1.2.3 From 4daff432fcc2272b8d32bd78d3ae47780cc3edca Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Wed, 6 Sep 2023 11:07:31 +0800 Subject: Core profile glBlendFuncSeparate replacing its EXT suffixed counterpart. --- indra/llrender/llrender.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llrender/llrender.cpp') diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 7c6b091ac5..eb1c7dcee9 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -1505,7 +1505,7 @@ void LLRender::blendFunc(eBlendFactor color_sfactor, eBlendFactor color_dfactor, mCurrBlendColorDFactor = color_dfactor; mCurrBlendAlphaDFactor = alpha_dfactor; flush(); - glBlendFuncSeparateEXT(sGLBlendFactor[color_sfactor], sGLBlendFactor[color_dfactor], + glBlendFuncSeparate(sGLBlendFactor[color_sfactor], sGLBlendFactor[color_dfactor], sGLBlendFactor[alpha_sfactor], sGLBlendFactor[alpha_dfactor]); } } -- cgit v1.2.3 From 623456626ffbb08dff208cf35dd3ac5df6755a37 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Wed, 6 Sep 2023 11:12:42 +0800 Subject: Always compile vertex array code So that, especially modern, GL implementations that do have vertex array but don't have the legacy GL_ARB_vertex_array_object defined have such code compiled too. --- indra/llrender/llrender.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llrender/llrender.cpp') diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index eb1c7dcee9..f34161980a 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -902,11 +902,11 @@ void LLRender::init(bool needs_vertex_buffer) if (sGLCoreProfile && !LLVertexBuffer::sUseVAO) { //bind a dummy vertex array object so we're core profile compliant -#ifdef GL_ARB_vertex_array_object +//#ifdef GL_ARB_vertex_array_object U32 ret; glGenVertexArrays(1, &ret); glBindVertexArray(ret); -#endif +//#endif } if (needs_vertex_buffer) -- cgit v1.2.3 From ddeca119875c89e42c41b55c77f317b7f6953a5a Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Wed, 6 Sep 2023 11:55:32 +0800 Subject: Preprocess anisotropy related code --- indra/llrender/llrender.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llrender/llrender.cpp') diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index f34161980a..89de6b93ea 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -519,6 +519,7 @@ void LLTexUnit::setTextureFilteringOption(LLTexUnit::eTextureFilterOptions optio } } +#if GL_EXT_texture_filter_anisotropic if (gGLManager.mHasAnisotropic) { if (LLImageGL::sGlobalUseAnisotropic && option == TFO_ANISOTROPIC) @@ -537,6 +538,7 @@ void LLTexUnit::setTextureFilteringOption(LLTexUnit::eTextureFilterOptions optio glTexParameterf(sGLTextureType[mCurrTexType], GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.f); } } +#endif } GLint LLTexUnit::getTextureSource(eTextureBlendSrc src) -- cgit v1.2.3 From e600f6504cd7edd9d2883ea7dc17c2574b1ff468 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Thu, 7 Sep 2023 19:46:10 +0800 Subject: Bring back GL funcs & macros that work on macOS --- indra/llrender/llrender.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'indra/llrender/llrender.cpp') diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 89de6b93ea..91ce983e5a 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -906,9 +906,13 @@ void LLRender::init(bool needs_vertex_buffer) { //bind a dummy vertex array object so we're core profile compliant //#ifdef GL_ARB_vertex_array_object U32 ret; +#if GL_APPLE_vertex_array_object + glGenVertexArraysAPPLE(1, &ret); + glBindVertexArrayAPPLE(ret); +#else glGenVertexArrays(1, &ret); glBindVertexArray(ret); -//#endif +#endif } if (needs_vertex_buffer) -- cgit v1.2.3 From d0b773094d5a3129f5b6db7d9de0da41791b2852 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Thu, 7 Sep 2023 21:12:38 +0800 Subject: Revert "Bring back GL funcs & macros that work on macOS" This reverts commit e600f6504cd7edd9d2883ea7dc17c2574b1ff468. --- indra/llrender/llrender.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'indra/llrender/llrender.cpp') diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 91ce983e5a..89de6b93ea 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -906,13 +906,9 @@ void LLRender::init(bool needs_vertex_buffer) { //bind a dummy vertex array object so we're core profile compliant //#ifdef GL_ARB_vertex_array_object U32 ret; -#if GL_APPLE_vertex_array_object - glGenVertexArraysAPPLE(1, &ret); - glBindVertexArrayAPPLE(ret); -#else glGenVertexArrays(1, &ret); glBindVertexArray(ret); -#endif +//#endif } if (needs_vertex_buffer) -- cgit v1.2.3