Refined the logic for the textures to include animated textures to not be downscaled They are not forced to be high boost level.
Update the logic of how to process the on screen max vsize to be simpler.
Added split time max_time for the updateImagesCreateTextures, as originally they were two different functions and can save doubled the time for each.
Added time limit on LLViewerObjectList::updateApparentAngles, as it it affects the Textures in the texture list and worked on a fixed # of objects per frame and each object is variable in the amount of processing required, affecting frame rate and # of textures updated.
The manual control for the Limit VRAM texture usage in the Preferences->Graphics->Hardware Settings did not restore the saved value of the slider upload load.
So when the viewer would load, it would indeed load the saved value, but the value was not reflected upon by the slider on the page. This caused issues of when a user went to move the slide back to it's intended position it would set off the bias system as well as make the user not have confidence in that the feature is working.
Added a call to the ser value of the UI control on refresh enable state of the UI floater for the preferences to the saved RenderMaxVRAMBudget.
Updated the math to remove the need to store the variable and use it again
Updated the "TextureCameraBoost" to default to 7, as we add 1 to the value now instead of using max (TextureCameraBoost, 1.0f)
Cleaned up the logic to be 1, cleaner and 2, more performant.
Moved allocations outside the loop as well as the static texture_camera_boost setup as it should be only done once and not every time a face is on screen.
Cleaned up switch statements into couple of if statements as switch logic would be only good if only 1 level to be used.
Added new logic in the LLViewerTextureList::updateImageDecodePriority method to better handle the texture quality.
- Apply new rules to bias discard, there are now 2 bias, off-screen and on-screen.
On-screen Bias
Only applied to LOD Textures and one that have Discard > 1 (0, 1 protected)
- Off-screen Bias
Will be using the old method of applying the mMaxVirtualSize, however
only on LOD textures and fetched textures get bias applied.
Local (UI & Icons), Media and Dynamic textures should not have any discard applied to them.
Without this, textures will become blurry that are on screen, which is one of the #1 user complaints.
So now, only LOD textures will change on screen, except for Fetched textures when the bias is greater then 2.00.
Also made possible fix for edge case of multiple faces for 1 texture, the last face dictates which happens to the texture. Now any that are in camera will flip signal that it is on screen.
System can be made to be be flexible.
To test out, Go to Preferences->Graphics->Rendering Settings and move the VRAM override to the far left. Then walk around and try to notice if there are any downscaled or blurry textures. To test a blurry object. Right click on it and pick edit. All of the game objects will have a max quality texture applied. Click off and see if the texture on the object changes quality to a blurred mess.
When saving textures to the fast cache, which only supports 16x16 textures at 4 bytes per pixel, the system will force scale down textures to fit, even beyond the allowed MAX_DISCARD_LEVEL, such as 1024x1024 having Discard = 6 and 2048x2048 texture having Discard = 7 and writing it to the headers.
Updated the readFromFastCache to expand invalid textures to be at the MAX_DISCARD_LEVEL(5) discard instead of at 6, 7 or 8. Scale up the 16x16 textures to match the requirements for the textures at MAX_DISCARD_LEVEL.
Mostly for re-loading after high bias scenario as these can cause crashes in the KDU decoder codebase. Which can possibly lead to deadlocked threads as well as bad textures clogging up the fetch system.
Example Firestorm.log output of the error in action.
2025-02-21T13:47:43Z INFO LLKDUMessage::put_text : KDU Error: Attempting to access a non-existent resolution level within some tile-component. Problem almost certainly caused by trying to discard more resolution levels than the number of DWT levels used to compress a tile-component.
Exception thrown at 0x00007FFA77A1BB0A in firestorm-bin.exe: Microsoft C++ exception: boost::wrapexcept<`anonymous namespace'::KDUError> at memory location 0x000000C3985FF470.
2025-02-21T13:47:43Z WARNING LLTextureFetchWorker::callbackDecoded : DECODE FAILED: 0c699ab7-dd72-bfc9-d695-267e1a3f936a Discard: 6, reason: LLKDUMessageError::flush()
2025-02-21T13:47:43Z WARNING _ll_apr_warn_status : APR: firestorm\phoenix-firestorm-foreverfps\indra\llcommon\llapr.cpp:651 The system cannot find the file specified.
2025-02-21T13:47:43Z WARNING LLAPRFile::remove : Attempting to remove filename: AppData\Local\FirestormOS_x64\texturecache\0\0c699ab7-dd72-bfc9-d695-267e1a3f936a.texture
2025-02-21T13:47:43Z INFO LLKDUMessage::put_text : KDU Error: Kakadu Core Error:
Added to the llgltexture a second boost level which will be used to properly restore the boost level after an object is right clicked on as the BOOST_SELECTED code does not restore the value the previous value. This does now and on all the child objects assigned to the object.
Also fixed up the lltextureview.cpp as it had some merge issues from a long time ago and was missed.
Fixed the blurry texture issue with a couple of fixes.
Objects selected by by the user would gain a BOOST_SELECTED boost level, but when unselected the system did not store the old value and would get turned to BOOST_NONE which allows the Bias system to further downscale the image lower then the original size.
Upon first loading a texture, if the desired size was lower then what was decoded, it would auto scale down the new texture, without first validating if the texture was allowed to be scaled down due to type of texture.
Further, the rules applied to the LLViewerTextureList::updateImageDecodePriority would apply to all textures on screen no matter what type as long as the boost was lower then BOOST_HIGH.
Changes include new mPrevBoostLevel for any texture with accessor methods to restore the values and updated the code which first set's the boost level to BOOST_SELECTED to store the boost level of all affected objects before changing the boost level.
Added LL's "Fix" for the bias by forcing to to stay static if VRAM or System RAM is at 10% of max.
Added logic to the updateImageDecodePriority to not apply bias to non LOD textures as well as any texture which has a current discard of 0 or 1, so not to blur high res images close to the screen.
Added logic to updateImagesCreateTextures to only scale down LOD textures which have a boost level < BOOST_HIGH
Added sPrevDesiredDiscardBiasto keep track other previous bias value before it was updated to allow for better control of the system handling bias effects such if the bias value is not chanigng, use the normal number of texture updates.
Fixed up the Developer -> Consoles -> Texture Console to have correct values for the
llformat("Tex: %d Fetch: %d(%d) Pkts:%d(%d) CAC R/W: %d/%d LFS:%d RAW:%d HTP:%d DEC:%d CRE:%d FCA:%d ",
line.