* updateImageDecodePriority - Avoid Long Face Loop
To avoid running a long loop on thousands of faces, some textures were being set to a BOOST level to avoid the updateImageDecodePriority function entirely but this was causing many of them to never be deleted over the course of a user's travels.
Instead of relying on BOOST, this commit changes the logic of the texture channel loop such that the face loop will only run if the number of faces is below the threshold.
To do this, we move the face_count incrementing outside of the face loop into the channel loop and increment it using the getNumFaces function instead.
We then check the face_count against the maximum number of faces we want to check and if it exceeds the number we set the number of faces for the face loop to check down to zero.
This avoids branch prediction misses and the long face loop issue.
Later, if the face_count is above the threshold, we assign the virtual size to the maximum.
I personally believe the max_faces_to_check should be lower than 1024, but I left that value in for continuity. I use 64 faces as my max on my compiled version of the viewer without any noticeable issues for memory use.
* updateImageDecodePriority - Face Loop Increment Swap
Looks like compilers like knowing the incrementing in the for loop information for optimizations and parallelization.
Sorry for the tiny commit.
* updateImageDecodePriority - Suggested Cleanup
Remove trailing white-space.
Co-authored-by: Andrey Lihatskiy <alihatskiy@productengine.com>
Fix for the mega prims.
Issue was cause by Linux reporting 0 GB of VRAM which forces texture compression on.
Texture compression affects the textures used for the generation of the mesh for the sculpted textures.
When sculpted image created, added check to turn off compression for the texture.
Also fixed issues where Sculpted textures loaded from fast cache would also cause artifacts. Disabled writing sculpted textures to fast cache.
Cleaned up the Dump function to instead of using strings, use newer std::format to be cleaner writing to the log as well as use LL_CONT to use logic while writing to the data log.
Added new chart to the LLViewerTextureList::Dump for Comparing Full Size vs the current Discard Level
Also added a few labels to the other comparison tables.
Updated the LLViewerTextureList::dump() to support tracking the # of textures at all possible boost levels vs. b 12 possible sizes
Cleaned up the code a bit for the headers to scale to the width of the table
Changed the array's from C array's to std::array's... old habits die hard.
Also clarified a set of comments.
Fixed up white spaces being added. Visual studio 2022 is inserting them and not sure why.
Added table to show horizonal size X vertical size counts
Added table to show discard level vs size counts
Added -1 as a valid discard level (this was causing possible crashes by not handling)
Added extra # of discard levels to handle larger texture sizes (2048 can scale down to 7, 4096 to 8 and invalid sizes can go +1 more)
Fixed out of bounds and possible buffer overflow issue due to getCurrentDiscard having -1 to > MAX_DISCARD_LEVEL + 1 be outputs.
Reverted change to the LLViewerTextureList's updateImageFetchTextures which was intended to skip processing UI textures to downscale as they don't need to be changed, but the problem is if a new local texture is created it does not get processed.
Added new boost levels for Tree, Grass and Light textures (More for tracking as they have custom hard coded values for the mPixelArea which causes issues with loading of sizes.
Added adjustments for the calcPixelArea and calcImportanceToCamera as well as getTextureVirtualSize
Added virtual texture size updates for Media textures
Added code to scale down off screen textures (saves a lot of texture VRAM.
Added additional features for the LLViewerTextureList::Dump
Only issue is server controlled textures which animate tend to load low quality, then upscale as well as Sculpted Volume's which force textures to reload.
Added new calculation to the LLCamera for draw distance multiplier
Removed the Inverse aspect as not longer used
Modified the LLFace to no long user the inverse aspect.
Updated mInFrustum to use mImportanceToCamera as it was correct
LLViewerCamera removed the mCosCameraFOV (not used anymore)
Added LLViewerMenu option under Developer->Dump->Texture List to dump texture list to info for debugging.
LLViewerTexture viewer for LOD textures, now loops to make the texture fit to cover the max discard value instead of calculating with logs and divisions.
LLViewerTextureList updated to to dump texture list to the Infos, and updated to boost for not only textures based upon the importance to the camera, but to boost a second time for textures close to the camera. Also capped the mMaxVirtualSize to try to help track down texture size changes
Updated LLPipeline to use same getDrawDistanceMultiplier as the texture calcPixelArea code.
Fixed up animations to always be running, so they should not stutter or be in odd places when turning the camera.
May need to revise the mInFrustum as trying to make sure it's within the actual visual location. Need to test with
Changed the textures to divide the texture vsize by the Aspect Ratio and Fields of view. to better control when a texture needs to be scaled down.
Fixed issue when low screen image size could cause an assert on the on screen console due to negative sizes(Calculated to -30 from the value and code that uses the negative location
Updated the logic in LLViewerObjectList to fix the issue of mObjects being modified at possibly any time by the code it calling.
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.
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)