diff options
-rw-r--r-- | indra/llrender/llgl.cpp | 19 | ||||
-rw-r--r-- | indra/llrender/llgldbg.cpp | 4 | ||||
-rw-r--r-- | indra/llrender/llglslshader.cpp | 6 | ||||
-rw-r--r-- | indra/llrender/llglstates.h | 89 | ||||
-rw-r--r-- | indra/llrender/llimagegl.cpp | 79 | ||||
-rw-r--r-- | indra/llrender/llpostprocess.cpp | 12 | ||||
-rw-r--r-- | indra/llrender/llrender.cpp | 24 | ||||
-rw-r--r-- | indra/llrender/llrender2dutils.cpp | 2 | ||||
-rw-r--r-- | indra/llrender/llrendertarget.cpp | 2 | ||||
-rw-r--r-- | indra/llwindow/llwindowsdl.cpp | 2 |
10 files changed, 221 insertions, 18 deletions
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<LLStaticHashedString> * 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<LLStaticHashedString> * 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<LLStaticHashedString> * 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<LLImageGL>& 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; diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index 37c4d09a73..e3af20c090 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -761,7 +761,9 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B //make sure multisampling is disabled by default +#if GL_VERSION_1_3 glDisable(GL_MULTISAMPLE_ARB); +#endif // We need to do this here, once video is init'd /* |