Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions indra/llrender/llrender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ void LLTexUnit::bindFast(LLTexture* texture)
if (gl_tex->mTexOptionsDirty)
{
gl_tex->mTexOptionsDirty = false;
setTextureAddressModeFast(gl_tex->mAddressMode);
setTextureFilteringOptionFast(gl_tex->mFilterOption);
setTextureAddressModeFast(gl_tex->mAddressMode, gl_tex->getTarget());
setTextureFilteringOptionFast(gl_tex->mFilterOption, gl_tex->getTarget());
}
}

Expand Down Expand Up @@ -467,16 +467,16 @@ void LLTexUnit::setTextureAddressMode(eTextureAddressMode mode)

activate();

setTextureAddressModeFast(mode);
setTextureAddressModeFast(mode, mCurrTexType);
}

void LLTexUnit::setTextureAddressModeFast(eTextureAddressMode mode)
void LLTexUnit::setTextureAddressModeFast(eTextureAddressMode mode, eTextureType tex_type)
{
glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_WRAP_S, sGLAddressMode[mode]);
glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_WRAP_T, sGLAddressMode[mode]);
if (mCurrTexType == TT_CUBE_MAP)
glTexParameteri(sGLTextureType[tex_type], GL_TEXTURE_WRAP_S, sGLAddressMode[mode]);
glTexParameteri(sGLTextureType[tex_type], GL_TEXTURE_WRAP_T, sGLAddressMode[mode]);
if (tex_type == TT_CUBE_MAP || tex_type == TT_CUBE_MAP_ARRAY || tex_type == TT_TEXTURE_3D)
{
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, sGLAddressMode[mode]);
glTexParameteri(sGLTextureType[tex_type], GL_TEXTURE_WRAP_R, sGLAddressMode[mode]);
Copy link
Preview

Copilot AI Sep 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 479 uses sGLTextureType[tex_type] but should use GL_TEXTURE_CUBE_MAP for cube maps to match the original behavior. The original code specifically used GL_TEXTURE_CUBE_MAP for the R coordinate, which may be required for proper cube map handling.

Suggested change
glTexParameteri(sGLTextureType[tex_type], GL_TEXTURE_WRAP_R, sGLAddressMode[mode]);
glTexParameteri(
tex_type == TT_CUBE_MAP ? GL_TEXTURE_CUBE_MAP : sGLTextureType[tex_type],
GL_TEXTURE_WRAP_R,
sGLAddressMode[mode]);

Copilot uses AI. Check for mistakes.

}
}

Expand All @@ -486,56 +486,56 @@ void LLTexUnit::setTextureFilteringOption(LLTexUnit::eTextureFilterOptions optio

gGL.flush();

setTextureFilteringOptionFast(option);
setTextureFilteringOptionFast(option, mCurrTexType);
}

void LLTexUnit::setTextureFilteringOptionFast(LLTexUnit::eTextureFilterOptions option)
void LLTexUnit::setTextureFilteringOptionFast(LLTexUnit::eTextureFilterOptions option, eTextureType tex_type)
{
if (option == TFO_POINT)
{
glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(sGLTextureType[tex_type], GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}
else
{
glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(sGLTextureType[tex_type], GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}

if (option >= TFO_TRILINEAR && mHasMipMaps)
{
glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(sGLTextureType[tex_type], GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
}
else if (option >= TFO_BILINEAR)
{
if (mHasMipMaps)
{
glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
glTexParameteri(sGLTextureType[tex_type], GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
}
else
{
glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(sGLTextureType[tex_type], GL_TEXTURE_MIN_FILTER, GL_LINEAR);
}
}
else
{
if (mHasMipMaps)
{
glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
glTexParameteri(sGLTextureType[tex_type], GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
}
else
{
glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(sGLTextureType[tex_type], GL_TEXTURE_MIN_FILTER, GL_NEAREST);
}
}

if (gGLManager.mHasAnisotropic)
{
if (LLImageGL::sGlobalUseAnisotropic && option == TFO_ANISOTROPIC)
{
glTexParameterf(sGLTextureType[mCurrTexType], GL_TEXTURE_MAX_ANISOTROPY, gGLManager.mMaxAnisotropy);
glTexParameterf(sGLTextureType[tex_type], GL_TEXTURE_MAX_ANISOTROPY, gGLManager.mMaxAnisotropy);
}
else
{
glTexParameterf(sGLTextureType[mCurrTexType], GL_TEXTURE_MAX_ANISOTROPY, 1.f);
glTexParameterf(sGLTextureType[tex_type], GL_TEXTURE_MAX_ANISOTROPY, 1.f);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions indra/llrender/llrender.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,14 @@ class LLTexUnit
// 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);
void setTextureAddressModeFast(eTextureAddressMode mode, eTextureType tex_type);

// 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);
void setTextureFilteringOptionFast(LLTexUnit::eTextureFilterOptions option, eTextureType tex_type);

static U32 getInternalType(eTextureType type);

Expand Down
2 changes: 1 addition & 1 deletion indra/newview/pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ bool LLPipeline::allocateScreenBufferInternal(U32 resX, U32 resY)

GLuint screenFormat = hdr ? GL_RGBA16F : GL_RGBA;

if (!mRT->screen.allocate(resX, resY, screenFormat)) return false;
if (!mRT->screen.allocate(resX, resY, GL_RGBA16F)) return false;
Copy link
Preview

Copilot AI Sep 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hardcoded GL_RGBA16F format ignores the computed screenFormat variable on line 859. This creates dead code and makes the HDR conditional logic meaningless. Either remove the unused variable or use it in the allocation call to maintain the intended behavior.

Suggested change
if (!mRT->screen.allocate(resX, resY, GL_RGBA16F)) return false;
if (!mRT->screen.allocate(resX, resY, screenFormat)) return false;

Copilot uses AI. Check for mistakes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line reverts to the behavior in the release/2025.06 branch, which does seem relatively safe on its own.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm concerned that the bool hdr initialization on line 812 wasn't corrected. I don't think we should force the render target format to be HDR all the time. On machines where we have forcibly downgraded them to OpenGL 3.1 Fallback Mode in order to avoid crashiness, I think we probably need to keep hdr screen format off. Possibly it should be changed to something like this?

    bool hdr = gGLManager.mGLVersion > 3.1f;

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RyeMutt am I understanding this correctly?


mRT->deferredScreen.shareDepthBuffer(mRT->screen);

Expand Down