diff options
| author | Rye <rye@alchemyviewer.org> | 2025-02-27 19:28:01 -0500 |
|---|---|---|
| committer | Rye <rye@alchemyviewer.org> | 2025-08-22 12:14:15 -0400 |
| commit | 99ce597b54a9180cff0f8907e94833257b77e263 (patch) | |
| tree | c932dd8fe9c1d7d9806359ada7c99040b4fb7769 /indra | |
| parent | a46d4f0f6923080d7c6e7d5267206e8c8d7a6ff9 (diff) | |
Fix texture filtering and address mode not updating for vast majority of textures when dirtied
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/llrender/llrender.cpp | 22 | ||||
| -rw-r--r-- | indra/llrender/llrender.h | 4 |
2 files changed, 23 insertions, 3 deletions
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index c26e9b15b8..4f646cdc33 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -207,6 +207,12 @@ void LLTexUnit::bindFast(LLTexture* texture) } glBindTexture(sGLTextureType[gl_tex->getTarget()], mCurrTexture); mHasMipMaps = gl_tex->mHasMipMaps; + if (gl_tex->mTexOptionsDirty) + { + gl_tex->mTexOptionsDirty = false; + setTextureAddressModeFast(gl_tex->mAddressMode); + setTextureFilteringOptionFast(gl_tex->mFilterOption); + } } bool LLTexUnit::bind(LLTexture* texture, bool for_rendering, bool forceBind) @@ -461,11 +467,16 @@ void LLTexUnit::setTextureAddressMode(eTextureAddressMode mode) activate(); - glTexParameteri (sGLTextureType[mCurrTexType], GL_TEXTURE_WRAP_S, sGLAddressMode[mode]); - glTexParameteri (sGLTextureType[mCurrTexType], GL_TEXTURE_WRAP_T, sGLAddressMode[mode]); + setTextureAddressModeFast(mode); +} + +void LLTexUnit::setTextureAddressModeFast(eTextureAddressMode mode) +{ + glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_WRAP_S, sGLAddressMode[mode]); + glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_WRAP_T, sGLAddressMode[mode]); if (mCurrTexType == TT_CUBE_MAP) { - glTexParameteri (GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, sGLAddressMode[mode]); + glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, sGLAddressMode[mode]); } } @@ -475,6 +486,11 @@ void LLTexUnit::setTextureFilteringOption(LLTexUnit::eTextureFilterOptions optio gGL.flush(); + setTextureFilteringOptionFast(option); +} + +void LLTexUnit::setTextureFilteringOptionFast(LLTexUnit::eTextureFilterOptions option) +{ if (option == TFO_POINT) { glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_MAG_FILTER, GL_NEAREST); diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index 9e68c2dcd1..755aee4bd6 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -208,11 +208,15 @@ public: // Warning: this stays set for the bound texture forever, // make sure you want to permanently change the address mode for the bound texture. void setTextureAddressMode(eTextureAddressMode mode); + // MUST already be active and bound + void setTextureAddressModeFast(eTextureAddressMode mode); // Sets the filtering options used to sample the texture // Warning: this stays set for the bound texture forever, // make sure you want to permanently change the filtering for the bound texture. void setTextureFilteringOption(LLTexUnit::eTextureFilterOptions option); + // MUST already be active and bound + void setTextureFilteringOptionFast(LLTexUnit::eTextureFilterOptions option); static U32 getInternalType(eTextureType type); |
