summaryrefslogtreecommitdiff
path: root/indra/llrender/llgl.h
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2024-04-29 07:43:28 +0300
committerAndrey Lihatskiy <alihatskiy@productengine.com>2024-04-29 07:56:09 +0300
commit1b68f71348ecf3983b76b40d7940da8377f049b7 (patch)
tree2974eddaef130a067c26033d60a59fc790365b3d /indra/llrender/llgl.h
parentaf4ea94efc1999f3b19fd8d643d0331f0b77e265 (diff)
#824 Process source files in bulk: replace tabs with spaces, convert CRLF to LF, and trim trailing whitespaces as needed
Diffstat (limited to 'indra/llrender/llgl.h')
-rw-r--r--indra/llrender/llgl.h332
1 files changed, 166 insertions, 166 deletions
diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h
index 4b0fbc0466..5a7ad943df 100644
--- a/indra/llrender/llgl.h
+++ b/indra/llrender/llgl.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llgl.h
* @brief LLGL definition
*
* $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$
*/
@@ -64,81 +64,81 @@ class LLSD;
class LLGLManager
{
public:
- LLGLManager();
+ LLGLManager();
- bool initGL();
- void shutdownGL();
+ bool initGL();
+ void shutdownGL();
- void initWGL(); // Initializes stupid WGL extensions
+ void initWGL(); // Initializes stupid WGL extensions
- std::string getRawGLString(); // For sending to simulator
+ std::string getRawGLString(); // For sending to simulator
- BOOL mInited;
- BOOL mIsDisabled;
+ BOOL mInited;
+ BOOL mIsDisabled;
- // OpenGL limits
- S32 mMaxSamples;
- S32 mNumTextureImageUnits;
- S32 mMaxSampleMaskWords;
- S32 mMaxColorTextureSamples;
- S32 mMaxDepthTextureSamples;
- S32 mMaxIntegerSamples;
+ // OpenGL limits
+ S32 mMaxSamples;
+ S32 mNumTextureImageUnits;
+ S32 mMaxSampleMaskWords;
+ S32 mMaxColorTextureSamples;
+ S32 mMaxDepthTextureSamples;
+ S32 mMaxIntegerSamples;
S32 mGLMaxVertexRange;
S32 mGLMaxIndexRange;
S32 mGLMaxTextureSize;
F32 mMaxAnisotropy = 0.f;
- // GL 4.x capabilities
- bool mHasCubeMapArray = false;
- bool mHasDebugOutput = false;
+ // GL 4.x capabilities
+ bool mHasCubeMapArray = false;
+ bool mHasDebugOutput = false;
bool mHasTransformFeedback = false;
bool mHasAnisotropic = false;
-
- // Vendor-specific extensions
+
+ // Vendor-specific extensions
bool mHasAMDAssociations = false;
- BOOL mIsAMD;
- BOOL mIsNVIDIA;
- BOOL mIsIntel;
+ BOOL mIsAMD;
+ BOOL mIsNVIDIA;
+ BOOL mIsIntel;
#if LL_DARWIN
- // Needed to distinguish problem cards on older Macs that break with Materials
- BOOL mIsMobileGF;
+ // Needed to distinguish problem cards on older Macs that break with Materials
+ BOOL mIsMobileGF;
#endif
-
- // Whether this version of GL is good enough for SL to use
- BOOL mHasRequirements;
- S32 mDriverVersionMajor;
- S32 mDriverVersionMinor;
- S32 mDriverVersionRelease;
- F32 mGLVersion; // e.g = 1.4
- S32 mGLSLVersionMajor;
- S32 mGLSLVersionMinor;
- std::string mDriverVersionVendorString;
- std::string mGLVersionString;
+ // Whether this version of GL is good enough for SL to use
+ BOOL mHasRequirements;
+
+ S32 mDriverVersionMajor;
+ S32 mDriverVersionMinor;
+ S32 mDriverVersionRelease;
+ F32 mGLVersion; // e.g = 1.4
+ S32 mGLSLVersionMajor;
+ S32 mGLSLVersionMinor;
+ std::string mDriverVersionVendorString;
+ std::string mGLVersionString;
- S32 mVRAM; // VRAM in MB
-
- void getPixelFormat(); // Get the best pixel format
+ S32 mVRAM; // VRAM in MB
- std::string getGLInfoString();
- void printGLInfoString();
- void getGLInfo(LLSD& info);
+ void getPixelFormat(); // Get the best pixel format
- void asLLSD(LLSD& info);
+ std::string getGLInfoString();
+ void printGLInfoString();
+ void getGLInfo(LLSD& info);
- // In ALL CAPS
- std::string mGLVendor;
- std::string mGLVendorShort;
+ void asLLSD(LLSD& info);
- // In ALL CAPS
- std::string mGLRenderer;
+ // In ALL CAPS
+ std::string mGLVendor;
+ std::string mGLVendorShort;
+
+ // In ALL CAPS
+ std::string mGLRenderer;
private:
- void initExtensions();
- void initGLStates();
- void initGLImages();
+ void initExtensions();
+ void initGLStates();
+ void initGLImages();
};
extern LLGLManager gGLManager;
@@ -173,51 +173,51 @@ void clear_glerror();
// This is a class for GL state management
/*
- GL STATE MANAGEMENT DESCRIPTION
+ GL STATE MANAGEMENT DESCRIPTION
- LLGLState and its two subclasses, LLGLEnable and LLGLDisable, manage the current
- enable/disable states of the GL to prevent redundant setting of state within a
- render path or the accidental corruption of what state the next path expects.
+ LLGLState and its two subclasses, LLGLEnable and LLGLDisable, manage the current
+ enable/disable states of the GL to prevent redundant setting of state within a
+ render path or the accidental corruption of what state the next path expects.
- Essentially, wherever you would call glEnable set a state and then
- subsequently reset it by calling glDisable (or vice versa), make an instance of
- LLGLEnable with the state you want to set, and assume it will be restored to its
- original state when that instance of LLGLEnable is destroyed. It is good practice
- to exploit stack frame controls for optimal setting/unsetting and readability of
- code. In llglstates.h, there are a collection of helper classes that define groups
- of enables/disables that can cause multiple states to be set with the creation of
- one instance.
+ Essentially, wherever you would call glEnable set a state and then
+ subsequently reset it by calling glDisable (or vice versa), make an instance of
+ LLGLEnable with the state you want to set, and assume it will be restored to its
+ original state when that instance of LLGLEnable is destroyed. It is good practice
+ to exploit stack frame controls for optimal setting/unsetting and readability of
+ code. In llglstates.h, there are a collection of helper classes that define groups
+ of enables/disables that can cause multiple states to be set with the creation of
+ one instance.
- Sample usage:
+ Sample usage:
- //disable lighting for rendering hud objects
- //INCORRECT USAGE
- LLGLEnable blend(GL_BLEND);
- renderHUD();
- LLGLDisable blend(GL_BLEND);
+ //disable lighting for rendering hud objects
+ //INCORRECT USAGE
+ LLGLEnable blend(GL_BLEND);
+ renderHUD();
+ LLGLDisable blend(GL_BLEND);
- //CORRECT USAGE
- {
- LLGLEnable blend(GL_BLEND);
- renderHUD();
- }
+ //CORRECT USAGE
+ {
+ LLGLEnable blend(GL_BLEND);
+ renderHUD();
+ }
- If a state is to be set on a conditional, the following mechanism
- is useful:
+ If a state is to be set on a conditional, the following mechanism
+ is useful:
- {
- LLGLEnable blend(blend_hud ? GL_GL_BLEND: 0);
- renderHUD();
- }
+ {
+ LLGLEnable blend(blend_hud ? GL_GL_BLEND: 0);
+ renderHUD();
+ }
- A LLGLState initialized with a parameter of 0 does nothing.
+ A LLGLState initialized with a parameter of 0 does nothing.
- LLGLState works by maintaining a map of the current GL states, and ignoring redundant
- enables/disables. If a redundant call is attempted, it becomes a noop, otherwise,
- it is set in the constructor and reset in the destructor.
+ LLGLState works by maintaining a map of the current GL states, and ignoring redundant
+ enables/disables. If a redundant call is attempted, it becomes a noop, otherwise,
+ it is set in the constructor and reset in the destructor.
- For debugging GL state corruption, running with debug enabled will trigger asserts
- if the existing GL state does not match the expected GL state.
+ For debugging GL state corruption, running with debug enabled will trigger asserts
+ if the existing GL state does not match the expected GL state.
*/
@@ -226,79 +226,79 @@ void clear_glerror();
class LLGLState
{
public:
- static void initClass();
- static void restoreGL();
+ static void initClass();
+ static void restoreGL();
- static void resetTextureStates();
- static void dumpStates();
+ static void resetTextureStates();
+ static void dumpStates();
// make sure GL blend function, GL states, and GL color mask match
- // what we expect
+ // what we expect
// writeAlpha - whether or not writing to alpha channel is expected
- static void checkStates(GLboolean writeAlpha = GL_TRUE);
+ static void checkStates(GLboolean writeAlpha = GL_TRUE);
protected:
- static boost::unordered_map<LLGLenum, LLGLboolean> sStateMap;
-
+ static boost::unordered_map<LLGLenum, LLGLboolean> sStateMap;
+
public:
- enum { CURRENT_STATE = -2 };
- LLGLState(LLGLenum state, S32 enabled = CURRENT_STATE);
- ~LLGLState();
- void setEnabled(S32 enabled);
- void enable() { setEnabled(TRUE); }
- void disable() { setEnabled(FALSE); }
+ enum { CURRENT_STATE = -2 };
+ LLGLState(LLGLenum state, S32 enabled = CURRENT_STATE);
+ ~LLGLState();
+ void setEnabled(S32 enabled);
+ void enable() { setEnabled(TRUE); }
+ void disable() { setEnabled(FALSE); }
protected:
- LLGLenum mState;
- BOOL mWasEnabled;
- BOOL mIsEnabled;
+ LLGLenum mState;
+ BOOL mWasEnabled;
+ BOOL mIsEnabled;
};
// New LLGLState class wrappers that don't depend on actual GL flags.
class LLGLEnableBlending : public LLGLState
{
public:
- LLGLEnableBlending(bool enable);
+ LLGLEnableBlending(bool enable);
};
class LLGLEnableAlphaReject : public LLGLState
{
public:
- LLGLEnableAlphaReject(bool enable);
+ LLGLEnableAlphaReject(bool enable);
};
// Enable with functor
class LLGLEnableFunc : LLGLState
{
public:
- LLGLEnableFunc(LLGLenum state, bool enable, boost::function<void()> func)
- : LLGLState(state, enable)
- {
- if (enable)
- {
- func();
- }
- }
+ LLGLEnableFunc(LLGLenum state, bool enable, boost::function<void()> func)
+ : LLGLState(state, enable)
+ {
+ if (enable)
+ {
+ func();
+ }
+ }
};
/// TODO: Being deprecated.
class LLGLEnable : public LLGLState
{
public:
- LLGLEnable(LLGLenum state) : LLGLState(state, TRUE) {}
+ LLGLEnable(LLGLenum state) : LLGLState(state, TRUE) {}
};
/// TODO: Being deprecated.
class LLGLDisable : public LLGLState
{
public:
- LLGLDisable(LLGLenum state) : LLGLState(state, FALSE) {}
+ LLGLDisable(LLGLenum state) : LLGLState(state, FALSE) {}
};
/*
Store and modify projection matrix to create an oblique
projection that clips to the specified plane. Oblique
projections alter values in the depth buffer, so this
- class should not be used mid-renderpass.
+ class should not be used mid-renderpass.
Restores projection matrix on destruction.
GL_MODELVIEW_MATRIX is active whenever program execution
@@ -306,21 +306,21 @@ public:
Does not stack.
Caches inverse of projection matrix used in gGLObliqueProjectionInverse
*/
-class LLGLUserClipPlane
+class LLGLUserClipPlane
{
public:
-
- LLGLUserClipPlane(const LLPlane& plane, const glh::matrix4f& modelview, const glh::matrix4f& projection, bool apply = true);
- ~LLGLUserClipPlane();
- void setPlane(F32 a, F32 b, F32 c, F32 d);
+ LLGLUserClipPlane(const LLPlane& plane, const glh::matrix4f& modelview, const glh::matrix4f& projection, bool apply = true);
+ ~LLGLUserClipPlane();
+
+ void setPlane(F32 a, F32 b, F32 c, F32 d);
void disable();
private:
- bool mApply;
+ bool mApply;
- glh::matrix4f mProjection;
- glh::matrix4f mModelview;
+ glh::matrix4f mProjection;
+ glh::matrix4f mModelview;
};
/*
@@ -334,40 +334,40 @@ class LLGLSquashToFarClip
{
public:
LLGLSquashToFarClip();
- LLGLSquashToFarClip(glh::matrix4f& projection, U32 layer = 0);
+ LLGLSquashToFarClip(glh::matrix4f& projection, U32 layer = 0);
void setProjectionMatrix(glh::matrix4f& projection, U32 layer);
- ~LLGLSquashToFarClip();
+ ~LLGLSquashToFarClip();
};
/*
- Interface for objects that need periodic GL updates applied to them.
- Used to synchronize GL updates with GL thread.
+ Interface for objects that need periodic GL updates applied to them.
+ Used to synchronize GL updates with GL thread.
*/
class LLGLUpdate
{
public:
- static std::list<LLGLUpdate*> sGLQ;
-
- BOOL mInQ;
- LLGLUpdate()
- : mInQ(FALSE)
- {
- }
- virtual ~LLGLUpdate()
- {
- if (mInQ)
- {
- std::list<LLGLUpdate*>::iterator iter = std::find(sGLQ.begin(), sGLQ.end(), this);
- if (iter != sGLQ.end())
- {
- sGLQ.erase(iter);
- }
- }
- }
- virtual void updateGL() = 0;
+ static std::list<LLGLUpdate*> sGLQ;
+
+ BOOL mInQ;
+ LLGLUpdate()
+ : mInQ(FALSE)
+ {
+ }
+ virtual ~LLGLUpdate()
+ {
+ if (mInQ)
+ {
+ std::list<LLGLUpdate*>::iterator iter = std::find(sGLQ.begin(), sGLQ.end(), this);
+ if (iter != sGLQ.end())
+ {
+ sGLQ.erase(iter);
+ }
+ }
+ }
+ virtual void updateGL() = 0;
};
const U32 FENCE_WAIT_TIME_NANOSECONDS = 1000; //1 ms
@@ -375,26 +375,26 @@ const U32 FENCE_WAIT_TIME_NANOSECONDS = 1000; //1 ms
class LLGLFence
{
public:
- virtual ~LLGLFence()
- {
- }
+ virtual ~LLGLFence()
+ {
+ }
- virtual void placeFence() = 0;
- virtual bool isCompleted() = 0;
- virtual void wait() = 0;
+ virtual void placeFence() = 0;
+ virtual bool isCompleted() = 0;
+ virtual void wait() = 0;
};
class LLGLSyncFence : public LLGLFence
{
public:
- GLsync mSync;
-
- LLGLSyncFence();
- virtual ~LLGLSyncFence();
-
- void placeFence();
- bool isCompleted();
- void wait();
+ GLsync mSync;
+
+ LLGLSyncFence();
+ virtual ~LLGLSyncFence();
+
+ void placeFence();
+ bool isCompleted();
+ void wait();
};
extern LLMatrix4 gGLObliqueProjectionInverse;
@@ -471,6 +471,6 @@ extern BOOL gGLActive;
#ifndef GL_DEPTH24_STENCIL8
#define GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_EXT
-#endif
+#endif
#endif // LL_LLGL_H