summaryrefslogtreecommitdiff
path: root/indra/llrender
diff options
context:
space:
mode:
authorMark Palange <palange@lindenlab.com>2009-01-13 03:46:56 +0000
committerMark Palange <palange@lindenlab.com>2009-01-13 03:46:56 +0000
commit446c55538e1fb12d8a1feb541edf99c16bb29121 (patch)
tree022ca3c10bd2e0326098719cdffb65f9465ab08f /indra/llrender
parent5476aca88e4b34d4d145f3a0b04fce95402c7b1f (diff)
svn merge -r106055-107012 svn+ssh://svn.lindenlab.com/svn/linden/branches/viewer/viewer_1-22/
merge RC5 changes into trunk, plus add'l localization xml (all newly added) files that should have been added with RC0-RC4 merge, but weren't.
Diffstat (limited to 'indra/llrender')
-rw-r--r--indra/llrender/llimagegl.cpp146
-rw-r--r--indra/llrender/llimagegl.h27
-rw-r--r--indra/llrender/llpostprocess.cpp93
-rw-r--r--indra/llrender/llpostprocess.h13
-rw-r--r--indra/llrender/llrender.cpp8
5 files changed, 198 insertions, 89 deletions
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index 74b2d292e9..3e1c160198 100644
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -62,8 +62,56 @@ S32 LLImageGL::sCount = 0;
BOOL LLImageGL::sGlobalUseAnisotropic = FALSE;
F32 LLImageGL::sLastFrameTime = 0.f;
+S32 LLImageGL::sMaxTextureSize = 0 ;
+
std::set<LLImageGL*> LLImageGL::sImageList;
+//**************************************************************************************
+//below are functions for debug use
+//do not delete them even though they are not currently being used.
+void check_all_images()
+{
+ for (std::set<LLImageGL*>::iterator iter = LLImageGL::sImageList.begin();
+ iter != LLImageGL::sImageList.end(); iter++)
+ {
+ LLImageGL* glimage = *iter;
+ if (glimage->getTexName() && glimage->isGLTextureCreated())
+ {
+ gGL.getTexUnit(0)->bind(glimage) ;
+ glimage->checkTexSize() ;
+ gGL.getTexUnit(0)->unbind(glimage->getTarget()) ;
+ }
+ }
+}
+
+void LLImageGL::checkTexSize() const
+{
+ if (gDebugGL && mTarget == GL_TEXTURE_2D)
+ {
+ GLint texname;
+ glGetIntegerv(GL_TEXTURE_BINDING_2D, &texname);
+ if (texname != mTexName)
+ {
+ llerrs << "Invalid texture bound!" << llendl;
+ }
+ stop_glerror() ;
+ LLGLint x = 0, y = 0 ;
+ glGetTexLevelParameteriv(mTarget, 0, GL_TEXTURE_WIDTH, (GLint*)&x);
+ glGetTexLevelParameteriv(mTarget, 0, GL_TEXTURE_HEIGHT, (GLint*)&y) ;
+ stop_glerror() ;
+ if(!x || !y)
+ {
+ return ;
+ }
+ if(x != (mWidth >> mCurrentDiscardLevel) || y != (mHeight >> mCurrentDiscardLevel))
+ {
+ llerrs << "wrong texture size and discard level!" << llendl ;
+ }
+ }
+}
+//end of debug functions
+//**************************************************************************************
+
//----------------------------------------------------------------------------
//static
@@ -149,17 +197,22 @@ void LLImageGL::destroyGL(BOOL save_state)
{
gGL.getTexUnit(stage)->unbind(LLTexUnit::TT_TEXTURE);
}
+
for (std::set<LLImageGL*>::iterator iter = sImageList.begin();
iter != sImageList.end(); iter++)
{
LLImageGL* glimage = *iter;
- if (glimage->mTexName && glimage->mComponents)
+ if (glimage->mTexName)
{
- if (save_state && glimage->isInitialized())
+ if (save_state && glimage->isGLTextureCreated() && glimage->mComponents)
{
glimage->mSaveData = new LLImageRaw;
- glimage->readBackRaw(glimage->mCurrentDiscardLevel, glimage->mSaveData, false);
+ if(!glimage->readBackRaw(glimage->mCurrentDiscardLevel, glimage->mSaveData, false))
+ {
+ glimage->mSaveData = NULL ;
+ }
}
+
glimage->destroyGLTexture();
stop_glerror();
}
@@ -173,9 +226,13 @@ void LLImageGL::restoreGL()
iter != sImageList.end(); iter++)
{
LLImageGL* glimage = *iter;
- if (glimage->mSaveData.notNull() && glimage->mSaveData->getComponents())
+ if(glimage->getTexName())
+ {
+ llerrs << "tex name is not 0." << llendl ;
+ }
+ if (glimage->mSaveData.notNull())
{
- if (glimage->getComponents())
+ if (glimage->getComponents() && glimage->mSaveData->getComponents())
{
glimage->createGLTexture(glimage->mCurrentDiscardLevel, glimage->mSaveData);
stop_glerror();
@@ -283,7 +340,7 @@ void LLImageGL::init(BOOL usemipmaps)
mFormatSwapBytes = FALSE;
mHasExplicitFormat = FALSE;
- mInitialized = true;
+ mGLTextureCreated = FALSE ;
}
void LLImageGL::cleanup()
@@ -322,6 +379,16 @@ void LLImageGL::setSize(S32 width, S32 height, S32 ncomponents)
{
if (width != mWidth || height != mHeight || ncomponents != mComponents)
{
+ if(width > 1024 || height > 1024)
+ {
+ llwarns << "texture size is big: width: " << width << " height: " << height << llendl ;
+ if(!sMaxTextureSize)
+ {
+ glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint*)&sMaxTextureSize) ;
+ }
+ llwarns << "max texture size is: " << sMaxTextureSize << llendl ;
+ }
+
// Check if dimensions are a power of two!
if (!checkSize(width,height))
{
@@ -645,7 +712,7 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips)
mHasMipMaps = FALSE;
}
stop_glerror();
- mInitialized = true;
+ mGLTextureCreated = true;
}
BOOL LLImageGL::setSubImage(const U8* datap, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height)
@@ -735,9 +802,8 @@ BOOL LLImageGL::setSubImage(const U8* datap, S32 data_width, S32 data_height, S3
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
stop_glerror();
- mInitialized = true;
+ mGLTextureCreated = true;
}
-
return TRUE;
}
@@ -752,7 +818,7 @@ BOOL LLImageGL::setSubImageFromFrameBuffer(S32 fb_x, S32 fb_y, S32 x_pos, S32 y_
if (gGL.getTexUnit(0)->bind(this, true))
{
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, fb_x, fb_y, x_pos, y_pos, width, height);
- mInitialized = true;
+ mGLTextureCreated = true;
stop_glerror();
return TRUE;
}
@@ -762,6 +828,36 @@ BOOL LLImageGL::setSubImageFromFrameBuffer(S32 fb_x, S32 fb_y, S32 x_pos, S32 y_
}
}
+//create an empty GL texture: just create a texture name
+//the texture is assiciate with some image by calling glTexImage outside LLImageGL
+BOOL LLImageGL::createGLTexture()
+{
+ if (gGLManager.mIsDisabled)
+ {
+ llwarns << "Trying to create a texture while GL is disabled!" << llendl;
+ return FALSE;
+ }
+
+ mGLTextureCreated = false ; //do not save this texture when gl is destroyed.
+
+ llassert(gGLManager.mInited);
+ stop_glerror();
+
+ if(mTexName)
+ {
+ glDeleteTextures(1, (reinterpret_cast<GLuint*>(&mTexName))) ;
+ }
+
+ glGenTextures(1, (GLuint*)&mTexName);
+ stop_glerror();
+ if (!mTexName)
+ {
+ llerrs << "LLImageGL::createGLTexture failed to make an empty texture" << llendl;
+ }
+
+ return TRUE ;
+}
+
BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename/*=0*/)
{
if (gGLManager.mIsDisabled)
@@ -769,6 +865,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S
llwarns << "Trying to create a texture while GL is disabled!" << llendl;
return FALSE;
}
+ mGLTextureCreated = false ;
llassert(gGLManager.mInited);
stop_glerror();
@@ -874,7 +971,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_
#endif
}
- mCurrentDiscardLevel = discard_level;
+ mCurrentDiscardLevel = discard_level;
setImage(data_in, data_hasmips);
@@ -975,7 +1072,7 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre
discard_level = mCurrentDiscardLevel;
}
- if (mTexName == 0 || discard_level < mCurrentDiscardLevel)
+ if (mTexName == 0 || discard_level < mCurrentDiscardLevel || discard_level > mMaxDiscardLevel )
{
return FALSE;
}
@@ -986,18 +1083,8 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre
gGL.getTexUnit(0)->unbind(mBindTarget);
llverify(gGL.getTexUnit(0)->bind(this));
- if (gDebugGL)
- {
- if (mTarget == GL_TEXTURE_2D)
- {
- GLint texname;
- glGetIntegerv(GL_TEXTURE_BINDING_2D, &texname);
- if (texname != mTexName)
- {
- llerrs << "Invalid texture bound!" << llendl;
- }
- }
- }
+ //debug code, leave it there commented.
+ //checkTexSize() ;
LLGLint glwidth = 0;
glGetTexLevelParameteriv(mTarget, gl_discard, GL_TEXTURE_WIDTH, (GLint*)&glwidth);
@@ -1006,7 +1093,7 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre
// No mip data smaller than current discard level
return FALSE;
}
-
+
S32 width = getWidth(discard_level);
S32 height = getHeight(discard_level);
S32 ncomponents = getComponents();
@@ -1014,6 +1101,13 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre
{
return FALSE;
}
+ if(width < glwidth)
+ {
+ llwarns << "texture size is smaller than it should be." << llendl ;
+ llwarns << "width: " << width << " glwidth: " << glwidth << " mWidth: " << mWidth <<
+ " mCurrentDiscardLevel: " << (S32)mCurrentDiscardLevel << " discard_level: " << (S32)discard_level << llendl ;
+ return FALSE ;
+ }
if (width <= 0 || width > 2048 || height <= 0 || height > 2048 || ncomponents < 1 || ncomponents > 4)
{
@@ -1099,7 +1193,7 @@ void LLImageGL::destroyGLTexture()
glDeleteTextures(1, (GLuint*)&mTexName);
mTexName = 0;
-
+ mGLTextureCreated = FALSE ;
stop_glerror();
}
}
diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h
index b3aa8f0984..01159ed744 100644
--- a/indra/llrender/llimagegl.h
+++ b/indra/llrender/llimagegl.h
@@ -91,6 +91,7 @@ public:
void setSize(S32 width, S32 height, S32 ncomponents);
+ BOOL createGLTexture() ;
BOOL createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename = 0);
BOOL createGLTexture(S32 discard_level, const U8* data, BOOL data_hasmips = FALSE, S32 usename = 0);
void setImage(const LLImageRaw* imageraw);
@@ -114,6 +115,8 @@ public:
S32 getDiscardLevel() const { return mCurrentDiscardLevel; }
S32 getMaxDiscardLevel() const { return mMaxDiscardLevel; }
+ S32 getCurrentWidth() const { return mWidth ;}
+ S32 getCurrentHeight() const { return mHeight ;}
S32 getWidth(S32 discard_level = -1) const;
S32 getHeight(S32 discard_level = -1) const;
U8 getComponents() const { return mComponents; }
@@ -135,8 +138,8 @@ public:
void setTarget(const LLGLenum target, const LLTexUnit::eTextureType bind_target);
LLTexUnit::eTextureType getTarget(void) const { return mBindTarget; }
- bool isInitialized(void) const { return mInitialized; }
- void setInitialized (bool initialized) { mInitialized = initialized; }
+ bool isGLTextureCreated(void) const { return mGLTextureCreated ; }
+ void setGLTextureCreated (bool initialized) { mGLTextureCreated = initialized; }
BOOL getUseMipMaps() const { return mUseMipMaps; }
void setUseMipMaps(BOOL usemips) { mUseMipMaps = usemips; }
@@ -148,6 +151,8 @@ public:
void updatePickMask(S32 width, S32 height, const U8* data_in);
BOOL getMask(const LLVector2 &tc);
+ void checkTexSize() const ;
+
protected:
void init(BOOL usemipmaps);
virtual void cleanup(); // Clean up the LLImageGL so it can be reinitialized. Be careful when using this in derived class destructors
@@ -165,21 +170,20 @@ private:
S8 mHasExplicitFormat; // If false (default), GL format is f(mComponents)
S8 mAutoGenMips;
+ bool mGLTextureCreated ;
+ LLGLuint mTexName;
+ U16 mWidth;
+ U16 mHeight;
+ S8 mCurrentDiscardLevel;
+
protected:
LLGLenum mTarget; // Normally GL_TEXTURE2D, sometimes something else (ex. cube maps)
LLTexUnit::eTextureType mBindTarget; // Normally TT_TEXTURE, sometimes something else (ex. cube maps)
- bool mInitialized;
-
- LLGLuint mTexName;
-
+
LLGLboolean mIsResident;
-
- U16 mWidth;
- U16 mHeight;
S8 mComponents;
- S8 mMaxDiscardLevel;
- S8 mCurrentDiscardLevel;
+ S8 mMaxDiscardLevel;
S8 mDontDiscard; // Keep full res version of this image (for UI, etc)
S8 mClampS; // Need to save clamp state
@@ -210,6 +214,7 @@ public:
static U32 sUniqueCount; // Tracks number of unique texture binds for current frame
static BOOL sGlobalUseAnisotropic;
+ static S32 sMaxTextureSize ;
#if DEBUG_MISS
BOOL mMissed; // Missed on last bind?
BOOL getMissed() const { return mMissed; };
diff --git a/indra/llrender/llpostprocess.cpp b/indra/llrender/llpostprocess.cpp
index 6aff279a21..940abb54d4 100644
--- a/indra/llrender/llpostprocess.cpp
+++ b/indra/llrender/llpostprocess.cpp
@@ -52,12 +52,14 @@ static const float LUMINANCE_B = 0.114f;
static const char * const XML_FILENAME = "postprocesseffects.xml";
LLPostProcess::LLPostProcess(void) :
- sceneRenderTexture(0), noiseTexture(0),
- tempBloomTexture(0),
initialized(false),
mAllEffects(LLSD::emptyMap()),
screenW(1), screenH(1)
{
+ mSceneRenderTexture = NULL ;
+ mNoiseTexture = NULL ;
+ mTempBloomTexture = NULL ;
+
/* Do nothing. Needs to be updated to use our current shader system, and to work with the move into llrender.
std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", XML_FILENAME));
LL_DEBUGS2("AppInit", "Shaders") << "Loading PostProcess Effects settings from " << pathName << LL_ENDL;
@@ -111,9 +113,7 @@ LLPostProcess::LLPostProcess(void) :
LLPostProcess::~LLPostProcess(void)
{
- glDeleteTextures(1, &sceneRenderTexture);
- glDeleteTextures(1, &noiseTexture);
- glDeleteTextures(1, &tempBloomTexture);
+ invalidate() ;
}
// static
@@ -158,6 +158,13 @@ void LLPostProcess::saveEffect(std::string const & effectName)
formatter->format(mAllEffects, effectsXML);
*/
}
+void LLPostProcess::invalidate()
+{
+ mSceneRenderTexture = NULL ;
+ mNoiseTexture = NULL ;
+ mTempBloomTexture = NULL ;
+ initialized = FALSE ;
+}
void LLPostProcess::apply(unsigned int width, unsigned int height)
{
@@ -173,7 +180,7 @@ void LLPostProcess::initialize(unsigned int width, unsigned int height)
{
screenW = width;
screenH = height;
- createTexture(sceneRenderTexture, screenW, screenH);
+ createTexture(mSceneRenderTexture, screenW, screenH);
initialized = true;
checkError();
@@ -199,16 +206,20 @@ void LLPostProcess::applyShaders(void)
}
if (tweaks.useNightVisionShader()){
/// If any of the above shaders have been called update the frame buffer;
- if (tweaks.useColorFilter()){
- copyFrameBuffer(sceneRenderTexture, screenW, screenH);
+ if (tweaks.useColorFilter())
+ {
+ GLuint tex = mSceneRenderTexture->getTexName() ;
+ copyFrameBuffer(tex, screenW, screenH);
}
applyNightVisionShader();
checkError();
}
if (tweaks.useBloomShader()){
/// If any of the above shaders have been called update the frame buffer;
- if (tweaks.useColorFilter().asBoolean() || tweaks.useNightVisionShader().asBoolean()){
- copyFrameBuffer(sceneRenderTexture, screenW, screenH);
+ if (tweaks.useColorFilter().asBoolean() || tweaks.useNightVisionShader().asBoolean())
+ {
+ GLuint tex = mSceneRenderTexture->getTexName() ;
+ copyFrameBuffer(tex, screenW, screenH);
}
applyBloomShader();
checkError();
@@ -306,7 +317,7 @@ void LLPostProcess::createNightVisionShader(void)
nightVisionUniforms["noiseStrength"] = 0;
nightVisionUniforms["lumWeights"] = 0;
- createNoiseTexture(noiseTexture);
+ createNoiseTexture(mNoiseTexture);
}
void LLPostProcess::applyBloomShader(void)
@@ -316,7 +327,7 @@ void LLPostProcess::applyBloomShader(void)
void LLPostProcess::createBloomShader(void)
{
- createTexture(tempBloomTexture, unsigned(screenW * 0.5), unsigned(screenH * 0.5));
+ createTexture(mTempBloomTexture, unsigned(screenW * 0.5), unsigned(screenH * 0.5));
/// Create Bloom Extract Shader
bloomExtractUniforms["RenderTexture"] = 0;
@@ -348,7 +359,10 @@ void LLPostProcess::doEffects(void)
glPushClientAttrib(GL_ALL_ATTRIB_BITS);
/// Copy the screen buffer to the render texture
- copyFrameBuffer(sceneRenderTexture, screenW, screenH);
+ {
+ GLuint tex = mSceneRenderTexture->getTexName() ;
+ copyFrameBuffer(tex, screenW, screenH);
+ }
/// Clear the frame buffer.
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
@@ -479,43 +493,42 @@ void LLPostProcess::changeOrthogonal(unsigned int width, unsigned int height)
viewOrthogonal(width, height);
}
-void LLPostProcess::createTexture(GLuint & texture, unsigned int width, unsigned int height)
+void LLPostProcess::createTexture(LLPointer<LLImageGL>& texture, unsigned int width, unsigned int height)
{
- if (texture != 0){
- glDeleteTextures(1, &texture);
- }
-
- std::vector<GLubyte> data(width * height * 4, 0);
-
- glGenTextures(1, &texture);
- gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, texture);
- glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 4, width, height, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, &data[0]);
- glTexParameteri(GL_TEXTURE_RECTANGLE_ARB,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
- glTexParameteri(GL_TEXTURE_RECTANGLE_ARB,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
- glTexParameteri(GL_TEXTURE_RECTANGLE_ARB,GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_RECTANGLE_ARB,GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-}
+ std::vector<GLubyte> data(width * height * 4, 0) ;
-void LLPostProcess::createNoiseTexture(GLuint & texture)
-{
- if (texture != 0){
- glDeleteTextures(1, &texture);
+ texture = new LLImageGL(FALSE) ;
+ if(texture->createGLTexture())
+ {
+ gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, texture->getTexName());
+ glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 4, width, height, 0,
+ GL_RGBA, GL_UNSIGNED_BYTE, &data[0]);
+ glTexParameteri(GL_TEXTURE_RECTANGLE_ARB,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_RECTANGLE_ARB,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_RECTANGLE_ARB,GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameteri(GL_TEXTURE_RECTANGLE_ARB,GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
}
- glGenTextures(1, &texture);
+}
+void LLPostProcess::createNoiseTexture(LLPointer<LLImageGL>& texture)
+{
std::vector<GLubyte> buffer(NOISE_SIZE * NOISE_SIZE);
for (unsigned int i = 0; i < NOISE_SIZE; i++){
for (unsigned int k = 0; k < NOISE_SIZE; k++){
buffer[(i * NOISE_SIZE) + k] = (GLubyte)((double) rand() / ((double) RAND_MAX + 1.f) * 255.f);
}
}
- gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, texture);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, NOISE_SIZE, NOISE_SIZE, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, &buffer[0]);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+
+ texture = new LLImageGL(FALSE) ;
+ if(texture->createGLTexture())
+ {
+ gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, texture->getTexName());
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, NOISE_SIZE, NOISE_SIZE, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, &buffer[0]);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+ }
}
bool LLPostProcess::checkError(void)
diff --git a/indra/llrender/llpostprocess.h b/indra/llrender/llpostprocess.h
index 8e278f8e10..e5e34d920c 100644
--- a/indra/llrender/llpostprocess.h
+++ b/indra/llrender/llpostprocess.h
@@ -184,21 +184,24 @@ public:
};
- GLuint sceneRenderTexture;
- GLuint noiseTexture;
- GLuint tempBloomTexture;
bool initialized;
PostProcessTweaks tweaks;
// the map of all availible effects
LLSD mAllEffects;
+private:
+ LLPointer<LLImageGL> mSceneRenderTexture ;
+ LLPointer<LLImageGL> mNoiseTexture ;
+ LLPointer<LLImageGL> mTempBloomTexture ;
+
public:
LLPostProcess(void);
~LLPostProcess(void);
void apply(unsigned int width, unsigned int height);
+ void invalidate() ;
/// Perform global initialization for this class.
static void initClass(void);
@@ -252,9 +255,9 @@ private:
/// OpenGL Helper Functions
void getShaderUniforms(glslUniforms & uniforms, GLhandleARB & prog);
- void createTexture(GLuint & texture, unsigned int width, unsigned int height);
+ void createTexture(LLPointer<LLImageGL>& texture, unsigned int width, unsigned int height);
void copyFrameBuffer(GLuint & texture, unsigned int width, unsigned int height);
- void createNoiseTexture(GLuint & texture);
+ void createNoiseTexture(LLPointer<LLImageGL>& texture);
bool checkError(void);
void checkShaderError(GLhandleARB shader);
void drawOrthoQuad(unsigned int width, unsigned int height, QuadType type);
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index 433be9e2eb..c7068133d2 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -187,17 +187,11 @@ bool LLTexUnit::bind(const LLImageGL* texture, bool forceBind)
llwarns << "NULL LLTexUnit::bind texture" << llendl;
return false;
}
-
- if (!texture->isInitialized() && !forceBind)
- {
- return texture->bindDefaultImage(mIndex);
- }
-
+
if (!texture->getTexName()) //if texture does not exist
{
return texture->bindDefaultImage(mIndex);
}
-
// Disabled caching of binding state.
activate();
enable(texture->getTarget());