summaryrefslogtreecommitdiff
path: root/indra/llrender/llgltexture.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llrender/llgltexture.cpp')
-rw-r--r--indra/llrender/llgltexture.cpp198
1 files changed, 106 insertions, 92 deletions
diff --git a/indra/llrender/llgltexture.cpp b/indra/llrender/llgltexture.cpp
index 3a6eebebba..c0e5477cea 100644
--- a/indra/llrender/llgltexture.cpp
+++ b/indra/llrender/llgltexture.cpp
@@ -30,20 +30,20 @@
// static
S32 LLGLTexture::getTotalNumOfCategories()
{
- return MAX_GL_IMAGE_CATEGORY - (BOOST_HIGH - BOOST_SCULPTED) + 2 ;
+ return MAX_GL_IMAGE_CATEGORY - (BOOST_HIGH - BOOST_SCULPTED) + 2;
}
// static
//index starts from zero.
S32 LLGLTexture::getIndexFromCategory(S32 category)
{
- return (category < BOOST_HIGH) ? category : category - (BOOST_HIGH - BOOST_SCULPTED) + 1 ;
+ return (category < BOOST_HIGH) ? category : category - (BOOST_HIGH - BOOST_SCULPTED) + 1;
}
//static
S32 LLGLTexture::getCategoryFromIndex(S32 index)
{
- return (index < BOOST_HIGH) ? index : index + (BOOST_HIGH - BOOST_SCULPTED) - 1 ;
+ return (index < BOOST_HIGH) ? index : index + (BOOST_HIGH - BOOST_SCULPTED) - 1;
}
LLGLTexture::LLGLTexture(BOOL usemipmaps)
@@ -55,19 +55,19 @@ LLGLTexture::LLGLTexture(BOOL usemipmaps)
LLGLTexture::LLGLTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps)
{
init();
- mFullWidth = width ;
- mFullHeight = height ;
+ mFullWidth = width;
+ mFullHeight = height;
mUseMipMaps = usemipmaps;
- mComponents = components ;
+ mComponents = components;
setTexelsPerImage();
}
LLGLTexture::LLGLTexture(const LLImageRaw* raw, BOOL usemipmaps)
{
init();
- mUseMipMaps = usemipmaps ;
+ mUseMipMaps = usemipmaps;
// Create an empty image of the specified size and width
- mGLTexturep = new LLImageGL(raw, usemipmaps) ;
+ mGLTexturep = new LLImageGL(raw, usemipmaps);
}
LLGLTexture::~LLGLTexture()
@@ -81,13 +81,13 @@ void LLGLTexture::init()
mFullWidth = 0;
mFullHeight = 0;
- mTexelsPerImage = 0 ;
- mUseMipMaps = FALSE ;
- mComponents = 0 ;
+ mTexelsPerImage = 0;
+ mUseMipMaps = FALSE;
+ mComponents = 0;
- mTextureState = NO_DELETE ;
+ mTextureState = NO_DELETE;
mDontDiscard = FALSE;
- mNeedsGLTexture = FALSE ;
+ mNeedsGLTexture = FALSE;
}
void LLGLTexture::cleanup()
@@ -111,287 +111,301 @@ void LLGLTexture::setBoostLevel(S32 level)
{
if(mBoostLevel != level)
{
- mBoostLevel = level ;
+ mBoostLevel = level;
if(mBoostLevel != LLGLTexture::BOOST_NONE
&& mBoostLevel != LLGLTexture::BOOST_ICON)
{
- setNoDelete() ;
+ setNoDelete();
}
}
}
void LLGLTexture::forceActive()
{
- mTextureState = ACTIVE ;
+ mTextureState = ACTIVE;
}
void LLGLTexture::setActive()
{
if(mTextureState != NO_DELETE)
{
- mTextureState = ACTIVE ;
+ mTextureState = ACTIVE;
}
}
//set the texture to stay in memory
void LLGLTexture::setNoDelete()
{
- mTextureState = NO_DELETE ;
+ mTextureState = NO_DELETE;
}
void LLGLTexture::generateGLTexture()
{
if(mGLTexturep.isNull())
{
- mGLTexturep = new LLImageGL(mFullWidth, mFullHeight, mComponents, mUseMipMaps) ;
+ mGLTexturep = new LLImageGL(mFullWidth, mFullHeight, mComponents, mUseMipMaps);
}
}
LLImageGL* LLGLTexture::getGLTexture() const
{
- llassert(mGLTexturep.notNull()) ;
+ llassert(mGLTexturep.notNull());
- return mGLTexturep ;
+ return mGLTexturep;
}
BOOL LLGLTexture::createGLTexture()
{
if(mGLTexturep.isNull())
{
- generateGLTexture() ;
+ generateGLTexture();
}
- return mGLTexturep->createGLTexture() ;
+ return mGLTexturep->createGLTexture();
}
BOOL LLGLTexture::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename, BOOL to_create, S32 category)
{
- llassert(mGLTexturep.notNull()) ;
+ llassert(mGLTexturep.notNull());
- BOOL ret = mGLTexturep->createGLTexture(discard_level, imageraw, usename, to_create, category) ;
+ BOOL ret = mGLTexturep->createGLTexture(discard_level, imageraw, usename, to_create, category);
if(ret)
{
- mFullWidth = mGLTexturep->getCurrentWidth() ;
- mFullHeight = mGLTexturep->getCurrentHeight() ;
- mComponents = mGLTexturep->getComponents() ;
+ mFullWidth = mGLTexturep->getCurrentWidth();
+ mFullHeight = mGLTexturep->getCurrentHeight();
+ mComponents = mGLTexturep->getComponents();
setTexelsPerImage();
}
- return ret ;
+ return ret;
}
void LLGLTexture::setExplicitFormat(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format, BOOL swap_bytes)
{
- llassert(mGLTexturep.notNull()) ;
+ llassert(mGLTexturep.notNull());
- mGLTexturep->setExplicitFormat(internal_format, primary_format, type_format, swap_bytes) ;
+ mGLTexturep->setExplicitFormat(internal_format, primary_format, type_format, swap_bytes);
}
void LLGLTexture::setAddressMode(LLTexUnit::eTextureAddressMode mode)
{
- llassert(mGLTexturep.notNull()) ;
- mGLTexturep->setAddressMode(mode) ;
+ llassert(mGLTexturep.notNull());
+ mGLTexturep->setAddressMode(mode);
}
void LLGLTexture::setFilteringOption(LLTexUnit::eTextureFilterOptions option)
{
- llassert(mGLTexturep.notNull()) ;
- mGLTexturep->setFilteringOption(option) ;
+ llassert(mGLTexturep.notNull());
+ mGLTexturep->setFilteringOption(option);
}
//virtual
S32 LLGLTexture::getWidth(S32 discard_level) const
{
- llassert(mGLTexturep.notNull()) ;
- return mGLTexturep->getWidth(discard_level) ;
+ llassert(mGLTexturep.notNull());
+ return mGLTexturep->getWidth(discard_level);
}
//virtual
S32 LLGLTexture::getHeight(S32 discard_level) const
{
- llassert(mGLTexturep.notNull()) ;
- return mGLTexturep->getHeight(discard_level) ;
+ llassert(mGLTexturep.notNull());
+ return mGLTexturep->getHeight(discard_level);
}
S32 LLGLTexture::getMaxDiscardLevel() const
{
- llassert(mGLTexturep.notNull()) ;
- return mGLTexturep->getMaxDiscardLevel() ;
+ llassert(mGLTexturep.notNull());
+ return mGLTexturep->getMaxDiscardLevel();
}
S32 LLGLTexture::getDiscardLevel() const
{
- llassert(mGLTexturep.notNull()) ;
- return mGLTexturep->getDiscardLevel() ;
+ llassert(mGLTexturep.notNull());
+ return mGLTexturep->getDiscardLevel();
}
S8 LLGLTexture::getComponents() const
{
- llassert(mGLTexturep.notNull()) ;
+ llassert(mGLTexturep.notNull());
- return mGLTexturep->getComponents() ;
+ return mGLTexturep->getComponents();
}
LLGLuint LLGLTexture::getTexName() const
{
- llassert(mGLTexturep.notNull()) ;
+ llassert(mGLTexturep.notNull());
- return mGLTexturep->getTexName() ;
+ return mGLTexturep->getTexName();
}
BOOL LLGLTexture::hasGLTexture() const
{
if(mGLTexturep.notNull())
{
- return mGLTexturep->getHasGLTexture() ;
+ return mGLTexturep->getHasGLTexture();
}
- return FALSE ;
+ return FALSE;
}
BOOL LLGLTexture::getBoundRecently() const
{
if(mGLTexturep.notNull())
{
- return mGLTexturep->getBoundRecently() ;
+ return mGLTexturep->getBoundRecently();
}
- return FALSE ;
+ return FALSE;
}
LLTexUnit::eTextureType LLGLTexture::getTarget(void) const
{
- llassert(mGLTexturep.notNull()) ;
- return mGLTexturep->getTarget() ;
+ llassert(mGLTexturep.notNull());
+ return mGLTexturep->getTarget();
}
BOOL LLGLTexture::setSubImage(const LLImageRaw* imageraw, S32 x_pos, S32 y_pos, S32 width, S32 height)
{
- llassert(mGLTexturep.notNull()) ;
+ llassert(mGLTexturep.notNull());
- return mGLTexturep->setSubImage(imageraw, x_pos, y_pos, width, height) ;
+ return mGLTexturep->setSubImage(imageraw, x_pos, y_pos, width, height);
}
BOOL LLGLTexture::setSubImage(const U8* datap, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height)
{
- llassert(mGLTexturep.notNull()) ;
+ llassert(mGLTexturep.notNull());
- return mGLTexturep->setSubImage(datap, data_width, data_height, x_pos, y_pos, width, height) ;
+ return mGLTexturep->setSubImage(datap, data_width, data_height, x_pos, y_pos, width, height);
}
void LLGLTexture::setGLTextureCreated (bool initialized)
{
- llassert(mGLTexturep.notNull()) ;
+ llassert(mGLTexturep.notNull());
- mGLTexturep->setGLTextureCreated (initialized) ;
+ mGLTexturep->setGLTextureCreated (initialized);
}
void LLGLTexture::setCategory(S32 category)
{
- llassert(mGLTexturep.notNull()) ;
+ llassert(mGLTexturep.notNull());
+
+ mGLTexturep->setCategory(category);
+}
- mGLTexturep->setCategory(category) ;
+void LLGLTexture::setTexName(LLGLuint texName)
+{
+ llassert(mGLTexturep.notNull());
+ return mGLTexturep->setTexName(texName);
+}
+
+void LLGLTexture::setTarget(const LLGLenum target, const LLTexUnit::eTextureType bind_target)
+{
+ llassert(mGLTexturep.notNull());
+ return mGLTexturep->setTarget(target, bind_target);
}
LLTexUnit::eTextureAddressMode LLGLTexture::getAddressMode(void) const
{
- llassert(mGLTexturep.notNull()) ;
+ llassert(mGLTexturep.notNull());
- return mGLTexturep->getAddressMode() ;
+ return mGLTexturep->getAddressMode();
}
S32Bytes LLGLTexture::getTextureMemory() const
{
- llassert(mGLTexturep.notNull()) ;
+ llassert(mGLTexturep.notNull());
- return mGLTexturep->mTextureMemory ;
+ return mGLTexturep->mTextureMemory;
}
LLGLenum LLGLTexture::getPrimaryFormat() const
{
- llassert(mGLTexturep.notNull()) ;
+ llassert(mGLTexturep.notNull());
- return mGLTexturep->getPrimaryFormat() ;
+ return mGLTexturep->getPrimaryFormat();
}
BOOL LLGLTexture::getIsAlphaMask() const
{
- llassert(mGLTexturep.notNull()) ;
+ llassert(mGLTexturep.notNull());
- return mGLTexturep->getIsAlphaMask() ;
+ return mGLTexturep->getIsAlphaMask();
}
BOOL LLGLTexture::getMask(const LLVector2 &tc)
{
- llassert(mGLTexturep.notNull()) ;
+ llassert(mGLTexturep.notNull());
- return mGLTexturep->getMask(tc) ;
+ return mGLTexturep->getMask(tc);
}
F32 LLGLTexture::getTimePassedSinceLastBound()
{
- llassert(mGLTexturep.notNull()) ;
+ llassert(mGLTexturep.notNull());
- return mGLTexturep->getTimePassedSinceLastBound() ;
+ return mGLTexturep->getTimePassedSinceLastBound();
}
BOOL LLGLTexture::getMissed() const
{
- llassert(mGLTexturep.notNull()) ;
+ llassert(mGLTexturep.notNull());
- return mGLTexturep->getMissed() ;
+ return mGLTexturep->getMissed();
}
BOOL LLGLTexture::isJustBound() const
{
- llassert(mGLTexturep.notNull()) ;
+ llassert(mGLTexturep.notNull());
- return mGLTexturep->isJustBound() ;
+ return mGLTexturep->isJustBound();
}
void LLGLTexture::forceUpdateBindStats(void) const
{
- llassert(mGLTexturep.notNull()) ;
+ llassert(mGLTexturep.notNull());
- return mGLTexturep->forceUpdateBindStats() ;
+ return mGLTexturep->forceUpdateBindStats();
}
U32 LLGLTexture::getTexelsInAtlas() const
{
- llassert(mGLTexturep.notNull()) ;
+ llassert(mGLTexturep.notNull());
- return mGLTexturep->getTexelsInAtlas() ;
+ return mGLTexturep->getTexelsInAtlas();
}
U32 LLGLTexture::getTexelsInGLTexture() const
{
- llassert(mGLTexturep.notNull()) ;
+ llassert(mGLTexturep.notNull());
- return mGLTexturep->getTexelsInGLTexture() ;
+ return mGLTexturep->getTexelsInGLTexture();
}
BOOL LLGLTexture::isGLTextureCreated() const
{
- llassert(mGLTexturep.notNull()) ;
+ llassert(mGLTexturep.notNull());
- return mGLTexturep->isGLTextureCreated() ;
+ return mGLTexturep->isGLTextureCreated();
}
S32 LLGLTexture::getDiscardLevelInAtlas() const
{
- llassert(mGLTexturep.notNull()) ;
+ llassert(mGLTexturep.notNull());
- return mGLTexturep->getDiscardLevelInAtlas() ;
+ return mGLTexturep->getDiscardLevelInAtlas();
}
void LLGLTexture::destroyGLTexture()
{
if(mGLTexturep.notNull() && mGLTexturep->getHasGLTexture())
{
- mGLTexturep->destroyGLTexture() ;
- mTextureState = DELETED ;
+ mGLTexturep->destroyGLTexture();
+ mTextureState = DELETED;
}
}
void LLGLTexture::setTexelsPerImage()
{
- S32 fullwidth = llmin(mFullWidth,(S32)MAX_IMAGE_SIZE_DEFAULT);
- S32 fullheight = llmin(mFullHeight,(S32)MAX_IMAGE_SIZE_DEFAULT);
- mTexelsPerImage = (F32)fullwidth * fullheight;
+ U32 fullwidth = llmin(mFullWidth, (U32)MAX_IMAGE_SIZE_DEFAULT);
+ U32 fullheight = llmin(mFullHeight, (U32)MAX_IMAGE_SIZE_DEFAULT);
+ mTexelsPerImage = (U32)fullwidth * fullheight;
}
+static LLUUID sStubUUID;
+const LLUUID& LLGLTexture::getID() const { return sStubUUID; } \ No newline at end of file