Merge remote-tracking branch 'origin/master' into FIRE-35794

master
Beq 2025-10-01 17:42:39 +01:00
commit 4098a28082
11 changed files with 56 additions and 13 deletions

View File

@ -90,7 +90,7 @@ jobs:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Setup python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: "3.11"

View File

@ -73,7 +73,7 @@ jobs:
- name: Set up Python (normal case)
if: matrix.container_image != 'ubuntu:22.04'
id: py311_setup
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: '3.11'
check-latest: true

View File

@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check PR description
uses: actions/github-script@v7
uses: actions/github-script@v8
with:
script: |
const description = context.payload.pull_request.body || '';

View File

@ -9,7 +9,7 @@ jobs:
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5
- uses: actions/labeler@v6
with:
configuration-path: .github/labeler.yaml
repo-token: "${{ secrets.GITHUB_TOKEN }}"

View File

@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v5
- uses: actions/setup-python@v6
with:
python-version: 3.x
- uses: pre-commit/action@v3.0.1

View File

@ -12,7 +12,7 @@ jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v9
- uses: actions/stale@v10
id: stale
with:
stale-pr-message: This pull request is stale because it has been open 30 days with no activity. Remove stale label or comment or it will be closed in 7 days

View File

@ -35,7 +35,7 @@ jobs:
echo NIGHTLY_DATE=${NIGHTLY_DATE} >> ${GITHUB_ENV}
echo TAG_ID="$(echo ${{ github.sha }} | cut -c1-8)-${{ inputs.project || '${NIGHTLY_DATE}' }}" >> ${GITHUB_ENV}
- name: Update Tag
uses: actions/github-script@v7.0.1
uses: actions/github-script@v8
with:
# use a real access token instead of GITHUB_TOKEN default.
# required so that the results of this tag creation can trigger the build workflow

View File

@ -641,6 +641,11 @@ bool LLImageGL::setSize(S32 width, S32 height, S32 ncomponents, S32 discard_leve
if(discard_level > 0)
{
mMaxDiscardLevel = llmax(mMaxDiscardLevel, (S8)discard_level);
// <FS:minerjr> [FIRE-35361] RenderMaxTextureResolution caps texture resolution lower than intended
// 2K textures could set the mMaxDiscardLevel above MAX_DISCARD_LEVEL, which would
// cause them to not be down-scaled so they would get stuck at 0 discard all the time.
mMaxDiscardLevel = llmin(mMaxDiscardLevel, (S8)MAX_DISCARD_LEVEL);
// </FS:minerjr> [FIRE-35361]
}
}
else
@ -1543,7 +1548,7 @@ bool LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S
if (discard_level < 0)
{
llassert(mCurrentDiscardLevel >= 0);
discard_level = mCurrentDiscardLevel;
discard_level = llmin(mCurrentDiscardLevel, MAX_DISCARD_LEVEL);
}
// Actual image width/height = raw image width/height * 2^discard_level
@ -1643,6 +1648,7 @@ bool LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, bool data_
discard_level = mCurrentDiscardLevel;
}
discard_level = llclamp(discard_level, 0, (S32)mMaxDiscardLevel);
discard_level = llmin(discard_level, MAX_DISCARD_LEVEL);
if (main_thread // <--- always force creation of new_texname when not on main thread ...
&& !defer_copy // <--- ... or defer copy is set

View File

@ -2095,6 +2095,30 @@ LLPointer<LLImageRaw> LLTextureCache::readFromFastCache(const LLUUID& id, S32& d
}
LLPointer<LLImageRaw> raw = new LLImageRaw(data, head[0], head[1], head[2], true);
// <FS:minerjr>
// This fixes the invalid discard values from being created which cause the decoder code to fail when trying to handle 6 and 7's which are above the MAX_DISCARD_LEVEL of 5
// especially on load
// We will expand the 16x16 texture to the actual MAX_DISCARD_LEVEL texture size, it may be blurry until the user gets closer but 5 discard value should be objects far from the camera.
// So a 1024x1024 texture with a dicard of 6 will become 32x32 and a 2048x2048 texture with a discard of 7 will become a 64x64 texture.
if (discardlevel > MAX_DISCARD_LEVEL)
{
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("FixBadDiscardLevel");
S32 w = head[0]; // Get the current width from the header (16)
S32 h = head[1]; // Get the current height from the header (16)
// Expand the width and height by teh difference between the discard and MAX_DISCARD_LEVEL bit shifted to the left. (Expand power of 2 textures)
w <<= discardlevel - MAX_DISCARD_LEVEL;
h <<= discardlevel - MAX_DISCARD_LEVEL;
// Set the discard level to the MAX_DISCARD_LEVEL
discardlevel = MAX_DISCARD_LEVEL;
// Scale up the texture and scale the actual data, as we just created it above, it should be fine.
raw->scale(w, h, true);
}
// </FS:minerjr>
return raw;
}

