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 ++++++++++++++++-------- indra/newview/llscenemonitor.cpp | 8 ++++---- indra/newview/llvieweroctree.cpp | 10 +++++----- indra/newview/pipeline.cpp | 2 +- 4 files changed, 26 insertions(+), 18 deletions(-) (limited to 'indra') 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; } diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 7089df677e..7c6a80e246 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -445,14 +445,14 @@ void LLSceneMonitor::calcDiffAggregate() if(mDiffState == EXECUTE_DIFF) { - glBeginQueryARB(GL_SAMPLES_PASSED_ARB, mQueryObject); + glBeginQuery(GL_SAMPLES_PASSED_ARB, mQueryObject); } gl_draw_scaled_target(0, 0, S32(mDiff->getWidth() * mDiffPixelRatio), S32(mDiff->getHeight() * mDiffPixelRatio), mDiff); if(mDiffState == EXECUTE_DIFF) { - glEndQueryARB(GL_SAMPLES_PASSED_ARB); + glEndQuery(GL_SAMPLES_PASSED_ARB); mDiffState = WAIT_ON_RESULT; } @@ -483,11 +483,11 @@ void LLSceneMonitor::fetchQueryResult() mDiffState = WAITING_FOR_NEXT_DIFF; GLuint available = 0; - glGetQueryObjectuivARB(mQueryObject, GL_QUERY_RESULT_AVAILABLE_ARB, &available); + glGetQueryObjectuiv(mQueryObject, GL_QUERY_RESULT_AVAILABLE, &available); if(available) { GLuint count = 0; - glGetQueryObjectuivARB(mQueryObject, GL_QUERY_RESULT_ARB, &count); + glGetQueryObjectuiv(mQueryObject, GL_QUERY_RESULT, &count); mDiffResult = sqrtf(count * 0.5f / (mDiff->getWidth() * mDiff->getHeight() * mDiffPixelRatio * mDiffPixelRatio)); //0.5 -> (front face + back face) diff --git a/indra/newview/llvieweroctree.cpp b/indra/newview/llvieweroctree.cpp index 36b2bd4c32..cb5ea1cef5 100644 --- a/indra/newview/llvieweroctree.cpp +++ b/indra/newview/llvieweroctree.cpp @@ -800,7 +800,7 @@ U32 LLOcclusionCullingGroup::getNewOcclusionQueryObjectName() { //seed 1024 query names into the free query pool GLuint queries[1024]; - glGenQueriesARB(1024, queries); + glGenQueries(1024, queries); for (int i = 0; i < 1024; ++i) { sFreeQueries.push(queries[i]); @@ -1129,7 +1129,7 @@ void LLOcclusionCullingGroup::checkOcclusion() GLuint available; { LL_PROFILE_ZONE_NAMED_CATEGORY_OCTREE("co - query available"); - glGetQueryObjectuivARB(mOcclusionQuery[LLViewerCamera::sCurCameraID], GL_QUERY_RESULT_AVAILABLE_ARB, &available); + glGetQueryObjectuiv(mOcclusionQuery[LLViewerCamera::sCurCameraID], GL_QUERY_RESULT_AVAILABLE, &available); } if (available) @@ -1137,7 +1137,7 @@ void LLOcclusionCullingGroup::checkOcclusion() GLuint query_result; // Will be # samples drawn, or a boolean depending on mHasOcclusionQuery2 (both are type GLuint) { LL_PROFILE_ZONE_NAMED_CATEGORY_OCTREE("co - query result"); - glGetQueryObjectuivARB(mOcclusionQuery[LLViewerCamera::sCurCameraID], GL_QUERY_RESULT_ARB, &query_result); + glGetQueryObjectuiv(mOcclusionQuery[LLViewerCamera::sCurCameraID], GL_QUERY_RESULT, &query_result); } #if LL_TRACK_PENDING_OCCLUSION_QUERIES sPendingQueries.erase(mOcclusionQuery[LLViewerCamera::sCurCameraID]); @@ -1250,7 +1250,7 @@ void LLOcclusionCullingGroup::doOcclusion(LLCamera* camera, const LLVector4a* sh //get an occlusion query that hasn't been used in awhile releaseOcclusionQueryObjectName(mOcclusionQuery[LLViewerCamera::sCurCameraID]); mOcclusionQuery[LLViewerCamera::sCurCameraID] = getNewOcclusionQueryObjectName(); - glBeginQueryARB(mode, mOcclusionQuery[LLViewerCamera::sCurCameraID]); + glBeginQuery(mode, mOcclusionQuery[LLViewerCamera::sCurCameraID]); } LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; @@ -1292,7 +1292,7 @@ void LLOcclusionCullingGroup::doOcclusion(LLCamera* camera, const LLVector4a* sh { LL_PROFILE_ZONE_NAMED("glEndQuery"); - glEndQueryARB(mode); + glEndQuery(mode); } } } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 63714bd5cb..23b863aa19 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -719,7 +719,7 @@ void LLPipeline::destroyGL() if (mMeshDirtyQueryObject) { - glDeleteQueriesARB(1, &mMeshDirtyQueryObject); + glDeleteQueries(1, &mMeshDirtyQueryObject); mMeshDirtyQueryObject = 0; } } -- cgit v1.2.3