secondlife / secondlife/viewer

OpenGL Error in lldrawpoolwater.cpp

Open
#4,342 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug maint-pe stale team:viewer
Dominant language
C++
Stars
299
Forks
146
Avg merge
1d 9h
Merged PRs (30d)
88

Description

As an effort to chase down opengl errors while working on megapahit, i found this one among others that i could fix, but this one, i am not sure what to do with it : so this is in lldrawpoolwater.cpp, lines 209 and 210.

shader->bindTexture(LLViewerShaderMgr::BUMP_MAP, tex_a);

this line is binding the texture it calls a bindfast()), then the next line will set its filtering options:

tex_a->setFilteringOption(filter_mode);

Problem is, when transparent water is turned OFF, this call will generate an invalid_enum error in llrender.cpp : void LLTexUnit::setTextureFilteringOption(....)

The reason why is, when it's called and the transparent water options is OFF, the mCurrTexType is equal to TT_NONE, which indicates the texture unit isn't active.

subsequent calls to glTexParameteri(...) generate an invalid_enum error, since the target is invalid (sGLTextureType[mCurrTexType]).

So it appears, for some reason shader->bindTexture(LLViewerShaderMgr::BUMP_MAP, tex_a); doesn't succeed at enabling the texture.

I saw this on Mac, i can't say if it happens on other platforms.

Also i didn't "explicitly" see this error in SLv, but it's most certainly present as the relative code in megapahit is identical and based on 7.1.15.

This has been around for several updates ( at least 7.1.13 ), i couldn't say if older.

In some cases it leads to performance drop when water transparency is OFF, but .. not always ... might depend on a combination of settings.

I thought i would share this as the engineers who worked on this would certainly know better than me.

https://secondlife.canny.io/admin/board/bug-reports/p/opengl-error-in-lldrawpoolwatercpp

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lldrawpoolwater.cpp at lines 209-210 and trace shader->bindTexture(LLViewerShaderMgr::BUMP_MAP, tex_a) into llrender.cpp, especially LLTexUnit::setTextureFilteringOption. Reproduce with transparent water turned off, including on Mac if possible. Done means the path no longer produces an invalid_enum error or the reported performance drop.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.