diff options
Diffstat (limited to 'indra/llrender')
| -rw-r--r-- | indra/llrender/CMakeLists.txt | 7 | ||||
| -rw-r--r-- | indra/llrender/llgl.cpp | 15 | ||||
| -rw-r--r-- | indra/llrender/llglslshader.cpp | 5 | ||||
| -rw-r--r-- | indra/llrender/llglslshader.h | 2 | ||||
| -rw-r--r-- | indra/llrender/llgltexture.cpp | 198 | ||||
| -rw-r--r-- | indra/llrender/llgltexture.h | 10 | ||||
| -rw-r--r-- | indra/llrender/llimagegl.cpp | 39 | ||||
| -rw-r--r-- | indra/llrender/llimagegl.h | 9 | ||||
| -rw-r--r-- | indra/llrender/llrender.cpp | 4 | ||||
| -rw-r--r-- | indra/llrender/llrender.h | 10 | ||||
| -rw-r--r-- | indra/llrender/llshadermgr.cpp | 28 | ||||
| -rw-r--r-- | indra/llrender/llshadermgr.h | 11 | ||||
| -rw-r--r-- | indra/llrender/lltexture.cpp | 12 | ||||
| -rw-r--r-- | indra/llrender/lltexture.h | 22 | 
14 files changed, 239 insertions, 133 deletions
| diff --git a/indra/llrender/CMakeLists.txt b/indra/llrender/CMakeLists.txt index 331f988382..89451a072c 100644 --- a/indra/llrender/CMakeLists.txt +++ b/indra/llrender/CMakeLists.txt @@ -13,6 +13,7 @@ include(LLVFS)  include(LLWindow)  include(LLXML)  include(LLVFS) +include(Atmosphere)  include_directories(      ${FREETYPE_INCLUDE_DIRS} @@ -24,6 +25,7 @@ include_directories(      ${LLWINDOW_INCLUDE_DIRS}      ${LLXML_INCLUDE_DIRS}      ${LLVFS_INCLUDE_DIRS} +    ${ATMOSPHERE_INCLUDE_DIR}      )  include_directories(SYSTEM      ${LLCOMMON_SYSTEM_INCLUDE_DIRS} @@ -31,6 +33,7 @@ include_directories(SYSTEM      )  set(llrender_SOURCE_FILES +    llatmosphere.cpp      llcubemap.cpp      llfontbitmapcache.cpp      llfontfreetype.cpp @@ -56,6 +59,7 @@ set(llrender_SOURCE_FILES  set(llrender_HEADER_FILES      CMakeLists.txt +    llatmosphere.h      llcubemap.h      llfontgl.h      llfontfreetype.h @@ -126,5 +130,6 @@ target_link_libraries(llrender      ${LLVFS_LIBRARIES}      ${LLWINDOW_LIBRARIES}      ${FREETYPE_LIBRARIES} -    ${OPENGL_LIBRARIES}) +    ${OPENGL_LIBRARIES} +    ${ATMOSPHERE_LIBRARIES}) diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 155c2402bd..2f78b6e104 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -1348,8 +1348,19 @@ void LLGLManager::initExtensions()  	if (mHasVertexShader)  	{  		LL_INFOS() << "initExtensions() VertexShader-related procs..." << LL_ENDL; -		glGetAttribLocationARB = (PFNGLGETATTRIBLOCATIONARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetAttribLocationARB"); -		glBindAttribLocationARB = (PFNGLBINDATTRIBLOCATIONARBPROC) GLH_EXT_GET_PROC_ADDRESS("glBindAttribLocationARB"); + +        // nSight doesn't support use of ARB funcs that have been normalized in the API +        if (!LLRender::sNsightDebugSupport) +        { +		    glGetAttribLocationARB = (PFNGLGETATTRIBLOCATIONARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetAttribLocationARB"); +		    glBindAttribLocationARB = (PFNGLBINDATTRIBLOCATIONARBPROC) GLH_EXT_GET_PROC_ADDRESS("glBindAttribLocationARB"); +        } +        else +        { +            glGetAttribLocationARB = (PFNGLGETATTRIBLOCATIONARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetAttribLocation"); +            glBindAttribLocationARB = (PFNGLBINDATTRIBLOCATIONARBPROC)GLH_EXT_GET_PROC_ADDRESS("glBindAttribLocation"); +        } +  		glGetActiveAttribARB = (PFNGLGETACTIVEATTRIBARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetActiveAttribARB");  		glVertexAttrib1dARB = (PFNGLVERTEXATTRIB1DARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1dARB");  		glVertexAttrib1dvARB = (PFNGLVERTEXATTRIB1DVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1dvARB"); diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index bba94a976f..b09ec53bc0 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -401,6 +401,11 @@ BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString> * attributes,      mDefines["OLD_SELECT"] = "1";  #endif +    if (mExtraLinkObject) +    { +        attachObject(mExtraLinkObject); +    } +      //compile new source      vector< pair<string,GLenum> >::iterator fileIter = mShaderFiles.begin();      for ( ; fileIter != mShaderFiles.end(); fileIter++ ) diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index 8e9c29ea4c..a7a9e27fcd 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -205,6 +205,8 @@ public:  	bool mTextureStateFetched;      magmin_filter_t mTextureMagMinFilter; +    GLhandleARB mExtraLinkObject = 0; +  private:  	void unloadInternal(); 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 diff --git a/indra/llrender/llgltexture.h b/indra/llrender/llgltexture.h index 45592ee077..a57e48ffad 100644 --- a/indra/llrender/llgltexture.h +++ b/indra/llrender/llgltexture.h @@ -103,7 +103,7 @@ public:  	virtual void dump();	// debug info to LL_INFOS() -	virtual const LLUUID& getID() const = 0; +	virtual const LLUUID& getID() const;  	void setBoostLevel(S32 level);  	S32  getBoostLevel() { return mBoostLevel; } @@ -132,6 +132,8 @@ public:  	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) ; +    void       setTexName(LLGLuint); // for forcing w/ externally created textures only +    void setTarget(const LLGLenum target, const LLTexUnit::eTextureType bind_target);  	LLTexUnit::eTextureAddressMode getAddressMode(void) const ;  	S32        getMaxDiscardLevel() const; @@ -178,11 +180,11 @@ protected:  protected:  	S32 mBoostLevel;				// enum describing priority level -	S32 mFullWidth; -	S32 mFullHeight; +	U32 mFullWidth; +	U32 mFullHeight;  	BOOL mUseMipMaps;  	S8  mComponents; -	F32 mTexelsPerImage;			// Texels per image. +	U32 mTexelsPerImage;			// Texels per image.  	mutable S8  mNeedsGLTexture;  	//GL texture diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 20cba68f84..75f6cd405a 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -352,10 +352,9 @@ BOOL LLImageGL::create(LLPointer<LLImageGL>& dest, const LLImageRaw* imageraw, B  }  //---------------------------------------------------------------------------- -  LLImageGL::LLImageGL(BOOL usemipmaps)  :	LLTrace::MemTrackable<LLImageGL>("LLImageGL"), -	mSaveData(0) +    mSaveData(0), mExternalTexture(FALSE)  {  	init(usemipmaps);  	setSize(0, 0, 0); @@ -365,7 +364,7 @@ LLImageGL::LLImageGL(BOOL usemipmaps)  LLImageGL::LLImageGL(U32 width, U32 height, U8 components, BOOL usemipmaps)  :	LLTrace::MemTrackable<LLImageGL>("LLImageGL"), -	mSaveData(0) +    mSaveData(0), mExternalTexture(FALSE)  {  	llassert( components <= 4 );  	init(usemipmaps); @@ -376,7 +375,7 @@ LLImageGL::LLImageGL(U32 width, U32 height, U8 components, BOOL usemipmaps)  LLImageGL::LLImageGL(const LLImageRaw* imageraw, BOOL usemipmaps)  :	LLTrace::MemTrackable<LLImageGL>("LLImageGL"), -	mSaveData(0) +    mSaveData(0), mExternalTexture(FALSE)  {  	init(usemipmaps);  	setSize(0, 0, 0); @@ -386,12 +385,36 @@ LLImageGL::LLImageGL(const LLImageRaw* imageraw, BOOL usemipmaps)  	createGLTexture(0, imageraw);   } +LLImageGL::LLImageGL( +    LLGLuint texName, +    U32 components, +    LLGLenum target, +    LLGLint  formatInternal, +    LLGLenum formatPrimary, +    LLGLenum formatType, +    LLTexUnit::eTextureAddressMode addressMode) +    : LLTrace::MemTrackable<LLImageGL>("LLImageGL"), mSaveData(0), mExternalTexture(TRUE) +{ +    init(false); +    mTexName = texName; +    mTarget = target; +    mComponents = components; +    mAddressMode = addressMode; +    mFormatType = formatType; +    mFormatInternal = formatInternal; +    mFormatPrimary = formatPrimary; +} + +  LLImageGL::~LLImageGL()  { -	LLImageGL::cleanup(); -	sImageList.erase(this); -	freePickMask(); -	sCount--; +    if (!mExternalTexture) +    { +	    LLImageGL::cleanup(); +	    sImageList.erase(this); +	    freePickMask(); +	    sCount--; +    }  }  void LLImageGL::init(BOOL usemipmaps) diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h index ad2aea9067..bb0284a166 100644 --- a/indra/llrender/llimagegl.h +++ b/indra/llrender/llimagegl.h @@ -84,7 +84,10 @@ public:  	LLImageGL(BOOL usemipmaps = TRUE);  	LLImageGL(U32 width, U32 height, U8 components, BOOL usemipmaps = TRUE);  	LLImageGL(const LLImageRaw* imageraw, BOOL usemipmaps = TRUE); -	 + +    // For wrapping textures created via GL elsewhere with our API only. Use with caution. +    LLImageGL(LLGLuint mTexName, U32 components, LLGLenum target, LLGLint  formatInternal, LLGLenum formatPrimary, LLGLenum formatType, LLTexUnit::eTextureAddressMode addressMode); +  protected:  	virtual ~LLImageGL(); @@ -234,6 +237,8 @@ protected:  	LLGLenum mFormatType;  	BOOL	 mFormatSwapBytes;// if true, use glPixelStorei(GL_UNPACK_SWAP_BYTES, 1) +    BOOL mExternalTexture; +  	// STATICS  public:	  	static std::set<LLImageGL*> sImageList; @@ -279,6 +284,8 @@ public:  	void setCategory(S32 category) {mCategory = category;}  	S32  getCategory()const {return mCategory;} +    void setTexName(GLuint texName) { mTexName = texName; } +  	//for debug use: show texture size distribution   	//----------------------------------------  	static S32 sCurTexSizeBar ; diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 76f28bb43f..a8f622d3ff 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -49,6 +49,7 @@ U32 LLRender::sUICalls = 0;  U32 LLRender::sUIVerts = 0;  U32 LLTexUnit::sWhiteTexture = 0;  bool LLRender::sGLCoreProfile = false; +bool LLRender::sNsightDebugSupport = false;  static const U32 LL_NUM_TEXTURE_LAYERS = 32;   static const U32 LL_NUM_LIGHT_UNITS = 8; @@ -58,7 +59,8 @@ static const GLenum sGLTextureType[] =  	GL_TEXTURE_2D,  	GL_TEXTURE_RECTANGLE_ARB,  	GL_TEXTURE_CUBE_MAP_ARB, -	GL_TEXTURE_2D_MULTISAMPLE +	GL_TEXTURE_2D_MULTISAMPLE, +    GL_TEXTURE_3D  };  static const GLint sGLAddressMode[] = diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index a67fb8da52..9ad3a6e593 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -61,10 +61,11 @@ public:  	typedef enum  	{  		TT_TEXTURE = 0,			// Standard 2D Texture -		TT_RECT_TEXTURE,	// Non power of 2 texture -		TT_CUBE_MAP,		// 6-sided cube map texture +		TT_RECT_TEXTURE,	    // Non power of 2 texture +		TT_CUBE_MAP,		    // 6-sided cube map texture  		TT_MULTISAMPLE_TEXTURE, // see GL_ARB_texture_multisample -		TT_NONE 		// No texture type is currently enabled +        TT_TEXTURE_3D,          // standard 3D Texture +		TT_NONE, 		        // No texture type is currently enabled          	} eTextureType;  	typedef enum @@ -438,7 +439,8 @@ public:  	static U32 sUICalls;  	static U32 sUIVerts;  	static bool sGLCoreProfile; -	 +    static bool sNsightDebugSupport; +  private:  	friend class LLLightState; diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index b010a4ae64..287f22783f 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -512,16 +512,16 @@ static std::string get_object_log(GLhandleARB ret)  void LLShaderMgr::dumpObjectLog(GLhandleARB ret, BOOL warns, const std::string& filename)   {  	std::string log = get_object_log(ret); +    std::string fname = filename; +    if (filename.empty()) +    { +        fname = "unknown shader file"; +    } -	if (log.length() > 0 || warns) +	if (log.length() > 0)  	{ -        LL_DEBUGS("ShaderLoading") << "Shader loading "; -         -		if (!filename.empty()) -		{ -            LL_CONT << "From " << filename << ":\n"; -		} -        LL_CONT << log << LL_ENDL; +        LL_INFOS() << "Shader loading from " << fname << ":\n" << LL_ENDL; +        LL_INFOS() << log << LL_ENDL;  	}   } @@ -1114,7 +1114,7 @@ void LLShaderMgr::initAttribsAndUniforms()  	mReservedUniforms.push_back("specularMap");  	mReservedUniforms.push_back("bumpMap");  	mReservedUniforms.push_back("environmentMap"); -	mReservedUniforms.push_back("cloude_noise_texture"); +	mReservedUniforms.push_back("cloud_noise_texture");  	mReservedUniforms.push_back("fullbright");  	mReservedUniforms.push_back("lightnorm");  	mReservedUniforms.push_back("sunlight_color"); @@ -1267,6 +1267,16 @@ void LLShaderMgr::initAttribsAndUniforms()  	mReservedUniforms.push_back("origin");  	mReservedUniforms.push_back("display_gamma"); + +    mReservedUniforms.push_back("inscatter"); +    mReservedUniforms.push_back("sun_size"); +    mReservedUniforms.push_back("fog_color"); + +    mReservedUniforms.push_back("transmittance_texture"); +    mReservedUniforms.push_back("scattering_texture"); +    mReservedUniforms.push_back("irradiance_texture"); +    mReservedUniforms.push_back("single_mie_scattering_texture"); +  	llassert(mReservedUniforms.size() == END_RESERVED_UNIFORMS);  	std::set<std::string> dupe_check; diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index 7bdd97200d..ac3f7d58d5 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -221,6 +221,17 @@ public:  		SHINY_ORIGIN,          DISPLAY_GAMMA, + +        INSCATTER_RT, +        SUN_SIZE, +        FOG_COLOR, + +        // precomputed textures from libatmosphere +        TRANSMITTANCE_TEX, +        SCATTER_TEX, +        ILLUMINANCE_TEX, +        SINGLE_MIE_SCATTER_TEX, +  		END_RESERVED_UNIFORMS  	} eGLSLReservedUniforms; diff --git a/indra/llrender/lltexture.cpp b/indra/llrender/lltexture.cpp index 90fbcec2be..787a09a159 100644 --- a/indra/llrender/lltexture.cpp +++ b/indra/llrender/lltexture.cpp @@ -29,3 +29,15 @@  LLTexture::~LLTexture()  {  } + +S8   LLTexture::getType() const { llassert(false); return 0; } +void LLTexture::setKnownDrawSize(S32 width, S32 height) { llassert(false); } +bool LLTexture::bindDefaultImage(const S32 stage) { llassert(false); return false; } +bool LLTexture::bindDebugImage(const S32 stage) { llassert(false); return false; } +void LLTexture::forceImmediateUpdate() { llassert(false); } +void LLTexture::setActive() { llassert(false);  } +S32	 LLTexture::getWidth(S32 discard_level) const { llassert(false); return 0; } +S32	 LLTexture::getHeight(S32 discard_level) const { llassert(false); return 0; } +bool LLTexture::isActiveFetching() { llassert(false); return false; } +LLImageGL* LLTexture::getGLTexture() const { llassert(false); return nullptr; } +void LLTexture::updateBindStatsForTester() { }
\ No newline at end of file diff --git a/indra/llrender/lltexture.h b/indra/llrender/lltexture.h index 9fca8b8cd3..41481fb8a7 100644 --- a/indra/llrender/lltexture.h +++ b/indra/llrender/lltexture.h @@ -58,21 +58,21 @@ public:  	//  	//interfaces to access LLGLTexture  	// -	virtual S8         getType() const = 0 ; -	virtual void       setKnownDrawSize(S32 width, S32 height) = 0 ; -	virtual bool       bindDefaultImage(const S32 stage = 0) = 0 ; -	virtual bool       bindDebugImage(const S32 stage = 0) = 0; -	virtual void       forceImmediateUpdate() = 0 ; -	virtual void       setActive() = 0 ; -	virtual S32	       getWidth(S32 discard_level = -1) const = 0 ; -	virtual S32	       getHeight(S32 discard_level = -1) const = 0 ; -	virtual bool       isActiveFetching() = 0; +	virtual S8         getType() const; +	virtual void       setKnownDrawSize(S32 width, S32 height); +	virtual bool       bindDefaultImage(const S32 stage = 0); +	virtual bool       bindDebugImage(const S32 stage = 0); +	virtual void       forceImmediateUpdate(); +	virtual void       setActive(); +	virtual S32	       getWidth(S32 discard_level = -1) const; +	virtual S32	       getHeight(S32 discard_level = -1) const; +	virtual bool       isActiveFetching();  private:  	//note: do not make this function public. -	virtual LLImageGL* getGLTexture() const = 0 ; +	virtual LLImageGL* getGLTexture() const; -	virtual void updateBindStatsForTester() = 0 ; +	virtual void updateBindStatsForTester();  };  #endif | 
