diff options
author | RunitaiLinden <davep@lindenlab.com> | 2023-05-16 20:31:29 -0500 |
---|---|---|
committer | RunitaiLinden <davep@lindenlab.com> | 2023-05-16 20:31:29 -0500 |
commit | ee0b330b2d6a3433e3bac6ab21cf6cc3e580c605 (patch) | |
tree | 2ac68911188c025b3564d977d11e9e5e4de5c934 /indra/llrender | |
parent | a256a18884ae8e4bc6297ca59fbd5936089ad59c (diff) |
DRTVWR-559 Decruft deprecated OpenGL flags.
Diffstat (limited to 'indra/llrender')
-rw-r--r-- | indra/llrender/CMakeLists.txt | 2 | ||||
-rw-r--r-- | indra/llrender/llgl.cpp | 26 | ||||
-rw-r--r-- | indra/llrender/llgl.h | 8 | ||||
-rw-r--r-- | indra/llrender/llgldbg.cpp | 223 | ||||
-rw-r--r-- | indra/llrender/llgldbg.h | 34 | ||||
-rw-r--r-- | indra/llrender/llglstates.h | 65 | ||||
-rw-r--r-- | indra/llrender/llrender2dutils.cpp | 5 | ||||
-rw-r--r-- | indra/llrender/llrender2dutils.h | 2 |
8 files changed, 16 insertions, 349 deletions
diff --git a/indra/llrender/CMakeLists.txt b/indra/llrender/CMakeLists.txt index 92ebdb9490..9454943dc5 100644 --- a/indra/llrender/CMakeLists.txt +++ b/indra/llrender/CMakeLists.txt @@ -18,7 +18,6 @@ set(llrender_SOURCE_FILES llfontgl.cpp llfontregistry.cpp llgl.cpp - llgldbg.cpp llglslshader.cpp llgltexture.cpp llimagegl.cpp @@ -46,7 +45,6 @@ set(llrender_HEADER_FILES llfontbitmapcache.h llfontregistry.h llgl.h - llgldbg.h llglheaders.h llglslshader.h llglstates.h diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 303edddfaf..ae408dae4f 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -2454,32 +2454,11 @@ LLGLState::LLGLState(LLGLenum state, S32 enabled) : mState(state), mWasEnabled(FALSE), mIsEnabled(FALSE) { LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; - switch (state) - { - case GL_ALPHA_TEST: - case GL_NORMALIZE: - case GL_TEXTURE_GEN_R: - case GL_TEXTURE_GEN_S: - case GL_TEXTURE_GEN_T: - case GL_TEXTURE_GEN_Q: - case GL_LIGHTING: - case GL_COLOR_MATERIAL: - case GL_FOG: - case GL_LINE_STIPPLE: - case GL_POLYGON_STIPPLE: - mState = 0; - break; - } - - stop_glerror(); if (mState) { mWasEnabled = sStateMap[state]; - // we can't actually assert on this as queued changes to state are not reflected by glIsEnabled - //llassert(mWasEnabled == glIsEnabled(state)); setEnabled(enabled); - stop_glerror(); } } @@ -2511,7 +2490,6 @@ void LLGLState::setEnabled(S32 enabled) LLGLState::~LLGLState() { LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; - stop_glerror(); if (mState) { if (gDebugGL) @@ -2544,7 +2522,6 @@ LLGLState::~LLGLState() } } } - stop_glerror(); } //////////////////////////////////////////////////////////////////////////////// @@ -2921,8 +2898,7 @@ void LLGLSyncFence::wait() } LLGLSPipelineSkyBox::LLGLSPipelineSkyBox() -: mAlphaTest(GL_ALPHA_TEST) -, mCullFace(GL_CULL_FACE) +: mCullFace(GL_CULL_FACE) , mSquashClip() { } diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h index eb0650d998..4b0fbc0466 100644 --- a/indra/llrender/llgl.h +++ b/indra/llrender/llgl.h @@ -192,13 +192,13 @@ void clear_glerror(); //disable lighting for rendering hud objects //INCORRECT USAGE - LLGLEnable lighting(GL_LIGHTING); + LLGLEnable blend(GL_BLEND); renderHUD(); - LLGLDisable lighting(GL_LIGHTING); + LLGLDisable blend(GL_BLEND); //CORRECT USAGE { - LLGLEnable lighting(GL_LIGHTING); + LLGLEnable blend(GL_BLEND); renderHUD(); } @@ -206,7 +206,7 @@ void clear_glerror(); is useful: { - LLGLEnable lighting(light_hud ? GL_LIGHTING : 0); + LLGLEnable blend(blend_hud ? GL_GL_BLEND: 0); renderHUD(); } diff --git a/indra/llrender/llgldbg.cpp b/indra/llrender/llgldbg.cpp deleted file mode 100644 index 0f1d4ae742..0000000000 --- a/indra/llrender/llgldbg.cpp +++ /dev/null @@ -1,223 +0,0 @@ -/** - * @file llgldbg.cpp - * @brief Definitions for OpenGL debugging support - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -// This file sets some global GL parameters, and implements some -// useful functions for GL operations. - -#include "linden_common.h" - -#include "llgldbg.h" - -#include "llgl.h" -#include "llglheaders.h" - - -//------------------------------------------------------------------------ -// cmstr() -//------------------------------------------------------------------------ -const char *cmstr(int i) -{ - switch( i ) - { - case GL_EMISSION: return "GL_EMISSION"; - case GL_AMBIENT: return "GL_AMBIENT"; - case GL_DIFFUSE: return "GL_DIFFUSE"; - case GL_SPECULAR: return "GL_SPECULAR"; - case GL_AMBIENT_AND_DIFFUSE: return "GL_AMBIENT_AND_DIFFUSE"; - } - return "UNKNOWN"; -} - -//------------------------------------------------------------------------ -// facestr() -//------------------------------------------------------------------------ -const char *facestr(int i) -{ - switch( i ) - { - case GL_FRONT: return "GL_FRONT"; - case GL_BACK: return "GL_BACK"; - case GL_FRONT_AND_BACK: return "GL_FRONT_AND_BACK"; - } - return "UNKNOWN"; -} - -//------------------------------------------------------------------------ -// boolstr() -//------------------------------------------------------------------------ -const char *boolstr(int b) -{ - return b ? "GL_TRUE" : "GL_FALSE"; -} - -//------------------------------------------------------------------------ -// fv4() -//------------------------------------------------------------------------ -const char *fv4(F32 *f) -{ - static char str[128]; - sprintf(str, "%8.3f %8.3f %8.3f %8.3f", f[0], f[1], f[2], f[3]); - return str; -} - -//------------------------------------------------------------------------ -// fv3() -//------------------------------------------------------------------------ -const char *fv3(F32 *f) -{ - static char str[128]; /* Flawfinder: ignore */ - snprintf(str, sizeof(str), "%8.3f, %8.3f, %8.3f", f[0], f[1], f[2]); /* Flawfinder: ignore */ - return str; -} - -//------------------------------------------------------------------------ -// fv1() -//------------------------------------------------------------------------ -const char *fv1(F32 *f) -{ - static char str[128]; /* Flawfinder: ignore */ - snprintf(str, sizeof(str), "%8.3f", f[0]); /* Flawfinder: ignore */ - return str; -} - -//------------------------------------------------------------------------ -// llgl_dump() -//------------------------------------------------------------------------ -void llgl_dump() -{ - int i; - F32 fv[16]; - GLboolean b; - - LL_INFOS() << "==========================" << LL_ENDL; - LL_INFOS() << "OpenGL State" << LL_ENDL; - LL_INFOS() << "==========================" << LL_ENDL; - - LL_INFOS() << "-----------------------------------" << LL_ENDL; - LL_INFOS() << "Current Values" << LL_ENDL; - LL_INFOS() << "-----------------------------------" << LL_ENDL; - - glGetFloatv(GL_CURRENT_COLOR, fv); - LL_INFOS() << "GL_CURRENT_COLOR : " << fv4(fv) << LL_ENDL; - - glGetFloatv(GL_CURRENT_NORMAL, fv); - LL_INFOS() << "GL_CURRENT_NORMAL : " << fv3(fv) << LL_ENDL; - - LL_INFOS() << "-----------------------------------" << LL_ENDL; - LL_INFOS() << "Lighting" << LL_ENDL; - LL_INFOS() << "-----------------------------------" << LL_ENDL; - - LL_INFOS() << "GL_LIGHTING : " << boolstr(glIsEnabled(GL_LIGHTING)) << LL_ENDL; - - LL_INFOS() << "GL_COLOR_MATERIAL : " << boolstr(glIsEnabled(GL_COLOR_MATERIAL)) << LL_ENDL; - - glGetIntegerv(GL_COLOR_MATERIAL_PARAMETER, (GLint*)&i); - LL_INFOS() << "GL_COLOR_MATERIAL_PARAMETER: " << cmstr(i) << LL_ENDL; - - glGetIntegerv(GL_COLOR_MATERIAL_FACE, (GLint*)&i); - LL_INFOS() << "GL_COLOR_MATERIAL_FACE : " << facestr(i) << LL_ENDL; - - fv[0] = fv[1] = fv[2] = fv[3] = 12345.6789f; - glGetMaterialfv(GL_FRONT, GL_AMBIENT, fv); - LL_INFOS() << "GL_AMBIENT material : " << fv4(fv) << LL_ENDL; - - fv[0] = fv[1] = fv[2] = fv[3] = 12345.6789f; - glGetMaterialfv(GL_FRONT, GL_DIFFUSE, fv); - LL_INFOS() << "GL_DIFFUSE material : " << fv4(fv) << LL_ENDL; - - fv[0] = fv[1] = fv[2] = fv[3] = 12345.6789f; - glGetMaterialfv(GL_FRONT, GL_SPECULAR, fv); - LL_INFOS() << "GL_SPECULAR material : " << fv4(fv) << LL_ENDL; - - fv[0] = fv[1] = fv[2] = fv[3] = 12345.6789f; - glGetMaterialfv(GL_FRONT, GL_EMISSION, fv); - LL_INFOS() << "GL_EMISSION material : " << fv4(fv) << LL_ENDL; - - fv[0] = fv[1] = fv[2] = fv[3] = 12345.6789f; - glGetMaterialfv(GL_FRONT, GL_SHININESS, fv); - LL_INFOS() << "GL_SHININESS material : " << fv1(fv) << LL_ENDL; - - fv[0] = fv[1] = fv[2] = fv[3] = 12345.6789f; - glGetFloatv(GL_LIGHT_MODEL_AMBIENT, fv); - LL_INFOS() << "GL_LIGHT_MODEL_AMBIENT : " << fv4(fv) << LL_ENDL; - - glGetBooleanv(GL_LIGHT_MODEL_LOCAL_VIEWER, &b); - LL_INFOS() << "GL_LIGHT_MODEL_LOCAL_VIEWER: " << boolstr(b) << LL_ENDL; - - glGetBooleanv(GL_LIGHT_MODEL_TWO_SIDE, &b); - LL_INFOS() << "GL_LIGHT_MODEL_TWO_SIDE : " << boolstr(b) << LL_ENDL; - - for (int l=0; l<8; l++) - { - b = glIsEnabled(GL_LIGHT0+l); - LL_INFOS() << "GL_LIGHT" << l << " : " << boolstr(b) << LL_ENDL; - - if (!b) - continue; - - glGetLightfv(GL_LIGHT0+l, GL_AMBIENT, fv); - LL_INFOS() << " GL_AMBIENT light : " << fv4(fv) << LL_ENDL; - - glGetLightfv(GL_LIGHT0+l, GL_DIFFUSE, fv); - LL_INFOS() << " GL_DIFFUSE light : " << fv4(fv) << LL_ENDL; - - glGetLightfv(GL_LIGHT0+l, GL_SPECULAR, fv); - LL_INFOS() << " GL_SPECULAR light : " << fv4(fv) << LL_ENDL; - - glGetLightfv(GL_LIGHT0+l, GL_POSITION, fv); - LL_INFOS() << " GL_POSITION light : " << fv4(fv) << LL_ENDL; - - glGetLightfv(GL_LIGHT0+l, GL_CONSTANT_ATTENUATION, fv); - LL_INFOS() << " GL_CONSTANT_ATTENUATION : " << fv1(fv) << LL_ENDL; - - glGetLightfv(GL_LIGHT0+l, GL_QUADRATIC_ATTENUATION, fv); - LL_INFOS() << " GL_QUADRATIC_ATTENUATION : " << fv1(fv) << LL_ENDL; - - glGetLightfv(GL_LIGHT0+l, GL_SPOT_DIRECTION, fv); - LL_INFOS() << " GL_SPOT_DIRECTION : " << fv4(fv) << LL_ENDL; - - glGetLightfv(GL_LIGHT0+l, GL_SPOT_EXPONENT, fv); - LL_INFOS() << " GL_SPOT_EXPONENT : " << fv1(fv) << LL_ENDL; - - glGetLightfv(GL_LIGHT0+l, GL_SPOT_CUTOFF, fv); - LL_INFOS() << " GL_SPOT_CUTOFF : " << fv1(fv) << LL_ENDL; - } - - LL_INFOS() << "-----------------------------------" << LL_ENDL; - LL_INFOS() << "Pixel Operations" << LL_ENDL; - LL_INFOS() << "-----------------------------------" << LL_ENDL; - - LL_INFOS() << "GL_ALPHA_TEST : " << boolstr(glIsEnabled(GL_ALPHA_TEST)) << LL_ENDL; - LL_INFOS() << "GL_DEPTH_TEST : " << boolstr(glIsEnabled(GL_DEPTH_TEST)) << LL_ENDL; - - glGetBooleanv(GL_DEPTH_WRITEMASK, &b); - LL_INFOS() << "GL_DEPTH_WRITEMASK : " << boolstr(b) << LL_ENDL; - - LL_INFOS() << "GL_BLEND : " << boolstr(glIsEnabled(GL_BLEND)) << LL_ENDL; - LL_INFOS() << "GL_DITHER : " << boolstr(glIsEnabled(GL_DITHER)) << LL_ENDL; -} - -// End diff --git a/indra/llrender/llgldbg.h b/indra/llrender/llgldbg.h deleted file mode 100644 index 963579cb82..0000000000 --- a/indra/llrender/llgldbg.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file llgldbg.h - * @brief Definitions for OpenGL debugging support - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLGLDBG_H -#define LL_LLGLDBG_H - -// Dumps the current OpenGL state to the console. -void llgl_dump(); - - -#endif // LL_LLGLDBG_H diff --git a/indra/llrender/llglstates.h b/indra/llrender/llglstates.h index c46585eab4..930c5e3ed7 100644 --- a/indra/llrender/llglstates.h +++ b/indra/llrender/llglstates.h @@ -56,77 +56,44 @@ private: class LLGLSDefault { protected: - LLGLEnable mColorMaterial; - LLGLDisable mAlphaTest, mBlend, mCullFace, mDither, - mLineSmooth, mLineStipple, mNormalize, mPolygonSmooth, - mGLMultisample; + LLGLDisable mBlend, mCullFace; public: LLGLSDefault() : - // Enable - mColorMaterial(GL_COLOR_MATERIAL), // Disable - mAlphaTest(GL_ALPHA_TEST), mBlend(GL_BLEND), - mCullFace(GL_CULL_FACE), - mDither(GL_DITHER), - mLineSmooth(GL_LINE_SMOOTH), - mLineStipple(GL_LINE_STIPPLE), - mNormalize(GL_NORMALIZE), - mPolygonSmooth(GL_POLYGON_SMOOTH), - mGLMultisample(GL_MULTISAMPLE) + mCullFace(GL_CULL_FACE) { } }; class LLGLSObjectSelect { protected: - LLGLDisable mBlend, mAlphaTest; + LLGLDisable mBlend; LLGLEnable mCullFace; public: LLGLSObjectSelect() : mBlend(GL_BLEND), - mAlphaTest(GL_ALPHA_TEST), mCullFace(GL_CULL_FACE) { } }; -class LLGLSObjectSelectAlpha -{ -protected: - LLGLEnable mAlphaTest; -public: - LLGLSObjectSelectAlpha() - : mAlphaTest(GL_ALPHA_TEST) - {} -}; - //---------------------------------------------------------------------------- class LLGLSUIDefault { protected: - LLGLEnable mBlend, mAlphaTest; + LLGLEnable mBlend; LLGLDisable mCullFace; LLGLDepthTest mDepthTest; public: LLGLSUIDefault() - : mBlend(GL_BLEND), mAlphaTest(GL_ALPHA_TEST), + : mBlend(GL_BLEND), mCullFace(GL_CULL_FACE), mDepthTest(GL_FALSE, GL_TRUE, GL_LEQUAL) {} }; -class LLGLSNoAlphaTest // : public LLGLSUIDefault -{ -protected: - LLGLDisable mAlphaTest; -public: - LLGLSNoAlphaTest() - : mAlphaTest(GL_ALPHA_TEST) - {} -}; - //---------------------------------------------------------------------------- class LLGLSPipeline @@ -144,11 +111,10 @@ public: class LLGLSPipelineAlpha // : public LLGLSPipeline { protected: - LLGLEnable mBlend, mAlphaTest; + LLGLEnable mBlend; public: LLGLSPipelineAlpha() - : mBlend(GL_BLEND), - mAlphaTest(GL_ALPHA_TEST) + : mBlend(GL_BLEND) { } }; @@ -162,20 +128,9 @@ public: {} }; -class LLGLSPipelineAvatar -{ -protected: - LLGLEnable mNormalize; -public: - LLGLSPipelineAvatar() - : mNormalize(GL_NORMALIZE) - {} -}; - class LLGLSPipelineSkyBox { protected: - LLGLDisable mAlphaTest; LLGLDisable mCullFace; LLGLSquashToFarClip mSquashClip; public: @@ -201,13 +156,11 @@ public: class LLGLSTracker { protected: - LLGLEnable mCullFace, mBlend, mAlphaTest; + LLGLEnable mCullFace, mBlend; public: LLGLSTracker() : mCullFace(GL_CULL_FACE), - mBlend(GL_BLEND), - mAlphaTest(GL_ALPHA_TEST) - + mBlend(GL_BLEND) { } }; diff --git a/indra/llrender/llrender2dutils.cpp b/indra/llrender/llrender2dutils.cpp index 2d6f3c9469..52869406d2 100644 --- a/indra/llrender/llrender2dutils.cpp +++ b/indra/llrender/llrender2dutils.cpp @@ -712,11 +712,8 @@ 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 ) +void gl_line_3d( const LLVector3& start, const LLVector3& end, const LLColor4& color) { - // Stippled line - LLGLEnable stipple(GL_LINE_STIPPLE); - gGL.color4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], color.mV[VALPHA]); gGL.flush(); diff --git a/indra/llrender/llrender2dutils.h b/indra/llrender/llrender2dutils.h index 206e68f084..135738c3ba 100644 --- a/indra/llrender/llrender2dutils.h +++ b/indra/llrender/llrender2dutils.h @@ -79,7 +79,7 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), bool scale_inner = true); void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), const LLRectf& scale_rect = LLRectf(0.f, 1.f, 1.f, 0.f), bool scale_inner = true); -void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LLColor4& color, F32 phase = 0.f ); +void gl_line_3d( const LLVector3& start, const LLVector3& end, const LLColor4& color); void gl_rect_2d_simple_tex( S32 width, S32 height ); |