From 6ec16974e5dcf5f9142ac4d54c4b7fb7f6366e3d Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Wed, 12 Jul 2023 15:53:45 +0800 Subject: Include FreeBSD macro variable for GL related code --- indra/llrender/llgl.cpp | 14 +++++++------- indra/llrender/llglheaders.h | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 193cfa64b8..a10bbbf726 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -156,7 +156,7 @@ LLMatrix4 gGLObliqueProjectionInverse; std::list LLGLUpdate::sGLQ; -#if (LL_WINDOWS || LL_LINUX) && !LL_MESA_HEADLESS +#if (LL_WINDOWS || LL_LINUX || LL_FREEBSD) && !LL_MESA_HEADLESS #if LL_WINDOWS PFNGLGETSTRINGIPROC glGetStringi = NULL; @@ -317,7 +317,7 @@ PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = NULL; #endif // vertex shader prototypes -#if LL_LINUX +#if LL_LINUX || LL_FREEBSD PFNGLVERTEXATTRIB1DARBPROC glVertexAttrib1dARB = NULL; PFNGLVERTEXATTRIB1DVARBPROC glVertexAttrib1dvARB = NULL; PFNGLVERTEXATTRIB1FARBPROC glVertexAttrib1fARB = NULL; @@ -344,7 +344,7 @@ PFNGLVERTEXATTRIB4NUBARBPROC glVertexAttrib4nubARB = NULL; PFNGLVERTEXATTRIB4NUBVARBPROC glVertexAttrib4nubvARB = NULL; PFNGLVERTEXATTRIB4NUIVARBPROC glVertexAttrib4nuivARB = NULL; PFNGLVERTEXATTRIB4NUSVARBPROC glVertexAttrib4nusvARB = NULL; -#if LL_LINUX +#if LL_LINUX || LL_FREEBSD PFNGLVERTEXATTRIB4BVARBPROC glVertexAttrib4bvARB = NULL; PFNGLVERTEXATTRIB4DARBPROC glVertexAttrib4dARB = NULL; PFNGLVERTEXATTRIB4DVARBPROC glVertexAttrib4dvARB = NULL; @@ -616,7 +616,7 @@ bool LLGLManager::initGL() mIsNVIDIA = TRUE; } else if (mGLVendor.find("INTEL") != std::string::npos -#if LL_LINUX +#if LL_LINUX || LL_FREEBSD // The Mesa-based drivers put this in the Renderer string, // not the Vendor string. || mGLRenderer.find("INTEL") != std::string::npos @@ -1060,7 +1060,7 @@ void LLGLManager::initExtensions() #endif #endif -#if LL_LINUX +#if LL_LINUX || LL_FREEBSD LL_INFOS() << "initExtensions() checking shell variables to adjust features..." << LL_ENDL; // Our extension support for the Linux Client is very young with some // potential driver gotchas, so offer a semi-secret way to turn it off. @@ -1180,7 +1180,7 @@ void LLGLManager::initExtensions() glGetIntegerv(GL_MAX_ELEMENTS_INDICES, (GLint*) &mGLMaxIndexRange); glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint*) &mGLMaxTextureSize); -#if (LL_WINDOWS || LL_LINUX) && !LL_MESA_HEADLESS +#if (LL_WINDOWS || LL_LINUX || LL_FREEBSD) && !LL_MESA_HEADLESS LL_DEBUGS("RenderInit") << "GL Probe: Getting symbols" << LL_ENDL; if (mHasVertexBufferObject) { @@ -1279,7 +1279,7 @@ void LLGLManager::initExtensions() glDebugMessageCallbackARB = (PFNGLDEBUGMESSAGECALLBACKARBPROC) GLH_EXT_GET_PROC_ADDRESS("glDebugMessageCallbackARB"); glGetDebugMessageLogARB = (PFNGLGETDEBUGMESSAGELOGARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetDebugMessageLogARB"); } -#if (!LL_LINUX) || LL_LINUX_NV_GL_HEADERS +#if (!LL_LINUX && !LL_FREEBSD) || LL_LINUX_NV_GL_HEADERS // This is expected to be a static symbol on Linux GL implementations, except if we use the nvidia headers - bah glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)GLH_EXT_GET_PROC_ADDRESS("glDrawRangeElements"); if (!glDrawRangeElements) diff --git a/indra/llrender/llglheaders.h b/indra/llrender/llglheaders.h index e1ecc6a6ca..3ad92ed20e 100644 --- a/indra/llrender/llglheaders.h +++ b/indra/llrender/llglheaders.h @@ -41,7 +41,7 @@ # include "GL/glh_extensions.h" # undef __APPLE__ -#elif LL_LINUX +#elif LL_LINUX || LL_FREEBSD //---------------------------------------------------------------------------- // LL_LINUX @@ -53,7 +53,7 @@ #include "GL/glu.h" -#if LL_LINUX && !LL_MESA_HEADLESS +#if (LL_LINUX || LL_FREEBSD) && !LL_MESA_HEADLESS // The __APPLE__ kludge is to make glh_extensions.h not symbol-clash horribly # define __APPLE__ # include "GL/glh_extensions.h" -- cgit v1.2.3 From 665a55a1a232877ccb499dbfd17806f438385e82 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Sat, 29 Jul 2023 21:07:13 +0800 Subject: The Linden libraries can be installed now Useful when installed as shared libraries, so other viewer executables can share these libraries. --- indra/llrender/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llrender') diff --git a/indra/llrender/CMakeLists.txt b/indra/llrender/CMakeLists.txt index c5cf1100d5..ea8947155e 100644 --- a/indra/llrender/CMakeLists.txt +++ b/indra/llrender/CMakeLists.txt @@ -102,3 +102,4 @@ target_link_libraries(llrender OpenGL::GLU ) +include(LibraryInstall) -- cgit v1.2.3 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/llgl.cpp | 2 +- indra/llrender/llimagegl.cpp | 6 +++--- indra/llrender/llrender.cpp | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index a10bbbf726..346973e3fd 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -1604,7 +1604,7 @@ void LLGLState::resetTextureStates() for (S32 j = maxTextureUnits-1; j >=0; j--) { gGL.getTexUnit(j)->activate(); - glClientActiveTextureARB(GL_TEXTURE0_ARB+j); + glClientActiveTexture(GL_TEXTURE0_ARB+j); j == 0 ? gGL.getTexUnit(j)->enable(LLTexUnit::TT_TEXTURE) : gGL.getTexUnit(j)->disable(); } } diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 465f30a343..8e83f2b401 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -741,7 +741,7 @@ BOOL LLImageGL::setImage(const U8* data_in, BOOL data_hasmips /* = FALSE */, S32 if (is_compressed) { S32 tex_size = dataFormatBytes(mFormatPrimary, w, h); - glCompressedTexImage2DARB(mTarget, gl_level, mFormatPrimary, w, h, 0, tex_size, (GLvoid *)data_in); + glCompressedTexImage2D(mTarget, gl_level, mFormatPrimary, w, h, 0, tex_size, (GLvoid *)data_in); stop_glerror(); } else @@ -943,7 +943,7 @@ BOOL LLImageGL::setImage(const U8* data_in, BOOL data_hasmips /* = FALSE */, S32 if (is_compressed) { S32 tex_size = dataFormatBytes(mFormatPrimary, w, h); - glCompressedTexImage2DARB(mTarget, 0, mFormatPrimary, w, h, 0, tex_size, (GLvoid *)data_in); + glCompressedTexImage2D(mTarget, 0, mFormatPrimary, w, h, 0, tex_size, (GLvoid *)data_in); stop_glerror(); } else @@ -1837,7 +1837,7 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre return FALSE ; } - glGetCompressedTexImageARB(mTarget, gl_discard, (GLvoid*)(imageraw->getData())); + glGetCompressedTexImage(mTarget, gl_discard, (GLvoid*)(imageraw->getData())); //stop_glerror(); } else 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 f19cb40115e3e35483d387c7e1c1bf3d119a33e5 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Tue, 5 Sep 2023 20:38:18 +0800 Subject: Comment out redefinitions of GL functions which are mostly ARB ones, and instead we define GLEXT prototypes to be true so we still get access to the functions. --- indra/llrender/llgl.cpp | 3 +++ indra/llrender/llglheaders.h | 4 ++++ 2 files changed, 7 insertions(+) (limited to 'indra/llrender') diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index e96a226115..68842c9692 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -162,6 +162,8 @@ std::list LLGLUpdate::sGLQ; PFNGLGETSTRINGIPROC glGetStringi = NULL; #endif +/* + // vertex blending prototypes PFNGLWEIGHTPOINTERARBPROC glWeightPointerARB = NULL; PFNGLVERTEXBLENDARBPROC glVertexBlendARB = NULL; @@ -399,6 +401,7 @@ PFNGLACTIVETEXTUREARBPROC glActiveTextureARB = NULL; PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARB = NULL; PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements = NULL; #endif // LL_LINUX_NV_GL_HEADERS +*/ #endif LLGLManager gGLManager; diff --git a/indra/llrender/llglheaders.h b/indra/llrender/llglheaders.h index 3ad92ed20e..1a8b2f1a64 100644 --- a/indra/llrender/llglheaders.h +++ b/indra/llrender/llglheaders.h @@ -48,6 +48,7 @@ //---------------------------------------------------------------------------- // Linux, MESA headers, but not necessarily assuming MESA runtime. // quotes so we get libraries/.../GL/ version +#define GL_GLEXT_PROTOTYPES 1 #include "GL/gl.h" #include "GL/glext.h" #include "GL/glu.h" @@ -83,6 +84,8 @@ extern PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARB; extern PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements; #endif // LL_LINUX_NV_GL_HEADERS +/* + // GL_ARB_vertex_array_object extern PFNGLBINDVERTEXARRAYPROC glBindVertexArray; extern PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArrays; @@ -307,6 +310,7 @@ extern PFNGLTRANSFORMFEEDBACKVARYINGSPROC glTransformFeedbackVaryings; extern PFNGLBINDBUFFERRANGEPROC glBindBufferRange; extern PFNGLBINDBUFFERBASEPROC glBindBufferBase; +*/ #elif LL_WINDOWS //---------------------------------------------------------------------------- -- cgit v1.2.3 From 6e9102ad408282ea6d5f8926f4a6ed377fe922ef Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Tue, 5 Sep 2023 21:18:29 +0800 Subject: Exclude FBSD from more GL function redefinitions at the same time revert to less difference from upstream. --- indra/llrender/llgl.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 68842c9692..6998d892e2 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -156,7 +156,7 @@ LLMatrix4 gGLObliqueProjectionInverse; std::list LLGLUpdate::sGLQ; -#if (LL_WINDOWS || LL_LINUX || LL_FREEBSD) && !LL_MESA_HEADLESS +#if (LL_WINDOWS || LL_LINUX) && !LL_MESA_HEADLESS #if LL_WINDOWS PFNGLGETSTRINGIPROC glGetStringi = NULL; @@ -319,7 +319,7 @@ PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = NULL; #endif // vertex shader prototypes -#if LL_LINUX || LL_FREEBSD +#if LL_LINUX PFNGLVERTEXATTRIB1DARBPROC glVertexAttrib1dARB = NULL; PFNGLVERTEXATTRIB1DVARBPROC glVertexAttrib1dvARB = NULL; PFNGLVERTEXATTRIB1FARBPROC glVertexAttrib1fARB = NULL; @@ -346,7 +346,7 @@ PFNGLVERTEXATTRIB4NUBARBPROC glVertexAttrib4nubARB = NULL; PFNGLVERTEXATTRIB4NUBVARBPROC glVertexAttrib4nubvARB = NULL; PFNGLVERTEXATTRIB4NUIVARBPROC glVertexAttrib4nuivARB = NULL; PFNGLVERTEXATTRIB4NUSVARBPROC glVertexAttrib4nusvARB = NULL; -#if LL_LINUX || LL_FREEBSD +#if LL_LINUX PFNGLVERTEXATTRIB4BVARBPROC glVertexAttrib4bvARB = NULL; PFNGLVERTEXATTRIB4DARBPROC glVertexAttrib4dARB = NULL; PFNGLVERTEXATTRIB4DVARBPROC glVertexAttrib4dvARB = NULL; @@ -1183,7 +1183,7 @@ void LLGLManager::initExtensions() glGetIntegerv(GL_MAX_ELEMENTS_INDICES, (GLint*) &mGLMaxIndexRange); glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint*) &mGLMaxTextureSize); -#if (LL_WINDOWS || LL_LINUX || LL_FREEBSD) && !LL_MESA_HEADLESS +#if (LL_WINDOWS || LL_LINUX) && !LL_MESA_HEADLESS LL_DEBUGS("RenderInit") << "GL Probe: Getting symbols" << LL_ENDL; if (mHasVertexBufferObject) { -- 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/llgl.cpp | 19 +++++++- indra/llrender/llgldbg.cpp | 4 ++ indra/llrender/llglslshader.cpp | 6 +++ indra/llrender/llglstates.h | 89 ++++++++++++++++++++++++++++++++------ indra/llrender/llimagegl.cpp | 79 ++++++++++++++++++++++++++++++++- indra/llrender/llpostprocess.cpp | 12 +++++ indra/llrender/llrender.cpp | 24 ++++++++++ indra/llrender/llrender2dutils.cpp | 2 + indra/llrender/llrendertarget.cpp | 2 + 9 files changed, 219 insertions(+), 18 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 6998d892e2..729e8a5f28 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -595,6 +595,7 @@ bool LLGLManager::initGL() #endif } +#if GL_VERSION_1_3 if (mGLVersion >= 2.1f && LLImageGL::sCompressTextures) { //use texture compression glHint(GL_TEXTURE_COMPRESSION_HINT, GL_NICEST); @@ -603,6 +604,7 @@ bool LLGLManager::initGL() { //GL version is < 3.0, always disable texture compression LLImageGL::sCompressTextures = false; } +#endif // Trailing space necessary to keep "nVidia Corpor_ati_on" cards // from being recognized as ATI. @@ -727,6 +729,7 @@ bool LLGLManager::initGL() { mNumTextureUnits = llmin(mNumTextureImageUnits, MAX_GL_TEXTURE_UNITS); } +#if GL_VERSION_1_3 else { GLint num_tex_units; @@ -737,6 +740,7 @@ bool LLGLManager::initGL() mNumTextureUnits = llmin(mNumTextureUnits, 2); } } +#endif } else { @@ -1474,12 +1478,14 @@ void log_glerror() error = glGetError(); while (LL_UNLIKELY(error)) { +#if GLU_VERSION_1_1 GLubyte const * gl_error_msg = gluErrorString(error); if (NULL != gl_error_msg) { LL_WARNS() << "GL Error: " << error << " GL Error String: " << gl_error_msg << LL_ENDL ; } else +#endif // GLU_VERSION_1_1 { // gluErrorString returns NULL for some extensions' error codes. // you'll probably have to grep for the number in glext.h. @@ -1498,6 +1504,7 @@ void do_assert_glerror() while (LL_UNLIKELY(error)) { quit = TRUE; +#if GLU_VERSION_1_1 GLubyte const * gl_error_msg = gluErrorString(error); if (NULL != gl_error_msg) { @@ -1510,6 +1517,7 @@ void do_assert_glerror() } } else +#endif // GLU_VERSION_1_1 { // gluErrorString returns NULL for some extensions' error codes. // you'll probably have to grep for the number in glext.h. @@ -1601,6 +1609,7 @@ void LLGLState::restoreGL() void LLGLState::resetTextureStates() { gGL.flush(); +#if GL_VERSION_1_3 GLint maxTextureUnits; glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &maxTextureUnits); @@ -1610,6 +1619,7 @@ void LLGLState::resetTextureStates() glClientActiveTexture(GL_TEXTURE0_ARB+j); j == 0 ? gGL.getTexUnit(j)->enable(LLTexUnit::TT_TEXTURE) : gGL.getTexUnit(j)->disable(); } +#endif } void LLGLState::dumpStates() @@ -1864,6 +1874,7 @@ LLGLState::LLGLState(LLGLenum state, S32 enabled) : mState(state), mWasEnabled(FALSE), mIsEnabled(FALSE) { LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; +#if GL_VERSION_1_1 switch (state) { case GL_ALPHA_TEST: @@ -1880,6 +1891,7 @@ LLGLState::LLGLState(LLGLenum state, S32 enabled) : mState = 0; break; } +#endif // GL_VERSION_1_1 stop_glerror(); @@ -2339,8 +2351,11 @@ void LLGLSyncFence::wait() } LLGLSPipelineSkyBox::LLGLSPipelineSkyBox() -: mAlphaTest(GL_ALPHA_TEST) -, mCullFace(GL_CULL_FACE) +: +#if GL_VERSION_1_1 +mAlphaTest(GL_ALPHA_TEST), +#endif +mCullFace(GL_CULL_FACE) , mSquashClip() { } diff --git a/indra/llrender/llgldbg.cpp b/indra/llrender/llgldbg.cpp index 0f1d4ae742..210802d164 100644 --- a/indra/llrender/llgldbg.cpp +++ b/indra/llrender/llgldbg.cpp @@ -35,6 +35,7 @@ #include "llglheaders.h" +#if GL_VERSION_1_1 //------------------------------------------------------------------------ // cmstr() //------------------------------------------------------------------------ @@ -50,6 +51,7 @@ const char *cmstr(int i) } return "UNKNOWN"; } +#endif //------------------------------------------------------------------------ // facestr() @@ -116,6 +118,7 @@ void llgl_dump() LL_INFOS() << "OpenGL State" << LL_ENDL; LL_INFOS() << "==========================" << LL_ENDL; +#if GL_VERSION_1_1 LL_INFOS() << "-----------------------------------" << LL_ENDL; LL_INFOS() << "Current Values" << LL_ENDL; LL_INFOS() << "-----------------------------------" << LL_ENDL; @@ -211,6 +214,7 @@ void llgl_dump() LL_INFOS() << "-----------------------------------" << LL_ENDL; LL_INFOS() << "GL_ALPHA_TEST : " << boolstr(glIsEnabled(GL_ALPHA_TEST)) << LL_ENDL; +#endif LL_INFOS() << "GL_DEPTH_TEST : " << boolstr(glIsEnabled(GL_DEPTH_TEST)) << LL_ENDL; glGetBooleanv(GL_DEPTH_WRITEMASK, &b); diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index da24d999b0..cfc871e0c6 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -677,10 +677,14 @@ void LLGLSLShader::mapUniform(GLint index, const vector * case GL_FLOAT_VEC2: size *= 2; break; case GL_FLOAT_VEC3: size *= 3; break; case GL_FLOAT_VEC4: size *= 4; break; +#if GL_VERSION_1_1 case GL_DOUBLE: size *= 2; break; +#if GL_VERSION_4_0 case GL_DOUBLE_VEC2: size *= 2; break; case GL_DOUBLE_VEC3: size *= 6; break; case GL_DOUBLE_VEC4: size *= 8; break; +#endif // GL_VERSION_4_0 +#endif // GL_VERSION_1_1 case GL_INT_VEC2: size *= 2; break; case GL_INT_VEC3: size *= 3; break; case GL_INT_VEC4: size *= 4; break; @@ -699,6 +703,7 @@ void LLGLSLShader::mapUniform(GLint index, const vector * case GL_FLOAT_MAT3x4: size *= 12; break; case GL_FLOAT_MAT4x2: size *= 8; break; case GL_FLOAT_MAT4x3: size *= 12; break; +#if GL_VERSION_4_0 case GL_DOUBLE_MAT2: size *= 8; break; case GL_DOUBLE_MAT3: size *= 18; break; case GL_DOUBLE_MAT4: size *= 32; break; @@ -708,6 +713,7 @@ void LLGLSLShader::mapUniform(GLint index, const vector * case GL_DOUBLE_MAT3x4: size *= 24; break; case GL_DOUBLE_MAT4x2: size *= 16; break; case GL_DOUBLE_MAT4x3: size *= 24; break; +#endif // GL_VERSION_4_0 } mTotalUniformSize += size; } diff --git a/indra/llrender/llglstates.h b/indra/llrender/llglstates.h index a4924eba14..753c9a984f 100644 --- a/indra/llrender/llglstates.h +++ b/indra/llrender/llglstates.h @@ -56,42 +56,71 @@ private: class LLGLSDefault { protected: +#if GL_VERSION_1_1 LLGLEnable mColorMaterial; - LLGLDisable mAlphaTest, mBlend, mCullFace, mDither, mFog, - mLineSmooth, mLineStipple, mNormalize, mPolygonSmooth, - mGLMultisample; +#endif + LLGLDisable +#if GL_VERSION_1_1 + mAlphaTest, +#endif + mBlend, mCullFace, mDither +#if GL_VERSION_1_1 + , mFog, + mLineSmooth, mLineStipple, mNormalize, mPolygonSmooth +#if GL_VERSION_1_3 + , + mGLMultisample +#endif // GL_VERSION_1_3 +#endif // GL_VERSION_1_1 + ; public: LLGLSDefault() : // Enable +#if GL_VERSION_1_1 mColorMaterial(GL_COLOR_MATERIAL), // Disable mAlphaTest(GL_ALPHA_TEST), +#endif mBlend(GL_BLEND), mCullFace(GL_CULL_FACE), - mDither(GL_DITHER), + mDither(GL_DITHER) +#if GL_VERSION_1_1 + , mFog(GL_FOG), mLineSmooth(GL_LINE_SMOOTH), mLineStipple(GL_LINE_STIPPLE), mNormalize(GL_NORMALIZE), - mPolygonSmooth(GL_POLYGON_SMOOTH), - mGLMultisample(GL_MULTISAMPLE_ARB) + mPolygonSmooth(GL_POLYGON_SMOOTH) +#if GL_VERSION_1_3 + , + mGLMultisample(GL_MULTISAMPLE) +#endif // GL_VERSION_1_3 +#endif // GL_VERSION_1_1 { } }; class LLGLSObjectSelect { protected: - LLGLDisable mBlend, mFog, mAlphaTest; + LLGLDisable mBlend +#if GL_VERSION_1_1 + , mFog, mAlphaTest +#endif + ; LLGLEnable mCullFace; public: LLGLSObjectSelect() - : mBlend(GL_BLEND), mFog(GL_FOG), + : mBlend(GL_BLEND), +#if GL_VERSION_1_1 + mFog(GL_FOG), mAlphaTest(GL_ALPHA_TEST), +#endif mCullFace(GL_CULL_FACE) { } }; +#if GL_VERSION_1_1 class LLGLSObjectSelectAlpha { protected: @@ -101,23 +130,32 @@ public: : mAlphaTest(GL_ALPHA_TEST) {} }; +#endif //---------------------------------------------------------------------------- class LLGLSUIDefault { protected: - LLGLEnable mBlend, mAlphaTest; + LLGLEnable mBlend +#if GL_VERSION_1_1 + , mAlphaTest +#endif + ; LLGLDisable mCullFace; LLGLDepthTest mDepthTest; public: LLGLSUIDefault() - : mBlend(GL_BLEND), mAlphaTest(GL_ALPHA_TEST), + : mBlend(GL_BLEND), +#if GL_VERSION_1_1 + mAlphaTest(GL_ALPHA_TEST), +#endif mCullFace(GL_CULL_FACE), mDepthTest(GL_FALSE, GL_TRUE, GL_LEQUAL) {} }; +#if GL_VERSION_1_1 class LLGLSNoAlphaTest // : public LLGLSUIDefault { protected: @@ -149,6 +187,7 @@ public: : mFog(GL_FOG) {} }; +#endif //---------------------------------------------------------------------------- @@ -167,14 +206,22 @@ public: class LLGLSPipelineAlpha // : public LLGLSPipeline { protected: - LLGLEnable mBlend, mAlphaTest; + LLGLEnable mBlend +#if GL_VERSION_1_1 + , mAlphaTest +#endif + ; public: LLGLSPipelineAlpha() - : mBlend(GL_BLEND), + : mBlend(GL_BLEND) +#if GL_VERSION_1_1 + , mAlphaTest(GL_ALPHA_TEST) +#endif { } }; +#if GL_VERSION_1_1 class LLGLSPipelineEmbossBump { protected: @@ -184,6 +231,7 @@ public: : mFog(GL_FOG) { } }; +#endif class LLGLSPipelineSelection { @@ -195,6 +243,7 @@ public: {} }; +#if GL_VERSION_1_1 class LLGLSPipelineAvatar { protected: @@ -204,11 +253,14 @@ public: : mNormalize(GL_NORMALIZE) {} }; +#endif class LLGLSPipelineSkyBox { protected: +#if GL_VERSION_1_1 LLGLDisable mAlphaTest; +#endif LLGLDisable mCullFace; LLGLSquashToFarClip mSquashClip; public: @@ -234,18 +286,26 @@ public: class LLGLSTracker { protected: - LLGLEnable mCullFace, mBlend, mAlphaTest; + LLGLEnable mCullFace, mBlend +#if GL_VERSION_1_1 + , mAlphaTest +#endif + ; public: LLGLSTracker() : mCullFace(GL_CULL_FACE), - mBlend(GL_BLEND), + mBlend(GL_BLEND) +#if GL_VERSION_1_1 + , mAlphaTest(GL_ALPHA_TEST) +#endif { } }; //---------------------------------------------------------------------------- +#if GL_VERSION_1_1 class LLGLSSpecular { public: @@ -270,6 +330,7 @@ public: } } }; +#endif //---------------------------------------------------------------------------- diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 8e83f2b401..34f668d1a2 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -212,14 +212,18 @@ S32 LLImageGL::dataFormatBits(S32 dataformat) case GL_LUMINANCE: return 8; case GL_ALPHA: return 8; case GL_RED: return 8; +#if GL_VERSION_1_1 case GL_COLOR_INDEX: return 8; +#endif case GL_LUMINANCE_ALPHA: return 16; case GL_RGB: return 24; case GL_SRGB: return 24; case GL_RGB8: return 24; case GL_RGBA: return 32; +#if GL_VERSION_2_1 case GL_SRGB_ALPHA: return 32; case GL_BGRA: return 32; // Used for QuickTime media textures on the Mac +#endif default: LL_ERRS() << "LLImageGL::Unknown format: " << dataformat << LL_ENDL; return 0; @@ -262,13 +266,17 @@ S32 LLImageGL::dataFormatComponents(S32 dataformat) case GL_LUMINANCE: return 1; case GL_ALPHA: return 1; case GL_RED: return 1; +#if GL_VERSION_1_1 case GL_COLOR_INDEX: return 1; +#endif case GL_LUMINANCE_ALPHA: return 2; case GL_RGB: return 3; case GL_SRGB: return 3; case GL_RGBA: return 4; +#if GL_VERSION_2_1 case GL_SRGB_ALPHA: return 4; case GL_BGRA: return 4; // Used for QuickTime media textures on the Mac +#endif default: LL_ERRS() << "LLImageGL::Unknown format: " << dataformat << LL_ENDL; return 0; @@ -746,11 +754,13 @@ BOOL LLImageGL::setImage(const U8* data_in, BOOL data_hasmips /* = FALSE */, S32 } else { +#if GL_VERSION_1_1 if(mFormatSwapBytes) { glPixelStorei(GL_UNPACK_SWAP_BYTES, 1); stop_glerror(); } +#endif LLImageGL::setManualImage(mTarget, gl_level, mFormatInternal, w, h, mFormatPrimary, GL_UNSIGNED_BYTE, (GLvoid*)data_in, mAllowCompression); if (gl_level == 0) @@ -759,11 +769,13 @@ BOOL LLImageGL::setImage(const U8* data_in, BOOL data_hasmips /* = FALSE */, S32 } updatePickMask(w, h, data_in); +#if GL_VERSION_1_1 if(mFormatSwapBytes) { glPixelStorei(GL_UNPACK_SWAP_BYTES, 0); stop_glerror(); } +#endif stop_glerror(); } @@ -776,11 +788,13 @@ BOOL LLImageGL::setImage(const U8* data_in, BOOL data_hasmips /* = FALSE */, S32 { stop_glerror(); { +#if GL_VERSION_1_1 if(mFormatSwapBytes) { glPixelStorei(GL_UNPACK_SWAP_BYTES, 1); stop_glerror(); } +#endif S32 w = getWidth(mCurrentDiscardLevel); S32 h = getHeight(mCurrentDiscardLevel); @@ -790,10 +804,12 @@ BOOL LLImageGL::setImage(const U8* data_in, BOOL data_hasmips /* = FALSE */, S32 //use legacy mipmap generation mode (note: making this condional can cause rendering issues) // -- but making it not conditional triggers deprecation warnings when core profile is enabled // (some rendering issues while core profile is enabled are acceptable at this point in time) +#if GL_VERSION_1_4 if (!LLRender::sGLCoreProfile) { glTexParameteri(mTarget, GL_GENERATE_MIPMAP, GL_TRUE); } +#endif LLImageGL::setManualImage(mTarget, 0, mFormatInternal, w, h, @@ -804,11 +820,13 @@ BOOL LLImageGL::setImage(const U8* data_in, BOOL data_hasmips /* = FALSE */, S32 updatePickMask(w, h, data_in); +#if GL_VERSION_1_1 if(mFormatSwapBytes) { glPixelStorei(GL_UNPACK_SWAP_BYTES, 0); stop_glerror(); } +#endif if (LLRender::sGLCoreProfile) { @@ -892,11 +910,13 @@ BOOL LLImageGL::setImage(const U8* data_in, BOOL data_hasmips /* = FALSE */, S32 llassert(w > 0 && h > 0 && cur_mip_data); (void)cur_mip_data; { +#if GL_VERSION_1_1 if(mFormatSwapBytes) { glPixelStorei(GL_UNPACK_SWAP_BYTES, 1); stop_glerror(); } +#endif LLImageGL::setManualImage(mTarget, m, mFormatInternal, w, h, mFormatPrimary, mFormatType, cur_mip_data, mAllowCompression); if (m == 0) @@ -909,11 +929,13 @@ BOOL LLImageGL::setImage(const U8* data_in, BOOL data_hasmips /* = FALSE */, S32 updatePickMask(w, h, cur_mip_data); } +#if GL_VERSION_1_1 if(mFormatSwapBytes) { glPixelStorei(GL_UNPACK_SWAP_BYTES, 0); stop_glerror(); } +#endif } if (prev_mip_data && prev_mip_data != data_in) { @@ -948,11 +970,13 @@ BOOL LLImageGL::setImage(const U8* data_in, BOOL data_hasmips /* = FALSE */, S32 } else { +#if GL_VERSION_1_1 if(mFormatSwapBytes) { glPixelStorei(GL_UNPACK_SWAP_BYTES, 1); stop_glerror(); } +#endif LLImageGL::setManualImage(mTarget, 0, mFormatInternal, w, h, mFormatPrimary, mFormatType, (GLvoid *)data_in, mAllowCompression); @@ -962,11 +986,13 @@ BOOL LLImageGL::setImage(const U8* data_in, BOOL data_hasmips /* = FALSE */, S32 stop_glerror(); +#if GL_VERSION_1_1 if(mFormatSwapBytes) { glPixelStorei(GL_UNPACK_SWAP_BYTES, 0); stop_glerror(); } +#endif } } @@ -1011,13 +1037,17 @@ BOOL LLImageGL::preAddToAtlas(S32 discard_level, const LLImageRaw* raw_image) { case 1: // Use luminance alpha (for fonts) +#if GL_VERSION_1_1 mFormatInternal = GL_LUMINANCE8; +#endif mFormatPrimary = GL_LUMINANCE; mFormatType = GL_UNSIGNED_BYTE; break; case 2: // Use luminance alpha (for fonts) +#if GL_VERSION_1_1 mFormatInternal = GL_LUMINANCE8_ALPHA8; +#endif mFormatPrimary = GL_LUMINANCE_ALPHA; mFormatType = GL_UNSIGNED_BYTE; break; @@ -1063,22 +1093,26 @@ BOOL LLImageGL::preAddToAtlas(S32 discard_level, const LLImageRaw* raw_image) glPixelStorei(GL_UNPACK_ROW_LENGTH, raw_image->getWidth()); stop_glerror(); +#if GL_VERSION_1_1 if(mFormatSwapBytes) { glPixelStorei(GL_UNPACK_SWAP_BYTES, 1); stop_glerror(); } +#endif return TRUE ; } void LLImageGL::postAddToAtlas() { +#if GL_VERSION_1_1 if(mFormatSwapBytes) { glPixelStorei(GL_UNPACK_SWAP_BYTES, 0); stop_glerror(); } +#endif glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); gGL.getTexUnit(0)->setTextureFilteringOption(mFilterOption); @@ -1153,11 +1187,13 @@ BOOL LLImageGL::setSubImage(const U8* datap, S32 data_width, S32 data_height, S3 glPixelStorei(GL_UNPACK_ROW_LENGTH, data_width); stop_glerror(); +#if GL_VERSION_1_1 if(mFormatSwapBytes) { glPixelStorei(GL_UNPACK_SWAP_BYTES, 1); stop_glerror(); } +#endif datap += (y_pos * data_width + x_pos) * getComponents(); // Update the GL texture @@ -1169,11 +1205,13 @@ BOOL LLImageGL::setSubImage(const U8* datap, S32 data_width, S32 data_height, S3 gGL.getTexUnit(0)->disable(); stop_glerror(); +#if GL_VERSION_1_1 if(mFormatSwapBytes) { glPixelStorei(GL_UNPACK_SWAP_BYTES, 0); stop_glerror(); } +#endif glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); stop_glerror(); @@ -1336,35 +1374,57 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt { case GL_RGB: case GL_RGB8: +#if GL_VERSION_1_3 intformat = GL_COMPRESSED_RGB; +#endif break; case GL_SRGB: case GL_SRGB8: +#if GL_VERSION_2_1 intformat = GL_COMPRESSED_SRGB; +#endif break; case GL_RGBA: case GL_RGBA8: +#if GL_VERSION_1_3 intformat = GL_COMPRESSED_RGBA; +#endif break; - case GL_SRGB_ALPHA: case GL_SRGB8_ALPHA8: +#if GL_VERSION_2_1 + case GL_SRGB_ALPHA: intformat = GL_COMPRESSED_SRGB_ALPHA; +#endif break; case GL_LUMINANCE: +#if GL_VERSION_1_1 case GL_LUMINANCE8: +#endif +#if GL_VERSION_1_3 intformat = GL_COMPRESSED_LUMINANCE; +#endif break; case GL_LUMINANCE_ALPHA: +#if GL_VERSION_1_1 case GL_LUMINANCE8_ALPHA8: +#endif +#if GL_VERSION_1_3 intformat = GL_COMPRESSED_LUMINANCE_ALPHA; +#endif break; case GL_ALPHA: +#if GL_VERSION_1_1 case GL_ALPHA8: +#endif +#if GL_VERSION_1_3 intformat = GL_COMPRESSED_ALPHA; +#endif break; case GL_RED: case GL_R8: +#if GL_VERSION_3_0 intformat = GL_COMPRESSED_RED; +#endif break; default: LL_WARNS() << "Could not compress format: " << std::hex << intformat << LL_ENDL; @@ -1478,13 +1538,17 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S { case 1: // Use luminance alpha (for fonts) +#if GL_VERSION_1_1 mFormatInternal = GL_LUMINANCE8; +#endif mFormatPrimary = GL_LUMINANCE; mFormatType = GL_UNSIGNED_BYTE; break; case 2: // Use luminance alpha (for fonts) +#if GL_VERSION_1_1 mFormatInternal = GL_LUMINANCE8_ALPHA8; +#endif mFormatPrimary = GL_LUMINANCE_ALPHA; mFormatType = GL_UNSIGNED_BYTE; break; @@ -1826,6 +1890,7 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre } //----------------------------------------------------------------------------------------------- +#if GL_VERSION_1_3 if (is_compressed) { LLGLint glbytes; @@ -1852,6 +1917,7 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre glGetTexImage(GL_TEXTURE_2D, gl_discard, mFormatPrimary, mFormatType, (GLvoid*)(imageraw->getData())); //stop_glerror(); } +#endif // GL_VERSION_1_3 //----------------------------------------------------------------------------------------------- if((error = glGetError()) != GL_NO_ERROR) @@ -1941,11 +2007,13 @@ BOOL LLImageGL::getIsResident(BOOL test_now) { if (test_now) { +#if GL_VERSION_1_1 if (mTexName != 0) { glAreTexturesResident(1, (GLuint*)&mTexName, &mIsResident); } else +#endif { mIsResident = FALSE; } @@ -2075,7 +2143,9 @@ void LLImageGL::calcAlphaChannelOffsetAndStride() mIsMask = FALSE; return; //no alpha channel. case GL_RGBA: +#if GL_VERSION_2_1 case GL_SRGB_ALPHA: +#endif mAlphaStride = 4; break; case GL_BGRA_EXT: @@ -2090,6 +2160,7 @@ void LLImageGL::calcAlphaChannelOffsetAndStride() { mAlphaOffset = mAlphaStride - 1 ; } +#if GL_VERSION_1_2 else if(is_little_endian()) { if (mFormatType == GL_UNSIGNED_INT_8_8_8_8) @@ -2112,6 +2183,7 @@ void LLImageGL::calcAlphaChannelOffsetAndStride() mAlphaOffset = 0 ; } } +#endif // GL_VERSION_1_2 if( mAlphaStride < 1 || //unsupported format mAlphaOffset < 0 || //unsupported type @@ -2266,7 +2338,10 @@ void LLImageGL::updatePickMask(S32 width, S32 height, const U8* data_in) if (mFormatType != GL_UNSIGNED_BYTE || ((mFormatPrimary != GL_RGBA) - && (mFormatPrimary != GL_SRGB_ALPHA))) +#if GL_VERSION_2_1 + && (mFormatPrimary != GL_SRGB_ALPHA) +#endif + )) { //cannot generate a pick mask for this texture return; diff --git a/indra/llrender/llpostprocess.cpp b/indra/llrender/llpostprocess.cpp index b6ea5aa7f1..ce36942e1a 100644 --- a/indra/llrender/llpostprocess.cpp +++ b/indra/llrender/llpostprocess.cpp @@ -357,8 +357,10 @@ void LLPostProcess::getShaderUniforms(glslUniforms & uniforms, GLhandleARB & pro void LLPostProcess::doEffects(void) { /// Save GL State +#if GL_VERSION_1_1 glPushAttrib(GL_ALL_ATTRIB_BITS); glPushClientAttrib(GL_ALL_ATTRIB_BITS); +#endif /// Copy the screen buffer to the render texture { @@ -383,15 +385,19 @@ void LLPostProcess::doEffects(void) viewPerspective(); /// Reset GL State +#if GL_VERSION_1_1 glPopClientAttrib(); glPopAttrib(); +#endif checkError(); } void LLPostProcess::copyFrameBuffer(U32 & texture, unsigned int width, unsigned int height) { gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, texture); +#if GL_VERSION_3_1 glCopyTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, 0, 0, width, height, 0); +#endif } void LLPostProcess::drawOrthoQuad(unsigned int width, unsigned int height, QuadType type) @@ -503,8 +509,10 @@ void LLPostProcess::createTexture(LLPointer& texture, unsigned int wi if(texture->createGLTexture()) { gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, texture->getTexName()); +#if GL_VERSION_3_1 glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 4, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, &data[0]); +#endif gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); } @@ -538,18 +546,22 @@ bool LLPostProcess::checkError(void) while (glErr != GL_NO_ERROR) { // shaderErrorLog << (const char *) gluErrorString(glErr) << std::endl; +#if GLU_VERSION_1_1 char const * err_str_raw = (const char *) gluErrorString(glErr); if(err_str_raw == NULL) { +#endif std::ostringstream err_builder; err_builder << "unknown error number " << glErr; mShaderErrorString = err_builder.str(); +#if GLU_VERSION_1_1 } else { mShaderErrorString = err_str_raw; } +#endif retCode = true; glErr = glGetError(); 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 } diff --git a/indra/llrender/llrender2dutils.cpp b/indra/llrender/llrender2dutils.cpp index 5cb1dc6b25..95f9376f8b 100644 --- a/indra/llrender/llrender2dutils.cpp +++ b/indra/llrender/llrender2dutils.cpp @@ -716,8 +716,10 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LLColor4& color, F32 phase ) { +#if GL_VERSION_1_1 // Stippled line LLGLEnable stipple(GL_LINE_STIPPLE); +#endif gGL.color4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], color.mV[VALPHA]); diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index fffc15efc3..f73aab8d23 100644 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -560,7 +560,9 @@ void LLRenderTarget::bindTexture(U32 index, S32 channel, LLTexUnit::eTextureFilt { case GL_SRGB: case GL_SRGB8: +#if GL_VERSION_2_1 case GL_SRGB_ALPHA: +#endif case GL_SRGB8_ALPHA8: isSRGB = true; break; -- cgit v1.2.3 From 4b7e271dff7fa6ff813f9fc8f81cc2b6604de6db Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Wed, 6 Sep 2023 08:15:16 +0800 Subject: Core profile glCreateShader & return type GLuint to replace the less portable ARB versions. --- indra/llrender/llglslshader.cpp | 12 ++++++------ indra/llrender/llglslshader.h | 8 ++++---- indra/llrender/llpostprocess.cpp | 4 ++-- indra/llrender/llpostprocess.h | 4 ++-- indra/llrender/llshadermgr.cpp | 12 ++++++------ indra/llrender/llshadermgr.h | 12 ++++++------ 6 files changed, 26 insertions(+), 26 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index cfc871e0c6..e310278955 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -47,7 +47,7 @@ using std::pair; using std::make_pair; using std::string; -GLhandleARB LLGLSLShader::sCurBoundShader = 0; +GLuint LLGLSLShader::sCurBoundShader = 0; LLGLSLShader* LLGLSLShader::sCurBoundShaderPtr = NULL; S32 LLGLSLShader::sIndexedTextureChannels = 0; bool LLGLSLShader::sProfileEnabled = false; @@ -347,7 +347,7 @@ void LLGLSLShader::unloadInternal() if (mProgramObject) { - GLhandleARB obj[1024]; + GLuint obj[1024]; GLsizei count; glGetAttachedObjectsARB(mProgramObject, 1024, &count, obj); @@ -425,7 +425,7 @@ BOOL LLGLSLShader::createShader(std::vector * attributes, vector< pair >::iterator fileIter = mShaderFiles.begin(); for ( ; fileIter != mShaderFiles.end(); fileIter++ ) { - GLhandleARB shaderhandle = LLShaderMgr::instance()->loadShaderFile((*fileIter).first, mShaderLevel, (*fileIter).second, &mDefines, mFeatures.mIndexedTextureChannels); + auto shaderhandle = LLShaderMgr::instance()->loadShaderFile((*fileIter).first, mShaderLevel, (*fileIter).second, &mDefines, mFeatures.mIndexedTextureChannels); LL_DEBUGS("ShaderLoading") << "SHADER FILE: " << (*fileIter).first << " mShaderLevel=" << mShaderLevel << LL_ENDL; if (shaderhandle) { @@ -505,7 +505,7 @@ BOOL LLGLSLShader::createShader(std::vector * attributes, } #if DEBUG_SHADER_INCLUDES -void dumpAttachObject( const char *func_name, GLhandleARB program_object, const std::string &object_path ) +void dumpAttachObject( const char *func_name, GLuint program_object, const std::string &object_path ) { GLcharARB* info_log; GLint info_len_expect = 0; @@ -563,7 +563,7 @@ BOOL LLGLSLShader::attachFragmentObject(std::string object_path) } } -void LLGLSLShader::attachObject(GLhandleARB object) +void LLGLSLShader::attachObject(GLuint object) { if (object != 0) { @@ -581,7 +581,7 @@ void LLGLSLShader::attachObject(GLhandleARB object) } } -void LLGLSLShader::attachObjects(GLhandleARB* objects, S32 count) +void LLGLSLShader::attachObjects(GLuint* objects, S32 count) { for (S32 i = 0; i < count; i++) { diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index 85e83dbcb9..8f8834e80e 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -145,7 +145,7 @@ public: LLGLSLShader(); ~LLGLSLShader(); - static GLhandleARB sCurBoundShader; + static GLuint sCurBoundShader; static LLGLSLShader* sCurBoundShaderPtr; static S32 sIndexedTextureChannels; @@ -167,8 +167,8 @@ public: const char** varyings = NULL); BOOL attachFragmentObject(std::string object); BOOL attachVertexObject(std::string object); - void attachObject(GLhandleARB object); - void attachObjects(GLhandleARB* objects = NULL, S32 count = 0); + void attachObject(GLuint object); + void attachObjects(GLuint* objects = NULL, S32 count = 0); BOOL mapAttributes(const std::vector * attributes); BOOL mapUniforms(const std::vector *); void mapUniform(GLint index, const std::vector *); @@ -239,7 +239,7 @@ public: U32 mMatHash[LLRender::NUM_MATRIX_MODES]; U32 mLightHash; - GLhandleARB mProgramObject; + GLuint mProgramObject; #if LL_RELEASE_WITH_DEBUG_INFO struct attr_name { diff --git a/indra/llrender/llpostprocess.cpp b/indra/llrender/llpostprocess.cpp index ce36942e1a..4e0d43c8b4 100644 --- a/indra/llrender/llpostprocess.cpp +++ b/indra/llrender/llpostprocess.cpp @@ -345,7 +345,7 @@ void LLPostProcess::createBloomShader(void) bloomBlurUniforms[sBlurWidth] = 0; } -void LLPostProcess::getShaderUniforms(glslUniforms & uniforms, GLhandleARB & prog) +void LLPostProcess::getShaderUniforms(glslUniforms & uniforms, GLuint & prog) { /// Find uniform locations and insert into map glslUniforms::iterator i; @@ -569,7 +569,7 @@ bool LLPostProcess::checkError(void) return retCode; } -void LLPostProcess::checkShaderError(GLhandleARB shader) +void LLPostProcess::checkShaderError(GLuint shader) { GLint infologLength = 0; GLint charsWritten = 0; diff --git a/indra/llrender/llpostprocess.h b/indra/llrender/llpostprocess.h index ce17b6693d..bdfc632831 100644 --- a/indra/llrender/llpostprocess.h +++ b/indra/llrender/llpostprocess.h @@ -249,12 +249,12 @@ private: void applyColorFilterShader(void); /// OpenGL Helper Functions - void getShaderUniforms(glslUniforms & uniforms, GLhandleARB & prog); + void getShaderUniforms(glslUniforms & uniforms, GLuint & prog); void createTexture(LLPointer& texture, unsigned int width, unsigned int height); void copyFrameBuffer(U32 & texture, unsigned int width, unsigned int height); void createNoiseTexture(LLPointer& texture); bool checkError(void); - void checkShaderError(GLhandleARB shader); + void checkShaderError(GLuint shader); void drawOrthoQuad(unsigned int width, unsigned int height, QuadType type); void viewOrthogonal(unsigned int width, unsigned int height); void changeOrthogonal(unsigned int width, unsigned int height); diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index c64f46f38a..0f945dea42 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -550,7 +550,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) //============================================================================ // Load Shader -static std::string get_object_log(GLhandleARB ret) +static std::string get_object_log(GLuint ret) { std::string res; @@ -584,7 +584,7 @@ void LLShaderMgr::dumpShaderSource(U32 shader_code_count, GLcharARB** shader_cod LL_CONT << LL_ENDL; } -void LLShaderMgr::dumpObjectLog(GLhandleARB ret, BOOL warns, const std::string& filename) +void LLShaderMgr::dumpObjectLog(GLuint ret, BOOL warns, const std::string& filename) { std::string log = get_object_log(ret); std::string fname = filename; @@ -600,7 +600,7 @@ void LLShaderMgr::dumpObjectLog(GLhandleARB ret, BOOL warns, const std::string& } } -GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, std::unordered_map* defines, S32 texture_index_channels) +GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, std::unordered_map* defines, S32 texture_index_channels) { // endsure work-around for missing GLSL funcs gets propogated to feature shader files (e.g. srgbF.glsl) @@ -964,7 +964,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade fclose(file); //create shader object - GLhandleARB ret = glCreateShaderObjectARB(type); + auto ret = glCreateShader(type); error = glGetError(); if (error != GL_NO_ERROR) @@ -1042,7 +1042,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade return ret; } -BOOL LLShaderMgr::linkProgramObject(GLhandleARB obj, BOOL suppress_errors) +BOOL LLShaderMgr::linkProgramObject(GLuint obj, BOOL suppress_errors) { //check for errors glLinkProgramARB(obj); @@ -1065,7 +1065,7 @@ BOOL LLShaderMgr::linkProgramObject(GLhandleARB obj, BOOL suppress_errors) return success; } -BOOL LLShaderMgr::validateProgramObject(GLhandleARB obj) +BOOL LLShaderMgr::validateProgramObject(GLuint obj) { //check program validity against current GL glValidateProgramARB(obj); diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index 67c0d6ab10..89d726d64a 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -260,11 +260,11 @@ public: virtual void initAttribsAndUniforms(void); BOOL attachShaderFeatures(LLGLSLShader * shader); - void dumpObjectLog(GLhandleARB ret, BOOL warns = TRUE, const std::string& filename = ""); + void dumpObjectLog(GLuint ret, BOOL warns = TRUE, const std::string& filename = ""); void dumpShaderSource(U32 shader_code_count, GLcharARB** shader_code_text); - BOOL linkProgramObject(GLhandleARB obj, BOOL suppress_errors = FALSE); - BOOL validateProgramObject(GLhandleARB obj); - GLhandleARB loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, std::unordered_map* defines = NULL, S32 texture_index_channels = -1); + BOOL linkProgramObject(GLuint obj, BOOL suppress_errors = FALSE); + BOOL validateProgramObject(GLuint obj); + GLuint loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, std::unordered_map* defines = NULL, S32 texture_index_channels = -1); // Implemented in the application to actually point to the shader directory. virtual std::string getShaderDirPrefix(void) = 0; // Pure Virtual @@ -274,8 +274,8 @@ public: public: // Map of shader names to compiled - std::map mVertexShaderObjects; - std::map mFragmentShaderObjects; + std::map mVertexShaderObjects; + std::map mFragmentShaderObjects; //global (reserved slot) shader parameters std::vector mReservedAttribs; -- cgit v1.2.3 From 1d2c62b79458feecb162f18764d0ff37f80414cf Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Wed, 6 Sep 2023 09:02:22 +0800 Subject: Core profile shader functions, macros & type replacing legacy ARB versions. --- indra/llrender/llpostprocess.cpp | 4 ++-- indra/llrender/llshadermgr.cpp | 24 ++++++++++++------------ indra/llrender/llshadermgr.h | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llpostprocess.cpp b/indra/llrender/llpostprocess.cpp index 4e0d43c8b4..d3449fb85d 100644 --- a/indra/llrender/llpostprocess.cpp +++ b/indra/llrender/llpostprocess.cpp @@ -577,7 +577,7 @@ void LLPostProcess::checkShaderError(GLuint shader) checkError(); // Check for OpenGL errors - glGetObjectParameterivARB(shader, GL_OBJECT_INFO_LOG_LENGTH_ARB, &infologLength); + glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infologLength); checkError(); // Check for OpenGL errors @@ -589,7 +589,7 @@ void LLPostProcess::checkShaderError(GLuint shader) /// Could not allocate infolog buffer return; } - glGetInfoLogARB(shader, infologLength, &charsWritten, infoLog); + glGetShaderInfoLog(shader, infologLength, &charsWritten, infoLog); // shaderErrorLog << (char *) infoLog << std::endl; mShaderErrorString = (char *) infoLog; free(infoLog); diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 0f945dea42..114059f092 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -556,12 +556,12 @@ static std::string get_object_log(GLuint ret) //get log length GLint length; - glGetObjectParameterivARB(ret, GL_OBJECT_INFO_LOG_LENGTH_ARB, &length); + glGetShaderiv(ret, GL_INFO_LOG_LENGTH, &length); if (length > 0) { //the log could be any size, so allocate appropriately - GLcharARB* log = new GLcharARB[length]; - glGetInfoLogARB(ret, length, &length, log); + auto log = new GLchar[length]; + glGetShaderInfoLog(ret, length, &length, log); res = std::string((char *)log); delete[] log; } @@ -569,7 +569,7 @@ static std::string get_object_log(GLuint ret) } //dump shader source for debugging -void LLShaderMgr::dumpShaderSource(U32 shader_code_count, GLcharARB** shader_code_text) +void LLShaderMgr::dumpShaderSource(U32 shader_code_count, GLchar** shader_code_text) { char num_str[16]; // U32 = max 10 digits @@ -671,9 +671,9 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev //we can't have any lines longer than 1024 characters //or any shaders longer than 4096 lines... deal - DaveP - GLcharARB buff[1024]; - GLcharARB *extra_code_text[1024]; - GLcharARB *shader_code_text[4096 + LL_ARRAY_SIZE(extra_code_text)] = { NULL }; + GLchar buff[1024]; + GLchar *extra_code_text[1024]; + GLchar *shader_code_text[4096 + LL_ARRAY_SIZE(extra_code_text)] = { NULL }; GLuint extra_code_count = 0, shader_code_count = 0; BOOST_STATIC_ASSERT(LL_ARRAY_SIZE(extra_code_text) < LL_ARRAY_SIZE(shader_code_text)); @@ -778,7 +778,7 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev for (std::unordered_map::iterator iter = defines->begin(); iter != defines->end(); ++iter) { std::string define = "#define " + iter->first + " " + iter->second + "\n"; - extra_code_text[extra_code_count++] = (GLcharARB *) strdup(define.c_str()); + extra_code_text[extra_code_count++] = (GLchar *) strdup(define.c_str()); } } @@ -927,7 +927,7 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev } else { - shader_code_text[shader_code_count] = (GLcharARB *)strdup((char *)buff); + shader_code_text[shader_code_count] = (GLchar *)strdup((char *)buff); if(flag_write_to_out_of_extra_block_area & flags) { @@ -973,7 +973,7 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev } //load source - glShaderSourceARB(ret, shader_code_count, (const GLcharARB**) shader_code_text, NULL); + glShaderSource(ret, shader_code_count, (const GLchar**) shader_code_text, NULL); error = glGetError(); if (error != GL_NO_ERROR) @@ -982,7 +982,7 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev } //compile source - glCompileShaderARB(ret); + glCompileShader(ret); error = glGetError(); if (error != GL_NO_ERROR) @@ -994,7 +994,7 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev { //check for errors GLint success = GL_TRUE; - glGetObjectParameterivARB(ret, GL_OBJECT_COMPILE_STATUS_ARB, &success); + glGetShaderiv(ret, GL_COMPILE_STATUS, &success); error = glGetError(); if (error != GL_NO_ERROR || success == GL_FALSE) diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index 89d726d64a..598aea4ce8 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -261,7 +261,7 @@ public: BOOL attachShaderFeatures(LLGLSLShader * shader); void dumpObjectLog(GLuint ret, BOOL warns = TRUE, const std::string& filename = ""); - void dumpShaderSource(U32 shader_code_count, GLcharARB** shader_code_text); + void dumpShaderSource(U32 shader_code_count, GLchar** shader_code_text); BOOL linkProgramObject(GLuint obj, BOOL suppress_errors = FALSE); BOOL validateProgramObject(GLuint obj); GLuint loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, std::unordered_map* defines = NULL, S32 texture_index_channels = -1); -- cgit v1.2.3 From de53dff78db1cbcfc0df050f86bd23adbe2b580f Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Wed, 6 Sep 2023 09:20:40 +0800 Subject: Core profile program object related functions Whether to create/delete, or take the program object as an argument. Include ones for attaching & detaching shaders too, ones that deal with attributes & uniforms and so on, etc.. Replacing legacy ARB versions. --- indra/llrender/llglslshader.cpp | 48 ++++++++++++++++++++-------------------- indra/llrender/llpostprocess.cpp | 2 +- indra/llrender/llshadermgr.cpp | 8 +++---- 3 files changed, 29 insertions(+), 29 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index e310278955..a0183e8225 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -349,15 +349,15 @@ void LLGLSLShader::unloadInternal() { GLuint obj[1024]; GLsizei count; - glGetAttachedObjectsARB(mProgramObject, 1024, &count, obj); + glGetAttachedShaders(mProgramObject, 1024, &count, obj); for (GLsizei i = 0; i < count; i++) { - glDetachObjectARB(mProgramObject, obj[i]); - glDeleteObjectARB(obj[i]); + glDetachShader(mProgramObject, obj[i]); + glDeleteShader(obj[i]); } - glDeleteObjectARB(mProgramObject); + glDeleteProgram(mProgramObject); mProgramObject = 0; } @@ -401,7 +401,7 @@ BOOL LLGLSLShader::createShader(std::vector * attributes, llassert_always(!mShaderFiles.empty()); // Create program - mProgramObject = glCreateProgramObjectARB(); + mProgramObject = glCreateProgram(); if (mProgramObject == 0) { // Shouldn't happen if shader related extensions, like ARB_vertex_shader, exist. @@ -530,7 +530,7 @@ BOOL LLGLSLShader::attachVertexObject(std::string object_path) if (LLShaderMgr::instance()->mVertexShaderObjects.count(object_path) > 0) { stop_glerror(); - glAttachObjectARB(mProgramObject, LLShaderMgr::instance()->mVertexShaderObjects[object_path]); + glAttachShader(mProgramObject, LLShaderMgr::instance()->mVertexShaderObjects[object_path]); #if DEBUG_SHADER_INCLUDES dumpAttachObject("attachVertexObject", mProgramObject, object_path); #endif // DEBUG_SHADER_INCLUDES @@ -549,7 +549,7 @@ BOOL LLGLSLShader::attachFragmentObject(std::string object_path) if (LLShaderMgr::instance()->mFragmentShaderObjects.count(object_path) > 0) { stop_glerror(); - glAttachObjectARB(mProgramObject, LLShaderMgr::instance()->mFragmentShaderObjects[object_path]); + glAttachShader(mProgramObject, LLShaderMgr::instance()->mFragmentShaderObjects[object_path]); #if DEBUG_SHADER_INCLUDES dumpAttachObject("attachFragmentObject", mProgramObject, object_path); #endif // DEBUG_SHADER_INCLUDES @@ -568,7 +568,7 @@ void LLGLSLShader::attachObject(GLuint object) if (object != 0) { stop_glerror(); - glAttachObjectARB(mProgramObject, object); + glAttachShader(mProgramObject, object); #if DEBUG_SHADER_INCLUDES std::string object_path("???"); dumpAttachObject("attachObject", mProgramObject, object_path); @@ -597,7 +597,7 @@ BOOL LLGLSLShader::mapAttributes(const std::vector * attri for (U32 i = 0; i < LLShaderMgr::instance()->mReservedAttribs.size(); i++) { const char* name = LLShaderMgr::instance()->mReservedAttribs[i].c_str(); - glBindAttribLocationARB(mProgramObject, i, (const GLcharARB *) name); + glBindAttribLocation(mProgramObject, i, (const GLchar *) name); } //link the program @@ -620,7 +620,7 @@ BOOL LLGLSLShader::mapAttributes(const std::vector * attri for (U32 i = 0; i < LLShaderMgr::instance()->mReservedAttribs.size(); i++) { const char* name = LLShaderMgr::instance()->mReservedAttribs[i].c_str(); - S32 index = glGetAttribLocationARB(mProgramObject, (const GLcharARB *)name); + S32 index = glGetAttribLocation(mProgramObject, (const GLchar *)name); if (index != -1) { #if LL_RELEASE_WITH_DEBUG_INFO @@ -637,7 +637,7 @@ BOOL LLGLSLShader::mapAttributes(const std::vector * attri for (U32 i = 0; i < numAttributes; i++) { const char* name = (*attributes)[i].String().c_str(); - S32 index = glGetAttribLocationARB(mProgramObject, name); + S32 index = glGetAttribLocation(mProgramObject, name); if (index != -1) { mAttribute[LLShaderMgr::instance()->mReservedAttribs.size() + i] = index; @@ -668,7 +668,7 @@ void LLGLSLShader::mapUniform(GLint index, const vector * name[0] = 0; - glGetActiveUniformARB(mProgramObject, index, 1024, &length, &size, &type, (GLcharARB *)name); + glGetActiveUniform(mProgramObject, index, 1024, &length, &size, &type, (GLchar *)name); #if !LL_DARWIN if (size > 0) { @@ -719,7 +719,7 @@ void LLGLSLShader::mapUniform(GLint index, const vector * } #endif - S32 location = glGetUniformLocationARB(mProgramObject, name); + S32 location = glGetUniformLocation(mProgramObject, name); if (location != -1) { //chop off "[0]" so we can always access the first element @@ -817,7 +817,7 @@ BOOL LLGLSLShader::mapUniforms(const vector * uniforms) //get the number of active uniforms GLint activeCount; - glGetObjectParameterivARB(mProgramObject, GL_OBJECT_ACTIVE_UNIFORMS_ARB, &activeCount); + glGetProgramiv(mProgramObject, GL_ACTIVE_UNIFORMS, &activeCount); //........................................................................................................................................ //........................................................................................ @@ -841,11 +841,11 @@ BOOL LLGLSLShader::mapUniforms(const vector * uniforms) */ - S32 diffuseMap = glGetUniformLocationARB(mProgramObject, "diffuseMap"); - S32 specularMap = glGetUniformLocationARB(mProgramObject, "specularMap"); - S32 bumpMap = glGetUniformLocationARB(mProgramObject, "bumpMap"); - S32 altDiffuseMap = glGetUniformLocationARB(mProgramObject, "altDiffuseMap"); - S32 environmentMap = glGetUniformLocationARB(mProgramObject, "environmentMap"); + S32 diffuseMap = glGetUniformLocation(mProgramObject, "diffuseMap"); + S32 specularMap = glGetUniformLocation(mProgramObject, "specularMap"); + S32 bumpMap = glGetUniformLocation(mProgramObject, "bumpMap"); + S32 altDiffuseMap = glGetUniformLocation(mProgramObject, "altDiffuseMap"); + S32 environmentMap = glGetUniformLocation(mProgramObject, "environmentMap"); std::set skip_index; @@ -862,7 +862,7 @@ BOOL LLGLSLShader::mapUniforms(const vector * uniforms) { name[0] = '\0'; - glGetActiveUniformARB(mProgramObject, i, 1024, &length, &size, &type, (GLcharARB *)name); + glGetActiveUniform(mProgramObject, i, 1024, &length, &size, &type, (GLchar *)name); if (-1 == diffuseMap && std::string(name) == "diffuseMap") { @@ -963,7 +963,7 @@ void LLGLSLShader::bind() if (sCurBoundShader != mProgramObject) // Don't re-bind current shader { LLVertexBuffer::unbind(); - glUseProgramObjectARB(mProgramObject); + glUseProgram(mProgramObject); sCurBoundShader = mProgramObject; sCurBoundShaderPtr = this; } @@ -995,7 +995,7 @@ void LLGLSLShader::unbind() gGL.flush(); stop_glerror(); LLVertexBuffer::unbind(); - glUseProgramObjectARB(0); + glUseProgram(0); sCurBoundShader = 0; sCurBoundShaderPtr = NULL; stop_glerror(); @@ -1006,7 +1006,7 @@ void LLGLSLShader::bindNoShader(void) LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; LLVertexBuffer::unbind(); - glUseProgramObjectARB(0); + glUseProgram(0); sCurBoundShader = 0; sCurBoundShaderPtr = NULL; } @@ -1434,7 +1434,7 @@ GLint LLGLSLShader::getUniformLocation(const LLStaticHashedString& uniform) if (gDebugGL) { stop_glerror(); - if (iter->second != glGetUniformLocationARB(mProgramObject, uniform.String().c_str())) + if (iter->second != glGetUniformLocation(mProgramObject, uniform.String().c_str())) { LL_ERRS() << "Uniform does not match." << LL_ENDL; } diff --git a/indra/llrender/llpostprocess.cpp b/indra/llrender/llpostprocess.cpp index d3449fb85d..f52de96549 100644 --- a/indra/llrender/llpostprocess.cpp +++ b/indra/llrender/llpostprocess.cpp @@ -350,7 +350,7 @@ void LLPostProcess::getShaderUniforms(glslUniforms & uniforms, GLuint & prog) /// Find uniform locations and insert into map glslUniforms::iterator i; for (i = uniforms.begin(); i != uniforms.end(); ++i){ - i->second = glGetUniformLocationARB(prog, i->first.String().c_str()); + i->second = glGetUniformLocation(prog, i->first.String().c_str()); } } diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 114059f092..ff547d9d47 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -1045,9 +1045,9 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev BOOL LLShaderMgr::linkProgramObject(GLuint obj, BOOL suppress_errors) { //check for errors - glLinkProgramARB(obj); + glLinkProgram(obj); GLint success = GL_TRUE; - glGetObjectParameterivARB(obj, GL_OBJECT_LINK_STATUS_ARB, &success); + glGetProgramiv(obj, GL_LINK_STATUS, &success); if (!suppress_errors && success == GL_FALSE) { //an error occured, print log @@ -1068,9 +1068,9 @@ BOOL LLShaderMgr::linkProgramObject(GLuint obj, BOOL suppress_errors) BOOL LLShaderMgr::validateProgramObject(GLuint obj) { //check program validity against current GL - glValidateProgramARB(obj); + glValidateProgram(obj); GLint success = GL_TRUE; - glGetObjectParameterivARB(obj, GL_OBJECT_VALIDATE_STATUS_ARB, &success); + glGetProgramiv(obj, GL_VALIDATE_STATUS, &success); if (success == GL_FALSE) { LL_SHADER_LOADING_WARNS() << "GLSL program not valid: " << LL_ENDL; -- cgit v1.2.3 From 7b2b8ec46e42477f0ba43e2bc59f9fcc713d1565 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Wed, 6 Sep 2023 09:50:48 +0800 Subject: Core profile uniform related functions replacing legacy ARB versions. --- indra/llrender/llglslshader.cpp | 48 ++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index a0183e8225..c402cab295 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -788,7 +788,7 @@ GLint LLGLSLShader::mapUniformTextureChannel(GLint location, GLenum type) if ((type >= GL_SAMPLER_1D_ARB && type <= GL_SAMPLER_2D_RECT_SHADOW_ARB) || type == GL_SAMPLER_2D_MULTISAMPLE) { //this here is a texture - glUniform1iARB(location, mActiveTextureChannels); + glUniform1i(location, mActiveTextureChannels); LL_DEBUGS("ShaderUniform") << "Assigned to texture channel " << mActiveTextureChannels << LL_ENDL; return mActiveTextureChannels++; } @@ -1136,7 +1136,7 @@ void LLGLSLShader::uniform1i(U32 index, GLint x) const auto& iter = mValue.find(mUniform[index]); if (iter == mValue.end() || iter->second.mV[0] != x) { - glUniform1iARB(mUniform[index], x); + glUniform1i(mUniform[index], x); mValue[mUniform[index]] = LLVector4(x,0.f,0.f,0.f); } } @@ -1159,7 +1159,7 @@ void LLGLSLShader::uniform1f(U32 index, GLfloat x) const auto& iter = mValue.find(mUniform[index]); if (iter == mValue.end() || iter->second.mV[0] != x) { - glUniform1fARB(mUniform[index], x); + glUniform1f(mUniform[index], x); mValue[mUniform[index]] = LLVector4(x,0.f,0.f,0.f); } } @@ -1182,7 +1182,7 @@ void LLGLSLShader::uniform2f(U32 index, GLfloat x, GLfloat y) LLVector4 vec(x,y,0.f,0.f); if (iter == mValue.end() || shouldChange(iter->second,vec)) { - glUniform2fARB(mUniform[index], x, y); + glUniform2f(mUniform[index], x, y); mValue[mUniform[index]] = vec; } } @@ -1205,7 +1205,7 @@ void LLGLSLShader::uniform3f(U32 index, GLfloat x, GLfloat y, GLfloat z) LLVector4 vec(x,y,z,0.f); if (iter == mValue.end() || shouldChange(iter->second,vec)) { - glUniform3fARB(mUniform[index], x, y, z); + glUniform3f(mUniform[index], x, y, z); mValue[mUniform[index]] = vec; } } @@ -1228,7 +1228,7 @@ void LLGLSLShader::uniform4f(U32 index, GLfloat x, GLfloat y, GLfloat z, GLfloat LLVector4 vec(x,y,z,w); if (iter == mValue.end() || shouldChange(iter->second,vec)) { - glUniform4fARB(mUniform[index], x, y, z, w); + glUniform4f(mUniform[index], x, y, z, w); mValue[mUniform[index]] = vec; } } @@ -1251,7 +1251,7 @@ void LLGLSLShader::uniform1iv(U32 index, U32 count, const GLint* v) LLVector4 vec(v[0],0.f,0.f,0.f); if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1) { - glUniform1ivARB(mUniform[index], count, v); + glUniform1iv(mUniform[index], count, v); mValue[mUniform[index]] = vec; } } @@ -1274,7 +1274,7 @@ void LLGLSLShader::uniform1fv(U32 index, U32 count, const GLfloat* v) LLVector4 vec(v[0],0.f,0.f,0.f); if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1) { - glUniform1fvARB(mUniform[index], count, v); + glUniform1fv(mUniform[index], count, v); mValue[mUniform[index]] = vec; } } @@ -1297,7 +1297,7 @@ void LLGLSLShader::uniform2fv(U32 index, U32 count, const GLfloat* v) LLVector4 vec(v[0],v[1],0.f,0.f); if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1) { - glUniform2fvARB(mUniform[index], count, v); + glUniform2fv(mUniform[index], count, v); mValue[mUniform[index]] = vec; } } @@ -1320,7 +1320,7 @@ void LLGLSLShader::uniform3fv(U32 index, U32 count, const GLfloat* v) LLVector4 vec(v[0],v[1],v[2],0.f); if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1) { - glUniform3fvARB(mUniform[index], count, v); + glUniform3fv(mUniform[index], count, v); mValue[mUniform[index]] = vec; } } @@ -1344,7 +1344,7 @@ void LLGLSLShader::uniform4fv(U32 index, U32 count, const GLfloat* v) if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1) { LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; - glUniform4fvARB(mUniform[index], count, v); + glUniform4fv(mUniform[index], count, v); mValue[mUniform[index]] = vec; } } @@ -1363,7 +1363,7 @@ void LLGLSLShader::uniformMatrix2fv(U32 index, U32 count, GLboolean transpose, c if (mUniform[index] >= 0) { - glUniformMatrix2fvARB(mUniform[index], count, transpose, v); + glUniformMatrix2fv(mUniform[index], count, transpose, v); } } } @@ -1380,7 +1380,7 @@ void LLGLSLShader::uniformMatrix3fv(U32 index, U32 count, GLboolean transpose, c if (mUniform[index] >= 0) { - glUniformMatrix3fvARB(mUniform[index], count, transpose, v); + glUniformMatrix3fv(mUniform[index], count, transpose, v); } } } @@ -1416,7 +1416,7 @@ void LLGLSLShader::uniformMatrix4fv(U32 index, U32 count, GLboolean transpose, c if (mUniform[index] >= 0) { - glUniformMatrix4fvARB(mUniform[index], count, transpose, v); + glUniformMatrix4fv(mUniform[index], count, transpose, v); } } } @@ -1489,7 +1489,7 @@ void LLGLSLShader::uniform1i(const LLStaticHashedString& uniform, GLint v) LLVector4 vec(v,0.f,0.f,0.f); if (iter == mValue.end() || shouldChange(iter->second,vec)) { - glUniform1iARB(location, v); + glUniform1i(location, v); mValue[location] = vec; } } @@ -1505,7 +1505,7 @@ void LLGLSLShader::uniform2i(const LLStaticHashedString& uniform, GLint i, GLint LLVector4 vec(i,j,0.f,0.f); if (iter == mValue.end() || shouldChange(iter->second,vec)) { - glUniform2iARB(location, i, j); + glUniform2i(location, i, j); mValue[location] = vec; } } @@ -1522,7 +1522,7 @@ void LLGLSLShader::uniform1f(const LLStaticHashedString& uniform, GLfloat v) LLVector4 vec(v,0.f,0.f,0.f); if (iter == mValue.end() || shouldChange(iter->second,vec)) { - glUniform1fARB(location, v); + glUniform1f(location, v); mValue[location] = vec; } } @@ -1538,7 +1538,7 @@ void LLGLSLShader::uniform2f(const LLStaticHashedString& uniform, GLfloat x, GLf LLVector4 vec(x,y,0.f,0.f); if (iter == mValue.end() || shouldChange(iter->second,vec)) { - glUniform2fARB(location, x,y); + glUniform2f(location, x,y); mValue[location] = vec; } } @@ -1555,7 +1555,7 @@ void LLGLSLShader::uniform3f(const LLStaticHashedString& uniform, GLfloat x, GLf LLVector4 vec(x,y,z,0.f); if (iter == mValue.end() || shouldChange(iter->second,vec)) { - glUniform3fARB(location, x,y,z); + glUniform3f(location, x,y,z); mValue[location] = vec; } } @@ -1571,7 +1571,7 @@ void LLGLSLShader::uniform1fv(const LLStaticHashedString& uniform, U32 count, co LLVector4 vec(v[0],0.f,0.f,0.f); if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1) { - glUniform1fvARB(location, count, v); + glUniform1fv(location, count, v); mValue[location] = vec; } } @@ -1587,7 +1587,7 @@ void LLGLSLShader::uniform2fv(const LLStaticHashedString& uniform, U32 count, co LLVector4 vec(v[0],v[1],0.f,0.f); if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1) { - glUniform2fvARB(location, count, v); + glUniform2fv(location, count, v); mValue[location] = vec; } } @@ -1603,7 +1603,7 @@ void LLGLSLShader::uniform3fv(const LLStaticHashedString& uniform, U32 count, co LLVector4 vec(v[0],v[1],v[2],0.f); if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1) { - glUniform3fvARB(location, count, v); + glUniform3fv(location, count, v); mValue[location] = vec; } } @@ -1620,7 +1620,7 @@ void LLGLSLShader::uniform4fv(const LLStaticHashedString& uniform, U32 count, co if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1) { LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; - glUniform4fvARB(location, count, v); + glUniform4fv(location, count, v); mValue[location] = vec; } } @@ -1633,7 +1633,7 @@ void LLGLSLShader::uniformMatrix4fv(const LLStaticHashedString& uniform, U32 cou if (location >= 0) { stop_glerror(); - glUniformMatrix4fvARB(location, count, transpose, v); + glUniformMatrix4fv(location, count, transpose, v); stop_glerror(); } } -- cgit v1.2.3 From e155e53b290f638d853ed3a027c2c8f064ff8201 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Wed, 6 Sep 2023 09:57:22 +0800 Subject: Core profile vertex attribute related functions replacing legacy ARB versions. --- indra/llrender/llglslshader.cpp | 4 +-- indra/llrender/llvertexbuffer.cpp | 58 +++++++++++++++++++-------------------- 2 files changed, 31 insertions(+), 31 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index c402cab295..48bdfb6b51 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -1643,7 +1643,7 @@ void LLGLSLShader::vertexAttrib4f(U32 index, GLfloat x, GLfloat y, GLfloat z, GL { if (mAttribute[index] > 0) { - glVertexAttrib4fARB(mAttribute[index], x, y, z, w); + glVertexAttrib4f(mAttribute[index], x, y, z, w); } } @@ -1651,7 +1651,7 @@ void LLGLSLShader::vertexAttrib4fv(U32 index, GLfloat* v) { if (mAttribute[index] > 0) { - glVertexAttrib4fvARB(mAttribute[index], v); + glVertexAttrib4fv(mAttribute[index], v); } } diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index be3e6ddff0..a33436eb90 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -1338,7 +1338,7 @@ void LLVertexBuffer::setupVertexArray() { if (mTypeMask & (1 << i)) { - glEnableVertexAttribArrayARB(i); + glEnableVertexAttribArray(i); if (attrib_integer[i]) { @@ -1364,14 +1364,14 @@ void LLVertexBuffer::setupVertexArray() // pointer value. Ruslan asserts that in this case the last // param is interpreted as an array data offset within the VBO // rather than as an actual pointer, so it's okay. - glVertexAttribPointerARB(i, attrib_size[i], attrib_type[i], + glVertexAttribPointer(i, attrib_size[i], attrib_type[i], attrib_normalized[i], sTypeSize[i], reinterpret_cast(intptr_t(mOffsets[i]))); } } else { - glDisableVertexAttribArrayARB(i); + glDisableVertexAttribArray(i); } } @@ -2396,74 +2396,74 @@ void LLVertexBuffer::setupVertexBuffer(U32 data_mask) { S32 loc = TYPE_NORMAL; void* ptr = (void*)(base + mOffsets[TYPE_NORMAL]); - glVertexAttribPointerARB(loc, 3, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_NORMAL], ptr); + glVertexAttribPointer(loc, 3, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_NORMAL], ptr); } if (data_mask & MAP_TEXCOORD3) { S32 loc = TYPE_TEXCOORD3; void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD3]); - glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD3], ptr); + glVertexAttribPointer(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD3], ptr); } if (data_mask & MAP_TEXCOORD2) { S32 loc = TYPE_TEXCOORD2; void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD2]); - glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD2], ptr); + glVertexAttribPointer(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD2], ptr); } if (data_mask & MAP_TEXCOORD1) { S32 loc = TYPE_TEXCOORD1; void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD1]); - glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD1], ptr); + glVertexAttribPointer(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD1], ptr); } if (data_mask & MAP_TANGENT) { S32 loc = TYPE_TANGENT; void* ptr = (void*)(base + mOffsets[TYPE_TANGENT]); - glVertexAttribPointerARB(loc, 4,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TANGENT], ptr); + glVertexAttribPointer(loc, 4,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TANGENT], ptr); } if (data_mask & MAP_TEXCOORD0) { S32 loc = TYPE_TEXCOORD0; void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD0]); - glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD0], ptr); + glVertexAttribPointer(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD0], ptr); } if (data_mask & MAP_COLOR) { S32 loc = TYPE_COLOR; //bind emissive instead of color pointer if emissive is present void* ptr = (data_mask & MAP_EMISSIVE) ? (void*)(base + mOffsets[TYPE_EMISSIVE]) : (void*)(base + mOffsets[TYPE_COLOR]); - glVertexAttribPointerARB(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_COLOR], ptr); + glVertexAttribPointer(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_COLOR], ptr); } if (data_mask & MAP_EMISSIVE) { S32 loc = TYPE_EMISSIVE; void* ptr = (void*)(base + mOffsets[TYPE_EMISSIVE]); - glVertexAttribPointerARB(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr); + glVertexAttribPointer(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr); if (!(data_mask & MAP_COLOR)) { //map emissive to color channel when color is not also being bound to avoid unnecessary shader swaps loc = TYPE_COLOR; - glVertexAttribPointerARB(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr); + glVertexAttribPointer(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr); } } if (data_mask & MAP_WEIGHT) { S32 loc = TYPE_WEIGHT; void* ptr = (void*)(base + mOffsets[TYPE_WEIGHT]); - glVertexAttribPointerARB(loc, 1, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT], ptr); + glVertexAttribPointer(loc, 1, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT], ptr); } if (data_mask & MAP_WEIGHT4) { S32 loc = TYPE_WEIGHT4; void* ptr = (void*)(base+mOffsets[TYPE_WEIGHT4]); - glVertexAttribPointerARB(loc, 4, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT4], ptr); + glVertexAttribPointer(loc, 4, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT4], ptr); } if (data_mask & MAP_CLOTHWEIGHT) { S32 loc = TYPE_CLOTHWEIGHT; void* ptr = (void*)(base + mOffsets[TYPE_CLOTHWEIGHT]); - glVertexAttribPointerARB(loc, 4, GL_FLOAT, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_CLOTHWEIGHT], ptr); + glVertexAttribPointer(loc, 4, GL_FLOAT, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_CLOTHWEIGHT], ptr); } if (data_mask & MAP_TEXTURE_INDEX && (gGLManager.mGLSLVersionMajor >= 2 || gGLManager.mGLSLVersionMinor >= 30)) //indexed texture rendering requires GLSL 1.30 or later @@ -2478,7 +2478,7 @@ void LLVertexBuffer::setupVertexBuffer(U32 data_mask) { S32 loc = TYPE_VERTEX; void* ptr = (void*)(base + mOffsets[TYPE_VERTEX]); - glVertexAttribPointerARB(loc, 3,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr); + glVertexAttribPointer(loc, 3,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr); } llglassertok(); @@ -2492,74 +2492,74 @@ void LLVertexBuffer::setupVertexBufferFast(U32 data_mask) { S32 loc = TYPE_NORMAL; void* ptr = (void*)(base + mOffsets[TYPE_NORMAL]); - glVertexAttribPointerARB(loc, 3, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_NORMAL], ptr); + glVertexAttribPointer(loc, 3, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_NORMAL], ptr); } if (data_mask & MAP_TEXCOORD3) { S32 loc = TYPE_TEXCOORD3; void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD3]); - glVertexAttribPointerARB(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD3], ptr); + glVertexAttribPointer(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD3], ptr); } if (data_mask & MAP_TEXCOORD2) { S32 loc = TYPE_TEXCOORD2; void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD2]); - glVertexAttribPointerARB(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD2], ptr); + glVertexAttribPointer(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD2], ptr); } if (data_mask & MAP_TEXCOORD1) { S32 loc = TYPE_TEXCOORD1; void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD1]); - glVertexAttribPointerARB(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD1], ptr); + glVertexAttribPointer(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD1], ptr); } if (data_mask & MAP_TANGENT) { S32 loc = TYPE_TANGENT; void* ptr = (void*)(base + mOffsets[TYPE_TANGENT]); - glVertexAttribPointerARB(loc, 4, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TANGENT], ptr); + glVertexAttribPointer(loc, 4, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TANGENT], ptr); } if (data_mask & MAP_TEXCOORD0) { S32 loc = TYPE_TEXCOORD0; void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD0]); - glVertexAttribPointerARB(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD0], ptr); + glVertexAttribPointer(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD0], ptr); } if (data_mask & MAP_COLOR) { S32 loc = TYPE_COLOR; //bind emissive instead of color pointer if emissive is present void* ptr = (data_mask & MAP_EMISSIVE) ? (void*)(base + mOffsets[TYPE_EMISSIVE]) : (void*)(base + mOffsets[TYPE_COLOR]); - glVertexAttribPointerARB(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_COLOR], ptr); + glVertexAttribPointer(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_COLOR], ptr); } if (data_mask & MAP_EMISSIVE) { S32 loc = TYPE_EMISSIVE; void* ptr = (void*)(base + mOffsets[TYPE_EMISSIVE]); - glVertexAttribPointerARB(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr); + glVertexAttribPointer(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr); if (!(data_mask & MAP_COLOR)) { //map emissive to color channel when color is not also being bound to avoid unnecessary shader swaps loc = TYPE_COLOR; - glVertexAttribPointerARB(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr); + glVertexAttribPointer(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr); } } if (data_mask & MAP_WEIGHT) { S32 loc = TYPE_WEIGHT; void* ptr = (void*)(base + mOffsets[TYPE_WEIGHT]); - glVertexAttribPointerARB(loc, 1, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT], ptr); + glVertexAttribPointer(loc, 1, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT], ptr); } if (data_mask & MAP_WEIGHT4) { S32 loc = TYPE_WEIGHT4; void* ptr = (void*)(base + mOffsets[TYPE_WEIGHT4]); - glVertexAttribPointerARB(loc, 4, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT4], ptr); + glVertexAttribPointer(loc, 4, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT4], ptr); } if (data_mask & MAP_CLOTHWEIGHT) { S32 loc = TYPE_CLOTHWEIGHT; void* ptr = (void*)(base + mOffsets[TYPE_CLOTHWEIGHT]); - glVertexAttribPointerARB(loc, 4, GL_FLOAT, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_CLOTHWEIGHT], ptr); + glVertexAttribPointer(loc, 4, GL_FLOAT, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_CLOTHWEIGHT], ptr); } if (data_mask & MAP_TEXTURE_INDEX) { @@ -2573,7 +2573,7 @@ void LLVertexBuffer::setupVertexBufferFast(U32 data_mask) { S32 loc = TYPE_VERTEX; void* ptr = (void*)(base + mOffsets[TYPE_VERTEX]); - glVertexAttribPointerARB(loc, 3, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr); + glVertexAttribPointer(loc, 3, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr); } } -- cgit v1.2.3 From f6b4f7bfd6c338c44dfbfb07479113075172d929 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Wed, 6 Sep 2023 10:04:56 +0800 Subject: Left out from previous commit --- indra/llrender/llvertexbuffer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index a33436eb90..b48c4f8262 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -451,14 +451,14 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask) { //was enabled if (!(data_mask & mask)) { //needs to be disabled - glDisableVertexAttribArrayARB(loc); + glDisableVertexAttribArray(loc); } } else { //was disabled if (data_mask & mask) { //needs to be enabled - glEnableVertexAttribArrayARB(loc); + glEnableVertexAttribArray(loc); } } } -- cgit v1.2.3 From 5c3c491537e58cb884b74694cc7453eef89d8515 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Wed, 6 Sep 2023 10:17:38 +0800 Subject: Core profile buffer related functions replacing their legacy ARB counterparts. --- indra/llrender/llrendertarget.cpp | 2 +- indra/llrender/llvertexbuffer.cpp | 66 +++++++++++++++++++-------------------- 2 files changed, 34 insertions(+), 34 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index f73aab8d23..005a7cfa97 100644 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -485,7 +485,7 @@ void LLRenderTarget::bindTarget() GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT3}; LL_PROFILER_GPU_ZONEC( "gl.DrawBuffersARB", 0x4000FF ) - glDrawBuffersARB(mTex.size(), drawbuffers); + glDrawBuffers(mTex.size(), drawbuffers); } if (mTex.empty()) diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index b48c4f8262..44107d2957 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -127,7 +127,7 @@ U32 LLVBOPool::genBuffer() if (sNameIdx == 0) { - glGenBuffersARB(1024, sNamePool); + glGenBuffers(1024, sNamePool); sNameIdx = 1024; } @@ -141,11 +141,11 @@ void LLVBOPool::deleteBuffer(U32 name) { LLVertexBuffer::unbind(); - glBindBufferARB(mType, name); - glBufferDataARB(mType, 0, NULL, mUsage); - glBindBufferARB(mType, 0); + glBindBuffer(mType, name); + glBufferData(mType, 0, NULL, mUsage); + glBindBuffer(mType, 0); - glDeleteBuffersARB(1, &name); + glDeleteBuffers(1, &name); } } @@ -176,7 +176,7 @@ U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed) //make a new buffer name = genBuffer(); - glBindBufferARB(mType, name); + glBindBuffer(mType, name); if (!for_seed && i < LL_VBO_POOL_SEED_COUNT) { //record this miss @@ -194,7 +194,7 @@ U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed) if (LLVertexBuffer::sDisableVBOMapping || mUsage != GL_DYNAMIC_DRAW_ARB) { - glBufferDataARB(mType, size, 0, mUsage); + glBufferData(mType, size, 0, mUsage); if (mUsage != GL_DYNAMIC_COPY_ARB) { //data will be provided by application ret = (U8*) ll_aligned_malloc<64>(size); @@ -212,10 +212,10 @@ U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed) } else { //always use a true hint of static draw when allocating non-client-backed buffers - glBufferDataARB(mType, size, 0, GL_STATIC_DRAW_ARB); + glBufferData(mType, size, 0, GL_STATIC_DRAW); } - glBindBufferARB(mType, 0); + glBindBuffer(mType, 0); if (for_seed) { //put into pool for future use @@ -767,12 +767,12 @@ void LLVertexBuffer::unbind() if (sVBOActive) { - glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); + glBindBuffer(GL_ARRAY_BUFFER, 0); sVBOActive = false; } if (sIBOActive) { - glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); sIBOActive = false; } @@ -1516,7 +1516,7 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran if (gDebugGL) { GLint size = 0; - glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &size); + glGetBufferParameteriv(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, &size); if (size < mSize) { @@ -1537,18 +1537,18 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran #ifndef LL_MESA_HEADLESS glBufferParameteriAPPLE(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SERIALIZED_MODIFY_APPLE, GL_FALSE); glBufferParameteriAPPLE(GL_ARRAY_BUFFER_ARB, GL_BUFFER_FLUSHING_UNMAP_APPLE, GL_FALSE); + src = (U8*) glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY); #endif - src = (U8*) glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); } else { - src = (U8*) glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); + src = (U8*) glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY); } } else { map_range = false; - src = (U8*) glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); + src = (U8*) glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY); } llassert(src != NULL); @@ -1572,7 +1572,7 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran //print out more debug info before crash LL_INFOS() << "vertex buffer size: (num verts : num indices) = " << getNumVerts() << " : " << getNumIndices() << LL_ENDL; GLint size; - glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &size); + glGetBufferParameteriv(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, &size); LL_INFOS() << "GL_ARRAY_BUFFER_ARB size is " << size << LL_ENDL; //-------------------- @@ -1710,18 +1710,18 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range) #ifndef LL_MESA_HEADLESS glBufferParameteriAPPLE(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_BUFFER_SERIALIZED_MODIFY_APPLE, GL_FALSE); glBufferParameteriAPPLE(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_BUFFER_FLUSHING_UNMAP_APPLE, GL_FALSE); + src = (U8*) glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY); #endif - src = (U8*) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); } else { - src = (U8*) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); + src = (U8*) glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY); } } else { map_range = false; - src = (U8*) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); + src = (U8*) glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY); } llassert(src != NULL); @@ -1797,12 +1797,12 @@ void LLVertexBuffer::unmapBuffer() S32 length = sTypeSize[region.mType]*region.mCount; if (mSize >= length + offset) { - glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, offset, length, (U8*)mMappedData + offset); + glBufferSubData(GL_ARRAY_BUFFER, offset, length, (U8*)mMappedData + offset); } else { GLint size = 0; - glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &size); + glGetBufferParameteriv(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, &size); LL_WARNS() << "Attempted to map regions to a buffer that is too small, " << "mapped size: " << mSize << ", gl buffer size: " << size @@ -1818,7 +1818,7 @@ void LLVertexBuffer::unmapBuffer() else { stop_glerror(); - glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, getSize(), (U8*) mMappedData); + glBufferSubData(GL_ARRAY_BUFFER, 0, getSize(), (U8*) mMappedData); stop_glerror(); } } @@ -1852,7 +1852,7 @@ void LLVertexBuffer::unmapBuffer() } } stop_glerror(); - glUnmapBufferARB(GL_ARRAY_BUFFER_ARB); + glUnmapBuffer(GL_ARRAY_BUFFER); stop_glerror(); mMappedData = NULL; @@ -1877,12 +1877,12 @@ void LLVertexBuffer::unmapBuffer() S32 length = sizeof(U16)*region.mCount; if (mIndicesSize >= length + offset) { - glBufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length, (U8*) mMappedIndexData+offset); + glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, offset, length, (U8*) mMappedIndexData+offset); } else { GLint size = 0; - glGetBufferParameterivARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &size); + glGetBufferParameteriv(GL_ELEMENT_ARRAY_BUFFER, GL_BUFFER_SIZE, &size); LL_WARNS() << "Attempted to map regions to a buffer that is too small, " << "mapped size: " << mIndicesSize << ", gl buffer size: " << size @@ -1898,7 +1898,7 @@ void LLVertexBuffer::unmapBuffer() else { stop_glerror(); - glBufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0, getIndicesSize(), (U8*) mMappedIndexData); + glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, getIndicesSize(), (U8*) mMappedIndexData); stop_glerror(); } } @@ -1935,7 +1935,7 @@ void LLVertexBuffer::unmapBuffer() } } - glUnmapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB); + glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER); mMappedIndexData = NULL; } @@ -2089,7 +2089,7 @@ bool LLVertexBuffer::bindGLBuffer(bool force_bind) if (useVBOs() && (force_bind || (mGLBuffer && (mGLBuffer != sGLRenderBuffer || !sVBOActive)))) { LL_PROFILE_ZONE_SCOPED_CATEGORY_VERTEX; - glBindBufferARB(GL_ARRAY_BUFFER_ARB, mGLBuffer); + glBindBuffer(GL_ARRAY_BUFFER, mGLBuffer); sGLRenderBuffer = mGLBuffer; sBindCount++; sVBOActive = true; @@ -2106,7 +2106,7 @@ bool LLVertexBuffer::bindGLBufferFast() { if (mGLBuffer != sGLRenderBuffer || !sVBOActive) { - glBindBufferARB(GL_ARRAY_BUFFER_ARB, mGLBuffer); + glBindBuffer(GL_ARRAY_BUFFER, mGLBuffer); sGLRenderBuffer = mGLBuffer; sBindCount++; sVBOActive = true; @@ -2129,7 +2129,7 @@ bool LLVertexBuffer::bindGLIndices(bool force_bind) { LL_ERRS() << "VBO bound while another VBO mapped!" << LL_ENDL; }*/ - glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, mGLIndices); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mGLIndices); sGLRenderIndices = mGLIndices; stop_glerror(); sBindCount++; @@ -2144,7 +2144,7 @@ bool LLVertexBuffer::bindGLIndicesFast() { if (mGLIndices != sGLRenderIndices || !sIBOActive) { - glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, mGLIndices); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mGLIndices); sGLRenderIndices = mGLIndices; sBindCount++; sIBOActive = true; @@ -2306,7 +2306,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask) { if (sVBOActive) { - glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); + glBindBuffer(GL_ARRAY_BUFFER, 0); sBindCount++; sVBOActive = false; setup = true; // ... or a VBO is deactivated @@ -2321,7 +2321,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask) { if (sIBOActive) { - glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); sBindCount++; sIBOActive = false; } -- cgit v1.2.3 From b87cfc3c7eb9e5ea38d2805bfce7f2facc57bd21 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Wed, 6 Sep 2023 10:29:21 +0800 Subject: Core profile query related functions replacing their legacy ARB counterparts. --- indra/llrender/llglslshader.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 48bdfb6b51..d18ee6d947 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -230,8 +230,8 @@ void LLGLSLShader::placeProfileQuery() #if !LL_DARWIN if (mTimerQuery == 0) { - glGenQueriesARB(1, &mSamplesQuery); - glGenQueriesARB(1, &mTimerQuery); + glGenQueries(1, &mSamplesQuery); + glGenQueries(1, &mTimerQuery); } if (!mTextureStateFetched) @@ -267,16 +267,24 @@ void LLGLSLShader::placeProfileQuery() } - glBeginQueryARB(GL_SAMPLES_PASSED, mSamplesQuery); - glBeginQueryARB(GL_TIME_ELAPSED, mTimerQuery); +#if GL_VERSION_1_5 + glBeginQuery(GL_SAMPLES_PASSED, mSamplesQuery); +#if GL_VERSION_3_3 + glBeginQuery(GL_TIME_ELAPSED, mTimerQuery); +#endif // GL_VERSION_3_3 +#endif // GL_VERSION_1_5 #endif } void LLGLSLShader::readProfileQuery(U32 count, U32 mode) { #if !LL_DARWIN - glEndQueryARB(GL_TIME_ELAPSED); - glEndQueryARB(GL_SAMPLES_PASSED); +#if GL_VERSION_1_5 +#if GL_VERSION_3_3 + glEndQuery(GL_TIME_ELAPSED); +#endif // GL_VERSION_3_3 + glEndQuery(GL_SAMPLES_PASSED); +#endif // GL_VERSION_1_5 GLuint64 time_elapsed = 0; glGetQueryObjectui64v(mTimerQuery, GL_QUERY_RESULT, &time_elapsed); @@ -364,13 +372,13 @@ void LLGLSLShader::unloadInternal() if (mTimerQuery) { - glDeleteQueriesARB(1, &mTimerQuery); + glDeleteQueries(1, &mTimerQuery); mTimerQuery = 0; } if (mSamplesQuery) { - glDeleteQueriesARB(1, &mSamplesQuery); + glDeleteQueries(1, &mSamplesQuery); mSamplesQuery = 0; } -- cgit v1.2.3 From 93a309edb2e824514b832f0970ca1927522afc63 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Wed, 6 Sep 2023 10:38:13 +0800 Subject: Some GL_VERSION_2_0 sampler implementor only code preprocessed so it doesn't get compiled on non implementors. --- indra/llrender/llglslshader.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index d18ee6d947..308ec1a771 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -793,7 +793,10 @@ GLint LLGLSLShader::mapUniformTextureChannel(GLint location, GLenum type) { LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; - if ((type >= GL_SAMPLER_1D_ARB && type <= GL_SAMPLER_2D_RECT_SHADOW_ARB) || + if ( +#if GL_VERSION_2_0 + (type >= GL_SAMPLER_1D_ARB && type <= GL_SAMPLER_2D_RECT_SHADOW_ARB) || +#endif type == GL_SAMPLER_2D_MULTISAMPLE) { //this here is a texture glUniform1i(location, mActiveTextureChannels); -- 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/llatmosphere.cpp | 8 ++--- indra/llrender/llcubemap.cpp | 12 +++---- indra/llrender/llgl.cpp | 6 ++-- indra/llrender/llrender.cpp | 18 +++++----- indra/llrender/llshadermgr.cpp | 8 ++--- indra/llrender/llvertexbuffer.cpp | 76 +++++++++++++++++++-------------------- indra/llrender/llvertexbuffer.h | 2 +- 7 files changed, 65 insertions(+), 65 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llatmosphere.cpp b/indra/llrender/llatmosphere.cpp index ffc17c89f8..8e37ca9b90 100644 --- a/indra/llrender/llatmosphere.cpp +++ b/indra/llrender/llatmosphere.cpp @@ -241,7 +241,7 @@ LLGLTexture* LLAtmosphere::getTransmittance() m_transmittance->generateGLTexture(); m_transmittance->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP); m_transmittance->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); - m_transmittance->setExplicitFormat(GL_RGB32F_ARB, GL_RGB, GL_FLOAT); + m_transmittance->setExplicitFormat(GL_RGB32F, GL_RGB, GL_FLOAT); m_transmittance->setTarget(GL_TEXTURE_2D, LLTexUnit::TT_TEXTURE); } return m_transmittance; @@ -255,7 +255,7 @@ LLGLTexture* LLAtmosphere::getScattering() m_scattering->generateGLTexture(); m_scattering->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP); m_scattering->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); - m_scattering->setExplicitFormat(GL_RGB16F_ARB, GL_RGB, GL_FLOAT); + m_scattering->setExplicitFormat(GL_RGB16F, GL_RGB, GL_FLOAT); m_scattering->setTarget(GL_TEXTURE_3D, LLTexUnit::TT_TEXTURE_3D); } return m_scattering; @@ -269,7 +269,7 @@ LLGLTexture* LLAtmosphere::getMieScattering() m_mie_scatter_texture->generateGLTexture(); m_mie_scatter_texture->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP); m_mie_scatter_texture->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); - m_mie_scatter_texture->setExplicitFormat(GL_RGB16F_ARB, GL_RGB, GL_FLOAT); + m_mie_scatter_texture->setExplicitFormat(GL_RGB16F, GL_RGB, GL_FLOAT); m_mie_scatter_texture->setTarget(GL_TEXTURE_3D, LLTexUnit::TT_TEXTURE_3D); } return m_mie_scatter_texture; @@ -283,7 +283,7 @@ LLGLTexture* LLAtmosphere::getIlluminance() m_illuminance->generateGLTexture(); m_illuminance->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP); m_illuminance->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); - m_illuminance->setExplicitFormat(GL_RGB32F_ARB, GL_RGB, GL_FLOAT); + m_illuminance->setExplicitFormat(GL_RGB32F, GL_RGB, GL_FLOAT); m_illuminance->setTarget(GL_TEXTURE_2D, LLTexUnit::TT_TEXTURE); } return m_illuminance; diff --git a/indra/llrender/llcubemap.cpp b/indra/llrender/llcubemap.cpp index 834084674e..ad2a4203ba 100644 --- a/indra/llrender/llcubemap.cpp +++ b/indra/llrender/llcubemap.cpp @@ -50,12 +50,12 @@ LLCubeMap::LLCubeMap(bool init_as_srgb) mMatrixStage(0), mIssRGB(init_as_srgb) { - mTargets[0] = GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB; - mTargets[1] = GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB; - mTargets[2] = GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB; - mTargets[3] = GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB; - mTargets[4] = GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB; - mTargets[5] = GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB; + mTargets[0] = GL_TEXTURE_CUBE_MAP_NEGATIVE_X; + mTargets[1] = GL_TEXTURE_CUBE_MAP_POSITIVE_X; + mTargets[2] = GL_TEXTURE_CUBE_MAP_NEGATIVE_Y; + mTargets[3] = GL_TEXTURE_CUBE_MAP_POSITIVE_Y; + mTargets[4] = GL_TEXTURE_CUBE_MAP_NEGATIVE_Z; + mTargets[5] = GL_TEXTURE_CUBE_MAP_POSITIVE_Z; } LLCubeMap::~LLCubeMap() diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 729e8a5f28..6ae5b0e94b 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -720,7 +720,7 @@ bool LLGLManager::initGL() stop_glerror(); GLint num_tex_image_units; - glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &num_tex_image_units); + glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &num_tex_image_units); mNumTextureImageUnits = llmin(num_tex_image_units, 32); if (mHasMultitexture) @@ -1593,8 +1593,8 @@ void LLGLState::initClass() // sStateMap[GL_TEXTURE_2D] = GL_TRUE; //make sure multisample defaults to disabled - sStateMap[GL_MULTISAMPLE_ARB] = GL_FALSE; - glDisable(GL_MULTISAMPLE_ARB); + sStateMap[GL_MULTISAMPLE_EXT] = GL_FALSE; + glDisable(GL_MULTISAMPLE_EXT); } //static 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; } } diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index ff547d9d47..bb3ded0229 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -748,7 +748,7 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev extra_code_text[extra_code_count++] = strdup("#define ATTRIBUTE in\n"); - if (type == GL_VERTEX_SHADER_ARB) + if (type == GL_VERTEX_SHADER) { //"varying" state is "out" in a vertex program, "in" in a fragment program // ("varying" is deprecated after version 1.20) extra_code_text[extra_code_count++] = strdup("#define VARYING out\n"); @@ -787,7 +787,7 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev extra_code_text[extra_code_count++] = strdup( "#define IS_AMD_CARD 1\n" ); } - if (texture_index_channels > 0 && type == GL_FRAGMENT_SHADER_ARB) + if (texture_index_channels > 0 && type == GL_FRAGMENT_SHADER) { //use specified number of texture channels for indexed texture rendering @@ -1022,10 +1022,10 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev if (ret) { // Add shader file to map - if (type == GL_VERTEX_SHADER_ARB) { + if (type == GL_VERTEX_SHADER) { mVertexShaderObjects[filename] = ret; } - else if (type == GL_FRAGMENT_SHADER_ARB) { + else if (type == GL_FRAGMENT_SHADER) { mFragmentShaderObjects[filename] = ret; } shader_level = try_gpu_class; diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 44107d2957..1893764cab 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -83,11 +83,11 @@ const U32 LL_VBO_POOL_SEED_COUNT = vbo_block_index(LL_VBO_POOL_MAX_SEED_SIZE); //============================================================================ //static -LLVBOPool LLVertexBuffer::sStreamVBOPool(GL_STREAM_DRAW_ARB, GL_ARRAY_BUFFER_ARB); -LLVBOPool LLVertexBuffer::sDynamicVBOPool(GL_DYNAMIC_DRAW_ARB, GL_ARRAY_BUFFER_ARB); -LLVBOPool LLVertexBuffer::sDynamicCopyVBOPool(GL_DYNAMIC_COPY_ARB, GL_ARRAY_BUFFER_ARB); -LLVBOPool LLVertexBuffer::sStreamIBOPool(GL_STREAM_DRAW_ARB, GL_ELEMENT_ARRAY_BUFFER_ARB); -LLVBOPool LLVertexBuffer::sDynamicIBOPool(GL_DYNAMIC_DRAW_ARB, GL_ELEMENT_ARRAY_BUFFER_ARB); +LLVBOPool LLVertexBuffer::sStreamVBOPool(GL_STREAM_DRAW, GL_ARRAY_BUFFER); +LLVBOPool LLVertexBuffer::sDynamicVBOPool(GL_DYNAMIC_DRAW, GL_ARRAY_BUFFER); +LLVBOPool LLVertexBuffer::sDynamicCopyVBOPool(GL_DYNAMIC_COPY, GL_ARRAY_BUFFER); +LLVBOPool LLVertexBuffer::sStreamIBOPool(GL_STREAM_DRAW, GL_ELEMENT_ARRAY_BUFFER); +LLVBOPool LLVertexBuffer::sDynamicIBOPool(GL_DYNAMIC_DRAW, GL_ELEMENT_ARRAY_BUFFER); U32 LLVBOPool::sBytesPooled = 0; U32 LLVBOPool::sIndexBytesPooled = 0; @@ -183,7 +183,7 @@ U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed) mMissCount[i]++; } - if (mType == GL_ARRAY_BUFFER_ARB) + if (mType == GL_ARRAY_BUFFER) { LLVertexBuffer::sAllocatedBytes += size; } @@ -192,10 +192,10 @@ U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed) LLVertexBuffer::sAllocatedIndexBytes += size; } - if (LLVertexBuffer::sDisableVBOMapping || mUsage != GL_DYNAMIC_DRAW_ARB) + if (LLVertexBuffer::sDisableVBOMapping || mUsage != GL_DYNAMIC_DRAW) { glBufferData(mType, size, 0, mUsage); - if (mUsage != GL_DYNAMIC_COPY_ARB) + if (mUsage != GL_DYNAMIC_COPY) { //data will be provided by application ret = (U8*) ll_aligned_malloc<64>(size); if (!ret) @@ -225,7 +225,7 @@ U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed) rec.mGLName = name; rec.mClientData = ret; - if (mType == GL_ARRAY_BUFFER_ARB) + if (mType == GL_ARRAY_BUFFER) { sBytesPooled += size; } @@ -241,7 +241,7 @@ U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed) name = mFreeList[i].front().mGLName; ret = mFreeList[i].front().mClientData; - if (mType == GL_ARRAY_BUFFER_ARB) + if (mType == GL_ARRAY_BUFFER) { sBytesPooled -= size; } @@ -263,7 +263,7 @@ void LLVBOPool::release(U32 name, U8* buffer, U32 size) deleteBuffer(name); ll_aligned_free_fallback((U8*) buffer); - if (mType == GL_ARRAY_BUFFER_ARB) + if (mType == GL_ARRAY_BUFFER) { LLVertexBuffer::sAllocatedBytes -= size; } @@ -322,7 +322,7 @@ void LLVBOPool::cleanup() l.pop_front(); - if (mType == GL_ARRAY_BUFFER_ARB) + if (mType == GL_ARRAY_BUFFER) { sBytesPooled -= size; LLVertexBuffer::sAllocatedBytes -= size; @@ -606,7 +606,7 @@ void LLVertexBuffer::drawRange(U32 mode, U32 start, U32 end, U32 count, U32 indi if (gDebugGL && !mGLArray && useVBOs()) { GLint elem = 0; - glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &elem); + glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &elem); if (elem != mGLIndices) { @@ -805,32 +805,32 @@ S32 LLVertexBuffer::determineUsage(S32 usage) ret_usage = 0; } - if (ret_usage == GL_STREAM_DRAW_ARB && !sUseStreamDraw) + if (ret_usage == GL_STREAM_DRAW && !sUseStreamDraw) { ret_usage = 0; } - if (ret_usage == GL_DYNAMIC_DRAW_ARB && sPreferStreamDraw) + if (ret_usage == GL_DYNAMIC_DRAW && sPreferStreamDraw) { - ret_usage = GL_STREAM_DRAW_ARB; + ret_usage = GL_STREAM_DRAW; } if (ret_usage == 0 && LLRender::sGLCoreProfile) { //MUST use VBOs for all rendering - ret_usage = GL_STREAM_DRAW_ARB; + ret_usage = GL_STREAM_DRAW; } - if (ret_usage && ret_usage != GL_STREAM_DRAW_ARB) + if (ret_usage && ret_usage != GL_STREAM_DRAW) { //only stream_draw and dynamic_draw are supported when using VBOs, dynamic draw is the default - if (ret_usage != GL_DYNAMIC_COPY_ARB) + if (ret_usage != GL_DYNAMIC_COPY) { if (sDisableVBOMapping) { //always use stream draw if VBO mapping is disabled - ret_usage = GL_STREAM_DRAW_ARB; + ret_usage = GL_STREAM_DRAW; } else { - ret_usage = GL_DYNAMIC_DRAW_ARB; + ret_usage = GL_DYNAMIC_DRAW; } } } @@ -863,7 +863,7 @@ LLVertexBuffer::LLVertexBuffer(U32 typemask, S32 usage) mMappable(false), mFence(NULL) { - mMappable = (mUsage == GL_DYNAMIC_DRAW_ARB && !sDisableVBOMapping); + mMappable = (mUsage == GL_DYNAMIC_DRAW && !sDisableVBOMapping); //zero out offsets for (U32 i = 0; i < TYPE_MAX; i++) @@ -986,11 +986,11 @@ void LLVertexBuffer::genBuffer(U32 size) { mSize = vbo_block_size(size); - if (mUsage == GL_STREAM_DRAW_ARB) + if (mUsage == GL_STREAM_DRAW) { mMappedData = sStreamVBOPool.allocate(mGLBuffer, mSize); } - else if (mUsage == GL_DYNAMIC_DRAW_ARB) + else if (mUsage == GL_DYNAMIC_DRAW) { mMappedData = sDynamicVBOPool.allocate(mGLBuffer, mSize); } @@ -1007,7 +1007,7 @@ void LLVertexBuffer::genIndices(U32 size) { mIndicesSize = vbo_block_size(size); - if (mUsage == GL_STREAM_DRAW_ARB) + if (mUsage == GL_STREAM_DRAW) { mMappedIndexData = sStreamIBOPool.allocate(mGLIndices, mIndicesSize); } @@ -1021,7 +1021,7 @@ void LLVertexBuffer::genIndices(U32 size) void LLVertexBuffer::releaseBuffer() { - if (mUsage == GL_STREAM_DRAW_ARB) + if (mUsage == GL_STREAM_DRAW) { sStreamVBOPool.release(mGLBuffer, mMappedData, mSize); } @@ -1038,7 +1038,7 @@ void LLVertexBuffer::releaseBuffer() void LLVertexBuffer::releaseIndices() { - if (mUsage == GL_STREAM_DRAW_ARB) + if (mUsage == GL_STREAM_DRAW) { sStreamIBOPool.release(mGLIndices, mMappedIndexData, mIndicesSize); } @@ -1503,7 +1503,7 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran #ifdef GL_ARB_map_buffer_range S32 offset = mOffsets[type] + sTypeSize[type]*index; S32 length = (sTypeSize[type]*count+0xF) & ~0xF; - src = (U8*) glMapBufferRange(GL_ARRAY_BUFFER_ARB, offset, length, + src = (U8*) glMapBufferRange(GL_ARRAY_BUFFER, offset, length, GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT | GL_MAP_INVALIDATE_RANGE_BIT); @@ -1524,7 +1524,7 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran } } - src = (U8*) glMapBufferRange(GL_ARRAY_BUFFER_ARB, 0, mSize, + src = (U8*) glMapBufferRange(GL_ARRAY_BUFFER, 0, mSize, GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT); #endif @@ -1577,7 +1577,7 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran //-------------------- GLint buff; - glGetIntegerv(GL_ARRAY_BUFFER_BINDING_ARB, &buff); + glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &buff); if ((GLuint)buff != mGLBuffer) { LL_ERRS() << "Invalid GL vertex buffer bound: " << buff << LL_ENDL; @@ -1665,7 +1665,7 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range) if (gDebugGL && useVBOs()) { GLint elem = 0; - glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &elem); + glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &elem); if (elem != mGLIndices) { @@ -1688,7 +1688,7 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range) #ifdef GL_ARB_map_buffer_range S32 offset = sizeof(U16)*index; S32 length = sizeof(U16)*count; - src = (U8*) glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length, + src = (U8*) glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER, offset, length, GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT | GL_MAP_INVALIDATE_RANGE_BIT); @@ -1697,7 +1697,7 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range) else { #ifdef GL_ARB_map_buffer_range - src = (U8*) glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER_ARB, 0, sizeof(U16)*mNumIndices, + src = (U8*) glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER, 0, sizeof(U16)*mNumIndices, GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT); #endif @@ -1741,7 +1741,7 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range) if(mMappable) { GLint buff; - glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &buff); + glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &buff); if ((GLuint)buff != mGLIndices) { LL_ERRS() << "Invalid GL index buffer bound: " << buff << LL_ENDL; @@ -1837,7 +1837,7 @@ void LLVertexBuffer::unmapBuffer() if (gGLManager.mHasMapBufferRange) { #ifdef GL_ARB_map_buffer_range - glFlushMappedBufferRange(GL_ARRAY_BUFFER_ARB, offset, length); + glFlushMappedBufferRange(GL_ARRAY_BUFFER, offset, length); #endif } else if (gGLManager.mHasFlushBufferRange) @@ -1917,7 +1917,7 @@ void LLVertexBuffer::unmapBuffer() if (gGLManager.mHasMapBufferRange) { #ifdef GL_ARB_map_buffer_range - glFlushMappedBufferRange(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length); + glFlushMappedBufferRange(GL_ELEMENT_ARRAY_BUFFER, offset, length); #endif } else if (gGLManager.mHasFlushBufferRange) @@ -2258,7 +2258,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask) if (gDebugGL && !mGLArray) { GLint buff; - glGetIntegerv(GL_ARRAY_BUFFER_BINDING_ARB, &buff); + glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &buff); if ((GLuint)buff != mGLBuffer) { if (gDebugSession) @@ -2273,7 +2273,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask) if (mGLIndices) { - glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &buff); + glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &buff); if ((GLuint)buff != mGLIndices) { if (gDebugSession) diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h index 3b3fe44984..1dbf271436 100644 --- a/indra/llrender/llvertexbuffer.h +++ b/indra/llrender/llvertexbuffer.h @@ -287,7 +287,7 @@ public: U8* getMappedIndices() const { return mMappedIndexData; } S32 getOffset(S32 type) const { return mOffsets[type]; } S32 getUsage() const { return mUsage; } - bool isWriteable() const { return (mMappable || mUsage == GL_STREAM_DRAW_ARB) ? true : false; } + bool isWriteable() const { return (mMappable || mUsage == GL_STREAM_DRAW) ? true : false; } void draw(U32 mode, U32 count, U32 indices_offset) const; void drawArrays(U32 mode, U32 offset, U32 count) const; -- cgit v1.2.3 From 08a5f59f058ed362e287b1655a3c8c6efccd4abd Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Wed, 6 Sep 2023 11:00:15 +0800 Subject: Khronos debug as an alternative to ARB's --- indra/llrender/llgl.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 6ae5b0e94b..88e07972ff 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -72,7 +72,7 @@ static const std::string HEADLESS_VERSION_STRING("1.0"); llofstream gFailLog; -#if GL_ARB_debug_output +#if GL_ARB_debug_output || GL_KHR_debug #ifndef APIENTRY #define APIENTRY @@ -86,14 +86,24 @@ void APIENTRY gl_debug_callback(GLenum source, const GLchar* message, GLvoid* userParam) { +#if GL_ARB_debug_output if (severity != GL_DEBUG_SEVERITY_HIGH_ARB && severity != GL_DEBUG_SEVERITY_MEDIUM_ARB && severity != GL_DEBUG_SEVERITY_LOW_ARB) +#elif GL_KHR_debug + if (severity != GL_DEBUG_SEVERITY_HIGH_KHR && + severity != GL_DEBUG_SEVERITY_MEDIUM_KHR && + severity != GL_DEBUG_SEVERITY_LOW_KHR) +#endif { //suppress out-of-spec messages sent by nvidia driver (mostly vertexbuffer hints) return; } +#if GL_ARB_debug_output if (severity == GL_DEBUG_SEVERITY_HIGH_ARB) +#elif GL_KHR_debug + if (severity == GL_DEBUG_SEVERITY_HIGH_KHR) +#endif { LL_WARNS() << "----- GL ERROR --------" << LL_ENDL; } @@ -106,7 +116,11 @@ void APIENTRY gl_debug_callback(GLenum source, LL_WARNS() << "Severity: " << std::hex << severity << LL_ENDL; LL_WARNS() << "Message: " << message << LL_ENDL; LL_WARNS() << "-----------------------" << LL_ENDL; +#if GL_ARB_debug_output if (severity == GL_DEBUG_SEVERITY_HIGH_ARB) +#elif GL_KHR_debug + if (severity == GL_DEBUG_SEVERITY_HIGH_KHR) +#endif { LL_ERRS() << "Halting on GL Error" << LL_ENDL; } @@ -1060,7 +1074,11 @@ void LLGLManager::initExtensions() mHasBlendFuncSeparate = ExtensionExists("GL_EXT_blend_func_separate", gGLHExts.mSysExts); mHasTextureRectangle = ExtensionExists("GL_ARB_texture_rectangle", gGLHExts.mSysExts); mHasTextureMultisample = ExtensionExists("GL_ARB_texture_multisample", gGLHExts.mSysExts); +#if GL_ARB_debug_output mHasDebugOutput = ExtensionExists("GL_ARB_debug_output", gGLHExts.mSysExts); +#else + mHasDebugOutput = ExtensionExists("GL_KHR_debug", gGLHExts.mSysExts); +#endif mHasTransformFeedback = mGLVersion >= 4.f ? TRUE : FALSE; #if !LL_DARWIN mHasPointParameters = ExtensionExists("GL_ARB_point_parameters", gGLHExts.mSysExts); -- 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') 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 ++-- indra/llrender/llvertexbuffer.cpp | 28 ++++++++++++++-------------- 2 files changed, 16 insertions(+), 16 deletions(-) (limited to 'indra/llrender') 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) diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 1893764cab..6cc6078ec8 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -403,9 +403,9 @@ U32 LLVertexBuffer::getVAOName() } else { -#ifdef GL_ARB_vertex_array_object +//#ifdef GL_ARB_vertex_array_object glGenVertexArrays(1, &ret); -#endif +//#endif } return ret; @@ -757,9 +757,9 @@ void LLVertexBuffer::unbind() { if (sGLRenderArray) { -#if GL_ARB_vertex_array_object +//#if GL_ARB_vertex_array_object glBindVertexArray(0); -#endif +//#endif sGLRenderArray = 0; sGLRenderIndices = 0; sIBOActive = false; @@ -927,9 +927,9 @@ LLVertexBuffer::~LLVertexBuffer() if (mGLArray) { -#if GL_ARB_vertex_array_object +//#if GL_ARB_vertex_array_object releaseVAOName(mGLArray); -#endif +//#endif } sCount--; @@ -1240,9 +1240,9 @@ bool LLVertexBuffer::allocateBuffer(S32 nverts, S32 nindices, bool create) if (gGLManager.mHasVertexArrayObject && useVBOs() && sUseVAO) { -#if GL_ARB_vertex_array_object +//#if GL_ARB_vertex_array_object mGLArray = getVAOName(); -#endif +//#endif setupVertexArray(); } } @@ -1258,9 +1258,9 @@ void LLVertexBuffer::setupVertexArray() } LL_PROFILE_ZONE_SCOPED_CATEGORY_VERTEX; -#if GL_ARB_vertex_array_object +//#if GL_ARB_vertex_array_object glBindVertexArray(mGLArray); -#endif +//#endif sGLRenderArray = mGLArray; static const U32 attrib_size[] = @@ -2064,9 +2064,9 @@ bool LLVertexBuffer::bindGLArray() { { LL_PROFILE_ZONE_SCOPED_CATEGORY_VERTEX; -#if GL_ARB_vertex_array_object +//#if GL_ARB_vertex_array_object glBindVertexArray(mGLArray); -#endif +//#endif sGLRenderArray = mGLArray; } @@ -2294,9 +2294,9 @@ void LLVertexBuffer::setBuffer(U32 data_mask) { if (sGLRenderArray) { -#if GL_ARB_vertex_array_object +//#if GL_ARB_vertex_array_object glBindVertexArray(0); -#endif +//#endif sGLRenderArray = 0; sGLRenderIndices = 0; sIBOActive = false; -- cgit v1.2.3 From 2d2ffc878a88d9f83689c39883054dbefd1ea82c Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Wed, 6 Sep 2023 11:22:32 +0800 Subject: Disable glBufferParameteriAPPLE use --- indra/llrender/llvertexbuffer.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 6cc6078ec8..4d8c850727 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -1534,11 +1534,13 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran { if (map_range) { +/* #ifndef LL_MESA_HEADLESS glBufferParameteriAPPLE(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SERIALIZED_MODIFY_APPLE, GL_FALSE); glBufferParameteriAPPLE(GL_ARRAY_BUFFER_ARB, GL_BUFFER_FLUSHING_UNMAP_APPLE, GL_FALSE); - src = (U8*) glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY); #endif +*/ + src = (U8*) glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY); } else { @@ -1707,11 +1709,13 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range) { if (map_range) { +/* #ifndef LL_MESA_HEADLESS glBufferParameteriAPPLE(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_BUFFER_SERIALIZED_MODIFY_APPLE, GL_FALSE); glBufferParameteriAPPLE(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_BUFFER_FLUSHING_UNMAP_APPLE, GL_FALSE); - src = (U8*) glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY); #endif +*/ + src = (U8*) glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY); } else { -- cgit v1.2.3 From ba2d401017b6b32a7224f09671d27600da17d499 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Wed, 6 Sep 2023 11:28:45 +0800 Subject: GL_EXT_map_buffer_range as an alternative to ARB's --- indra/llrender/llvertexbuffer.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 4d8c850727..c8d6d16c1a 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -1500,7 +1500,7 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran { if (map_range) { -#ifdef GL_ARB_map_buffer_range +#if GL_ARB_map_buffer_range || GL_EXT_map_buffer_range S32 offset = mOffsets[type] + sTypeSize[type]*index; S32 length = (sTypeSize[type]*count+0xF) & ~0xF; src = (U8*) glMapBufferRange(GL_ARRAY_BUFFER, offset, length, @@ -1511,7 +1511,7 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran } else { -#ifdef GL_ARB_map_buffer_range +#if GL_ARB_map_buffer_range || GL_EXT_map_buffer_range if (gDebugGL) { @@ -1687,7 +1687,7 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range) { if (map_range) { -#ifdef GL_ARB_map_buffer_range +#if GL_ARB_map_buffer_range || GL_EXT_map_buffer_range S32 offset = sizeof(U16)*index; S32 length = sizeof(U16)*count; src = (U8*) glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER, offset, length, @@ -1698,7 +1698,7 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range) } else { -#ifdef GL_ARB_map_buffer_range +#if GL_ARB_map_buffer_range || GL_EXT_map_buffer_range src = (U8*) glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER, 0, sizeof(U16)*mNumIndices, GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT); @@ -1840,7 +1840,7 @@ void LLVertexBuffer::unmapBuffer() S32 length = sTypeSize[region.mType]*region.mCount; if (gGLManager.mHasMapBufferRange) { -#ifdef GL_ARB_map_buffer_range +#if GL_ARB_map_buffer_range || GL_EXT_map_buffer_range glFlushMappedBufferRange(GL_ARRAY_BUFFER, offset, length); #endif } @@ -1920,7 +1920,7 @@ void LLVertexBuffer::unmapBuffer() S32 length = sizeof(U16)*region.mCount; if (gGLManager.mHasMapBufferRange) { -#ifdef GL_ARB_map_buffer_range +#if GL_ARB_map_buffer_range || GL_EXT_map_buffer_range glFlushMappedBufferRange(GL_ELEMENT_ARRAY_BUFFER, offset, length); #endif } -- cgit v1.2.3 From 7dab57f52b5f34c84b5bba95d5e357e563cacb99 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Wed, 6 Sep 2023 11:32:48 +0800 Subject: Core profile glFlushMappedBufferRange function replacing its APPLE counterpart. --- indra/llrender/llvertexbuffer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index c8d6d16c1a..57c37328c4 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -1847,7 +1847,7 @@ void LLVertexBuffer::unmapBuffer() else if (gGLManager.mHasFlushBufferRange) { #ifndef LL_MESA_HEADLESS - glFlushMappedBufferRangeAPPLE(GL_ARRAY_BUFFER_ARB, offset, length); + glFlushMappedBufferRange(GL_ARRAY_BUFFER, offset, length); #endif } } -- cgit v1.2.3 From 375a21652ffab95fd0bc65180d4c0d31b87ba264 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Wed, 6 Sep 2023 11:37:18 +0800 Subject: Disable glFlushMappedBufferRangeAPPLE use --- indra/llrender/llvertexbuffer.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llrender') diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 57c37328c4..f71403d2f4 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -1924,6 +1924,7 @@ void LLVertexBuffer::unmapBuffer() glFlushMappedBufferRange(GL_ELEMENT_ARRAY_BUFFER, offset, length); #endif } + /* else if (gGLManager.mHasFlushBufferRange) { #ifdef GL_APPLE_flush_buffer_range @@ -1932,6 +1933,7 @@ void LLVertexBuffer::unmapBuffer() #endif #endif } + */ stop_glerror(); } -- cgit v1.2.3 From 69805644e058f999c973cc8ef8a24f130105bbe5 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Wed, 6 Sep 2023 11:43:59 +0800 Subject: EXT_disjoint_timer_query as alternative to ARB's --- indra/llrender/llgl.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/llrender') diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 88e07972ff..8b5b77196d 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -1033,7 +1033,11 @@ void LLGLManager::initExtensions() mHasARBEnvCombine = ExtensionExists("GL_ARB_texture_env_combine", gGLHExts.mSysExts); mHasCompressedTextures = glh_init_extensions("GL_ARB_texture_compression"); mHasOcclusionQuery = ExtensionExists("GL_ARB_occlusion_query", gGLHExts.mSysExts); +#if GL_ARB_timer_query mHasTimerQuery = ExtensionExists("GL_ARB_timer_query", gGLHExts.mSysExts); +#else + mHasTimerQuery = ExtensionExists("GL_EXT_disjoint_timer_query", gGLHExts.mSysExts); +#endif mHasOcclusionQuery2 = ExtensionExists("GL_ARB_occlusion_query2", gGLHExts.mSysExts); mHasVertexBufferObject = ExtensionExists("GL_ARB_vertex_buffer_object", gGLHExts.mSysExts); mHasVertexArrayObject = ExtensionExists("GL_ARB_vertex_array_object", gGLHExts.mSysExts); -- cgit v1.2.3 From ec43470dff035b834ec797737f12d49bade19a6a Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Wed, 6 Sep 2023 11:49:58 +0800 Subject: GL_EXT_draw's can be used for transform feedback --- indra/llrender/llgl.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/llrender') diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 8b5b77196d..216b499674 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -1083,7 +1083,11 @@ void LLGLManager::initExtensions() #else mHasDebugOutput = ExtensionExists("GL_KHR_debug", gGLHExts.mSysExts); #endif +#if GL_EXT_draw_transform_feedback + mHasTransformFeedback = ExtensionExists("GL_EXT_draw_transform_feedback", gGLHExts.mSysExts); +#else mHasTransformFeedback = mGLVersion >= 4.f ? TRUE : FALSE; +#endif #if !LL_DARWIN mHasPointParameters = ExtensionExists("GL_ARB_point_parameters", gGLHExts.mSysExts); #endif -- 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') 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 99eb1b6ca476a52214cf3c214dcf89785bdfa68e Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Wed, 6 Sep 2023 12:07:24 +0800 Subject: Check texture compression implementations before compiling its code. --- indra/llrender/llimagegl.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 34f668d1a2..06312e778c 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -203,12 +203,16 @@ S32 LLImageGL::dataFormatBits(S32 dataformat) { switch (dataformat) { +#if GL_EXT_texture_compression_s3tc || GL_EXT_texture_compression_dxt1 case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: return 4; - case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: return 4; case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: return 8; - case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: return 8; case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: return 8; +#endif +#if GL_EXT_texture_sRGB || GL_EXT_texture_compression_s3tc_srgb + case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: return 4; + case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: return 8; case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: return 8; +#endif case GL_LUMINANCE: return 8; case GL_ALPHA: return 8; case GL_RED: return 8; @@ -235,6 +239,8 @@ S32 LLImageGL::dataFormatBytes(S32 dataformat, S32 width, S32 height) { switch (dataformat) { +#if GL_EXT_texture_compression_s3tc || GL_EXT_texture_compression_dxt1 \ + || GL_EXT_texture_sRGB || GL_EXT_texture_compression_s3tc_srgb case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: @@ -244,6 +250,7 @@ S32 LLImageGL::dataFormatBytes(S32 dataformat, S32 width, S32 height) if (width < 4) width = 4; if (height < 4) height = 4; break; +#endif default: break; } @@ -257,12 +264,16 @@ S32 LLImageGL::dataFormatComponents(S32 dataformat) { switch (dataformat) { +#if GL_EXT_texture_compression_s3tc || GL_EXT_texture_compression_dxt1 case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: return 3; - case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: return 3; case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: return 4; - case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: return 4; case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: return 4; +#endif +#if GL_EXT_texture_sRGB || GL_EXT_texture_compression_s3tc_srgb + case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: return 3; + case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: return 4; case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: return 4; +#endif case GL_LUMINANCE: return 1; case GL_ALPHA: return 1; case GL_RED: return 1; @@ -692,6 +703,8 @@ BOOL LLImageGL::setImage(const U8* data_in, BOOL data_hasmips /* = FALSE */, S32 switch (mFormatPrimary) { +#if GL_EXT_texture_compression_s3tc || GL_EXT_texture_compression_dxt1 \ + || GL_EXT_texture_sRGB || GL_EXT_texture_compression_s3tc_srgb case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: @@ -700,6 +713,7 @@ BOOL LLImageGL::setImage(const U8* data_in, BOOL data_hasmips /* = FALSE */, S32 case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: is_compressed = true; break; +#endif default: break; } -- cgit v1.2.3 From 907b4f5925265a5ce7da49aa58e9df3d30c97168 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Wed, 6 Sep 2023 12:13:18 +0800 Subject: Check for GL_BGRA_EXT before compiling its code --- indra/llrender/llimagegl.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 06312e778c..dbb206839a 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -2162,9 +2162,11 @@ void LLImageGL::calcAlphaChannelOffsetAndStride() #endif mAlphaStride = 4; break; +#if GL_EXT_bgra case GL_BGRA_EXT: mAlphaStride = 4; break; +#endif default: break; } @@ -2200,8 +2202,12 @@ void LLImageGL::calcAlphaChannelOffsetAndStride() #endif // GL_VERSION_1_2 if( mAlphaStride < 1 || //unsupported format - mAlphaOffset < 0 || //unsupported type - (mFormatPrimary == GL_BGRA_EXT && mFormatType != GL_UNSIGNED_BYTE)) //unknown situation + mAlphaOffset < 0 //unsupported type +#if GL_EXT_bgra + || + (mFormatPrimary == GL_BGRA_EXT && mFormatType != GL_UNSIGNED_BYTE) //unknown situation +#endif + ) { LL_WARNS() << "Cannot analyze alpha for image with format type " << std::hex << mFormatType << std::dec << LL_ENDL; -- cgit v1.2.3 From 3ffe942384ca99c2407c79eee782201973bcb095 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Wed, 6 Sep 2023 12:17:23 +0800 Subject: Suffixless GL_LUMINANCE(_ALPHA) for those that don't implement the 8 suffixed ones. --- indra/llrender/llimagegl.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/llrender') diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index dbb206839a..56d319a0c4 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -1554,6 +1554,8 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S // Use luminance alpha (for fonts) #if GL_VERSION_1_1 mFormatInternal = GL_LUMINANCE8; +#else + mFormatInternal = GL_LUMINANCE; #endif mFormatPrimary = GL_LUMINANCE; mFormatType = GL_UNSIGNED_BYTE; @@ -1562,6 +1564,8 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S // Use luminance alpha (for fonts) #if GL_VERSION_1_1 mFormatInternal = GL_LUMINANCE8_ALPHA8; +#else + mFormatInternal = GL_LUMINANCE_ALPHA; #endif mFormatPrimary = GL_LUMINANCE_ALPHA; mFormatType = GL_UNSIGNED_BYTE; -- cgit v1.2.3 From 39916024f4878739a64c785cdaa16cdccc171e7f Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Wed, 6 Sep 2023 12:21:49 +0800 Subject: glDrawBuffers instead of glDrawBuffer since the latter is less portable. I'm guessing 1st arg is 0 since the condition is when mTex is empty. --- indra/llrender/llrendertarget.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index 005a7cfa97..90f9253a75 100644 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -491,7 +491,8 @@ void LLRenderTarget::bindTarget() if (mTex.empty()) { //no color buffer to draw to LL_PROFILER_GPU_ZONEC( "gl.DrawBuffer", 0x0000FF ) - glDrawBuffer(GL_NONE); + GLenum drawbuffers[] = {GL_NONE}; + glDrawBuffers(0, drawbuffers); glReadBuffer(GL_NONE); } -- cgit v1.2.3 From 211ab43ba2cd23052534ac6817309c52969590d1 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Wed, 6 Sep 2023 12:29:13 +0800 Subject: GL TIME_ELAPSED_EXT as alternative to TIME_ELAPSED --- indra/llrender/llglslshader.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/llrender') diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 308ec1a771..58a9e28270 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -272,6 +272,8 @@ void LLGLSLShader::placeProfileQuery() #if GL_VERSION_3_3 glBeginQuery(GL_TIME_ELAPSED, mTimerQuery); #endif // GL_VERSION_3_3 +#else + glBeginQuery(GL_TIME_ELAPSED_EXT, mTimerQuery); #endif // GL_VERSION_1_5 #endif } @@ -284,6 +286,8 @@ void LLGLSLShader::readProfileQuery(U32 count, U32 mode) glEndQuery(GL_TIME_ELAPSED); #endif // GL_VERSION_3_3 glEndQuery(GL_SAMPLES_PASSED); +#else + glEndQuery(GL_TIME_ELAPSED_EXT); #endif // GL_VERSION_1_5 GLuint64 time_elapsed = 0; -- cgit v1.2.3 From 68c8e3e8f1d66c656bd6c1c014e13945f6998749 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Wed, 6 Sep 2023 13:57:29 +0800 Subject: Re-exclude FBSD test on Nvidia headers to minimise difference from upstream, as it's certain it's not FreeBSD anyway due to the removal of LL_FREEBSD on the containing scope. --- indra/llrender/llgl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 216b499674..6449fcdf33 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -1312,7 +1312,7 @@ void LLGLManager::initExtensions() glDebugMessageCallbackARB = (PFNGLDEBUGMESSAGECALLBACKARBPROC) GLH_EXT_GET_PROC_ADDRESS("glDebugMessageCallbackARB"); glGetDebugMessageLogARB = (PFNGLGETDEBUGMESSAGELOGARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetDebugMessageLogARB"); } -#if (!LL_LINUX && !LL_FREEBSD) || LL_LINUX_NV_GL_HEADERS +#if (!LL_LINUX) || LL_LINUX_NV_GL_HEADERS // This is expected to be a static symbol on Linux GL implementations, except if we use the nvidia headers - bah glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)GLH_EXT_GET_PROC_ADDRESS("glDrawRangeElements"); if (!glDrawRangeElements) -- cgit v1.2.3 From 520fbfac5071f74d21e46b2f07dc0ed68b098903 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Wed, 6 Sep 2023 14:47:00 +0800 Subject: Comment out the GL functions redefinitions for all --- indra/llrender/llgl.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llrender') diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 6449fcdf33..f597b1a932 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -1213,6 +1213,7 @@ void LLGLManager::initExtensions() glGetIntegerv(GL_MAX_ELEMENTS_INDICES, (GLint*) &mGLMaxIndexRange); glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint*) &mGLMaxTextureSize); +/* #if (LL_WINDOWS || LL_LINUX) && !LL_MESA_HEADLESS LL_DEBUGS("RenderInit") << "GL Probe: Getting symbols" << LL_ENDL; if (mHasVertexBufferObject) @@ -1476,6 +1477,7 @@ void LLGLManager::initExtensions() LL_DEBUGS("RenderInit") << "GL Probe: Got symbols" << LL_ENDL; #endif +*/ mInited = TRUE; } -- cgit v1.2.3 From 0aa43b264a76bb46cec2381b66708052b6b0ced9 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Thu, 7 Sep 2023 19:11:44 +0800 Subject: Comment out the GL funcs redefinition for Darwin --- indra/llrender/llglheaders.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llglheaders.h b/indra/llrender/llglheaders.h index 1a8b2f1a64..3596223a93 100644 --- a/indra/llrender/llglheaders.h +++ b/indra/llrender/llglheaders.h @@ -575,6 +575,7 @@ extern PFNGLGETDEBUGMESSAGELOGARBPROC glGetDebugMessageLogARB; #include "GL/glh_extensions.h" +/* // These symbols don't exist on 10.3.9, so they have to be declared weak. Redeclaring them here fixes the problem. // Note that they also must not be called on 10.3.9. This should be taken care of by a runtime check for the existence of the GL extension. #include @@ -692,7 +693,7 @@ extern "C" { #ifndef GL_ARB_vertex_buffer_object -/* GL types for handling large vertex buffer objects */ +// GL types for handling large vertex buffer objects typedef intptr_t GLintptrARB; typedef intptr_t GLsizeiptrARB; #endif @@ -708,7 +709,7 @@ typedef GLboolean (* glIsBufferARBProcPtr) (GLuint buffer); typedef void (* glBufferDataARBProcPtr) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage); typedef void (* glBufferSubDataARBProcPtr) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data); typedef void (* glGetBufferSubDataARBProcPtr) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data); -typedef GLvoid* (* glMapBufferARBProcPtr) (GLenum target, GLenum access); /* Flawfinder: ignore */ +typedef GLvoid* (* glMapBufferARBProcPtr) (GLenum target, GLenum access); // Flawfinder: ignore typedef GLboolean (* glUnmapBufferARBProcPtr) (GLenum target); typedef void (* glGetBufferParameterivARBProcPtr) (GLenum target, GLenum pname, GLint *params); typedef void (* glGetBufferPointervARBProcPtr) (GLenum target, GLenum pname, GLvoid* *params); @@ -724,7 +725,7 @@ extern GLvoid* glMapBufferARB (GLenum, GLenum); extern GLboolean glUnmapBufferARB (GLenum); extern void glGetBufferParameterivARB (GLenum, GLenum, GLint *); extern void glGetBufferPointervARB (GLenum, GLenum, GLvoid* *); -#endif /* GL_GLEXT_FUNCTION_POINTERS */ +#endif // GL_GLEXT_FUNCTION_POINTERS #endif #ifndef GL_ARB_texture_rg @@ -771,7 +772,7 @@ extern void glGetBufferPointervARB (GLenum, GLenum, GLvoid* *); // extern void glCompressedTexSubImage2D (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid*); // extern void glCompressedTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid*); // extern void glGetCompressedTexImage (GLenum, GLint, GLvoid*); -// #endif /* GL_GLEXT_FUNCTION_POINTERS */ +// #endif // GL_GLEXT_FUNCTION_POINTERS // #endif #ifdef __cplusplus @@ -779,6 +780,7 @@ extern void glGetBufferPointervARB (GLenum, GLenum, GLvoid* *); #endif #include +*/ #endif // LL_MESA / LL_WINDOWS / LL_DARWIN -- 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/llatmosphere.cpp | 16 +++++++++++++ indra/llrender/llgl.cpp | 7 ++++++ indra/llrender/llglslshader.cpp | 9 +++++-- indra/llrender/llrender.cpp | 6 ++++- indra/llrender/llvertexbuffer.cpp | 49 +++++++++++++++++++++++++-------------- 5 files changed, 67 insertions(+), 20 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llatmosphere.cpp b/indra/llrender/llatmosphere.cpp index 8e37ca9b90..941ffe2711 100644 --- a/indra/llrender/llatmosphere.cpp +++ b/indra/llrender/llatmosphere.cpp @@ -241,7 +241,11 @@ LLGLTexture* LLAtmosphere::getTransmittance() m_transmittance->generateGLTexture(); m_transmittance->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP); m_transmittance->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); +#if GL_ARB_texture_float + m_transmittance->setExplicitFormat(GL_RGB32F_ARB, GL_RGB, GL_FLOAT); +#else m_transmittance->setExplicitFormat(GL_RGB32F, GL_RGB, GL_FLOAT); +#endif m_transmittance->setTarget(GL_TEXTURE_2D, LLTexUnit::TT_TEXTURE); } return m_transmittance; @@ -255,7 +259,11 @@ LLGLTexture* LLAtmosphere::getScattering() m_scattering->generateGLTexture(); m_scattering->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP); m_scattering->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); +#if GL_ARB_texture_float + m_scattering->setExplicitFormat(GL_RGB16F_ARB, GL_RGB, GL_FLOAT); +#else m_scattering->setExplicitFormat(GL_RGB16F, GL_RGB, GL_FLOAT); +#endif m_scattering->setTarget(GL_TEXTURE_3D, LLTexUnit::TT_TEXTURE_3D); } return m_scattering; @@ -269,7 +277,11 @@ LLGLTexture* LLAtmosphere::getMieScattering() m_mie_scatter_texture->generateGLTexture(); m_mie_scatter_texture->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP); m_mie_scatter_texture->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); +#if GL_ARB_texture_float + m_mie_scatter_texture->setExplicitFormat(GL_RGB16F_ARB, GL_RGB, GL_FLOAT); +#else m_mie_scatter_texture->setExplicitFormat(GL_RGB16F, GL_RGB, GL_FLOAT); +#endif m_mie_scatter_texture->setTarget(GL_TEXTURE_3D, LLTexUnit::TT_TEXTURE_3D); } return m_mie_scatter_texture; @@ -283,7 +295,11 @@ LLGLTexture* LLAtmosphere::getIlluminance() m_illuminance->generateGLTexture(); m_illuminance->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP); m_illuminance->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); +#if GL_ARB_texture_float + m_illuminance->setExplicitFormat(GL_RGB32F_ARB, GL_RGB, GL_FLOAT); +#else m_illuminance->setExplicitFormat(GL_RGB32F, GL_RGB, GL_FLOAT); +#endif m_illuminance->setTarget(GL_TEXTURE_2D, LLTexUnit::TT_TEXTURE); } return m_illuminance; diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index f597b1a932..9c809d5bd0 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -777,10 +777,12 @@ bool LLGLManager::initGL() if (mHasTextureMultisample) { +#if GL_VERSION_3_2 glGetIntegerv(GL_MAX_COLOR_TEXTURE_SAMPLES, &mMaxColorTextureSamples); glGetIntegerv(GL_MAX_DEPTH_TEXTURE_SAMPLES, &mMaxDepthTextureSamples); glGetIntegerv(GL_MAX_INTEGER_SAMPLES, &mMaxIntegerSamples); glGetIntegerv(GL_MAX_SAMPLE_MASK_WORDS, &mMaxSampleMaskWords); +#endif } stop_glerror(); @@ -1621,8 +1623,13 @@ void LLGLState::initClass() // sStateMap[GL_TEXTURE_2D] = GL_TRUE; //make sure multisample defaults to disabled +#if GL_ARB_multisample + sStateMap[GL_MULTISAMPLE_ARB] = GL_FALSE; + glDisable(GL_MULTISAMPLE_ARB); +#elif GL_EXT_multisample || GL_EXT_multisample_compatibility sStateMap[GL_MULTISAMPLE_EXT] = GL_FALSE; glDisable(GL_MULTISAMPLE_EXT); +#endif } //static diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 58a9e28270..f587fb414c 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -797,16 +797,21 @@ GLint LLGLSLShader::mapUniformTextureChannel(GLint location, GLenum type) { LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; +#if GL_VERSION_2_0 || GL_VERSION_3_2 if ( #if GL_VERSION_2_0 - (type >= GL_SAMPLER_1D_ARB && type <= GL_SAMPLER_2D_RECT_SHADOW_ARB) || + (type >= GL_SAMPLER_1D_ARB && type <= GL_SAMPLER_2D_RECT_SHADOW_ARB) #endif - type == GL_SAMPLER_2D_MULTISAMPLE) +#if GL_VERSION_3_2 + || type == GL_SAMPLER_2D_MULTISAMPLE +#endif + ) { //this here is a texture glUniform1i(location, mActiveTextureChannels); LL_DEBUGS("ShaderUniform") << "Assigned to texture channel " << mActiveTextureChannels << LL_ENDL; return mActiveTextureChannels++; } +#endif // GL_VERSION_2_0 || GL_VERSION_3_2 return -1; } 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) diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index f71403d2f4..0c8a8fed6a 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -404,8 +404,11 @@ U32 LLVertexBuffer::getVAOName() else { //#ifdef GL_ARB_vertex_array_object +#if GL_APPLE_vertex_array_object + glGenVertexArraysAPPLE(1, &ret); +#else glGenVertexArrays(1, &ret); -//#endif +#endif } return ret; @@ -758,8 +761,11 @@ void LLVertexBuffer::unbind() if (sGLRenderArray) { //#if GL_ARB_vertex_array_object +#if GL_APPLE_vertex_array_object + glBindVertexArrayAPPLE(0); +#else glBindVertexArray(0); -//#endif +#endif sGLRenderArray = 0; sGLRenderIndices = 0; sIBOActive = false; @@ -1259,8 +1265,11 @@ void LLVertexBuffer::setupVertexArray() LL_PROFILE_ZONE_SCOPED_CATEGORY_VERTEX; //#if GL_ARB_vertex_array_object +#if GL_APPLE_vertex_array_object + glBindVertexArrayAPPLE(mGLArray); +#else glBindVertexArray(mGLArray); -//#endif +#endif sGLRenderArray = mGLArray; static const U32 attrib_size[] = @@ -1534,12 +1543,10 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran { if (map_range) { -/* -#ifndef LL_MESA_HEADLESS +#if !LL_MESA_HEADLESS && GL_APPLE_flush_buffer_range && LL_DARWIN glBufferParameteriAPPLE(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SERIALIZED_MODIFY_APPLE, GL_FALSE); glBufferParameteriAPPLE(GL_ARRAY_BUFFER_ARB, GL_BUFFER_FLUSHING_UNMAP_APPLE, GL_FALSE); #endif -*/ src = (U8*) glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY); } else @@ -1709,12 +1716,10 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range) { if (map_range) { -/* -#ifndef LL_MESA_HEADLESS +#if !LL_MESA_HEADLESS && GL_APPLE_flush_buffer_range && LL_DARWIN glBufferParameteriAPPLE(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_BUFFER_SERIALIZED_MODIFY_APPLE, GL_FALSE); glBufferParameteriAPPLE(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_BUFFER_FLUSHING_UNMAP_APPLE, GL_FALSE); #endif -*/ src = (U8*) glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY); } else @@ -1840,13 +1845,17 @@ void LLVertexBuffer::unmapBuffer() S32 length = sTypeSize[region.mType]*region.mCount; if (gGLManager.mHasMapBufferRange) { -#if GL_ARB_map_buffer_range || GL_EXT_map_buffer_range +#if GL_APPLE_flush_buffer_range && LL_DARWIN + glFlushMappedBufferRangeAPPLE(GL_ARRAY_BUFFER, offset, length); +#elif GL_ARB_map_buffer_range || GL_EXT_map_buffer_range glFlushMappedBufferRange(GL_ARRAY_BUFFER, offset, length); #endif } else if (gGLManager.mHasFlushBufferRange) { -#ifndef LL_MESA_HEADLESS +#if !LL_MESA_HEADLESS && GL_APPLE_flush_buffer_range && LL_DARWIN + glFlushMappedBufferRangeAPPLE(GL_ARRAY_BUFFER, offset, length); +#else glFlushMappedBufferRange(GL_ARRAY_BUFFER, offset, length); #endif } @@ -1920,20 +1929,20 @@ void LLVertexBuffer::unmapBuffer() S32 length = sizeof(U16)*region.mCount; if (gGLManager.mHasMapBufferRange) { -#if GL_ARB_map_buffer_range || GL_EXT_map_buffer_range +#if GL_APPLE_flush_buffer_range && LL_DARWIN + glFlushMappedBufferRangeAPPLE(GL_ELEMENT_ARRAY_BUFFER, offset, length); +#elif GL_ARB_map_buffer_range || GL_EXT_map_buffer_range glFlushMappedBufferRange(GL_ELEMENT_ARRAY_BUFFER, offset, length); #endif } - /* else if (gGLManager.mHasFlushBufferRange) { -#ifdef GL_APPLE_flush_buffer_range +#if GL_APPLE_flush_buffer_range && LL_DARWIN #ifndef LL_MESA_HEADLESS glFlushMappedBufferRangeAPPLE(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length); #endif #endif } - */ stop_glerror(); } @@ -2071,8 +2080,11 @@ bool LLVertexBuffer::bindGLArray() { LL_PROFILE_ZONE_SCOPED_CATEGORY_VERTEX; //#if GL_ARB_vertex_array_object +#if GL_APPLE_vertex_array_object + glBindVertexArrayAPPLE(mGLArray); +#else glBindVertexArray(mGLArray); -//#endif +#endif sGLRenderArray = mGLArray; } @@ -2301,8 +2313,11 @@ void LLVertexBuffer::setBuffer(U32 data_mask) if (sGLRenderArray) { //#if GL_ARB_vertex_array_object +#if GL_APPLE_vertex_array_object + glBindVertexArrayAPPLE(0); +#else glBindVertexArray(0); -//#endif +#endif sGLRenderArray = 0; sGLRenderIndices = 0; sIBOActive = false; -- cgit v1.2.3 From 3da53b180139d2a79811c1ed7384beaad3a86a48 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Thu, 7 Sep 2023 21:11:07 +0800 Subject: Bring back OpenGL >= 3.0 functionalities to macOS They weren't compiled with the previous commit, and it affected a lot. --- indra/llrender/llglheaders.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/llrender') diff --git a/indra/llrender/llglheaders.h b/indra/llrender/llglheaders.h index 3596223a93..4a0c76760b 100644 --- a/indra/llrender/llglheaders.h +++ b/indra/llrender/llglheaders.h @@ -573,6 +573,9 @@ extern PFNGLGETDEBUGMESSAGELOGARBPROC glGetDebugMessageLogARB; #define GL_EXT_separate_specular_color 1 #include +#define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED +#include + #include "GL/glh_extensions.h" /* -- 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/llatmosphere.cpp | 16 ------------- indra/llrender/llgl.cpp | 7 ------ indra/llrender/llglslshader.cpp | 9 ++----- indra/llrender/llrender.cpp | 6 +---- indra/llrender/llvertexbuffer.cpp | 49 ++++++++++++++------------------------- 5 files changed, 20 insertions(+), 67 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llatmosphere.cpp b/indra/llrender/llatmosphere.cpp index 941ffe2711..8e37ca9b90 100644 --- a/indra/llrender/llatmosphere.cpp +++ b/indra/llrender/llatmosphere.cpp @@ -241,11 +241,7 @@ LLGLTexture* LLAtmosphere::getTransmittance() m_transmittance->generateGLTexture(); m_transmittance->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP); m_transmittance->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); -#if GL_ARB_texture_float - m_transmittance->setExplicitFormat(GL_RGB32F_ARB, GL_RGB, GL_FLOAT); -#else m_transmittance->setExplicitFormat(GL_RGB32F, GL_RGB, GL_FLOAT); -#endif m_transmittance->setTarget(GL_TEXTURE_2D, LLTexUnit::TT_TEXTURE); } return m_transmittance; @@ -259,11 +255,7 @@ LLGLTexture* LLAtmosphere::getScattering() m_scattering->generateGLTexture(); m_scattering->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP); m_scattering->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); -#if GL_ARB_texture_float - m_scattering->setExplicitFormat(GL_RGB16F_ARB, GL_RGB, GL_FLOAT); -#else m_scattering->setExplicitFormat(GL_RGB16F, GL_RGB, GL_FLOAT); -#endif m_scattering->setTarget(GL_TEXTURE_3D, LLTexUnit::TT_TEXTURE_3D); } return m_scattering; @@ -277,11 +269,7 @@ LLGLTexture* LLAtmosphere::getMieScattering() m_mie_scatter_texture->generateGLTexture(); m_mie_scatter_texture->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP); m_mie_scatter_texture->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); -#if GL_ARB_texture_float - m_mie_scatter_texture->setExplicitFormat(GL_RGB16F_ARB, GL_RGB, GL_FLOAT); -#else m_mie_scatter_texture->setExplicitFormat(GL_RGB16F, GL_RGB, GL_FLOAT); -#endif m_mie_scatter_texture->setTarget(GL_TEXTURE_3D, LLTexUnit::TT_TEXTURE_3D); } return m_mie_scatter_texture; @@ -295,11 +283,7 @@ LLGLTexture* LLAtmosphere::getIlluminance() m_illuminance->generateGLTexture(); m_illuminance->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP); m_illuminance->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); -#if GL_ARB_texture_float - m_illuminance->setExplicitFormat(GL_RGB32F_ARB, GL_RGB, GL_FLOAT); -#else m_illuminance->setExplicitFormat(GL_RGB32F, GL_RGB, GL_FLOAT); -#endif m_illuminance->setTarget(GL_TEXTURE_2D, LLTexUnit::TT_TEXTURE); } return m_illuminance; diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 9c809d5bd0..f597b1a932 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -777,12 +777,10 @@ bool LLGLManager::initGL() if (mHasTextureMultisample) { -#if GL_VERSION_3_2 glGetIntegerv(GL_MAX_COLOR_TEXTURE_SAMPLES, &mMaxColorTextureSamples); glGetIntegerv(GL_MAX_DEPTH_TEXTURE_SAMPLES, &mMaxDepthTextureSamples); glGetIntegerv(GL_MAX_INTEGER_SAMPLES, &mMaxIntegerSamples); glGetIntegerv(GL_MAX_SAMPLE_MASK_WORDS, &mMaxSampleMaskWords); -#endif } stop_glerror(); @@ -1623,13 +1621,8 @@ void LLGLState::initClass() // sStateMap[GL_TEXTURE_2D] = GL_TRUE; //make sure multisample defaults to disabled -#if GL_ARB_multisample - sStateMap[GL_MULTISAMPLE_ARB] = GL_FALSE; - glDisable(GL_MULTISAMPLE_ARB); -#elif GL_EXT_multisample || GL_EXT_multisample_compatibility sStateMap[GL_MULTISAMPLE_EXT] = GL_FALSE; glDisable(GL_MULTISAMPLE_EXT); -#endif } //static diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index f587fb414c..58a9e28270 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -797,21 +797,16 @@ GLint LLGLSLShader::mapUniformTextureChannel(GLint location, GLenum type) { LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; -#if GL_VERSION_2_0 || GL_VERSION_3_2 if ( #if GL_VERSION_2_0 - (type >= GL_SAMPLER_1D_ARB && type <= GL_SAMPLER_2D_RECT_SHADOW_ARB) + (type >= GL_SAMPLER_1D_ARB && type <= GL_SAMPLER_2D_RECT_SHADOW_ARB) || #endif -#if GL_VERSION_3_2 - || type == GL_SAMPLER_2D_MULTISAMPLE -#endif - ) + type == GL_SAMPLER_2D_MULTISAMPLE) { //this here is a texture glUniform1i(location, mActiveTextureChannels); LL_DEBUGS("ShaderUniform") << "Assigned to texture channel " << mActiveTextureChannels << LL_ENDL; return mActiveTextureChannels++; } -#endif // GL_VERSION_2_0 || GL_VERSION_3_2 return -1; } 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) diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 0c8a8fed6a..f71403d2f4 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -404,11 +404,8 @@ U32 LLVertexBuffer::getVAOName() else { //#ifdef GL_ARB_vertex_array_object -#if GL_APPLE_vertex_array_object - glGenVertexArraysAPPLE(1, &ret); -#else glGenVertexArrays(1, &ret); -#endif +//#endif } return ret; @@ -761,11 +758,8 @@ void LLVertexBuffer::unbind() if (sGLRenderArray) { //#if GL_ARB_vertex_array_object -#if GL_APPLE_vertex_array_object - glBindVertexArrayAPPLE(0); -#else glBindVertexArray(0); -#endif +//#endif sGLRenderArray = 0; sGLRenderIndices = 0; sIBOActive = false; @@ -1265,11 +1259,8 @@ void LLVertexBuffer::setupVertexArray() LL_PROFILE_ZONE_SCOPED_CATEGORY_VERTEX; //#if GL_ARB_vertex_array_object -#if GL_APPLE_vertex_array_object - glBindVertexArrayAPPLE(mGLArray); -#else glBindVertexArray(mGLArray); -#endif +//#endif sGLRenderArray = mGLArray; static const U32 attrib_size[] = @@ -1543,10 +1534,12 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran { if (map_range) { -#if !LL_MESA_HEADLESS && GL_APPLE_flush_buffer_range && LL_DARWIN +/* +#ifndef LL_MESA_HEADLESS glBufferParameteriAPPLE(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SERIALIZED_MODIFY_APPLE, GL_FALSE); glBufferParameteriAPPLE(GL_ARRAY_BUFFER_ARB, GL_BUFFER_FLUSHING_UNMAP_APPLE, GL_FALSE); #endif +*/ src = (U8*) glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY); } else @@ -1716,10 +1709,12 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range) { if (map_range) { -#if !LL_MESA_HEADLESS && GL_APPLE_flush_buffer_range && LL_DARWIN +/* +#ifndef LL_MESA_HEADLESS glBufferParameteriAPPLE(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_BUFFER_SERIALIZED_MODIFY_APPLE, GL_FALSE); glBufferParameteriAPPLE(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_BUFFER_FLUSHING_UNMAP_APPLE, GL_FALSE); #endif +*/ src = (U8*) glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY); } else @@ -1845,17 +1840,13 @@ void LLVertexBuffer::unmapBuffer() S32 length = sTypeSize[region.mType]*region.mCount; if (gGLManager.mHasMapBufferRange) { -#if GL_APPLE_flush_buffer_range && LL_DARWIN - glFlushMappedBufferRangeAPPLE(GL_ARRAY_BUFFER, offset, length); -#elif GL_ARB_map_buffer_range || GL_EXT_map_buffer_range +#if GL_ARB_map_buffer_range || GL_EXT_map_buffer_range glFlushMappedBufferRange(GL_ARRAY_BUFFER, offset, length); #endif } else if (gGLManager.mHasFlushBufferRange) { -#if !LL_MESA_HEADLESS && GL_APPLE_flush_buffer_range && LL_DARWIN - glFlushMappedBufferRangeAPPLE(GL_ARRAY_BUFFER, offset, length); -#else +#ifndef LL_MESA_HEADLESS glFlushMappedBufferRange(GL_ARRAY_BUFFER, offset, length); #endif } @@ -1929,20 +1920,20 @@ void LLVertexBuffer::unmapBuffer() S32 length = sizeof(U16)*region.mCount; if (gGLManager.mHasMapBufferRange) { -#if GL_APPLE_flush_buffer_range && LL_DARWIN - glFlushMappedBufferRangeAPPLE(GL_ELEMENT_ARRAY_BUFFER, offset, length); -#elif GL_ARB_map_buffer_range || GL_EXT_map_buffer_range +#if GL_ARB_map_buffer_range || GL_EXT_map_buffer_range glFlushMappedBufferRange(GL_ELEMENT_ARRAY_BUFFER, offset, length); #endif } + /* else if (gGLManager.mHasFlushBufferRange) { -#if GL_APPLE_flush_buffer_range && LL_DARWIN +#ifdef GL_APPLE_flush_buffer_range #ifndef LL_MESA_HEADLESS glFlushMappedBufferRangeAPPLE(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length); #endif #endif } + */ stop_glerror(); } @@ -2080,11 +2071,8 @@ bool LLVertexBuffer::bindGLArray() { LL_PROFILE_ZONE_SCOPED_CATEGORY_VERTEX; //#if GL_ARB_vertex_array_object -#if GL_APPLE_vertex_array_object - glBindVertexArrayAPPLE(mGLArray); -#else glBindVertexArray(mGLArray); -#endif +//#endif sGLRenderArray = mGLArray; } @@ -2313,11 +2301,8 @@ void LLVertexBuffer::setBuffer(U32 data_mask) if (sGLRenderArray) { //#if GL_ARB_vertex_array_object -#if GL_APPLE_vertex_array_object - glBindVertexArrayAPPLE(0); -#else glBindVertexArray(0); -#endif +//#endif sGLRenderArray = 0; sGLRenderIndices = 0; sIBOActive = false; -- cgit v1.2.3 From b47d2a1c0e432483d93693de58956367a3c935d6 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Thu, 7 Sep 2023 21:14:07 +0800 Subject: Bring back GL_MULTISAMPLE_ARB to macOS since it doesn't have GL_MULTISAMPLE_EXT. --- indra/llrender/llgl.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/llrender') diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index f597b1a932..5ad8e7f5df 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -1621,8 +1621,13 @@ void LLGLState::initClass() // sStateMap[GL_TEXTURE_2D] = GL_TRUE; //make sure multisample defaults to disabled +#if GL_ARB_multisample + sStateMap[GL_MULTISAMPLE_ARB] = GL_FALSE; + glDisable(GL_MULTISAMPLE_ARB); +#else sStateMap[GL_MULTISAMPLE_EXT] = GL_FALSE; glDisable(GL_MULTISAMPLE_EXT); +#endif } //static -- cgit v1.2.3 From d328f2efb2d22e690a5461f4ba2d2eeb6603ac8f Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Thu, 7 Sep 2023 21:19:31 +0800 Subject: Bring back glBufferParameteriAPPLE GL_APPLE_flush_buffer_range is defined on other platforms such as FreeBSD but there would failure to link, hence the extra LL_DARWIN. --- indra/llrender/llvertexbuffer.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index f71403d2f4..4064d35753 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -1534,12 +1534,10 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran { if (map_range) { -/* -#ifndef LL_MESA_HEADLESS +#if !LL_MESA_HEADLESS && GL_APPLE_flush_buffer_range && LL_DARWIN glBufferParameteriAPPLE(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SERIALIZED_MODIFY_APPLE, GL_FALSE); glBufferParameteriAPPLE(GL_ARRAY_BUFFER_ARB, GL_BUFFER_FLUSHING_UNMAP_APPLE, GL_FALSE); #endif -*/ src = (U8*) glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY); } else @@ -1709,12 +1707,10 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range) { if (map_range) { -/* -#ifndef LL_MESA_HEADLESS +#if !LL_MESA_HEADLESS && GL_APPLE_flush_buffer_range && LL_DARWIN glBufferParameteriAPPLE(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_BUFFER_SERIALIZED_MODIFY_APPLE, GL_FALSE); glBufferParameteriAPPLE(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_BUFFER_FLUSHING_UNMAP_APPLE, GL_FALSE); #endif -*/ src = (U8*) glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY); } else @@ -1924,16 +1920,14 @@ void LLVertexBuffer::unmapBuffer() glFlushMappedBufferRange(GL_ELEMENT_ARRAY_BUFFER, offset, length); #endif } - /* else if (gGLManager.mHasFlushBufferRange) { -#ifdef GL_APPLE_flush_buffer_range +#if GL_APPLE_flush_buffer_range && LL_DARWIN #ifndef LL_MESA_HEADLESS glFlushMappedBufferRangeAPPLE(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length); #endif #endif } - */ stop_glerror(); } -- cgit v1.2.3