View File

@ -1898,10 +1898,10 @@ bool LLTextureFetchWorker::doWork(S32 param)
mHttpReplyOffset = 0;
mLoadedDiscard = mRequestedDiscard;
if (mLoadedDiscard < 0)
if (mLoadedDiscard < 0 || (mLoadedDiscard > MAX_DISCARD_LEVEL && mFormattedImage->getCodec() == IMG_CODEC_J2C))
{
LL_WARNS(LOG_TXT) << mID << " mLoadedDiscard is " << mLoadedDiscard
<< ", should be >=0" << LL_ENDL;
<< ", should be >=0 and <=" << MAX_DISCARD_LEVEL << LL_ENDL;
}
setState(DECODE_IMAGE);
if (mWriteToCacheState != NOT_WRITE)
@ -1963,14 +1963,27 @@ bool LLTextureFetchWorker::doWork(S32 param)
LL_DEBUGS(LOG_TXT) << mID << " DECODE_IMAGE abort: mLoadedDiscard < 0" << LL_ENDL;
return true;
}
llassert_always(mFormattedImage.notNull());
S32 discard = mHaveAllData && mFormattedImage->getCodec() != IMG_CODEC_J2C ? 0 : mLoadedDiscard;
if (discard > MAX_DISCARD_LEVEL) // only warn for j2c
{
// We encode j2c with fixed amount of discard levels,
// Trying to decode beyound that will fail.
LL_WARNS(LOG_TXT) << "Decode entered with invalid discard. ID = " << mID << LL_ENDL;
//abort, don't decode
setState(DONE);
LL_DEBUGS(LOG_TXT) << mID << " DECODE_IMAGE abort: mLoadedDiscard > MAX_DISCARD_LEVEL" << LL_ENDL;
return true;
}
mDecodeTimer.reset();
mRawImage = NULL;
mAuxImage = NULL;
llassert_always(mFormattedImage.notNull());
// if we have the entire image data (and the image is not J2C), decode the full res image
// DO NOT decode a higher res j2c than was requested. This is a waste of time and memory.
S32 discard = mHaveAllData && mFormattedImage->getCodec() != IMG_CODEC_J2C ? 0 : mLoadedDiscard;
mDecoded = false;
setState(DECODE_IMAGE_UPDATE);
LL_DEBUGS(LOG_TXT) << mID << ": Decoding. Bytes: " << mFormattedImage->getDataSize() << " Discard: " << discard

View File

@ -2188,7 +2188,7 @@ bool LLViewerFetchedTexture::updateFetch()
static LLCachedControl<U32> sTextureDiscardLevel(gSavedSettings, "TextureDiscardLevel");
const U32 override_tex_discard_level = sTextureDiscardLevel();
// </FS:Ansariel>
if (override_tex_discard_level != 0)
if (override_tex_discard_level != 0 && override_tex_discard_level <= MAX_DISCARD_LEVEL)
{
desired_discard = override_tex_discard_level;
}