summaryrefslogtreecommitdiff
path: root/indra/newview/llviewertexture.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewertexture.h')
-rwxr-xr-xindra/newview/llviewertexture.h166
1 files changed, 31 insertions, 135 deletions
diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h
index 2eaa0ac92d..2ec26af3c0 100755
--- a/indra/newview/llviewertexture.h
+++ b/indra/newview/llviewertexture.h
@@ -27,7 +27,7 @@
#ifndef LL_LLVIEWERTEXTURE_H
#define LL_LLVIEWERTEXTURE_H
-#include "lltexture.h"
+#include "llgltexture.h"
#include "lltimer.h"
#include "llframetimer.h"
#include "llhost.h"
@@ -88,16 +88,11 @@ public:
class LLTextureBar;
-class LLViewerTexture : public LLTexture
+class LLViewerTexture : public LLGLTexture
{
public:
enum
{
- MAX_IMAGE_SIZE_DEFAULT = 1024,
- INVALID_DISCARD_LEVEL = 0x7fff
- };
- enum
- {
LOCAL_TEXTURE,
MEDIA_TEXTURE,
DYNAMIC_TEXTURE,
@@ -107,42 +102,6 @@ public:
INVALID_TEXTURE_TYPE
};
- enum EBoostLevel
- {
- BOOST_NONE = 0,
- BOOST_AVATAR_BAKED ,
- BOOST_AVATAR ,
- BOOST_CLOUDS ,
- BOOST_SCULPTED ,
-
- BOOST_HIGH = 10,
- BOOST_SELECTED ,
- BOOST_BUMP ,
- BOOST_TERRAIN , // has to be high priority for minimap / low detail
- BOOST_AVATAR_BAKED_SELF ,
- BOOST_AVATAR_SELF , // needed for baking avatar
- BOOST_SUPER_HIGH , //textures higher than this need to be downloaded at the required resolution without delay.
- BOOST_HUD ,
- BOOST_ICON ,
- BOOST_UI ,
- BOOST_PREVIEW ,
- BOOST_MAP ,
- BOOST_MAP_VISIBLE ,
- BOOST_MAX_LEVEL,
-
- //other texture Categories
- LOCAL = BOOST_MAX_LEVEL,
- AVATAR_SCRATCH_TEX,
- DYNAMIC_TEX,
- MEDIA,
- ATLAS,
- OTHER,
- MAX_GL_IMAGE_CATEGORY
- };
-
- static S32 getTotalNumOfCategories() ;
- static S32 getIndexFromCategory(S32 category) ;
- static S32 getCategoryFromIndex(S32 index) ;
typedef std::vector<LLFace*> ll_face_list_t;
typedef std::vector<LLVOVolume*> ll_volume_list_t;
@@ -168,8 +127,7 @@ public:
/*virtual*/ bool bindDefaultImage(const S32 stage = 0) ;
/*virtual*/ void forceImmediateUpdate() ;
- const LLUUID& getID() const { return mID; }
-
+ /*virtual*/ const LLUUID& getID() const { return mID; }
void setBoostLevel(S32 level);
S32 getBoostLevel() { return mBoostLevel; }
@@ -177,13 +135,12 @@ public:
void resetTextureStats();
void setMaxVirtualSizeResetInterval(S32 interval)const {mMaxVirtualSizeResetInterval = interval;}
void resetMaxVirtualSizeResetCounter()const {mMaxVirtualSizeResetCounter = mMaxVirtualSizeResetInterval;}
+ S32 getMaxVirtualSizeResetCounter() const { return mMaxVirtualSizeResetCounter; }
virtual F32 getMaxVirtualSize() ;
LLFrameTimer* getLastReferencedTimer() {return &mLastReferencedTimer ;}
- S32 getFullWidth() const { return mFullWidth; }
- S32 getFullHeight() const { return mFullHeight; }
/*virtual*/ void setKnownDrawSize(S32 width, S32 height);
virtual void addFace(LLFace* facep) ;
@@ -196,60 +153,8 @@ public:
S32 getNumVolumes() const;
const ll_volume_list_t* getVolumeList() const { return &mVolumeList; }
- void generateGLTexture() ;
- void destroyGLTexture() ;
-
- //---------------------------------------------------------------------------------------------
- //functions to access LLImageGL
- //---------------------------------------------------------------------------------------------
- /*virtual*/S32 getWidth(S32 discard_level = -1) const;
- /*virtual*/S32 getHeight(S32 discard_level = -1) const;
- BOOL hasGLTexture() const ;
- LLGLuint getTexName() const ;
- BOOL createGLTexture() ;
- BOOL createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename = 0, BOOL to_create = TRUE, S32 category = LLViewerTexture::OTHER);
virtual void setCachedRawImage(S32 discard_level, LLImageRaw* imageraw) ;
-
- void setFilteringOption(LLTexUnit::eTextureFilterOptions option);
- void setExplicitFormat(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format = 0, BOOL swap_bytes = FALSE);
- void setAddressMode(LLTexUnit::eTextureAddressMode mode);
- BOOL setSubImage(const LLImageRaw* imageraw, S32 x_pos, S32 y_pos, S32 width, S32 height);
- BOOL setSubImage(const U8* datap, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height);
- void setGLTextureCreated (bool initialized);
- void setCategory(S32 category) ;
-
- LLTexUnit::eTextureAddressMode getAddressMode(void) const ;
- S32 getMaxDiscardLevel() const;
- S32 getDiscardLevel() const;
- S8 getComponents() const ;
- BOOL getBoundRecently() const;
- S32 getTextureMemory() const ;
- LLGLenum getPrimaryFormat() const;
- BOOL getIsAlphaMask() const ;
- LLTexUnit::eTextureType getTarget(void) const ;
- BOOL getMask(const LLVector2 &tc);
- F32 getTimePassedSinceLastBound();
- BOOL getMissed() const ;
- BOOL isJustBound()const ;
- void forceUpdateBindStats(void) const;
-
- U32 getTexelsInAtlas() const ;
- U32 getTexelsInGLTexture() const ;
- BOOL isGLTextureCreated() const ;
- S32 getDiscardLevelInAtlas() const ;
- //---------------------------------------------------------------------------------------------
- //end of functions to access LLImageGL
- //---------------------------------------------------------------------------------------------
-
- //-----------------
- /*virtual*/ void setActive() ;
- void forceActive() ;
- void setNoDelete() ;
- void dontDiscard() { mDontDiscard = 1; mTextureState = NO_DELETE; }
- BOOL getDontDiscard() const { return mDontDiscard; }
- //-----------------
-
BOOL isLargeImage() ;
void setParcelMedia(LLViewerMediaTexture* media) {mParcelMedia = media;}
@@ -262,36 +167,22 @@ protected:
void init(bool firstinit) ;
void reorganizeFaceList() ;
void reorganizeVolumeList() ;
- void setTexelsPerImage();
private:
friend class LLBumpImageList;
friend class LLUIImageList;
- //note: do not make this function public.
- /*virtual*/ LLImageGL* getGLTexture() const ;
virtual void switchToCachedImage();
static bool isMemoryForTextureLow() ;
protected:
LLUUID mID;
- S32 mBoostLevel; // enum describing priority level
F32 mSelectedTime; // time texture was last selected
- S32 mFullWidth;
- S32 mFullHeight;
- BOOL mUseMipMaps ;
- S8 mComponents;
- F32 mTexelsPerImage; // Texels per image.
- mutable S8 mNeedsGLTexture;
mutable F32 mMaxVirtualSize; // The largest virtual size of the image, in pixels - how much data to we need?
mutable S32 mMaxVirtualSizeResetCounter ;
mutable S32 mMaxVirtualSizeResetInterval;
mutable F32 mAdditionalDecodePriority; // priority add to mDecodePriority.
LLFrameTimer mLastReferencedTimer;
- //GL texture
- LLPointer<LLImageGL> mGLTexturep ;
- S8 mDontDiscard; // Keep full res version of this image (for UI, etc)
-
ll_face_list_t mFaceList ; //reverse pointer pointing to the faces using this image as texture
U32 mNumFaces ;
LLFrameTimer mLastFaceListUpdateTimer ;
@@ -303,17 +194,6 @@ protected:
//do not use LLPointer here.
LLViewerMediaTexture* mParcelMedia ;
-protected:
- typedef enum
- {
- DELETED = 0, //removed from memory
- DELETION_CANDIDATE, //ready to be removed from memory
- INACTIVE, //not be used for the last certain period (i.e., 30 seconds).
- ACTIVE, //just being used, can become inactive if not being used for a certain time (10 seconds).
- NO_DELETE = 99 //stay in memory, can not be removed.
- } LLGLTextureState;
- LLGLTextureState mTextureState ;
-
static F32 sTexelPixelRatio;
public:
static const U32 sCurrentFileVersion;
@@ -353,6 +233,16 @@ public:
};
+enum FTType
+{
+ FTT_UNKNOWN = -1,
+ FTT_DEFAULT = 0, // standard texture fetched by id.
+ FTT_SERVER_BAKE, // texture produced by appearance service and fetched from there.
+ FTT_HOST_BAKE, // old-style baked texture uploaded by viewer and fetched from avatar's host.
+ FTT_MAP_TILE, // tiles are fetched from map server directly.
+ FTT_LOCAL_FILE // fetch directly from a local file.
+};
+
//
//textures are managed in gTextureList.
//raw image data is fetched from remote or local cache
@@ -366,9 +256,9 @@ class LLViewerFetchedTexture : public LLViewerTexture
protected:
/*virtual*/ ~LLViewerFetchedTexture();
public:
- LLViewerFetchedTexture(const LLUUID& id, const LLHost& host = LLHost::invalid, BOOL usemipmaps = TRUE);
- LLViewerFetchedTexture(const LLImageRaw* raw, BOOL usemipmaps);
- LLViewerFetchedTexture(const std::string& url, const LLUUID& id, BOOL usemipmaps = TRUE);
+ LLViewerFetchedTexture(const LLUUID& id, FTType f_type, const LLHost& host = LLHost::invalid, BOOL usemipmaps = TRUE);
+ LLViewerFetchedTexture(const LLImageRaw* raw, FTType f_type, BOOL usemipmaps);
+ LLViewerFetchedTexture(const std::string& url, FTType f_type, const LLUUID& id, BOOL usemipmaps = TRUE);
public:
static F32 maxDecodePriority();
@@ -393,6 +283,7 @@ public:
public:
/*virtual*/ S8 getType() const ;
+ FTType getFTType() const;
/*virtual*/ void forceImmediateUpdate() ;
/*virtual*/ void dump() ;
@@ -428,6 +319,7 @@ public:
// the priority list, and cause horrible things to happen.
void setDecodePriority(F32 priority = -1.0f);
F32 getDecodePriority() const { return mDecodePriority; };
+ F32 getAdditionalDecodePriority() const { return mAdditionalDecodePriority; };
void setAdditionalDecodePriority(F32 priority) ;
@@ -509,7 +401,7 @@ protected:
S32 getCurrentDiscardLevelForFetching() ;
private:
- void init(bool firstinit) ;
+ void init(bool firstinit) ;
void cleanup() ;
void saveRawImage() ;
@@ -556,7 +448,8 @@ protected:
S8 mHasFetcher; // We've made a fecth request
S8 mIsFetching; // Fetch request is active
bool mCanUseHTTP ; //This texture can be fetched through http if true.
-
+
+ FTType mFTType; // What category of image is this - map tile, server bake, etc?
mutable S8 mIsMissingAsset; // True if we know that there is no image asset with this image id in the database.
typedef std::list<LLLoadedCallbackEntry*> callback_list_t;
@@ -616,8 +509,8 @@ protected:
/*virtual*/ ~LLViewerLODTexture(){}
public:
- LLViewerLODTexture(const LLUUID& id, const LLHost& host = LLHost::invalid, BOOL usemipmaps = TRUE);
- LLViewerLODTexture(const std::string& url, const LLUUID& id, BOOL usemipmaps = TRUE);
+ LLViewerLODTexture(const LLUUID& id, FTType f_type, const LLHost& host = LLHost::invalid, BOOL usemipmaps = TRUE);
+ LLViewerLODTexture(const std::string& url, FTType f_type, const LLUUID& id, BOOL usemipmaps = TRUE);
/*virtual*/ S8 getType() const;
// Process image stats to determine priority/quality requirements.
@@ -731,8 +624,9 @@ public:
static LLPointer<LLViewerTexture> getLocalTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps, BOOL generate_gl_tex = TRUE) ;
static LLViewerFetchedTexture* getFetchedTexture(const LLUUID &image_id,
+ FTType f_type = FTT_DEFAULT,
BOOL usemipmap = TRUE,
- LLViewerTexture::EBoostLevel boost_priority = LLViewerTexture::BOOST_NONE, // Get the requested level immediately upon creation.
+ LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE, // Get the requested level immediately upon creation.
S8 texture_type = LLViewerTexture::FETCHED_TEXTURE,
LLGLint internal_format = 0,
LLGLenum primary_format = 0,
@@ -740,8 +634,9 @@ public:
);
static LLViewerFetchedTexture* getFetchedTextureFromFile(const std::string& filename,
+ FTType f_type = FTT_LOCAL_FILE,
BOOL usemipmap = TRUE,
- LLViewerTexture::EBoostLevel boost_priority = LLViewerTexture::BOOST_NONE,
+ LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE,
S8 texture_type = LLViewerTexture::FETCHED_TEXTURE,
LLGLint internal_format = 0,
LLGLenum primary_format = 0,
@@ -749,15 +644,16 @@ public:
);
static LLViewerFetchedTexture* getFetchedTextureFromUrl(const std::string& url,
+ FTType f_type,
BOOL usemipmap = TRUE,
- LLViewerTexture::EBoostLevel boost_priority = LLViewerTexture::BOOST_NONE,
+ LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE,
S8 texture_type = LLViewerTexture::FETCHED_TEXTURE,
LLGLint internal_format = 0,
LLGLenum primary_format = 0,
const LLUUID& force_id = LLUUID::null
);
- static LLViewerFetchedTexture* getFetchedTextureFromHost(const LLUUID& image_id, LLHost host) ;
+ static LLViewerFetchedTexture* getFetchedTextureFromHost(const LLUUID& image_id, FTType f_type, LLHost host) ;
static void init() ;
static void cleanup() ;