summaryrefslogtreecommitdiff
path: root/indra/newview/llviewertexturelist.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewertexturelist.cpp')
-rw-r--r--indra/newview/llviewertexturelist.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index e4fd947892..7dd32074cf 100644
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -1014,6 +1014,38 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag
}
imagep->addTextureStats(max_vsize);
+
+ // Derive stream priority channel from face lists.
+ // Map render texture channels to priority channels:
+ // 0 = normal, 1 = diffuse, 2 = specular, 3 = emissive
+ {
+ static const S32 render_to_priority[] = {
+ 1, // DIFFUSE_MAP (0)
+ 0, // NORMAL_MAP / ALTERNATE_DIFFUSE_MAP (1)
+ 2, // SPECULAR_MAP (2)
+ 1, // BASECOLOR_MAP (3)
+ 2, // METALLIC_ROUGHNESS_MAP (4)
+ 0, // GLTF_NORMAL_MAP (5)
+ 3, // EMISSIVE_MAP (6)
+ };
+
+ S32 priority_channel = 1; // default to diffuse
+ for (U32 i = 0; i < LLRender::NUM_TEXTURE_CHANNELS; ++i)
+ {
+ if (imagep->getNumFaces(i) > 0)
+ {
+ priority_channel = llmin(priority_channel, render_to_priority[i]);
+ }
+ }
+
+ static LLCachedControl<LLVector4> channel_priority(gSavedSettings, "TextureChannelPriority",
+ LLVector4(10.0f, 20.0f, 40.0f, 20.0f));
+ F32 factor = llmax(channel_priority().mV[priority_channel], 0.1f);
+ if (factor != 1.0f)
+ {
+ imagep->mMaxVirtualSize /= factor;
+ }
+ }
}
#if 0